use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientMetricsPropertiesTest method testSystemPropertiesOverrideConfig.
@Test
public void testSystemPropertiesOverrideConfig() {
// setting non-defaults
System.setProperty(ClientProperty.METRICS_ENABLED.getName(), "false");
System.setProperty(ClientProperty.METRICS_JMX_ENABLED.getName(), "false");
System.setProperty(ClientProperty.METRICS_COLLECTION_FREQUENCY.getName(), "24");
HazelcastClientProxy client = createClient();
ClientConfig clientConfig = client.getClientConfig();
ClientMetricsConfig metricsConfig = clientConfig.getMetricsConfig();
assertFalse(metricsConfig.isEnabled());
assertFalse(metricsConfig.getJmxConfig().isEnabled());
assertEquals(24, metricsConfig.getCollectionFrequencySeconds());
// verify that the overridden config is used
ClientMetricsConfig metricsConfigUsed = client.client.getClientStatisticsService().getMetricsConfig();
assertSame(originalMetricsConfig, metricsConfigUsed);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientMetricsPropertiesTest method testConfigPropertiesOverrideConfig.
@Test
public void testConfigPropertiesOverrideConfig() {
// setting non-defaults
clientConfig.setProperty(ClientProperty.METRICS_ENABLED.getName(), "false");
clientConfig.setProperty(ClientProperty.METRICS_JMX_ENABLED.getName(), "false");
clientConfig.setProperty(ClientProperty.METRICS_COLLECTION_FREQUENCY.getName(), "24");
HazelcastClientProxy client = createClient();
assertFalse(originalMetricsConfig.isEnabled());
assertFalse(originalMetricsConfig.getJmxConfig().isEnabled());
assertEquals(24, originalMetricsConfig.getCollectionFrequencySeconds());
// verify that the overridden config is used
ClientMetricsConfig metricsConfigUsed = client.client.getClientStatisticsService().getMetricsConfig();
assertSame(originalMetricsConfig, metricsConfigUsed);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientMetricsPropertiesTest method testDeprecatedPropertiesStillEffective.
@Test
public void testDeprecatedPropertiesStillEffective() {
// setting non-defaults
clientConfig.setProperty(ClientProperty.STATISTICS_ENABLED.getName(), "false");
clientConfig.setProperty(ClientProperty.STATISTICS_PERIOD_SECONDS.getName(), "24");
HazelcastClientProxy client = createClient();
ClientConfig clientConfig = client.getClientConfig();
ClientMetricsConfig metricsConfig = clientConfig.getMetricsConfig();
assertFalse(metricsConfig.isEnabled());
assertEquals(24, metricsConfig.getCollectionFrequencySeconds());
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy 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.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientMapNearCacheSerializationCountTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
ClientConfig clientConfig = getClientConfig();
if (nearCacheConfig != null) {
clientConfig.addNearCacheConfig(nearCacheConfig);
}
prepareSerializationConfig(clientConfig.getSerializationConfig());
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
IMap<K, V> clientMap = client.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = ((ClientMapProxy) clientMap).getContext().getNearCacheManager(clientMap.getServiceName());
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, client.getSerializationService()).setNearCacheInstance(client).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(clientMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager);
}
Aggregations