Search in sources :

Example 61 with MultiMap

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

the class ClientMultiMapTest method testContainsKey_whenKeyNull.

@Test(expected = NullPointerException.class)
public void testContainsKey_whenKeyNull() {
    final MultiMap mm = client.getMultiMap(randomString());
    mm.containsKey(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 62 with MultiMap

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

the class ClientMultiMapTest method testContainsKey_whenKeyNotExists.

@Test
public void testContainsKey_whenKeyNotExists() {
    final MultiMap mm = client.getMultiMap(randomString());
    assertFalse(mm.containsKey("NOT_THERE"));
}
Also used : MultiMap(com.hazelcast.core.MultiMap) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 63 with MultiMap

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

the class ClientTxnMultiMapTest method testRemove.

@Test
public void testRemove() throws Exception {
    final String mapName = randomString();
    final String key = "key";
    final String val = "value";
    MultiMap multiMap = client.getMultiMap(mapName);
    multiMap.put(key, val);
    TransactionContext tx = client.newTransactionContext();
    tx.beginTransaction();
    TransactionalMultiMap txnMultiMap = tx.getMultiMap(mapName);
    txnMultiMap.remove(key, val);
    tx.commitTransaction();
    assertTrue(client.getMultiMap(mapName).get(key).isEmpty());
}
Also used : MultiMap(com.hazelcast.core.MultiMap) TransactionalMultiMap(com.hazelcast.core.TransactionalMultiMap) TransactionContext(com.hazelcast.transaction.TransactionContext) TransactionalMultiMap(com.hazelcast.core.TransactionalMultiMap) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 64 with MultiMap

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

the class ClientTxnMultiMapTest method testSize.

@Test
public void testSize() throws Exception {
    final String mapName = randomString();
    final String key = "key";
    final String value = "value";
    final MultiMap multiMap = client.getMultiMap(mapName);
    multiMap.put(key, value);
    TransactionContext tx = client.newTransactionContext();
    tx.beginTransaction();
    TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
    mulitMapTxn.put(key, "newValue");
    mulitMapTxn.put("newKey", value);
    assertEquals(3, mulitMapTxn.size());
    tx.commitTransaction();
}
Also used : MultiMap(com.hazelcast.core.MultiMap) TransactionalMultiMap(com.hazelcast.core.TransactionalMultiMap) TransactionContext(com.hazelcast.transaction.TransactionContext) TransactionalMultiMap(com.hazelcast.core.TransactionalMultiMap) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 65 with MultiMap

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

the class ClientTxnMultiMapTest method testCount.

@Test
public void testCount() throws Exception {
    final String mapName = randomString();
    final String key = "key";
    final String value = "value";
    final MultiMap multiMap = client.getMultiMap(mapName);
    multiMap.put(key, value);
    TransactionContext tx = client.newTransactionContext();
    tx.beginTransaction();
    TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
    mulitMapTxn.put(key, "newValue");
    assertEquals(2, mulitMapTxn.valueCount(key));
    tx.commitTransaction();
}
Also used : MultiMap(com.hazelcast.core.MultiMap) TransactionalMultiMap(com.hazelcast.core.TransactionalMultiMap) TransactionContext(com.hazelcast.transaction.TransactionContext) TransactionalMultiMap(com.hazelcast.core.TransactionalMultiMap) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

MultiMap (com.hazelcast.core.MultiMap)118 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