You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2012/10/05 15:50:19 UTC
svn commit: r1394524 - in /cxf/branches/2.6.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...
Author: coheigea
Date: Fri Oct 5 13:50:17 2012
New Revision: 1394524
URL: http://svn.apache.org/viewvc?rev=1394524&view=rev
Log:
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.6.x-fixes/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java
cxf/branches/2.6.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java
cxf/branches/2.6.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java
Modified: cxf/branches/2.6.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.6.x-fixes/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java?rev=1394524&r1=1394523&r2=1394524&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java (original)
+++ cxf/branches/2.6.x-fixes/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/caching/CachingTest.java Fri Oct 5 13:50:17 2012
@@ -333,9 +333,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.6.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.6.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java?rev=1394524&r1=1394523&r2=1394524&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java (original)
+++ cxf/branches/2.6.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_actas/UsernameActAsTest.java Fri Oct 5 13:50:17 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;
@@ -35,7 +37,6 @@ import org.apache.cxf.ws.security.tokens
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.apache.cxf.ws.security.trust.delegation.WSSUsernameCallbackHandler;
import org.example.contract.doubleit.DoubleItPortType;
import org.junit.BeforeClass;
@@ -170,10 +171,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);
@@ -189,10 +188,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 {
@@ -273,10 +270,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(
@@ -365,9 +360,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(
@@ -447,10 +440,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);
@@ -468,6 +458,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.6.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.6.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java?rev=1394524&r1=1394523&r2=1394524&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java (original)
+++ cxf/branches/2.6.x-fixes/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/username_onbehalfof/UsernameOnBehalfOfTest.java Fri Oct 5 13:50:17 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;
@@ -35,7 +37,6 @@ import org.apache.cxf.ws.security.tokens
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.apache.cxf.ws.security.trust.delegation.WSSUsernameCallbackHandler;
import org.example.contract.doubleit.DoubleItPortType;
import org.junit.BeforeClass;
@@ -176,10 +177,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);
@@ -195,10 +194,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 {
@@ -283,10 +280,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(
@@ -379,9 +374,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(
@@ -465,10 +458,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);
@@ -487,6 +477,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);