use of com.hazelcast.client.impl.clientside.HazelcastClientProxy 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.impl.clientside.HazelcastClientProxy 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());
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientMapNearCacheBasicTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
ClientConfig clientConfig = getClientConfig();
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);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientMapNearCachePreloaderTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
ClientConfig clientConfig = getClientConfig().addNearCacheConfig(nearCacheConfig);
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
IMap<K, V> clientMap = client.getMap(nearCacheConfig.getName());
NearCacheManager nearCacheManager = ((ClientMapProxy) clientMap).getContext().getNearCacheManager(clientMap.getServiceName());
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(nearCacheConfig.getName());
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, client.getSerializationService()).setNearCacheInstance(client).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(clientMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class TestDisabledSpringAwareAnnotation method testDisabledSpringManagedContext.
@Test
public void testDisabledSpringManagedContext() {
HazelcastInstance instance = (HazelcastInstance) context.getBean("instance");
assertNull(instance.getConfig().getManagedContext());
HazelcastClientProxy client = (HazelcastClientProxy) context.getBean("client");
assertNull(client.getClientConfig().getManagedContext());
}
Aggregations