use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientReplicatedMapNearCacheBasicTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
ClientConfig clientConfig = getClientConfig();
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
ReplicatedMap<K, V> clientMap = client.getReplicatedMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = ((ClientReplicatedMapProxy) 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 ReplicatedMapDataStructureAdapter<>(clientMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class ClientReplicatedMapNearCacheSerializationCountTest 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);
ReplicatedMap<K, V> clientMap = client.getReplicatedMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = ((ClientReplicatedMapProxy) 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 ReplicatedMapDataStructureAdapter<K, V>(clientMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager);
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class TestBeansApplicationContext method testApplicationContext.
@Test
public void testApplicationContext() {
assertTrue(HazelcastClient.getAllHazelcastClients().isEmpty());
context.getBean("map2");
assertEquals(1, Hazelcast.getAllHazelcastInstances().size());
assertEquals(1, HazelcastClient.getAllHazelcastClients().size());
HazelcastInstance hazelcast = Hazelcast.getAllHazelcastInstances().iterator().next();
long distributedObjectsSize = hazelcast.getDistributedObjects().stream().filter(distributedObject -> !distributedObject.getName().startsWith(INTERNAL_JET_OBJECTS_PREFIX)).count();
assertEquals(2, distributedObjectsSize);
context.getBean("client");
context.getBean("client");
assertEquals(3, HazelcastClient.getAllHazelcastClients().size());
HazelcastClientProxy client = (HazelcastClientProxy) HazelcastClient.getAllHazelcastClients().iterator().next();
assertNull(client.getClientConfig().getManagedContext());
int batchSize = client.getClientConfig().getQueryCacheConfigs().get("").get("cache1").getBatchSize();
assertEquals(12, batchSize);
assertFalse(client.getClientConfig().getMetricsConfig().isEnabled());
HazelcastInstance instance = (HazelcastInstance) context.getBean("instance");
assertEquals(1, Hazelcast.getAllHazelcastInstances().size());
assertEquals(instance, Hazelcast.getAllHazelcastInstances().iterator().next());
assertNull(instance.getConfig().getManagedContext());
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class TestSpringClientFailoverContext method testBlueGreenClient.
@Test
public void testBlueGreenClient() {
HazelcastClientProxy blueGreenClient = applicationContext.getBean("blueGreenClient", HazelcastClientProxy.class);
ClientFailoverConfig failoverConfig = blueGreenClient.client.getFailoverConfig();
List<ClientConfig> clientConfigs = failoverConfig.getClientConfigs();
assertEquals(2, clientConfigs.size());
assertEquals("spring-cluster", clientConfigs.get(0).getClusterName());
assertEquals("alternativeClusterName", clientConfigs.get(1).getClusterName());
assertEquals(5, failoverConfig.getTryCount());
blueGreenClient.shutdown();
}
use of com.hazelcast.client.impl.clientside.HazelcastClientProxy in project hazelcast by hazelcast.
the class TestEnabledSpringAwareAnnotation method testSpringManagedContext.
@Test
public void testSpringManagedContext() {
HazelcastInstance instance = (HazelcastInstance) context.getBean("instance");
assertTrue(instance.getConfig().getManagedContext() instanceof SpringManagedContext);
HazelcastClientProxy client = (HazelcastClientProxy) context.getBean("client");
assertTrue(client.getClientConfig().getManagedContext() instanceof SpringManagedContext);
}
Aggregations