Search in sources :

Example 36 with NearCacheManager

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));
}
Also used : NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) NearCache(com.hazelcast.internal.nearcache.NearCache)

Example 37 with NearCacheManager

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());
    }
}
Also used : NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) NearCache(com.hazelcast.internal.nearcache.NearCache) HashSet(java.util.HashSet)

Example 38 with NearCacheManager

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);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager) NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig) NearCacheTestUtils.getBaseConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) NearCacheTestContextBuilder(com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder) Data(com.hazelcast.internal.serialization.Data)

Example 39 with NearCacheManager

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);
}
Also used : NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager) NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager) NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig) NearCacheTestUtils.getBaseConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig) Data(com.hazelcast.internal.serialization.Data) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NearCacheTestContextBuilder(com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder)

Example 40 with NearCacheManager

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);
}
Also used : NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager) NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) RepairingTask(com.hazelcast.internal.nearcache.impl.invalidation.RepairingTask) Config(com.hazelcast.config.Config) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig) NearCacheTestUtils.getBaseConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig) TransactionalMapDataStructureAdapter(com.hazelcast.internal.adapter.TransactionalMapDataStructureAdapter) Data(com.hazelcast.internal.serialization.Data)

Aggregations

NearCacheManager (com.hazelcast.internal.nearcache.NearCacheManager)40 ClientConfig (com.hazelcast.client.config.ClientConfig)22 Data (com.hazelcast.internal.serialization.Data)21 HazelcastInstance (com.hazelcast.core.HazelcastInstance)19 NearCacheTestContextBuilder (com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder)15 HazelcastClientProxy (com.hazelcast.client.impl.clientside.HazelcastClientProxy)13 Config (com.hazelcast.config.Config)12 HazelcastClientCacheManager (com.hazelcast.client.cache.impl.HazelcastClientCacheManager)11 Data (com.hazelcast.nio.serialization.Data)11 CachingProvider (javax.cache.spi.CachingProvider)11 NearCacheTestUtils.getMapNearCacheManager (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getMapNearCacheManager)10 NearCacheTestContext (com.hazelcast.internal.nearcache.NearCacheTestContext)9 HazelcastClientProxy (com.hazelcast.client.impl.HazelcastClientProxy)8 NearCacheTestUtils.getBaseConfig (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig)8 NearCacheTestUtils.createNearCacheConfig (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig)7 CacheTestSupport.createClientCachingProvider (com.hazelcast.cache.CacheTestSupport.createClientCachingProvider)6 CacheTestSupport.createServerCachingProvider (com.hazelcast.cache.CacheTestSupport.createServerCachingProvider)6 HazelcastServerCachingProvider (com.hazelcast.cache.impl.HazelcastServerCachingProvider)6 HazelcastClientCachingProvider (com.hazelcast.client.cache.impl.HazelcastClientCachingProvider)5 MapConfig (com.hazelcast.config.MapConfig)5