cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1546407 [1/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/
Date Thu, 28 Nov 2013 17:47:02 GMT
Author: coheigea
Date: Thu Nov 28 17:47:01 2013
New Revision: 1546407

URL: http://svn.apache.org/r1546407
Log:
Partial switch to use parameterized tests in systests/ws-security

Added:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/TestParam.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java
      - copied, changed from r1546353, cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/DefaultCryptoCoverageCheckerTest.java
Removed:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/StaxBindingPropertiesTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/DefaultCryptoCoverageCheckerTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/StaxCryptoCoverageCheckerTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/StaxGCMTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/StaxHttpsTokenTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/kerberos/StaxKerberosTokenTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/StaxPartsTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/StaxSamlTokenTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/StaxWSSecurityClientTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/StaxSpnegoTokenTest.java
Modified:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/kerberos/KerberosTokenTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/PolicyAlternativeTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/spnego/SpnegoTokenTest.java

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java?rev=1546407&r1=1546406&r2=1546407&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java Thu Nov 28 17:47:01 2013
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.bindings;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
@@ -27,21 +29,29 @@ 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;
 
 /**
- * This is a test for various properties associated with a security binding. It tests both DOM + 
- * StAX clients against the DOM server
+ * This is a test for various properties associated with a security binding.
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class BindingPropertiesTest 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");
+    
+    final TestParam test;
+    
+    public BindingPropertiesTest(TestParam type) {
+        this.test = type;
+    }
 
     @BeforeClass
     public static void startServers() throws Exception {
@@ -51,6 +61,22 @@ public class BindingPropertiesTest 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)
+        );
+    }
+    
+    @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
@@ -76,37 +102,31 @@ public class BindingPropertiesTest exten
         // This should work, as OnlySignEntireHeadersAndBody is not specified
         QName portQName = new QName(NAMESPACE, "DoubleItNotOnlySignPort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
         port.doubleIt(25);
         
         // This should fail, as OnlySignEntireHeadersAndBody is specified
         portQName = new QName(NAMESPACE, "DoubleItOnlySignPort");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on OnlySignEntireHeadersAndBody property");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "OnlySignEntireHeadersAndBody does not match the requirements";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
-        // Streaming
         try {
-            SecurityTestUtil.enableStreaming(port);
             port.doubleIt(25);
             fail("Failure expected on OnlySignEntireHeadersAndBody property");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "OnlySignEntireHeadersAndBody does not match the requirements";
-            // assertTrue(ex.getMessage().contains(error));
+            if (!test.isStreaming()) {
+                String error = "OnlySignEntireHeadersAndBody";
+                assertTrue(ex.getMessage().contains(error));
+            }
         }
         
         ((java.io.Closeable)port).close();
@@ -129,37 +149,32 @@ public class BindingPropertiesTest exten
         // Successful invocation
         QName portQName = new QName(NAMESPACE, "DoubleItEncryptSignaturePort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
         port.doubleIt(25);
         
         // This should fail, as the client is not encrypting the signature is specified
         portQName = new QName(NAMESPACE, "DoubleItEncryptSignaturePort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not encrypting the signature property");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "The signature is not protected";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
-        // Streaming
         try {
-            SecurityTestUtil.enableStreaming(port);
             port.doubleIt(25);
             fail("Failure expected on not encrypting the signature property");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "The signature is not protected";
-            // assertTrue(ex.getMessage().contains(error));
+            if (!test.isStreaming()) {
+                String error = "The signature is not protected";
+                assertTrue(ex.getMessage().contains(error)
+                           || ex.getMessage().contains("Signature must be encrypted"));
+            }
         }
         
         ((java.io.Closeable)port).close();
@@ -182,37 +197,32 @@ public class BindingPropertiesTest exten
         // Successful invocation
         QName portQName = new QName(NAMESPACE, "DoubleItIncludeTimestampPort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
         port.doubleIt(25);
         
         // This should fail, as the client is not sending a Timestamp
         portQName = new QName(NAMESPACE, "DoubleItIncludeTimestampPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not sending a Timestamp");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "Received Timestamp does not match the requirements";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
-        // Streaming
         try {
-            SecurityTestUtil.enableStreaming(port);
             port.doubleIt(25);
             fail("Failure expected on not sending a Timestamp");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "Received Timestamp does not match the requirements";
-            // assertTrue(ex.getMessage().contains(error));
+            if (!test.isStreaming()) {
+                String error = "Received Timestamp does not match the requirements";
+                assertTrue(ex.getMessage().contains(error)
+                           || ex.getMessage().contains("Timestamp must be present"));
+            }
         }
         
         ((java.io.Closeable)port).close();
@@ -235,37 +245,32 @@ public class BindingPropertiesTest exten
         // Successful invocation
         QName portQName = new QName(NAMESPACE, "DoubleItEncryptBeforeSigningPort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
         port.doubleIt(25);
         
         // This should fail, as the client is not following the correct steps for this property
         portQName = new QName(NAMESPACE, "DoubleItEncryptBeforeSigningPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not encrypting before signing");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "Not encrypted before signed";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
-        // Streaming
         try {
-            SecurityTestUtil.enableStreaming(port);
             port.doubleIt(25);
             fail("Failure expected on not encrypting before signing");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "Not encrypted before signed";
-            // assertTrue(ex.getMessage().contains(error));
+            if (!test.isStreaming()) {
+                String error = "Not encrypted before signed";
+                assertTrue(ex.getMessage().contains(error)
+                           || ex.getMessage().contains("EncryptBeforeSigning"));
+            }
         }
         
         ((java.io.Closeable)port).close();
@@ -288,37 +293,33 @@ public class BindingPropertiesTest exten
         // Successful invocation
         QName portQName = new QName(NAMESPACE, "DoubleItSignBeforeEncryptingPort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
         port.doubleIt(25);
         
         // This should fail, as the client is not following the correct steps for this property
         portQName = new QName(NAMESPACE, "DoubleItSignBeforeEncryptingPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not signing before encrypting");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "Not signed before encrypted";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
-        // Streaming
+        // DOM
         try {
-            SecurityTestUtil.enableStreaming(port);
             port.doubleIt(25);
             fail("Failure expected on not signing before encrypting");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "Not signed before encrypted";
-            // assertTrue(ex.getMessage().contains(error));
+            if (!test.isStreaming()) {
+                String error = "Not signed before encrypted";
+                assertTrue(ex.getMessage().contains(error)
+                           || ex.getMessage().contains("SignBeforeEncrypting"));
+            }
         }
         
         ((java.io.Closeable)port).close();
@@ -341,35 +342,34 @@ public class BindingPropertiesTest exten
         // Successful invocation
         QName portQName = new QName(NAMESPACE, "DoubleItTimestampFirstPort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // TODO It's not sending the Timestamp "first" correctly - DOM
-        // port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
-        port.doubleIt(25);
+        // TODO It's not sending the Timestamp "first" correctly - DOM
+        // TODO Timestamp First/Last validation not working - see WSS-444
+        if (test.isStreaming() && !STAX_PORT.equals(test.getPort())) {
+            port.doubleIt(25);
+        }
         
         // This should fail, as the client is sending the timestamp last
         portQName = new QName(NAMESPACE, "DoubleItTimestampFirstPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        /*
-        // DOM
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on on sending the timestamp last");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "Layout does not match the requirements";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
-        */
-        // Streaming
+        
         try {
-            SecurityTestUtil.enableStreaming(port);
-            port.doubleIt(25);
-            fail("Failure expected on on sending the timestamp last");
+            // TODO DOM not working as above
+            // TODO Timestamp First/Last validation not working - see WSS-444
+            if (test.isStreaming() && !STAX_PORT.equals(test.getPort())) {
+                port.doubleIt(25);
+                fail("Failure expected on on sending the timestamp last");
+            }
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             // String error = "Layout does not match the requirements";
             // assertTrue(ex.getMessage().contains(error));
@@ -395,37 +395,37 @@ public class BindingPropertiesTest exten
         // Successful invocation
         QName portQName = new QName(NAMESPACE, "DoubleItTimestampLastPort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
-        port.doubleIt(25);
+        // TODO Timestamp First/Last validation not working - see WSS-444
+        if (!STAX_PORT.equals(test.getPort())) {
+            port.doubleIt(25);
+        }
         
         // This should fail, as the client is sending the timestamp first
         portQName = new QName(NAMESPACE, "DoubleItTimestampLastPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on sending the timestamp first");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "Layout does not match the requirements";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
-        // Streaming
         try {
-            SecurityTestUtil.enableStreaming(port);
-            port.doubleIt(25);
-            fail("Failure expected on sending the timestamp first");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "Layout does not match the requirements";
-            // assertTrue(ex.getMessage().contains(error));
+            // TODO Timestamp First/Last validation not working - see WSS-444
+            if (!STAX_PORT.equals(test.getPort())) {
+                port.doubleIt(25);
+                fail("Failure expected on sending the timestamp first");
+            }
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            if (!test.isStreaming()) {
+                String error = "Layout does not match the requirements";
+                assertTrue(ex.getMessage().contains(error));
+            }
         }
         
         ((java.io.Closeable)port).close();
@@ -448,46 +448,44 @@ public class BindingPropertiesTest exten
         // Successful invocation
         QName portQName = new QName(NAMESPACE, "DoubleItStrictPort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-
-        // DOM
-        port.doubleIt(25);
+        updateAddressPort(port, test.getPort());
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
+
+        // TODO Strict validation not working - see WSS-444
+        if (!STAX_PORT.equals(test.getPort())) {
+            port.doubleIt(25);
+        }
         
         // This should fail, as the client is sending the timestamp last
         portQName = new QName(NAMESPACE, "DoubleItStrictPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on sending the timestamp last");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "Layout does not match the requirements";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
-        // Streaming
         try {
-            SecurityTestUtil.enableStreaming(port);
-            port.doubleIt(25);
-            fail("Failure expected on sending the timestamp last");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "Layout does not match the requirements";
-            // assertTrue(ex.getMessage().contains(error));
+            // TODO Strict validation not working - see WSS-444
+            if (!STAX_PORT.equals(test.getPort())) {
+                port.doubleIt(25);
+                fail("Failure expected on sending the timestamp last");
+            }
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            if (!test.isStreaming()) {
+                String error = "Layout does not match the requirements";
+                assertTrue(ex.getMessage().contains(error));
+            }
         }
         
         ((java.io.Closeable)port).close();
         bus.shutdown(true);
     }
     
-    // TODO
     @org.junit.Test
-    @org.junit.Ignore
     public void testTokenProtection() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
@@ -503,21 +501,35 @@ public class BindingPropertiesTest exten
         // Successful invocation
         QName portQName = new QName(NAMESPACE, "DoubleItTokenProtectionPort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        port.doubleIt(25);
+        updateAddressPort(port, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
+        
+        // TODO DOM server not working
+        if (!PORT.equals(test.getPort())) {
+            port.doubleIt(25);
+        }
         
         // This should fail, as the property is not enabled
         portQName = new QName(NAMESPACE, "DoubleItTokenProtectionPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
         try {
-            port.doubleIt(25);
-            fail("Failure expected on not protecting the token");
+            // TODO DOM server not working
+            if (!PORT.equals(test.getPort())) {
+                port.doubleIt(25);
+                fail("Failure expected on not protecting the token");
+            }
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
             // String error = "Layout does not match the requirements";
             // assertTrue(ex.getMessage().contains(error));
-            System.out.println("EX: " + ex.getMessage());
         }
         
         ((java.io.Closeable)port).close();
@@ -541,37 +553,31 @@ public class BindingPropertiesTest exten
         // This should work, as SignatureConfirmation is enabled
         QName portQName = new QName(NAMESPACE, "DoubleItSignatureConfirmationPort");
         DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
         port.doubleIt(25);
         
         // This should fail, as SignatureConfirmation is not enabled
         portQName = new QName(NAMESPACE, "DoubleItSignatureConfirmationPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not enabling SignatureConfirmation");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "Check Signature confirmation";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
-        // Streaming
         try {
-            SecurityTestUtil.enableStreaming(port);
             port.doubleIt(25);
             fail("Failure expected on not enabling SignatureConfirmation");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // String error = "Check Signature confirmation";
-            // assertTrue(ex.getMessage().contains(error));
+            if (!test.isStreaming()) {
+                String error = "Check Signature confirmation";
+                assertTrue(ex.getMessage().contains(error));
+            }
         }
         
         ((java.io.Closeable)port).close();

Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/TestParam.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/TestParam.java?rev=1546407&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/TestParam.java (added)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/common/TestParam.java Thu Nov 28 17:47:01 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.ws.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;
+    }
+    
+}

Copied: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java (from r1546353, cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/DefaultCryptoCoverageCheckerTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java?p2=cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java&p1=cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/DefaultCryptoCoverageCheckerTest.java&r1=1546353&r2=1546407&rev=1546407&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/DefaultCryptoCoverageCheckerTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java Thu Nov 28 17:47:01 2013
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.coverage_checker;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -29,18 +31,22 @@ 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.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
 import org.apache.cxf.ws.security.wss4j.WSS4JStaxOutInterceptor;
 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 the DefaultCryptoCoverageChecker. It tests both DOM + StAX 
- * clients against the DOM server.
+ * A set of tests for the CryptoCoverageChecker functionality.
  */
-public class DefaultCryptoCoverageCheckerTest extends AbstractBusClientServerTestBase {
+@RunWith(value = org.junit.runners.Parameterized.class)
+public class CryptoCoverageCheckerTest extends AbstractBusClientServerTestBase {
     public static final String PORT = allocatePort(Server.class);
+    public 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");
@@ -49,7 +55,13 @@ public class DefaultCryptoCoverageChecke
     
     static {
         unrestrictedPoliciesInstalled = SecurityTestUtil.checkUnrestrictedPoliciesInstalled();
-    };    
+    };
+    
+    final TestParam test;
+    
+    public CryptoCoverageCheckerTest(TestParam type) {
+        this.test = type;
+    }
 
     @BeforeClass
     public static void startServers() throws Exception {
@@ -59,6 +71,22 @@ public class DefaultCryptoCoverageChecke
                 // 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
@@ -70,18 +98,18 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testSignedBodyTimestamp() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItBodyTimestampPort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "Timestamp Signature");
@@ -94,15 +122,18 @@ public class DefaultCryptoCoverageChecke
                      + "{}{http://docs.oasis-open.org/wss/2004/01/oasis-"
                      + "200401-wss-wssecurity-utility-1.0.xsd}Timestamp;");
         
-        // DOM
-        WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        port.doubleIt(25);
-        bus.getOutInterceptors().remove(outInterceptor);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
+        
+        if (test.isStreaming()) {
+            WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
         
-        // Streaming
-        WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
         port.doubleIt(25);
         
         ((java.io.Closeable)port).close();
@@ -112,18 +143,18 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testSignedBodyOnly() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItBodyTimestampPort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "Timestamp Signature");
@@ -134,21 +165,17 @@ public class DefaultCryptoCoverageChecke
         outProps.put("signatureParts",
                      "{}{http://schemas.xmlsoap.org/soap/envelope/}Body;");
         
-        // DOM
-        WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not signing the Timestamp");
-        } catch (Exception ex) {
-            // expected
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
-        bus.getOutInterceptors().remove(outInterceptor);
         
-        // Streaming
-        WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
+        if (test.isStreaming()) {
+            WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
         
         try {
             port.doubleIt(25);
@@ -164,18 +191,18 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testSignedTimestampOnly() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItBodyTimestampPort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "Timestamp Signature");
@@ -187,21 +214,17 @@ public class DefaultCryptoCoverageChecke
                      "{}{http://docs.oasis-open.org/wss/2004/01/oasis-"
                      + "200401-wss-wssecurity-utility-1.0.xsd}Timestamp;");
         
-        // DOM
-        WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not signing the Timestamp");
-        } catch (Exception ex) {
-            // expected
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
-        bus.getOutInterceptors().remove(outInterceptor);
         
-        // Streaming
-        WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
+        if (test.isStreaming()) {
+            WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
         
         try {
             port.doubleIt(25);
@@ -209,7 +232,7 @@ public class DefaultCryptoCoverageChecke
         } catch (Exception ex) {
             // expected
         }
-        
+
         ((java.io.Closeable)port).close();
         bus.shutdown(true);
     }
@@ -217,18 +240,18 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testSignedBodyTimestampSoap12() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItBodyTimestampSoap12Port");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "Timestamp Signature");
@@ -241,15 +264,18 @@ public class DefaultCryptoCoverageChecke
                      + "{}{http://docs.oasis-open.org/wss/2004/01/oasis-"
                      + "200401-wss-wssecurity-utility-1.0.xsd}Timestamp;");
         
-        // DOM
-        WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        port.doubleIt(25);
-        bus.getOutInterceptors().remove(outInterceptor);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
+        
+        if (test.isStreaming()) {
+            WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
         
-        // Streaming
-        WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
         port.doubleIt(25);
         
         ((java.io.Closeable)port).close();
@@ -259,18 +285,18 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testSignedBodyOnlySoap12() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItBodyTimestampSoap12Port");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "Timestamp Signature");
@@ -281,21 +307,17 @@ public class DefaultCryptoCoverageChecke
         outProps.put("signatureParts",
                      "{}{http://www.w3.org/2003/05/soap-envelope}Body;");
         
-        // DOM
-        WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not signing the Timestamp");
-        } catch (Exception ex) {
-            // expected
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
-        bus.getOutInterceptors().remove(outInterceptor);
         
-        // Streaming
-        WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
+        if (test.isStreaming()) {
+            WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
         
         try {
             port.doubleIt(25);
@@ -311,18 +333,18 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testSignedTimestampOnlySoap12() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItBodyTimestampSoap12Port");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "Timestamp Signature");
@@ -334,21 +356,17 @@ public class DefaultCryptoCoverageChecke
                      "{}{http://docs.oasis-open.org/wss/2004/01/oasis-"
                      + "200401-wss-wssecurity-utility-1.0.xsd}Timestamp;");
         
-        // DOM
-        WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not signing the Timestamp");
-        } catch (Exception ex) {
-            // expected
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
-        bus.getOutInterceptors().remove(outInterceptor);
         
-        // Streaming
-        WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
+        if (test.isStreaming()) {
+            WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
         
         try {
             port.doubleIt(25);
@@ -368,18 +386,18 @@ public class DefaultCryptoCoverageChecke
             return;
         }
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItSignedEncryptedBodyPort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "Timestamp Signature Encrypt");
@@ -394,15 +412,18 @@ public class DefaultCryptoCoverageChecke
         outProps.put("encryptionParts",
                      "{}{http://schemas.xmlsoap.org/soap/envelope/}Body;");
 
-        // DOM
-        WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        port.doubleIt(25);
-        bus.getOutInterceptors().remove(outInterceptor);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
+        if (test.isStreaming()) {
+            WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
+
         port.doubleIt(25);
         
         ((java.io.Closeable)port).close();
@@ -412,18 +433,18 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testSignedNotEncryptedBody() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItSignedEncryptedBodyPort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "Timestamp Signature Encrypt");
@@ -439,21 +460,17 @@ public class DefaultCryptoCoverageChecke
                      "{}{http://docs.oasis-open.org/wss/2004/01/oasis-"
                      + "200401-wss-wssecurity-utility-1.0.xsd}Timestamp;");
         
-        // DOM
-        WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not encrypting the SOAP Body");
-        } catch (Exception ex) {
-            // expected
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
-        bus.getOutInterceptors().remove(outInterceptor);
         
-        // Streaming
-        WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
+        if (test.isStreaming()) {
+            WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
         
         try {
             port.doubleIt(25);
@@ -469,18 +486,18 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testWSAddressing() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItWSAPort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
         Map<String, Object> outProps = new HashMap<String, Object>();
         outProps.put("action", "Timestamp Signature");
@@ -493,21 +510,19 @@ public class DefaultCryptoCoverageChecke
                      + "{}{http://docs.oasis-open.org/wss/2004/01/oasis-"
                      + "200401-wss-wssecurity-utility-1.0.xsd}Timestamp;");
 
-        // DOM
-        WSS4JOutInterceptor outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        
-        try {
-            port.doubleIt(25);
-            fail("Failure expected on not signing the WS-Addressing headers");
-        } catch (Exception ex) {
-            // expected
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
-        bus.getOutInterceptors().remove(outInterceptor);
         
-        // Streaming
-        WSS4JStaxOutInterceptor staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
+        WSS4JStaxOutInterceptor staxOutInterceptor = null;
+        WSS4JOutInterceptor outInterceptor = null;
+        if (test.isStreaming()) {
+            staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
         
         try {
             port.doubleIt(25);
@@ -515,7 +530,6 @@ public class DefaultCryptoCoverageChecke
         } catch (Exception ex) {
             // expected
         }
-        bus.getOutInterceptors().remove(staxOutInterceptor);
         
         // Now sign the WS-Addressing headers
         outProps.put("signatureParts",
@@ -524,16 +538,20 @@ public class DefaultCryptoCoverageChecke
                 + "200401-wss-wssecurity-utility-1.0.xsd}Timestamp;"
                 + "{}{http://www.w3.org/2005/08/addressing}ReplyTo;");
         
-        // DOM
-        outInterceptor = new WSS4JOutInterceptor(outProps);
-        bus.getOutInterceptors().add(outInterceptor);
-        
-        port.doubleIt(25);
-        bus.getOutInterceptors().remove(outInterceptor);
+        if (test.isStreaming()) {
+            bus.getOutInterceptors().remove(staxOutInterceptor);
+            SecurityTestUtil.enableStreaming(port);
+        } else {
+            bus.getOutInterceptors().remove(outInterceptor);
+        }
         
-        // Streaming
-        staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
-        bus.getOutInterceptors().add(staxOutInterceptor);
+        if (test.isStreaming()) {
+            staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
         
         port.doubleIt(25);
         
@@ -547,27 +565,30 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testClientChecker() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItClientCheckerPort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        port.doubleIt(25);
-        
-        // Now try with a message that will create a Fault in the SEI
-        try {
-            port.doubleIt(0);
-            fail("Failure expected on trying to double 0");
-        } catch (Exception ex) {
-            assertTrue(ex.getMessage().contains("0 can't be doubled"));
+        // This test only applies to the DOM implementation
+        if (PORT.equals(test.getPort()) && !test.isStreaming()) {
+            port.doubleIt(25);
+            
+            // Now try with a message that will create a Fault in the SEI
+            try {
+                port.doubleIt(0);
+                fail("Failure expected on trying to double 0");
+            } catch (Exception ex) {
+                assertTrue(ex.getMessage().contains("0 can't be doubled"));
+            }
         }
         
         ((java.io.Closeable)port).close();
@@ -579,27 +600,30 @@ public class DefaultCryptoCoverageChecke
     @org.junit.Test
     public void testClientChecker2() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = DefaultCryptoCoverageCheckerTest.class.getResource("client.xml");
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
         
-        URL wsdl = DefaultCryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItClientCheckerPort2");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        port.doubleIt(25);
-        
-        // Now try with a message that will create a Fault in the SEI
-        try {
-            port.doubleIt(0);
-            fail("Failure expected on trying to double 0");
-        } catch (Exception ex) {
-            assertTrue(ex.getMessage().contains("0 can't be doubled"));
+        // This test only applies to the DOM implementation
+        if (PORT.equals(test.getPort()) && !test.isStreaming()) {
+            port.doubleIt(25);
+            
+            // Now try with a message that will create a Fault in the SEI
+            try {
+                port.doubleIt(0);
+                fail("Failure expected on trying to double 0");
+            } catch (Exception ex) {
+                assertTrue(ex.getMessage().contains("0 can't be doubled"));
+            }
         }
         
         ((java.io.Closeable)port).close();

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java?rev=1546407&r1=1546406&r2=1546407&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/gcm/GCMTest.java Thu Nov 28 17:47:01 2013
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.gcm;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
@@ -27,16 +29,20 @@ import javax.xml.ws.Service;
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.systest.ws.common.SecurityTestUtil;
+import org.apache.cxf.systest.ws.common.TestParam;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
 
 /**
- * A set of tests for GCM algorithms using custom WS-SecurityPolicy expressions. It tests both 
- * DOM + StAX clients against the DOM server
+ * A set of tests for GCM algorithms using custom WS-SecurityPolicy expressions. 
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class GCMTest 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");
@@ -44,6 +50,12 @@ public class GCMTest extends AbstractBus
     private static boolean unrestrictedPoliciesInstalled = 
             SecurityTestUtil.checkUnrestrictedPoliciesInstalled();
     
+    final TestParam test;
+    
+    public GCMTest(TestParam type) {
+        this.test = type;
+    }
+    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -52,6 +64,22 @@ public class GCMTest extends AbstractBus
                 // 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
@@ -86,13 +114,12 @@ public class GCMTest extends AbstractBus
         QName portQName = new QName(NAMESPACE, "DoubleItGCM128Port");
         DoubleItPortType gcmPort = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(gcmPort, PORT);
+        updateAddressPort(gcmPort, test.getPort());
         
-        // DOM
-        gcmPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(gcmPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(gcmPort);
         gcmPort.doubleIt(25);
         
         ((java.io.Closeable)gcmPort).close();
@@ -129,13 +156,13 @@ public class GCMTest extends AbstractBus
         QName portQName = new QName(NAMESPACE, "DoubleItGCM192Port");
         DoubleItPortType gcmPort = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(gcmPort, PORT);
+        updateAddressPort(gcmPort, test.getPort());
         
-        // DOM
-        gcmPort.doubleIt(25);
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(gcmPort);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(gcmPort);
+        }
+
         gcmPort.doubleIt(25);
         
         ((java.io.Closeable)gcmPort).close();
@@ -172,13 +199,12 @@ public class GCMTest extends AbstractBus
         QName portQName = new QName(NAMESPACE, "DoubleItGCM256Port");
         DoubleItPortType gcmPort = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(gcmPort, PORT);
+        updateAddressPort(gcmPort, test.getPort());
         
-        // DOM
-        gcmPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(gcmPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(gcmPort);
         gcmPort.doubleIt(25);
         
         ((java.io.Closeable)gcmPort).close();

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java?rev=1546407&r1=1546406&r2=1546407&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java Thu Nov 28 17:47:01 2013
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.https;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
@@ -27,19 +29,29 @@ 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 the HttpsToken policy. It tests both DOM + StAX clients against the 
- * DOM server.
+ * A set of tests for the HttpsToken policy.
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class HttpsTokenTest 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");
+    
+    final TestParam test;
+    
+    public HttpsTokenTest(TestParam type) {
+        this.test = type;
+    }
 
     @BeforeClass
     public static void startServers() throws Exception {
@@ -49,6 +61,22 @@ public class HttpsTokenTest extends Abst
             // 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
@@ -72,36 +100,31 @@ public class HttpsTokenTest extends Abst
         QName portQName = new QName(NAMESPACE, "DoubleItRequireClientCertPort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
         port.doubleIt(25);
         
         // This should fail, as the client does not use a client cert
         portQName = new QName(NAMESPACE, "DoubleItRequireClientCertPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        try {
-            // DOM
-            port.doubleIt(25);
-            fail("Failure expected on not using a client cert");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "HttpsToken";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
         try {
-            // Streaming
-            SecurityTestUtil.enableStreaming(port);
             port.doubleIt(25);
             fail("Failure expected on not using a client cert");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // expected
+            if (!test.isStreaming() && !STAX_PORT.equals(test.getPort())) {
+                String error = "HttpsToken";
+                assertTrue(ex.getMessage().contains(error));
+            }
         }
         
         ((java.io.Closeable)port).close();
@@ -123,38 +146,35 @@ public class HttpsTokenTest extends Abst
         QName portQName = new QName(NAMESPACE, "DoubleItBasicAuthPort");
         DoubleItPortType port = 
                 service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        // DOM
-        port.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(port);
-        port.doubleIt(25);  
+        port.doubleIt(25);
         
         // This should fail, as the client does not send a UsernamePassword
         portQName = new QName(NAMESPACE, "DoubleItBasicAuthPort2");
         port = service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
+        updateAddressPort(port, test.getPort());
         
-        try {
-            // DOM
-            port.doubleIt(25);
-            fail("Failure expected on not sending a UsernamePassword");
-        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            String error = "HttpsToken";
-            assertTrue(ex.getMessage().contains(error));
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
         
         try {
-            // Streaming
-            SecurityTestUtil.enableStreaming(port);
             port.doubleIt(25);
             fail("Failure expected on not sending a UsernamePassword");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            // expected
+            if (!test.isStreaming() && !STAX_PORT.equals(test.getPort())) {
+                String error = "HttpsToken";
+                assertTrue(ex.getMessage().contains(error));
+            }
         }
         
+        ((java.io.Closeable)port).close();
+        bus.shutdown(true);
     }
     
 }

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/kerberos/KerberosTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/kerberos/KerberosTokenTest.java?rev=1546407&r1=1546406&r2=1546407&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/kerberos/KerberosTokenTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/kerberos/KerberosTokenTest.java Thu Nov 28 17:47:01 2013
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.kerberos;
 
 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 Kerberos Tokens. The tests are @Ignore'd, as they require a running KDC. To run the
@@ -43,13 +48,14 @@ import org.junit.BeforeClass;
  * 
  * See here for more information:
  * http://coheigea.blogspot.com/2011/10/using-kerberos-with-web-services-part.html
- * 
- * It tests both DOM + StAX clients against the DOM server
  */
 @org.junit.Ignore
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class KerberosTokenTest 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");
@@ -57,6 +63,12 @@ public class KerberosTokenTest extends A
     private static boolean unrestrictedPoliciesInstalled = 
             SecurityTestUtil.checkUnrestrictedPoliciesInstalled();
     
+    final TestParam test;
+    
+    public KerberosTokenTest(TestParam type) {
+        this.test = type;
+    }
+    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -65,6 +77,22 @@ public class KerberosTokenTest extends A
             // 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
@@ -88,14 +116,16 @@ public class KerberosTokenTest extends A
         QName portQName = new QName(NAMESPACE, "DoubleItKerberosTransportPort");
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(kerberosPort, portNumber);
         
-        updateAddressPort(kerberosPort, PORT2);
-        
-        // DOM
-        kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(kerberosPort);
         kerberosPort.doubleIt(25);
         
         ((java.io.Closeable)kerberosPort).close();
@@ -122,13 +152,12 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
 
-        updateAddressPort(kerberosPort, PORT);
+        updateAddressPort(kerberosPort, test.getPort());
         
-        // DOM
-        kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(kerberosPort);
         kerberosPort.doubleIt(25);
         
         ((java.io.Closeable)kerberosPort).close();
@@ -155,13 +184,12 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
 
-        updateAddressPort(kerberosPort, PORT);
+        updateAddressPort(kerberosPort, test.getPort());
         
-        // DOM
-        kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(kerberosPort);
         kerberosPort.doubleIt(25);
         
         ((java.io.Closeable)kerberosPort).close();
@@ -188,13 +216,12 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
 
-        updateAddressPort(kerberosPort, PORT);
+        updateAddressPort(kerberosPort, test.getPort());
         
-        // DOM
-        kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(kerberosPort);
         kerberosPort.doubleIt(25);
         
         ((java.io.Closeable)kerberosPort).close();
@@ -221,13 +248,12 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
 
-        updateAddressPort(kerberosPort, PORT);
+        updateAddressPort(kerberosPort, test.getPort());
         
-        // DOM
-        kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(kerberosPort);
         kerberosPort.doubleIt(25);
         
         ((java.io.Closeable)kerberosPort).close();
@@ -249,14 +275,16 @@ public class KerberosTokenTest extends A
         QName portQName = new QName(NAMESPACE, "DoubleItKerberosTransportEndorsingPort");
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
-
-        updateAddressPort(kerberosPort, PORT2);
+        String portNumber = PORT2;
+        if (STAX_PORT.equals(test.getPort())) {
+            portNumber = STAX_PORT2;
+        }
+        updateAddressPort(kerberosPort, portNumber);
         
-        // DOM
-        kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(kerberosPort);
         kerberosPort.doubleIt(25);
         
         ((java.io.Closeable)kerberosPort).close();
@@ -279,9 +307,17 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
 
-        updateAddressPort(kerberosPort, PORT);
-        int result = kerberosPort.doubleIt(25);
-        assertTrue(result == 50);
+        updateAddressPort(kerberosPort, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
+        
+        // TODO Streaming support
+        if (!test.isStreaming()) {
+            int result = kerberosPort.doubleIt(25);
+            assertTrue(result == 50);
+        }
         
         ((java.io.Closeable)kerberosPort).close();
         bus.shutdown(true);
@@ -303,13 +339,12 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
         
-        updateAddressPort(kerberosPort, PORT);
+        updateAddressPort(kerberosPort, test.getPort());
         
-        // DOM
-        kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(kerberosPort);
         kerberosPort.doubleIt(25);
         
         ((java.io.Closeable)kerberosPort).close();
@@ -332,14 +367,16 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
         
-        updateAddressPort(kerberosPort, PORT);
-        
-        // DOM
-        kerberosPort.doubleIt(25);
+        updateAddressPort(kerberosPort, test.getPort());
         
-        // TODO Streaming
-        // SecurityTestUtil.enableStreaming(kerberosPort);
-        // kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
+
+        // TODO Streaming support
+        if (!test.isStreaming()) {
+            kerberosPort.doubleIt(25);
+        }
         
         ((java.io.Closeable)kerberosPort).close();
         bus.shutdown(true);
@@ -365,10 +402,17 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
         
-        updateAddressPort(kerberosPort, PORT);
+        updateAddressPort(kerberosPort, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
-        int result = kerberosPort.doubleIt(25);
-        assertTrue(result == 50);
+        // TODO Streaming support
+        if (!test.isStreaming()) {
+            int result = kerberosPort.doubleIt(25);
+            assertTrue(result == 50);
+        }
         
         ((java.io.Closeable)kerberosPort).close();
         bus.shutdown(true);
@@ -394,13 +438,12 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
         
-        updateAddressPort(kerberosPort, PORT);
+        updateAddressPort(kerberosPort, test.getPort());
         
-        // DOM
-        kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
-        // Streaming
-        SecurityTestUtil.enableStreaming(kerberosPort);
         kerberosPort.doubleIt(25);
         
         ((java.io.Closeable)kerberosPort).close();
@@ -427,14 +470,16 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
         
-        updateAddressPort(kerberosPort, PORT);
+        updateAddressPort(kerberosPort, test.getPort());
         
-        // DOM
-        kerberosPort.doubleIt(25);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
         
         // TODO Streaming
-        // SecurityTestUtil.enableStreaming(kerberosPort);
-        // kerberosPort.doubleIt(25);
+        if (!test.isStreaming()) {
+            kerberosPort.doubleIt(25);
+        }
         
         ((java.io.Closeable)kerberosPort).close();
         bus.shutdown(true);
@@ -460,14 +505,16 @@ public class KerberosTokenTest extends A
         DoubleItPortType kerberosPort = 
                 service.getPort(portQName, DoubleItPortType.class);
         
-        updateAddressPort(kerberosPort, PORT);
-        
-        // DOM
-        kerberosPort.doubleIt(25);
+        updateAddressPort(kerberosPort, test.getPort());
         
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(kerberosPort);
+        }
+
         // TODO Streaming
-        // SecurityTestUtil.enableStreaming(kerberosPort);
-        // kerberosPort.doubleIt(25);
+        if (!test.isStreaming()) {
+            kerberosPort.doubleIt(25);
+        }
         
         ((java.io.Closeable)kerberosPort).close();
         bus.shutdown(true);



Mime
View raw message