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 2016/12/21 17:01:01 UTC

[2/3] camel git commit: Add async support for camel-cxf JAX-RS producer

http://git-wip-us.apache.org/repos/asf/camel/blob/208e21c5/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringAsyncRelay.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringAsyncRelay.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringAsyncRelay.xml
new file mode 100644
index 0000000..4de53f6
--- /dev/null
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringAsyncRelay.xml
@@ -0,0 +1,47 @@
+<?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:camel="http://camel.apache.org/schema/spring"
+	xmlns:cxf="http://camel.apache.org/schema/cxf" 
+	xsi:schemaLocation="http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+                        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+	
+	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+	
+	<bean id="builder"
+		class="org.apache.camel.component.cxf.jaxrs.CxfRsAsyncRelayTest.CamelRouteBuilder" />
+	<camel:camelContext id="cxfrs_context">
+		<camel:routeBuilder ref="builder" />
+		<camel:endpoint id="upload1"
+			uri="cxfrs:bean:rsServer1?bindingStyle=SimpleConsumer" />
+		<camel:endpoint id="upload2"
+			uri="cxfrs:bean:rsServer2?bindingStyle=SimpleConsumer" />
+		<camel:endpoint id="upload2Client" uri="cxfrs:bean:rsClient2?httpClientAPI=false" />
+		<!--<camel:endpoint id="upload2Client" uri="cxfrs:bean:rsClient2?httpClientAPI=false&amp;synchronous=true" />-->
+	</camel:camelContext>
+	<cxf:rsServer id="rsServer1" address="http://localhost:${CXFTestSupport.port6}/CxfRsAsyncRelayTest/rest"
+		serviceClass="org.apache.camel.component.cxf.jaxrs.CxfRsAsyncRelayTest.UploadService"
+		loggingFeatureEnabled="true" loggingSizeLimit="5000" />
+	<cxf:rsServer id="rsServer2" address="http://localhost:${CXFTestSupport.port6}/CxfRsAsyncRelayTest/rast"
+		serviceClass="org.apache.camel.component.cxf.jaxrs.CxfRsAsyncRelayTest.UploadService"
+		loggingFeatureEnabled="true" loggingSizeLimit="5000" />
+	<cxf:rsClient id="rsClient2" address="http://localhost:${CXFTestSupport.port6}/CxfRsAsyncRelayTest/rast"
+		serviceClass="org.apache.camel.component.cxf.jaxrs.CxfRsAsyncRelayTest.UploadService"
+		loggingFeatureEnabled="true" loggingSizeLimit="5000" />
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/208e21c5/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducer.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducer.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducer.xml
index 34d073b..4155dfb 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducer.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducer.xml
@@ -49,11 +49,11 @@
     <endpoint id="fromEndpoint" uri="jetty://http://localhost:${CxfRsProducerTest.jetty}/CxfRsProducerTest/testQuery"/>
     <route>
        <from uri="direct://proxy"/>
-       <to uri="cxfrs://bean://rsClientProxy"/>
+       <to uri="cxfrs://bean://rsClientProxy?synchronous=true"/>
     </route>
     <route>
        <from uri="direct://http"/>
-       <to uri="cxfrs://bean://rsClientHttp"/>
+       <to uri="cxfrs://bean://rsClientHttp?synchronous=true"/>
     </route>
     <route>
        <from ref="fromEndpoint"/>

http://git-wip-us.apache.org/repos/asf/camel/blob/208e21c5/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerAddressOverride.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerAddressOverride.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerAddressOverride.xml
index e346ab7..b64d768 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerAddressOverride.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerAddressOverride.xml
@@ -48,11 +48,11 @@
     <endpoint id="fromEndpoint" uri="jetty://http://localhost:${CxfRsProducerAddressOverrideTest.jetty}/CxfRsProducerAddressOverrideTest/testQuery"/>
     <route>
        <from uri="direct://proxy"/>
-       <to uri="cxfrs://bean://rsClientProxy"/>
+       <to uri="cxfrs://bean://rsClientProxy?synchronous=true"/>
     </route>
     <route>
        <from uri="direct://http"/>
-       <to uri="cxfrs://bean://rsClientHttp"/>
+       <to uri="cxfrs://bean://rsClientHttp?synchronous=true"/>
     </route>
     <route>
        <from ref="fromEndpoint"/>

http://git-wip-us.apache.org/repos/asf/camel/blob/208e21c5/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerSession.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerSession.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerSession.xml
index 7837077..859420e 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerSession.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerSession.xml
@@ -49,39 +49,39 @@
     <endpoint id="fromEndpoint" uri="jetty://http://127.0.0.1:${CxfRsProducerSessionTest.jetty}/CxfRsProducerSessionTest/echoservice"/>
     <route>
        <from uri="direct://proxy"/>
-       <to uri="cxfrs://bean://rsClientProxy"/>
+       <to uri="cxfrs://bean://rsClientProxy?synchronous=true"/>
        <convertBodyTo type="java.lang.String"/>
-       <to uri="cxfrs://bean://rsClientProxy"/>
+       <to uri="cxfrs://bean://rsClientProxy?synchronous=true"/>
     </route>
     <route>
        <from uri="direct://proxyinstance"/>
-       <to uri="cxfrs://bean://rsClientProxy?cookieHandler=#instanceCookieHandler"/>
+       <to uri="cxfrs://bean://rsClientProxy?cookieHandler=#instanceCookieHandler&amp;synchronous=true"/>
        <convertBodyTo type="java.lang.String"/>
-       <to uri="cxfrs://bean://rsClientProxy?cookieHandler=#instanceCookieHandler"/>
+       <to uri="cxfrs://bean://rsClientProxy?cookieHandler=#instanceCookieHandler&amp;synchronous=true"/>
     </route>
     <route>
        <from uri="direct://proxyexchange"/>
-       <to uri="cxfrs://bean://rsClientProxy?cookieHandler=#exchangeCookieHandler"/>
+       <to uri="cxfrs://bean://rsClientProxy?cookieHandler=#exchangeCookieHandler&amp;synchronous=true"/>
        <convertBodyTo type="java.lang.String"/>
-       <to uri="cxfrs://bean://rsClientProxy?cookieHandler=#exchangeCookieHandler"/>
+       <to uri="cxfrs://bean://rsClientProxy?cookieHandler=#exchangeCookieHandler&amp;synchronous=true"/>
     </route>
     <route>
        <from uri="direct://http"/>
-       <to uri="cxfrs://bean://rsClientHttp"/>
+       <to uri="cxfrs://bean://rsClientHttp?synchronous=true"/>
        <convertBodyTo type="java.lang.String"/>
-       <to uri="cxfrs://bean://rsClientHttp"/>
+       <to uri="cxfrs://bean://rsClientHttp?synchronous=true"/>
     </route>
     <route>
        <from uri="direct://httpinstance"/>
-       <to uri="cxfrs://bean://rsClientHttp?cookieHandler=#instanceCookieHandler"/>
+       <to uri="cxfrs://bean://rsClientHttp?cookieHandler=#instanceCookieHandler&amp;synchronous=true"/>
        <convertBodyTo type="java.lang.String"/>
-       <to uri="cxfrs://bean://rsClientHttp?cookieHandler=#instanceCookieHandler"/>
+       <to uri="cxfrs://bean://rsClientHttp?cookieHandler=#instanceCookieHandler&amp;synchronous=true"/>
     </route>
     <route>
        <from uri="direct://httpexchange"/>
-       <to uri="cxfrs://bean://rsClientHttp?cookieHandler=#exchangeCookieHandler"/>
+       <to uri="cxfrs://bean://rsClientHttp?cookieHandler=#exchangeCookieHandler&amp;synchronous=true"/>
        <convertBodyTo type="java.lang.String"/>
-       <to uri="cxfrs://bean://rsClientHttp?cookieHandler=#exchangeCookieHandler"/>
+       <to uri="cxfrs://bean://rsClientHttp?cookieHandler=#exchangeCookieHandler&amp;synchronous=true"/>
     </route>
   </camelContext>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/208e21c5/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml
index 97b5ede..3fa078a 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml
@@ -33,7 +33,7 @@
 		<camel:endpoint id="upload2"
 			uri="cxfrs:bean:rsServer2?bindingStyle=SimpleConsumer" />
 		<camel:endpoint id="upload2Client"
-			uri="cxfrs:bean:rsClient2?httpClientAPI=false" />
+			uri="cxfrs:bean:rsClient2?httpClientAPI=false&amp;synchronous=true" />
 	</camel:camelContext>
 	<cxf:rsServer id="rsServer1" address="http://localhost:${CXFTestSupport.port6}/CxfRsRelayTest/rest"
 		serviceClass="org.apache.camel.component.cxf.jaxrs.CxfRsRelayTest.UploadService"

http://git-wip-us.apache.org/repos/asf/camel/blob/208e21c5/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
index f266056..382fabf 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringRouter.xml
@@ -66,7 +66,7 @@
        <!-- Just need to ignoreDeleteMethodMessageBody -->
        <from uri="cxfrs://bean://rsServer"/>
        <to uri="log:body?level=INFO"/>
-       <to uri="cxfrs://bean://rsClient?ignoreDeleteMethodMessageBody=true"/>
+       <to uri="cxfrs://bean://rsClient?ignoreDeleteMethodMessageBody=true&amp;synchronous=true"/>
     </route>
   </camelContext>
   

http://git-wip-us.apache.org/repos/asf/camel/blob/208e21c5/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringSslAsyncProducer.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringSslAsyncProducer.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringSslAsyncProducer.xml
new file mode 100644
index 0000000..d912580
--- /dev/null
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringSslAsyncProducer.xml
@@ -0,0 +1,94 @@
+<?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"
+       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+       xmlns:sec="http://cxf.apache.org/configuration/security"
+       xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
+       http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+       http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
+       http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
+    ">
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+    <import resource="classpath:META-INF/cxf/cxf.xml"/>
+
+    <httpj:engine-factory bus="cxf">
+        <!-- you just need to specify the TLS Server configuration for the certain port -->
+        <httpj:engine port="${CXFTestSupport.sslPort}">
+            <httpj:tlsServerParameters>
+                <sec:keyManagers keyPassword="changeit">
+                    <sec:keyStore type="JKS" password="changeit"
+                                  resource="/ssl/keystore-server.jks"/>
+                </sec:keyManagers>
+                <sec:clientAuthentication want="false" required="false"/>
+            </httpj:tlsServerParameters>
+        </httpj:engine>
+    </httpj:engine-factory>
+
+    <jaxrs:server id="restService"
+                  address="https://localhost:${CXFTestSupport.sslPort}/CxfRsProducerTest/"
+                  staticSubresourceResolution="true">
+        <jaxrs:serviceBeans>
+            <ref bean="customerService"/>
+        </jaxrs:serviceBeans>
+    </jaxrs:server>
+
+    <sslContextParameters xmlns="http://camel.apache.org/schema/spring"
+                          id="wrongSslContext">
+        <trustManagers>
+            <keyStore type="JKS" resource="/ssl/truststore-wrong.jks"
+                      password="changeit"/>
+        </trustManagers>
+    </sslContextParameters>
+    <sslContextParameters xmlns="http://camel.apache.org/schema/spring"
+                          id="mySslContext">
+        <trustManagers>
+            <keyStore type="JKS" resource="/ssl/truststore-client.jks"
+                      password="changeit"/>
+        </trustManagers>
+    </sslContextParameters>
+
+    <bean id="defaultHostnameVerifier"
+          class="org.apache.cxf.transport.https.httpclient.DefaultHostnameVerifier"/>
+
+    <bean id="customerService" class="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"/>
+
+    <cxf:rsClient id="rsClientHttp" address="https://localhost:${CXFTestSupport.sslPort}/CxfRsProducerTest/"/>
+
+    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <route>
+            <from uri="direct://trust"/>
+            <to uri="cxfrs://bean://rsClientHttp?sslContextParameters=#mySslContext&amp;hostnameVerifier=#defaultHostnameVerifier"/>
+        </route>
+        <route>
+            <from uri="direct://wrongTrust"/>
+            <to uri="cxfrs://bean://rsClientHttp?sslContextParameters=#wrongSslContext&amp;hostnameVerifier=#defaultHostnameVerifier"/>
+        </route>
+        <route>
+            <from uri="direct://noTrust"/>
+            <to uri="cxfrs://bean://rsClientHttp?sslContextParameters=#wrongSslContext&amp;hostnameVerifier=#defaultHostnameVerifier"/>
+        </route>
+    </camelContext>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/208e21c5/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringSslProducer.xml
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringSslProducer.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringSslProducer.xml
index 06f17d8..327625e 100644
--- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringSslProducer.xml
+++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringSslProducer.xml
@@ -19,12 +19,10 @@
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:cxf="http://camel.apache.org/schema/cxf"
        xmlns:jaxrs="http://cxf.apache.org/jaxrs"
-       xmlns:util="http://www.springframework.org/schema/util"
        xmlns:sec="http://cxf.apache.org/configuration/security"
        xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
        http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
        http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
@@ -81,15 +79,15 @@
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
         <route>
             <from uri="direct://trust"/>
-            <to uri="cxfrs://bean://rsClientHttp?sslContextParameters=#mySslContext&amp;hostnameVerifier=#defaultHostnameVerifier"/>
+            <to uri="cxfrs://bean://rsClientHttp?sslContextParameters=#mySslContext&amp;hostnameVerifier=#defaultHostnameVerifier&amp;synchronous=true"/>
         </route>
         <route>
             <from uri="direct://wrongTrust"/>
-            <to uri="cxfrs://bean://rsClientHttp?sslContextParameters=#wrongSslContext&amp;hostnameVerifier=#defaultHostnameVerifier"/>
+            <to uri="cxfrs://bean://rsClientHttp?sslContextParameters=#wrongSslContext&amp;hostnameVerifier=#defaultHostnameVerifier&amp;synchronous=true"/>
         </route>
         <route>
             <from uri="direct://noTrust"/>
-            <to uri="cxfrs://bean://rsClientHttp?sslContextParameters=#wrongSslContext&amp;hostnameVerifier=#defaultHostnameVerifier"/>
+            <to uri="cxfrs://bean://rsClientHttp?sslContextParameters=#wrongSslContext&amp;hostnameVerifier=#defaultHostnameVerifier&amp;synchronous=true"/>
         </route>
     </camelContext>