use of com.hazelcast.client.config.ClientMetricsConfig in project hazelcast by hazelcast.
the class ClientMetricsPropertiesTest method testInvalidConfigPropertiesIgnored.
@Test
public void testInvalidConfigPropertiesIgnored() {
// setting non-defaults
clientConfig.setProperty(ClientProperty.METRICS_ENABLED.getName(), "invalid");
clientConfig.setProperty(ClientProperty.METRICS_JMX_ENABLED.getName(), "invalid");
clientConfig.setProperty(ClientProperty.METRICS_COLLECTION_FREQUENCY.getName(), "invalid");
HazelcastClientProxy client = createClient();
MetricsConfig defaultConfig = new MetricsConfig();
// booleans result in false values even though they're "invalid"
// therefore, all boolean config fields are set to false
assertFalse(originalMetricsConfig.isEnabled());
assertFalse(originalMetricsConfig.getJmxConfig().isEnabled());
assertEquals(defaultConfig.getCollectionFrequencySeconds(), originalMetricsConfig.getCollectionFrequencySeconds());
// verify that the overridden config is used
ClientMetricsConfig metricsConfigUsed = client.client.getClientStatisticsService().getMetricsConfig();
assertSame(originalMetricsConfig, metricsConfigUsed);
}
use of com.hazelcast.client.config.ClientMetricsConfig in project hazelcast by hazelcast.
the class ClientDomConfigProcessor method handleMetrics.
private void handleMetrics(Node node) {
ClientMetricsConfig metricsConfig = clientConfig.getMetricsConfig();
NamedNodeMap attributes = node.getAttributes();
for (int a = 0; a < attributes.getLength(); a++) {
Node att = attributes.item(a);
if (matches("enabled", att.getNodeName())) {
boolean enabled = getBooleanValue(getAttribute(node, "enabled"));
metricsConfig.setEnabled(enabled);
}
}
for (Node child : childElements(node)) {
String nodeName = cleanNodeName(child);
if (matches("jmx", nodeName)) {
handleMetricsJmx(child);
} else if (matches("collection-frequency-seconds", nodeName)) {
metricsConfig.setCollectionFrequencySeconds(Integer.parseInt(getTextContent(child)));
}
}
}
use of com.hazelcast.client.config.ClientMetricsConfig in project hazelcast by hazelcast.
the class ClientMetricsPropertiesTest method testInvalidSystemPropertiesIgnored.
@Test
public void testInvalidSystemPropertiesIgnored() {
// setting non-defaults
System.setProperty(ClientProperty.METRICS_ENABLED.getName(), "invalid");
System.setProperty(ClientProperty.METRICS_JMX_ENABLED.getName(), "invalid");
System.setProperty(ClientProperty.METRICS_COLLECTION_FREQUENCY.getName(), "invalid");
HazelcastClientProxy client = createClient();
ClientConfig config = client.getClientConfig();
ClientMetricsConfig defaultConfig = new ClientMetricsConfig();
// booleans result in false values even though they're "invalid"
// therefore, all boolean config fields are set to false
ClientMetricsConfig metricsConfig = config.getMetricsConfig();
assertFalse(metricsConfig.isEnabled());
assertFalse(metricsConfig.getJmxConfig().isEnabled());
assertEquals(defaultConfig.getCollectionFrequencySeconds(), metricsConfig.getCollectionFrequencySeconds());
// verify that the overridden config is used
ClientMetricsConfig metricsConfigUsed = client.client.getClientStatisticsService().getMetricsConfig();
assertSame(originalMetricsConfig, metricsConfigUsed);
}
use of com.hazelcast.client.config.ClientMetricsConfig in project hazelcast by hazelcast.
the class ClientMetricsPropertiesTest method testDeprecatedPropertiesIgnored_whenNewPropertiesGiven.
@Test
public void testDeprecatedPropertiesIgnored_whenNewPropertiesGiven() {
clientConfig.setProperty(ClientProperty.STATISTICS_ENABLED.getName(), "true");
clientConfig.setProperty(ClientProperty.STATISTICS_PERIOD_SECONDS.getName(), "24");
clientConfig.setProperty(ClientProperty.METRICS_ENABLED.getName(), "false");
clientConfig.setProperty(ClientProperty.METRICS_COLLECTION_FREQUENCY.getName(), "30");
HazelcastClientProxy client = createClient();
ClientConfig clientConfig = client.getClientConfig();
ClientMetricsConfig metricsConfig = clientConfig.getMetricsConfig();
assertFalse(metricsConfig.isEnabled());
assertEquals(30, metricsConfig.getCollectionFrequencySeconds());
}
Aggregations