use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class LocalMapStatsTest method testLocalMapStats_withMemberGroups.
@Test
public void testLocalMapStats_withMemberGroups() throws Exception {
final String mapName = randomMapName();
final String[] firstMemberGroup = { "127.0.0.1", "127.0.0.2" };
final String[] secondMemberGroup = { "127.0.0.3" };
final Config config = createConfig(mapName, firstMemberGroup, secondMemberGroup);
final String[] addressArray = concatenateArrays(firstMemberGroup, secondMemberGroup);
final TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(addressArray);
final HazelcastInstance node1 = factory.newHazelcastInstance(config);
final HazelcastInstance node2 = factory.newHazelcastInstance(config);
final HazelcastInstance node3 = factory.newHazelcastInstance(config);
final IMap<Object, Object> test = node3.getMap(mapName);
test.put(1, 1);
assertBackupEntryCount(1, mapName, factory.getAllHazelcastInstances());
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class InvalidationMemberAddRemoveTest method createConfig.
protected Config createConfig() {
Config config = new Config();
config.setProperty("hazelcast.invalidation.reconciliation.interval.seconds", Integer.toString(RECONCILIATION_INTERVAL_SECONDS));
config.setProperty("hazelcast.invalidation.max.tolerated.miss.count", "0");
config.setProperty("hazelcast.map.invalidation.batch.enabled", "true");
config.setProperty("hazelcast.map.invalidation.batch.size", Integer.toString(INVALIDATION_BATCH_SIZE));
config.setProperty("hazelcast.partition.count", "271");
return config;
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class MapInvalidationMetaDataMigrationTest method uuids_migrated_whenSourceNodeShutdown.
@Test
public void uuids_migrated_whenSourceNodeShutdown() throws Exception {
String mapName = "test";
Config config = newConfig(mapName);
HazelcastInstance instance1 = factory.newHazelcastInstance(config);
IMap<Object, Object> map = instance1.getMap(mapName);
for (int i = 0; i < 10000; i++) {
map.put(i, i);
}
Map<Integer, UUID> source1 = getPartitionToUuidMap(instance1);
HazelcastInstance instance2 = factory.newHazelcastInstance(config);
HazelcastInstance instance3 = factory.newHazelcastInstance(config);
waitAllForSafeState(instance1, instance2, instance3);
instance1.shutdown();
Map<Integer, UUID> destination2 = getPartitionToUuidMap(instance2);
Map<Integer, UUID> destination3 = getPartitionToUuidMap(instance3);
Map<Integer, UUID> merged = mergeOwnedPartitionUuids(destination2, destination3, getNodeEngineImpl(instance2).getPartitionService());
assertEquals(source1, merged);
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class MapInvalidationMetaDataMigrationTest method newConfig.
protected Config newConfig(String mapName) {
NearCacheConfig nearCacheConfig = new NearCacheConfig();
nearCacheConfig.setInMemoryFormat(getNearCacheInMemoryFormat());
nearCacheConfig.setName(mapName);
nearCacheConfig.setInvalidateOnChange(true);
nearCacheConfig.setCacheLocalEntries(true);
MapConfig mapConfig = new MapConfig(mapName);
mapConfig.setNearCacheConfig(nearCacheConfig);
mapConfig.setBackupCount(0).setAsyncBackupCount(0);
Config config = getConfig();
return config.addMapConfig(mapConfig);
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class MapInvalidationMetaDataMigrationTest method sequences_migrated_whenOneNodeContinuouslyStartsAndStops.
@Test
public void sequences_migrated_whenOneNodeContinuouslyStartsAndStops() throws Exception {
final String mapName = "test";
final Config config = newConfig(mapName);
final HazelcastInstance instance1 = factory.newHazelcastInstance(config);
IMap<Object, Object> map = instance1.getMap(mapName);
for (int i = 0; i < 10000; i++) {
map.put(i, i);
}
Map<Integer, Long> source = getPartitionToSequenceMap(mapName, instance1);
HazelcastInstance instance2 = factory.newHazelcastInstance(config);
final AtomicBoolean stop = new AtomicBoolean();
Thread shadow = new Thread(new Runnable() {
public void run() {
while (!stop.get()) {
HazelcastInstance instance = factory.newHazelcastInstance(config);
waitAllForSafeState(instance);
sleepSeconds(5);
instance.shutdown();
}
}
});
shadow.start();
sleepSeconds(20);
stop.set(true);
shadow.join();
instance2.shutdown();
Map<Integer, Long> destination = getPartitionToSequenceMap(mapName, instance1);
assertEquals(source, destination);
}
Aggregations