use of com.hazelcast.map.impl.mapstore.MapStoreTest.SimpleMapStore in project hazelcast by hazelcast.
the class MapStoreWriteBehindTest method testWriteBehindDestroy.
@Test(timeout = 120000)
@Category(NightlyTest.class)
public // issue #2747: when MapStore configured with write behind, distributed objects' destroy method does not work
void testWriteBehindDestroy() throws InterruptedException {
final int writeDelaySeconds = 5;
String mapName = randomMapName();
final MapStore<String, String> store = new SimpleMapStore<String, String>();
Config config = newConfig(mapName, store, writeDelaySeconds);
HazelcastInstance hzInstance = createHazelcastInstance(config);
IMap<String, String> map = hzInstance.getMap(mapName);
map.put("key", "value");
map.destroy();
sleepSeconds(2 * writeDelaySeconds);
assertNotEquals("value", store.load("key"));
}
use of com.hazelcast.map.impl.mapstore.MapStoreTest.SimpleMapStore in project hazelcast by hazelcast.
the class MapStoreWriteBehindTest method mapStore_setOnIMapDoesNotRemoveKeyFromWriteBehindDeleteQueue.
@Test(timeout = 120000)
public void mapStore_setOnIMapDoesNotRemoveKeyFromWriteBehindDeleteQueue() {
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.map.impl.mapstore.MapStoreTest.SimpleMapStore 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.map.impl.mapstore.MapStoreTest.SimpleMapStore in project hazelcast by hazelcast.
the class MapStoreWriteBehindTest method testWriteBehindDestroy.
@Test(timeout = 120000)
@Category(NightlyTest.class)
public // issue #2747: when MapStore configured with write behind, distributed objects' destroy method does not work
void testWriteBehindDestroy() {
final int writeDelaySeconds = 5;
String mapName = randomMapName();
final MapStore<String, String> store = new SimpleMapStore<String, String>();
Config config = newConfig(mapName, store, writeDelaySeconds);
HazelcastInstance hzInstance = createHazelcastInstance(config);
IMap<String, String> map = hzInstance.getMap(mapName);
map.put("key", "value");
map.destroy();
sleepSeconds(2 * writeDelaySeconds);
assertNotEquals("value", store.load("key"));
}
Aggregations