camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r790520 - in /camel/trunk/components/camel-jms/src: main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java test/java/org/apache/camel/component/jms/JmsProducerWithJMSHeaderTest.java
Date Thu, 02 Jul 2009 09:33:11 GMT
Author: davsclaus
Date: Thu Jul  2 09:33:10 2009
New Revision: 790520

URL: http://svn.apache.org/viewvc?rev=790520&view=rev
Log:
CAMEL-1783: polished a bit.

Modified:
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerWithJMSHeaderTest.java

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java?rev=790520&r1=790519&r2=790520&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsHeaderFilterStrategy.java
Thu Jul  2 09:33:10 2009
@@ -17,7 +17,6 @@
 package org.apache.camel.component.jms;
 
 import org.apache.camel.impl.DefaultHeaderFilterStrategy;
-import org.apache.camel.util.ObjectHelper;
 
 /**
  * @version $Revision$

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerWithJMSHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerWithJMSHeaderTest.java?rev=790520&r1=790519&r2=790520&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerWithJMSHeaderTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsProducerWithJMSHeaderTest.java
Thu Jul  2 09:33:10 2009
@@ -89,11 +89,11 @@
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
 
-        long ttl = System.currentTimeMillis() + 2000;
+        long ttl = System.currentTimeMillis() + 5000;
         template.sendBodyAndHeader("activemq:queue:bar?preserveMessageQos=true", "Hello World",
"JMSExpiration", ttl);
 
         // sleep just a little
-        Thread.sleep(500);
+        Thread.sleep(2000);
 
         Exchange bar = consumer.receiveNoWait("activemq:queue:bar");
         assertNotNull("Should be a message on queue", bar);
@@ -224,6 +224,41 @@
         assertEquals("queue://foo", mock.getReceivedExchanges().get(0).getIn().getHeader("JMSDestination",
Destination.class).toString());
     }
 
+    @Test
+    public void testInOutJMSDestination() throws Exception {
+        Destination queue = new ActiveMQQueue("reply");
+
+        String reply = (String) template.requestBodyAndHeader("activemq:queue:bar", "Hello
World", JmsConstants.JMS_DESTINATION, queue);
+        assertEquals("Bye World", reply);
+    }
+
+    @Test
+    public void testInOutJMSDestinationName() throws Exception {
+        String reply = (String) template.requestBodyAndHeader("activemq:queue:bar", "Hello
World", JmsConstants.JMS_DESTINATION_NAME, "reply");
+        assertEquals("Bye World", reply);
+    }
+
+    @Test
+    public void testInOnlyRouteJMSDestinationName() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            public void configure() throws Exception {
+                from("activemq:queue:a").to("activemq:queue:b");
+                from("activemq:queue:b").to("mock:result");
+            }
+        });
+        context.start();
+
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("Hello World");
+        mock.message(0).header("JMSDestination").isNotNull();
+
+        template.sendBodyAndHeader("activemq:queue:bar", "Hello World", JmsConstants.JMS_DESTINATION_NAME,
"a");
+
+        assertMockEndpointsSatisfied();
+
+        assertEquals("queue://b", mock.getReceivedExchanges().get(0).getIn().getHeader("JMSDestination",
Destination.class).toString());
+    }
+
     protected CamelContext createCamelContext() throws Exception {
         CamelContext camelContext = super.createCamelContext();
 
@@ -239,6 +274,9 @@
             @Override
             public void configure() throws Exception {
                 from("activemq:queue:foo").to("mock:result");
+
+                from("activemq:queue:reply").transform(constant("Bye World"));
+
             }
         };
     }



Mime
View raw message