use of com.hazelcast.client.impl.spi.ClientProxy in project hazelcast by hazelcast.
the class ClientCacheNearCacheLeakTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder(CacheConfig<K, V> cacheConfig) {
ClientConfig clientConfig = getClientConfig();
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
CachingProvider provider = createClientCachingProvider(client);
HazelcastClientCacheManager cacheManager = (HazelcastClientCacheManager) provider.getCacheManager();
ICache<K, V> clientCache = cacheManager.createCache(DEFAULT_NEAR_CACHE_NAME, cacheConfig);
NearCacheManager nearCacheManager = ((ClientCacheProxy) clientCache).getContext().getNearCacheManager(clientCache.getServiceName());
String cacheNameWithPrefix = cacheManager.getCacheNameWithPrefix(DEFAULT_NEAR_CACHE_NAME);
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(cacheNameWithPrefix);
ClientContext clientContext = ((ClientProxy) clientCache).getContext();
RepairingTask repairingTask = clientContext.getRepairingTask(CacheService.SERVICE_NAME);
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, client.getSerializationService()).setNearCacheInstance(client).setNearCacheAdapter(new ICacheDataStructureAdapter<K, V>(clientCache)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setCacheManager(cacheManager).setRepairingTask(repairingTask);
}
use of com.hazelcast.client.impl.spi.ClientProxy in project hazelcast by hazelcast.
the class ClientCacheInvalidationMetaDataFetcherTest method getRepairingTask.
@SuppressWarnings("unchecked")
private RepairingTask getRepairingTask(String cacheName, int partition, long givenSequence, UUID givenUuid) {
HazelcastInstance member = factory.newHazelcastInstance();
distortRandomPartitionSequence(getPrefixedName(cacheName), partition, givenSequence, member);
distortRandomPartitionUuid(partition, givenUuid, member);
ClientConfig clientConfig = new ClientConfig().addNearCacheConfig(new NearCacheConfig(cacheName));
HazelcastClientProxy client = (HazelcastClientProxy) factory.newHazelcastClient(clientConfig);
CachingProvider clientCachingProvider = createClientCachingProvider(client);
Cache<Integer, Integer> clientCache = clientCachingProvider.getCacheManager().createCache(cacheName, newCacheConfig());
ClientContext clientContext = ((ClientProxy) clientCache).getContext();
return clientContext.getRepairingTask(SERVICE_NAME);
}
use of com.hazelcast.client.impl.spi.ClientProxy in project hazelcast by hazelcast.
the class ProxyEqualityTest method testProxiesAreCached.
@Test
public void testProxiesAreCached() {
ClientProxy ref1 = (ClientProxy) client1ClusterA.getSet(name);
ClientProxy ref2 = (ClientProxy) client1ClusterA.getSet(name);
assertSame(ref1, ref2);
}
use of com.hazelcast.client.impl.spi.ClientProxy in project hazelcast by hazelcast.
the class ProxyEqualityTest method testTwoClientProxiesFromTheSameInstanceAreEquals.
@Test
public void testTwoClientProxiesFromTheSameInstanceAreEquals() {
ClientProxy ref1 = (ClientProxy) client1ClusterA.getSet(name);
ClientProxy ref2 = (ClientProxy) client1ClusterA.getSet(name);
assertEquals(ref1, ref2);
}
use of com.hazelcast.client.impl.spi.ClientProxy in project hazelcast by hazelcast.
the class ProxyEqualityTest method testTwoClientProxiesFromTwoDifferentClientsConnectedToTheSameInstanceAreNotEquals.
@Test
public void testTwoClientProxiesFromTwoDifferentClientsConnectedToTheSameInstanceAreNotEquals() {
ClientProxy ref1 = (ClientProxy) client1ClusterA.getSet(name);
ClientProxy ref2 = (ClientProxy) client2ClusterA.getSet(name);
assertNotEquals(ref1, ref2);
}
Aggregations