Author: coheigea
Date: Fri Oct  5 10:21:27 2012
New Revision: 1394433

URL: http://svn.apache.org/viewvc?rev=1394433&view=rev
Log:
Disable the STSClient in the CachingTest rather than create a new one...perhaps 
this will help with randomly failing tests on Jenkins

Modified:
    
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java

Modified: 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java?rev=1394433&r1=1394432&r2=1394433&view=diff
==============================================================================
--- 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
 (original)
+++ 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
 Fri Oct  5 10:21:27 2012
@@ -30,9 +30,11 @@ import javax.xml.ws.soap.SOAPFaultExcept
 import org.w3c.dom.Element;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.systest.sts.common.SecurityTestUtil;
 import org.apache.cxf.systest.sts.deployment.STSServer;
@@ -110,7 +112,7 @@ public class CachingTest extends Abstrac
         
         // Change the STSClient so that it can no longer find the STS
         BindingProvider p = (BindingProvider)transportSaml1Port;
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, new 
STSClient(bus));
+        clearSTSClient(p);
         
         // This should succeed as the token is cached
         doubleIt(transportSaml1Port, 30);
@@ -158,7 +160,7 @@ public class CachingTest extends Abstrac
         
         // Change the STSClient so that it can no longer find the STS
         BindingProvider p = (BindingProvider)transportSaml1Port;
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, new 
STSClient(bus));
+        clearSTSClient(p);
         
         // This should fail as it can't get the token
         try {
@@ -328,6 +330,13 @@ public class CachingTest extends Abstrac
 
         return stsClient.requestSecurityToken(endpointAddress);
     }
+    
+    private void clearSTSClient(BindingProvider p) throws BusException, 
EndpointException {
+        STSClient stsClient = 
(STSClient)p.getRequestContext().get(SecurityConstants.STS_CLIENT);
+        stsClient.setWsdlLocation(null);
+        stsClient.setLocation(null);
+        stsClient.getClient().destroy();
+    }
 
     private static void doubleIt(DoubleItPortType port, int numToDouble) {
         int resp = port.doubleIt(numToDouble);


Reply via email to