camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1085285 - in /camel/trunk/tests/camel-itest/src/test: java/org/apache/camel/itest/proxy/ resources/org/apache/camel/itest/proxy/
Date Fri, 25 Mar 2011 08:38:32 GMT
Author: davsclaus
Date: Fri Mar 25 08:38:32 2011
New Revision: 1085285

URL: http://svn.apache.org/viewvc?rev=1085285&view=rev
Log:
Added test

Added:
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/Echo.java
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoClient.java
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoProduceTest.java
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.java
    camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/proxy/
    camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.xml
      - copied, changed from r1083179, camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/mail/SpringMailEndpointTest-context.xml

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/Echo.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/Echo.java?rev=1085285&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/Echo.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/Echo.java Fri
Mar 25 08:38:32 2011
@@ -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.itest.proxy;
+
+/**
+ *
+ */
+public interface Echo {
+
+    String hello(String name);
+
+}

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoClient.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoClient.java?rev=1085285&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoClient.java
(added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoClient.java
Fri Mar 25 08:38:32 2011
@@ -0,0 +1,36 @@
+/**
+ * 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.proxy;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ */
+@Component("client")
+public class EchoClient {
+
+    @Resource(name = "myEcho")
+    private Echo echo;
+
+    public String hello(String name) {
+        return echo.hello(name);
+    }
+
+}

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoProduceTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoProduceTest.java?rev=1085285&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoProduceTest.java
(added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/EchoProduceTest.java
Fri Mar 25 08:38:32 2011
@@ -0,0 +1,48 @@
+/**
+ * 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.proxy;
+
+import org.apache.camel.Produce;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class EchoProduceTest extends CamelTestSupport {
+
+    @Produce(uri = "direct:start")
+    private Echo echo;
+
+    @Test
+    public void testEchoProduce() throws Exception {
+        String reply = echo.hello("Camel");
+        assertEquals("Hello Camel", reply);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .transform().simple("Hello ${body}");
+            }
+        };
+    }
+}

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.java?rev=1085285&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.java
(added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.java
Fri Mar 25 08:38:32 2011
@@ -0,0 +1,42 @@
+/**
+ * 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.proxy;
+
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ *
+ */
+public class SpringEchoCamelProxyTest extends CamelSpringTestSupport {
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.xml");
+    }
+
+    @Test
+    public void testEchoProduce() throws Exception {
+        EchoClient client = context.getRegistry().lookup("client", EchoClient.class);
+
+        String reply = client.hello("Camel");
+        assertEquals("Hello Camel", reply);
+    }
+
+}

Copied: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.xml
(from r1083179, camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/mail/SpringMailEndpointTest-context.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.xml?p2=camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.xml&p1=camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/mail/SpringMailEndpointTest-context.xml&r1=1083179&r2=1085285&rev=1085285&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/mail/SpringMailEndpointTest-context.xml
(original)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/proxy/SpringEchoCamelProxyTest.xml
Fri Mar 25 08:38:32 2011
@@ -17,38 +17,28 @@
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-    <bean id="myMailEndpoint" class="org.apache.camel.component.mail.MailEndpoint">
-        <property name="camelContext" ref="camel"/>
-        <property name="configuration" ref="mailConfig"/>
-        <property name="consumerProperties">
-            <map key-type="java.lang.String">
-                <entry key="delay" value="3000"/>
-            </map>
-        </property>
-    </bean>
-
-    <bean id="mailConfig" class="org.apache.camel.component.mail.MailConfiguration">
-        <property name="host" value="localhost"/>
-        <property name="port" value="110"/>
-        <property name="username" value="james2"/>
-        <property name="password" value="james2"/>
-        <property name="protocol" value="pop3"/>
-        <property name="unseen" value="false"/>
-    </bean>
+    <context:component-scan base-package="org.apache.camel.itest.proxy"/>
 
-    <!-- START SNIPPET: example -->
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
-        <template id="camelTemplate"/>
+
+        <proxy id="myEcho"
+               serviceInterface="org.apache.camel.itest.proxy.Echo"
+               serviceUrl="direct:start"/>
 
         <route>
-            <from ref="myMailEndpoint"/>
-            <to uri="mock:result"/>
+            <from uri="direct:start"/>
+            <transform>
+                <simple>Hello ${body}</simple>
+            </transform>
         </route>
+
     </camelContext>
 
 </beans>



Mime
View raw message