use of com.hazelcast.map.ReachedMaxSizeException 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);
}
}
Aggregations