You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by as...@apache.org on 2016/05/20 19:46:30 UTC
[1/2] cxf git commit: [CXF-6908] Adding testcase
Repository: cxf
Updated Branches:
refs/heads/master e28b6d244 -> 0c2fb8fe7
[CXF-6908] Adding testcase
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ffa81f69
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ffa81f69
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ffa81f69
Branch: refs/heads/master
Commit: ffa81f69c90a6287429631b7da2eb0390f5608f4
Parents: e28b6d2
Author: Alessio Soldano <as...@redhat.com>
Authored: Fri May 20 21:36:40 2016 +0200
Committer: Alessio Soldano <as...@redhat.com>
Committed: Fri May 20 21:37:23 2016 +0200
----------------------------------------------------------------------
.../systest/ws/security/SecurityPolicyTest.java | 68 ++++++++++++++++++++
.../cxf/systest/ws/security/DoubleIt.wsdl | 3 +
2 files changed, 71 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/ffa81f69/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
index 4ab13d7..fb0eea0 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
@@ -29,6 +29,8 @@ import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.BindingProvider;
@@ -39,6 +41,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
import javax.xml.ws.ServiceMode;
import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.soap.SOAPFaultException;
import javax.xml.xpath.XPathConstants;
import org.w3c.dom.Document;
@@ -79,6 +82,8 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase {
+ PORT + "/SecPolTestSignThenEncrypt";
public static final String POLICY_SIGNENC_PROVIDER_ADDRESS
= "http://localhost:" + PORT + "/SecPolTestSignThenEncryptProvider";
+ public static final String POLICY_FAULT_SIGNENC_PROVIDER_ADDRESS
+ = "http://localhost:" + PORT + "/SecPolTestFaultSignThenEncryptProvider";
public static final String POLICY_SIGN_ADDRESS = "http://localhost:" + PORT + "/SecPolTestSign";
public static final String POLICY_XPATH_ADDRESS = "http://localhost:" + PORT + "/SecPolTestXPath";
public static final String POLICY_SIGNONLY_ADDRESS = "http://localhost:" + PORT + "/SecPolTestSignedOnly";
@@ -164,6 +169,12 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase {
ei = ep.getServer().getEndpoint().getEndpointInfo();
setCryptoProperties(ei, "bob.properties", "alice.properties");
+ ep = (EndpointImpl)Endpoint.publish(POLICY_FAULT_SIGNENC_PROVIDER_ADDRESS,
+ new DoubleItFaultProvider());
+
+ ei = ep.getServer().getEndpoint().getEndpointInfo();
+ setCryptoProperties(ei, "bob.properties", "alice.properties");
+
ep = (EndpointImpl)Endpoint.create(new DoubleItImpl());
ep.setEndpointName(new QName("http://www.example.org/contract/DoubleIt", "DoubleItPortSignedOnly"));
ep.setWsdlLocation(wsdl.getPath());
@@ -468,6 +479,28 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase {
}
+ @WebServiceProvider(targetNamespace = "http://www.example.org/contract/DoubleIt",
+ portName = "DoubleItFaultPortSignThenEncrypt",
+ serviceName = "DoubleItService",
+ wsdlLocation = "classpath:/org/apache/cxf/systest/ws/security/DoubleIt.wsdl")
+ @ServiceMode(value = Mode.MESSAGE)
+ public static class DoubleItFaultProvider implements Provider<SOAPMessage> {
+
+ public SOAPMessage invoke(SOAPMessage request) {
+ try {
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SOAPMessage msg = messageFactory.createMessage();
+ msg.getSOAPBody().addFault(new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server"),
+ "Foo");
+ return msg;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ }
+
@Test
public void testCXF3041() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
@@ -666,4 +699,39 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase {
epBus.shutdown(true);
bus.shutdown(true);
}
+
+ @Test
+ public void testFault() throws Exception {
+ SpringBusFactory bf = new SpringBusFactory();
+
+ URL busFile = SecurityPolicyTest.class.getResource("https_config_client.xml");
+ Bus bus = bf.createBus(busFile.toString());
+ SpringBusFactory.setDefaultBus(bus);
+ SpringBusFactory.setThreadDefaultBus(bus);
+
+ URL wsdl = SecurityPolicyTest.class.getResource("DoubleIt.wsdl");
+ Service service = Service.create(wsdl, SERVICE_QNAME);
+
+ QName portQName = new QName(NAMESPACE, "DoubleItFaultPortSignThenEncrypt");
+ DoubleItPortType pt = service.getPort(portQName, DoubleItPortType.class);
+ updateAddressPort(pt, PORT);
+ ((BindingProvider)pt).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER,
+ new KeystorePasswordCallback());
+ ((BindingProvider)pt).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
+ "alice.properties");
+ ((BindingProvider)pt).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES,
+ "bob.properties");
+
+ // DOM
+ try {
+ pt.doubleIt(5);
+ fail("SOAPFaultException expected!");
+ } catch (SOAPFaultException e) {
+ assertEquals("Foo", e.getFault().getFaultString());
+ } finally {
+ ((java.io.Closeable)pt).close();
+ bus.shutdown(true);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/ffa81f69/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl
index f478fa6..20f2f2e 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/security/DoubleIt.wsdl
@@ -246,6 +246,9 @@
<wsdl:port name="DoubleItPortSignThenEncrypt" binding="tns:DoubleItBindingSignThenEncrypt">
<soap:address location="http://localhost:9010/SecPolTestSignThenEncrypt"/>
</wsdl:port>
+ <wsdl:port name="DoubleItFaultPortSignThenEncrypt" binding="tns:DoubleItBindingSignThenEncrypt">
+ <soap:address location="http://localhost:9010/SecPolTestFaultSignThenEncryptProvider"/>
+ </wsdl:port>
<wsdl:port name="DoubleItPortSign" binding="tns:DoubleItBindingSign">
<soap:address location="http://localhost:9010/SecPolTestSign"/>
</wsdl:port>
[2/2] cxf git commit: [CXF-6908] Excluding test for still open issue
Posted by as...@apache.org.
[CXF-6908] Excluding test for still open issue
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/0c2fb8fe
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/0c2fb8fe
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/0c2fb8fe
Branch: refs/heads/master
Commit: 0c2fb8fe7847cc85862ec5e9fec9c7bf9b2c195c
Parents: ffa81f6
Author: Alessio Soldano <as...@redhat.com>
Authored: Fri May 20 21:45:48 2016 +0200
Committer: Alessio Soldano <as...@redhat.com>
Committed: Fri May 20 21:45:48 2016 +0200
----------------------------------------------------------------------
.../org/apache/cxf/systest/ws/security/SecurityPolicyTest.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/0c2fb8fe/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
index fb0eea0..4cd7b66 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/SecurityPolicyTest.java
@@ -68,6 +68,7 @@ import org.example.contract.doubleit.DoubleItPortTypeHeader;
import org.example.schema.doubleit.DoubleIt;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
public class SecurityPolicyTest extends AbstractBusClientServerTestBase {
@@ -701,6 +702,7 @@ public class SecurityPolicyTest extends AbstractBusClientServerTestBase {
}
@Test
+ @Ignore("CXF-6908")
public void testFault() throws Exception {
SpringBusFactory bf = new SpringBusFactory();