Search in sources :

Example 51 with MultiMap

use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.

the class ClientMultiMapLockTest method testForceUnlock_whenKeyNull.

@Test(expected = NullPointerException.class)
public void testForceUnlock_whenKeyNull() {
    final MultiMap mm = client.getMultiMap(randomString());
    mm.forceUnlock(null);
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 52 with MultiMap

use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.

the class ClientMultiMapLockTest method testUnlock_whenRentrantlyLockedBySelf.

@Test
public void testUnlock_whenRentrantlyLockedBySelf() {
    final MultiMap mm = client.getMultiMap(randomString());
    final Object key = "key";
    mm.lock(key);
    mm.lock(key);
    mm.unlock(key);
    assertTrue(mm.isLocked(key));
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 53 with MultiMap

use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.

the class ClientMultiMapLockTest method testTryLock_whenNullKey.

@Test(expected = NullPointerException.class)
public void testTryLock_whenNullKey() {
    final MultiMap mm = client.getMultiMap(randomString());
    mm.tryLock(null);
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 54 with MultiMap

use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.

the class ClientMultiMapLockTest method testUnLock.

@Test
public void testUnLock() {
    final MultiMap mm = client.getMultiMap(randomString());
    final Object key = "key";
    mm.lock(key);
    mm.unlock(key);
    assertFalse(mm.isLocked(key));
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 55 with MultiMap

use of com.hazelcast.multimap.MultiMap in project hazelcast by hazelcast.

the class ListenerLeakTest method testMultiMapEntryListeners.

@Test
public void testMultiMapEntryListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = newHazelcastClient();
    MultiMap multiMap = client.getMultiMap(randomString());
    UUID id = multiMap.addEntryListener(mock(EntryListener.class), false);
    Collection<ClientConnectionRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(multiMap.removeEntryListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) UUID(java.util.UUID) EntryListener(com.hazelcast.core.EntryListener) ClientConnectionRegistration(com.hazelcast.client.impl.spi.impl.listener.ClientConnectionRegistration) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

MultiMap (com.hazelcast.multimap.MultiMap)93 Test (org.junit.Test)93 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)92 QuickTest (com.hazelcast.test.annotation.QuickTest)92 HazelcastTestSupport.randomString (com.hazelcast.test.HazelcastTestSupport.randomString)11 TransactionContext (com.hazelcast.transaction.TransactionContext)8 TransactionalMultiMap (com.hazelcast.transaction.TransactionalMultiMap)8 CountDownLatch (java.util.concurrent.CountDownLatch)7 Collection (java.util.Collection)6 Set (java.util.Set)5 TreeSet (java.util.TreeSet)5 AssertTask (com.hazelcast.test.AssertTask)4 UUID (java.util.UUID)4 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 EntryAdapter (com.hazelcast.core.EntryAdapter)2 EntryEvent (com.hazelcast.core.EntryEvent)2 EntryListener (com.hazelcast.core.EntryListener)2 ArrayList (java.util.ArrayList)2 ClientConnectionRegistration (com.hazelcast.client.impl.spi.impl.listener.ClientConnectionRegistration)1 TestHazelcastFactory (com.hazelcast.client.test.TestHazelcastFactory)1