use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testLock_whenAlreadyLockedBySelf.
@Test
public void testLock_whenAlreadyLockedBySelf() {
final MultiMap mm = client.getMultiMap(randomString());
final Object key = "Key";
mm.lock(key);
mm.lock(key);
assertTrue(mm.isLocked(key));
}
use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapTest method testSizeCount.
@Test
public void testSizeCount() {
final Object key1 = "key1";
final Object key2 = "key2";
final MultiMap mm = client.getMultiMap(randomString());
mm.put(key1, 1);
mm.put(key1, 2);
mm.put(key2, 1);
mm.put(key2, 2);
mm.put(key2, 2);
assertEquals(4, mm.size());
}
use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapTest method testEmptySizeCount.
@Test
public void testEmptySizeCount() {
final MultiMap mm = client.getMultiMap(randomString());
assertEquals(0, mm.size());
}
use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapTest method testRemoveValue_whenValueNotExists.
@Test
public void testRemoveValue_whenValueNotExists() {
final Object key = "key";
final int maxItemsPerKey = 4;
final MultiMap mm = client.getMultiMap(randomString());
for (int i = 0; i < maxItemsPerKey; i++) {
mm.put(key, i);
}
boolean result = mm.remove(key, "NOT_THERE");
assertFalse(result);
}
use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapTest method testRemoveKeyValue.
@Test
public void testRemoveKeyValue() {
final Object key = "key";
final int maxItemsPerKey = 4;
final MultiMap mm = client.getMultiMap(randomString());
for (int i = 0; i < maxItemsPerKey; i++) {
mm.put(key, i);
}
for (int i = 0; i < maxItemsPerKey; i++) {
boolean result = mm.remove(key, i);
assertTrue(result);
}
}
Aggregations