Search in sources :

Example 1 with TemporaryBlockerMapStore

use of com.hazelcast.map.impl.mapstore.writebehind.TemporaryBlockerMapStore in project hazelcast by hazelcast.

the class ClientWriteBehindFlushTest method testFlush_shouldNotCause_concurrentStoreOperation.

@Test
public void testFlush_shouldNotCause_concurrentStoreOperation() throws Exception {
    int blockStoreOperationSeconds = 5;
    TemporaryBlockerMapStore store = new TemporaryBlockerMapStore(blockStoreOperationSeconds);
    Config config = newMapStoredConfig(store, 2);
    TestHazelcastFactory hazelcastFactory = new TestHazelcastFactory();
    hazelcastFactory.newHazelcastInstance(config);
    IMap<String, String> map = hazelcastFactory.newHazelcastClient().getMap(MAP_NAME);
    map.put("key", "value");
    map.flush();
    assertEquals("Expecting only one store after flush", 1, store.getStoreOperationCount());
    hazelcastFactory.shutdownAll();
}
Also used : Config(com.hazelcast.config.Config) MapConfig(com.hazelcast.config.MapConfig) MapStoreConfig(com.hazelcast.config.MapStoreConfig) TestHazelcastFactory(com.hazelcast.client.test.TestHazelcastFactory) TemporaryBlockerMapStore(com.hazelcast.map.impl.mapstore.writebehind.TemporaryBlockerMapStore) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

TestHazelcastFactory (com.hazelcast.client.test.TestHazelcastFactory)1 Config (com.hazelcast.config.Config)1 MapConfig (com.hazelcast.config.MapConfig)1 MapStoreConfig (com.hazelcast.config.MapStoreConfig)1 TemporaryBlockerMapStore (com.hazelcast.map.impl.mapstore.writebehind.TemporaryBlockerMapStore)1 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1