You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/11/16 11:03:05 UTC
svn commit: r1410272 - in /camel/trunk/tests/camel-itest/src/test:
java/org/apache/camel/itest/greeter/ resources/
resources/org/apache/camel/itest/greeter/
Author: davsclaus
Date: Fri Nov 16 10:03:03 2012
New Revision: 1410272
URL: http://svn.apache.org/viewvc?rev=1410272&view=rev
Log:
Added test based on user forum issue
Added:
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.java (with props)
camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply1.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply2.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/greetMe.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.xml
- copied, changed from r1410217, camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/RecipientListCxfTest-context.xml
Modified:
camel/trunk/tests/camel-itest/src/test/resources/log4j.properties
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.java?rev=1410272&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.java Fri Nov 16 10:03:03 2012
@@ -0,0 +1,76 @@
+/**
+ * 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.io.File;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.test.AvailablePortFinder;
+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 JettyRecipientListCxfIssueTest extends CamelSpringTestSupport {
+
+ private static int port1 = AvailablePortFinder.getNextAvailable(20032);
+ private static int port2 = AvailablePortFinder.getNextAvailable(20043);
+ private static int port3 = AvailablePortFinder.getNextAvailable(20044);
+ static {
+ //set them as system properties so Spring can use the property placeholder
+ //things to set them into the URL's in the spring contexts
+ System.setProperty("RecipientListCxfTest.port1", Integer.toString(port1));
+ System.setProperty("RecipientListCxfTest.port2", Integer.toString(port2));
+ System.setProperty("RecipientListCxfTest.port3", Integer.toString(port3));
+ }
+
+
+ @Override
+ protected AbstractApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.xml");
+ }
+
+ @Test
+ public void testJettyRecipientListCxf() throws Exception {
+ final String request = context().getTypeConverter().convertTo(String.class, new File("src/test/resources/greetMe.xml"));
+ assertNotNull(request);
+
+ // send a message to jetty
+ Exchange out = template.request("jetty:http://0.0.0.0:{{RecipientListCxfTest.port3}}/myapp", new Processor() {
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ exchange.getIn().setHeader("operationName", "greetMe");
+ exchange.getIn().setBody(request);
+ }
+ });
+
+ assertNotNull(out);
+ assertTrue("Should have out", out.hasOut());
+
+ String body = out.getOut().getBody(String.class);
+ log.info("Reply from jetty call:\n{}", body);
+
+ // we get the last reply as response
+ assertNotNull(body);
+ assertTrue("Should have Bye Camel", body.contains("Bye Camel"));
+ }
+
+}
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply1.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply1.xml?rev=1410272&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply1.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply1.xml Fri Nov 16 10:03:03 2012
@@ -0,0 +1,8 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://apache.org/hello_world_soap_http/types">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <typ:greetMe>
+ <typ:requestType>Hello Camel</typ:requestType>
+ </typ:greetMe>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply1.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply1.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply1.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply2.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply2.xml?rev=1410272&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply2.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply2.xml Fri Nov 16 10:03:03 2012
@@ -0,0 +1,8 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://apache.org/hello_world_soap_http/types">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <typ:greetMe>
+ <typ:requestType>Bye Camel</typ:requestType>
+ </typ:greetMe>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply2.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply2.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/greetMe-reply2.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/greetMe.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/greetMe.xml?rev=1410272&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/greetMe.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/greetMe.xml Fri Nov 16 10:03:03 2012
@@ -0,0 +1,8 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://apache.org/hello_world_soap_http/types">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <typ:greetMe>
+ <typ:requestType>Camel</typ:requestType>
+ </typ:greetMe>
+ </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/resources/greetMe.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/greetMe.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/greetMe.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: camel/trunk/tests/camel-itest/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/log4j.properties?rev=1410272&r1=1410271&r2=1410272&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/log4j.properties (original)
+++ camel/trunk/tests/camel-itest/src/test/resources/log4j.properties Fri Nov 16 10:03:03 2012
@@ -27,6 +27,9 @@ log4j.rootLogger=INFO, file
#log4j.logger.org.apache.camel.component.file=TRACE
#log4j.logger.org.apache.camel.component.netty=DEBUG
#log4j.logger.org.apache.camel.processor.DefaultErrorHandler=TRACE
+#log4j.logger.org.apache.camel.component.jetty=TRACE
+#log4j.logger.org.apache.camel.processor.Pipeline=TRACE
+#log4j.logger.org.apache.camel.processor.MulticastProcessor=TRACE
# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
Copied: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.xml (from r1410217, camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/RecipientListCxfTest-context.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.xml?p2=camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.xml&p1=camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/RecipientListCxfTest-context.xml&r1=1410217&r2=1410272&rev=1410272&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/RecipientListCxfTest-context.xml (original)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/greeter/JettyRecipientListCxfIssueTest.xml Fri Nov 16 10:03:03 2012
@@ -33,6 +33,12 @@
endpointName="s:SoapOverHttp"
serviceName="s:SOAPService"
xmlns:s="http://apache.org/hello_world_soap_http">
+ <cxf:properties>
+ <entry key="dataFormat" value="MESSAGE"/>
+ <entry key="receiveTimeout" value="60000"/>
+ <entry key="connectionTimeout" value="60000"/>
+ <entry key="schema-validation-enabled" value="true" />
+ </cxf:properties>
</cxf:cxfEndpoint>
<cxf:cxfEndpoint id="serviceEndpoint2" address="http://localhost:${RecipientListCxfTest.port2}/SoapContext/SoapPort"
@@ -41,34 +47,45 @@
endpointName="s:SoapOverHttp"
serviceName="s:SOAPService"
xmlns:s="http://apache.org/hello_world_soap_http">
+ <cxf:properties>
+ <entry key="dataFormat" value="MESSAGE"/>
+ <entry key="receiveTimeout" value="60000"/>
+ <entry key="connectionTimeout" value="60000"/>
+ <entry key="schema-validation-enabled" value="true" />
+ </cxf:properties>
</cxf:cxfEndpoint>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
- <from uri="direct:start"/>
- <recipientList parallelProcessing="true">
+ <from uri="jetty:http://0.0.0.0:{{RecipientListCxfTest.port3}}/myapp?matchOnUriPrefix=true&useContinuation=true"/>
+ <to uri="log:input"/>
+ <setHeader headerName="foo">
+ <constant>cxf:bean:serviceEndpoint,cxf:bean:serviceEndpoint2</constant>
+ </setHeader>
+ <recipientList delimiter=",">
<header>foo</header>
</recipientList>
- <to uri="mock:output"/>
</route>
<route>
<from uri="cxf:bean:serviceEndpoint"/>
<transform>
- <simple>Hello ${body}</simple>
+ <simple resultType="java.io.File">src/test/resources/greetMe-reply1.xml</simple>
</transform>
- <to uri="log:reply"/>
- <to uri="mock:reply"/>
</route>
<route>
<from uri="cxf:bean:serviceEndpoint2"/>
+ <!-- can be used to delay response from 2nd web service, and check Camel if any
+ threads is blocked waiting for the reply
+ <delay>
+ <constant>50000</constant>
+ </delay>
+ -->
<transform>
- <simple>Bye ${body}</simple>
+ <simple resultType="java.io.File">src/test/resources/greetMe-reply2.xml</simple>
</transform>
- <to uri="log:reply2"/>
- <to uri="mock:reply2"/>
</route>
</camelContext>