cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1546973 [1/2] - in /cxf/trunk/services/sts/systests/basic: ./ src/test/java/org/apache/cxf/systest/sts/asymmetric/ src/test/java/org/apache/cxf/systest/sts/bearer/ src/test/java/org/apache/cxf/systest/sts/common/ src/test/java/org/apache/c...
Date Mon, 02 Dec 2013 12:12:22 GMT
Author: coheigea
Date: Mon Dec  2 12:12:22 2013
New Revision: 1546973

URL: http://svn.apache.org/r1546973
Log:
Adding streaming STS system tests to the STS basic system test suite

Added:
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/deployment/StaxSTSServer.java
      - copied, changed from r1546615, cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java
      - copied, changed from r1546615, cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfCachingTest.java
      - copied, changed from r1546615, cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
    cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/stax-cxf-encrypted-ut.xml
    cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/stax-cxf-servlet.xml
    cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/stax-cxf-transport.xml
    cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/stax-cxf-ut.xml
    cxf/trunk/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/deployment/stax-cxf-x509.xml
Modified:
    cxf/trunk/services/sts/systests/basic/pom.xml
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issuer/IssuerTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issueunit/IssueUnitTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
    cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/x509_symmetric/X509SymmetricBindingTest.java

Modified: cxf/trunk/services/sts/systests/basic/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/pom.xml?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/pom.xml (original)
+++ cxf/trunk/services/sts/systests/basic/pom.xml Mon Dec  2 12:12:22 2013
@@ -169,22 +169,5 @@
                 </plugins>
             </build>
         </profile>
-        <profile>
-            <id>war</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-surefire-plugin</artifactId>
-                        <configuration>
-                            <systemPropertyVariables>
-                                <sts.deployment>war</sts.deployment>
-                                <java.io.tmpdir>${basedir}/target/tmp</java.io.tmpdir>
-                            </systemPropertyVariables>
-                        </configuration>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
     </profiles>
 </project>

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/asymmetric/AsymmetricBindingTest.java Mon Dec  2 12:12:22 2013
@@ -33,6 +33,7 @@ import org.apache.cxf.systest.sts.common
 import org.apache.cxf.systest.sts.common.TestParam;
 import org.apache.cxf.systest.sts.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
+import org.apache.cxf.systest.sts.deployment.StaxSTSServer;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.trust.STSClient;
@@ -53,7 +54,9 @@ import org.junit.runners.Parameterized.P
 public class AsymmetricBindingTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
+    static final String STAX_STSPORT = allocatePort(StaxSTSServer.class);
     static final String STSPORT2 = allocatePort(STSServer.class, 2);
+    static final String STAX_STSPORT2 = allocatePort(StaxSTSServer.class, 2);
 
     private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
@@ -61,8 +64,6 @@ public class AsymmetricBindingTest exten
     private static final String PORT = allocatePort(Server.class);
     private static final String STAX_PORT = allocatePort(StaxServer.class);
     
-    private static boolean standalone;
-    
     final TestParam test;
     
     public AsymmetricBindingTest(TestParam type) {
@@ -83,25 +84,32 @@ public class AsymmetricBindingTest exten
                    // set this to false to fork
                    launchServer(StaxServer.class, true)
         );
-        String deployment = System.getProperty("sts.deployment");
-        if ("standalone".equals(deployment) || deployment == null) {
-            standalone = true;
-            assertTrue(
-                    "Server failed to launch",
-                    // run the server in the same process
-                    // set this to false to fork
-                    launchServer(STSServer.class, true)
-            );
-        }
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxSTSServer.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)},
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false, STSPORT2)},
+                                                {new TestParam(PORT, true, STSPORT2)},
+                                                {new TestParam(STAX_PORT, false, STSPORT2)},
+                                                {new TestParam(STAX_PORT, true, STSPORT2)},
+                                                
+                                                {new TestParam(PORT, false, STAX_STSPORT2)},
+                                                {new TestParam(PORT, true, STAX_STSPORT2)},
+                                                {new TestParam(STAX_PORT, false, STAX_STSPORT2)},
+                                                {new TestParam(STAX_PORT, true, STAX_STSPORT2)},
         });
     }
     
@@ -127,9 +135,8 @@ public class AsymmetricBindingTest exten
         DoubleItPortType asymmetricSaml1Port = 
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(asymmetricSaml1Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml1Port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml1Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(asymmetricSaml1Port);
@@ -157,9 +164,8 @@ public class AsymmetricBindingTest exten
         DoubleItPortType asymmetricSaml2Port = 
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(asymmetricSaml2Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml2Port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml2Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(asymmetricSaml2Port);
@@ -188,9 +194,8 @@ public class AsymmetricBindingTest exten
         DoubleItPortType asymmetricSaml1EncryptedPort = 
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(asymmetricSaml1EncryptedPort, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml1EncryptedPort, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)asymmetricSaml1EncryptedPort, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(asymmetricSaml1EncryptedPort);
@@ -212,7 +217,6 @@ public class AsymmetricBindingTest exten
             doubleIt(asymmetricSaml1EncryptedPort, 40);
         }
         
-        
         ((java.io.Closeable)asymmetricSaml1EncryptedPort).close();
         bus.shutdown(true);
     }

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/bearer/BearerTest.java Mon Dec  2 12:12:22 2013
@@ -38,6 +38,7 @@ import org.apache.cxf.systest.sts.common
 import org.apache.cxf.systest.sts.common.TestParam;
 import org.apache.cxf.systest.sts.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
+import org.apache.cxf.systest.sts.deployment.StaxSTSServer;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.ws.security.SecurityConstants;
 import org.apache.cxf.ws.security.tokenstore.MemoryTokenStore;
@@ -59,7 +60,9 @@ import org.junit.runners.Parameterized.P
 public class BearerTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
+    static final String STAX_STSPORT = allocatePort(StaxSTSServer.class);
     static final String STSPORT2 = allocatePort(STSServer.class, 2);
+    static final String STAX_STSPORT2 = allocatePort(StaxSTSServer.class, 2);
     
     private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
@@ -67,8 +70,6 @@ public class BearerTest extends Abstract
     private static final String PORT = allocatePort(Server.class);
     private static final String STAX_PORT = allocatePort(StaxServer.class);
     
-    private static boolean standalone;
-    
     final TestParam test;
     
     public BearerTest(TestParam type) {
@@ -89,25 +90,32 @@ public class BearerTest extends Abstract
                    // set this to false to fork
                    launchServer(StaxServer.class, true)
         );
-        String deployment = System.getProperty("sts.deployment");
-        if ("standalone".equals(deployment) || deployment == null) {
-            standalone = true;
-            assertTrue(
-                    "Server failed to launch",
-                    // run the server in the same process
-                    // set this to false to fork
-                    launchServer(STSServer.class, true)
-            );
-        }
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxSTSServer.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)},
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false, STSPORT)},
+                                                {new TestParam(PORT, true, STSPORT)},
+                                                {new TestParam(STAX_PORT, false, STSPORT)},
+                                                {new TestParam(STAX_PORT, true, STSPORT)},
+                                                
+                                                {new TestParam(PORT, false, STAX_STSPORT)},
+                                                {new TestParam(PORT, true, STAX_STSPORT)},
+                                                {new TestParam(STAX_PORT, false, STAX_STSPORT)},
+                                                {new TestParam(STAX_PORT, true, STAX_STSPORT)},
         });
     }
     
@@ -133,9 +141,8 @@ public class BearerTest extends Abstract
         DoubleItPortType transportSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportSaml2Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(transportSaml2Port);
@@ -163,9 +170,8 @@ public class BearerTest extends Abstract
         DoubleItPortType transportSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportSaml2Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(transportSaml2Port);
@@ -217,9 +223,8 @@ public class BearerTest extends Abstract
         DoubleItPortType transportSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportSaml2Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(transportSaml2Port);

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java Mon Dec  2 12:12:22 2013
@@ -24,14 +24,20 @@ package org.apache.cxf.systest.sts.commo
 public final class TestParam {
     final String port;
     final boolean streaming;
+    final String stsPort;
     
     public TestParam(String p, boolean b) {
+        this(p, b, null);
+    }
+    
+    public TestParam(String p, boolean b, String stsPort) {
         port = p;
         streaming = b;
+        this.stsPort = stsPort;
     }
     
     public String toString() {
-        return port + ":" + (streaming ? "streaming" : "dom");
+        return port + ":" + (streaming ? "streaming" : "dom") + ":" + stsPort;
     }
 
     public String getPort() {
@@ -41,5 +47,9 @@ public final class TestParam {
     public boolean isStreaming() {
         return streaming;
     }
+
+    public String getStsPort() {
+        return stsPort;
+    }
     
 }

Copied: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/deployment/StaxSTSServer.java (from r1546615, cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/deployment/StaxSTSServer.java?p2=cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/deployment/StaxSTSServer.java&p1=cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java&r1=1546615&r2=1546973&rev=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/common/TestParam.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/deployment/StaxSTSServer.java Mon Dec  2 12:12:22 2013
@@ -16,30 +16,31 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.systest.sts.common;
+package org.apache.cxf.systest.sts.deployment;
 
-/**
- * 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");
-    }
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class StaxSTSServer extends AbstractBusTestServerBase {
+
+    public StaxSTSServer() {
 
-    public String getPort() {
-        return port;
     }
 
-    public boolean isStreaming() {
-        return streaming;
+    protected void run()  {
+        URL busFile = StaxSTSServer.class.getResource("stax-cxf-servlet.xml");
+        Bus busLocal = new SpringBusFactory().createBus(busFile);
+        BusFactory.setDefaultBus(busLocal);
+        setBus(busLocal);
+
+        try {
+            new StaxSTSServer();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
-    
 }

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java Mon Dec  2 12:12:22 2013
@@ -53,8 +53,6 @@ public class IntermediaryTransformationC
     
     private static final String PORT = allocatePort(Intermediary.class);
     
-    private static boolean standalone;
-
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -69,16 +67,12 @@ public class IntermediaryTransformationC
             // set this to false to fork
             launchServer(Server.class, true)
         );
-        String deployment = System.getProperty("sts.deployment");
-        if ("standalone".equals(deployment) || deployment == null) {
-            standalone = true;
-            assertTrue(
-                    "Server failed to launch",
-                    // run the server in the same process
-                    // set this to false to fork
-                    launchServer(STSServer.class, true)
-            );
-        }
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
     }
     
     @org.junit.AfterClass
@@ -103,9 +97,8 @@ public class IntermediaryTransformationC
         DoubleItPortType transportPort = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportPort, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportPort, STSPORT);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)transportPort, STSPORT);
 
         // Make initial successful invocation
         doubleIt(transportPort, 25);

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationTest.java Mon Dec  2 12:12:22 2013
@@ -54,8 +54,6 @@ public class IntermediaryTransformationT
     
     private static final String PORT = allocatePort(Intermediary.class);
     
-    private static boolean standalone;
-
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -70,16 +68,12 @@ public class IntermediaryTransformationT
             // set this to false to fork
             launchServer(Server.class, true)
         );
-        String deployment = System.getProperty("sts.deployment");
-        if ("standalone".equals(deployment) || deployment == null) {
-            standalone = true;
-            assertTrue(
-                    "Server failed to launch",
-                    // run the server in the same process
-                    // set this to false to fork
-                    launchServer(STSServer.class, true)
-            );
-        }
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
     }
     
     @org.junit.AfterClass
@@ -104,9 +98,8 @@ public class IntermediaryTransformationT
         DoubleItPortType transportPort = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportPort, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportPort, STSPORT);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)transportPort, STSPORT);
 
         doubleIt(transportPort, 25);
         
@@ -130,9 +123,8 @@ public class IntermediaryTransformationT
         DoubleItPortType transportPort = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportPort, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportPort, STSPORT);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)transportPort, STSPORT);
 
         try {
             doubleIt(transportPort, 30);

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issuer/IssuerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issuer/IssuerTest.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issuer/IssuerTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issuer/IssuerTest.java Mon Dec  2 12:12:22 2013
@@ -42,8 +42,6 @@ public class IssuerTest extends Abstract
 
     private static final String PORT = allocatePort(Server.class);
     
-    private static boolean standalone;
-    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -57,16 +55,12 @@ public class IssuerTest extends Abstract
             ServerSocket sock = new ServerSocket(30101);
             sock.close();
             
-            String deployment = System.getProperty("sts.deployment");
-            if ("standalone".equals(deployment) || deployment == null) {
-                standalone = true;
-                assertTrue(
-                        "Server failed to launch",
-                        // run the server in the same process
-                        // set this to false to fork
-                        launchServer(STSServer.class, true)
-                );
-            }
+            assertTrue(
+                       "Server failed to launch",
+                       // run the server in the same process
+                       // set this to false to fork
+                       launchServer(STSServer.class, true)
+            );
         } catch (IOException ex) {
             // standalone is set to false + the test won't run
         }
@@ -84,10 +78,6 @@ public class IssuerTest extends Abstract
     @org.junit.Test
     public void testSAML1Issuer() throws Exception {
         
-        if (!standalone) {
-            return;
-        }
-
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = IssuerTest.class.getResource("cxf-client.xml");
 
@@ -112,10 +102,6 @@ public class IssuerTest extends Abstract
     @org.junit.Test
     public void testSAML2MEX() throws Exception {
         
-        if (!standalone) {
-            return;
-        }
-
         SpringBusFactory bf = new SpringBusFactory();
         URL busFile = IssuerTest.class.getResource("cxf-client.xml");
 

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issueunit/IssueUnitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issueunit/IssueUnitTest.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issueunit/IssueUnitTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/issueunit/IssueUnitTest.java Mon Dec  2 12:12:22 2013
@@ -87,20 +87,14 @@ public class IssueUnitTest extends Abstr
     private static final String DEFAULT_ADDRESS = 
         "https://localhost:8081/doubleit/services/doubleittransportsaml1";
     
-    private static boolean standalone;
-    
     @BeforeClass
     public static void startServers() throws Exception {
-        String deployment = System.getProperty("sts.deployment");
-        if ("standalone".equals(deployment) || deployment == null) {
-            standalone = true;
-            assertTrue(
-                    "Server failed to launch",
-                    // run the server in the same process
-                    // set this to false to fork
-                    launchServer(STSServer.class, true)
-            );
-        }
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
     }
     
     @org.junit.AfterClass
@@ -464,10 +458,8 @@ public class IssueUnitTest extends Abstr
         String wsdlPort
     ) throws Exception {
         STSClient stsClient = new STSClient(bus);
-        String port = "8443";
-        if (standalone) {
-            port = STSPORT;
-        }
+        String port = STSPORT;
+
         if (realmUri != null) {
             stsClient.setWsdlLocation("https://localhost:" + port + "/SecurityTokenService/" + realmUri
                                       + "/Transport?wsdl");
@@ -591,10 +583,8 @@ public class IssueUnitTest extends Abstr
             String endpointAddress
     ) throws Exception {
         STSClient stsClient = new STSClient(bus);
-        String port = "8443";
-        if (standalone) {
-            port = STSPORT;
-        }
+        String port = STSPORT;
+
         stsClient.setWsdlLocation("https://localhost:" + port + "/SecurityTokenService/Transport?wsdl");
         stsClient.setServiceName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService");
         stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_Port");

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/symmetric/SymmetricBindingTest.java Mon Dec  2 12:12:22 2013
@@ -32,6 +32,7 @@ import org.apache.cxf.systest.sts.common
 import org.apache.cxf.systest.sts.common.TestParam;
 import org.apache.cxf.systest.sts.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
+import org.apache.cxf.systest.sts.deployment.StaxSTSServer;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
@@ -47,7 +48,9 @@ import org.junit.runners.Parameterized.P
 public class SymmetricBindingTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
+    static final String STAX_STSPORT = allocatePort(StaxSTSServer.class);
     static final String STSPORT2 = allocatePort(STSServer.class, 2);
+    static final String STAX_STSPORT2 = allocatePort(StaxSTSServer.class, 2);
     
     private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
@@ -55,8 +58,6 @@ public class SymmetricBindingTest extend
     private static final String PORT = allocatePort(Server.class);
     private static final String STAX_PORT = allocatePort(StaxServer.class);
     
-    private static boolean standalone;
-    
     final TestParam test;
     
     public SymmetricBindingTest(TestParam type) {
@@ -77,25 +78,32 @@ public class SymmetricBindingTest extend
                    // set this to false to fork
                    launchServer(StaxServer.class, true)
         );
-        String deployment = System.getProperty("sts.deployment");
-        if ("standalone".equals(deployment) || deployment == null) {
-            standalone = true;
-            assertTrue(
-                    "Server failed to launch",
-                    // run the server in the same process
-                    // set this to false to fork
-                    launchServer(STSServer.class, true)
-            );
-        }
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxSTSServer.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)},
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false, STSPORT2)},
+                                                {new TestParam(PORT, true, STSPORT2)},
+                                                {new TestParam(STAX_PORT, false, STSPORT2)},
+                                                {new TestParam(STAX_PORT, true, STSPORT2)},
+                                                
+                                                {new TestParam(PORT, false, STAX_STSPORT2)},
+                                                {new TestParam(PORT, true, STAX_STSPORT2)},
+                                                {new TestParam(STAX_PORT, false, STAX_STSPORT2)},
+                                                {new TestParam(STAX_PORT, true, STAX_STSPORT2)},
         });
     }
     
@@ -120,9 +128,8 @@ public class SymmetricBindingTest extend
         DoubleItPortType symmetricSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(symmetricSaml1Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(symmetricSaml1Port);
@@ -151,9 +158,8 @@ public class SymmetricBindingTest extend
         DoubleItPortType symmetricSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(symmetricSaml2Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(symmetricSaml2Port);
@@ -181,9 +187,8 @@ public class SymmetricBindingTest extend
         DoubleItPortType symmetricSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(symmetricSaml1Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml1Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(symmetricSaml1Port);
@@ -215,9 +220,8 @@ public class SymmetricBindingTest extend
         DoubleItPortType symmetricSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(symmetricSaml2Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)symmetricSaml2Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(symmetricSaml2Port);

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/transport/TransportBindingTest.java Mon Dec  2 12:12:22 2013
@@ -32,6 +32,7 @@ import org.apache.cxf.systest.sts.common
 import org.apache.cxf.systest.sts.common.TestParam;
 import org.apache.cxf.systest.sts.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
+import org.apache.cxf.systest.sts.deployment.StaxSTSServer;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
@@ -46,7 +47,9 @@ import org.junit.runners.Parameterized.P
 public class TransportBindingTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
+    static final String STAX_STSPORT = allocatePort(StaxSTSServer.class);
     static final String STSPORT2 = allocatePort(STSServer.class, 2);
+    static final String STAX_STSPORT2 = allocatePort(StaxSTSServer.class, 2);
     
     private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
@@ -54,8 +57,6 @@ public class TransportBindingTest extend
     private static final String PORT = allocatePort(Server.class);
     private static final String STAX_PORT = allocatePort(StaxServer.class);
     
-    private static boolean standalone;
-    
     final TestParam test;
     
     public TransportBindingTest(TestParam type) {
@@ -76,25 +77,32 @@ public class TransportBindingTest extend
                    // set this to false to fork
                    launchServer(StaxServer.class, true)
         );
-        String deployment = System.getProperty("sts.deployment");
-        if ("standalone".equals(deployment) || deployment == null) {
-            standalone = true;
-            assertTrue(
-                    "Server failed to launch",
-                    // run the server in the same process
-                    // set this to false to fork
-                    launchServer(STSServer.class, true)
-            );
-        }
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxSTSServer.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)},
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false, STSPORT)},
+                                                {new TestParam(PORT, true, STSPORT)},
+                                                {new TestParam(STAX_PORT, false, STSPORT)},
+                                                {new TestParam(STAX_PORT, true, STSPORT)},
+                                                
+                                                {new TestParam(PORT, false, STAX_STSPORT)},
+                                                {new TestParam(PORT, true, STAX_STSPORT)},
+                                                {new TestParam(STAX_PORT, false, STAX_STSPORT)},
+                                                {new TestParam(STAX_PORT, true, STAX_STSPORT)},
         });
     }
     
@@ -120,9 +128,8 @@ public class TransportBindingTest extend
         DoubleItPortType transportSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportSaml1Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, test.getStsPort());
 
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(transportSaml1Port);
@@ -150,9 +157,8 @@ public class TransportBindingTest extend
         DoubleItPortType transportSaml2Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportSaml2Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, STSPORT);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)transportSaml2Port, test.getStsPort());
 
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(transportSaml2Port);
@@ -186,9 +192,8 @@ public class TransportBindingTest extend
         DoubleItPortType transportSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportSaml1Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
-        }
+
+        TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(transportSaml1Port);
@@ -221,10 +226,9 @@ public class TransportBindingTest extend
         DoubleItPortType transportSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportSaml1Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
-        }
 
+        TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, test.getStsPort());
+        
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(transportSaml1Port);
         }
@@ -256,9 +260,8 @@ public class TransportBindingTest extend
         DoubleItPortType transportSaml1Port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(transportSaml1Port, test.getPort());
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, STSPORT);
-        }
+
+        TokenTestUtils.updateSTSPort((BindingProvider)transportSaml1Port, test.getStsPort());
         
         if (test.isStreaming()) {
             SecurityTestUtil.enableStreaming(transportSaml1Port);

Copied: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java (from r1546615, cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java?p2=cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java&p1=cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java&r1=1546615&r2=1546973&rev=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsCachingTest.java Mon Dec  2 12:12:22 2013
@@ -46,10 +46,8 @@ import org.junit.BeforeClass;
  * it has obtained from an unknown client as an "ActAs" element. This username is obtained
  * by parsing the "ws-security.username" property. The client then invokes on the service 
  * provider using the returned token from the STS.
- * 
- * It tests both DOM + StAX clients against the DOM server.
  */
-public class UsernameActAsTest extends AbstractBusClientServerTestBase {
+public class UsernameActAsCachingTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
     static final String STSPORT2 = allocatePort(STSServer.class, 2);
@@ -59,8 +57,6 @@ public class UsernameActAsTest extends A
 
     private static final String PORT = allocatePort(Server.class);
     
-    private static boolean standalone;
-    
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue(
@@ -69,16 +65,12 @@ public class UsernameActAsTest extends A
             // set this to false to fork
             launchServer(Server.class, true)
         );
-        String deployment = System.getProperty("sts.deployment");
-        if ("standalone".equals(deployment) || deployment == null) {
-            standalone = true;
-            assertTrue(
-                    "Server failed to launch",
-                    // run the server in the same process
-                    // set this to false to fork
-                    launchServer(STSServer.class, true)
-            );
-        }
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
     }
     
     @org.junit.AfterClass
@@ -87,108 +79,6 @@ public class UsernameActAsTest extends A
         stopAllServers();
     }
 
-    @org.junit.Test
-    public void testUsernameActAs() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort");
-        DoubleItPortType port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
-        
-        // Transport port
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        doubleIt(port, 25);
-        
-        ((java.io.Closeable)port).close();
-        
-        DoubleItPortType port2 = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port2, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
-        }
-        
-        ((BindingProvider)port2).getRequestContext().put(
-            "ws-security.username", "eve"
-        );
-        // This time we expect a failure as the server validator doesn't accept "eve".
-        try {
-            doubleIt(port2, 30);
-            fail("Failure expected on an unknown user");
-        } catch (Exception ex) {
-            // expected
-        }
-        
-        ((java.io.Closeable)port2).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testUsernameActAsStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort");
-        DoubleItPortType port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
-        SecurityTestUtil.enableStreaming(port);
-        
-        // Transport port
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        doubleIt(port, 25);
-        
-        ((java.io.Closeable)port).close();
-        
-        DoubleItPortType port2 = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port2, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
-        }
-        SecurityTestUtil.enableStreaming(port2);
-        
-        ((BindingProvider)port2).getRequestContext().put(
-            "ws-security.username", "eve"
-        );
-        // This time we expect a failure as the server validator doesn't accept "eve".
-        try {
-            doubleIt(port2, 30);
-            fail("Failure expected on an unknown user");
-        } catch (Exception ex) {
-            // expected
-        }
-        
-        ((java.io.Closeable)port2).close();
-        bus.shutdown(true);
-    }
-    
     /**
      * Test caching the issued token
      */
@@ -196,13 +86,13 @@ public class UsernameActAsTest extends A
     public void testUsernameActAsCaching() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
+        URL busFile = UsernameActAsCachingTest.class.getResource("cxf-client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
+        URL wsdl = UsernameActAsCachingTest.class.getResource("DoubleIt.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort2");
         
@@ -212,9 +102,8 @@ public class UsernameActAsTest extends A
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
         
         TokenStore tokenStore = new MemoryTokenStore();
         ((BindingProvider)port).getRequestContext().put(
@@ -240,9 +129,8 @@ public class UsernameActAsTest extends A
         DoubleItPortType port2 = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(port2, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
         
         // Change the STSClient so that it can no longer find the STS
         p = (BindingProvider)port2;
@@ -284,22 +172,21 @@ public class UsernameActAsTest extends A
     public void testDifferentUsersCaching() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
+        URL busFile = UsernameActAsCachingTest.class.getResource("cxf-client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
+        URL wsdl = UsernameActAsCachingTest.class.getResource("DoubleIt.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort3");
         
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
         
         // Disable storing tokens per-proxy
         ((BindingProvider)port).getRequestContext().put(
@@ -375,22 +262,21 @@ public class UsernameActAsTest extends A
     public void testAppliesToCaching() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
+        URL busFile = UsernameActAsCachingTest.class.getResource("cxf-client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
+        URL wsdl = UsernameActAsCachingTest.class.getResource("DoubleIt.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort4");
         
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
         
         // Disable storing tokens per-proxy
         ((BindingProvider)port).getRequestContext().put(
@@ -467,22 +353,21 @@ public class UsernameActAsTest extends A
     public void testNoAppliesToCaching() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
+        URL busFile = UsernameActAsCachingTest.class.getResource("cxf-client.xml");
 
         Bus bus = bf.createBus(busFile.toString());
         SpringBusFactory.setDefaultBus(bus);
         SpringBusFactory.setThreadDefaultBus(bus);
 
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
+        URL wsdl = UsernameActAsCachingTest.class.getResource("DoubleIt.wsdl");
         Service service = Service.create(wsdl, SERVICE_QNAME);
         QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort5");
         
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
         
         // Disable storing tokens per-proxy
         ((BindingProvider)port).getRequestContext().put(

Modified: cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java?rev=1546973&r1=1546972&r2=1546973&view=diff
==============================================================================
--- cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java (original)
+++ cxf/trunk/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java Mon Dec  2 12:12:22 2013
@@ -19,26 +19,25 @@
 package org.apache.cxf.systest.sts.username_actas;
 
 import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Service;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusException;
 import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.systest.sts.common.SecurityTestUtil;
+import org.apache.cxf.systest.sts.common.TestParam;
 import org.apache.cxf.systest.sts.common.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
+import org.apache.cxf.systest.sts.deployment.StaxSTSServer;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.apache.cxf.ws.security.SecurityConstants;
-import org.apache.cxf.ws.security.tokenstore.MemoryTokenStore;
-import org.apache.cxf.ws.security.tokenstore.SecurityToken;
-import org.apache.cxf.ws.security.tokenstore.TokenStore;
-import org.apache.cxf.ws.security.trust.STSClient;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
 
 
 /**
@@ -46,20 +45,25 @@ import org.junit.BeforeClass;
  * it has obtained from an unknown client as an "ActAs" element. This username is obtained
  * by parsing the "ws-security.username" property. The client then invokes on the service 
  * provider using the returned token from the STS.
- * 
- * It tests both DOM + StAX clients against the DOM server.
  */
+@RunWith(value = org.junit.runners.Parameterized.class)
 public class UsernameActAsTest extends AbstractBusClientServerTestBase {
     
     static final String STSPORT = allocatePort(STSServer.class);
+    static final String STAX_STSPORT = allocatePort(StaxSTSServer.class);
     static final String STSPORT2 = allocatePort(STSServer.class, 2);
+    static final String STAX_STSPORT2 = allocatePort(StaxSTSServer.class, 2);
     
     private static final String NAMESPACE = "http://www.example.org/contract/DoubleIt";
     private static final QName SERVICE_QNAME = new QName(NAMESPACE, "DoubleItService");
 
     private static final String PORT = allocatePort(Server.class);
     
-    private static boolean standalone;
+    final TestParam test;
+    
+    public UsernameActAsTest(TestParam type) {
+        this.test = type;
+    }
     
     @BeforeClass
     public static void startServers() throws Exception {
@@ -69,16 +73,29 @@ public class UsernameActAsTest extends A
             // set this to false to fork
             launchServer(Server.class, true)
         );
-        String deployment = System.getProperty("sts.deployment");
-        if ("standalone".equals(deployment) || deployment == null) {
-            standalone = true;
-            assertTrue(
-                    "Server failed to launch",
-                    // run the server in the same process
-                    // set this to false to fork
-                    launchServer(STSServer.class, true)
-            );
-        }
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(STSServer.class, true)
+        );
+        assertTrue(
+                   "Server failed to launch",
+                   // run the server in the same process
+                   // set this to false to fork
+                   launchServer(StaxSTSServer.class, true)
+        );
+    }
+    
+    @Parameters(name = "{0}")
+    public static Collection<TestParam[]> data() {
+       
+        return Arrays.asList(new TestParam[][] {{new TestParam(PORT, false, STSPORT2)},
+                                                {new TestParam(PORT, true, STSPORT2)},
+                                                
+                                                {new TestParam(PORT, false, STAX_STSPORT2)},
+                                                {new TestParam(PORT, true, STAX_STSPORT2)},
+        });
     }
     
     @org.junit.AfterClass
@@ -102,61 +119,13 @@ public class UsernameActAsTest extends A
         QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort");
         DoubleItPortType port = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
-        
-        // Transport port
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        doubleIt(port, 25);
-        
-        ((java.io.Closeable)port).close();
-        
-        DoubleItPortType port2 = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port2, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
-        }
+        updateAddressPort(port, test.getPort());
         
-        ((BindingProvider)port2).getRequestContext().put(
-            "ws-security.username", "eve"
-        );
-        // This time we expect a failure as the server validator doesn't accept "eve".
-        try {
-            doubleIt(port2, 30);
-            fail("Failure expected on an unknown user");
-        } catch (Exception ex) {
-            // expected
-        }
+        TokenTestUtils.updateSTSPort((BindingProvider)port, test.getStsPort());
         
-        ((java.io.Closeable)port2).close();
-        bus.shutdown(true);
-    }
-    
-    @org.junit.Test
-    public void testUsernameActAsStreaming() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort");
-        DoubleItPortType port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
         }
-        SecurityTestUtil.enableStreaming(port);
         
         // Transport port
         ((BindingProvider)port).getRequestContext().put(
@@ -168,11 +137,13 @@ public class UsernameActAsTest extends A
         
         DoubleItPortType port2 = 
             service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port2, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
+        updateAddressPort(port2, test.getPort());
+        
+        TokenTestUtils.updateSTSPort((BindingProvider)port2, test.getStsPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port2);
         }
-        SecurityTestUtil.enableStreaming(port2);
         
         ((BindingProvider)port2).getRequestContext().put(
             "ws-security.username", "eve"
@@ -189,344 +160,6 @@ public class UsernameActAsTest extends A
         bus.shutdown(true);
     }
     
-    /**
-     * Test caching the issued token
-     */
-    @org.junit.Test
-    public void testUsernameActAsCaching() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort2");
-        
-        //
-        // Proxy no. 1
-        // 
-        DoubleItPortType port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
-        
-        TokenStore tokenStore = new MemoryTokenStore();
-        ((BindingProvider)port).getRequestContext().put(
-            TokenStore.class.getName(), tokenStore
-        );
-
-        // Make a successful invocation
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        doubleIt(port, 25);
-        
-        // Change the STSClient so that it can no longer find the STS
-        BindingProvider p = (BindingProvider)port;
-        clearSTSClient(p);
-        
-        // This invocation should be successful as the token is cached
-        doubleIt(port, 25);
-        
-        // 
-        // Proxy no. 2
-        //
-        DoubleItPortType port2 = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port2, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port2, STSPORT2);
-        }
-        
-        // Change the STSClient so that it can no longer find the STS
-        p = (BindingProvider)port2;
-        clearSTSClient(p);
-        
-        // This should fail as the cache is not being used
-        try {
-            doubleIt(port2, 40);
-            fail("Failure expected as the token is not stored in the cache");
-        } catch (Exception ex) {
-            // expected
-        }
-        
-        // Set the cache correctly
-        p.getRequestContext().put(TokenStore.class.getName(), tokenStore);
-        
-        // Make another invocation - this should succeed as the token is cached
-        p.getRequestContext().put("ws-security.username", "alice");
-        doubleIt(port2, 40);
-        
-        // Reset the cache - this invocation should fail
-        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
-        p.getRequestContext().put(SecurityConstants.TOKEN, new SecurityToken());
-        try {
-            doubleIt(port2, 40);
-            fail("Failure expected as the cache is reset");
-        } catch (Exception ex) {
-            // expected
-        }
-        
-        ((java.io.Closeable)port).close();
-        bus.shutdown(true);
-    }
-    
-    /**
-     * Test caching the issued token when the STSClient is deployed in an intermediary
-     */
-    @org.junit.Test
-    public void testDifferentUsersCaching() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort3");
-        
-        DoubleItPortType port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
-        
-        // Disable storing tokens per-proxy
-        ((BindingProvider)port).getRequestContext().put(
-            SecurityConstants.CACHE_ISSUED_TOKEN_IN_ENDPOINT, "false"
-        );
-        
-        // Make a successful invocation
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        doubleIt(port, 25);
-        
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "bob"
-        );
-        doubleIt(port, 30);
-        
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "eve"
-        );
-        try {
-            doubleIt(port, 30);
-            fail("Failure expected on a bad user");
-        } catch (Exception ex) {
-            //
-        }
-        
-        // Change the STSClient so that it can no longer find the STS
-        BindingProvider p = (BindingProvider)port;
-        clearSTSClient(p);
-        
-        // Make a successful invocation
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        doubleIt(port, 25);
-        
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "bob"
-        );
-        doubleIt(port, 30);
-        
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "eve2"
-        );
-        try {
-            doubleIt(port, 30);
-            fail("Failure expected on a bad user");
-        } catch (Exception ex) {
-            //
-        }
-        
-        // Reset the cache - this invocation should fail
-        p.getRequestContext().put(TokenStore.class.getName(), new MemoryTokenStore());
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        try {
-            doubleIt(port, 30);
-            fail("Failure expected");
-        } catch (Exception ex) {
-            //
-        }
-        
-        ((java.io.Closeable)port).close();
-        bus.shutdown(true);
-    }
-    
-    /**
-     * Test caching the issued token when the STSClient is deployed in an intermediary
-     */
-    @org.junit.Test
-    public void testAppliesToCaching() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort4");
-        
-        DoubleItPortType port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
-        
-        // Disable storing tokens per-proxy
-        ((BindingProvider)port).getRequestContext().put(
-            SecurityConstants.CACHE_ISSUED_TOKEN_IN_ENDPOINT, "false"
-        );
-        
-        // Make a successful invocation
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        BindingProvider p = (BindingProvider)port;
-        p.getRequestContext().put(
-            SecurityConstants.STS_APPLIES_TO, 
-            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
-        );
-        doubleIt(port, 25);
-        
-        // Make a successful invocation
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "bob"
-        );
-        p.getRequestContext().put(
-            SecurityConstants.STS_APPLIES_TO, 
-            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
-        );
-        doubleIt(port, 25);
-        
-        // Change the STSClient so that it can no longer find the STS
-        clearSTSClient(p);
-        
-        // Make a successful invocation - should work as token is cached
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        p.getRequestContext().put(
-            SecurityConstants.STS_APPLIES_TO, 
-            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
-        );
-        doubleIt(port, 25);
-        
-        // Make a successful invocation - should work as token is cached
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "bob"
-        );
-        p.getRequestContext().put(
-            SecurityConstants.STS_APPLIES_TO, 
-            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
-        );
-        doubleIt(port, 25);
-        
-        // Change appliesTo - should fail
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        p.getRequestContext().put(
-            SecurityConstants.STS_APPLIES_TO, 
-            "http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
-        );
-        try {
-            doubleIt(port, 30);
-            fail("Failure expected");
-        } catch (Exception ex) {
-            //
-        }
-        
-        ((java.io.Closeable)port).close();
-        bus.shutdown(true);
-    }
-    
-    /**
-     * Test caching the issued token when the STSClient is deployed in an intermediary
-     */
-    @org.junit.Test
-    public void testNoAppliesToCaching() throws Exception {
-
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = UsernameActAsTest.class.getResource("cxf-client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        SpringBusFactory.setDefaultBus(bus);
-        SpringBusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = UsernameActAsTest.class.getResource("DoubleIt.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricSAML2BearerPort5");
-        
-        DoubleItPortType port = 
-            service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        if (standalone) {
-            TokenTestUtils.updateSTSPort((BindingProvider)port, STSPORT2);
-        }
-        
-        // Disable storing tokens per-proxy
-        ((BindingProvider)port).getRequestContext().put(
-            SecurityConstants.CACHE_ISSUED_TOKEN_IN_ENDPOINT, "false"
-        );
-        
-        // Make a successful invocation
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "alice"
-        );
-        // Disable appliesTo
-        BindingProvider p = (BindingProvider)port;
-        STSClient stsClient = (STSClient)p.getRequestContext().get(SecurityConstants.STS_CLIENT);
-        stsClient.setEnableAppliesTo(false);
-        doubleIt(port, 25);
-        
-        // Change the STSClient so that it can no longer find the STS
-        clearSTSClient(p);
-        
-        // This should work
-        doubleIt(port, 25);
-        
-        // Bob should fail
-        ((BindingProvider)port).getRequestContext().put(
-            "ws-security.username", "bob"
-        );
-        try {
-            doubleIt(port, 30);
-            fail("Failure expected");
-        } catch (Exception ex) {
-            //
-        }
-        
-        ((java.io.Closeable)port).close();
-        bus.shutdown(true);
-    }
-    
-    private void clearSTSClient(BindingProvider p) throws BusException, EndpointException {
-        STSClient stsClient = (STSClient)p.getRequestContext().get(SecurityConstants.STS_CLIENT);
-        stsClient.getClient().destroy();
-        stsClient.setWsdlLocation(null);
-        stsClient.setLocation(null);
-    }
-
     private static void doubleIt(DoubleItPortType port, int numToDouble) {
         int resp = port.doubleIt(numToDouble);
         assertEquals(2 * numToDouble, resp);



Mime
View raw message