use of com.hazelcast.config.MetricsConfig in project hazelcast by hazelcast.
the class MetricsPropertiesTest method testSystemPropertiesOverrideConfig.
@Test
public void testSystemPropertiesOverrideConfig() {
// setting non-defaults
System.setProperty(ClusterProperty.METRICS_ENABLED.getName(), "false");
System.setProperty(ClusterProperty.METRICS_MC_ENABLED.getName(), "false");
System.setProperty(ClusterProperty.METRICS_MC_RETENTION.getName(), "42");
System.setProperty(ClusterProperty.METRICS_JMX_ENABLED.getName(), "false");
System.setProperty(ClusterProperty.METRICS_COLLECTION_FREQUENCY.getName(), "24");
HazelcastInstance instance = createHazelcastInstance();
Config instanceConfig = instance.getConfig();
MetricsConfig metricsConfig = instanceConfig.getMetricsConfig();
assertFalse(metricsConfig.isEnabled());
assertFalse(metricsConfig.getManagementCenterConfig().isEnabled());
assertEquals(42, metricsConfig.getManagementCenterConfig().getRetentionSeconds());
assertFalse(metricsConfig.getJmxConfig().isEnabled());
assertEquals(24, metricsConfig.getCollectionFrequencySeconds());
// verify that the overridden config is used
MetricsService metricsService = getNodeEngineImpl(instance).getService(MetricsService.SERVICE_NAME);
assertSame(metricsConfig, metricsService.getConfig());
}
use of com.hazelcast.config.MetricsConfig in project hazelcast by hazelcast.
the class MetricsPropertiesTest method testInvalidConfigPropertiesIgnored.
@Test
public void testInvalidConfigPropertiesIgnored() {
Config originalConfig = smallInstanceConfig();
// setting non-defaults
originalConfig.setProperty(ClusterProperty.METRICS_ENABLED.getName(), "invalid");
originalConfig.setProperty(ClusterProperty.METRICS_MC_ENABLED.getName(), "invalid");
originalConfig.setProperty(ClusterProperty.METRICS_MC_RETENTION.getName(), "invalid");
originalConfig.setProperty(ClusterProperty.METRICS_JMX_ENABLED.getName(), "invalid");
originalConfig.setProperty(ClusterProperty.METRICS_COLLECTION_FREQUENCY.getName(), "invalid");
HazelcastInstance instance = createHazelcastInstance(originalConfig);
Config instanceConfig = instance.getConfig();
MetricsConfig defaultConfig = new MetricsConfig();
// booleans result in false values even though they're "invalid"
// therefore, all boolean config fields are set to false
MetricsConfig metricsConfig = instanceConfig.getMetricsConfig();
assertFalse(metricsConfig.isEnabled());
assertFalse(metricsConfig.getManagementCenterConfig().isEnabled());
assertEquals(defaultConfig.getManagementCenterConfig().getRetentionSeconds(), metricsConfig.getManagementCenterConfig().getRetentionSeconds());
assertFalse(metricsConfig.getJmxConfig().isEnabled());
assertEquals(defaultConfig.getCollectionFrequencySeconds(), metricsConfig.getCollectionFrequencySeconds());
// verify that the overridden config is used
MetricsService metricsService = getNodeEngineImpl(instance).getService(MetricsService.SERVICE_NAME);
assertSame(metricsConfig, metricsService.getConfig());
}
use of com.hazelcast.config.MetricsConfig in project hazelcast by hazelcast.
the class MetricsPropertiesTest method testConfigPropertiesOverrideConfig.
@Test
public void testConfigPropertiesOverrideConfig() {
Config originalConfig = smallInstanceConfig();
// setting non-defaults
originalConfig.setProperty(ClusterProperty.METRICS_ENABLED.getName(), "false");
originalConfig.setProperty(ClusterProperty.METRICS_MC_ENABLED.getName(), "false");
originalConfig.setProperty(ClusterProperty.METRICS_MC_RETENTION.getName(), "42");
originalConfig.setProperty(ClusterProperty.METRICS_JMX_ENABLED.getName(), "false");
originalConfig.setProperty(ClusterProperty.METRICS_COLLECTION_FREQUENCY.getName(), "24");
HazelcastInstance instance = createHazelcastInstance(originalConfig);
Config instanceConfig = instance.getConfig();
MetricsConfig metricsConfig = instanceConfig.getMetricsConfig();
assertFalse(metricsConfig.isEnabled());
assertFalse(metricsConfig.getManagementCenterConfig().isEnabled());
assertEquals(42, metricsConfig.getManagementCenterConfig().getRetentionSeconds());
assertFalse(metricsConfig.getJmxConfig().isEnabled());
assertEquals(24, metricsConfig.getCollectionFrequencySeconds());
// verify that the overridden config is used
MetricsService metricsService = getNodeEngineImpl(instance).getService(MetricsService.SERVICE_NAME);
assertSame(metricsConfig, metricsService.getConfig());
}
Aggregations