You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2008/11/30 13:45:03 UTC

svn commit: r721806 - in /activemq/camel/trunk/tests: camel-itest-spring-2.0/ camel-itest/ camel-itest/pom.xml camel-itest/src/test/java/org/apache/camel/itest/jms/JmsHttpJmsTest.java camel-partial-classpath-test/

Author: davsclaus
Date: Sun Nov 30 04:45:02 2008
New Revision: 721806

URL: http://svn.apache.org/viewvc?rev=721806&view=rev
Log:
Added unit test based on user forum problem

Added:
    activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsHttpJmsTest.java   (contents, props changed)
      - copied, changed from r721782, activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsIntegrationTest.java
Modified:
    activemq/camel/trunk/tests/camel-itest/   (props changed)
    activemq/camel/trunk/tests/camel-itest-spring-2.0/   (props changed)
    activemq/camel/trunk/tests/camel-itest/pom.xml
    activemq/camel/trunk/tests/camel-partial-classpath-test/   (props changed)

Propchange: activemq/camel/trunk/tests/camel-itest/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Nov 30 04:45:02 2008
@@ -4,3 +4,4 @@
 .project
 activemq-data
 .settings
+*.i??

Propchange: activemq/camel/trunk/tests/camel-itest-spring-2.0/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Nov 30 04:45:02 2008
@@ -5,3 +5,4 @@
 target
 .settings
 eclipse-classes
+*.i??

Modified: activemq/camel/trunk/tests/camel-itest/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tests/camel-itest/pom.xml?rev=721806&r1=721805&r2=721806&view=diff
==============================================================================
--- activemq/camel/trunk/tests/camel-itest/pom.xml (original)
+++ activemq/camel/trunk/tests/camel-itest/pom.xml Sun Nov 30 04:45:02 2008
@@ -52,6 +52,11 @@
       <artifactId>camel-jetty</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-http</artifactId>
+      <scope>test</scope>
+    </dependency>
 
     <dependency>
       <groupId>junit</groupId>

Copied: activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsHttpJmsTest.java (from r721782, activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsIntegrationTest.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsHttpJmsTest.java?p2=activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsHttpJmsTest.java&p1=activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsIntegrationTest.java&r1=721782&r2=721806&rev=721806&view=diff
==============================================================================
--- activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsIntegrationTest.java (original)
+++ activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsHttpJmsTest.java Sun Nov 30 04:45:02 2008
@@ -16,38 +16,43 @@
  */
 package org.apache.camel.itest.jms;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
 import javax.jms.ConnectionFactory;
 import javax.naming.Context;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.jms.JmsComponent;
 import org.apache.camel.util.jndi.JndiContext;
 
 /**
- * @version $Revision:520964 $
+ * Based on user forum.
+ *
+ * @version $Revision$
  */
-public class JmsIntegrationTest extends ContextTestSupport {
-    protected CountDownLatch receivedCountDown = new CountDownLatch(1);
-    protected MyBean myBean = new MyBean();
-
-    public void testOneWayInJmsOutPojo() throws Exception {
-        // Send a message to the JMS endpoint
-        template.sendBodyAndHeader("jms:test", "Hello", "cheese", 123);
+public class JmsHttpJmsTest extends ContextTestSupport {
+
+    public void testJmsHttpJms() throws Exception {
+        template.sendBody("jms:in", "Hello World");
 
-        // The Activated endpoint should send it to the pojo due to the configured route.
-        assertTrue("The message ware received by the Pojo", receivedCountDown.await(5, TimeUnit.SECONDS));
+        Endpoint endpoint = context.getEndpoint("jms:out");
+        endpoint.createConsumer(new Processor() {
+            public void process(Exchange exchange) throws Exception {
+                assertEquals("Bye World", exchange.getIn().getBody(String.class));
+            }
+        });
     }
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("jms:test").to("bean:myBean");
+                from("jms:in").to("http://localhost/myservice").to("jms:out");
+
+                from("jetty:http://localhost/myservice").transform().constant("Bye World");
             }
         };
     }
@@ -55,7 +60,6 @@
     @Override
     protected Context createJndiContext() throws Exception {
         JndiContext answer = new JndiContext();
-        answer.bind("myBean", myBean);
 
         // add ActiveMQ with embedded broker
         ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
@@ -63,11 +67,4 @@
         return answer;
     }
 
-    protected class MyBean {
-        public void onMessage(String body) {
-            log.info("Received: " + body);
-            receivedCountDown.countDown();
-        }
-    }
-
-}
+}
\ No newline at end of file

Propchange: activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsHttpJmsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsHttpJmsTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: activemq/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/jms/JmsHttpJmsTest.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: activemq/camel/trunk/tests/camel-partial-classpath-test/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Nov 30 04:45:02 2008
@@ -5,3 +5,4 @@
 target
 .settings
 eclipse-classes
+*.i??