Author: rsearls
Date: 2015-01-25 21:19:47 -0500 (Sun, 25 Jan 2015)
New Revision: 19424
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wssePolicy/SignEncryptTestCase.java
Log:
Revert to previous code.
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wssePolicy/SignEncryptTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wssePolicy/SignEncryptTestCase.java 2015-01-25
23:43:52 UTC (rev 19423)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wssePolicy/SignEncryptTestCase.java 2015-01-26
02:19:47 UTC (rev 19424)
@@ -40,6 +40,8 @@
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.apache.cxf.ws.security.SecurityConstants;
import org.jboss.shrinkwrap.api.asset.StringAsset;
@@ -87,36 +89,31 @@
@Test
@RunAsClient
+ @WrapThreadContextClassLoader
+ @OperateOnDeployment("jaxws-samples-wssePolicy-sign-encrypt-client")
public void test() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL("http://" + getServerHost() + ":" +
getServerPort() + "/jaxws-samples-wssePolicy-sign-encrypt?wsdl");
+ URL wsdlURL = new URL("http://" + getServerHost() + ":" +
getServerPort() + "/jaxws-samples-wssePolicy-sign-encrypt?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
+ setupWsse(proxy);
try
{
- setupWsse(proxy);
assertEquals("Secure Hello World!", proxy.sayHello());
}
catch (SOAPFaultException e)
{
throw new Exception("Error " + e.getMessage() + " - please check
that the Bouncy Castle provider is installed.", e);
}
- catch(MalformedURLException me)
- {
- throw new Exception("setup error: " + me.getMessage());
- }
}
- private void setupWsse(ServiceIface proxy) throws MalformedURLException {
- ((BindingProvider)
proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new
KeystorePasswordCallback());
-
- URL url = new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wssePolicy/sign-encrypt/META-INF/alice.properties").toURI().toURL();
- ((BindingProvider)
proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, url);
- ((BindingProvider)
proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, url);
-
- ((BindingProvider)
proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "alice");
- ((BindingProvider)
proxy).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+ private void setupWsse(ServiceIface proxy)
+ {
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new
KeystorePasswordCallback());
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,
Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES,
Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME,
"alice");
+
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME,
"bob");
}
-
}