use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class MapConfigRequestTest method setUp.
@Before
public void setUp() {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
HazelcastInstance[] instances = factory.newInstances();
managementCenterService = getNode(instances[0]).getManagementCenterService();
mapName = randomMapName();
dto = new MapConfigDTO(new MapConfig("MapConfigRequestTest"));
}
use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class EmbeddedMapInterceptorTest method testPutTransientInterceptedValuePropagatesToBackupCorrectly.
@Test
public void testPutTransientInterceptedValuePropagatesToBackupCorrectly() throws Exception {
TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(3);
HazelcastInstance h1 = startNode(nodeFactory);
HazelcastInstance h2 = startNode(nodeFactory);
IMap<Object, Object> map1 = h1.getMap(mapName);
IMap<Object, Object> map2 = h2.getMap(mapName);
String key = generateKeyOwnedBy(h1);
map1.putTransient(key, key, 1, TimeUnit.MINUTES);
assertEquals(key.toUpperCase() + "-foo", map1.get(key));
h1.getLifecycleService().shutdown();
assertEquals(key.toUpperCase() + "-foo", map2.get(key));
}
use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class EmbeddedMapInterceptorTest method testStoppingNodeLeavesInterceptor.
/**
* Test for issue #3932 (https://github.com/hazelcast/hazelcast/issues/3932)
*/
@Test
public void testStoppingNodeLeavesInterceptor() {
TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(3);
HazelcastInstance i1 = startNode(nodeFactory);
HazelcastInstance i2 = startNode(nodeFactory);
final IMap<Integer, String> map1 = i1.getMap(mapName);
final IMap<Integer, String> map2 = i2.getMap(mapName);
String[] cities = { "NEW YORK", "ISTANBULL", "TOKYO", "LONDON", "PARIS", "CAIRO", "HONG KONG" };
putAll(map1, cities);
//Now terminate one node
i2.shutdown();
assertGet(map1, "-foo", cities);
//Now adding the node back in
i2 = startNode(nodeFactory);
IMap<Integer, String> map2b = i2.getMap(mapName);
assertGet(map1, "-foo", cities);
assertGet(map2b, "-foo", cities);
}
use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class EmbeddedMapInterceptorTest method testPutIfAbsentInterceptedValuePropagatesToBackupCorrectly.
@Test
public void testPutIfAbsentInterceptedValuePropagatesToBackupCorrectly() throws Exception {
TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(3);
HazelcastInstance h1 = startNode(nodeFactory);
HazelcastInstance h2 = startNode(nodeFactory);
IMap<Object, Object> map1 = h1.getMap(mapName);
IMap<Object, Object> map2 = h2.getMap(mapName);
String key = generateKeyOwnedBy(h1);
map1.putIfAbsent(key, key);
assertEquals(key.toUpperCase() + "-foo", map1.get(key));
h1.getLifecycleService().shutdown();
assertEquals(key.toUpperCase() + "-foo", map2.get(key));
}
use of com.hazelcast.test.TestHazelcastInstanceFactory in project hazelcast by hazelcast.
the class EmbeddedMapInterceptorTest method testTryPutInterceptedValuePropagatesToBackupCorrectly.
@Test
public void testTryPutInterceptedValuePropagatesToBackupCorrectly() throws Exception {
TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(3);
HazelcastInstance h1 = startNode(nodeFactory);
HazelcastInstance h2 = startNode(nodeFactory);
IMap<Object, Object> map1 = h1.getMap(mapName);
IMap<Object, Object> map2 = h2.getMap(mapName);
String key = generateKeyOwnedBy(h1);
map1.tryPut(key, key, 5, TimeUnit.SECONDS);
assertEquals(key.toUpperCase() + "-foo", map1.get(key));
h1.getLifecycleService().shutdown();
assertEquals(key.toUpperCase() + "-foo", map2.get(key));
}
Aggregations