Author: rsearls
Date: 2015-01-23 13:51:49 -0500 (Fri, 23 Jan 2015)
New Revision: 19420
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wssePolicy/SignEncryptTestCase.java
Log:
Must get properties file from local disk. No longer access to JAR file via classloader.
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-23
17:48:24 UTC (rev 19419)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wssePolicy/SignEncryptTestCase.java 2015-01-23
18:51:49 UTC (rev 19420)
@@ -22,9 +22,9 @@
package org.jboss.test.ws.jaxws.samples.wssePolicy;
import java.io.File;
+import java.lang.Exception;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
+import java.net.MalformedURLException;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
@@ -43,10 +43,8 @@
import org.apache.cxf.ws.security.SecurityConstants;
import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
/**
* WS-Security Policy sign & encrypt test case
@@ -95,23 +93,30 @@
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)
- {
-
((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");
+
+ 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");
}
+
}
Show replies by date