Author: davsclaus
Date: Thu Oct 22 11:02:55 2009
New Revision: 828653

URL: http://svn.apache.org/viewvc?rev=828653&view=rev
Log:
CAMEL-2095: Added unit test for CamelProxy

Added:
    
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
   (with props)
    
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/MyProxySender.java
   (with props)
    
camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml
      - copied, changed from r825962, 
camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/autoRegisteredRouteBuilder.xml

Added: 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java?rev=828653&view=auto
==============================================================================
--- 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
 (added)
+++ 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
 Thu Oct 22 11:02:55 2009
@@ -0,0 +1,37 @@
+/**
+ * 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.config;
+
+import junit.framework.TestCase;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class CamelProxyTest extends TestCase {
+
+    public void testCamelProxy() throws Exception {
+        ApplicationContext ac = new 
ClassPathXmlApplicationContext("org/apache/camel/spring/config/CamelProxyTest.xml");
+
+        MyProxySender sender = (MyProxySender) ac.getBean("myProxySender");
+        String reply = sender.hello("World");
+
+        assertEquals("Hello World", reply);
+    }
+
+}
\ No newline at end of file

Propchange: 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/CamelProxyTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/MyProxySender.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/MyProxySender.java?rev=828653&view=auto
==============================================================================
--- 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/MyProxySender.java
 (added)
+++ 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/MyProxySender.java
 Thu Oct 22 11:02:55 2009
@@ -0,0 +1,26 @@
+/**
+ * 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.config;
+
+/**
+ * @version $Revision$
+ */
+public interface MyProxySender {
+
+    String hello(String name);
+
+}

Propchange: 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/MyProxySender.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/branches/camel-1.x/components/camel-spring/src/test/java/org/apache/camel/spring/config/MyProxySender.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: 
camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml
 (from r825962, 
camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/autoRegisteredRouteBuilder.xml)
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml?p2=camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml&p1=camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/autoRegisteredRouteBuilder.xml&r1=825962&r2=828653&rev=828653&view=diff
==============================================================================
--- 
camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/autoRegisteredRouteBuilder.xml
 (original)
+++ 
camel/branches/camel-1.x/components/camel-spring/src/test/resources/org/apache/camel/spring/config/CamelProxyTest.xml
 Thu Oct 22 11:02:55 2009
@@ -22,14 +22,25 @@
        http://activemq.apache.org/camel/schema/spring 
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
     ">
 
-  <!-- START SNIPPET: example4 -->
-  <camelContext id="camel4" 
xmlns="http://activemq.apache.org/camel/schema/spring"; 
autowireRouteBuilders="true">
-  </camelContext>
-  <!-- END SNIPPET: example4 -->
+    <!-- START SNIPPET: e1 -->
+    <camelContext id="myCamel" 
xmlns="http://activemq.apache.org/camel/schema/spring";>
 
+        <!-- create a proxy that will route to the direct:start endpoint when 
invoked -->
+        <proxy id="myProxySender"
+               serviceInterface="org.apache.camel.spring.config.MyProxySender"
+               serviceUrl="direct:start"/>
+
+        <!-- this is the route that our proxy will routed when invoked
+             and the output from this route is returned as reply on the proxy 
-->
+        <route>
+            <from uri="direct:start"/>
+            <to uri="log:foo"/>
+            <transform>
+                <constant>Hello World</constant>
+            </transform>
+        </route>
+
+    </camelContext>
+    <!-- END SNIPPET: e1 -->
 
-  <bean id="configuredRouteBuilder" 
class="org.apache.camel.spring.xml.ConfiguredRouteBuilder">
-    <property name="fromUri" value="seda:test.a"/>
-    <property name="toUri" value="seda:test.b"/>
-  </bean>
 </beans>


Reply via email to