[jboss-cvs] JBoss Messaging SVN: r2156 - in trunk/tests/src/org/jboss/test/messaging: tools/aop and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 2 19:02:35 EST 2007


Author: clebert.suconic at jboss.com
Date: 2007-02-02 19:02:35 -0500 (Fri, 02 Feb 2007)
New Revision: 2156

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
   trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-808
Adding tests as discussed on forum thread associated with the JIRA (808)

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2007-02-02 22:57:28 UTC (rev 2155)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2007-02-03 00:02:35 UTC (rev 2156)
@@ -1677,6 +1677,16 @@
       failureOnInvocation(PoisonInterceptor.FAIL_BEFORE_ACKNOWLEDGE_DELIVERY);
    }
 
+   public void testFailureRightBeforeSend() throws Exception
+   {
+      failureOnInvocation(PoisonInterceptor.FAIL_BEFORE_SEND);
+   }
+
+   public void testFailureRightAfterSend() throws Exception
+   {
+      failureOnInvocation(PoisonInterceptor.FAIL_AFTER_SEND);
+   }
+
    // Package protected ----------------------------------------------------------------------------
 
    // Protected ------------------------------------------------------------------------------------
@@ -1814,6 +1824,10 @@
 
          assertEquals("before-poison", tm.getText());
 
+         tm = (TextMessage)consumer.receive(1000);
+
+         assertNull(tm);
+
       }
       finally
       {

Modified: trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java	2007-02-02 22:57:28 UTC (rev 2155)
+++ trunk/tests/src/org/jboss/test/messaging/tools/aop/PoisonInterceptor.java	2007-02-03 00:02:35 UTC (rev 2156)
@@ -42,6 +42,10 @@
 
    public static final int FAIL_BEFORE_ACKNOWLEDGE_DELIVERY = 3;
 
+   public static final int FAIL_AFTER_SEND = 4;
+
+   public static final int FAIL_BEFORE_SEND = 5;
+
    // Static ---------------------------------------------------------------------------------------
    
    private static int type;
@@ -109,7 +113,23 @@
 
          crash(invocation.getTargetObject());
       }
+      else if (target instanceof SessionAdvised && "send".equals(methodName)
+                 && type == FAIL_AFTER_SEND)
+      {
+         invocation.invokeNext();
 
+         log.info("##### Crashing after send!!!");
+
+         crash(invocation.getTargetObject());
+      }
+      else if (target instanceof SessionAdvised && "send".equals(methodName)
+                 && type == FAIL_BEFORE_SEND)
+      {
+         log.info("##### Crashing before send!!!");
+
+         crash(invocation.getTargetObject());
+      }
+
       return invocation.invokeNext();
    }
   




More information about the jboss-cvs-commits mailing list