Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes b72e2b560 -> 418bfd0df


CXF-7088 - Adding streaming test


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

Branch: refs/heads/3.1.x-fixes
Commit: 418bfd0dffa1702fd44031ecf217000f41b86d88
Parents: b72e2b5
Author: Colm O hEigeartaigh <cohei...@apache.org>
Authored: Mon Oct 17 11:27:21 2016 +0100
Committer: Colm O hEigeartaigh <cohei...@apache.org>
Committed: Mon Oct 17 11:28:01 2016 +0100

----------------------------------------------------------------------
 .../systest/ws/tokens/SupportingTokenTest.java  | 16 +++--
 .../cxf/systest/ws/tokens/TLSStaxServer.java    | 47 +++++++++++++
 .../cxf/systest/ws/tokens/tls-stax-server.xml   | 69 ++++++++++++++++++++
 3 files changed, 128 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/418bfd0d/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java
----------------------------------------------------------------------
diff --git 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java
 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java
index 7e9ecd0..350ba03 100644
--- 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java
+++ 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java
@@ -45,6 +45,7 @@ public class SupportingTokenTest extends 
AbstractBusClientServerTestBase {
     static final String PORT = allocatePort(Server.class);
     static final String TLS_PORT = allocatePort(TLSServer.class);
     static final String STAX_PORT = allocatePort(StaxServer.class);
+    static final String TLS_STAX_PORT = allocatePort(TLSStaxServer.class);
     
     private static final String NAMESPACE = 
"http://www.example.org/contract/DoubleIt";;
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, 
"DoubleItService");
@@ -75,6 +76,12 @@ public class SupportingTokenTest extends 
AbstractBusClientServerTestBase {
                    // set this to false to fork
                    launchServer(StaxServer.class, true)
         );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(TLSStaxServer.class, true)
+        );
     }
     
     @Parameters(name = "{0}")
@@ -224,9 +231,6 @@ public class SupportingTokenTest extends 
AbstractBusClientServerTestBase {
     @org.junit.Test
     public void testEncryptedSupportingOverTLS() throws Exception {
 
-        if (STAX_PORT.equals(test.getPort())) {
-            return;
-        }
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SupportingTokenTest.class.getResource("tls-client.xml");
 
@@ -243,7 +247,9 @@ public class SupportingTokenTest extends 
AbstractBusClientServerTestBase {
         
         if (PORT.equals(test.getPort())) {
             updateAddressPort(port, TLS_PORT);
-        }
+        } else if (STAX_PORT.equals(test.getPort())) {
+            updateAddressPort(port, TLS_STAX_PORT);
+        } 
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(port);
@@ -257,6 +263,8 @@ public class SupportingTokenTest extends 
AbstractBusClientServerTestBase {
         
         if (PORT.equals(test.getPort())) {
             updateAddressPort(port, TLS_PORT);
+        } else if (STAX_PORT.equals(test.getPort())) {
+            updateAddressPort(port, TLS_STAX_PORT);
         }
         
         if (test.isStreaming()) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/418bfd0d/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/TLSStaxServer.java
----------------------------------------------------------------------
diff --git 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/TLSStaxServer.java
 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/TLSStaxServer.java
new file mode 100644
index 0000000..2cd3018
--- /dev/null
+++ 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/TLSStaxServer.java
@@ -0,0 +1,47 @@
+/**
+ * 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.tokens;
+
+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 TLSStaxServer extends AbstractBusTestServerBase {
+
+    public TLSStaxServer() {
+
+    }
+
+    protected void run()  {
+        URL busFile = TLSStaxServer.class.getResource("tls-stax-server.xml");
+        Bus busLocal = new SpringBusFactory().createBus(busFile);
+        BusFactory.setDefaultBus(busLocal);
+        setBus(busLocal);
+
+        try {
+            new TLSStaxServer();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/418bfd0d/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/tokens/tls-stax-server.xml
----------------------------------------------------------------------
diff --git 
a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/tokens/tls-stax-server.xml
 
b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/tokens/tls-stax-server.xml
new file mode 100644
index 0000000..240e83c
--- /dev/null
+++ 
b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/tokens/tls-stax-server.xml
@@ -0,0 +1,69 @@
+<?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: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.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.org/schemas/policy.xsd         
http://cxf.apache.org/transports/http/configuration             
http://cxf.apache.org/schemas/configuration/http-conf.xsd         http://cxf.apa
 che.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         
http://www.w3.org/ns/ws-policy                                  
http://www.w3.org/2007/02/ws-policy.xsd     ">
+    <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+    <cxf:bus>
+        <cxf:features>
+            <p:policies/>
+            <cxf:logging/>
+        </cxf:features>
+    </cxf:bus>
+    <httpj:engine-factory id="tls-settings">
+        <httpj:engine port="${testutil.ports.tokens.TLSStaxServer}">
+            <httpj:tlsServerParameters>
+                <sec:keyManagers keyPassword="password">
+                    <sec:keyStore type="jks" password="password" 
resource="keys/Bethal.jks"/>
+                </sec:keyManagers>
+                <sec:trustManagers>
+                    <sec:keyStore type="jks" password="password" 
resource="keys/Truststore.jks"/>
+                </sec:trustManagers>
+                <sec:clientAuthentication want="true" required="false"/>
+            </httpj:tlsServerParameters>
+        </httpj:engine>
+    </httpj:engine-factory>
+    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt"; 
id="EncryptedSupportingTokens4" 
address="https://localhost:${testutil.ports.tokens.TLSStaxServer}/DoubleItEncryptedSupporting4";
 serviceName="s:DoubleItService" 
endpointName="s:DoubleItEncryptedSupportingPort4" 
implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" 
wsdlLocation="org/apache/cxf/systest/ws/tokens/DoubleItTokens.wsdl" 
depends-on="tls-settings">
+        <jaxws:properties>
+            <entry key="security.callback-handler" 
value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/>
+            <entry key="security.signature.properties" value="bob.properties"/>
+            <entry key="security.encryption.username" value="useReqSigCert"/>
+            <entry key="security.subject.cert.constraints" 
value=".*O=apache.org.*"/>
+            <entry key="ws-security.enable.streaming" value="true"/>
+        </jaxws:properties>
+        <jaxws:features>
+            <p:policies>
+                <wsp:PolicyReference 
xmlns:wsp="http://www.w3.org/ns/ws-policy"; 
URI="classpath:/org/apache/cxf/systest/ws/tokens/encrypted-supp-token-policy.xml"/>
+            </p:policies>
+        </jaxws:features>
+    </jaxws:endpoint>
+    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt"; 
id="EncryptedSupportingTokens5" 
address="https://localhost:${testutil.ports.tokens.TLSStaxServer}/DoubleItEncryptedSupporting5";
 serviceName="s:DoubleItService" 
endpointName="s:DoubleItEncryptedSupportingPort5" 
implementor="org.apache.cxf.systest.ws.common.DoubleItImpl" 
wsdlLocation="org/apache/cxf/systest/ws/tokens/DoubleItTokens.wsdl" 
depends-on="tls-settings">
+        <jaxws:properties>
+            <entry key="security.callback-handler" 
value="org.apache.cxf.systest.ws.common.UTPasswordCallback"/>
+            <entry key="security.signature.properties" value="bob.properties"/>
+            <entry key="security.encryption.username" value="useReqSigCert"/>
+            <entry key="security.subject.cert.constraints" 
value=".*O=apache.org.*"/>
+            <entry key="ws-security.enable.streaming" value="true"/>
+        </jaxws:properties>
+        <jaxws:features>
+            <p:policies>
+                <wsp:PolicyReference 
xmlns:wsp="http://www.w3.org/ns/ws-policy"; 
URI="classpath:/org/apache/cxf/systest/ws/tokens/encrypted-supp-token-policy.xml"/>
+            </p:policies>
+        </jaxws:features>
+    </jaxws:endpoint>
+</beans>

Reply via email to