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));
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class MonitoringFeatureTest method testMonitoringDisabled.
@Test
public void testMonitoringDisabled() {
final ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.register(MonitoringFeature.class);
resourceConfig.property(ServerProperties.MONITORING_ENABLED, false);
final ApplicationHandler applicationHandler = new ApplicationHandler(resourceConfig);
final ResourceConfig config = applicationHandler.getConfiguration();
Assert.assertFalse(config.isRegistered(ApplicationInfoListener.class));
Assert.assertFalse(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 testAllDisabled3.
@Test
public void testAllDisabled3() {
final ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, false);
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_ENABLED, false);
final ApplicationHandler applicationHandler = new ApplicationHandler(resourceConfig);
final ResourceConfig config = applicationHandler.getConfiguration();
Assert.assertFalse(config.isRegistered(ApplicationInfoListener.class));
Assert.assertFalse(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 testStatisticsEnabledMbeansEnabledByInstance2.
@Test
public void testStatisticsEnabledMbeansEnabledByInstance2() {
final ResourceConfig resourceConfig = new ResourceConfig();
final MonitoringFeature monitoringFeature = new MonitoringFeature();
monitoringFeature.setmBeansEnabled(true);
resourceConfig.register(monitoringFeature);
resourceConfig.property(ServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED, false);
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 ResourceNotFoundTest method testExistingMixedResources.
@Test
public void testExistingMixedResources() throws Exception {
ApplicationHandler app = createMixedApp();
ContainerResponse response;
response = app.apply(RequestContextBuilder.from("/foo", "GET").accept("text/plain").build()).get();
assertEquals(200, response.getStatus());
assertEquals("foo", response.getEntity());
response = app.apply(RequestContextBuilder.from("/dynamic", "GET").accept("text/plain").build()).get();
assertEquals(200, response.getStatus());
assertEquals("dynamic", response.getEntity());
response = app.apply(RequestContextBuilder.from("/foo/bar", "GET").accept("text/plain").build()).get();
assertEquals(200, response.getStatus());
assertEquals("bar", response.getEntity());
response = app.apply(RequestContextBuilder.from("/foo/dynamic", "GET").accept("text/plain").build()).get();
assertEquals(200, response.getStatus());
assertEquals("dynamic", response.getEntity());
}
Aggregations