use of com.hazelcast.client.cache.impl.HazelcastClientCachingProvider in project hazelcast by hazelcast.
the class ClientManagerTest method testMultiClusterMultipleClients.
@Test
public void testMultiClusterMultipleClients() {
final String cacheName = "test";
final String key1 = "key1";
final String valuecm1 = "Value-is-cm1";
final String valuecm2 = "Value-is-cm2";
final HazelcastClientCachingProvider cachingProvider = new HazelcastClientCachingProvider();
final CacheManager cm1 = cachingProvider.getCacheManager(uri1, null);
final CacheManager cm2 = cachingProvider.getCacheManager(uri2, null);
final CacheConfig<String, String> cacheConfig = new CacheConfig<String, String>();
final Cache<String, String> cache1 = cm1.createCache(cacheName, cacheConfig);
final Cache<String, String> cache2 = cm2.createCache(cacheName, cacheConfig);
cache1.put(key1, valuecm1);
cache2.put(key1, valuecm2);
assertEquals(valuecm1, cache1.get(key1));
assertEquals(valuecm2, cache2.get(key1));
cachingProvider.close(uri1, null);
cachingProvider.close(uri2, null);
final CacheManager cm11 = cachingProvider.getCacheManager(uri1, null);
final Cache<String, String> cache11 = cm11.getCache(cacheName);
assertEquals(valuecm1, cache11.get(key1));
cm11.close();
}
Aggregations