use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class ClientMapNearCachePreloaderTest method createContext.
@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext(boolean createNearCacheInstance) {
Config config = getConfig();
HazelcastInstance member = hazelcastFactory.newHazelcastInstance(config);
IMap<K, V> memberMap = member.getMap(nearCacheConfig.getName());
IMapDataStructureAdapter<K, V> dataAdapter = new IMapDataStructureAdapter<K, V>(memberMap);
if (createNearCacheInstance) {
NearCacheTestContextBuilder<K, V, Data, String> contextBuilder = createNearCacheContextBuilder();
return contextBuilder.setDataInstance(member).setDataAdapter(dataAdapter).build();
}
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(member)).setDataInstance(member).setDataAdapter(dataAdapter).build();
}
use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class ClientMapNearCacheLeakTest method createContext.
@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext() {
Config config = getConfig();
HazelcastInstance member = hazelcastFactory.newHazelcastInstance(config);
IMap<K, V> memberMap = member.getMap(DEFAULT_NEAR_CACHE_NAME);
IMapDataStructureAdapter<K, V> dataAdapter = new IMapDataStructureAdapter<K, V>(memberMap);
// wait until the initial load is done
dataAdapter.waitUntilLoaded();
NearCacheTestContextBuilder<K, V, Data, String> builder = createNearCacheContextBuilder();
return builder.setDataInstance(member).setDataAdapter(dataAdapter).build();
}
use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class ClientMapNearCacheLeakTest 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);
ClientContext clientContext = ((ClientProxy) clientMap).getContext();
RepairingTask repairingTask = clientContext.getRepairingTask(MapService.SERVICE_NAME);
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, client.getSerializationService()).setNearCacheInstance(client).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(clientMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setRepairingTask(repairingTask);
}
use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class LiteMemberClientMapNearCacheBasicTest method createNearCacheContextBuilder.
private <K, V> NearCacheTestContextBuilder<K, V, Data, String> createNearCacheContextBuilder(IMapMapStore mapStore) {
Config configWithNearCache = getConfig(mapStore, true);
HazelcastInstance liteMember = hazelcastFactory.newHazelcastInstance(configWithNearCache);
IMap<K, V> liteMemberMap = liteMember.getMap(DEFAULT_NEAR_CACHE_NAME);
NearCacheManager nearCacheManager = getMapNearCacheManager(liteMember);
NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
return new NearCacheTestContextBuilder<K, V, Data, String>(nearCacheConfig, getSerializationService(liteMember)).setNearCacheInstance(liteMember).setNearCacheAdapter(new IMapDataStructureAdapter<K, V>(liteMemberMap)).setNearCache(nearCache).setNearCacheManager(nearCacheManager).setLoader(mapStore);
}
use of com.hazelcast.internal.adapter.IMapDataStructureAdapter in project hazelcast by hazelcast.
the class LiteMemberClientMapNearCacheBasicTest method createContext.
@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext(boolean loaderEnabled) {
IMapMapStore mapStore = loaderEnabled ? new IMapMapStore() : null;
Config config = getConfig(mapStore, false);
ClientConfig clientConfig = getClientConfig();
// create a Hazelcast member to hold the data
hazelcastFactory.newHazelcastInstance(config);
// create a Hazelcast client to be used in the tests
HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
IMap<K, V> clientMap = client.getMap(DEFAULT_NEAR_CACHE_NAME);
IMapDataStructureAdapter<K, V> dataAdapter = new IMapDataStructureAdapter<K, V>(clientMap);
// wait until the initial load is done
dataAdapter.waitUntilLoaded();
NearCacheTestContextBuilder<K, V, Data, String> builder = createNearCacheContextBuilder(mapStore);
return builder.setDataInstance(client).setDataAdapter(dataAdapter).setLoader(mapStore).build();
}
Aggregations