Package org.jboss.cache.transaction

Examples of org.jboss.cache.transaction.DummyTransactionManager


      cache.remove("/");
   }


   public void testTxPutRollback() throws Exception, NotSupportedException {
      DummyTransactionManager mgr=DummyTransactionManager.getInstance();

      cache.remove("/one");
      addDelay();
      mgr.begin();
      tx=mgr.getTransaction();

      cache.put("/one/two/three", "key1", "val1");
      cache.put("/one/two/three/four", "key2", "val2");
      tx.rollback();
      addDelay();
View Full Code Here


    * Tests basic operations with a transaction.
    */
   public void testBasicOperationsTransactional()
      throws Exception {

      DummyTransactionManager mgr=DummyTransactionManager.getInstance();
      mgr.begin();
      tx=mgr.getTransaction();
      doTestBasicOperations();
      tx.commit();
   }
View Full Code Here

   /**
    * Tests basic operations with a transaction.
    */
   public void testModificationsTransactional()
      throws Exception {
      DummyTransactionManager mgr=DummyTransactionManager.getInstance();
      mgr.begin();
      tx=mgr.getTransaction();
      doTestModifications();
      tx.commit();
   }
View Full Code Here

      oldFactory_ = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
      System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);

      DummyTransactionManager.getInstance();
      nodeList_ = nodeGen(depth_, children_);
      tm_ = new DummyTransactionManager();

      log("ReplicatedSyncPerfAopTest: cacheMode=REPL_SYNC");
   }
View Full Code Here

      oldFactory_ = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
      System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);

      DummyTransactionManager.getInstance();
      initCaches(TreeCache.LOCAL);
      tm_ = new DummyTransactionManager();

      originalStrBuf_ = new StringBuffer();
      newStrBuf_ = new StringBuffer();
      generateString();
      log("ReplicatedAsyncPerfAopTest: cacheMode=ReplAsync");
View Full Code Here

         fail("Test fails with exception " +ex);
      }     
   }

   Transaction beginTransaction() throws SystemException, NotSupportedException {
      DummyTransactionManager mgr=DummyTransactionManager.getInstance();
      mgr.begin();
      Transaction tx=mgr.getTransaction();
      return tx;
   }
View Full Code Here

      oldFactory_ = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
      System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);

      DummyTransactionManager.getInstance();
      initCaches(TreeCache.LOCAL);
      tm_ = new DummyTransactionManager();

      log("ReplicatedAsyncPerfAopTest: cacheMode=Local");
      nodeList_ = nodeGen(depth_, children_);
      populateNode();
   }
View Full Code Here

      System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);

      DummyTransactionManager.getInstance();
      initCaches(TreeCache.LOCAL);
      nodeList_ = nodeGen(depth_, children_);
      tm_ = new DummyTransactionManager();

      log("LocalPerfAopTest: cacheMode=LOCAL, one cache");
   }
View Full Code Here

        nodeInterceptor.setNext(dummy);

        cache.setInterceptorChain(interceptor);

//     first set up a node with a pojo
        DummyTransactionManager mgr = DummyTransactionManager.getInstance();
        mgr.begin();
        Transaction tx = mgr.getTransaction();

        // inject InvocationContext
        cache.getInvocationContext().setTransaction(tx);
        cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx));

        SamplePojo pojo = new SamplePojo(21, "test");

        cache.put("/one/two", "key1", pojo);

        //suspend current transaction
        mgr.suspend();

        //start a new transaction
        mgr.begin();
        Transaction tx2 = mgr.getTransaction();
        cache.getInvocationContext().setTransaction(tx2);
        cache.getInvocationContext().setGlobalTransaction(cache.getCurrentTransaction(tx2));

        SamplePojo pojo2 = new SamplePojo(21, "test");

        cache.put("/one/two", "key2", pojo2);

        assertEquals(null, dummy.getCalled());
        TransactionTable table = cache.getTransactionTable();


        GlobalTransaction gtx = table.get(tx);

        OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);

        TransactionWorkspace workspace = entry.getTransactionWorkSpace();

        //resume the suspended transaction
        GlobalTransaction gtx2 = table.get(tx2);

        OptimisticTransactionEntry entry2 = (OptimisticTransactionEntry) table.get(gtx2);

        TransactionWorkspace workspace2 = entry2.getTransactionWorkSpace();

        //commit both tx
        mgr.commit();
        mgr.resume(tx);
        mgr.commit();

        //assert that our keys are in one space
        assertEquals(3, workspace.getNodes().size());
        assertNotNull(workspace.getNode(Fqn.fromString("/one/two")));
        assertEquals(pojo, workspace.getNode(Fqn.fromString("/one/two")).get("key1"));
View Full Code Here


        TreeCache cache = createReplicatedCache(TreeCache.REPL_ASYNC);
        TreeCache cache2 = createReplicatedCache(TreeCache.REPL_ASYNC);

        DummyTransactionManager mgr = DummyTransactionManager.getInstance();

        //start local transaction
        mgr.begin();
        Transaction tx = mgr.getTransaction();

        //this sets
        GlobalTransaction gtx = cache.getCurrentTransaction(tx);

        SamplePojo pojo = new SamplePojo(21, "test");

        cache.put("/one/two", "key1", pojo);

        //GlobalTransaction gtx = cache.getCurrentTransaction(tx);
        TransactionTable table = cache.getTransactionTable();
        assertNotNull(mgr.getTransaction());
        mgr.commit();


        assertNull(mgr.getTransaction());

        //assert that the local cache is in the right state
        assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
        assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());
View Full Code Here

TOP

Related Classes of org.jboss.cache.transaction.DummyTransactionManager

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.