Search in sources :

Example 11 with NearCacheManager

use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.

the class TxnMapNearCacheBasicTest method createContext.

@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext() {
    Config config = getConfig();
    config.getMapConfig(DEFAULT_NEAR_CACHE_NAME).setNearCacheConfig(nearCacheConfig);
    HazelcastInstance[] instances = hazelcastFactory.newInstances(config);
    HazelcastInstance member = instances[0];
    // this creates the Near Cache instance
    member.getMap(DEFAULT_NEAR_CACHE_NAME);
    NearCacheManager nearCacheManager = getMapNearCacheManager(member);
    NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
    return new NearCacheTestContext<K, V, Data, String>(getSerializationService(member), member, new TransactionalMapDataStructureAdapter<K, V>(member, DEFAULT_NEAR_CACHE_NAME), false, nearCache, nearCacheManager);
}
Also used : NearCacheTestContext(com.hazelcast.internal.nearcache.NearCacheTestContext) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.NearCacheTestUtils.getMapNearCacheManager) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.NearCacheTestUtils.createNearCacheConfig) Config(com.hazelcast.config.Config) Data(com.hazelcast.nio.serialization.Data)

Example 12 with NearCacheManager

use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.

the class TxnMapNearCacheSerializationCountTest method createContext.

@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext() {
    Config config = getConfig();
    MapConfig mapConfig = config.getMapConfig(DEFAULT_NEAR_CACHE_NAME).setInMemoryFormat(mapInMemoryFormat);
    if (nearCacheConfig != null) {
        mapConfig.setNearCacheConfig(nearCacheConfig);
    }
    prepareSerializationConfig(config.getSerializationConfig());
    HazelcastInstance[] instances = hazelcastFactory.newInstances(config);
    HazelcastInstance member = instances[0];
    // this creates the Near Cache instance
    member.getMap(DEFAULT_NEAR_CACHE_NAME);
    NearCacheManager nearCacheManager = getMapNearCacheManager(member);
    NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
    return new NearCacheTestContext<K, V, Data, String>(getSerializationService(member), member, new TransactionalMapDataStructureAdapter<K, V>(member, DEFAULT_NEAR_CACHE_NAME), false, nearCache, nearCacheManager);
}
Also used : NearCacheTestContext(com.hazelcast.internal.nearcache.NearCacheTestContext) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.NearCacheTestUtils.getMapNearCacheManager) MapConfig(com.hazelcast.config.MapConfig) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.NearCacheTestUtils.createNearCacheConfig) Config(com.hazelcast.config.Config) Data(com.hazelcast.nio.serialization.Data) MapConfig(com.hazelcast.config.MapConfig)

Example 13 with NearCacheManager

use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.

the class LiteMemberMapNearCacheSerializationCountTest method createContext.

@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext() {
    HazelcastInstance member = hazelcastFactory.newHazelcastInstance(createConfig(nearCacheConfig, false));
    HazelcastInstance liteMember = hazelcastFactory.newHazelcastInstance(createConfig(nearCacheConfig, true));
    IMap<K, V> memberMap = member.getMap(DEFAULT_NEAR_CACHE_NAME);
    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 NearCacheTestContext<K, V, Data, String>(getSerializationService(member), liteMember, member, new IMapDataStructureAdapter<K, V>(liteMemberMap), new IMapDataStructureAdapter<K, V>(memberMap), true, nearCache, nearCacheManager);
}
Also used : NearCacheTestContext(com.hazelcast.internal.nearcache.NearCacheTestContext) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.NearCacheTestUtils.getMapNearCacheManager) Data(com.hazelcast.nio.serialization.Data)

Example 14 with NearCacheManager

use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.

the class MapNearCacheSerializationCountTest method createContext.

@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext() {
    Config config = getConfig();
    MapConfig mapConfig = config.getMapConfig(DEFAULT_NEAR_CACHE_NAME).setInMemoryFormat(mapInMemoryFormat);
    if (nearCacheConfig != null) {
        mapConfig.setNearCacheConfig(nearCacheConfig);
    }
    prepareSerializationConfig(config.getSerializationConfig());
    HazelcastInstance[] instances = hazelcastFactory.newInstances(config);
    HazelcastInstance member = instances[0];
    IMap<K, V> map = member.getMap(DEFAULT_NEAR_CACHE_NAME);
    NearCacheManager nearCacheManager = getMapNearCacheManager(member);
    NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
    return new NearCacheTestContext<K, V, Data, String>(getSerializationService(member), member, new IMapDataStructureAdapter<K, V>(map), true, nearCache, nearCacheManager);
}
Also used : NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) NearCacheTestUtils.getMapNearCacheManager(com.hazelcast.internal.nearcache.NearCacheTestUtils.getMapNearCacheManager) MapConfig(com.hazelcast.config.MapConfig) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.NearCacheTestUtils.createNearCacheConfig) Config(com.hazelcast.config.Config) Data(com.hazelcast.nio.serialization.Data) NearCacheTestContext(com.hazelcast.internal.nearcache.NearCacheTestContext) HazelcastInstance(com.hazelcast.core.HazelcastInstance) MapConfig(com.hazelcast.config.MapConfig)

Example 15 with NearCacheManager

use of com.hazelcast.internal.nearcache.NearCacheManager in project hazelcast by hazelcast.

the class ClientReplicatedMapNearCacheSerializationCountTest method createContext.

@Override
protected <K, V> NearCacheTestContext<K, V, Data, String> createContext() {
    Config config = getConfig();
    config.getReplicatedMapConfig(DEFAULT_NEAR_CACHE_NAME).setInMemoryFormat(replicatedMapInMemoryFormat);
    prepareSerializationConfig(config.getSerializationConfig());
    ClientConfig clientConfig = getClientConfig();
    if (nearCacheConfig != null) {
        clientConfig.addNearCacheConfig(nearCacheConfig);
    }
    prepareSerializationConfig(clientConfig.getSerializationConfig());
    HazelcastInstance member = hazelcastFactory.newHazelcastInstance(config);
    HazelcastClientProxy client = (HazelcastClientProxy) hazelcastFactory.newHazelcastClient(clientConfig);
    ReplicatedMap<K, V> memberMap = member.getReplicatedMap(DEFAULT_NEAR_CACHE_NAME);
    ReplicatedMap<K, V> clientMap = client.getReplicatedMap(DEFAULT_NEAR_CACHE_NAME);
    NearCacheManager nearCacheManager = client.client.getNearCacheManager();
    NearCache<Data, String> nearCache = nearCacheManager.getNearCache(DEFAULT_NEAR_CACHE_NAME);
    return new NearCacheTestContext<K, V, Data, String>(client.getSerializationService(), client, member, new ReplicatedMapDataStructureAdapter<K, V>(clientMap), new ReplicatedMapDataStructureAdapter<K, V>(memberMap), false, nearCache, nearCacheManager);
}
Also used : NearCacheManager(com.hazelcast.internal.nearcache.NearCacheManager) ClientConfig(com.hazelcast.client.config.ClientConfig) NearCacheTestUtils.createNearCacheConfig(com.hazelcast.internal.nearcache.NearCacheTestUtils.createNearCacheConfig) Config(com.hazelcast.config.Config) Data(com.hazelcast.nio.serialization.Data) NearCacheTestContext(com.hazelcast.internal.nearcache.NearCacheTestContext) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ClientConfig(com.hazelcast.client.config.ClientConfig) HazelcastClientProxy(com.hazelcast.client.impl.HazelcastClientProxy)

Aggregations

NearCacheManager (com.hazelcast.internal.nearcache.NearCacheManager)17 Data (com.hazelcast.nio.serialization.Data)16 NearCacheTestContext (com.hazelcast.internal.nearcache.NearCacheTestContext)14 HazelcastInstance (com.hazelcast.core.HazelcastInstance)13 ClientConfig (com.hazelcast.client.config.ClientConfig)10 HazelcastClientProxy (com.hazelcast.client.impl.HazelcastClientProxy)10 Config (com.hazelcast.config.Config)8 NearCacheTestUtils.createNearCacheConfig (com.hazelcast.internal.nearcache.NearCacheTestUtils.createNearCacheConfig)8 NearCacheTestUtils.getMapNearCacheManager (com.hazelcast.internal.nearcache.NearCacheTestUtils.getMapNearCacheManager)6 HazelcastClientCacheManager (com.hazelcast.client.cache.impl.HazelcastClientCacheManager)5 HazelcastClientCachingProvider (com.hazelcast.client.cache.impl.HazelcastClientCachingProvider)5 CachingProvider (javax.cache.spi.CachingProvider)5 HazelcastServerCachingProvider (com.hazelcast.cache.impl.HazelcastServerCachingProvider)4 HazelcastServerCacheManager (com.hazelcast.cache.impl.HazelcastServerCacheManager)3 MapConfig (com.hazelcast.config.MapConfig)2 ClientContext (com.hazelcast.client.spi.ClientContext)1 TestHazelcastFactory (com.hazelcast.client.test.TestHazelcastFactory)1 CacheConfig (com.hazelcast.config.CacheConfig)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 IMapDataStructureAdapter (com.hazelcast.internal.adapter.IMapDataStructureAdapter)1