use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testLockTTL_whenLockedBySelf.
@Test
public void testLockTTL_whenLockedBySelf() {
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.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testUnlock_whenNotLocked.
@Test(expected = IllegalMonitorStateException.class)
public void testUnlock_whenNotLocked() {
final MultiMap mm = client.getMultiMap(randomString());
mm.unlock("NOT_LOCKED");
}
use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testLockTTL.
@Test
public void testLockTTL() {
final MultiMap mm = client.getMultiMap(randomString());
final Object key = "Key";
mm.lock(key, 30, TimeUnit.SECONDS);
assertTrue(mm.isLocked(key));
}
use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapLockTest method testUnlock_whenLockedByOther.
@Test(expected = IllegalMonitorStateException.class)
public void testUnlock_whenLockedByOther() throws Exception {
final MultiMap mm = client.getMultiMap(randomString());
final Object key = "key";
mm.lock(key);
UnLockThread t = new UnLockThread(mm, key);
t.start();
assertJoinable(t);
throw t.exception;
}
use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.
the class ClientMultiMapTest method testContainsEntry.
@Test
public void testContainsEntry() {
final MultiMap mm = client.getMultiMap(randomString());
mm.put("key1", "value1");
assertTrue(mm.containsEntry("key1", "value1"));
assertFalse(mm.containsEntry("key1", "NOT_THERE"));
assertFalse(mm.containsEntry("NOT_THERE", "NOT_THERE"));
assertFalse(mm.containsEntry("NOT_THERE", "value1"));
}
Aggregations