Search in sources :

Example 1 with MonitoringFeature

use of org.glassfish.jersey.server.internal.monitoring.MonitoringFeature 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));
}
Also used : MonitoringFeature(org.glassfish.jersey.server.internal.monitoring.MonitoringFeature) ApplicationInfoListener(org.glassfish.jersey.server.internal.monitoring.ApplicationInfoListener) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) MonitoringEventListener(org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener) MBeanExposer(org.glassfish.jersey.server.internal.monitoring.jmx.MBeanExposer) Test(org.junit.Test)

Example 2 with MonitoringFeature

use of org.glassfish.jersey.server.internal.monitoring.MonitoringFeature 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));
}
Also used : MonitoringFeature(org.glassfish.jersey.server.internal.monitoring.MonitoringFeature) ApplicationInfoListener(org.glassfish.jersey.server.internal.monitoring.ApplicationInfoListener) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) MonitoringEventListener(org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener) MBeanExposer(org.glassfish.jersey.server.internal.monitoring.jmx.MBeanExposer) Test(org.junit.Test)

Example 3 with MonitoringFeature

use of org.glassfish.jersey.server.internal.monitoring.MonitoringFeature 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));
}
Also used : MonitoringFeature(org.glassfish.jersey.server.internal.monitoring.MonitoringFeature) ApplicationInfoListener(org.glassfish.jersey.server.internal.monitoring.ApplicationInfoListener) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) MonitoringEventListener(org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener) MBeanExposer(org.glassfish.jersey.server.internal.monitoring.jmx.MBeanExposer) Test(org.junit.Test)

Example 4 with MonitoringFeature

use of org.glassfish.jersey.server.internal.monitoring.MonitoringFeature in project jersey by jersey.

the class MonitoringFeatureTest method testStatisticsEnabledMbeansEnabledByInstance.

@Test
public void testStatisticsEnabledMbeansEnabledByInstance() {
    final ResourceConfig resourceConfig = new ResourceConfig();
    final MonitoringFeature monitoringFeature = new MonitoringFeature();
    monitoringFeature.setmBeansEnabled(true);
    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));
}
Also used : MonitoringFeature(org.glassfish.jersey.server.internal.monitoring.MonitoringFeature) ApplicationInfoListener(org.glassfish.jersey.server.internal.monitoring.ApplicationInfoListener) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) MonitoringEventListener(org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener) MBeanExposer(org.glassfish.jersey.server.internal.monitoring.jmx.MBeanExposer) Test(org.junit.Test)

Example 5 with MonitoringFeature

use of org.glassfish.jersey.server.internal.monitoring.MonitoringFeature in project jersey by jersey.

the class MonitoringFeatureTest method testAllDisabled.

@Test
public void testAllDisabled() {
    final ResourceConfig resourceConfig = new ResourceConfig();
    final MonitoringFeature monitoringFeature = new MonitoringFeature();
    monitoringFeature.setmBeansEnabled(true);
    resourceConfig.register(monitoringFeature);
    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.assertTrue(config.isRegistered(ApplicationInfoListener.class));
    Assert.assertFalse(config.isRegistered(MonitoringEventListener.class));
    Assert.assertFalse(config.isRegistered(MBeanExposer.class));
}
Also used : MonitoringFeature(org.glassfish.jersey.server.internal.monitoring.MonitoringFeature) ApplicationInfoListener(org.glassfish.jersey.server.internal.monitoring.ApplicationInfoListener) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) MonitoringEventListener(org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener) MBeanExposer(org.glassfish.jersey.server.internal.monitoring.jmx.MBeanExposer) Test(org.junit.Test)

Aggregations

ApplicationHandler (org.glassfish.jersey.server.ApplicationHandler)6 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)6 ApplicationInfoListener (org.glassfish.jersey.server.internal.monitoring.ApplicationInfoListener)6 MonitoringEventListener (org.glassfish.jersey.server.internal.monitoring.MonitoringEventListener)6 MonitoringFeature (org.glassfish.jersey.server.internal.monitoring.MonitoringFeature)6 MBeanExposer (org.glassfish.jersey.server.internal.monitoring.jmx.MBeanExposer)6 Test (org.junit.Test)6