cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1546346 - in /cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts: asymmetric/ bearer/ common/ sendervouches/ symmetric/ transport/ x509_symmetric/
Date Thu, 28 Nov 2013 11:03:50 GMT
Author: coheigea
Date: Thu Nov 28 11:03:49 2013
New Revision: 1546346

URL: http://svn.apache.org/r1546346
Log:
Using parameterized tests for STS basic systests

Added:
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java
Removed:
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/StaxAsymmetricBindingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/StaxBearerTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/StaxSenderVouchesTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/StaxSymmetricBindingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/StaxTransportBindingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/x509_symmetric/StaxX509SymmetricBindingTest.java
Modified:
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/SenderVouchesTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/x509_symmetric/X509SymmetricBindingTest.java

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java?rev=1546346&r1=1546345&r2=1546346&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java Thu Nov 28 11:03:49 2013
@@ -20,15 +20,17 @@ package org.apache.cxf.systest.sts.asymm
 
 import java.net.URL;
 import java.security.cert.X509Certificate;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 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.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -37,17 +39,17 @@ import org.apache.cxf.ws.security.trust.
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.CryptoFactory;
 import org.apache.wss4j.common.crypto.CryptoType;
-
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
 
 /**
  * Test the Asymmetric binding. The CXF client gets a token from the STS by authenticating via a
  * Username Token over the symmetric binding, and then sends it to the CXF endpoint using 
  * the asymmetric binding.
- * 
- * It tests both DOM + StAX clients against the DOM server
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class AsymmetricBindingTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
@@ -57,8 +59,15 @@ public class AsymmetricBindingTest exten
     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);
     
     private static boolean standalone;
+    
+    final TestParam test;
+    
+    public AsymmetricBindingTest(TestParam type) {
+        this.test = type;
+    }
 
     @BeforeClass
     public static void startServers() throws Exception {
@@ -68,6 +77,12 @@ public class AsymmetricBindingTest exten
                 // set this to false to fork
                 launchServer(Server.class, true)
         );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxServer.class, true)
+        );
         String deployment = System.getProperty("sts.deployment");
         if ("standalone".equals(deployment) || deployment == null) {
             standalone = true;
@@ -80,6 +95,16 @@ public class AsymmetricBindingTest exten
         }
     }
     
+    @Parameters(name = "{0}")
+    public static Collection<TestParam[]> data() {
+       
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
+                                                {new TestParam(PORT, true)},
+                                                {new TestParam(STAX_PORT, false)},
+                                                {new TestParam(STAX_PORT, true)},
+        });
+    }
+    
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
@@ -101,21 +126,15 @@ public class AsymmetricBindingTest exten
         QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML1Port");
         DoubleItPortType asymmetricSaml1Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(asymmetricSaml1Port, PORT);
+        updateAddressPort(asymmetricSaml1Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml1Port, STSPORT2);
         }
         
-        // DOM
-        doubleIt(asymmetricSaml1Port, 25);
-        
-        // Streaming
-        asymmetricSaml1Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(asymmetricSaml1Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml1Port, STSPORT2);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(asymmetricSaml1Port);
         }
-        SecurityTestUtil.enableStreaming(asymmetricSaml1Port);
+        
         doubleIt(asymmetricSaml1Port, 25);
         
         ((java.io.Closeable)asymmetricSaml1Port).close();
@@ -137,24 +156,18 @@ public class AsymmetricBindingTest exten
         QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2Port");
         DoubleItPortType asymmetricSaml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(asymmetricSaml2Port, PORT);
+        updateAddressPort(asymmetricSaml2Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml2Port, STSPORT2);
         }
         
-        // DOM
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(asymmetricSaml2Port);
+        }
+        
         doubleIt(asymmetricSaml2Port, 30);
         TokenTestUtils.verifyToken(asymmetricSaml2Port);
         
-        // Streaming
-        asymmetricSaml2Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(asymmetricSaml2Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml2Port, STSPORT2);
-        }
-        SecurityTestUtil.enableStreaming(asymmetricSaml2Port);
-        doubleIt(asymmetricSaml2Port, 25);
-        
         ((java.io.Closeable)asymmetricSaml2Port).close();
         bus.shutdown(true);
     }
@@ -174,11 +187,15 @@ public class AsymmetricBindingTest exten
         QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML1EncryptedPort");
         DoubleItPortType asymmetricSaml1EncryptedPort = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(asymmetricSaml1EncryptedPort, PORT);
+        updateAddressPort(asymmetricSaml1EncryptedPort, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml1EncryptedPort, STSPORT2);
         }
         
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(asymmetricSaml1EncryptedPort);
+        }
+        
         // Set the X509Certificate manually on the STSClient (just to test that we can)
         BindingProvider bindingProvider = (BindingProvider)asymmetricSaml1EncryptedPort;
         STSClient stsClient = 
@@ -189,22 +206,12 @@ public class AsymmetricBindingTest exten
         X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
         stsClient.setUseKeyCertificate(certs[0]);
         
-        doubleIt(asymmetricSaml1EncryptedPort, 40);
-        
         // TODO Streaming - The encrypted issued token is placed under the Signature
         // and hence an error is thrown on the receiving side
-        asymmetricSaml1EncryptedPort = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(asymmetricSaml1EncryptedPort, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml1EncryptedPort, STSPORT2);
+        if (!test.isStreaming()) {
+            doubleIt(asymmetricSaml1EncryptedPort, 40);
         }
-        bindingProvider = (BindingProvider)asymmetricSaml1EncryptedPort;
-        stsClient = 
-            (STSClient)bindingProvider.getRequestContext().get(SecurityConstants.STS_CLIENT);
-        stsClient.setUseKeyCertificate(certs[0]);
         
-        SecurityTestUtil.enableStreaming(asymmetricSaml1EncryptedPort);
-        // doubleIt(asymmetricSaml1EncryptedPort, 25);
         
         ((java.io.Closeable)asymmetricSaml1EncryptedPort).close();
         bus.shutdown(true);

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java?rev=1546346&r1=1546345&r2=1546346&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java Thu Nov 28 11:03:49 2013
@@ -19,6 +19,8 @@
 package org.apache.cxf.systest.sts.bearer;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
@@ -27,13 +29,13 @@ import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Service;
 
 import org.w3c.dom.Element;
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.systest.sts.common.SecurityTestUtil;
+import org.apache.cxf.systest.sts.common.TestParam;
 import org.apache.cxf.systest.sts.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -47,12 +49,13 @@ import org.apache.wss4j.common.saml.Saml
 import org.apache.wss4j.dom.WSConstants;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
 
 /**
  * Test the Bearer TokenType over TLS.
- * 
- * It tests both DOM + StAX clients against the DOM server
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class BearerTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
@@ -62,8 +65,15 @@ public class BearerTest extends Abstract
     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);
     
     private static boolean standalone;
+    
+    final TestParam test;
+    
+    public BearerTest(TestParam type) {
+        this.test = type;
+    }
 
     @BeforeClass
     public static void startServers() throws Exception {
@@ -73,6 +83,12 @@ public class BearerTest extends Abstract
                    // set this to false to fork
                    launchServer(Server.class, true)
         );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxServer.class, true)
+        );
         String deployment = System.getProperty("sts.deployment");
         if ("standalone".equals(deployment) || deployment == null) {
             standalone = true;
@@ -85,6 +101,16 @@ public class BearerTest extends Abstract
         }
     }
     
+    @Parameters(name = "{0}")
+    public static Collection<TestParam[]> data() {
+       
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
+                                                {new TestParam(PORT, true)},
+                                                {new TestParam(STAX_PORT, false)},
+                                                {new TestParam(STAX_PORT, true)},
+        });
+    }
+    
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
@@ -106,22 +132,15 @@ public class BearerTest extends Abstract
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2BearerPort");
         DoubleItPortType transportSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml2Port, PORT);
+        updateAddressPort(transportSaml2Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
         }
         
-        // DOM
-        doubleIt(transportSaml2Port, 45);
-        
-        // Streaming
-        transportSaml2Port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml2Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(transportSaml2Port);
         }
-        SecurityTestUtil.enableStreaming(transportSaml2Port);
+        
         doubleIt(transportSaml2Port, 45);
         
         ((java.io.Closeable)transportSaml2Port).close();
@@ -143,61 +162,14 @@ public class BearerTest extends Abstract
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2BearerPort");
         DoubleItPortType transportSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml2Port, PORT);
+        updateAddressPort(transportSaml2Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
         }
         
-        //
-        // Create a SAML2 Bearer Assertion and add it to the TokenStore so that the
-        // IssuedTokenInterceptorProvider does not invoke on the STS
-        //
-        Client client = ClientProxy.getClient(transportSaml2Port);
-        Endpoint ep = client.getEndpoint();
-        String id = "1234";
-        ep.getEndpointInfo().setProperty(TokenStore.class.getName(), new MemoryTokenStore());
-        ep.getEndpointInfo().setProperty(SecurityConstants.TOKEN_ID, id);
-        TokenStore store = (TokenStore)ep.getEndpointInfo().getProperty(TokenStore.class.getName());
-
-        SAMLCallback samlCallback = new SAMLCallback();
-        SAMLUtil.doSAMLCallback(new Saml2CallbackHandler(), samlCallback);
-        SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback);
-        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        dbf.setNamespaceAware(true);
-        DocumentBuilder db = dbf.newDocumentBuilder();
-        Element assertionElement = assertion.toDOM(db.newDocument());
-        
-        SecurityToken tok = new SecurityToken(id);
-        tok.setTokenType(WSConstants.WSS_SAML2_TOKEN_TYPE);
-        tok.setToken(assertionElement);
-        store.add(tok);
-        
-        doubleIt(transportSaml2Port, 50);
-        
-        ((java.io.Closeable)transportSaml2Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSAML2UnsignedBearerStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = BearerTest.class.getResource("cxf-unsigned-client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = BearerTest.class.getResource("DoubleIt.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2BearerPort");
-        DoubleItPortType transportSaml2Port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml2Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(transportSaml2Port);
         }
-        SecurityTestUtil.enableStreaming(transportSaml2Port);
         
         //
         // Create a SAML2 Bearer Assertion and add it to the TokenStore so that the
@@ -244,22 +216,15 @@ public class BearerTest extends Abstract
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2BearerPort2");
         DoubleItPortType transportSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml2Port, PORT);
+        updateAddressPort(transportSaml2Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
         }
         
-        // DOM
-        doubleIt(transportSaml2Port, 45);
-        
-        // Streaming
-        transportSaml2Port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml2Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(transportSaml2Port);
         }
-        SecurityTestUtil.enableStreaming(transportSaml2Port);
+        
         doubleIt(transportSaml2Port, 45);
         
         ((java.io.Closeable)transportSaml2Port).close();

Added: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java?rev=1546346&view=auto
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java (added)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java Thu Nov 28 11:03:49 2013
@@ -0,0 +1,45 @@
+/**
+ * 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.common;
+
+/**
+ * This holds some parameters to pass to the tests to avoid duplicating code.
+ */
+public final class TestParam {
+    final String port;
+    final boolean streaming;
+    
+    public TestParam(String p, boolean b) {
+        port = p;
+        streaming = b;
+    }
+    
+    public String toString() {
+        return port + ":" + (streaming ? "streaming" : "dom");
+    }
+
+    public String getPort() {
+        return port;
+    }
+
+    public boolean isStreaming() {
+        return streaming;
+    }
+    
+}

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/SenderVouchesTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/SenderVouchesTest.java?rev=1546346&r1=1546345&r2=1546346&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/SenderVouchesTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/sendervouches/SenderVouchesTest.java Thu Nov 28 11:03:49 2013
@@ -19,6 +19,8 @@
 package org.apache.cxf.systest.sts.sendervouches;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
@@ -26,25 +28,35 @@ 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.testutil.common.AbstractBusClientServerTestBase;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
 
 /**
  * In this test case, a CXF client sends a Username Token via (1-way) TLS to a CXF intermediary.
  * The intermediary validates the UsernameToken, and then inserts the username into a SAML
  * Assertion which it signs and sends to a provider (via TLS).
- * 
- * It tests both DOM + StAX clients against the DOM server
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class SenderVouchesTest extends AbstractBusClientServerTestBase {
     
     static final String PORT2 = allocatePort(Server.class, 2);
+    static final String STAX_PORT2 = allocatePort(StaxServer.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(Intermediary.class);
+    private static final String STAX_PORT = allocatePort(StaxIntermediary.class);
+    
+    final TestParam test;
+    
+    public SenderVouchesTest(TestParam type) {
+        this.test = type;
+    }
 
     @BeforeClass
     public static void startServers() throws Exception {
@@ -60,6 +72,28 @@ public class SenderVouchesTest extends A
             // set this to false to fork
             launchServer(Intermediary.class, true)
         );
+        assertTrue(
+                   "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(StaxIntermediary.class, true)
+        );
+    }
+    
+    @Parameters(name = "{0}")
+    public static Collection<TestParam[]> data() {
+       
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
+                                                {new TestParam(PORT, true)},
+                                                {new TestParam(STAX_PORT, false)},
+                                                {new TestParam(STAX_PORT, true)},
+        });
     }
     
     @org.junit.AfterClass
@@ -83,17 +117,13 @@ public class SenderVouchesTest extends A
         QName portQName = new QName(NAMESPACE, "DoubleItTransportUTPort");
         DoubleItPortType transportUTPort = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportUTPort, PORT);
+        updateAddressPort(transportUTPort, test.getPort());
         
-        // DOM
-        doubleIt(transportUTPort, 25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(transportUTPort);
+        }
         
-        // Streaming
-        transportUTPort = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportUTPort, PORT);
-        SecurityTestUtil.enableStreaming(transportUTPort);
-        doubleIt(transportUTPort, 45);
+        doubleIt(transportUTPort, 25);
         
         ((java.io.Closeable)transportUTPort).close();
         bus.shutdown(true);

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java?rev=1546346&r1=1546345&r2=1546346&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java Thu Nov 28 11:03:49 2013
@@ -19,6 +19,8 @@
 package org.apache.cxf.systest.sts.symmetric;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
@@ -27,19 +29,21 @@ 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.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
 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;
 
 /**
  * Test the Symmetric binding. The CXF client gets a token from the STS by authenticating via a
  * Username Token over the symmetric binding, and then sends it to the CXF endpoint using 
  * the symmetric binding.
- * 
- * It tests both DOM + StAX clients against the DOM server
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class SymmetricBindingTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
@@ -49,9 +53,16 @@ public class SymmetricBindingTest extend
     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);
     
     private static boolean standalone;
     
+    final TestParam test;
+    
+    public SymmetricBindingTest(TestParam type) {
+        this.test = type;
+    }
+    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -60,6 +71,12 @@ public class SymmetricBindingTest extend
             // set this to false to fork
             launchServer(Server.class, true)
         );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxServer.class, true)
+        );
         String deployment = System.getProperty("sts.deployment");
         if ("standalone".equals(deployment) || deployment == null) {
             standalone = true;
@@ -72,6 +89,16 @@ public class SymmetricBindingTest extend
         }
     }
     
+    @Parameters(name = "{0}")
+    public static Collection<TestParam[]> data() {
+       
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
+                                                {new TestParam(PORT, true)},
+                                                {new TestParam(STAX_PORT, false)},
+                                                {new TestParam(STAX_PORT, true)},
+        });
+    }
+    
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
@@ -92,23 +119,17 @@ public class SymmetricBindingTest extend
         QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML1Port");
         DoubleItPortType symmetricSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml1Port, PORT);
+        updateAddressPort(symmetricSaml1Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, STSPORT2);
         }
-
-        // DOM
-        doubleIt(symmetricSaml1Port, 25);
-        TokenTestUtils.verifyToken(symmetricSaml1Port);
         
-        // Streaming
-        symmetricSaml1Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml1Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, STSPORT);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(symmetricSaml1Port);
         }
-        SecurityTestUtil.enableStreaming(symmetricSaml1Port);
+
         doubleIt(symmetricSaml1Port, 25);
+        TokenTestUtils.verifyToken(symmetricSaml1Port);
         
         ((java.io.Closeable)symmetricSaml1Port).close();
         bus.shutdown(true);
@@ -129,24 +150,18 @@ public class SymmetricBindingTest extend
         QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML2Port");
         DoubleItPortType symmetricSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml2Port, PORT);
+        updateAddressPort(symmetricSaml2Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT2);
         }
         
-        // DOM
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(symmetricSaml2Port);
+        }
+        
         doubleIt(symmetricSaml2Port, 30);
         TokenTestUtils.verifyToken(symmetricSaml2Port);
         
-        // Streaming
-        symmetricSaml2Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml2Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT);
-        }
-        SecurityTestUtil.enableStreaming(symmetricSaml2Port);
-        doubleIt(symmetricSaml2Port, 25);
-        
         ((java.io.Closeable)symmetricSaml2Port).close();
         bus.shutdown(true);
     }
@@ -165,24 +180,21 @@ public class SymmetricBindingTest extend
         QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML1EncryptedPort");
         DoubleItPortType symmetricSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml1Port, PORT);
+        updateAddressPort(symmetricSaml1Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, STSPORT2);
         }
-
-        // DOM
-        doubleIt(symmetricSaml1Port, 25);
         
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(symmetricSaml1Port);
+        }
+
         // TODO Streaming - The encrypted issued token is placed under the ReferenceList
         // and hence an error is thrown on the receiving side
-        symmetricSaml1Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml1Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, STSPORT2);
+        if (!test.isStreaming()) {
+            doubleIt(symmetricSaml1Port, 25);
         }
-        SecurityTestUtil.enableStreaming(symmetricSaml1Port);
-        // doubleIt(symmetricSaml1Port, 25);
-
+        
         ((java.io.Closeable)symmetricSaml1Port).close();
         bus.shutdown(true);
     }
@@ -202,23 +214,16 @@ public class SymmetricBindingTest extend
         QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML2SecureConversationPort");
         DoubleItPortType symmetricSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml2Port, PORT);
+        updateAddressPort(symmetricSaml2Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT2);
         }
         
-        // DOM
-        doubleIt(symmetricSaml2Port, 30);
-        
-        // Streaming
-        symmetricSaml2Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml2Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT2);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(symmetricSaml2Port);
         }
-        SecurityTestUtil.enableStreaming(symmetricSaml2Port);
         
-        doubleIt(symmetricSaml2Port, 25);
+        doubleIt(symmetricSaml2Port, 30);
         
         ((java.io.Closeable)symmetricSaml2Port).close();
         bus.shutdown(true);

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java?rev=1546346&r1=1546345&r2=1546346&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java Thu Nov 28 11:03:49 2013
@@ -19,6 +19,8 @@
 package org.apache.cxf.systest.sts.transport;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
@@ -27,19 +29,20 @@ 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.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
 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;
 
 /**
  * Test the TransportBinding. The CXF client gets a token from the STS over TLS, and then
  * sends it to the CXF endpoint over TLS.
- * 
- * It tests both DOM + StAX clients against the DOM server
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class TransportBindingTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
@@ -49,9 +52,16 @@ public class TransportBindingTest extend
     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);
     
     private static boolean standalone;
     
+    final TestParam test;
+    
+    public TransportBindingTest(TestParam type) {
+        this.test = type;
+    }
+    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -60,6 +70,12 @@ public class TransportBindingTest extend
                    // set this to false to fork
                    launchServer(Server.class, true)
         );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxServer.class, true)
+        );
         String deployment = System.getProperty("sts.deployment");
         if ("standalone".equals(deployment) || deployment == null) {
             standalone = true;
@@ -72,6 +88,16 @@ public class TransportBindingTest extend
         }
     }
     
+    @Parameters(name = "{0}")
+    public static Collection<TestParam[]> data() {
+       
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
+                                                {new TestParam(PORT, true)},
+                                                {new TestParam(STAX_PORT, false)},
+                                                {new TestParam(STAX_PORT, true)},
+        });
+    }
+    
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
@@ -93,27 +119,21 @@ public class TransportBindingTest extend
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1Port");
         DoubleItPortType transportSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml1Port, PORT);
+        updateAddressPort(transportSaml1Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
         }
 
-        // DOM
-        doubleIt(transportSaml1Port, 25);
-        
-        // Streaming
-        transportSaml1Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml1Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(transportSaml1Port);
         }
-        SecurityTestUtil.enableStreaming(transportSaml1Port);
+        
         doubleIt(transportSaml1Port, 25);
         
         ((java.io.Closeable)transportSaml1Port).close();
         bus.shutdown(true);
     }
-
+    
     @org.junit.Test
     public void testSAML2() throws Exception {
 
@@ -129,22 +149,15 @@ public class TransportBindingTest extend
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML2Port");
         DoubleItPortType transportSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml2Port, PORT);
+        updateAddressPort(transportSaml2Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
         }
-        
-        // DOM
-        doubleIt(transportSaml2Port, 30);
-        
-        // Streaming
-        transportSaml2Port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml2Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
+
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(transportSaml2Port);
         }
-        SecurityTestUtil.enableStreaming(transportSaml2Port);
+        
         doubleIt(transportSaml2Port, 25);
         
         ((java.io.Closeable)transportSaml2Port).close();
@@ -172,27 +185,15 @@ public class TransportBindingTest extend
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1Port");
         DoubleItPortType transportSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml1Port, PORT);
+        updateAddressPort(transportSaml1Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
         }
         
-        // DOM
-        try {
-            doubleIt(transportSaml1Port, 35);
-            fail("Expected failure on an unknown client");
-        } catch (javax.xml.ws.soap.SOAPFaultException fault) {
-            // expected
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(transportSaml1Port);
         }
         
-        // Streaming
-        transportSaml1Port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml1Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
-        }
-        SecurityTestUtil.enableStreaming(transportSaml1Port);
         try {
             doubleIt(transportSaml1Port, 35);
             fail("Expected failure on an unknown client");
@@ -219,22 +220,15 @@ public class TransportBindingTest extend
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1EndorsingPort");
         DoubleItPortType transportSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml1Port, PORT);
+        updateAddressPort(transportSaml1Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
         }
-        
-        // DOM
-        doubleIt(transportSaml1Port, 40);
-        
-        // Streaming
-        transportSaml1Port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml1Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
+
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(transportSaml1Port);
         }
-        SecurityTestUtil.enableStreaming(transportSaml1Port);
+        
         doubleIt(transportSaml1Port, 25);
         
         ((java.io.Closeable)transportSaml1Port).close();
@@ -261,11 +255,15 @@ public class TransportBindingTest extend
         QName portQName = new QName(NAMESPACE, "DoubleItTransportSAML1EndorsingPort");
         DoubleItPortType transportSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(transportSaml1Port, PORT);
+        updateAddressPort(transportSaml1Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
         }
         
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(transportSaml1Port);
+        }
+        
         try {
             doubleIt(transportSaml1Port, 35);
             //fail("Expected failure on an unknown address");

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/x509_symmetric/X509SymmetricBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/x509_symmetric/X509SymmetricBindingTest.java?rev=1546346&r1=1546345&r2=1546346&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/x509_symmetric/X509SymmetricBindingTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/x509_symmetric/X509SymmetricBindingTest.java Thu Nov 28 11:03:49 2013
@@ -19,29 +19,31 @@
 package org.apache.cxf.systest.sts.x509_symmetric;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 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.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
 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;
 
 /**
  * Test the Symmetric binding. The CXF client gets a token from the STS by authenticating via an
  * X.509 Cert over the asymmetric binding, and then sends it to the CXF endpoint using 
  * the symmetric binding.
- * 
- * It tests both DOM + StAX clients against the DOM server
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class X509SymmetricBindingTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
@@ -51,9 +53,16 @@ public class X509SymmetricBindingTest ex
     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);
     
     private static boolean standalone;
     
+    final TestParam test;
+    
+    public X509SymmetricBindingTest(TestParam type) {
+        this.test = type;
+    }
+    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -62,6 +71,12 @@ public class X509SymmetricBindingTest ex
                    // set this to false to fork
                    launchServer(Server.class, true)
         );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxServer.class, true)
+        );
         String deployment = System.getProperty("sts.deployment");
         if ("standalone".equals(deployment) || deployment == null) {
             standalone = true;
@@ -74,6 +89,16 @@ public class X509SymmetricBindingTest ex
         }
     }
     
+    @Parameters(name = "{0}")
+    public static Collection<TestParam[]> data() {
+       
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
+                                                {new TestParam(PORT, true)},
+                                                {new TestParam(STAX_PORT, false)},
+                                                {new TestParam(STAX_PORT, true)},
+        });
+    }
+    
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
@@ -95,23 +120,16 @@ public class X509SymmetricBindingTest ex
         QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML1Port");
         DoubleItPortType symmetricSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml1Port, PORT);
+        updateAddressPort(symmetricSaml1Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, STSPORT2);
         }
-
-        // DOM
-        doubleIt(symmetricSaml1Port, 25);
         
-        // Streaming
-        symmetricSaml1Port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml1Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, STSPORT);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(symmetricSaml1Port);
         }
-        SecurityTestUtil.enableStreaming(symmetricSaml1Port);
-        doubleIt(symmetricSaml1Port, 45);
+
+        doubleIt(symmetricSaml1Port, 25);
         
         ((java.io.Closeable)symmetricSaml1Port).close();
         bus.shutdown(true);
@@ -132,25 +150,18 @@ public class X509SymmetricBindingTest ex
         QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML2Port");
         DoubleItPortType symmetricSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml2Port, PORT);
+        updateAddressPort(symmetricSaml2Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT2);
         }
         
-        // DOM
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(symmetricSaml2Port);
+        }
+        
         doubleIt(symmetricSaml2Port, 30);
         TokenTestUtils.verifyToken(symmetricSaml2Port);
         
-        // Streaming
-        symmetricSaml2Port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml2Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT);
-        }
-        SecurityTestUtil.enableStreaming(symmetricSaml2Port);
-        doubleIt(symmetricSaml2Port, 45);
-        
         ((java.io.Closeable)symmetricSaml2Port).close();
         bus.shutdown(true);
     }
@@ -170,24 +181,20 @@ public class X509SymmetricBindingTest ex
         QName portQName = new QName(NAMESPACE, "DoubleItSymmetricSAML2EndorsingPort");
         DoubleItPortType symmetricSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml2Port, PORT);
+        updateAddressPort(symmetricSaml2Port, test.getPort());
         if (standalone) {
             TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT2);
         }
         
-        // DOM
-        doubleIt(symmetricSaml2Port, 30);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(symmetricSaml2Port);
+        }
         
-        // Streaming
-        symmetricSaml2Port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(symmetricSaml2Port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT);
+        // TODO See WSS-481 - "Problem with EncryptSignature + EndorsingSupportingTokens"
+        if (!STAX_PORT.equals(test.getPort())) {
+            doubleIt(symmetricSaml2Port, 30);
         }
-        SecurityTestUtil.enableStreaming(symmetricSaml2Port);
-        doubleIt(symmetricSaml2Port, 45);
-
+        
         ((java.io.Closeable)symmetricSaml2Port).close();
         bus.shutdown(true);
     }



Mime
View raw message