Author: wtam
Date: Tue Mar 16 15:52:13 2010
New Revision: 923820

URL: http://svn.apache.org/viewvc?rev=923820&view=rev
Log:
add unit test for Soap 1.2 MTOM support

Added:
    
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test.java
   (with props)
    
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/HelloImpl12.java
   (with props)
    
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
   (with props)
Modified:
    
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadModeTest.java
    camel/trunk/components/camel-cxf/src/test/resources/mtom.wsdl

Added: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test.java?rev=923820&view=auto
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test.java
 (added)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test.java
 Tue Mar 16 15:52:13 2010
@@ -0,0 +1,51 @@
+/**
+ * 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.mtom;
+
+import java.net.URL;
+
+import org.apache.camel.cxf.mtom_feature.Hello;
+import org.apache.camel.cxf.mtom_feature.HelloService12;
+import org.springframework.test.context.ContextConfiguration;
+
+import static org.junit.Assert.assertNotNull;
+
+
+/**
+ * Unit test for exercising MTOM enabled end-to-end router in PAYLOAD mode for 
SOAP 1.2
+ * 
+ * @version $Revision$
+ */
+...@contextconfiguration
+public class CxfMtomRouterPayloadMode12Test extends 
CxfMtomRouterPayloadModeTest {
+    
+    @Override
+    protected Object getImpl() {
+        return new HelloImpl12();
+    }
+    
+    @Override
+    protected Hello getPort() {
+        URL wsdl = getClass().getResource("/mtom.wsdl");
+        assertNotNull("WSDL is null", wsdl);
+
+        HelloService12 service = new HelloService12(wsdl, 
HelloService12.SERVICE);
+        assertNotNull("Service is null ", service);
+        return service.getHelloPort();
+    }
+
+}

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

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

Modified: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadModeTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadModeTest.java?rev=923820&r1=923819&r2=923820&view=diff
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadModeTest.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadModeTest.java
 Tue Mar 16 15:52:13 2010
@@ -21,7 +21,6 @@ import java.awt.image.BufferedImage;
 import java.net.URL;
 
 import javax.imageio.ImageIO;
-import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.Holder;
@@ -48,16 +47,14 @@ import static org.junit.Assert.assertNot
  */
 @ContextConfiguration
 public class CxfMtomRouterPayloadModeTest extends 
AbstractJUnit4SpringContextTests {
-    
-    protected final QName serviceName = new 
QName("http://apache.org/camel/cxf/mtom_feature";, "HelloService");
-    
+        
     @Autowired
     protected CamelContext context;
     private Endpoint endpoint;
 
     @Before
     public void setUp() throws Exception {
-        endpoint = Endpoint.publish("http://localhost:9092/jaxws-mtom/hello";, 
new HelloImpl());
+        endpoint = Endpoint.publish("http://localhost:9092/jaxws-mtom/hello";, 
getImpl());
         SOAPBinding binding = (SOAPBinding)endpoint.getBinding();
         binding.setMTOMEnabled(true);
         
@@ -98,11 +95,11 @@ public class CxfMtomRouterPayloadModeTes
         
     }
     
-    private Hello getPort() {
+    protected Hello getPort() {
         URL wsdl = getClass().getResource("/mtom.wsdl");
         assertNotNull("WSDL is null", wsdl);
 
-        HelloService service = new HelloService(wsdl, serviceName);
+        HelloService service = new HelloService(wsdl, HelloService.SERVICE);
         assertNotNull("Service is null ", service);
         return service.getHelloPort();
     }
@@ -111,5 +108,10 @@ public class CxfMtomRouterPayloadModeTes
         return ImageIO.read(getClass().getResource(name));
     }
     
+    
+    protected Object getImpl() {
+        return new HelloImpl();
+    }
+    
 
 }

Added: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/HelloImpl12.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/HelloImpl12.java?rev=923820&view=auto
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/HelloImpl12.java
 (added)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/HelloImpl12.java
 Tue Mar 16 15:52:13 2010
@@ -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.component.cxf.mtom;
+
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlSeeAlso;
+
+import org.apache.camel.cxf.mtom_feature.Hello;
+
+/**
+ * Hello Test Impl class for SOAP 1.2
+ * @version $Revision$
+ */
+
+...@webservice(serviceName = "HelloService12")
+...@xmlseealso({org.apache.camel.cxf.mtom_feature.types.ObjectFactory.class})
+
[email protected](value = 
javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING)  
+public class HelloImpl12 extends HelloImpl implements Hello {
+        
+
+}

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

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

Modified: camel/trunk/components/camel-cxf/src/test/resources/mtom.wsdl
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/mtom.wsdl?rev=923820&r1=923819&r2=923820&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/mtom.wsdl (original)
+++ camel/trunk/components/camel-cxf/src/test/resources/mtom.wsdl Tue Mar 16 
15:52:13 2010
@@ -20,6 +20,7 @@ under the License.
 <wsdl:definitions xmlns:types="http://apache.org/camel/cxf/mtom_feature/types"; 
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
+          xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/";
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
                  xmlns:tns="http://apache.org/camel/cxf/mtom_feature"; 
                  name="jaxws mtom feature"
@@ -95,11 +96,40 @@ under the License.
        </wsdl:operation>
 
     </wsdl:binding>
+    
+    <wsdl:binding name="HelloBinding12" type="tns:Hello">
+        <soap12:binding 
transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"; style="document" /> 
+           <wsdl:operation name="echoData">
+               <soap12:operation soapAction="echoDataAction"/>
+               <wsdl:input>
+                       <soap12:body use="literal"/>
+               </wsdl:input>
+               <wsdl:output>
+                       <soap12:body use="literal"/>
+               </wsdl:output>
+           </wsdl:operation>
+
+           <wsdl:operation name="Detail">
+               <soap12:operation soapAction="DetailAction"/>
+               <wsdl:input>
+                       <soap12:body use="literal"/>
+               </wsdl:input>
+               <wsdl:output>
+                       <soap12:body use="literal"/>
+               </wsdl:output>
+           </wsdl:operation>
+    </wsdl:binding>
 
     <wsdl:service name="HelloService">
        <wsdl:port name="HelloPort" binding="tns:HelloBinding">
            <soap:address 
location="http://localhost:9091/jaxws-mtom/hello";></soap:address>
        </wsdl:port>
     </wsdl:service>
+    
+    <wsdl:service name="HelloService12">
+           <wsdl:port name="HelloPort" binding="tns:HelloBinding12">
+               <soap12:address 
location="http://localhost:9091/jaxws-mtom/hello"/>
+           </wsdl:port>
+    </wsdl:service>
 
 </wsdl:definitions>
\ No newline at end of file

Added: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml?rev=923820&view=auto
==============================================================================
--- 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
 (added)
+++ 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
 Tue Mar 16 15:52:13 2010
@@ -0,0 +1,89 @@
+<?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
+    ">
+
+  <!-- START SNIPPET: enableMtom -->
+
+   <cxf:cxfEndpoint id="routerEndpoint" 
address="http://localhost:9091/jaxws-mtom/hello";
+            wsdlURL="mtom.wsdl"
+            serviceName="ns:HelloService12"
+            endpointName="ns:HelloPort"
+            xmlns:ns="http://apache.org/camel/cxf/mtom_feature";>
+
+        <cxf:properties>
+            <!--  enable mtom by setting this property to true -->
+            <entry key="mtom-enabled" value="true"/>
+            
+            <!--  set the camel-cxf endpoint data fromat to PAYLOAD mode -->
+            <entry key="dataFormat" value="PAYLOAD"/>
+        </cxf:properties>      
+        
+  <!-- END SNIPPET: enableMtom -->
+       
+<!--                              
+        <cxf:inInterceptors>
+                   <ref bean="logInbound"/>
+               </cxf:inInterceptors>   
+               <cxf:outInterceptors>
+                   <ref bean="logOutbound"/>
+               </cxf:outInterceptors>
+-->
+       
+   </cxf:cxfEndpoint>
+            
+   <cxf:cxfEndpoint id="serviceEndpoint" 
address="http://localhost:9092/jaxws-mtom/hello";
+            wsdlURL="mtom.wsdl"
+            serviceName="ns:HelloService12"
+            endpointName="ns:HelloPort"
+            xmlns:ns="http://apache.org/camel/cxf/mtom_feature";>
+            
+        <cxf:properties>
+            <entry key="mtom-enabled" value="true"/>
+            <entry key="dataFormat" value="PAYLOAD"/>            
+        </cxf:properties>  
+
+<!--                              
+        <cxf:inInterceptors>
+                   <ref bean="logInbound"/>
+               </cxf:inInterceptors>   
+               <cxf:outInterceptors>
+                   <ref bean="logOutbound"/>
+               </cxf:outInterceptors>          
+-->
+
+   </cxf:cxfEndpoint>                        
+
+   <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
+      <route>
+          <from uri="cxf:bean:routerEndpoint" />
+          <to uri="cxf:bean:serviceEndpoint" />
+      </route>
+   </camelContext>
+   
+   <bean id="logOutbound" 
class="org.apache.cxf.interceptor.LoggingOutInterceptor" />         
+   <bean id="logInbound" 
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+
+</beans>
\ No newline at end of file

Propchange: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to