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 2013/11/28 18:47:02 UTC

svn commit: r1546407 [3/3] - in /cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws: bindings/ common/ coverage_checker/ gcm/ https/ kerberos/ parts/ policy/ saml/ security/ spnego/

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java?rev=1546407&r1=1546406&r2=1546407&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java Thu Nov 28 17:47:01 2013
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.saml;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
@@ -30,6 +32,7 @@ import org.apache.cxf.bus.spring.SpringB
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.systest.ws.common.SecurityTestUtil;
+import org.apache.cxf.systest.ws.common.TestParam;
 import org.apache.cxf.systest.ws.saml.client.SamlCallbackHandler;
 import org.apache.cxf.systest.ws.saml.client.SamlElementCallbackHandler;
 import org.apache.cxf.systest.ws.saml.client.SamlRoleCallbackHandler;
@@ -38,20 +41,31 @@ import org.apache.cxf.testutil.common.Ab
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.wss4j.common.saml.bean.ConditionsBean;
 import org.apache.wss4j.common.saml.bean.KeyInfoBean.CERT_IDENTIFIER;
+import org.apache.wss4j.common.saml.builder.SAML1Constants;
 import org.apache.wss4j.common.saml.builder.SAML2Constants;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
 
 /**
- * A set of tests for SAML Tokens. It tests both DOM + StAX clients against the 
- * DOM server
+ * A set of tests for SAML Tokens. 
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class SamlTokenTest extends AbstractBusClientServerTestBase {
     static final String PORT = allocatePort(Server.class);
+    static final String STAX_PORT = allocatePort(StaxServer.class);
     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");
+    
+    final TestParam test;
+    
+    public SamlTokenTest(TestParam type) {
+        this.test = type;
+    }
 
     @BeforeClass
     public static void startServers() throws Exception {
@@ -61,6 +75,22 @@ public class SamlTokenTest extends Abstr
             // 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)
+        );
+    }
+    
+    @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
@@ -84,75 +114,21 @@ public class SamlTokenTest extends Abstr
         QName portQName = new QName(NAMESPACE, "DoubleItSaml1TransportPort");
         DoubleItPortType saml1Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
-        
-        try {
-            saml1Port.doubleIt(25);
-            fail("Expected failure on an invocation with no SAML Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
         }
+        updateAddressPort(saml1Port, portNumber);
         
-        ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
-        );
-        try {
-            saml1Port.doubleIt(25);
-            fail("Expected failure on an invocation with a SAML2 Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            assertTrue(ex.getMessage().contains("Wrong SAML Version"));
-        }
-
-        ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
-        );
-        int result = saml1Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        // Don't send any Token...failure expected
-        portQName = new QName(NAMESPACE, "DoubleItSaml1TransportPort2");
-        saml1Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
-        
-        ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
-        );
-        
-        try {
-            saml1Port.doubleIt(25);
-            fail("Failure expected on no token");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "The received token does not match the token inclusion requirement";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml1Port);
         }
         
-        ((java.io.Closeable)saml1Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml1OverTransportStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml1TransportPort");
-        DoubleItPortType saml1Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml1Port);
-        
         try {
             saml1Port.doubleIt(25);
             fail("Expected failure on an invocation with no SAML Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
+            assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
         }
         
         ((BindingProvider)saml1Port).getRequestContext().put(
@@ -162,7 +138,10 @@ public class SamlTokenTest extends Abstr
             saml1Port.doubleIt(25);
             fail("Expected failure on an invocation with a SAML2 Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // assertTrue(ex.getMessage().contains("Wrong SAML Version"));
+            if (!test.isStreaming()) {
+                assertTrue(ex.getMessage().contains("Wrong SAML Version")
+                           || ex.getMessage().contains("enforces SamlVersion11Profile11 but we got 2.0"));
+            }
         }
 
         ((BindingProvider)saml1Port).getRequestContext().put(
@@ -175,7 +154,6 @@ public class SamlTokenTest extends Abstr
         portQName = new QName(NAMESPACE, "DoubleItSaml1TransportPort2");
         saml1Port = service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(saml1Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml1Port);
         
         ((BindingProvider)saml1Port).getRequestContext().put(
             "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
@@ -185,8 +163,10 @@ public class SamlTokenTest extends Abstr
             saml1Port.doubleIt(25);
             fail("Failure expected on no token");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "The received token does not match the token inclusion requirement";
-            // assertTrue(ex.getMessage().contains(error));
+            if (!test.isStreaming()) {
+                String error = "The received token does not match the token inclusion requirement";
+                assertTrue(ex.getMessage().contains(error));
+            }
         }
         
         ((java.io.Closeable)saml1Port).close();
@@ -208,20 +188,25 @@ public class SamlTokenTest extends Abstr
         QName portQName = new QName(NAMESPACE, "DoubleItSaml1SupportingPort");
         DoubleItPortType saml1Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(saml1Port, portNumber);
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml1Port);
+        }
         
+        SamlCallbackHandler samlCallbackHandler = new SamlCallbackHandler(false);
+        samlCallbackHandler.setConfirmationMethod(SAML1Constants.CONF_BEARER);
         ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
+            "ws-security.saml-callback-handler", samlCallbackHandler
         );
         
-        // DOM
         int result = saml1Port.doubleIt(25);
         assertTrue(result == 50);
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(saml1Port);
-        saml1Port.doubleIt(25);
-        
         ((java.io.Closeable)saml1Port).close();
         bus.shutdown(true);
     }
@@ -242,10 +227,20 @@ public class SamlTokenTest extends Abstr
         QName portQName = new QName(NAMESPACE, "DoubleItSaml1SupportingPort");
         DoubleItPortType saml1Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(saml1Port, portNumber);
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml1Port);
+        }
         
+        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(false, true);
+        callbackHandler.setConfirmationMethod(SAML1Constants.CONF_BEARER);
         ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false, true)
+            "ws-security.saml-callback-handler", callbackHandler
         );
         
         ((BindingProvider)saml1Port).getRequestContext().put(
@@ -259,14 +254,9 @@ public class SamlTokenTest extends Abstr
             "org.apache.cxf.systest.ws.common.KeystorePasswordCallback"
         );
         
-        // DOM
         int result = saml1Port.doubleIt(25);
         assertTrue(result == 50);
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(saml1Port);
-        saml1Port.doubleIt(25);
-        
         ((java.io.Closeable)saml1Port).close();
         bus.shutdown(true);
     }
@@ -286,475 +276,37 @@ public class SamlTokenTest extends Abstr
         QName portQName = new QName(NAMESPACE, "DoubleItSaml1TransportPort");
         DoubleItPortType saml1Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
-        
-        try {
-            saml1Port.doubleIt(25);
-            fail("Expected failure on an invocation with no SAML Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
         }
+        updateAddressPort(saml1Port, portNumber);
         
-        ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlElementCallbackHandler(false)
-        );
-        int result = saml1Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        ((java.io.Closeable)saml1Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml1ElementOverTransportStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml1TransportPort");
-        DoubleItPortType saml1Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml1Port);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml1Port);
+        }
         
         try {
             saml1Port.doubleIt(25);
             fail("Expected failure on an invocation with no SAML Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
+            if (!test.isStreaming()) {
+                assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
+            }
         }
         
         ((BindingProvider)saml1Port).getRequestContext().put(
             "ws-security.saml-callback-handler", new SamlElementCallbackHandler(false)
         );
-        int result = saml1Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        ((java.io.Closeable)saml1Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml2OverSymmetric() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricPort");
-        DoubleItPortType saml2Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-       
-        try {
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with no SAML Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
-        }
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
-        );
-        try {
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with a SAML1 Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            assertTrue(ex.getMessage().contains("Wrong SAML Version"));
-        }
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
-        );
-        int result = saml2Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        try {
-            SamlCallbackHandler callbackHandler = 
-                new SamlCallbackHandler();
-            callbackHandler.setConfirmationMethod(SAML2Constants.CONF_BEARER);
-            ((BindingProvider)saml2Port).getRequestContext().put(
-                "ws-security.saml-callback-handler", callbackHandler
-            );
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with a invalid SAML2 Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // expected
-        }
-        
-        ((java.io.Closeable)saml2Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml2OverSymmetricStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricPort");
-        DoubleItPortType saml2Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-        SecurityTestUtil.enableStreaming(saml2Port);
-       
-        try {
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with no SAML Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
-        }
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
-        );
-        try {
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with a SAML1 Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // assertTrue(ex.getMessage().contains("Wrong SAML Version"));
-        }
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
-        );
-        int result = saml2Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        try {
-            SamlCallbackHandler callbackHandler = 
-                new SamlCallbackHandler();
-            callbackHandler.setConfirmationMethod(SAML2Constants.CONF_BEARER);
-            ((BindingProvider)saml2Port).getRequestContext().put(
-                "ws-security.saml-callback-handler", callbackHandler
-            );
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with a invalid SAML2 Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // expected
-        }
-        
-        ((java.io.Closeable)saml2Port).close();
-        bus.shutdown(true);
-    }
-    
-    // Some negative tests. Send a sender-vouches assertion as a SupportingToken...this will
-    // fail as the provider will demand that there is a signature covering both the assertion
-    // and the message body.
-    @org.junit.Test
-    public void testSaml2OverSymmetricSupporting() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricSupportingPort");
-        DoubleItPortType saml2Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
-        );
-        
-        try {
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with an unsigned SAML SV Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            assertTrue(ex.getMessage().contains("An error was discovered processing"));
-        }
-        
-        ((java.io.Closeable)saml2Port).close();
-        bus.shutdown(true);
-    }
-
-    @org.junit.Test
-    public void testSaml2OverAsymmetric() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricPort");
-        DoubleItPortType saml2Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-
-        try {
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with no SAML Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
-        }
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
-        );
-        try {
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with a SAML1 Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            assertTrue(ex.getMessage().contains("Wrong SAML Version"));
-        }
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
-        );
-        int result = saml2Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        // Don't send any Token...failure expected
-        portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricPort2");
-        saml2Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
-        );
-        
-        try {
-            saml2Port.doubleIt(25);
-            fail("Failure expected on no token");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "The received token does not match the token inclusion requirement";
-            assertTrue(ex.getMessage().contains(error));
-        }
-        
-        ((java.io.Closeable)saml2Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml2OverAsymmetricStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricPort");
-        DoubleItPortType saml2Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-        SecurityTestUtil.enableStreaming(saml2Port);
-
-        try {
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with no SAML Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
-        }
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
-        );
-        try {
-            saml2Port.doubleIt(25);
-            fail("Expected failure on an invocation with a SAML1 Assertion");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // assertTrue(ex.getMessage().contains("Wrong SAML Version"));
-        }
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
-        );
-        int result = saml2Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        // Don't send any Token...failure expected
-        portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricPort2");
-        saml2Port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-        SecurityTestUtil.enableStreaming(saml2Port);
-        
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
-        );
-        
-        try {
-            saml2Port.doubleIt(25);
-            fail("Failure expected on no token");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            //String error = "The received token does not match the token inclusion requirement";
-            //assertTrue(ex.getMessage().contains(error));
-        }
-        
-        ((java.io.Closeable)saml2Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml1SelfSignedOverTransport() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml1SelfSignedTransportPort");
-        DoubleItPortType saml1Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
-        
-        ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false, true)
-        );
-        int result = saml1Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        ((java.io.Closeable)saml1Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml1SelfSignedOverTransportStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml1SelfSignedTransportPort");
-        DoubleItPortType saml1Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml1Port);
-        
-        ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false, true)
-        );
-        int result = saml1Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        ((java.io.Closeable)saml1Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml1SelfSignedOverTransportSP11() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml1SelfSignedTransportSP11Port");
-        DoubleItPortType saml1Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
-        
-        ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false, true)
-        );
-        int result = saml1Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        ((java.io.Closeable)saml1Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml1SelfSignedOverTransportSP11Streaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml1SelfSignedTransportSP11Port");
-        DoubleItPortType saml1Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml1Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml1Port);
-        
-        ((BindingProvider)saml1Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler(false, true)
-        );
-        int result = saml1Port.doubleIt(25);
-        assertTrue(result == 50);
-        
-        ((java.io.Closeable)saml1Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testAsymmetricSamlInitiator() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSamlInitiatorPort");
-        DoubleItPortType saml2Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-        
-        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
-        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", callbackHandler
-        );
-        int result = saml2Port.doubleIt(25);
+        int result = saml1Port.doubleIt(25);
         assertTrue(result == 50);
         
-        ((java.io.Closeable)saml2Port).close();
+        ((java.io.Closeable)saml1Port).close();
         bus.shutdown(true);
     }
     
     @org.junit.Test
-    public void testAsymmetricSamlInitiatorStreaming() throws Exception {
+    public void testSaml2OverSymmetric() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -765,16 +317,39 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSamlInitiatorPort");
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-        SecurityTestUtil.enableStreaming(saml2Port);
+        updateAddressPort(saml2Port, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
+       
+        try {
+            saml2Port.doubleIt(25);
+            fail("Expected failure on an invocation with no SAML Assertion");
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            if (!test.isStreaming()) {
+                assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
+            }
+        }
         
-        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
-        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
         ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", callbackHandler
+            "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
+        );
+        try {
+            saml2Port.doubleIt(25);
+            fail("Expected failure on an invocation with a SAML1 Assertion");
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            if (!test.isStreaming()) {
+                assertTrue(ex.getMessage().contains("Wrong SAML Version")
+                           || ex.getMessage().contains("enforces SamlVersion20Profile11 but we got 1.1"));
+            }
+        }
+        
+        ((BindingProvider)saml2Port).getRequestContext().put(
+            "ws-security.saml-callback-handler", new SamlCallbackHandler()
         );
         int result = saml2Port.doubleIt(25);
         assertTrue(result == 50);
@@ -783,8 +358,11 @@ public class SamlTokenTest extends Abstr
         bus.shutdown(true);
     }
     
+    // Some negative tests. Send a sender-vouches assertion as a SupportingToken...this will
+    // fail as the provider will demand that there is a signature covering both the assertion
+    // and the message body.
     @org.junit.Test
-    public void testSaml2OverSymmetricSignedElements() throws Exception {
+    public void testSaml2OverSymmetricSupporting() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -795,23 +373,35 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricSignedElementsPort");
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricSupportingPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
+        updateAddressPort(saml2Port, test.getPort());
         
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
+
         ((BindingProvider)saml2Port).getRequestContext().put(
             "ws-security.saml-callback-handler", new SamlCallbackHandler()
         );
-        int result = saml2Port.doubleIt(25);
-        assertTrue(result == 50);
+        
+        try {
+            saml2Port.doubleIt(25);
+            fail("Expected failure on an invocation with an unsigned SAML SV Assertion");
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            if (!test.isStreaming()) {
+                assertTrue(ex.getMessage().contains("An error was discovered processing")
+                           || ex.getMessage().contains("SamlToken not satisfied"));
+            }
+        }
         
         ((java.io.Closeable)saml2Port).close();
         bus.shutdown(true);
     }
-    
+
     @org.junit.Test
-    public void testSaml2EndorsingOverTransport() throws Exception {
+    public void testSaml2OverAsymmetric() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -822,26 +412,68 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportPort");
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
+        updateAddressPort(saml2Port, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
+
+        try {
+            saml2Port.doubleIt(25);
+            fail("Expected failure on an invocation with no SAML Assertion");
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            if (!test.isStreaming()) {
+                assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
+            }
+        }
         
-        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
-        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
         ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", callbackHandler
+            "ws-security.saml-callback-handler", new SamlCallbackHandler(false)
+        );
+        try {
+            saml2Port.doubleIt(25);
+            fail("Expected failure on an invocation with a SAML1 Assertion");
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            if (!test.isStreaming()) {
+                assertTrue(ex.getMessage().contains("Wrong SAML Version")
+                           || ex.getMessage().contains("enforces SamlVersion20Profile11 but we got 1.1"));
+            }
+        }
+        
+        ((BindingProvider)saml2Port).getRequestContext().put(
+            "ws-security.saml-callback-handler", new SamlCallbackHandler()
         );
-
         int result = saml2Port.doubleIt(25);
         assertTrue(result == 50);
         
+        // Don't send any Token...failure expected
+        portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricPort2");
+        saml2Port = service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(saml2Port, PORT);
+        
+        ((BindingProvider)saml2Port).getRequestContext().put(
+            "ws-security.saml-callback-handler", new SamlCallbackHandler()
+        );
+        
+        try {
+            saml2Port.doubleIt(25);
+            fail("Failure expected on no token");
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            if (!test.isStreaming()) {
+                String error = "The received token does not match the token inclusion requirement";
+                assertTrue(ex.getMessage().contains(error));
+            }
+        }
+        
         ((java.io.Closeable)saml2Port).close();
         bus.shutdown(true);
     }
     
     @org.junit.Test
-    public void testSaml2EndorsingOverTransportStreaming() throws Exception {
+    public void testSaml1SelfSignedOverTransport() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -852,27 +484,31 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportPort");
-        DoubleItPortType saml2Port = 
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml1SelfSignedTransportPort");
+        DoubleItPortType saml1Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml2Port);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(saml1Port, portNumber);
         
-        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
-        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", callbackHandler
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml1Port);
+        }
+        
+        ((BindingProvider)saml1Port).getRequestContext().put(
+            "ws-security.saml-callback-handler", new SamlCallbackHandler(false, true)
         );
-
-        int result = saml2Port.doubleIt(25);
+        int result = saml1Port.doubleIt(25);
         assertTrue(result == 50);
         
-        ((java.io.Closeable)saml2Port).close();
+        ((java.io.Closeable)saml1Port).close();
         bus.shutdown(true);
     }
     
     @org.junit.Test
-    public void testSaml2EndorsingPKOverTransport() throws Exception {
+    public void testSaml1SelfSignedOverTransportSP11() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -883,27 +519,31 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportPort");
-        DoubleItPortType saml2Port = 
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml1SelfSignedTransportSP11Port");
+        DoubleItPortType saml1Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(saml1Port, portNumber);
         
-        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
-        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
-        callbackHandler.setKeyInfoIdentifier(CERT_IDENTIFIER.KEY_VALUE);
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", callbackHandler
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml1Port);
+        }
+        
+        ((BindingProvider)saml1Port).getRequestContext().put(
+            "ws-security.saml-callback-handler", new SamlCallbackHandler(false, true)
         );
-
-        int result = saml2Port.doubleIt(25);
+        int result = saml1Port.doubleIt(25);
         assertTrue(result == 50);
         
-        ((java.io.Closeable)saml2Port).close();
+        ((java.io.Closeable)saml1Port).close();
         bus.shutdown(true);
     }
     
     @org.junit.Test
-    public void testSaml2EndorsingPKOverTransportStreaming() throws Exception {
+    public void testAsymmetricSamlInitiator() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -914,19 +554,20 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportPort");
+        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSamlInitiatorPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml2Port);
+        updateAddressPort(saml2Port, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
         
         SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
         callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
-        callbackHandler.setKeyInfoIdentifier(CERT_IDENTIFIER.KEY_VALUE);
         ((BindingProvider)saml2Port).getRequestContext().put(
             "ws-security.saml-callback-handler", callbackHandler
         );
-
         int result = saml2Port.doubleIt(25);
         assertTrue(result == 50);
         
@@ -935,7 +576,7 @@ public class SamlTokenTest extends Abstr
     }
     
     @org.junit.Test
-    public void testSaml2EndorsingOverTransportSP11() throws Exception {
+    public void testSaml2OverSymmetricSignedElements() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -946,26 +587,30 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportSP11Port");
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2SymmetricSignedElementsPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
+        updateAddressPort(saml2Port, test.getPort());
         
-        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
-        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", callbackHandler
-        );
-
-        int result = saml2Port.doubleIt(25);
-        assertTrue(result == 50);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
+        
+        // This test only works for DOM
+        if (!test.isStreaming() && PORT.equals(test.getPort())) {
+            ((BindingProvider)saml2Port).getRequestContext().put(
+                "ws-security.saml-callback-handler", new SamlCallbackHandler()
+            );
+            int result = saml2Port.doubleIt(25);
+            assertTrue(result == 50);
+        }
         
         ((java.io.Closeable)saml2Port).close();
         bus.shutdown(true);
     }
     
     @org.junit.Test
-    public void testSaml2EndorsingOverTransportSP11Streaming() throws Exception {
+    public void testSaml2EndorsingOverTransport() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -976,11 +621,18 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportSP11Port");
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml2Port);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(saml2Port, portNumber);
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
         
         SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
         callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
@@ -996,7 +648,7 @@ public class SamlTokenTest extends Abstr
     }
     
     @org.junit.Test
-    public void testSaml2OverAsymmetricSignedEncrypted() throws Exception {
+    public void testSaml2EndorsingPKOverTransport() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -1007,14 +659,26 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricSignedEncryptedPort");
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(saml2Port, portNumber);
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
         
+        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
+        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
+        callbackHandler.setKeyInfoIdentifier(CERT_IDENTIFIER.KEY_VALUE);
         ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
+            "ws-security.saml-callback-handler", callbackHandler
         );
+
         int result = saml2Port.doubleIt(25);
         assertTrue(result == 50);
         
@@ -1023,7 +687,7 @@ public class SamlTokenTest extends Abstr
     }
     
     @org.junit.Test
-    public void testSaml2OverAsymmetricSignedEncryptedStreaming() throws Exception {
+    public void testSaml2EndorsingOverTransportSP11() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -1034,15 +698,25 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricSignedEncryptedPort");
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingTransportSP11Port");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-        SecurityTestUtil.enableStreaming(saml2Port);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(saml2Port, portNumber);
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
         
+        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
+        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
         ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", new SamlCallbackHandler()
+            "ws-security.saml-callback-handler", callbackHandler
         );
+
         int result = saml2Port.doubleIt(25);
         assertTrue(result == 50);
         
@@ -1051,7 +725,7 @@ public class SamlTokenTest extends Abstr
     }
     
     @org.junit.Test
-    public void testSaml2OverAsymmetricEncrypted() throws Exception {
+    public void testSaml2OverAsymmetricSignedEncrypted() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -1062,15 +736,17 @@ public class SamlTokenTest extends Abstr
 
         URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricEncryptedPort");
+        QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricSignedEncryptedPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
+        updateAddressPort(saml2Port, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
         
-        SamlCallbackHandler callbackHandler = new SamlCallbackHandler();
-        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_BEARER);
         ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", callbackHandler
+            "ws-security.saml-callback-handler", new SamlCallbackHandler()
         );
         int result = saml2Port.doubleIt(25);
         assertTrue(result == 50);
@@ -1080,7 +756,7 @@ public class SamlTokenTest extends Abstr
     }
     
     @org.junit.Test
-    public void testSaml2OverAsymmetricEncryptedStreaming() throws Exception {
+    public void testSaml2OverAsymmetricEncrypted() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = SamlTokenTest.class.getResource("client.xml");
@@ -1094,8 +770,11 @@ public class SamlTokenTest extends Abstr
         QName portQName = new QName(NAMESPACE, "DoubleItSaml2AsymmetricEncryptedPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
-        SecurityTestUtil.enableStreaming(saml2Port);
+        updateAddressPort(saml2Port, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
         
         SamlCallbackHandler callbackHandler = new SamlCallbackHandler();
         callbackHandler.setConfirmationMethod(SAML2Constants.CONF_BEARER);
@@ -1124,38 +803,15 @@ public class SamlTokenTest extends Abstr
         QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingEncryptedTransportPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
-        
-        SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
-        callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
-        ((BindingProvider)saml2Port).getRequestContext().put(
-            "ws-security.saml-callback-handler", callbackHandler
-        );
-
-        int result = saml2Port.doubleIt(25);
-        assertTrue(result == 50);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(saml2Port, portNumber);
         
-        ((java.io.Closeable)saml2Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testSaml2EndorsingEncryptedOverTransportStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItSaml2EndorsingEncryptedTransportPort");
-        DoubleItPortType saml2Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml2Port);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
         
         SamlCallbackHandler callbackHandler = new SamlCallbackHandler(true, true);
         callbackHandler.setConfirmationMethod(SAML2Constants.CONF_HOLDER_KEY);
@@ -1185,44 +841,25 @@ public class SamlTokenTest extends Abstr
         QName portQName = new QName(NAMESPACE, "DoubleItInlinePolicyPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
-        
-        try {
-            saml2Port.doubleIt(25);
-            fail("Failure expected on no SamlToken");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "The received token does not match the token inclusion requirement";
-            assertTrue(ex.getMessage().contains(error));
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
         }
+        updateAddressPort(saml2Port, portNumber);
         
-        ((java.io.Closeable)saml2Port).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testNoSamlTokenStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = SamlTokenTest.class.getResource("client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = SamlTokenTest.class.getResource("DoubleItSaml.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItInlinePolicyPort");
-        DoubleItPortType saml2Port = 
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
-        SecurityTestUtil.enableStreaming(saml2Port);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(saml2Port);
+        }
         
         try {
             saml2Port.doubleIt(25);
             fail("Failure expected on no SamlToken");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "The received token does not match the token inclusion requirement";
-            // assertTrue(ex.getMessage().contains(error));
+            if (!test.isStreaming()) {
+                String error = "The received token does not match the token inclusion requirement";
+                assertTrue(ex.getMessage().contains(error)
+                           || ex.getMessage().contains("SamlToken not satisfied"));
+            }
         }
         
         ((java.io.Closeable)saml2Port).close();
@@ -1246,7 +883,7 @@ public class SamlTokenTest extends Abstr
         QName portQName = new QName(NAMESPACE, "DoubleItSaml2PEPPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT);
+        updateAddressPort(saml2Port, test.getPort());
        
         try {
             saml2Port.doubleIt(25);
@@ -1293,7 +930,11 @@ public class SamlTokenTest extends Abstr
         QName portQName = new QName(NAMESPACE, "DoubleItSaml2TransportPort");
         DoubleItPortType saml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(saml2Port, PORT2);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(saml2Port, portNumber);
 
         // Create a SAML Token with no "OneTimeUse" Condition
         ((BindingProvider)saml2Port).getRequestContext().put(

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java?rev=1546407&r1=1546406&r2=1546407&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java Thu Nov 28 17:47:01 2013
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.security;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -49,6 +51,7 @@ import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.jaxws.DispatchImpl;
 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.apache.cxf.transport.http.HTTPConduit;
 import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
@@ -56,12 +59,16 @@ import org.apache.cxf.ws.security.wss4j.
 import org.apache.hello_world_soap_http.Greeter;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
 
 /**
  *
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class WSSecurityClientTest extends AbstractBusClientServerTestBase {
     public static final String PORT = allocatePort(Server.class);
+    public static final String STAX_PORT = allocatePort(StaxServer.class);
     public static final String DEC_PORT = allocatePort(WSSecurityClientTest.class);
 
     private static final java.net.URL WSDL_LOC;
@@ -76,7 +83,7 @@ public class WSSecurityClientTest extend
         }
         WSDL_LOC = tmp;
     }
-
+    
     private static final QName GREETER_SERVICE_QNAME =
         new QName(
             "http://apache.org/hello_world_soap_http",
@@ -95,6 +102,12 @@ public class WSSecurityClientTest extend
             "UsernameTokenPort"
         );
 
+    final TestParam test;
+    
+    public WSSecurityClientTest(TestParam type) {
+        this.test = type;
+    }
+    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -103,9 +116,23 @@ public class WSSecurityClientTest 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)
+        );
         createStaticBus();
     }
     
+    @Parameters(name = "{0}")
+    public static Collection<TestParam[]> data() {
+       
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false)},
+                                                {new TestParam(STAX_PORT, true)},
+        });
+    }
+    
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         SecurityTestUtil.cleanup();
@@ -117,7 +144,7 @@ public class WSSecurityClientTest extend
         final javax.xml.ws.Service svc 
             = javax.xml.ws.Service.create(WSDL_LOC, GREETER_SERVICE_QNAME);
         final Greeter greeter = svc.getPort(USERNAME_TOKEN_PORT_QNAME, Greeter.class);
-        updateAddressPort(greeter, PORT);
+        updateAddressPort(greeter, test.getPort());
         
         Client client = ClientProxy.getClient(greeter);
         Map<String, Object> props = new HashMap<String, Object>();
@@ -165,7 +192,7 @@ public class WSSecurityClientTest extend
         final javax.xml.ws.Service svc 
             = javax.xml.ws.Service.create(WSDL_LOC, GREETER_SERVICE_QNAME);
         final Greeter greeter = svc.getPort(USERNAME_TOKEN_PORT_QNAME, Greeter.class);
-        updateAddressPort(greeter, PORT);
+        updateAddressPort(greeter, test.getPort());
         
         Client client = ClientProxy.getClient(greeter);
         Map<String, Object> props = new HashMap<String, Object>();
@@ -231,7 +258,7 @@ public class WSSecurityClientTest extend
             TIMESTAMP_SIGN_ENCRYPT_PORT_QNAME,
             Greeter.class
         );
-        updateAddressPort(greeter, PORT);
+        updateAddressPort(greeter, test.getPort());
 
         // Add a No-Op JAX-WS SoapHandler to the dispatch chain to
         // verify that the SoapHandlerInterceptor can peacefully co-exist
@@ -263,7 +290,7 @@ public class WSSecurityClientTest extend
         //
         // Old Created Date should result in a Fault
         //
-        dispatcher = createUsernameTokenDispatcher();
+        dispatcher = createUsernameTokenDispatcher(test.getPort());
         is = getClass().getResourceAsStream(
             "test-data/UsernameTokenRequest.xml"
         );
@@ -273,7 +300,7 @@ public class WSSecurityClientTest extend
         //
         // Sending no security headers should result in a Fault
         //
-        dispatcher = createUsernameTokenDispatcher();
+        dispatcher = createUsernameTokenDispatcher(test.getPort());
         is = getClass().getResourceAsStream(
             "test-data/NoHeadersRequest.xml"
         );
@@ -282,7 +309,7 @@ public class WSSecurityClientTest extend
         //
         // Sending and empty header should result in a Fault
         //
-        dispatcher = createUsernameTokenDispatcher();
+        dispatcher = createUsernameTokenDispatcher(test.getPort());
         is = getClass().getResourceAsStream(
             "test-data/EmptyHeaderRequest.xml"
         );
@@ -291,7 +318,7 @@ public class WSSecurityClientTest extend
         //
         // Sending and empty security header should result in a Fault
         //
-        dispatcher = createUsernameTokenDispatcher();
+        dispatcher = createUsernameTokenDispatcher(test.getPort());
         is = getClass().getResourceAsStream(
             "test-data/EmptySecurityHeaderRequest.xml"
         );
@@ -307,7 +334,7 @@ public class WSSecurityClientTest extend
         //
         // Sending no security headers should result in a Fault
         //
-        dispatcher = createUsernameTokenDispatcher(true);
+        dispatcher = createUsernameTokenDispatcher(true, test.getPort());
         is = getClass().getResourceAsStream("test-data/NoHeadersRequest.xml");
         try {
             dispatcher.invoke(new StreamSource(is));
@@ -319,7 +346,7 @@ public class WSSecurityClientTest extend
         //
         // Sending and empty header should result in a Fault
         //
-        dispatcher = createUsernameTokenDispatcher(true);
+        dispatcher = createUsernameTokenDispatcher(true, test.getPort());
         is = getClass().getResourceAsStream("test-data/EmptyHeaderRequest.xml");
         try {
             dispatcher.invoke(new StreamSource(is));
@@ -330,7 +357,7 @@ public class WSSecurityClientTest extend
         //
         // Sending and empty security header should result in a Fault
         //
-        dispatcher = createUsernameTokenDispatcher(true);
+        dispatcher = createUsernameTokenDispatcher(true, test.getPort());
         is = getClass().getResourceAsStream("test-data/EmptySecurityHeaderRequest.xml");
         try {
             dispatcher.invoke(new StreamSource(is));
@@ -340,17 +367,17 @@ public class WSSecurityClientTest extend
         }
 
     }
-    private static Dispatch<Source> createUsernameTokenDispatcher() {
-        return createUsernameTokenDispatcher(false);
+    private static Dispatch<Source> createUsernameTokenDispatcher(String port) {
+        return createUsernameTokenDispatcher(false, port);
     }
-    private static Dispatch<Source> createUsernameTokenDispatcher(boolean decoupled) {
+    private static Dispatch<Source> createUsernameTokenDispatcher(boolean decoupled, String port) {
         final Service service = Service.create(
             GREETER_SERVICE_QNAME
         );
         service.addPort(
             USERNAME_TOKEN_PORT_QNAME,
             decoupled ? SOAPBinding.SOAP11HTTP_BINDING : HTTPBinding.HTTP_BINDING, 
-            "http://localhost:" + PORT + "/GreeterService/UsernameTokenPort"
+            "http://localhost:" + port + "/GreeterService/UsernameTokenPort"
         );
         final Dispatch<Source> dispatcher = service.createDispatch(
             USERNAME_TOKEN_PORT_QNAME,

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java?rev=1546407&r1=1546406&r2=1546407&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java Thu Nov 28 17:47:01 2013
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.spnego;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
@@ -27,9 +29,12 @@ 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 set of tests for Spnego Tokens. The tests are @Ignore'd, as they require a running KDC. To run the
@@ -40,12 +45,12 @@ import org.junit.BeforeClass;
  *  
  * mvn test -Pnochecks -Dtest=SpnegoTokenTest 
  *     -Djava.security.auth.login.config=src/test/resources/kerberos.jaas
- * 
- * It tests both DOM + StAX clients against the DOM server
  */
 @org.junit.Ignore
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class SpnegoTokenTest extends AbstractBusClientServerTestBase {
     static final String PORT = allocatePort(Server.class);
+    static final String STAX_PORT = allocatePort(StaxServer.class);
 
     private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
@@ -53,6 +58,12 @@ public class SpnegoTokenTest extends Abs
     private static boolean unrestrictedPoliciesInstalled = 
             SecurityTestUtil.checkUnrestrictedPoliciesInstalled();
     
+    final TestParam test;
+    
+    public SpnegoTokenTest(TestParam type) {
+        this.test = type;
+    }
+    
     @BeforeClass
     public static void startServers() throws Exception {
         if (unrestrictedPoliciesInstalled) {
@@ -62,9 +73,25 @@ public class SpnegoTokenTest extends Abs
                 // 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)
+            );
         }
     }
     
+    @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 {
         if (unrestrictedPoliciesInstalled) {
@@ -92,13 +119,12 @@ public class SpnegoTokenTest extends Abs
         QName portQName = new QName(NAMESPACE, "DoubleItSpnegoSymmetricPort");
         DoubleItPortType spnegoPort = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(spnegoPort, PORT);
+        updateAddressPort(spnegoPort, test.getPort());
         
-        // DOM
-        spnegoPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(spnegoPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(spnegoPort);
         spnegoPort.doubleIt(25);
         
         ((java.io.Closeable)spnegoPort).close();
@@ -124,13 +150,12 @@ public class SpnegoTokenTest extends Abs
         QName portQName = new QName(NAMESPACE, "DoubleItSpnegoSymmetricDerivedPort");
         DoubleItPortType spnegoPort = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(spnegoPort, PORT);
+        updateAddressPort(spnegoPort, test.getPort());
         
-        // DOM
-        spnegoPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(spnegoPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(spnegoPort);
         spnegoPort.doubleIt(25);
         
         ((java.io.Closeable)spnegoPort).close();
@@ -156,13 +181,12 @@ public class SpnegoTokenTest extends Abs
         QName portQName = new QName(NAMESPACE, "DoubleItSpnegoSymmetricEncryptBeforeSigningPort");
         DoubleItPortType spnegoPort = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(spnegoPort, PORT);
+        updateAddressPort(spnegoPort, test.getPort());
         
-        // DOM
-        spnegoPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(spnegoPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(spnegoPort);
         spnegoPort.doubleIt(25);
         
         ((java.io.Closeable)spnegoPort).close();