Author: veithen
Date: Fri Sep  5 13:45:43 2008
New Revision: 692543

URL: http://svn.apache.org/viewvc?rev=692543&view=rev
Log:
JMS transport tests: make sure that destination name and JNDI name are 
different from each other

Modified:
    
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSChannel.java
    
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSRequestResponseChannel.java

Modified: 
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSChannel.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSChannel.java?rev=692543&r1=692542&r2=692543&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSChannel.java
 (original)
+++ 
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSChannel.java
 Fri Sep  5 13:45:43 2008
@@ -40,6 +40,7 @@
     private final ContentTypeMode contentTypeMode;
     protected JMSTestEnvironment env;
     private String destinationName;
+    private String jndiName;
     private Destination destination;
     
     public JMSChannel(String name, String destinationType, ContentTypeMode 
contentTypeMode) {
@@ -65,18 +66,24 @@
         return destinationName.toString();
     }
     
+    protected String buildJndiName(String direction, String destinationType) {
+        return "jms/" + buildDestinationName(direction, destinationType);
+    }
+    
     @SuppressWarnings("unused")
     private void setUp(JMSTestEnvironment env) throws Exception {
         this.env = env;
         destinationName = buildDestinationName("request", destinationType);
+        jndiName = buildJndiName("request", destinationType);
         destination = env.createDestination(destinationType, destinationName);
-        env.getContext().bind(destinationName, destination);
+        env.getContext().bind(jndiName, destination);
     }
 
     @SuppressWarnings("unused")
     private void tearDown() throws Exception {
-        env.getContext().unbind(destinationName);
+        env.getContext().unbind(jndiName);
         destinationName = null;
+        jndiName = null;
         destination = null;
     }
 
@@ -115,12 +122,12 @@
     }
 
     public EndpointReference getEndpointReference() throws Exception {
-        return new EndpointReference("jms:/" + destinationName + 
"?transport.jms.DestinationType=" + destinationType + 
"&java.naming.factory.initial=org.mockejb.jndi.MockContextFactory&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory");
+        return new EndpointReference("jms:/" + jndiName + 
"?transport.jms.DestinationType=" + destinationType + 
"&java.naming.factory.initial=org.mockejb.jndi.MockContextFactory&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory");
     }
 
     public void setupService(AxisService service) throws Exception {
         service.addParameter(JMSConstants.CONFAC_PARAM, destinationType);
         service.addParameter(JMSConstants.DEST_PARAM_TYPE, destinationType);
-        service.addParameter(JMSConstants.DEST_PARAM, destinationName);
+        service.addParameter(JMSConstants.DEST_PARAM, jndiName);
     }
 }

Modified: 
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSRequestResponseChannel.java
URL: 
http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSRequestResponseChannel.java?rev=692543&r1=692542&r2=692543&view=diff
==============================================================================
--- 
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSRequestResponseChannel.java
 (original)
+++ 
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSRequestResponseChannel.java
 Fri Sep  5 13:45:43 2008
@@ -30,6 +30,7 @@
 public class JMSRequestResponseChannel extends JMSChannel implements 
RequestResponseChannel {
     private final String replyDestinationType;
     private String replyDestinationName;
+    private String replyJndiName;
     private Destination replyDestination;
     
     public JMSRequestResponseChannel(String name, String destinationType, 
String replyDestinationType, ContentTypeMode contentTypeMode) {
@@ -44,14 +45,16 @@
     @SuppressWarnings("unused")
     private void setUp(JMSTestEnvironment env) throws Exception {
         replyDestinationName = buildDestinationName("response", 
replyDestinationType);
+        replyJndiName = buildJndiName("response", replyDestinationType);
         replyDestination = env.createDestination(replyDestinationType, 
replyDestinationName);
-        env.getContext().bind(replyDestinationName, replyDestination);
+        env.getContext().bind(replyJndiName, replyDestination);
     }
 
     @SuppressWarnings("unused")
     private void tearDown() throws Exception {
-        env.getContext().unbind(replyDestinationName);
+        env.getContext().unbind(replyJndiName);
         replyDestinationName = null;
+        replyJndiName = null;
         replyDestination = null;
     }
 
@@ -59,7 +62,7 @@
     public void setupService(AxisService service) throws Exception {
         super.setupService(service);
         service.addParameter(JMSConstants.REPLY_PARAM_TYPE, 
replyDestinationType);
-        service.addParameter(JMSConstants.REPLY_PARAM, replyDestinationName);
+        service.addParameter(JMSConstants.REPLY_PARAM, replyJndiName);
     }
 
     @Override
@@ -71,7 +74,7 @@
     @Override
     public EndpointReference getEndpointReference() throws Exception {
         String address = super.getEndpointReference().getAddress();
-        return new EndpointReference(address + "&" + 
JMSConstants.REPLY_PARAM_TYPE + "=" + replyDestinationType + "&" + 
JMSConstants.REPLY_PARAM + "=" + replyDestinationName);
+        return new EndpointReference(address + "&" + 
JMSConstants.REPLY_PARAM_TYPE + "=" + replyDestinationType + "&" + 
JMSConstants.REPLY_PARAM + "=" + replyJndiName);
     }
 
     @Key("replyDestType")


Reply via email to