Author: rsearls
Date: 2015-01-02 16:25:47 -0500 (Fri, 02 Jan 2015)
New Revision: 19309
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/handlerauth/HandlerAuthTestCase.java
Log:
arquillian migration handlerauth test
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/handlerauth/HandlerAuthTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/handlerauth/HandlerAuthTestCase.java 2015-01-02
17:12:00 UTC (rev 19308)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/handlerauth/HandlerAuthTestCase.java 2015-01-02
21:25:47 UTC (rev 19309)
@@ -32,7 +32,16 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
@@ -45,29 +54,39 @@
* @author Alessio Soldano
* @since 24-Sep-2013
*/
+(a)RunWith(Arquillian.class)
public class HandlerAuthTestCase extends JBossWSTest
{
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.JarDeployment("jaxws-handlerauth2.jar") {
{
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(name="jaxws-handlerauth2", order= 1, testable = false)
+ public static JavaArchive createDeployment1() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class,
"jaxws-handlerauth2.jar");
+ archive
+ .addManifest()
+ .addClass(org.jboss.test.ws.jaxws.handlerauth.LogicalSimpleHandler.class)
+ .addClass(org.jboss.test.ws.jaxws.handlerauth.SecureEndpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.handlerauth.SecureEndpointImpl2.class)
+ .addAsResource("org/jboss/test/ws/jaxws/handlerauth/handlers2.xml");
+ return archive;
+ }
+
+ @Deployment(name="jaxws-handlerauth", order= 1, testable = false)
+ public static JavaArchive createDeployment2() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class,
"jaxws-handlerauth.jar");
archive
.addManifest()
- .addClass(org.jboss.test.ws.jaxws.handlerauth.LogicalSimpleHandler.class)
.addClass(org.jboss.test.ws.jaxws.handlerauth.SecureEndpoint.class)
- .addClass(org.jboss.test.ws.jaxws.handlerauth.SecureEndpointImpl2.class)
-
.addAsResource("org/jboss/test/ws/jaxws/handlerauth/handlers2.xml");
- }
- });
- list.add(new JBossWSTestHelper.JarDeployment("jaxws-handlerauth.jar") {
{
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.handlerauth.SecureEndpoint.class)
.addClass(org.jboss.test.ws.jaxws.handlerauth.SecureEndpointImpl.class)
.addClass(org.jboss.test.ws.jaxws.handlerauth.SimpleHandler.class)
.addAsResource("org/jboss/test/ws/jaxws/handlerauth/handlers.xml");
- }
- });
- list.add(new JBossWSTestHelper.JarDeployment("jaxws-handlerauth3.jar") {
{
+ return archive;
+ }
+
+ @Deployment(name="jaxws-handlerauth3", order= 2, testable = false)
+ public static JavaArchive createDeployment3() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class,
"jaxws-handlerauth3.jar");
archive
.addManifest()
.addClass(org.jboss.test.ws.jaxws.handlerauth.SecureEndpoint.class)
@@ -75,39 +94,34 @@
.addClass(org.jboss.test.ws.jaxws.handlerauth.SimpleHandler.class)
.addAsResource("org/jboss/test/ws/jaxws/handlerauth/handlers.xml")
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/handlerauth/META-INF/jboss-webservices.xml"),
"jboss-webservices.xml");
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ return archive;
}
-
- public static Test suite()
- {
- JBossWSTestSetup testSetup = new JBossWSTestSetup(HandlerAuthTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- Map<String, String> authenticationOptions = new HashMap<String,
String>();
- authenticationOptions.put("usersProperties",
-
getResourceFile("jaxws/handlerauth/jbossws-users.properties").getAbsolutePath());
- authenticationOptions.put("rolesProperties",
-
getResourceFile("jaxws/handlerauth/jbossws-roles.properties").getAbsolutePath());
- testSetup.addSecurityDomainRequirement("handlerauth-security-domain",
authenticationOptions);
- return testSetup;
- }
-
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-handlerauth")
public void testAuthSOAPHandler() throws Exception {
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/handlerauth?wsdl");
+ URL wsdlURL = new URL(baseURL + "/handlerauth?wsdl");
Service service = Service.create(wsdlURL, new QName("http://ws/",
"SecureEndpointImplService"));
SecureEndpoint port = service.getPort(new QName("http://ws/",
"SecureEndpointPort"), SecureEndpoint.class);
testAuth(port);
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-handlerauth2")
public void testAuthLogicalHandler() throws Exception {
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/handlerauth2?wsdl");
+ URL wsdlURL = new URL(baseURL + "/handlerauth2?wsdl");
Service service = Service.create(wsdlURL, new QName("http://ws/",
"SecureEndpointImpl2Service"));
SecureEndpoint port = service.getPort(new QName("http://ws/",
"SecureEndpoint2Port"), SecureEndpoint.class);
testAuth(port);
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment("jaxws-handlerauth3")
public void testNoHandlerAuth() throws Exception {
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/handlerauth3?wsdl");
+ URL wsdlURL = new URL(baseURL + "/handlerauth3?wsdl");
Service service = Service.create(wsdlURL, new QName("http://ws/",
"SecureEndpointImpl3Service"));
SecureEndpoint port = service.getPort(new QName("http://ws/",
"SecureEndpoint3Port"), SecureEndpoint.class);
setUser((BindingProvider)port, "John", "foo");