Search in sources :

Example 1 with IMapMapStore

use of com.hazelcast.internal.adapter.IMapMapStore in project hazelcast by hazelcast.

the class MapNearCacheBasicTest method createContext.

@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext(boolean loaderEnabled) {
    IMapMapStore mapStore = loaderEnabled ? new IMapMapStore() : null;
    Config config = createConfig(mapStore, false);
    HazelcastInstance dataInstance = hazelcastFactory.newHazelcastInstance(config);
    IMap<K, V> dataMap = dataInstance.getMap(DEFAULT_NEAR_CACHE_NAME);
    IMapDataStructureAdapter<K, V> dataAdapter = new IMapDataStructureAdapter<K, V>(dataMap);
    // wait until the initial load is done
    dataAdapter.waitUntilLoaded();
    NearCacheTestContextBuilder<K, V, Data, String> builder = createNearCacheContextBuilder(mapStore);
    return builder.setDataInstance(dataInstance).setDataAdapter(dataAdapter).build();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) 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) IMapDataStructureAdapter(com.hazelcast.internal.adapter.IMapDataStructureAdapter) Data(com.hazelcast.internal.serialization.Data) IMapMapStore(com.hazelcast.internal.adapter.IMapMapStore)

Example 2 with IMapMapStore

use of com.hazelcast.internal.adapter.IMapMapStore in project hazelcast by hazelcast.

the class LiteMemberMapNearCacheBasicTest 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);
    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(mapStore);
    return builder.setDataInstance(member).setDataAdapter(dataAdapter).build();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapNearCacheBasicTest.addMapStoreConfig(com.hazelcast.map.impl.nearcache.MapNearCacheBasicTest.addMapStoreConfig) 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) IMapDataStructureAdapter(com.hazelcast.internal.adapter.IMapDataStructureAdapter) Data(com.hazelcast.internal.serialization.Data) IMapMapStore(com.hazelcast.internal.adapter.IMapMapStore)

Example 3 with IMapMapStore

use of com.hazelcast.internal.adapter.IMapMapStore 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();
}
Also used : MapNearCacheBasicTest.addMapStoreConfig(com.hazelcast.map.impl.nearcache.MapNearCacheBasicTest.addMapStoreConfig) MapConfig(com.hazelcast.config.MapConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) Config(com.hazelcast.config.Config) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig) NearCacheTestUtils.getBaseConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig) IMapDataStructureAdapter(com.hazelcast.internal.adapter.IMapDataStructureAdapter) Data(com.hazelcast.internal.serialization.Data) IMapMapStore(com.hazelcast.internal.adapter.IMapMapStore) ClientConfig(com.hazelcast.client.config.ClientConfig) HazelcastClientProxy(com.hazelcast.client.impl.clientside.HazelcastClientProxy)

Example 4 with IMapMapStore

use of com.hazelcast.internal.adapter.IMapMapStore in project hazelcast by hazelcast.

the class ClientMapNearCacheBasicTest method createContext.

@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext(boolean loaderEnabled) {
    IMapMapStore mapStore = loaderEnabled ? new IMapMapStore() : null;
    Config config = getConfig();
    addMapStoreConfig(mapStore, config.getMapConfig(DEFAULT_NEAR_CACHE_NAME));
    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).setLoader(mapStore).build();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapNearCacheBasicTest.addMapStoreConfig(com.hazelcast.map.impl.nearcache.MapNearCacheBasicTest.addMapStoreConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) Config(com.hazelcast.config.Config) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig) NearCacheTestUtils.getBaseConfig(com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig) IMapDataStructureAdapter(com.hazelcast.internal.adapter.IMapDataStructureAdapter) Data(com.hazelcast.internal.serialization.Data) IMapMapStore(com.hazelcast.internal.adapter.IMapMapStore)

Aggregations

Config (com.hazelcast.config.Config)4 IMapDataStructureAdapter (com.hazelcast.internal.adapter.IMapDataStructureAdapter)4 IMapMapStore (com.hazelcast.internal.adapter.IMapMapStore)4 NearCacheTestUtils.createNearCacheConfig (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.createNearCacheConfig)4 NearCacheTestUtils.getBaseConfig (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig)4 Data (com.hazelcast.internal.serialization.Data)4 MapConfig (com.hazelcast.config.MapConfig)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 MapNearCacheBasicTest.addMapStoreConfig (com.hazelcast.map.impl.nearcache.MapNearCacheBasicTest.addMapStoreConfig)3 ClientConfig (com.hazelcast.client.config.ClientConfig)2 HazelcastClientProxy (com.hazelcast.client.impl.clientside.HazelcastClientProxy)1 MapStoreConfig (com.hazelcast.config.MapStoreConfig)1