use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class WriteBehindFlushTest method testWriteBehindQueues_emptied_onBackupNodes.
@Test
public void testWriteBehindQueues_emptied_onBackupNodes() throws Exception {
int nodeCount = 3;
String mapName = randomName();
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(nodeCount);
MapStoreConfig mapStoreConfig = new MapStoreConfig();
MapStoreWithCounter mapStore = new MapStoreWithCounter<Integer, String>();
mapStoreConfig.setImplementation(mapStore).setWriteDelaySeconds(3000);
Config config = getConfig();
config.setProperty(GroupProperty.MAP_REPLICA_SCHEDULED_TASK_DELAY_SECONDS.getName(), "0");
config.getMapConfig(mapName).setMapStoreConfig(mapStoreConfig);
HazelcastInstance member1 = factory.newHazelcastInstance(config);
HazelcastInstance member2 = factory.newHazelcastInstance(config);
HazelcastInstance member3 = factory.newHazelcastInstance(config);
IMap<Integer, Integer> map = member1.getMap(mapName);
for (int i = 0; i < 1000; i++) {
map.put(i, i);
}
map.flush();
assertWriteBehindQueuesEmpty(mapName, asList(member1, member2, member3));
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class WriteBehindFlushTest method newMapStoredConfig.
private Config newMapStoredConfig(MapStore store, int writeDelaySeconds) {
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setWriteDelaySeconds(writeDelaySeconds);
mapStoreConfig.setImplementation(store);
Config config = getConfig();
MapConfig mapConfig = config.getMapConfig("default");
mapConfig.setMapStoreConfig(mapStoreConfig);
return config;
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class MapStoreWriteBehindTest method testIssue1085WriteBehindBackup.
@Test(timeout = 120000)
public void testIssue1085WriteBehindBackup() throws InterruptedException {
Config config = getConfig();
String name = "testIssue1085WriteBehindBackup";
MapConfig writeBehindBackup = config.getMapConfig(name);
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setWriteDelaySeconds(5);
int size = 1000;
MapStoreWithStoreCount mapStore = new MapStoreWithStoreCount(size, 120);
mapStoreConfig.setImplementation(mapStore);
writeBehindBackup.setMapStoreConfig(mapStoreConfig);
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(3);
HazelcastInstance instance = factory.newHazelcastInstance(config);
HazelcastInstance instance2 = factory.newHazelcastInstance(config);
final IMap<Integer, Integer> map = instance.getMap(name);
for (int i = 0; i < size; i++) {
map.put(i, i);
}
instance2.getLifecycleService().shutdown();
mapStore.awaitStores();
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class MapStoreWriteBehindTest method mapStore_setOnIMapDoesNotRemoveKeyFromWriteBehindDeleteQueue.
@Test(timeout = 120000)
public void mapStore_setOnIMapDoesNotRemoveKeyFromWriteBehindDeleteQueue() throws Exception {
MapStoreConfig mapStoreConfig = new MapStoreConfig().setEnabled(true).setImplementation(new SimpleMapStore<String, String>()).setWriteDelaySeconds(Integer.MAX_VALUE);
Config config = getConfig();
config.getMapConfig("map").setMapStoreConfig(mapStoreConfig);
HazelcastInstance instance = createHazelcastInstance(config);
IMap<String, String> map = instance.getMap("map");
map.put("foo", "bar");
map.remove("foo");
map.set("foo", "bar");
assertEquals("bar", map.get("foo"));
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class NearCacheLiteMemberTest method createNearCachedMapConfigWithMapStoreConfig.
public static Config createNearCachedMapConfigWithMapStoreConfig(String mapName, boolean liteMember) {
NearCacheTestSupport.SimpleMapStore store = new NearCacheTestSupport.SimpleMapStore();
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(store);
NearCacheConfig nearCacheConfig = new NearCacheConfig();
nearCacheConfig.setInvalidateOnChange(true);
Config config = new Config();
config.setLiteMember(liteMember);
config.getMapConfig(mapName).setMapStoreConfig(mapStoreConfig).setNearCacheConfig(nearCacheConfig);
return config;
}
Aggregations