camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r770906 - in /camel/trunk/tests/camel-itest/src/test: java/org/apache/camel/itest/greeter/ resources/org/apache/camel/itest/greeter/
Date Sat, 02 May 2009 07:09:28 GMT
Author: ningjiang
Date: Sat May  2 07:09:28 2009
New Revision: 770906

URL: http://svn.apache.org/viewvc?rev=770906&view=rev
Log:
CAMEL-1581 Added an integration test for camel-cxf and camel-jms

Added:
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java
  (with props)
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareRequest.java
  (with props)
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java
  (with props)
    camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/CamelGreeterConsumerTest-context.xml
  (with props)

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java?rev=770906&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java
(added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java
Sat May  2 07:09:28 2009
@@ -0,0 +1,57 @@
+/**
+ * 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.greeter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.cxf.CxfConstants;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+
+@ContextConfiguration
+public class CamelGreeterConsumerTest extends AbstractJUnit38SpringContextTests {
+    private static final transient Log LOG = LogFactory.getLog(CamelGreeterTest.class);
+
+    @Autowired
+    protected CamelContext camelContext;
+
+
+    public void testMocksAreValid() throws Exception {
+        assertNotNull(camelContext);
+
+        ProducerTemplate template = camelContext.createProducerTemplate();
+        List<String> params = new ArrayList<String>();
+        params.add("Willem");
+        Object result = template.sendBodyAndHeader("cxf://bean:serviceEndpoint", ExchangePattern.InOut
, 
+                                                   params, CxfConstants.OPERATION_NAME, "greetMe");
+        assertTrue("Result is a list instance ", result instanceof List);
+        assertEquals("Get the wrong response", ((List)result).get(0), "HelloWillem");
+    }
+
+}

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/CamelGreeterConsumerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareRequest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareRequest.java?rev=770906&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareRequest.java
(added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareRequest.java
Sat May  2 07:09:28 2009
@@ -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.greeter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.component.cxf.CxfConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class JmsPrepareRequest implements Processor {
+    private static final transient Log LOG = LogFactory.getLog(JmsPrepareRequest.class);
+
+    public void process(Exchange exchange) throws Exception {
+        String request = exchange.getIn().getBody(String.class);       
+        exchange.getOut().setBody(request);
+    }
+
+}
\ No newline at end of file

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareRequest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java?rev=770906&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java
(added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java
Sat May  2 07:09:28 2009
@@ -0,0 +1,27 @@
+/**
+ * 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.greeter;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
+public class JmsPrepareResponse implements Processor {
+    public void process(Exchange exchange) throws Exception {
+        String request = exchange.getIn().getBody(String.class);               
+        exchange.getOut().setBody("Hello" + request);
+    }
+}

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JmsPrepareResponse.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/CamelGreeterConsumerTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/CamelGreeterConsumerTest-context.xml?rev=770906&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/CamelGreeterConsumerTest-context.xml
(added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/CamelGreeterConsumerTest-context.xml
Sat May  2 07:09:28 2009
@@ -0,0 +1,70 @@
+<?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"
+       xmlns:cxf="http://camel.apache.org/schema/cxf"
+
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+
+ <import resource="classpath:activemq.xml" />
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+
+ <cxf:cxfEndpoint id="serviceEndpoint" address="http://localhost:9000/SoapContext/SoapPort"
+            wsdlURL="wsdl/hello_world.wsdl"
+    		serviceClass="org.apache.hello_world_soap_http.Greeter"
+    		endpointName="s:SoapOverHttp"
+    		serviceName="s:SOAPService"
+    	    xmlns:s="http://apache.org/hello_world_soap_http">
+    <cxf:properties>
+      <entry key="setDefaultBus" value="false"/>
+    </cxf:properties>
+ </cxf:cxfEndpoint>
+
+  <bean id="jmsPrepareRequest" class="org.apache.camel.itest.greeter.JmsPrepareRequest"/>
+  <bean id="jmsPrepareResponse" class="org.apache.camel.itest.greeter.JmsPrepareResponse"/>
+  
+  <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
+  	<property name="connectionFactory">
+  		<bean class="org.apache.activemq.ActiveMQConnectionFactory">
+  			<property name="brokerURL"
+  				value="tcp://localhost:61616" />
+  		</bean>
+  	</property>
+  </bean>
+
+  <!-- START SNIPPET: example -->
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>        
+        <from uri="cxf://bean:serviceEndpoint"/>
+        <process ref="jmsPrepareRequest"/>
+        <to uri="jms:responseQueue"/>              
+    </route>
+    <route>
+        <from uri="jms:responseQueue"/>
+        <process ref="jmsPrepareResponse"/>
+    </route>    
+  </camelContext>
+  <!-- END SNIPPET: example -->
+
+</beans>

Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/CamelGreeterConsumerTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/CamelGreeterConsumerTest-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/CamelGreeterConsumerTest-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message