cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1394530 - in /cxf/branches/2.5.x-fixes/services/sts/systests: advanced/src/test/java/org/apache/cxf/systest/sts/caching/ basic/src/test/java/org/apache/cxf/systest/sts/username_actas/ basic/src/test/java/org/apache/cxf/systest/sts/username...
Date Fri, 05 Oct 2012 13:57:08 GMT
Author: coheigea
Date: Fri Oct  5 13:57:08 2012
New Revision: 1394530

URL: http://svn.apache.org/viewvc?rev=1394530&view=rev
Log:
Merged revisions 1394524 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

........
  r1394524 | coheigea | 2012-10-05 14:50:17 +0100 (Fri, 05 Oct 2012) | 10 lines

  Merged revisions 1394520 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk

  ........
    r1394520 | coheigea | 2012-10-05 14:45:39 +0100 (Fri, 05 Oct 2012) | 2 lines

    Disable more STSClients in the STS systests/basic caching tests...

  ........

........

Modified:
    cxf/branches/2.5.x-fixes/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
    cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
    cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java

Modified: cxf/branches/2.5.x-fixes/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java?rev=1394530&r1=1394529&r2=1394530&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
(original)
+++ cxf/branches/2.5.x-fixes/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
Fri Oct  5 13:57:08 2012
@@ -332,9 +332,9 @@ public class CachingTest extends Abstrac
     
     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);
-        stsClient.getClient().destroy();
     }
 
     private static void doubleIt(DoubleItPortType port, int numToDouble) {

Modified: cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java?rev=1394530&r1=1394529&r2=1394530&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
(original)
+++ cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
Fri Oct  5 13:57:08 2012
@@ -25,7 +25,9 @@ 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.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
@@ -34,7 +36,6 @@ import org.apache.cxf.ws.security.Securi
 import org.apache.cxf.ws.security.tokenstore.MemoryTokenStore;
 import org.apache.cxf.ws.security.tokenstore.TokenStore;
 import org.apache.cxf.ws.security.trust.STSClient;
-import org.apache.cxf.ws.security.trust.delegation.WSSUsernameCallbackHandler;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
 
@@ -169,10 +170,8 @@ public class UsernameActAsTest extends A
         doubleIt(bearerPort, 25);
         
         // Change the STSClient so that it can no longer find the STS
-        STSClient stsClient = new STSClient(bus);
-        stsClient.setActAs(new WSSUsernameCallbackHandler());
         BindingProvider p = (BindingProvider)bearerPort;
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // This invocation should be successful as the token is cached
         doubleIt(bearerPort, 25);
@@ -188,10 +187,8 @@ public class UsernameActAsTest extends A
         }
         
         // Change the STSClient so that it can no longer find the STS
-        stsClient = new STSClient(bus);
-        stsClient.setActAs(new WSSUsernameCallbackHandler());
         p = (BindingProvider)bearerPort2;
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // This should fail as the cache is not being used
         try {
@@ -271,10 +268,8 @@ public class UsernameActAsTest extends A
         }
         
         // Change the STSClient so that it can no longer find the STS
-        STSClient stsClient = new STSClient(bus);
-        stsClient.setActAs(new WSSUsernameCallbackHandler());
         BindingProvider p = (BindingProvider)bearerPort;
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // Make a successful invocation
         ((BindingProvider)bearerPort).getRequestContext().put(
@@ -363,9 +358,7 @@ public class UsernameActAsTest extends A
         doubleIt(bearerPort, 25);
         
         // Change the STSClient so that it can no longer find the STS
-        STSClient stsClient = new STSClient(bus);
-        stsClient.setActAs(new WSSUsernameCallbackHandler());
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // Make a successful invocation - should work as token is cached
         ((BindingProvider)bearerPort).getRequestContext().put(
@@ -445,10 +438,7 @@ public class UsernameActAsTest extends A
         doubleIt(bearerPort, 25);
         
         // Change the STSClient so that it can no longer find the STS
-        stsClient = new STSClient(bus);
-        stsClient.setActAs(new WSSUsernameCallbackHandler());
-        stsClient.setEnableAppliesTo(false);
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // This should work
         doubleIt(bearerPort, 25);
@@ -466,6 +456,13 @@ public class UsernameActAsTest extends A
         
         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);

Modified: cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java?rev=1394530&r1=1394529&r2=1394530&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
(original)
+++ cxf/branches/2.5.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
Fri Oct  5 13:57:08 2012
@@ -25,7 +25,9 @@ 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.TokenTestUtils;
 import org.apache.cxf.systest.sts.deployment.STSServer;
@@ -34,7 +36,6 @@ import org.apache.cxf.ws.security.Securi
 import org.apache.cxf.ws.security.tokenstore.MemoryTokenStore;
 import org.apache.cxf.ws.security.tokenstore.TokenStore;
 import org.apache.cxf.ws.security.trust.STSClient;
-import org.apache.cxf.ws.security.trust.delegation.WSSUsernameCallbackHandler;
 import org.example.contract.doubleit.DoubleItPortType;
 import org.junit.BeforeClass;
 
@@ -167,10 +168,8 @@ public class UsernameOnBehalfOfTest exte
         doubleIt(bearerPort, 25);
         
         // Change the STSClient so that it can no longer find the STS
-        STSClient stsClient = new STSClient(bus);
-        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
         BindingProvider p = (BindingProvider)bearerPort;
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // This invocation should be successful as the token is cached
         doubleIt(bearerPort, 25);
@@ -186,10 +185,8 @@ public class UsernameOnBehalfOfTest exte
         }
         
         // Change the STSClient so that it can no longer find the STS
-        stsClient = new STSClient(bus);
-        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
         p = (BindingProvider)bearerPort2;
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // This should fail as the cache is not being used
         try {
@@ -269,10 +266,8 @@ public class UsernameOnBehalfOfTest exte
         }
         
         // Change the STSClient so that it can no longer find the STS
-        STSClient stsClient = new STSClient(bus);
-        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
         BindingProvider p = (BindingProvider)bearerPort;
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // Make a successful invocation
         ((BindingProvider)bearerPort).getRequestContext().put(
@@ -361,9 +356,7 @@ public class UsernameOnBehalfOfTest exte
         doubleIt(bearerPort, 25);
         
         // Change the STSClient so that it can no longer find the STS
-        STSClient stsClient = new STSClient(bus);
-        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // Make a successful invocation - should work as token is cached
         ((BindingProvider)bearerPort).getRequestContext().put(
@@ -443,10 +436,7 @@ public class UsernameOnBehalfOfTest exte
         doubleIt(bearerPort, 25);
         
         // Change the STSClient so that it can no longer find the STS
-        stsClient = new STSClient(bus);
-        stsClient.setOnBehalfOf(new WSSUsernameCallbackHandler());
-        stsClient.setEnableAppliesTo(false);
-        p.getRequestContext().put(SecurityConstants.STS_CLIENT, stsClient);
+        clearSTSClient(p);
         
         // This should work
         doubleIt(bearerPort, 25);
@@ -465,6 +455,13 @@ public class UsernameOnBehalfOfTest exte
         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