Search in sources :

Example 91 with MultiMap

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

the class ClientTxnMultiMapTest method testRemove_whenBackedWithList.

@Test
public void testRemove_whenBackedWithList() throws Exception {
    final String mapName = multiMapBackedByList + randomString();
    final String key = "key";
    final String value = "value";
    final MultiMap multiMap = server.getMultiMap(mapName);
    multiMap.put(key, value);
    TransactionContext tx = client.newTransactionContext();
    tx.beginTransaction();
    TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
    Collection c = mulitMapTxn.remove(key);
    assertFalse(c.isEmpty());
    tx.commitTransaction();
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) TransactionalMultiMap(com.hazelcast.transaction.TransactionalMultiMap) TransactionContext(com.hazelcast.transaction.TransactionContext) TransactionalMultiMap(com.hazelcast.transaction.TransactionalMultiMap) Collection(java.util.Collection) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 92 with MultiMap

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

the class ClientTxnMultiMapTest method testRemoveAll.

@Test
public void testRemoveAll() throws Exception {
    final String mapName = randomString();
    final String key = "key";
    MultiMap multiMap = client.getMultiMap(mapName);
    for (int i = 0; i < 10; i++) {
        multiMap.put(key, i);
    }
    TransactionContext tx = client.newTransactionContext();
    tx.beginTransaction();
    TransactionalMultiMap txnMultiMap = tx.getMultiMap(mapName);
    txnMultiMap.remove(key);
    tx.commitTransaction();
    assertTrue(multiMap.get(key).isEmpty());
}
Also used : MultiMap(com.hazelcast.multimap.MultiMap) TransactionalMultiMap(com.hazelcast.transaction.TransactionalMultiMap) TransactionContext(com.hazelcast.transaction.TransactionContext) TransactionalMultiMap(com.hazelcast.transaction.TransactionalMultiMap) HazelcastTestSupport.randomString(com.hazelcast.test.HazelcastTestSupport.randomString) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 93 with MultiMap

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

the class MBeanTest method testMultiMap.

@Test
public void testMultiMap() throws Exception {
    MultiMap map = holder.getHz().getMultiMap("multimap");
    map.size();
    holder.assertMBeanExistEventually("MultiMap", map.getName());
}
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