Adding an MTOM fault test

Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b4fc7d55
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b4fc7d55
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b4fc7d55

Branch: refs/heads/3.0.x-fixes
Commit: b4fc7d55c5b086ccf5023ebdb5b2853c255eb0c3
Parents: 2ae6337
Author: Colm O hEigeartaigh <[email protected]>
Authored: Wed Dec 23 17:05:03 2015 +0000
Committer: Colm O hEigeartaigh <[email protected]>
Committed: Wed Dec 23 17:10:55 2015 +0000

----------------------------------------------------------------------
 .../apache/cxf/systest/ws/fault/FaultTest.java  | 36 +++++++++++++++++++-
 .../cxf/systest/ws/fault/DoubleItFault.wsdl     |  3 ++
 .../org/apache/cxf/systest/ws/fault/client.xml  |  8 +++++
 .../org/apache/cxf/systest/ws/fault/server.xml  |  7 ++++
 4 files changed, 53 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b4fc7d55/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
----------------------------------------------------------------------
diff --git 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
index 1c8e475..f53366d 100644
--- 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
+++ 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java
@@ -135,6 +135,41 @@ public class FaultTest extends 
AbstractBusClientServerTestBase {
         bus.shutdown(true);
     }
     
+    // TODO
+    @org.junit.Test
+    @org.junit.Ignore
+    public void testSoap12Mtom() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = FaultTest.class.getResource("client.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+
+        URL wsdl = FaultTest.class.getResource("DoubleItFault.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItSoap12MtomPort");
+        DoubleItPortType utPort = 
+                service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(utPort, PORT);
+        
+        // Make a successful invocation
+        ((BindingProvider)utPort).getRequestContext().put("security.username", 
"alice");
+        utPort.doubleIt(25);
+        
+        // Now make an invocation using another username
+        ((BindingProvider)utPort).getRequestContext().put("security.username", 
"bob");
+        ((BindingProvider)utPort).getRequestContext().put("security.password", 
"password");
+        try {
+            utPort.doubleIt(25);
+            fail("Expected failure on bob");
+        } catch (Exception ex) {
+            assertTrue(ex.getMessage().contains("This is a fault"));
+        }
+        ((java.io.Closeable)utPort).close();
+        bus.shutdown(true);
+    }
+    
     @org.junit.Test
     public void testSoap12Dispatch() throws Exception {
         createBus();
@@ -190,5 +225,4 @@ public class FaultTest extends 
AbstractBusClientServerTestBase {
         client.destroy();
     }
     
-    
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/b4fc7d55/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl
----------------------------------------------------------------------
diff --git 
a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl
 
b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl
index 2e388f5..2d4bf02 100644
--- 
a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl
+++ 
b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl
@@ -103,6 +103,9 @@
         <wsdl:port name="DoubleItSoap12DispatchPort" 
binding="tns:DoubleItSoap12DispatchBinding">
             <soap12:address 
location="http://localhost:9009/DoubleItSoap12Dispatch"/>
         </wsdl:port>
+        <wsdl:port name="DoubleItSoap12MtomPort" 
binding="tns:DoubleItSoap12Binding">
+            <soap12:address 
location="http://localhost:9009/DoubleItSoap12Mtom"/>
+        </wsdl:port>
         <wsdl:port name="DoubleItAsymmetricPort" 
binding="tns:DoubleItAsymmetricBinding">
             <soap12:address 
location="http://localhost:9009/DoubleItAsymmetric"/>
         </wsdl:port>

http://git-wip-us.apache.org/repos/asf/cxf/blob/b4fc7d55/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml
----------------------------------------------------------------------
diff --git 
a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml
 
b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml
index 8011c39..7b8fbe8 100644
--- 
a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml
+++ 
b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml
@@ -38,6 +38,14 @@
             <entry key="ws-security.encryption.username" value="bob"/>
         </jaxws:properties>
     </jaxws:client>
+    <jaxws:client 
name="{http://www.example.org/contract/DoubleIt}DoubleItSoap12MtomPort"; 
createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="security.callback-handler" 
value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+            <entry key="security.encryption.properties" 
value="bob.properties"/>
+            <entry key="security.encryption.username" value="bob"/>
+            <entry key="mtom-enabled" value="true"/>
+        </jaxws:properties>
+    </jaxws:client>
     
     <jaxws:client 
name="{http://www.example.org/contract/DoubleIt}DoubleItAsymmetricPort"; 
createdFromAPI="true">
         <jaxws:properties>

http://git-wip-us.apache.org/repos/asf/cxf/blob/b4fc7d55/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml
----------------------------------------------------------------------
diff --git 
a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml
 
b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml
index 574b929..e696e9b 100644
--- 
a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml
+++ 
b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml
@@ -43,4 +43,11 @@
             <entry key="ws-security.signature.properties" 
value="bob.properties"/>
         </jaxws:properties>
     </jaxws:endpoint>
+    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt"; 
id="Soap12Mtom" 
address="http://localhost:${testutil.ports.fault.Server}/DoubleItSoap12Mtom"; 
serviceName="s:DoubleItService" endpointName="s:DoubleItSoap12MtomPort" 
implementor="org.apache.cxf.systest.ws.fault.DoubleItPortTypeImpl" 
wsdlLocation="org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl">
+        <jaxws:properties>
+            <entry key="security.callback-handler" 
value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+            <entry key="security.signature.properties" value="bob.properties"/>
+            <entry key="mtom-enabled" value="true"/>
+        </jaxws:properties>
+    </jaxws:endpoint>
 </beans>

Reply via email to