Package com.hazelcast.transaction

Examples of com.hazelcast.transaction.TransactionContext.commitTransaction()


        TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
        mulitMapTxn.put(key, "newValue");

        assertEquals(2, mulitMapTxn.valueCount(key));

        tx.commitTransaction();
    }

    @Test
    public void testGet_whenBackedWithList() throws Exception {
        final String mapName = multiMapBackedByList+randomString();
View Full Code Here


        TransactionContext tx = client.newTransactionContext();
        tx.beginTransaction();
        TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
        Collection c = mulitMapTxn.get(key);
        assertFalse(c.isEmpty());
        tx.commitTransaction();
    }

    @Test
    public void testRemove_whenBackedWithList() throws Exception {
        final String mapName = multiMapBackedByList+randomString();
View Full Code Here

        TransactionContext tx = client.newTransactionContext();
        tx.beginTransaction();
        TransactionalMultiMap mulitMapTxn = tx.getMultiMap(mapName);
        Collection c = mulitMapTxn.remove(key);
        assertFalse(c.isEmpty());
        tx.commitTransaction();
    }
}
View Full Code Here

            mapTransaction.set(key, cb);

            cb.setAmount(700);
            mapTransaction.set(key, cb);

            context.commitTransaction();

        } catch (TransactionException e) {
            e.printStackTrace();
            fail();
        }
View Full Code Here

        final TransactionContext context = client.newTransactionContext();
        context.beginTransaction();
        final TransactionalMap<Object, Object> txnMap = context.getMap(mapName);
        txnMap.put(key, value);
        context.commitTransaction();

        assertEquals(value, map.get(key));
    }

    @Test
View Full Code Here

        context.beginTransaction();
        final TransactionalMap<Object, Object> txnMap = context.getMap(mapName);

        assertNull(txnMap.put(key, value));

        context.commitTransaction();
    }

    @Test
    public void testTxnMapGet_BeforeCommit() throws Exception {
        final String mapName = randomString();
View Full Code Here

        txnMap.put(key, value);
        assertEquals(value, txnMap.get(key));
        assertNull(map.get(key));

        context.commitTransaction();
    }

    @Test
    public void testPutWithTTL() {
        final String mapName = randomString();
View Full Code Here

        final TransactionalMap<Object, Object> txnMap = context.getMap(mapName);

        txnMap.put(key, value, ttlSeconds, TimeUnit.SECONDS);
        Object resultFromClientWhileTxnInProgress = map.get(key);

        context.commitTransaction();

        assertNull(resultFromClientWhileTxnInProgress);
        assertEquals(value, map.get(key));

        //waite for ttl to expire
View Full Code Here

        assertNull(txMap.put("key2", "value2"));
        assertEquals(2, txMap.size());
        assertEquals(2, txMap.keySet().size());
        assertEquals(2, txMap.values().size());

        context.commitTransaction();

        assertEquals(2, map.size());
        assertEquals(2, map.keySet().size());
        assertEquals(2, map.values().size());
    }
View Full Code Here

        assertEquals(0, txMap.keySet(new SqlPredicate("age = 10")).size());
        assertEquals(0, txMap.values(new SqlPredicate("age = 10")).size());
        assertEquals(2, txMap.keySet(new SqlPredicate("age >= 10")).size());
        assertEquals(2, txMap.values(new SqlPredicate("age >= 10")).size());

        context.commitTransaction();

        assertEquals(2, map.size());
        assertEquals(2, map.values().size());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.