use of javax.management.QueryExp 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()));
}
Aggregations