use of com.hazelcast.config.MapConfig 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.MapConfig 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.MapConfig 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.MapConfig 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);
}
use of com.hazelcast.config.MapConfig in project hazelcast by hazelcast.
the class ClientMapWriteQuorumTest method initialize.
@BeforeClass
public static void initialize() throws Exception {
QuorumConfig quorumConfig = new QuorumConfig();
quorumConfig.setName(QUORUM_ID);
quorumConfig.setEnabled(true);
quorumConfig.setSize(3);
quorumConfig.setType(QuorumType.WRITE);
MapConfig mapConfig = new MapConfig(MAP_NAME_PREFIX + "*");
mapConfig.setQuorumName(QUORUM_ID);
factory = new TestHazelcastFactory();
cluster = new PartitionedCluster(factory).partitionFiveMembersThreeAndTwo(mapConfig, quorumConfig);
initializeClients();
verifyClients();
}
Aggregations