cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/2] cxf git commit: Fixing tests
Date Mon, 15 Dec 2014 15:34:32 GMT
Fixing tests


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

Branch: refs/heads/2.7.x-fixes
Commit: 639efcb8eed7749559c35df0f70c78bf3d997d28
Parents: 06d3905
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Dec 15 15:34:23 2014 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Dec 15 15:34:23 2014 +0000

----------------------------------------------------------------------
 .../cxf/systest/sts/template/StaxServer.java    | 46 ------------
 .../cxf/systest/sts/template/TemplateTest.java  | 78 +++-----------------
 .../systest/sts/template/cxf-stax-service.xml   | 51 -------------
 3 files changed, 12 insertions(+), 163 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/639efcb8/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/StaxServer.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/StaxServer.java
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/StaxServer.java
deleted file mode 100644
index 18818af..0000000
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/StaxServer.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.sts.template;
-
-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 StaxServer extends AbstractBusTestServerBase {
-
-    public StaxServer() {
-
-    }
-
-    protected void run()  {
-        URL busFile = StaxServer.class.getResource("cxf-stax-service.xml");
-        Bus busLocal = new SpringBusFactory().createBus(busFile);
-        BusFactory.setDefaultBus(busLocal);
-        setBus(busLocal);
-
-        try {
-            new StaxServer();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf/blob/639efcb8/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
index 2fe7ea5..9445c56 100644
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/template/TemplateTest.java
@@ -19,8 +19,6 @@
 package org.apache.cxf.systest.sts.template;
 
 import java.net.URL;
-import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -31,40 +29,26 @@ import javax.xml.ws.Service;
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.systest.sts.common.SecurityTestUtil;
-import org.apache.cxf.systest.sts.common.TestParam;
 import org.apache.cxf.systest.sts.deployment.STSServer;
-import org.apache.cxf.systest.sts.deployment.StaxSTSServer;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.trust.STSClient;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized.Parameters;
 
 /**
  * Test various aspects of the RequestSecurityTokenTemplate. Make sure that if we are expecting
  * a SAML 2.0 token, that's what we get etc. Same goes for the KeyType.
  */
-@RunWith(value = org.junit.runners.Parameterized.class)
 public class TemplateTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
-    static final String STAX_STSPORT = allocatePort(StaxSTSServer.class);
     static final String STSPORT2 = allocatePort(STSServer.class, 2);
-    static final String STAX_STSPORT2 = allocatePort(StaxSTSServer.class, 2);
     
     private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
 
     private static final String PORT = allocatePort(Server.class);
-    private static final String STAX_PORT = allocatePort(StaxServer.class);
-    
-    final TestParam test;
-    
-    public TemplateTest(TestParam type) {
-        this.test = type;
-    }
     
     @BeforeClass
     public static void startServers() throws Exception {
@@ -78,24 +62,10 @@ public class TemplateTest extends AbstractBusClientServerTestBase {
                    "Server failed to launch",
                    // run the server in the same process
                    // 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(STSServer.class, true)
         );
     }
     
-    @Parameters(name = "{0}")
-    public static Collection<TestParam[]> data() {
-       
-        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false, STSPORT)},
-                                                {new TestParam(STAX_PORT, false, STSPORT)},
-        });
-    }
-    
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
@@ -117,21 +87,17 @@ public class TemplateTest extends AbstractBusClientServerTestBase {
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1PublicKeyPort");
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, test.getPort());
+        updateAddressPort(port, PORT);
         
         // Setup STSClient
         STSClient stsClient = createSTSClient(bus);
-        String wsdlLocation = "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";
+        String wsdlLocation = "https://localhost:" + STSPORT + "/SecurityTokenService/Transport?wsdl";
         stsClient.setWsdlLocation(wsdlLocation);
         
         ((BindingProvider)port).getRequestContext().put(
             SecurityConstants.STS_CLIENT, stsClient
         );
         
-        if (test.isStreaming()) {
-            SecurityTestUtil.enableStreaming(port);
-        }
-        
         doubleIt(port, 25);
         
         ((java.io.Closeable)port).close();
@@ -153,23 +119,19 @@ public class TemplateTest extends AbstractBusClientServerTestBase {
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1PublicKeyPort");
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, test.getPort());
+        updateAddressPort(port, PORT);
         
         // Setup STSClient
         STSClient stsClient = createSTSClient(bus);
         stsClient.setKeyType("http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey");
         stsClient.setTokenType("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0");
-        String wsdlLocation = "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";
+        String wsdlLocation = "https://localhost:" + STSPORT + "/SecurityTokenService/Transport?wsdl";
         stsClient.setWsdlLocation(wsdlLocation);
         
         ((BindingProvider)port).getRequestContext().put(
             SecurityConstants.STS_CLIENT, stsClient
         );
 
-        if (test.isStreaming()) {
-            SecurityTestUtil.enableStreaming(port);
-        }
-        
         try {
             doubleIt(port, 25);
             fail("Failure expected on sending a SAML 2.0 token");
@@ -196,13 +158,13 @@ public class TemplateTest extends AbstractBusClientServerTestBase {
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1PublicKeyPort");
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, test.getPort());
+        updateAddressPort(port, PORT);
         
         // Setup STSClient
         STSClient stsClient = createSTSClient(bus);
         stsClient.setKeyType("http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer");
         stsClient.setTokenType("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");
-        String wsdlLocation = "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";
+        String wsdlLocation = "https://localhost:" + STSPORT + "/SecurityTokenService/Transport?wsdl";
         stsClient.setWsdlLocation(wsdlLocation);
         
         ((BindingProvider)port).getRequestContext().put(
@@ -210,10 +172,6 @@ public class TemplateTest extends AbstractBusClientServerTestBase {
         );
         ((BindingProvider)port).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME,
                                                         "myclientkey");
-        if (test.isStreaming()) {
-            SecurityTestUtil.enableStreaming(port);
-        }
-        
         try {
             doubleIt(port, 25);
             fail("Failure expected on sending a SAML 1.1 Bearer token");
@@ -240,21 +198,17 @@ public class TemplateTest extends AbstractBusClientServerTestBase {
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2PublicKeyPort");
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, test.getPort());
+        updateAddressPort(port, PORT);
         
         // Setup STSClient
         STSClient stsClient = createSTSClient(bus);
-        String wsdlLocation = "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";
+        String wsdlLocation = "https://localhost:" + STSPORT + "/SecurityTokenService/Transport?wsdl";
         stsClient.setWsdlLocation(wsdlLocation);
         
         ((BindingProvider)port).getRequestContext().put(
             SecurityConstants.STS_CLIENT, stsClient
         );
         
-        if (test.isStreaming()) {
-            SecurityTestUtil.enableStreaming(port);
-        }
-        
         doubleIt(port, 25);
         
         ((java.io.Closeable)port).close();
@@ -276,23 +230,19 @@ public class TemplateTest extends AbstractBusClientServerTestBase {
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2PublicKeyPort");
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, test.getPort());
+        updateAddressPort(port, PORT);
         
         // Setup STSClient
         STSClient stsClient = createSTSClient(bus);
         stsClient.setKeyType("http://docs.oasis-open.org/ws-sx/ws-trust/200512/PublicKey");
         stsClient.setTokenType("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");
-        String wsdlLocation = "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";
+        String wsdlLocation = "https://localhost:" + STSPORT + "/SecurityTokenService/Transport?wsdl";
         stsClient.setWsdlLocation(wsdlLocation);
         
         ((BindingProvider)port).getRequestContext().put(
             SecurityConstants.STS_CLIENT, stsClient
         );
         
-        if (test.isStreaming()) {
-            SecurityTestUtil.enableStreaming(port);
-        }
-        
         try {
             doubleIt(port, 25);
             fail("Failure expected on sending a SAML 1.1 token");
@@ -319,23 +269,19 @@ public class TemplateTest extends AbstractBusClientServerTestBase {
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2PublicKeyPort");
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, test.getPort());
+        updateAddressPort(port, PORT);
         
         // Setup STSClient
         STSClient stsClient = createSTSClient(bus);
         stsClient.setKeyType("http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer");
         stsClient.setTokenType("http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0");
-        String wsdlLocation = "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";
+        String wsdlLocation = "https://localhost:" + STSPORT + "/SecurityTokenService/Transport?wsdl";
         stsClient.setWsdlLocation(wsdlLocation);
         
         ((BindingProvider)port).getRequestContext().put(
             SecurityConstants.STS_CLIENT, stsClient
         );
         
-        if (test.isStreaming()) {
-            SecurityTestUtil.enableStreaming(port);
-        }
-        
         try {
             doubleIt(port, 25);
             fail("Failure expected on sending a SAML 2.0 Bearer token");

http://git-wip-us.apache.org/repos/asf/cxf/blob/639efcb8/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/template/cxf-stax-service.xml
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/template/cxf-stax-service.xml
b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/template/cxf-stax-service.xml
deleted file mode 100644
index 24a0ed9..0000000
--- a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/template/cxf-stax-service.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<!--
- 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:cxf="http://cxf.apache.org/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sec="http://cxf.apache.org/configuration/security"
xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation="             http://cxf.apache.org/core
            http://cxf.apache.org/schemas/core.xsd             http://cxf.apache.org/configuration/security
            http://cxf.apache.org/schemas/configuration/security.xsd             http://cxf.apache.org/jaxws
            http://cxf.apache.org/schemas/jaxws.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://www.springframework.org/schema/beans             http://www.springframework.org/schema/beans/spring-beans.xsd">
-    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="doubleittransportsaml1PublicKey"
implementor="org.apache.cxf.systest.sts.common.DoubleItPortTypeImpl" endpointName="s:DoubleItTransportSAML1PublicKeyPort"
serviceName="s:DoubleItService" depends-on="ClientAuthHttpsSettings" address="https://localhost:${testutil.ports.StaxServer}/doubleit/services/doubleittransportsaml1publickey"
wsdlLocation="org/apache/cxf/systest/sts/template/DoubleIt.wsdl">
-        <jaxws:properties>
-            <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
-            <entry key="ws-security.signature.properties" value="serviceKeystore.properties"/>
-            <entry key="ws-security.is-bsp-compliant" value="false"/>
-            <entry key="ws-security.enable.streaming" value="true"/>
-        </jaxws:properties>
-    </jaxws:endpoint>
-    <jaxws:endpoint xmlns:s="http://www.example.org/contract/DoubleIt" id="doubleittransportsaml2PublicKey"
implementor="org.apache.cxf.systest.sts.common.DoubleItPortTypeImpl" endpointName="s:DoubleItTransportSAML2PublicKeyPort"
serviceName="s:DoubleItService" depends-on="ClientAuthHttpsSettings" address="https://localhost:${testutil.ports.StaxServer}/doubleit/services/doubleittransportsaml2publickey"
wsdlLocation="org/apache/cxf/systest/sts/template/DoubleIt.wsdl">
-        <jaxws:properties>
-            <entry key="ws-security.callback-handler" value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
-            <entry key="ws-security.signature.properties" value="serviceKeystore.properties"/>
-            <entry key="ws-security.is-bsp-compliant" value="false"/>
-            <entry key="ws-security.enable.streaming" value="true"/>
-        </jaxws:properties>
-    </jaxws:endpoint>
-    <httpj:engine-factory id="ClientAuthHttpsSettings" bus="cxf">
-        <httpj:engine port="${testutil.ports.StaxServer}">
-            <httpj:tlsServerParameters>
-                <sec:keyManagers keyPassword="skpass">
-                    <sec:keyStore type="jks" password="sspass" resource="servicestore.jks"/>
-                </sec:keyManagers>
-                <sec:trustManagers>
-                    <sec:keyStore type="jks" password="stsspass" resource="stsstore.jks"/>
-                </sec:trustManagers>
-                <sec:clientAuthentication want="true" required="true"/>
-            </httpj:tlsServerParameters>
-        </httpj:engine>
-    </httpj:engine-factory>
-</beans>


Mime
View raw message