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);
}
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"));
}
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());
}
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();
}
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();
}
Aggregations