use of org.apache.sling.commons.metrics.Meter in project sling by apache.
the class MetricServiceTest method jmxRegistration.
@Test
public void jmxRegistration() throws Exception {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
activate();
Meter meter = service.meter("test");
assertNotNull(meter);
QueryExp q = Query.isInstanceOf(Query.value(JmxReporter.JmxMeterMBean.class.getName()));
Set<ObjectName> names = server.queryNames(new ObjectName("org.apache.sling:name=*,type=" + JMX_TYPE_METRICS), q);
assertThat(names, is(not(empty())));
MockOsgi.deactivate(service, context.bundleContext());
names = server.queryNames(new ObjectName("org.apache.sling:name=*"), q);
assertThat(names, is(empty()));
}
use of org.apache.sling.commons.metrics.Meter in project sling by apache.
the class MetricServiceTest method meter.
@Test
public void meter() throws Exception {
activate();
Meter meter = service.meter("test");
assertNotNull(meter);
assertTrue(getRegistry().getMeters().containsKey("test"));
assertSame(meter, service.meter("test"));
}
Aggregations