Package org.infinispan.transaction.tm

Examples of org.infinispan.transaction.tm.DummyTransaction


   public void testSecondTxCannotPrepare1() throws Exception {

      tm(0).begin();
      cache(0).put("k0", "v");
      DummyTransaction dtm = (DummyTransaction) tm(0).suspend();

      assert checkTxCount(0, 1, 0);
      assert checkTxCount(1, 0, 0);
      assert checkTxCount(2, 0, 0);
View Full Code Here


   public void testSecondTxCannotPrepare2() throws Exception {

      tm(1).begin();
      cache(1).put("k0", "v");
      DummyTransaction dtm = (DummyTransaction) tm(1).suspend();

      assert checkTxCount(0, 0, 1);
      assert checkTxCount(1, 1, 0);
      assert checkTxCount(2, 0, 1);
View Full Code Here

         throw new RuntimeException(e);
      }
   }

   private Xid getXid() throws SystemException {
      Xid xid;DummyTransaction dummyTransaction = (DummyTransaction) tm().getTransaction();
      xid = dummyTransaction.getXid();
      return xid;
   }
View Full Code Here

         public Object call() throws Exception {
            for (int i = 0; i < TX_COUNT; i++) {
               Object k = getKeyForCache(1);
               tm(0).begin();
               cache(0).put(k, k);
               DummyTransaction transaction = ((DummyTransactionManager) tm(0)).getTransaction();
               keys2Tx.put(k, transaction);
               tm(0).commit();
            }
            return null;
         }
View Full Code Here

      cache.put("k", "v");
      TransactionXaAdapter xaRes = (TransactionXaAdapter) dummyTm().firstEnlistedResource();
      assertPrepared(0, dummyTm().getTransaction());
      xaRes.prepare(xaRes.getLocalTransaction().getXid());
      assertPrepared(1, dummyTm().getTransaction());
      final DummyTransaction suspend = (DummyTransaction) dummyTm().suspend();

      xaRes.commit(xaRes.getLocalTransaction().getXid(), false);
      assertPrepared(0, suspend);
      assertEquals(0, TestingUtil.getTransactionTable(cache).getLocalTxCount());
   }
View Full Code Here

      assertPrepared(0, suspend);
      assertEquals(0, TestingUtil.getTransactionTable(cache).getLocalTxCount());
   }

   public void testMultipleTransactions() throws Exception {
      DummyTransaction suspend1 = beginTx();
      DummyTransaction suspend2 = beginTx();
      DummyTransaction suspend3 = beginTx();
      DummyTransaction suspend4 = beginTx();

      assertPrepared(0, suspend1, suspend2, suspend3, suspend4);

      prepareTransaction(suspend1);
      assertPrepared(1, suspend1, suspend2, suspend3, suspend4);
View Full Code Here

         Object key = getKeyForCache(0);
         if (key2Tx.containsKey(key)) continue;

         dummyTm(nodeThatPuts).begin();
         cache(nodeThatPuts).put(key, key);
         DummyTransaction tx = dummyTm(nodeThatPuts).getTransaction();
         tx.runPrepare();
         dummyTm(nodeThatPuts).suspend();
         key2Tx.put(key, tx);

         assertLocked(0, key);
      }
View Full Code Here

   public void testTxAndLockOnSameNode() throws Exception {
      final Object k = getKeyForCache(0);

      tm(0).begin();
      cache(0).put(k, "v");
      DummyTransaction dtm = (DummyTransaction) tm(0).getTransaction();

      dtm.runPrepare();

      assert lockManager(0).isLocked(k);
      assert !lockManager(1).isLocked(k);
      assert !lockManager(2).isLocked(k);

      dtm.runCommitTx();

      assertNotLocked(k);
      assertValue(k, false);
   }
View Full Code Here

      Object k = getKeyForCache(2);
     
      tm(1).begin();
      cache(1).put(k,"v");
      final DummyTransaction transaction = (DummyTransaction) tm(1).getTransaction();
      transaction.runPrepare();
      tm(1).suspend();

      assertNotLocked(cache(0), k);
      assertNotLocked(cache(1), k);
      assertLocked(cache(2), k);
View Full Code Here

      assertNotLocked("k");

      tm(0).begin();
      operation.perform("k", 0);
      DummyTransaction dtm = (DummyTransaction) tm(0).getTransaction();
      dtm.runPrepare();

      assert lockManager(0).isLocked("k");
      assert !lockManager(1).isLocked("k");
      assert !lockManager(2).isLocked("k");

      dtm.runCommitTx();
      tm(0).suspend();

      assertNotLocked("k");

      assertValue("k", removed);
View Full Code Here

TOP

Related Classes of org.infinispan.transaction.tm.DummyTransaction

Copyright © 2018 www.massapicom. 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.