use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapTest method testClear.
@Test
public void testClear() {
final MultiMap mm = client.getMultiMap(randomString());
final int maxKeys = 9;
final int maxValues = 3;
for (int key = 0; key < maxKeys; key++) {
for (int val = 0; val < maxValues; val++) {
mm.put(key, val);
}
}
mm.clear();
assertEquals(0, mm.size());
}
use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testForceUnlock_whenKeyNull.
@Test(expected = NullPointerException.class)
public void testForceUnlock_whenKeyNull() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
mm.forceUnlock(null);
}
use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testTryLock_whenLockedBySelf.
@Test
public void testTryLock_whenLockedBySelf() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
final Object key = "Key";
mm.lock(key);
assertTrue(mm.tryLock(key));
}
use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testLockTTL_whenLockedBySelf.
@Test
public void testLockTTL_whenLockedBySelf() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
final Object key = "Key";
mm.lock(key);
mm.lock(key, 30, TimeUnit.SECONDS);
assertTrue(mm.isLocked(key));
}
use of com.hazelcast.core.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testLockTTLExpired.
@Test
public void testLockTTLExpired() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
final Object key = "Key";
mm.lock(key, 1, TimeUnit.SECONDS);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertFalse(mm.isLocked(key));
}
});
}
Aggregations