You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2011/11/08 11:33:00 UTC

svn commit: r1199177 - in /camel/trunk/components/camel-cxf/src/test: java/org/apache/camel/component/cxf/wsa/ resources/org/apache/camel/component/cxf/wsa/

Author: ningjiang
Date: Tue Nov  8 10:33:00 2011
New Revision: 1199177

URL: http://svn.apache.org/viewvc?rev=1199177&view=rev
Log:
Enhanced the Camel WSAddressingTest

Added:
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest.java   (with props)
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest-context.xml
      - copied, changed from r1198990, camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingTest-context.xml
Modified:
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingTest.java
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingTest-context.xml

Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest.java?rev=1199177&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest.java (added)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest.java Tue Nov  8 10:33:00 2011
@@ -0,0 +1,24 @@
+/**
+ * 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.component.cxf.wsa;
+
+import org.springframework.test.context.ContextConfiguration;
+
+@ContextConfiguration
+public class WSAddressingPAYLOADTest extends WSAddressingTest {
+
+}

Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingTest.java?rev=1199177&r1=1199176&r2=1199177&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingTest.java (original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wsa/WSAddressingTest.java Tue Nov  8 10:33:00 2011
@@ -17,6 +17,7 @@
 package org.apache.camel.component.cxf.wsa;
 
 import java.net.URL;
+import java.util.List;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
@@ -41,6 +42,7 @@ import org.springframework.test.context.
 import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 /**
  *
  * @version 
@@ -49,7 +51,8 @@ import static org.junit.Assert.assertEqu
 public class WSAddressingTest extends AbstractJUnit4SpringContextTests {
     protected static int port0 = CXFTestSupport.getPort1(); 
     protected static int port1 = CXFTestSupport.getPort2(); 
-    protected static int port2 = CXFTestSupport.getPort3(); 
+    protected static int port2 = CXFTestSupport.getPort3();
+
     
     
     @Autowired
@@ -58,12 +61,20 @@ public class WSAddressingTest extends Ab
     
     private Server serviceEndpoint;
     
+    protected String getServerAddress() {
+        return "http://localhost:" + port1 + "/" + this.getClass().getSimpleName() + "/SoapContext/SoapPort";
+    }
+    
+    protected String getClientAddress() {
+        return "http://localhost:" + port0 + "/" + this.getClass().getSimpleName() + "/SoapContext/SoapPort";
+    }
+    
     @Before
     public void setUp() throws Exception {      
         
         template = context.createProducerTemplate();
         JaxWsServerFactoryBean svrBean = new JaxWsServerFactoryBean();
-        svrBean.setAddress("http://localhost:" + port1 + "/WSAddressingTest/SoapContext/SoapPort");
+        svrBean.setAddress(getServerAddress());
         svrBean.setServiceClass(Greeter.class);
         svrBean.setServiceBean(new GreeterImpl());
         SpringBusFactory bf = new SpringBusFactory();
@@ -88,7 +99,7 @@ public class WSAddressingTest extends Ab
     public void testWSAddressing() throws Exception {
         JaxWsProxyFactoryBean proxyFactory = new  JaxWsProxyFactoryBean();
         ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
-        clientBean.setAddress("http://localhost:" + port0 + "/WSAddressingTest/SoapContext/SoapPort");
+        clientBean.setAddress(getClientAddress());
         clientBean.setServiceClass(Greeter.class);
         SpringBusFactory bf = new SpringBusFactory();
         URL cxfConfig = null;
@@ -96,7 +107,7 @@ public class WSAddressingTest extends Ab
         if (getCxfClientConfig() != null) {
             cxfConfig = ClassLoaderUtils.getResource(getCxfClientConfig(), this.getClass());
         }
-        clientBean.setBus(bf.createBus(cxfConfig));
+        proxyFactory.setBus(bf.createBus(cxfConfig));
         Greeter client = (Greeter) proxyFactory.create();
         String result = client.greetMe("world!");
         assertEquals("Get a wrong response", "Hello world!", result);
@@ -119,6 +130,10 @@ public class WSAddressingTest extends Ab
     public static class RemoveRequestOutHeaderProcessor implements Processor {
 
         public void process(Exchange exchange) throws Exception {
+            List headerList = (List) exchange.getIn().getHeader(Header.HEADER_LIST);
+            assertNotNull("We should get the header list.", headerList);
+            assertEquals("Get a wrong size of header list.", 4, headerList.size());
+            // we don't need send the soap headers to the client
             exchange.getIn().removeHeader(Header.HEADER_LIST);
         }
         

Copied: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest-context.xml (from r1198990, camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingTest-context.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest-context.xml?p2=camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest-context.xml&p1=camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingTest-context.xml&r1=1198990&r2=1199177&rev=1199177&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingTest-context.xml (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingPAYLOADTest-context.xml Tue Nov  8 10:33:00 2011
@@ -22,11 +22,10 @@
        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
   ">
-  
-     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
   
 	<cxf:cxfEndpoint id="routerEndpoint"
-		address="http://localhost:${CXFTestSupport.port1}/WSAddressingTest/SoapContext/SoapPort" endpointName="tns:SoapPort"
+		address="http://localhost:${CXFTestSupport.port1}/WSAddressingPAYLOADTest/SoapContext/SoapPort" endpointName="tns:SoapPort"
 		serviceName="tns:SOAPService" wsdlURL="/wsdl/hello_world.wsdl"
 		serviceClass="org.apache.hello_world_soap_http.Greeter"
 		xmlns:tns="http://apache.org/hello_world_soap_http">
@@ -41,7 +40,7 @@
 		</cxf:features>
 	</cxf:cxfEndpoint>
 	<cxf:cxfEndpoint id="serviceEndpoint"
-		address="http://localhost:${CXFTestSupport.port2}/WSAddressingTest/SoapContext/SoapPort" endpointName="tns:SoapPort"
+		address="http://localhost:${CXFTestSupport.port2}/WSAddressingPAYLOADTest/SoapContext/SoapPort" endpointName="tns:SoapPort"
 		serviceName="tns:SOAPService" wsdlURL="/wsdl/hello_world.wsdl"
 		serviceClass="org.apache.hello_world_soap_http.Greeter"		
 		xmlns:tns="http://apache.org/hello_world_soap_http">
@@ -55,19 +54,19 @@
 			<wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing" />
 		</cxf:features-->
 	</cxf:cxfEndpoint>	
-
-	<camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring">
-		<route>
-			<from uri="cxf:bean:routerEndpoint" />
-			<!-- need to remove the addressing header, since the back end service doesn't support addressing -->
-			<process ref="removeRequestOutHeaderProcessor" />			
-			<to uri="cxf:bean:serviceEndpoint" />			
-		</route>
-	</camelContext>	
 	
 	<bean id="removeRequestOutHeaderProcessor"
 		class="org.apache.camel.component.cxf.wsa.WSAddressingTest$RemoveRequestOutHeaderProcessor" />
 		
 	<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
 	<bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
+    
+	<camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring">
+		<route>
+			<from uri="cxf:bean:routerEndpoint?dataFormat=PAYLOAD" />
+			<!-- need to remove the addressing header, since the back end service doesn't support addressing -->
+			<process ref="removeRequestOutHeaderProcessor" />			
+			<to uri="cxf:bean:serviceEndpoint?dataFormat=PAYLOAD" />			
+		</route>
+	</camelContext>	
 </beans>
\ No newline at end of file

Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingTest-context.xml?rev=1199177&r1=1199176&r2=1199177&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingTest-context.xml (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wsa/WSAddressingTest-context.xml Tue Nov  8 10:33:00 2011
@@ -22,8 +22,7 @@
        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
   ">
-  
-     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
   
 	<cxf:cxfEndpoint id="routerEndpoint"
 		address="http://localhost:${CXFTestSupport.port1}/WSAddressingTest/SoapContext/SoapPort" endpointName="tns:SoapPort"
@@ -55,7 +54,13 @@
 			<wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing" />
 		</cxf:features-->
 	</cxf:cxfEndpoint>	
-
+	
+	<bean id="removeRequestOutHeaderProcessor"
+		class="org.apache.camel.component.cxf.wsa.WSAddressingTest$RemoveRequestOutHeaderProcessor" />
+		
+	<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
+	<bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
+	
 	<camelContext id="camel" trace="true" xmlns="http://camel.apache.org/schema/spring">
 		<route>
 			<from uri="cxf:bean:routerEndpoint" />
@@ -64,10 +69,4 @@
 			<to uri="cxf:bean:serviceEndpoint" />			
 		</route>
 	</camelContext>	
-	
-	<bean id="removeRequestOutHeaderProcessor"
-		class="org.apache.camel.component.cxf.wsa.WSAddressingTest$RemoveRequestOutHeaderProcessor" />
-		
-	<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
-	<bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
 </beans>
\ No newline at end of file