[jboss-svn-commits] JBL Code SVN: r38130 - in labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta: tests/src/org/jboss/internal/soa/esb/couriers and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jul 2 15:03:31 EDT 2012


Author: tcunning
Date: 2012-07-02 15:03:31 -0400 (Mon, 02 Jul 2012)
New Revision: 38130

Modified:
   labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
   labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/JmsCourierUnitTest.java
Log:
JBESB-3739
Throw an exception on JmsCourier constructor of CLIENT_ACKNOWLEDGE is the acknowledge mode.


Modified: labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java	2012-07-02 01:56:45 UTC (rev 38129)
+++ labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/src/org/jboss/internal/soa/esb/couriers/JmsCourier.java	2012-07-02 19:03:31 UTC (rev 38130)
@@ -97,6 +97,10 @@
                 throw new CourierException(e);
             }
         }
+        
+        if (_epr.getAcknowledgeMode() == javax.jms.Session.CLIENT_ACKNOWLEDGE) {
+        	throw new CourierException("CLIENT_ACKNOWLEDGE mode is not valid for a non-gateway listener using jms-provider");
+        }
     } // ________________________________
 
     public void cleanup() {

Modified: labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/JmsCourierUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/JmsCourierUnitTest.java	2012-07-02 01:56:45 UTC (rev 38129)
+++ labs/jbossesb/branches/JBESB_4_11_CP/product/rosetta/tests/src/org/jboss/internal/soa/esb/couriers/JmsCourierUnitTest.java	2012-07-02 19:03:31 UTC (rev 38130)
@@ -22,11 +22,14 @@
 package org.jboss.internal.soa.esb.couriers;
 
 import static org.junit.Assert.fail;
+import static org.jboss.soa.esb.addressing.eprs.JMSEpr.*;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 
+import java.util.Properties;
+
 import javax.jms.Destination;
 import javax.jms.ExceptionListener;
 import javax.jms.JMSException;
@@ -36,6 +39,7 @@
 import javax.jms.MessageProducer;
 import javax.jms.QueueConnection;
 import javax.jms.QueueSession;
+import javax.jms.Session;
 import javax.naming.Context;
 
 import junit.framework.Assert;
@@ -44,6 +48,7 @@
 import org.jboss.internal.soa.esb.util.MessageFlowContext;
 import org.jboss.soa.esb.addressing.eprs.JMSEpr;
 import org.jboss.soa.esb.common.Environment;
+import org.jboss.soa.esb.couriers.CourierException;
 import org.jboss.soa.esb.couriers.CourierTransportException;
 import org.jboss.soa.esb.helpers.NamingContextPool;
 import org.jboss.soa.esb.message.format.MessageFactory;
@@ -93,7 +98,7 @@
     {
         MockContextFactory.revertSetAsInitial();
     }
-    
+        
     @Test(timeout=10000)
     public void testDelivery()
         throws Exception
@@ -161,6 +166,26 @@
         
         Assert.assertEquals("Invalid producer priority", expectedPriority, MockFailMessageProducer.producerPriority) ;
     }
+
+    @Test
+    public void testCLIENTACK() throws Exception {
+        String expectedDestination = "/queue/test";
+        String expectedConnectionFactory = "ConnectionFactory";
+        String expectedDestinationType = JMSEpr.QUEUE_TYPE;
+        String expectedSelector = "JMSCorrelationID=1000";
+        boolean NON_PERSISTENT = false;
+        Properties nullEnvironment = null;
+        
+        JMSEpr jmsEpr = new JMSEpr( ONE_ONE_PROTOCOL, expectedDestinationType, expectedDestination ,
+                expectedConnectionFactory,
+                nullEnvironment, expectedSelector, NON_PERSISTENT, AcknowledgeMode.CLIENT_ACKNOWLEDGE.toString());
+
+        try {
+    		JmsCourier newCourier = new JmsCourier(jmsEpr);
+    		fail("Expected to receieve CourierException");
+    	} catch (CourierException ce) {    		
+    	}
+    }
     
     private static final class MockQueueConnectionFactory extends QueueConnectionFactoryImpl
     {



More information about the jboss-svn-commits mailing list