Package org.jboss.test.jca.adapter

Examples of org.jboss.test.jca.adapter.TestConnection


      }
   }
  
   public void doOnePool(BaseConnectionManager2 cm) throws Exception
   {
      TestConnection c1 = allocate(cm, cri1);
      TestManagedConnection mc1 = c1.getMC();
      c1.close();
      TestConnection c2 = allocate(cm, cri1);
      TestManagedConnection mc2 = c2.getMC();
      c2.close();
      assertEquals("Should get the same connection for same criteria", mc1, mc2);
      c2 = allocate(cm, cri2);
      mc2 = c2.getMC();
      c2.close();
      assertEquals("Should get the same connection for different cri", mc1, mc2);
   }
View Full Code Here


      super.tearDown();
   }

   public void testSimple() throws Exception
   {
      TestConnection c = (TestConnection)cm.allocateConnection(mcf, cri);
      assertNotNull(c);
      c.close();
   }
View Full Code Here

      c.close();
   }

   public void testManualTransactionCommit() throws Exception
   {
      TestConnection c = (TestConnection)cm.allocateConnection(mcf, cri);
      assertNotNull(c);
      try
      {
         c.begin();
         assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         c.commit();
         assertEquals(TestManagedConnection.LOCAL_COMMITTED, c.getLocalState());
      }
      finally
      {
         c.close();
      }
   }
View Full Code Here

      }
   }

   public void testManualTransactionRollback() throws Exception
   {
      TestConnection c = (TestConnection)cm.allocateConnection(mcf, cri);
      assertNotNull(c);
      try
      {
         c.begin();
         assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         c.rollback();
         assertEquals(TestManagedConnection.LOCAL_ROLLEDBACK, c.getLocalState());
      }
      finally
      {
         c.close();
      }
   }
View Full Code Here

      }
   }

   public void testManualTransactionForgetToCommitRollback() throws Exception
   {
      TestConnection c = (TestConnection)cm.allocateConnection(mcf, cri);
      assertNotNull(c);
      try
      {
         c.begin();
         assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
      }
      finally
      {
         c.close();
         assertEquals(TestManagedConnection.LOCAL_ROLLEDBACK, c.getLocalState());
      }
   }
View Full Code Here

   }

   public void testJTATransactionCommit() throws Exception
   {
      tm.begin();
      TestConnection c = null;
      try
      {
         c = (TestConnection)cm.allocateConnection(mcf, cri);
         assertNotNull(c);
         try
         {
            assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         }
         finally
         {
            c.close();
            assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         }
      }
      finally
      {
         tm.commit();
         if (c != null)
            assertEquals(TestManagedConnection.LOCAL_COMMITTED, c.getLocalState());
      }
   }
View Full Code Here

   }

   public void testJTATransactionRollback() throws Exception
   {
      tm.begin();
      TestConnection c = null;
      try
      {
         c = (TestConnection)cm.allocateConnection(mcf, cri);
         assertNotNull(c);
         try
         {
            assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         }
         finally
         {
            c.close();
            assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         }
      }
      finally
      {
         tm.rollback();
         if (c != null)
            assertEquals(TestManagedConnection.LOCAL_ROLLEDBACK, c.getLocalState());
      }
   }
View Full Code Here

   }

   public void testUserTransactionCommit() throws Exception
   {
      ut.begin();
      TestConnection c = null;
      try
      {
         c = (TestConnection)cm.allocateConnection(mcf, cri);
         assertNotNull(c);
         try
         {
            assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         }
         finally
         {
            c.close();
            assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         }
      }
      finally
      {
         ut.commit();
         if (c != null)
            assertEquals(TestManagedConnection.LOCAL_COMMITTED, c.getLocalState());
      }
   }
View Full Code Here

   }

   public void testUserTransactionRollback() throws Exception
   {
      ut.begin();
      TestConnection c = null;
      try
      {
         c = (TestConnection)cm.allocateConnection(mcf, cri);
         assertNotNull(c);
         try
         {
            assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         }
         finally
         {
            c.close();
            assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
         }
      }
      finally
      {
         ut.rollback();
         if (c != null)
            assertEquals(TestManagedConnection.LOCAL_ROLLEDBACK, c.getLocalState());
      }
   }
View Full Code Here

   public void testLazyUserTransactionCommit() throws Exception
   {
      ccm.pushMetaAwareObject(this, null);
      try
      {
         TestConnection c = (TestConnection)cm.allocateConnection(mcf, cri);
         assertNotNull(c);
         try
         {
            assertEquals(TestManagedConnection.LOCAL_NONE, c.getLocalState());
            ut.begin();
            try
            {
               assertEquals(TestManagedConnection.LOCAL_TRANSACTION, c.getLocalState());
            }
            finally
            {
               ut.commit();
               assertEquals(TestManagedConnection.LOCAL_COMMITTED, c.getLocalState());
            }
         }
         finally
         {
            c.close();
            assertEquals(TestManagedConnection.LOCAL_COMMITTED, c.getLocalState());
         }
      }
      finally
      {
         ccm.popMetaAwareObject(null);
View Full Code Here

TOP

Related Classes of org.jboss.test.jca.adapter.TestConnection

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.