use of com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder in project hazelcast by hazelcast.
the class ClientCacheNearCacheInvalidationTest method createNearCacheTest.
private <K, V, NK, NV> NearCacheTestContext<K, V, NK, NV> createNearCacheTest(String cacheName, NearCacheConfig nearCacheConfig, CacheConfig<K, V> cacheConfig) {
ClientConfig clientConfig = getClientConfig().setProperty(RECONCILIATION_INTERVAL_SECONDS.getName(), "0").addNearCacheConfig(nearCacheConfig);
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
CachingProvider provider = createClientCachingProvider(client);
HazelcastClientCacheManager cacheManager = (HazelcastClientCacheManager) provider.getCacheManager();
ICache<K, V> cache = cacheManager.createCache(cacheName, cacheConfig);
NearCacheManager nearCacheManager = ((ClientCacheProxy) cache).getContext().getNearCacheManager(CacheService.SERVICE_NAME);
NearCache<NK, NV> nearCache = nearCacheManager.getNearCache(cacheManager.getCacheNameWithPrefix(cacheName));
NearCacheTestContextBuilder<K, V, NK, NV> builder = new NearCacheTestContextBuilder<>(nearCacheConfig, client.getSerializationService());
return builder.setNearCacheInstance(client).setNearCacheAdapter(new ICacheDataStructureAdapter<>(cache)).setNearCacheManager(nearCacheManager).setNearCache(nearCache).build();
}
use of com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder in project hazelcast by hazelcast.
the class ClientMapNearCacheBasicTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
ClientConfig clientConfig = getClientConfig();
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
IMap<K, V> clientMap = client.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = ((ClientMapProxy) 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 IMapDataStructureAdapter<K, V>(clientMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager);
}
use of com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder in project hazelcast by hazelcast.
the class ClientMapNearCachePreloaderTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder() {
ClientConfig clientConfig = getClientConfig().addNearCacheConfig(nearCacheConfig);
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
IMap<K, V> clientMap = client.getMap(nearCacheConfig.getName());
NearCacheManager nearCacheManager = ((ClientMapProxy) clientMap).getContext().getNearCacheManager(clientMap.getServiceName());
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(nearCacheConfig.getName());
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, client.getSerializationService()).setNearCacheInstance(client).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(clientMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager);
}
use of com.hazelcast.internal.nearcache.impl.NearCacheTestContextBuilder 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.impl.NearCacheTestContextBuilder 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);
}
Aggregations