You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2015/12/23 18:08:45 UTC
cxf git commit: Adding an MTOM fault test
Repository: cxf
Updated Branches:
refs/heads/master 1d9e4a307 -> 309f0c9fa
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/309f0c9f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/309f0c9f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/309f0c9f
Branch: refs/heads/master
Commit: 309f0c9fa9cc9216d6fae183ee1cab66ca208b13
Parents: 1d9e4a3
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Wed Dec 23 17:05:03 2015 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Wed Dec 23 17:05:03 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/309f0c9f/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 5429b7b..4bc825b 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/309f0c9f/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/309f0c9f/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 7f7ebf0..8863d41 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="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/309f0c9f/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 d89a8d2..3362cab 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="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>