use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class MonitoringFeatureTest method testStatisticsEnabled.
@Test
public void testStatisticsEnabled() {
final ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.register(MonitoringFeature.class);
final ApplicationHandler applicationHandler = new ApplicationHandler(resourceConfig);
final ResourceConfig config = applicationHandler.getConfiguration();
Assert.assertTrue(config.isRegistered(ApplicationInfoListener.class));
Assert.assertTrue(config.isRegistered(MonitoringEventListener.class));
Assert.assertFalse(config.isRegistered(MBeanExposer.class));
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class MonitoringFeatureTest method testOnlyMBeansEnabled3.
@Test
public void testOnlyMBeansEnabled3() {
final ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, true);
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_ENABLED, false);
resourceConfig.register(new MonitoringFeature());
final ApplicationHandler applicationHandler = new ApplicationHandler(resourceConfig);
final ResourceConfig config = applicationHandler.getConfiguration();
Assert.assertTrue(config.isRegistered(ApplicationInfoListener.class));
Assert.assertTrue(config.isRegistered(MonitoringEventListener.class));
Assert.assertTrue(config.isRegistered(MBeanExposer.class));
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class MonitoringFeatureTest method testMonitoringEnabledByAutodiscovery.
@Test
public void testMonitoringEnabledByAutodiscovery() {
final ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.property(ServerProperties.MONITORING_ENABLED, true);
final ApplicationHandler applicationHandler = new ApplicationHandler(resourceConfig);
final ResourceConfig config = applicationHandler.getConfiguration();
Assert.assertTrue(config.isRegistered(ApplicationInfoListener.class));
Assert.assertTrue(config.isRegistered(MonitoringEventListener.class));
Assert.assertFalse(config.isRegistered(MBeanExposer.class));
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class MonitoringFeatureTest method testAllEnabled2.
@Test
public void testAllEnabled2() {
final ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, true);
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_ENABLED, true);
final MonitoringFeature monitoringFeature = new MonitoringFeature();
monitoringFeature.setmBeansEnabled(false);
resourceConfig.register(monitoringFeature);
final ApplicationHandler applicationHandler = new ApplicationHandler(resourceConfig);
final ResourceConfig config = applicationHandler.getConfiguration();
Assert.assertTrue(config.isRegistered(ApplicationInfoListener.class));
Assert.assertTrue(config.isRegistered(MonitoringEventListener.class));
Assert.assertTrue(config.isRegistered(MBeanExposer.class));
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class MonitoringFeatureTest method testAllEnabled.
@Test
public void testAllEnabled() {
final ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, true);
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_ENABLED, true);
final ApplicationHandler applicationHandler = new ApplicationHandler(resourceConfig);
final ResourceConfig config = applicationHandler.getConfiguration();
Assert.assertTrue(config.isRegistered(ApplicationInfoListener.class));
Assert.assertTrue(config.isRegistered(MonitoringEventListener.class));
Assert.assertTrue(config.isRegistered(MBeanExposer.class));
}
Aggregations