예제 #1
0
  @Test
  @InSequence(2)
  @Ignore
  public void testTransactionCommit() throws Throwable {
    userTx.begin();
    HazelcastConnection c = getConnection();
    try {
      TransactionalMap<String, String> m = c.getTransactionalMap("testTransactionCommit");

      m.put("key", "value");

      doSql();

      assertEquals("value", m.get("key"));
    } finally {
      c.close();
    }
    userTx.commit();
    HazelcastConnection con2 = getConnection();

    try {
      assertEquals("value", con2.getMap("testTransactionCommit").get("key"));
      validateSQLdata(true);
    } finally {
      con2.close();
    }
  }
예제 #2
0
  @Test
  public void testTxnMapGet_BeforeCommit() throws Exception {
    final String mapName = randomString();
    final String key = "key";
    final String value = "Value";
    final IMap map = client.getMap(mapName);

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

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

    context.commitTransaction();
  }