use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.
the class NearCacheManagerTestSupport method doClearNearCacheAndClearAllNearCaches.
void doClearNearCacheAndClearAllNearCaches() {
NearCacheManager nearCacheManager = createNearCacheManager();
for (int i = 0; i < DEFAULT_NEAR_CACHE_COUNT; i++) {
createNearCache(nearCacheManager, DEFAULT_NEAR_CACHE_NAME + "-" + i);
}
Collection<NearCache> nearCaches1 = nearCacheManager.listAllNearCaches();
assertEquals(DEFAULT_NEAR_CACHE_COUNT, nearCaches1.size());
for (int i = 0; i < DEFAULT_NEAR_CACHE_COUNT; i++) {
assertTrue(nearCacheManager.clearNearCache(DEFAULT_NEAR_CACHE_NAME + "-" + i));
}
Collection<NearCache> nearCaches2 = nearCacheManager.listAllNearCaches();
// clear doesn't remove Near Cache, just clears it
assertEquals(DEFAULT_NEAR_CACHE_COUNT, nearCaches2.size());
nearCacheManager.clearAllNearCaches();
Collection<NearCache> nearCaches3 = nearCacheManager.listAllNearCaches();
// clear all doesn't remove Near Caches, just clears them
assertEquals(DEFAULT_NEAR_CACHE_COUNT, nearCaches3.size());
assertFalse(nearCacheManager.clearNearCache(DEFAULT_NEAR_CACHE_NAME + "-" + DEFAULT_NEAR_CACHE_COUNT));
}
use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.
the class NearCacheManagerTestSupport method doListNearCaches.
void doListNearCaches() {
NearCacheManager nearCacheManager = createNearCacheManager();
Set<String> nearCacheNames = new HashSet<String>();
Collection<NearCache> nearCaches1 = nearCacheManager.listAllNearCaches();
assertEquals(0, nearCaches1.size());
for (int i = 0; i < DEFAULT_NEAR_CACHE_COUNT; i++) {
String nearCacheName = DEFAULT_NEAR_CACHE_NAME + "-" + i;
createNearCache(nearCacheManager, nearCacheName);
nearCacheNames.add(nearCacheName);
}
Collection<NearCache> nearCaches2 = nearCacheManager.listAllNearCaches();
assertEquals(DEFAULT_NEAR_CACHE_COUNT, nearCaches2.size());
for (NearCache nearCache : nearCaches2) {
assertContains(nearCacheNames, nearCache.getName());
}
}
use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.
the class MapNearCacheBasicTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder(IMapMapStore mapStore) {
Config configWithNearCache = createConfig(mapStore, true);
HazelcastInstance nearCacheInstance = hazelcastFactory.newHazelcastInstance(configWithNearCache);
IMap<K, V> nearCacheMap = nearCacheInstance.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = getMapNearCacheManager(nearCacheInstance);
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(nearCacheInstance)).setNearCacheInstance(nearCacheInstance).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(nearCacheMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setLoader(mapStore).setHasLocalData(true);
}
use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.
the class MapNearCacheLeakTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
Config configWithNearCache = getConfig(true);
HazelcastInstance nearCacheInstance = hazelcastFactory.newHazelcastInstance(configWithNearCache);
IMap<K, V> nearCacheMap = nearCacheInstance.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = getMapNearCacheManager(nearCacheInstance);
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
RepairingTask repairingTask = ((MapNearCacheManager) nearCacheManager).getRepairingTask();
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(nearCacheInstance)).setNearCacheInstance(nearCacheInstance).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(nearCacheMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setHasLocalData(true).setRepairingTask(repairingTask);
}
use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.
the class TxnMapNearCacheLeakTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
Config configWithNearCache = getConfig(true);
HazelcastInstance nearCacheInstance = hazelcastFactory.newHazelcastInstance(configWithNearCache);
nearCacheInstance.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = getMapNearCacheManager(nearCacheInstance);
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
RepairingTask repairingTask = ((MapNearCacheManager) nearCacheManager).getRepairingTask();
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(nearCacheInstance)).setNearCacheInstance(nearCacheInstance).setNearCacheAdapter(new TransactionalMapDataStructureAdapter<K, V>(nearCacheInstance, DEFAULT_NEAR_CACHE_NAME)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setRepairingTask(repairingTask);
}
Aggregations