[jboss-cvs] JBossAS SVN: r100025 - in trunk/testsuite/src/main/org/jboss/test/tm: test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 27 18:16:14 EST 2010


Author: bstansberry at jboss.com
Date: 2010-01-27 18:16:14 -0500 (Wed, 27 Jan 2010)
New Revision: 100025

Modified:
   trunk/testsuite/src/main/org/jboss/test/tm/resource/MTOperation.java
   trunk/testsuite/src/main/org/jboss/test/tm/test/MTTransactionManagerUnitTestCase.java
Log:
[JBAS-6896] Port to trunk

Modified: trunk/testsuite/src/main/org/jboss/test/tm/resource/MTOperation.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/tm/resource/MTOperation.java	2010-01-27 23:05:10 UTC (rev 100024)
+++ trunk/testsuite/src/main/org/jboss/test/tm/resource/MTOperation.java	2010-01-27 23:16:14 UTC (rev 100025)
@@ -80,7 +80,10 @@
    
    /** Set when an exception is expected */
    protected Throwable throwable;
-   
+
+   /** If a throwable is required, or only *may* occur */
+   private boolean require;
+
    // Static Methods ------------------------------------------------
    
    /**
@@ -134,9 +137,15 @@
 
    public MTOperation(int op, int id, Throwable throwable)
    {
+      this(op, id, throwable, true);
+   }
+
+   public MTOperation(int op, int id, Throwable throwable, boolean require)
+   {
       this.id = new Integer(id);
       this.op = op;
       this.throwable = throwable;
+      this.require = require;
    }
    
    // Public Methods ------------------------------------------------
@@ -189,20 +198,20 @@
          caught = t;
       }
 
-      // expected an exception but caught none
-      if (throwable != null && caught == null)
+      // required an exception but caught none
+      if (require && throwable != null && caught == null)
       {
          throw new Exception("Expected throwable " + throwable);
       }
-      
-      // expected an exception but caught the wrong one
-      if (throwable != null && (throwable.getClass().isAssignableFrom(caught.getClass())) == false)
+
+      // got an exception, but it was the wrong one
+      if (throwable != null && caught != null && !throwable.getClass().isAssignableFrom(caught.getClass()))
       {
          log.warn("Caught wrong throwable", caught);
          throw new Exception("Expected throwable " + throwable + " caught " + caught);
       }
-      
-      // did not expect an exception bug caught one
+
+      // did not expect an exception but caught one
       if (throwable == null && caught != null)
       {
          log.warn("Caught unexpected throwable", caught);

Modified: trunk/testsuite/src/main/org/jboss/test/tm/test/MTTransactionManagerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/tm/test/MTTransactionManagerUnitTestCase.java	2010-01-27 23:05:10 UTC (rev 100024)
+++ trunk/testsuite/src/main/org/jboss/test/tm/test/MTTransactionManagerUnitTestCase.java	2010-01-27 23:16:14 UTC (rev 100025)
@@ -191,9 +191,11 @@
                new MTOperation(MTOperation.TM_BEGIN, 10),
                new MTOperation(MTOperation.TM_GET_STATUS),
                new MTOperation(MTOperation.XX_SLEEP_200),
-               new MTOperation(MTOperation.TM_GET_STATUS),               
-               new MTOperation(MTOperation.TM_COMMIT, -1, new IllegalStateException())
-   
+               new MTOperation(MTOperation.TM_GET_STATUS),
+
+               // FIXME - JBTM-558
+               new MTOperation(MTOperation.TM_COMMIT, -1, new RollbackException(), false)
+
             }
             ,
             {




More information about the jboss-cvs-commits mailing list