activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r533644 - in /activemq/camel/trunk/camel-spring/src/test: java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml
Date Mon, 30 Apr 2007 09:19:44 GMT
Author: jstrachan
Date: Mon Apr 30 02:19:43 2007
New Revision: 533644

URL: http://svn.apache.org/viewvc?view=rev&rev=533644
Log:
added a test case to test the routing using a spring.xml file

Added:
    activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
  (with props)
    activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml
  (with props)

Added: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java?view=auto&rev=533644
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
(added)
+++ activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
Mon Apr 30 02:19:43 2007
@@ -0,0 +1,61 @@
+/**
+ *
+ * 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.spring;
+
+import org.apache.camel.TestSupport;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Processor;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.util.CamelClient;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision: 521586 $
+ */
+public class RoutingUsingCamelContextFactoryTest extends TestSupport {
+    protected String body = "<hello>world!</hello>";
+
+    public void testXMLRouteLoading() throws Exception {
+        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml");
+
+        CamelContext context = (CamelContext) applicationContext.getBean("camel");
+        assertNotNull("No context found!", context);
+
+        MockEndpoint resultEndpoint = (MockEndpoint) resolveMandatoryEndpoint(context, "mock:result");
+        resultEndpoint.expectedBodiesReceived(body);
+
+        // now lets send a message
+        CamelClient<Exchange> client = new CamelClient<Exchange>(context);
+        client.send("queue:start", new Processor<Exchange>() {
+            public void process(Exchange exchange) {
+                Message in = exchange.getIn();
+                in.setHeader("name", "James");
+                in.setBody(body);
+            }
+        });
+        
+
+        resultEndpoint.assertIsSatisfied();
+    }
+
+}

Propchange: activemq/camel/trunk/camel-spring/src/test/java/org/apache/camel/spring/RoutingUsingCamelContextFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml?view=auto&rev=533644
==============================================================================
--- activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml
(added)
+++ activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml
Mon Apr 30 02:19:43 2007
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       http://activemq.apache.org/camel/schema/camel-1.0.xsd http://activemq.apache.org/camel/schema/camel-1.0.xsd
+    ">
+
+  <!-- START SNIPPET: example -->
+  <bean id="camel" class="org.apache.camel.spring.CamelContextFactoryBean">
+    <property name="routeBuilder">
+	    <routeBuilder xmlns="http://activemq.apache.org/camel/schema/camel-1.0.xsd">
+	       <route>
+	         <from uri="queue:start"/>
+	         <to uri="mock:result"/>
+	       </route>
+	    </routeBuilder>
+    </property>
+  </bean>
+  <!-- END SNIPPET: example -->
+  
+</beans>

Propchange: activemq/camel/trunk/camel-spring/src/test/resources/org/apache/camel/spring/routingUsingCamelContextFactoryTest.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message