Search in sources :

Example 61 with MultiMap

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

the class ClientMultiMapTest method testPut.

@Test
public void testPut() {
    final Object key = "key1";
    final MultiMap mm = client.getMultiMap(randomString());
    assertTrue(mm.put(key, 1));
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 62 with MultiMap

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

the class ClientMultiMapTest method testValueCount_whenKeyNotThere.

@Test
public void testValueCount_whenKeyNotThere() {
    final Object key = "key1";
    final MultiMap mm = client.getMultiMap(randomString());
    assertEquals(0, mm.valueCount("NOT_THERE"));
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 63 with MultiMap

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

the class ClientMultiMapListenersTest method testListenerEntryAddEvent_whenValueNotIncluded.

@Test
public void testListenerEntryAddEvent_whenValueNotIncluded() throws InterruptedException {
    final int maxKeys = 21;
    final int maxItems = 3;
    final MultiMap mm = client.getMultiMap(randomString());
    MyEntryListener listener = new CountDownValueNullListener(maxKeys * maxItems);
    mm.addEntryListener(listener, false);
    for (int i = 0; i < maxKeys; i++) {
        for (int j = 0; j < maxKeys; j++) {
            mm.put(i, j);
        }
    }
    assertOpenEventually(listener.addLatch);
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 64 with MultiMap

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

the class ClientMultiMapListenersTest method testListenerOnKeyEntryRemoveEvent.

@Test
public void testListenerOnKeyEntryRemoveEvent() throws InterruptedException {
    final Object key = "key";
    final int maxItems = 88;
    final MultiMap mm = client.getMultiMap(randomString());
    MyEntryListener listener = new CountDownValueNotNullListener(maxItems);
    mm.addEntryListener(listener, key, true);
    for (int i = 0; i < maxItems; i++) {
        mm.put(key, i);
        mm.remove(key, i);
    }
    assertOpenEventually(listener.removeLatch);
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 65 with MultiMap

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

the class ClientMultiMapListenersTest method testAddLocalEntryListener.

@Test(expected = UnsupportedOperationException.class)
public void testAddLocalEntryListener() {
    final MultiMap mm = client.getMultiMap(randomString());
    MyEntryListener myEntryListener = new CountDownValueNotNullListener(1);
    mm.addLocalEntryListener(myEntryListener);
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) 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