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 2017/01/20 15:41:27 UTC
[2/3] cxf git commit: Adding @Ignore'd tests for WSS4J Stax
whitespace issue
Adding @Ignore'd tests for WSS4J Stax whitespace issue
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b680ab1f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b680ab1f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b680ab1f
Branch: refs/heads/master
Commit: b680ab1feb3bcc8339b809550698f46b7212b168
Parents: 0a03465
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Jan 20 12:06:20 2017 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Jan 20 12:06:20 2017 +0000
----------------------------------------------------------------------
.../systest/ws/action/SignatureStaxServer.java | 41 ++++++++++
.../ws/action/SignatureWhitespaceTest.java | 41 +++++++++-
.../cxf/systest/ws/action/signature-server.xml | 12 +--
.../systest/ws/action/signature-stax-server.xml | 81 ++++++++++++++++++++
4 files changed, 166 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/b680ab1f/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureStaxServer.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureStaxServer.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureStaxServer.java
new file mode 100644
index 0000000..fdee170
--- /dev/null
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureStaxServer.java
@@ -0,0 +1,41 @@
+/**
+ * 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.cxf.systest.ws.action;
+
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class SignatureStaxServer extends AbstractBusTestServerBase {
+
+ public SignatureStaxServer() {
+
+ }
+
+ protected void run() {
+ URL busFile = SignatureStaxServer.class.getResource("signature-stax-server.xml");
+ Bus busLocal = new SpringBusFactory().createBus(busFile);
+ BusFactory.setDefaultBus(busLocal);
+ setBus(busLocal);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/b680ab1f/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
index f4de930..2f3cc43 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/SignatureWhitespaceTest.java
@@ -21,6 +21,8 @@ package org.apache.cxf.systest.ws.action;
import java.io.File;
import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
@@ -30,15 +32,20 @@ import javax.xml.ws.Service;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.systest.ws.common.SecurityTestUtil;
+import org.apache.cxf.systest.ws.common.TestParam;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.example.contract.doubleit.DoubleItPortType;
import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
/**
* A test for CXF-5679.
*/
+@RunWith(value = org.junit.runners.Parameterized.class)
public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
public static final String PORT = allocatePort(SignatureServer.class);
+ public static final String STAX_PORT = allocatePort(SignatureStaxServer.class);
private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
@@ -51,6 +58,18 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
// set this to false to fork
launchServer(SignatureServer.class, true)
);
+ assertTrue(
+ "Server failed to launch",
+ // run the server in the same process
+ // set this to false to fork
+ launchServer(SignatureStaxServer.class, true)
+ );
+ }
+
+ final TestParam test;
+
+ public SignatureWhitespaceTest(TestParam type) {
+ this.test = type;
}
@org.junit.AfterClass
@@ -58,6 +77,14 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
SecurityTestUtil.cleanup();
stopAllServers();
}
+
+ @Parameters(name = "{0}")
+ public static Collection<TestParam[]> data() {
+
+ return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
+ {new TestParam(STAX_PORT, false)},
+ });
+ }
@org.junit.Test
public void testNormalSignedSOAPBody() throws Exception {
@@ -74,7 +101,7 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
QName portQName = new QName(NAMESPACE, "DoubleItSignaturePort");
DoubleItPortType port =
service.getPort(portQName, DoubleItPortType.class);
- updateAddressPort(port, PORT);
+ updateAddressPort(port, test.getPort());
port.doubleIt(25);
@@ -84,6 +111,10 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
@org.junit.Test
public void testTrailingWhitespaceInSOAPBody() throws Exception {
+ // TODO Bug
+ if (STAX_PORT.equals(test.getPort())) {
+ return;
+ }
SpringBusFactory bf = new SpringBusFactory();
URL busFile = SignatureWhitespaceTest.class.getResource("client.xml");
@@ -105,7 +136,7 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
StreamSource request = new StreamSource(new File(requestFile.getPath()));
- updateAddressPort(dispatch, PORT);
+ updateAddressPort(dispatch, test.getPort());
// Make a successful request
StreamSource response = dispatch.invoke(request);
@@ -114,6 +145,10 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
@org.junit.Test
public void testAddedCommentsInSOAPBody() throws Exception {
+ // TODO Bug
+ if (STAX_PORT.equals(test.getPort())) {
+ return;
+ }
SpringBusFactory bf = new SpringBusFactory();
URL busFile = SignatureWhitespaceTest.class.getResource("client.xml");
@@ -135,7 +170,7 @@ public class SignatureWhitespaceTest extends AbstractBusClientServerTestBase {
StreamSource request = new StreamSource(new File(requestFile.getPath()));
- updateAddressPort(dispatch, PORT);
+ updateAddressPort(dispatch, test.getPort());
// Make a successful request
StreamSource response = dispatch.invoke(request);
http://git-wip-us.apache.org/repos/asf/cxf/blob/b680ab1f/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
index 5327944..e421492 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-server.xml
@@ -26,9 +26,9 @@
</cxf:features>
</cxf:bus>
- <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignature" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
+ <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature" address="http://localhost:${testutil.ports.SignatureStaxServer}/DoubleItSignature" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
<jaxws:outInterceptors>
- <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+ <bean class="org.apache.cxf.ws.security.wss4j.WSS4JStaxOutInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Signature"/>
@@ -41,7 +41,7 @@
</bean>
</jaxws:outInterceptors>
<jaxws:inInterceptors>
- <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+ <bean class="org.apache.cxf.ws.security.wss4j.WSS4JStaxInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Signature"/>
@@ -52,9 +52,9 @@
</jaxws:inInterceptors>
</jaxws:endpoint>
- <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature2" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignature2" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort2" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
+ <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature2" address="http://localhost:${testutil.ports.SignatureStaxServer}/DoubleItSignature2" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort2" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
<jaxws:outInterceptors>
- <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+ <bean class="org.apache.cxf.ws.security.wss4j.WSS4JStaxOutInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Signature"/>
@@ -67,7 +67,7 @@
</bean>
</jaxws:outInterceptors>
<jaxws:inInterceptors>
- <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+ <bean class="org.apache.cxf.ws.security.wss4j.WSS4JStaxInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Signature"/>
http://git-wip-us.apache.org/repos/asf/cxf/blob/b680ab1f/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-stax-server.xml
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-stax-server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-stax-server.xml
new file mode 100644
index 0000000..5327944
--- /dev/null
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/action/signature-stax-server.xml
@@ -0,0 +1,81 @@
+<?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:util="http://www.springframework.org/schema/util" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:cxf="http://cxf.apache.org/core" xmlns:p="http://cxf.apache.org/policy" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.2.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/policy http://cxf.apache.o
rg/schemas/policy.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd ">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+ <cxf:bus>
+ <cxf:features>
+ <p:policies/>
+ <cxf:logging/>
+ </cxf:features>
+ </cxf:bus>
+
+ <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignature" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
+ <jaxws:outInterceptors>
+ <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+ <constructor-arg>
+ <map>
+ <entry key="action" value="Signature"/>
+ <entry key="signatureUser" value="bob"/>
+ <entry key="signaturePropFile" value="bob.properties"/>
+ <entry key="signatureKeyIdentifier" value="DirectReference"/>
+ <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+ </map>
+ </constructor-arg>
+ </bean>
+ </jaxws:outInterceptors>
+ <jaxws:inInterceptors>
+ <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+ <constructor-arg>
+ <map>
+ <entry key="action" value="Signature"/>
+ <entry key="signatureVerificationPropFile" value="bob.properties"/>
+ </map>
+ </constructor-arg>
+ </bean>
+ </jaxws:inInterceptors>
+ </jaxws:endpoint>
+
+ <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="Signature2" address="http://localhost:${testutil.ports.SignatureServer}/DoubleItSignature2" serviceName="s:DoubleItService" endpointName="s:DoubleItSignaturePort2" implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" wsdlLocation="org/apache/cxf/systest/ws/action/DoubleItAction.wsdl">
+ <jaxws:outInterceptors>
+ <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
+ <constructor-arg>
+ <map>
+ <entry key="action" value="Signature"/>
+ <entry key="signatureUser" value="bob"/>
+ <entry key="signaturePropFile" value="bob.properties"/>
+ <entry key="signatureKeyIdentifier" value="DirectReference"/>
+ <entry key="passwordCallbackClass" value="org.apache.cxf.systest.ws.common.KeystorePasswordCallback"/>
+ </map>
+ </constructor-arg>
+ </bean>
+ </jaxws:outInterceptors>
+ <jaxws:inInterceptors>
+ <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
+ <constructor-arg>
+ <map>
+ <entry key="action" value="Signature"/>
+ <entry key="signatureVerificationPropFile"
+ value="org/apache/cxf/systest/ws/action/bob-modified.properties"/>
+ </map>
+ </constructor-arg>
+ </bean>
+ </jaxws:inInterceptors>
+ </jaxws:endpoint>
+</beans>