use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class ClientWriteBehindFlushTest method setUp.
@Before
public void setUp() throws Exception {
MapStoreConfig mapStoreConfig = new MapStoreConfig();
MapStoreWithCounter mapStore = new MapStoreWithCounter<Integer, String>();
mapStoreConfig.setImplementation(mapStore).setWriteDelaySeconds(3000);
Config config = getConfig();
config.getMapConfig(MAP_NAME).setMapStoreConfig(mapStoreConfig);
TestHazelcastFactory hazelcastFactory = new TestHazelcastFactory();
member1 = hazelcastFactory.newHazelcastInstance(config);
member2 = hazelcastFactory.newHazelcastInstance(config);
member3 = hazelcastFactory.newHazelcastInstance(config);
client = hazelcastFactory.newHazelcastClient();
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class ClientWriteBehindFlushTest method newMapStoredConfig.
protected 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(MAP_NAME);
mapConfig.setMapStoreConfig(mapStoreConfig);
return config;
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class ClientMapLoadAllTest method givenSpecificKeysWereReloaded_whenLoadAllIsCalled_thenAllEntriesAreLoadedFromTheStore.
@Test
public void givenSpecificKeysWereReloaded_whenLoadAllIsCalled_thenAllEntriesAreLoadedFromTheStore() {
String name = randomString();
int keysInMapStore = 10000;
Config config = new Config();
MapConfig mapConfig = config.getMapConfig(name);
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(new MapLoaderTest.DummyMapLoader(keysInMapStore));
mapStoreConfig.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER);
mapConfig.setMapStoreConfig(mapStoreConfig);
hazelcastFactory.newHazelcastInstance(config);
HazelcastInstance client = hazelcastFactory.newHazelcastClient();
IMap<Integer, Integer> map = client.getMap(name);
//load specific keys
map.loadAll(setOfValuesBetween(0, keysInMapStore), true);
//remove everything
map.clear();
//assert loadAll with load all entries provided by the mapLoader
map.loadAll(true);
assertEquals(keysInMapStore, map.size());
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class ClientMapStoreTest method mapStore_OperationQueue_AtMaxCapacity.
@Test
public void mapStore_OperationQueue_AtMaxCapacity() {
int maxCapacity = 1000;
Config config = new Config();
config.setProperty(GroupProperty.MAP_WRITE_BEHIND_QUEUE_CAPACITY.getName(), String.valueOf(maxCapacity));
MapConfig mapConfig = new MapConfig();
MapStoreConfig mapStoreConfig = new MapStoreConfig();
MapStoreBackup store = new MapStoreBackup();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(store);
mapStoreConfig.setWriteDelaySeconds(60);
mapStoreConfig.setWriteCoalescing(false);
mapConfig.setName(MAP_NAME);
mapConfig.setMapStoreConfig(mapStoreConfig);
config.addMapConfig(mapConfig);
HazelcastInstance server = hazelcastFactory.newHazelcastInstance(config);
HazelcastInstance client = hazelcastFactory.newHazelcastClient();
IMap<Integer, Integer> map = client.getMap(MAP_NAME);
for (int i = 0; i < maxCapacity; i++) {
map.put(i, i);
}
assertEquals(maxCapacity, map.size());
try {
map.put(maxCapacity, maxCapacity);
fail("Should not exceed max capacity");
} catch (ReachedMaxSizeException expected) {
ignore(expected);
}
}
use of com.hazelcast.config.MapStoreConfig in project hazelcast by hazelcast.
the class ClientMapStoreTest method setup.
@Before
public void setup() {
nodeConfig = new Config();
MapConfig mapConfig = new MapConfig();
MapStoreConfig mapStoreConfig = new MapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(new SimpleMapStore());
mapStoreConfig.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER);
mapConfig.setName(MAP_NAME);
mapConfig.setMapStoreConfig(mapStoreConfig);
nodeConfig.addMapConfig(mapConfig);
}
Aggregations