Package org.jboss.cache.transaction

Examples of org.jboss.cache.transaction.DummyTransactionManager





   public void testTxPutCommit() throws Exception, NotSupportedException {
      DummyTransactionManager mgr=DummyTransactionManager.getInstance();
      mgr.begin();
      Transaction tx=mgr.getTransaction();


      cache1.put(fqn, "key1", "val1");
      cache1.put("/one/two/three/four", "key2", "val2");
      assertNull(cache2.get(fqn, "key1"));
View Full Code Here


   }



   public void testTxPrepareAndRollback() throws Exception, NotSupportedException {
      final DummyTransactionManager mgr=DummyTransactionManager.getInstance();
      mgr.begin();
      Transaction tx1=mgr.getTransaction();

      cache1.setLockAcquisitionTimeout(1500);
      cache2.setLockAcquisitionTimeout(1500);


      Thread locker=new Thread() {
         Transaction tx2=null;
         public void run() {
            try {
               mgr.begin();
               tx2=mgr.getTransaction();
               cache2.put(fqn, "block-key1", "block-val1"); // acquires a lock on cache2./one/two/three
               TestingUtil.sleepThread(5000);
            }
            catch(Exception e) {
               e.printStackTrace();
View Full Code Here

   }


   public void testPutAfterTxCommit() throws Exception, NotSupportedException
   {
      DummyTransactionManager mgr=DummyTransactionManager.getInstance();
      mgr.begin();
      Transaction tx=mgr.getTransaction();

      cache1.put(fqn, "key1", "val1");
      assertTrue(cache1.exists(fqn));
      tx.commit();
      assertTrue(cache1.exists(fqn));
View Full Code Here

      assertTrue(cache1.exists("/a/b/c"));
   }

   public void testPutAfterTxRollback() throws Exception, NotSupportedException
   {
      DummyTransactionManager mgr=DummyTransactionManager.getInstance();
      mgr.begin();
      Transaction tx=mgr.getTransaction();

      cache1.put(fqn, "key1", "val1");
      assertTrue(cache1.exists(fqn));
      tx.rollback();
      assertFalse(cache1.getCacheLoader().exists(fqn));
View Full Code Here

         old_factory=null;
      }
   }

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

         old_factory=null;
      }
   }

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

      cache.evict(Fqn.fromString("/a/2"));
      cache.evict(Fqn.fromString("/a/3"));
      cache.evict(Fqn.fromString("/a"));
      addDelay();

      DummyTransactionManager mgr=DummyTransactionManager.getInstance();

       mgr.begin();
      tx=mgr.getTransaction();
      Set children=cache.getChildrenNames("/a");

       System.out.println("**** " + cache.getTransactionManager());

      assertEquals(3, children.size());
View Full Code Here

   }


   public void testTxPutCommit() throws Exception, NotSupportedException {
      DummyTransactionManager mgr=DummyTransactionManager.getInstance();
      mgr.begin();
      tx=mgr.getTransaction();

      cache.put("/one/two/three", "key1", "val1");
      cache.put("/one/two/three/four", "key2", "val2");
      tx.commit();
      assertNotNull("Cache has node /one/two/three", cache.getKeys("/one/two/three"));
View Full Code Here

      assertEquals("Loader has correct number of children", 1, children.size());
      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");
      log.debug("NODE1 " + cache.get("/one/two/three").getData());
      tx.rollback();
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

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.