[jboss-cvs] JBossAS SVN: r57139 - branches/Branch_4_0/testsuite/src/main/org/jboss/test/jca/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 25 12:21:50 EDT 2006


Author: weston.price at jboss.com
Date: 2006-09-25 12:21:48 -0400 (Mon, 25 Sep 2006)
New Revision: 57139

Modified:
   branches/Branch_4_0/testsuite/src/main/org/jboss/test/jca/test/XATxConnectionManagerUnitTestCase.java
Log:
[JBAS-3693] Added test case to verify behavior.

Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/jca/test/XATxConnectionManagerUnitTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/jca/test/XATxConnectionManagerUnitTestCase.java	2006-09-25 16:21:14 UTC (rev 57138)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/jca/test/XATxConnectionManagerUnitTestCase.java	2006-09-25 16:21:48 UTC (rev 57139)
@@ -55,7 +55,7 @@
  * Created: Mon Jan 14 00:43:40 2002
  *
  * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
- * @version $Revision:$
+ * @version $Revision$
  */
 public class XATxConnectionManagerUnitTestCase extends JBossTestCase
 {
@@ -356,4 +356,38 @@
      assertTrue(conn2 == null);            
      assertTrue(cm.getPoolingStrategy().getConnectionCount() == 1);
   }
+
+  public void testFailedEndTx() throws Exception
+  {
+     TestManagedConnection.setFailInEnd(false, XAException.XAER_RMFAIL);
+     tm.begin();
+     TestConnection conn = null;
+     TestConnection conn2 = null;
+     
+     try
+     {
+        assertTrue("Connection in pool!", cm.getPoolingStrategy().getConnectionCount() == 0);
+        conn = (TestConnection)cm.allocateConnection(mcf, cri);
+        
+        //One should have been created
+        assertTrue(cm.getPoolingStrategy().getConnectionCount() == 1);
+
+        TestManagedConnection.setFailInEnd(true, XAException.XAER_RMFAIL);
+        
+        conn2 = (TestConnection)cm.allocateConnection(mcf, cri);
+        
+        fail("Should not be here.");
+     
+     }
+     catch (Throwable e)
+     {
+     }      
+     
+     conn.close();
+     
+     assertTrue(conn2 == null);            
+     assertTrue(cm.getPoolingStrategy().getConnectionCount() == 1);
+
+  }
+
 }




More information about the jboss-cvs-commits mailing list