use of com.hazelcast.replicatedmap.ReplicatedMap in project hazelcast by hazelcast.
the class MBeanDestroyTest method testReplicatedMap.
@Test
public void testReplicatedMap() throws Exception {
String replicatedMapName = randomString();
ReplicatedMap replicatedMap = holder.getHz().getReplicatedMap(replicatedMapName);
replicatedMap.size();
holder.assertMBeanExistEventually("ReplicatedMap", replicatedMap.getName());
destroyObjectAndAssert(replicatedMap, "ReplicatedMap");
}
use of com.hazelcast.replicatedmap.ReplicatedMap in project hazelcast by hazelcast.
the class MBeanTest method testReplicatedMap.
@Test
public void testReplicatedMap() throws Exception {
String replicatedMapName = randomString();
ReplicatedMap replicatedMap = holder.getHz().getReplicatedMap(replicatedMapName);
replicatedMap.size();
holder.assertMBeanExistEventually("ReplicatedMap", replicatedMap.getName());
}
use of com.hazelcast.replicatedmap.ReplicatedMap in project hazelcast by hazelcast.
the class ClientReplicatedMapTest method testClear.
@Test
public void testClear() {
HazelcastInstance instance1 = factory.newHazelcastInstance(config);
HazelcastInstance instance2 = factory.newHazelcastClient();
final ReplicatedMap<String, String> map1 = instance1.getReplicatedMap("default");
final ReplicatedMap<String, String> map2 = instance2.getReplicatedMap("default");
for (int i = 0; i < OPERATION_COUNT; i++) {
map1.put("foo-" + i, "bar");
}
for (Map.Entry<String, String> entry : map2.entrySet()) {
assertStartsWith("foo-", entry.getKey());
assertEquals("bar", entry.getValue());
}
for (Map.Entry<String, String> entry : map1.entrySet()) {
assertStartsWith("foo-", entry.getKey());
assertEquals("bar", entry.getValue());
}
map1.clear();
assertEquals(0, map1.size());
assertEquals(0, map2.size());
}
use of com.hazelcast.replicatedmap.ReplicatedMap in project hazelcast by hazelcast.
the class ClientReplicatedMapTest method testUpdate.
@Test
public void testUpdate() {
HazelcastInstance instance1 = factory.newHazelcastInstance(config);
HazelcastInstance instance2 = factory.newHazelcastClient();
final ReplicatedMap<String, String> map1 = instance1.getReplicatedMap("default");
final ReplicatedMap<String, String> map2 = instance2.getReplicatedMap("default");
for (int i = 0; i < OPERATION_COUNT; i++) {
map1.put("foo-" + i, "bar");
}
for (Map.Entry<String, String> entry : map2.entrySet()) {
assertStartsWith("foo-", entry.getKey());
assertEquals("bar", entry.getValue());
}
for (Map.Entry<String, String> entry : map1.entrySet()) {
assertStartsWith("foo-", entry.getKey());
assertEquals("bar", entry.getValue());
}
for (int i = 0; i < OPERATION_COUNT; i++) {
map2.put("foo-" + i, "bar2");
}
for (Map.Entry<String, String> entry : map2.entrySet()) {
assertEquals("bar2", entry.getValue());
}
for (Map.Entry<String, String> entry : map1.entrySet()) {
assertEquals("bar2", entry.getValue());
}
}
use of com.hazelcast.replicatedmap.ReplicatedMap in project hazelcast by hazelcast.
the class ClientReplicatedMapTest method testRemove.
@Test
public void testRemove() {
HazelcastInstance instance1 = factory.newHazelcastInstance(config);
HazelcastInstance instance2 = factory.newHazelcastClient();
final ReplicatedMap<String, String> map1 = instance1.getReplicatedMap("default");
final ReplicatedMap<String, String> map2 = instance2.getReplicatedMap("default");
for (int i = 0; i < OPERATION_COUNT; i++) {
map1.put("foo-" + i, "bar");
}
for (Map.Entry<String, String> entry : map2.entrySet()) {
assertStartsWith("foo-", entry.getKey());
assertEquals("bar", entry.getValue());
}
for (Map.Entry<String, String> entry : map1.entrySet()) {
assertStartsWith("foo-", entry.getKey());
assertEquals("bar", entry.getValue());
}
for (int i = 0; i < OPERATION_COUNT; i++) {
map2.remove("foo-" + i);
}
for (int i = 0; i < OPERATION_COUNT; i++) {
assertNull(map2.get("foo-" + i));
}
for (int i = 0; i < OPERATION_COUNT; i++) {
assertNull(map1.get("foo-" + i));
}
}
Aggregations