Search in sources :

Example 56 with MultiMap

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

the class ClientMultiMapTest method testPutMultiValuesToKey.

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

Example 57 with MultiMap

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

the class ClientMultiMapTest method testValues_whenEmptyCollection.

@Test
public void testValues_whenEmptyCollection() {
    final MultiMap mm = client.getMultiMap(randomString());
    assertEquals(Collections.EMPTY_LIST, mm.values());
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 58 with MultiMap

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

the class ClientMultiMapTest method testRemoveKey.

@Test
public void testRemoveKey() {
    final Object key = "key";
    final int maxItemsPerKey = 44;
    final MultiMap mm = client.getMultiMap(randomString());
    Set expeted = new TreeSet();
    for (int i = 0; i < maxItemsPerKey; i++) {
        mm.put(key, i);
        expeted.add(i);
    }
    Set resultSet = new TreeSet(mm.remove(key));
    assertEquals(expeted, resultSet);
    assertEquals(0, mm.size());
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) TreeSet(java.util.TreeSet) Set(java.util.Set) TreeSet(java.util.TreeSet) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 59 with MultiMap

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

the class ClientMultiMapTest method testGetLocalMultiMapStats.

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

Example 60 with MultiMap

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

the class ClientMultiMapTest method testKeyValues.

@Test
public void testKeyValues() {
    final int maxKeys = 31;
    final int maxValues = 3;
    final MultiMap mm = client.getMultiMap(randomString());
    Set expected = new TreeSet();
    for (int key = 0; key < maxKeys; key++) {
        for (int val = 0; val < maxValues; val++) {
            mm.put(key, val);
            expected.add(val);
        }
    }
    Set resultSet = new TreeSet(mm.values());
    assertEquals(expected, resultSet);
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) TreeSet(java.util.TreeSet) Set(java.util.Set) TreeSet(java.util.TreeSet) 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