activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r523357 - in /activemq/camel/trunk/camel-itest: ./ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/camel/ src/main/java/org/apache/camel/itest/ src/main/java/org/apache/camel/itest/jms/ src/test/java/ src/test/resources/
Date Wed, 28 Mar 2007 15:10:58 GMT
Author: chirino
Date: Wed Mar 28 08:10:52 2007
New Revision: 523357

URL: http://svn.apache.org/viewvc?view=rev&rev=523357
Log:
Adding first test

Added:
    activemq/camel/trunk/camel-itest/src/main/java/org/
    activemq/camel/trunk/camel-itest/src/main/java/org/apache/
    activemq/camel/trunk/camel-itest/src/main/java/org/apache/camel/
    activemq/camel/trunk/camel-itest/src/main/java/org/apache/camel/itest/
    activemq/camel/trunk/camel-itest/src/main/java/org/apache/camel/itest/jms/
    activemq/camel/trunk/camel-itest/src/main/java/org/apache/camel/itest/jms/JmsIntegrationTest.java
Removed:
    activemq/camel/trunk/camel-itest/src/test/java/
    activemq/camel/trunk/camel-itest/src/test/resources/
Modified:
    activemq/camel/trunk/camel-itest/pom.xml

Modified: activemq/camel/trunk/camel-itest/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-itest/pom.xml?view=diff&rev=523357&r1=523356&r2=523357
==============================================================================
--- activemq/camel/trunk/camel-itest/pom.xml (original)
+++ activemq/camel/trunk/camel-itest/pom.xml Wed Mar 28 08:10:52 2007
@@ -67,6 +67,7 @@
       <artifactId>camel-spring</artifactId>
     </dependency>
 
+<!--
     <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
@@ -74,14 +75,28 @@
       <optional>true</optional>
       <scope>test</scope>
     </dependency>
-
+-->
 
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <scope>test</scope>
+      <scope>compile</scope>
     </dependency>
 
   </dependencies>
-
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
+          <childDelegation>false</childDelegation>
+          <useFile>true</useFile>
+          <includes>
+            <include>**/*Test.*</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>

Added: activemq/camel/trunk/camel-itest/src/main/java/org/apache/camel/itest/jms/JmsIntegrationTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-itest/src/main/java/org/apache/camel/itest/jms/JmsIntegrationTest.java?view=auto&rev=523357
==============================================================================
--- activemq/camel/trunk/camel-itest/src/main/java/org/apache/camel/itest/jms/JmsIntegrationTest.java
(added)
+++ activemq/camel/trunk/camel-itest/src/main/java/org/apache/camel/itest/jms/JmsIntegrationTest.java
Wed Mar 28 08:10:52 2007
@@ -0,0 +1,99 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.itest.jms;
+
+import static org.apache.camel.component.jms.JmsComponent.jmsComponentClientAcknowledge;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+import junit.framework.TestCase;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Producer;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.jms.JmsEndpoint;
+import org.apache.camel.component.jms.JmsExchange;
+import org.apache.camel.component.jms.JmsMessage;
+import org.apache.camel.component.pojo.PojoComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.util.ProducerCache;
+
+import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
+import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
+
+/**
+ * @version $Revision:520964 $
+ */
+public class JmsIntegrationTest extends TestCase {
+	
+    protected CamelContext container = new DefaultCamelContext();
+
+    public void testDummy() {
+    }
+    
+    /**
+     * Commented out since this fails due to us not converting the JmsExchange to a PojoExchange
+     * 
+     * @throws Exception
+     */
+	public void xtestOneWayInJmsOutPojo() throws Exception {
+		
+		final CountDownLatch receivedCountDown = new CountDownLatch(1);
+		
+        // Configure the components
+        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
+        container.addComponent("activemq", jmsComponentClientAcknowledge(connectionFactory));
+        PojoComponent component = new PojoComponent();
+        component.addService("listener", new MessageListener(){
+			public void onMessage(Message msg) {
+				System.out.println("Received: "+msg);
+				receivedCountDown.countDown();				
+			}
+		});
+        container.addComponent("default", component);
+
+        // lets add a jms -> pojo route
+        container.addRoutes(new RouteBuilder() {
+            public void configure() {
+                from("jms:activemq:test").to("pojo:default:listener");
+            }
+        });
+        
+        container.activateEndpoints();
+        
+        // Send a message to the JMS endpoint
+        JmsEndpoint endpoint = (JmsEndpoint) container.resolveEndpoint("jms:activemq:test");
       
+        Producer<JmsExchange> producer = endpoint.createProducer();
+        JmsExchange exchange = producer.createExchange();
+        JmsMessage in = exchange.getIn();
+        in.setBody("Hello");
+        in.setHeader("cheese", 123);
+        producer.onExchange(exchange);
+        
+        // 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));
+        
+        container.deactivateEndpoints();
+        
+	}
+	
+}



Mime
View raw message