Search in sources :

Example 16 with MultiMap

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

the class ClientMultiMapLockTest method testLock.

@Test
public void testLock() throws Exception {
    final MultiMap mm = client.getMultiMap(randomString());
    final Object key = "Key";
    mm.lock(key);
    assertTrue(mm.isLocked(key));
}
Also used : MultiMap(com.hazelcast.core.MultiMap) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 17 with MultiMap

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

the class ClientMultiMapTest method testRemove_whenKeyNotExist.

@Test
public void testRemove_whenKeyNotExist() {
    final MultiMap mm = client.getMultiMap(randomString());
    Collection coll = mm.remove("NOT_THERE");
    assertTrue(coll.isEmpty());
}
Also used : MultiMap(com.hazelcast.core.MultiMap) Collection(java.util.Collection) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 18 with MultiMap

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

the class ClientMultiMapTest method testKeySet.

@Test
public void testKeySet() {
    final int maxKeys = 23;
    final MultiMap mm = client.getMultiMap(randomString());
    Set expected = new TreeSet();
    for (int key = 0; key < maxKeys; key++) {
        mm.put(key, 1);
        expected.add(key);
    }
    assertEquals(expected, mm.keySet());
}
Also used : MultiMap(com.hazelcast.core.MultiMap) Set(java.util.Set) TreeSet(java.util.TreeSet) TreeSet(java.util.TreeSet) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 19 with MultiMap

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

the class ClientMultiMapTest method testContainsValue_whenSearchValueNull.

@Test(expected = NullPointerException.class)
public void testContainsValue_whenSearchValueNull() {
    final MultiMap mm = client.getMultiMap(randomString());
    mm.containsValue(null);
}
Also used : MultiMap(com.hazelcast.core.MultiMap) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 20 with MultiMap

use of com.hazelcast.core.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"));
}
Also used : MultiMap(com.hazelcast.core.MultiMap) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

MultiMap (com.hazelcast.core.MultiMap)117 Test (org.junit.Test)117 QuickTest (com.hazelcast.test.annotation.QuickTest)107 ParallelTest (com.hazelcast.test.annotation.ParallelTest)106 HazelcastInstance (com.hazelcast.core.HazelcastInstance)16 HazelcastTestSupport.randomString (com.hazelcast.test.HazelcastTestSupport.randomString)12 Map (java.util.Map)11 Config (com.hazelcast.config.Config)9 TransactionalMultiMap (com.hazelcast.core.TransactionalMultiMap)9 JobTracker (com.hazelcast.mapreduce.JobTracker)9 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)9 HashMap (java.util.HashMap)9 TransactionContext (com.hazelcast.transaction.TransactionContext)8 SlowTest (com.hazelcast.test.annotation.SlowTest)7 CountDownLatch (java.util.concurrent.CountDownLatch)6 AssertTask (com.hazelcast.test.AssertTask)5 Collection (java.util.Collection)5 List (java.util.List)5 Set (java.util.Set)4 TreeSet (java.util.TreeSet)4