use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class NearCacheTest method getMapConfiguredWithMaxSizeAndPolicy.
private IMap<Integer, Integer> getMapConfiguredWithMaxSizeAndPolicy(EvictionPolicy evictionPolicy, int maxSize) {
String mapName = randomMapName();
Config config = getConfig();
config.getMapConfig(mapName).setNearCacheConfig(newNearCacheConfigWithEntryCountEviction(evictionPolicy, maxSize));
HazelcastInstance instance = createHazelcastInstance(config);
return instance.getMap(mapName);
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class NearCacheTest method test_whenEmptyMap_thenPopulatedNearCacheShouldReturnNull_neverNULL_OBJECT.
@Test
public void test_whenEmptyMap_thenPopulatedNearCacheShouldReturnNull_neverNULL_OBJECT() {
int size = 10;
String mapName = randomMapName();
Config config = getConfig();
config.getMapConfig(mapName).setNearCacheConfig(newNearCacheConfig());
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(1);
HazelcastInstance instance = factory.newHazelcastInstance(config);
// populate map
IMap<Integer, Integer> map = instance.getMap(mapName);
for (int i = 0; i < size; i++) {
// populate Near Cache
assertNull(map.get(i));
// fetch value from Near Cache
assertNull(map.get(i));
}
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class NearCacheTestSupport method createNearCachedMapConfigWithMapStoreConfig.
protected Config createNearCachedMapConfigWithMapStoreConfig(String mapName) {
SimpleMapStore store = new SimpleMapStore();
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(store);
Config config = createNearCachedMapConfig(mapName);
config.getMapConfig(mapName).setMapStoreConfig(mapStoreConfig);
return config;
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class InvalidationMemberAddRemoveTest method createConfig.
protected Config createConfig() {
Config config = new Config();
config.setProperty("hazelcast.invalidation.reconciliation.interval.seconds", Integer.toString(RECONCILIATION_INTERVAL_SECONDS));
config.setProperty("hazelcast.invalidation.max.tolerated.miss.count", "0");
config.setProperty("hazelcast.map.invalidation.batch.enabled", "true");
config.setProperty("hazelcast.map.invalidation.batch.size", Integer.toString(INVALIDATION_BATCH_SIZE));
config.setProperty("hazelcast.partition.count", "271");
return config;
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class MapInvalidationMetaDataMigrationTest method uuids_migrated_whenSourceNodeShutdown.
@Test
public void uuids_migrated_whenSourceNodeShutdown() throws Exception {
String mapName = "test";
Config config = newConfig(mapName);
HazelcastInstance instance1 = factory.newHazelcastInstance(config);
IMap<Object, Object> map = instance1.getMap(mapName);
for (int i = 0; i < 10000; i++) {
map.put(i, i);
}
Map<Integer, UUID> source1 = getPartitionToUuidMap(instance1);
HazelcastInstance instance2 = factory.newHazelcastInstance(config);
HazelcastInstance instance3 = factory.newHazelcastInstance(config);
waitAllForSafeState(instance1, instance2, instance3);
instance1.shutdown();
Map<Integer, UUID> destination2 = getPartitionToUuidMap(instance2);
Map<Integer, UUID> destination3 = getPartitionToUuidMap(instance3);
Map<Integer, UUID> merged = mergeOwnedPartitionUuids(destination2, destination3, getNodeEngineImpl(instance2).getPartitionService());
assertEquals(source1, merged);
}
Aggregations