Author: asoldano
Date: 2014-11-20 15:56:33 -0500 (Thu, 20 Nov 2014)
New Revision: 19109
Added:
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/WrapThreadContextClassLoader.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/EJBDigestServiceImpl.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy
Removed:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DeploymentArchives.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptDeploymentArchives.java
Modified:
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTest.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/asynch/AsynchTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/mtom/MtomTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DefaultSchemaValidationTestCaseForked.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/SchemaValidationTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/AddressingTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsrm/client/WSReliableMessagingWithAPITestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/AnnotatedSignEncryptTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/MultipleClientsSignEncryptTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptGCMTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/UsernameOverTransportTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/UsernameTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationDigestEjbTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationDigestTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationEJBTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaspi/JaspiAuthenticationTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/DeploymentArchives.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples21xTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/pom.xml
stack/cxf/branches/arquillian/pom.xml
Log:
Initial changes for using Arquillian
Modified:
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTest.java
===================================================================
---
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTest.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTest.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -27,6 +27,7 @@
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Hashtable;
@@ -47,6 +48,10 @@
import org.jboss.logging.Logger;
import org.jboss.ws.common.DOMWriter;
import org.jboss.ws.common.concurrent.CopyJob;
+import org.junit.Rule;
+import org.junit.rules.TestRule;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -422,4 +427,42 @@
}
}
+ @Rule
+ public TestRule watcher = new TestWatcher() {
+
+ private ClassLoader classLoader = null;
+
+ protected void starting(Description description) {
+ final String cjp = getClientJarPaths();
+ if (cjp == null || cjp.trim().isEmpty()) {
+ return;
+ }
+ if (description.getAnnotation(WrapThreadContextClassLoader.class) != null) {
+ classLoader = Thread.currentThread().getContextClassLoader();
+
+ StringTokenizer st = new StringTokenizer(cjp, ", ");
+ URL[] archives = new URL[st.countTokens()];
+
+ try {
+ for (int i = 0; i < archives.length; i++)
+ archives[i] = new File(JBossWSTestHelper.getTestArchiveDir(),
st.nextToken()).toURI().toURL();
+
+ URLClassLoader cl = new URLClassLoader(archives, classLoader);
+ Thread.currentThread().setContextClassLoader(cl);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ protected void finished(Description description) {
+ if (classLoader != null &&
description.getAnnotation(WrapThreadContextClassLoader.class) != null) {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+ }
+ };
+
+ protected String getClientJarPaths() {
+ return null;
+ }
}
\ No newline at end of file
Added:
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/WrapThreadContextClassLoader.java
===================================================================
---
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/WrapThreadContextClassLoader.java
(rev 0)
+++
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/WrapThreadContextClassLoader.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.wsf.test;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.METHOD })
+public @interface WrapThreadContextClassLoader
+{
+
+}
Property changes on:
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/WrapThreadContextClassLoader.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml 2014-11-19 13:50:36
UTC (rev 19108)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml 2014-11-20 20:56:33
UTC (rev 19109)
@@ -68,6 +68,30 @@
</activation>
<build>
<plugins>
+ <plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>testsuite-default</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+
<source>${basedir}/src/test/scripts/jbws-testsuite-default.groovy</source>
+ <properties>
+
<inputFile>${jboss.home}/standalone/configuration/standalone.xml</inputFile>
+
<outputFile>${jboss.home}/standalone/configuration/jbws-testsuite-default.xml</outputFile>
+
<usersPropFile>${project.build.directory}/test-classes/jbossws-users.properties</usersPropFile>
+
<rolesPropFile>${project.build.directory}/test-classes/jbossws-roles.properties</rolesPropFile>
+
<keystorePath>${project.build.directory}/test-classes/test.keystore</keystorePath>
+
<testResourcesDir>${project.build.directory}/test-resources</testResourcesDir>
+ </properties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin> <!-- This copies jbossws-cxf-factories jar to endorsed dir
before the integration-tests are run -->
<artifactId>maven-resources-plugin</artifactId>
<executions>
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
(rev 0)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml 2014-11-20
20:56:33 UTC (rev 19109)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian
xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <group qualifier="cxf-tests" default="true">
+ <container qualifier="jboss" default="true">
+ <configuration>
+ <property name="jbossHome">${jboss.home}</property>
+ <!-- <property name="javaVmArguments">${server.jvm.args}
-Djboss.inst=${basedir}/target/jbossas -Dtest.bind.address=${node0}</property>
-->
+ <property
name="serverConfig">jbws-testsuite-default.xml</property>
+ <!-- -Djboss.inst is not necessarily needed, only in case the test case
neeeds path to the instance it runs in.
+ In the future, Arquillian should capable of injecting it into
@ArquillianResource File or such. -->
+ <property
name="allowConnectingToRunningServer">true</property>
+ <!-- <property
name="managementAddress">${node0:127.0.0.1}</property> -->
+ <property
name="managementPort">${as.managementPort:9990}</property>
+
+ <!-- AS7-4070 -->
+ <property name="waitForPorts">${as.debug.port:8787}
${as.managementPort:9990}</property>
+ <property
name="waitForPortsTimeoutInSeconds">8</property>
+ </configuration>
+ </container>
+ </group>
+</arquillian>
Property changes on:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/asynch/AsynchTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/asynch/AsynchTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/asynch/AsynchTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -32,13 +32,17 @@
import javax.xml.ws.Response;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Asynchronous web services test case (both client and server side async)
@@ -46,6 +50,7 @@
* @author alessio.soldano(a)jboss.com
* @since 21-Jun-2012
*/
+(a)RunWith(Arquillian.class)
public class AsynchTestCase extends JBossWSTest
{
private String endpointAddress = "http://" + getServerHost() +
":8080/jaxws-samples-asynch";
@@ -63,11 +68,18 @@
return list.toArray(new BaseDeployment<?>[list.size()]);
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(AsynchTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
+ @Deployment(testable = false)
+ public static WebArchive createDep() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-asynch.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.samples.asynch.EndpointImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/asynch/WEB-INF/web.xml"));
+ return archive;
}
+ @Test
+ @RunAsClient
public void testEndpoint() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/samples/asynch",
"EndpointImplService");
@@ -78,6 +90,8 @@
assertEquals(user + " (ASYNC)", proxy.echo(user)); //expect ASYNC as on
server side the invocation is dispatched to the async method
}
+ @Test
+ @RunAsClient
public void testAsyncEndpoint() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/samples/asynch",
"EndpointImplService");
@@ -89,6 +103,8 @@
assertEquals(user + " (ASYNC)", proxy.echoAsync(user).get());
}
+ @Test
+ @RunAsClient
public void testAsyncEndpointUsingHandler() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/samples/asynch",
"EndpointImplService");
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/mtom/MtomTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/mtom/MtomTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/mtom/MtomTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -26,62 +26,62 @@
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.helpers.IOUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.ws.common.DOMUtils;
-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;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/**
* Client invoking web service using MTOM
*
*/
+(a)RunWith(Arquillian.class)
public final class MtomTestCase extends JBossWSTest
{
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-samples-mtom.war") {
{
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.samples.mtom.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.mtom.ServiceImpl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.mtom.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.mtom.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/mtom/WEB-INF/wsdl/MtomService.wsdl"),
"wsdl/MtomService.wsdl")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/mtom/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDep() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-mtom.war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.samples.mtom.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.mtom.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.mtom.jaxws.SayHello.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.mtom.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/mtom/WEB-INF/wsdl/MtomService.wsdl"),
"wsdl/MtomService.wsdl")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/mtom/WEB-INF/web.xml"));
+ return archive;
}
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-mtom/MtomService";
-
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(MtomTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testMtomWithProxy() throws Exception
{
// construct proxy
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/mtom",
"MtomService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/jaxws-samples-mtom/MtomService" +
"?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
// invoke method
assertEquals("Hello World!", proxy.sayHello());
}
+ @Test
+ @RunAsClient
public void testMtomWithoutProxy() throws Exception
{
final String mtomPayload =
"--uuid:b7a481a7-274a-42ed-8b84-9bb2280fb2e7\r\n"
@@ -93,7 +93,7 @@
+
"xmlns:ns3=\"http://www.jboss.org/jbossws/ws-extensions/wsaddressing\"/></soap:Body></soap:Envelope>\r\n"
+
"--uuid:b7a481a7-274a-42ed-8b84-9bb2280fb2e7--";
- HttpURLConnection conn = (HttpURLConnection)new URL(serviceURL).openConnection();
+ HttpURLConnection conn = (HttpURLConnection)new URL(baseURL +
"/jaxws-samples-mtom/MtomService").openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type",
@@ -117,13 +117,15 @@
}
}
+ @Test
+ @RunAsClient
public void testMtomNotUsed() throws Exception
{
final String envelope = "<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><...
+ "<ns2:sayHello
xmlns:ns2=\"http://www.jboss.org/jbossws/ws-extensions/mtom\" "
+
"xmlns:ns3=\"http://www.jboss.org/jbossws/ws-extensions/wsaddressing\"/></soap:Body></soap:Envelope>";
- HttpURLConnection conn = (HttpURLConnection)new URL(serviceURL).openConnection();
+ HttpURLConnection conn = (HttpURLConnection)new URL(baseURL +
"/jaxws-samples-mtom/MtomService").openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/xml");
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DefaultSchemaValidationTestCaseForked.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DefaultSchemaValidationTestCaseForked.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DefaultSchemaValidationTestCaseForked.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -21,19 +21,27 @@
*/
package org.jboss.test.ws.jaxws.samples.schemavalidation;
+import java.io.File;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployer;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.WebArchive;
import org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse;
import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* A testcase for verifying default schema validation configured
@@ -41,24 +49,61 @@
*
* @author alessio.soldano(a)jboss.com
*/
+(a)RunWith(Arquillian.class)
public class DefaultSchemaValidationTestCaseForked extends JBossWSTest
{
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(DefaultSchemaValidationTestCaseForked.class,
DeploymentArchives.CLIENT_WAR);
+ private static final String DEPLOYMENT = "jaxws-samples-schemavalidation";
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @ArquillianResource
+ Deployer deployer;
+
+ @Deployment(testable = false)
+ public static WebArchive createClientDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-schemavalidation-client.war");
+ archive
+ .addManifest()
+ .addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.Hello.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.Helper.class)
+
.addPackage("org.jboss.test.ws.jaxws.samples.schemavalidation.types")
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/client.wsdl"),
"classes/client.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/validatingClient.wsdl"),
"classes/validatingClient.wsdl")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/META-INF/permissions.xml"),
"permissions.xml");
+ return archive;
}
+ @Deployment(name = DEPLOYMENT, testable = false, managed = false)
+ public static WebArchive createServerDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEPLOYMENT +
".war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.Hello.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.HelloImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.ValidatingHelloImpl.class)
+
.addPackage("org.jboss.test.ws.jaxws.samples.schemavalidation.types")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/WEB-INF/wsdl/hello.wsdl"),
"wsdl/hello.wsdl")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/WEB-INF/web.xml"));
+ return archive;
+ }
+
/**
* Verifies the default client configuration can be used to always set schema
validation from AS model
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
public void testDefaultClientValidation() throws Exception {
try {
- JBossWSTestHelper.deploy(DeploymentArchives.SERVER);
+ deployer.deploy(DEPLOYMENT);
assertEquals("1",
runInContainer("testDefaultClientValidation"));
} finally {
- JBossWSTestHelper.undeploy(DeploymentArchives.SERVER);
+ deployer.undeploy(DEPLOYMENT);
}
}
@@ -67,6 +112,8 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
public void testDefaultServerValidation() throws Exception {
final QName serviceName = new
QName("http://jboss.org/schemavalidation",
"HelloService");
final QName portName = new
QName("http://jboss.org/schemavalidation",
"HelloPort");
@@ -74,10 +121,10 @@
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello) service.getPort(portName, Hello.class);
((BindingProvider)
proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- "http://" + getServerHost() +
":8080/jaxws-samples-schemavalidation/hello");
+ "http://" + baseURL.getHost() + ":" + baseURL.getPort() +
"/jaxws-samples-schemavalidation/hello");
HelloResponse hr;
try {
- JBossWSTestHelper.deploy(DeploymentArchives.SERVER);
+ deployer.deploy(DEPLOYMENT);
hr = proxy.helloRequest("JBoss");
assertNotNull(hr);
assertEquals(2, hr.getReturn());
@@ -85,7 +132,7 @@
assertNotNull(hr);
assertEquals(2, hr.getReturn());
} finally {
- JBossWSTestHelper.undeploy(DeploymentArchives.SERVER);
+ deployer.undeploy(DEPLOYMENT);
}
// -- modify default conf to enable default endpoint schema validation
@@ -93,7 +140,7 @@
{
runInContainer("enableDefaultEndpointSchemaValidation");
try {
- JBossWSTestHelper.deploy(DeploymentArchives.SERVER);
+ deployer.deploy(DEPLOYMENT);
hr = proxy.helloRequest("JBoss");
assertNotNull(hr);
assertEquals(2, hr.getReturn());
@@ -104,7 +151,7 @@
assertTrue(e.getMessage().contains("is not facet-valid with respect
to enumeration"));
}
} finally {
- JBossWSTestHelper.undeploy(DeploymentArchives.SERVER);
+ deployer.undeploy(DEPLOYMENT);
}
}
finally
@@ -121,8 +168,7 @@
private String runInContainer(String test) throws Exception
{
- URL url = new URL("http://" + getServerHost()
- +
":8080/jaxws-samples-schemavalidation-client?path=/jaxws-samples-schemavalidation/hello&method="
+ test
+ URL url = new URL(baseURL +
"?path=/jaxws-samples-schemavalidation/hello&method=" + test
+ "&helper=" + Helper.class.getName());
return IOUtils.readAndCloseStream(url.openStream());
}
Deleted:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DeploymentArchives.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DeploymentArchives.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/DeploymentArchives.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2014, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.schemavalidation;
-
-import java.io.File;
-
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSTestHelper;
-
-public final class DeploymentArchives
-{
- public static final String SERVER = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-samples-schemavalidation.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.Hello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.HelloImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.ValidatingHelloImpl.class)
-
.addPackage("org.jboss.test.ws.jaxws.samples.schemavalidation.types")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/WEB-INF/wsdl/hello.wsdl"),
"wsdl/hello.wsdl")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/WEB-INF/web.xml"));
- }
- });
-
- public static final String CLIENT_WAR = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-samples-schemavalidation-client.war") {
{
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.Hello.class)
- .addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.Helper.class)
-
.addPackage("org.jboss.test.ws.jaxws.samples.schemavalidation.types")
- .addClass(org.jboss.wsf.test.ClientHelper.class)
- .addClass(org.jboss.wsf.test.TestServlet.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/client.wsdl"),
"classes/client.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/validatingClient.wsdl"),
"classes/validatingClient.wsdl")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/META-INF/permissions.xml"),
"permissions.xml");
- }
- });
-
- public static final String CLIENT_JAR = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-samples-schemavalidation-client.jar") {
{
- archive
- .addManifest()
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/META-INF/jaxws-client-config.xml"),
"jaxws-client-config.xml");
- }
- });
-
- private DeploymentArchives() {
- //NO OP
- }
-}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/SchemaValidationTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/SchemaValidationTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/schemavalidation/SchemaValidationTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -21,18 +21,27 @@
*/
package org.jboss.test.ws.jaxws.samples.schemavalidation;
+import java.io.File;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.WebArchive;
import org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse;
import org.jboss.ws.api.configuration.ClientConfigUtil;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* A testcase acting as sample for using client and server schema validation of messages
@@ -40,23 +49,45 @@
* @author ema(a)redhat.com
* @author alessio.soldano(a)jboss.com
*/
+(a)RunWith(Arquillian.class)
public class SchemaValidationTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-schemavalidation/hello";
- private final String validatingServiceURL = "http://" + getServerHost() +
":8080/jaxws-samples-schemavalidation/validatingHello";
+ @ArquillianResource
+ private URL baseURL;
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(SchemaValidationTestCase.class,
DeploymentArchives.SERVER + ", " + DeploymentArchives.CLIENT_JAR);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-schemavalidation.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.Hello.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.HelloImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.schemavalidation.ValidatingHelloImpl.class)
+ .addPackage("org.jboss.test.ws.jaxws.samples.schemavalidation.types")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/WEB-INF/wsdl/hello.wsdl"),
"wsdl/hello.wsdl")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/WEB-INF/web.xml"));
+ return archive;
}
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-samples-schemavalidation-client.jar") {
{
+ archive
+ .addManifest()
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/schemavalidation/META-INF/jaxws-client-config.xml"),
"jaxws-client-config.xml");
+ }
+ });
+ }
+
+ @Test
+ @RunAsClient
public void testSchemaValidationEndpoint() throws Exception
{
QName serviceName = new
QName("http://jboss.org/schemavalidation",
"HelloService");
- URL wsdlURL =
getResourceURL("jaxws/samples/schemavalidation/WEB-INF/wsdl/hello.wsdl");
+ URL wsdlURL =
JBossWSTestHelper.getResourceURL("jaxws/samples/schemavalidation/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(new
QName("http://jboss.org/schemavalidation", "ValidatingHelloPort"),
Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
validatingServiceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL + "/validatingHello");
HelloResponse hr = proxy.helloRequest("JBoss"); //valid value (see xsd
restriction in the wsdl)
assertNotNull(hr);
assertEquals(1, hr.getReturn());
@@ -68,13 +99,15 @@
}
}
+ @Test
+ @RunAsClient
public void testNoSchemaValidationEndpoint() throws Exception
{
QName serviceName = new
QName("http://jboss.org/schemavalidation",
"HelloService");
- URL wsdlURL =
getResourceURL("jaxws/samples/schemavalidation/WEB-INF/wsdl/hello.wsdl");
+ URL wsdlURL =
JBossWSTestHelper.getResourceURL("jaxws/samples/schemavalidation/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(new
QName("http://jboss.org/schemavalidation", "HelloPort"),
Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL + "/hello");
HelloResponse hr = proxy.helloRequest("JBoss");
assertNotNull(hr);
assertEquals(2, hr.getReturn());
@@ -83,13 +116,15 @@
assertEquals(2, hr.getReturn());
}
+ @Test
+ @RunAsClient
public void testClientSideSchemaValidation() throws Exception
{
QName serviceName = new
QName("http://jboss.org/schemavalidation",
"HelloService");
- URL wsdlURL =
getResourceURL("jaxws/samples/schemavalidation/validatingClient.wsdl");
+ URL wsdlURL =
JBossWSTestHelper.getResourceURL("jaxws/samples/schemavalidation/validatingClient.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(new
QName("http://jboss.org/schemavalidation", "HelloPort"),
Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL + "/hello");
((BindingProvider)proxy).getRequestContext().put("schema-validation-enabled",
true); //enable client side schema validation
HelloResponse hr = proxy.helloRequest("JBoss");
assertNotNull(hr);
@@ -102,13 +137,18 @@
}
}
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void testClientSideSchemaValidationUsingConfiguration() throws Exception
{
+ try {
+
QName serviceName = new
QName("http://jboss.org/schemavalidation",
"HelloService");
- URL wsdlURL =
getResourceURL("jaxws/samples/schemavalidation/validatingClient.wsdl");
+ URL wsdlURL =
JBossWSTestHelper.getResourceURL("jaxws/samples/schemavalidation/validatingClient.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(new
QName("http://jboss.org/schemavalidation", "HelloPort"),
Hello.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL + "/hello");
ClientConfigUtil.setConfigProperties(proxy,
"META-INF/jaxws-client-config.xml", "Test Validating Client Config");
//enable client side schema validation
HelloResponse hr = proxy.helloRequest("JBoss");
assertNotNull(hr);
@@ -119,5 +159,8 @@
} catch (Exception e) {
assertTrue("not respect to enumration error is expected",
e.getMessage().contains("is not facet-valid with respect to enumeration"));
}
+ } finally {
+
+ }
}
}
\ No newline at end of file
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/session/SessionEndpointTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -23,20 +23,21 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
-import org.jboss.wsf.test.JBossWSTestSetup;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Test to demonstrate enable session with cxf <code>@FactoryType</code>
@@ -44,41 +45,22 @@
*
* @author ema(a)redhat.com
*/
+(a)RunWith(Arquillian.class)
public class SessionEndpointTestCase extends JBossWSTest
{
- private String targetNS = "http://jboss.org/jaxws-samples-session";
-
- private SessionEndpoint proxy;
-
- public static BaseDeployment<?>[] createDeployments()
- {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-session.war")
- {
- {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n" +
"Dependencies: org.apache.cxf.impl\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.session.SessionEndpoint.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.session.SessionEndpointImpl.class)
- .setWebXML(
- new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/session/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-session.war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n" +
"Dependencies: org.apache.cxf.impl\n"))
+ .addClass(org.jboss.test.ws.jaxws.samples.session.SessionEndpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.session.SessionEndpointImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/session/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSTestSetup(SessionEndpointTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- }
-
+ @Test
+ @RunAsClient
public void testSession() throws Exception
{
SessionEndpoint proxy = this.createPort();
@@ -98,11 +80,11 @@
public SessionEndpoint createPort() throws Exception
{
- QName serviceName = new QName(targetNS, "SessionService");
+ QName serviceName = new
QName("http://jboss.org/jaxws-samples-session",
"SessionService");
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-session/session?wsdl");
Service service = Service.create(wsdlURL, serviceName);
- proxy = (SessionEndpoint) service.getPort(SessionEndpoint.class);
+ SessionEndpoint proxy = (SessionEndpoint) service.getPort(SessionEndpoint.class);
return proxy;
}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/AddressingTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/AddressingTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/AddressingTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -24,8 +24,6 @@
import java.io.File;
import java.net.SocketTimeoutException;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
@@ -33,55 +31,55 @@
import javax.xml.ws.WebServiceException;
import javax.xml.ws.soap.AddressingFeature;
-import junit.framework.Test;
-
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.stack.cxf.client.UseThreadBusFeature;
-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;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Client invoking web service using WS-Addressing
*
* @author richard.opalka(a)jboss.com
*/
+(a)RunWith(Arquillian.class)
public final class AddressingTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsa/AddressingService";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsa.war") {
{
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.samples.wsa.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsa.ServiceImpl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsa.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsa.jaxws.SayHelloResponse.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsa/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsa.war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.samples.wsa.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsa.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsa.jaxws.SayHello.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsa.jaxws.SayHelloResponse.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsa/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(AddressingTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
/**
* This tests the invocation using the local copy of the service contract; that does
not have any ws-addressing
* policy, so the addressing feature needs to be explicitly provided.
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
public void testUsingLocalContract() throws Exception
{
// construct proxy
@@ -89,7 +87,7 @@
URL wsdlURL =
getResourceURL("jaxws/samples/wsa/WEB-INF/wsdl/AddressingService.wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class, new
AddressingFeature());
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL + "/jaxws-samples-wsa/AddressingService");
// invoke method
assertEquals("Hello World!", proxy.sayHello("World"));
}
@@ -100,11 +98,13 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
public void testUsingContractFromDeployedEndpoint() throws Exception
{
// construct proxy
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wsaddressing",
"AddressingService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsa/AddressingService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
// invoke method
@@ -120,6 +120,8 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
public void testDecoupledEndpointForLongLastingProcessingOfInvocations() throws
Exception
{
final Bus bus = BusFactory.newInstance().createBus();
@@ -127,7 +129,7 @@
try {
// construct proxy
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wsaddressing",
"AddressingService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsa/AddressingService?wsdl");
Service service = Service.create(wsdlURL, serviceName, new
UseThreadBusFeature());
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsdd/WSDiscoveryTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -31,8 +31,6 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
-import junit.framework.Test;
-
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.ws.discovery.WSDiscoveryClient;
@@ -40,10 +38,15 @@
import org.apache.cxf.ws.discovery.wsdl.ProbeType;
import org.apache.cxf.ws.discovery.wsdl.ResolveMatchType;
import org.apache.cxf.ws.discovery.wsdl.ScopesType;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Discovery 1.1 sample
@@ -51,37 +54,36 @@
* @author alessio.soldano(a)jboss.com
* @since 07-May-2013
*/
+(a)RunWith(Arquillian.class)
public final class WSDiscoveryTestCase extends JBossWSTest
{
private static final int TIMEOUT =
Integer.getInteger(WSDiscoveryTestCase.class.getName() + ".timeout", 2000);
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsdd2.war") {
{
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.samples.wsdd.AnotherServiceImpl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsdd.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsdd.ServiceImpl.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsdd/WEB-INF/jboss-webservices.xml"),
"jboss-webservices.xml");
- }
- });
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsdd.war") {
{
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.samples.wsdd.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsdd.ServiceImpl.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsdd/WEB-INF/jboss-webservices.xml"),
"jboss-webservices.xml");
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(name = "jaxws-samples-wsdd2", testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsdd2.war");
+ archive
+ .addManifest()
+ .addClass(org.jboss.test.ws.jaxws.samples.wsdd.AnotherServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsdd.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsdd.ServiceImpl.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsdd/WEB-INF/jboss-webservices.xml"),
"jboss-webservices.xml");
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(WSDiscoveryTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
+ @Deployment(name = "jaxws-samples-wsdd", testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsdd.war");
+ archive
+ .addManifest()
+ .addClass(org.jboss.test.ws.jaxws.samples.wsdd.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsdd.ServiceImpl.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsdd/WEB-INF/jboss-webservices.xml"),
"jboss-webservices.xml");
+ return archive;
}
-
+
+ @Test
+ @RunAsClient
public void testProbeAndResolve() throws Exception
{
Bus bus = null;
@@ -139,6 +141,8 @@
return filtered;
}
+ @Test
+ @RunAsClient
public void testInvocation() throws Exception
{
Bus bus = null;
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsrm/client/WSReliableMessagingWithAPITestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsrm/client/WSReliableMessagingWithAPITestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsrm/client/WSReliableMessagingWithAPITestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -23,23 +23,25 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.WebArchive;
import org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService;
-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;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Client invoking web service with WS-RM and using no xml descriptor
@@ -48,33 +50,30 @@
* @since 02-Aug-2010
*
*/
+(a)RunWith(Arquillian.class)
public final class WSReliableMessagingWithAPITestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsrm-api/SimpleService";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsrm-api.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.RMCheckInterceptor.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.SimpleServiceImpl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.jaxws.Echo.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.jaxws.EchoResponse.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.jaxws.Ping.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl"),
"wsdl/SimpleService.wsdl")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsrm/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsrm-api.war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.RMCheckInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.SimpleServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.jaxws.Echo.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.jaxws.EchoResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsrm.service.jaxws.Ping.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl"),
"wsdl/SimpleService.wsdl")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsrm/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(WSReliableMessagingWithAPITestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void test() throws Exception
{
final Bus bus = BusFactory.newInstance().createBus();
@@ -84,7 +83,7 @@
URL wsdlURL =
getResourceURL("jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl");
Service service = Service.create(wsdlURL, serviceName);
SimpleService proxy = (SimpleService)service.getPort(SimpleService.class);
-
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
baseURL + "/jaxws-samples-wsrm-api/SimpleService");
assertEquals("Hello World!", proxy.echo("Hello World!")); //
request response call
proxy.ping(); // one way call
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/AnnotatedSignEncryptTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/AnnotatedSignEncryptTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/AnnotatedSignEncryptTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -21,20 +21,29 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse.policy.basic;
+import java.io.File;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.message.Message;
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.WebArchive;
import org.jboss.ws.common.IOUtils;
import org.jboss.wsf.test.CryptoHelper;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-SecurityPolicy code first dev test
@@ -42,26 +51,55 @@
* @author alessio.soldano(a)jboss.com
* @since 05-Jun-2013
*/
+(a)RunWith(Arquillian.class)
public final class AnnotatedSignEncryptTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-sign-encrypt-gcm-code-first/AnnotatedSecurityService";
+ @ArquillianResource
+ private URL baseURL;
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(AnnotatedSignEncryptTestCase.class,
SignEncryptDeploymentArchives.SERVER_GCM_CODEFIRST_WAR + " " +
SignEncryptDeploymentArchives.CLIENT_JAR);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-sign-encrypt-gcm-code-first.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.AnnotatedServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.AnnotatedServiceImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/bob.jks"),
"classes/bob.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/bob.properties"),
"classes/bob.properties");
+ return archive;
}
+
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("AnnotatedSignEncryptTestCase-client.jar") { {
+ archive
+ .addManifest()
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.jks"),
"alice.jks")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.properties"),
"alice.properties")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/jaxws-client-config.xml"),
"jaxws-client-config.xml");
+ }
+ });
+ }
+ @Test
+ @RunAsClient
public void testWsdl() throws Exception
{
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/AnnotatedSecurityService?wsdl");
assertTrue(IOUtils.readAndCloseStream(wsdlURL.openStream()).contains("AsymmetricBinding_X509v1_GCM256OAEP_ProtectTokens_binding_policy"));
}
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test() throws Exception
{
try {
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"AnnotatedSecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/AnnotatedSecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
AnnotatedServiceIface proxy =
(AnnotatedServiceIface)service.getPort(AnnotatedServiceIface.class);
setupWsse(proxy);
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/MultipleClientsSignEncryptTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/MultipleClientsSignEncryptTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/MultipleClientsSignEncryptTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -23,22 +23,25 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPFaultException;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy sign & encrypt test case
@@ -47,13 +50,33 @@
* @author alessio.soldano(a)jboss.com
* @since 13-Jan-2012
*/
+(a)RunWith(Arquillian.class)
public final class MultipleClientsSignEncryptTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-sign-encrypt-mc/SecurityService";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-sign-encrypt-mc-client.jar")
{ {
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-sign-encrypt-mc.war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.MultipleClientsServiceImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/bob2.jks"),
"classes/bob2.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/bob2.properties"),
"classes/bob2.properties")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd");
+ return archive;
+ }
+
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-sign-encrypt-mc-client.jar")
{ {
archive
.addManifest()
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.jks"),
"alice.jks")
@@ -62,33 +85,15 @@
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/john.properties"),
"john.properties");
}
});
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-sign-encrypt-mc.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.MultipleClientsServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/bob2.jks"),
"classes/bob2.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/bob2.properties"),
"classes/bob2.properties")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd");
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(MultipleClientsSignEncryptTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void testAlice() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "alice");
@@ -102,10 +107,13 @@
}
}
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void testJohn() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "john");
Deleted:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptDeploymentArchives.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptDeploymentArchives.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptDeploymentArchives.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2014, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.samples.wsse.policy.basic;
-
-import java.io.File;
-
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSTestHelper;
-
-public final class SignEncryptDeploymentArchives
-{
- public static final String SERVER_WAR = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-sign-encrypt.war") {
{
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/bob.jks"),
"classes/bob.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/bob.properties"),
"classes/bob.properties")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/web.xml"));
- }
- });
-
- public static final String CLIENT_WAR = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-sign-encrypt-client.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client
services\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.SignEncryptHelper.class)
- .addClass(org.jboss.wsf.test.ClientHelper.class)
- .addClass(org.jboss.wsf.test.CryptoHelper.class)
- .addClass(org.jboss.wsf.test.TestServlet.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.properties"),
"classes/META-INF/alice.properties")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.jks"),
"classes/META-INF/alice.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/jaxws-client-config.xml"),
"classes/META-INF/jaxws-client-config.xml");
- }
- });
-
- public static final String CLIENT_JAR = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-sign-encrypt-client.jar")
{ {
- archive
- .addManifest()
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.jks"),
"alice.jks")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.properties"),
"alice.properties")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/jaxws-client-config.xml"),
"jaxws-client-config.xml");
- }
- });
-
- public static final String SERVER_GCM_WAR = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-sign-encrypt-gcm.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/bob.jks"),
"classes/bob.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/bob.properties"),
"classes/bob.properties")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/web.xml"));
- }
- });
-
- public static final String SERVER_GCM_CODEFIRST_WAR =
JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-sign-encrypt-gcm-code-first.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.AnnotatedServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.AnnotatedServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/bob.jks"),
"classes/bob.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/bob.properties"),
"classes/bob.properties");
- }
- });
-
-
- private SignEncryptDeploymentArchives() {
- //NOOP
- }
-}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptGCMTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptGCMTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptGCMTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -21,13 +21,23 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse.policy.basic;
+import java.io.File;
import java.net.URL;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.WebArchive;
import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy sign & encrypt test case
@@ -36,27 +46,82 @@
* @author alessio.soldano(a)jboss.com
* @since 27-Feb-2012
*/
+(a)RunWith(Arquillian.class)
public final class SignEncryptGCMTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-sign-encrypt-gcm";
+ private static final String WS_DEPLOYMENT =
"jaxws-samples-wsse-policy-sign-encrypt-gcm";
+ private static final String SERVLET_DEPLOYMENT =
"jaxws-samples-wsse-policy-sign-encrypt-gcm-client";
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(SignEncryptGCMTestCase.class,
- SignEncryptDeploymentArchives.CLIENT_JAR + " " +
SignEncryptDeploymentArchives.CLIENT_WAR + " " +
SignEncryptDeploymentArchives.SERVER_GCM_WAR);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(name = WS_DEPLOYMENT, testable = false)
+ public static WebArchive createDeployment1() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, WS_DEPLOYMENT +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/bob.jks"),
"classes/bob.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/bob.properties"),
"classes/bob.properties")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/web.xml"));
+ return archive;
}
-
+
+ @Deployment(name = SERVLET_DEPLOYMENT, testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, SERVLET_DEPLOYMENT +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client
services\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.SignEncryptHelper.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.CryptoHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.properties"),
"classes/META-INF/alice.properties")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.jks"),
"classes/META-INF/alice.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/jaxws-client-config.xml"),
"classes/META-INF/jaxws-client-config.xml");
+ return archive;
+ }
+
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("SignEncryptGCMTestCase-client.jar") { {
+ archive
+ .addManifest()
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.jks"),
"alice.jks")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.properties"),
"alice.properties")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/jaxws-client-config.xml"),
"jaxws-client-config.xml");
+ }
+ });
+ }
+
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
+ @OperateOnDeployment(WS_DEPLOYMENT)
public void testClientSide() throws Exception
{
SignEncryptHelper helper = new SignEncryptHelper();
- helper.setTargetEndpoint(serviceURL);
+ helper.setTargetEndpoint(baseURL +
"/jaxws-samples-wsse-policy-sign-encrypt-gcm");
assertTrue(helper.testSignEncrypt());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(WS_DEPLOYMENT)
+ @WrapThreadContextClassLoader
public void testClientSideUsingConfigProperties() throws Exception
{
SignEncryptHelper helper = new SignEncryptHelper();
- helper.setTargetEndpoint(serviceURL);
+ helper.setTargetEndpoint(baseURL +
"/jaxws-samples-wsse-policy-sign-encrypt-gcm");
assertTrue(helper.testSignEncryptUsingConfigProperties());
}
@@ -68,10 +133,12 @@
// assertEquals("1", br.readLine());
// }
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVLET_DEPLOYMENT)
public void testServerSideUsingConfigProperties() throws Exception
{
- URL url = new URL("http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-sign-encrypt-client?" +
-
"path=/jaxws-samples-wsse-policy-sign-encrypt-gcm&method=testSignEncryptUsingConfigProperties&helper="
+ SignEncryptHelper.class.getName());
+ URL url = new URL(baseURL +
"?path=/jaxws-samples-wsse-policy-sign-encrypt-gcm&method=testSignEncryptUsingConfigProperties&helper="
+ SignEncryptHelper.class.getName());
assertEquals("1", IOUtils.readAndCloseStream(url.openStream()));
}
}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -21,13 +21,23 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse.policy.basic;
+import java.io.File;
import java.net.URL;
-import junit.framework.Test;
-
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.WebArchive;
import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy sign & encrypt test case
@@ -35,41 +45,100 @@
* @author alessio.soldano(a)jboss.com
* @since 29-Apr-2011
*/
+(a)RunWith(Arquillian.class)
public final class SignEncryptTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-sign-encrypt";
+ private static final String WS_DEPLOYMENT =
"jaxws-samples-wsse-policy-sign-encrypt";
+ private static final String SERVLET_DEPLOYMENT =
"jaxws-samples-wsse-policy-sign-encrypt-client";
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(SignEncryptTestCase.class,
- SignEncryptDeploymentArchives.CLIENT_JAR + " " +
SignEncryptDeploymentArchives.CLIENT_WAR + " " +
SignEncryptDeploymentArchives.SERVER_WAR);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(name = WS_DEPLOYMENT, testable = false)
+ public static WebArchive createDeployment1() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, WS_DEPLOYMENT +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/bob.jks"),
"classes/bob.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/bob.properties"),
"classes/bob.properties")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/WEB-INF/web.xml"));
+ return archive;
}
-
+
+ @Deployment(name = SERVLET_DEPLOYMENT, testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-sign-encrypt-client.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client
services\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.SignEncryptHelper.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.CryptoHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.properties"),
"classes/META-INF/alice.properties")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.jks"),
"classes/META-INF/alice.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/jaxws-client-config.xml"),
"classes/META-INF/jaxws-client-config.xml");
+ return archive;
+ }
+
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("SignEncryptTestCase-client.jar") { {
+ archive
+ .addManifest()
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.jks"),
"alice.jks")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/alice.properties"),
"alice.properties")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign-encrypt/META-INF/jaxws-client-config.xml"),
"jaxws-client-config.xml");
+ }
+ });
+ }
+
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
+ @OperateOnDeployment(WS_DEPLOYMENT)
public void testClientSide() throws Exception
{
SignEncryptHelper helper = new SignEncryptHelper();
- helper.setTargetEndpoint(serviceURL);
+ helper.setTargetEndpoint(baseURL +
"/jaxws-samples-wsse-policy-sign-encrypt");
assertTrue(helper.testSignEncrypt());
}
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
+ @OperateOnDeployment(WS_DEPLOYMENT)
public void testClientSideUsingConfigProperties() throws Exception
{
SignEncryptHelper helper = new SignEncryptHelper();
- helper.setTargetEndpoint(serviceURL);
+ helper.setTargetEndpoint(baseURL +
"/jaxws-samples-wsse-policy-sign-encrypt");
assertTrue(helper.testSignEncryptUsingConfigProperties());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVLET_DEPLOYMENT)
public void testServerSide() throws Exception
{
- URL url = new URL("http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-sign-encrypt-client?" +
-
"path=/jaxws-samples-wsse-policy-sign-encrypt&method=testSignEncrypt&helper="
+ SignEncryptHelper.class.getName());
+ URL url = new URL(baseURL +
"?path=/jaxws-samples-wsse-policy-sign-encrypt&method=testSignEncrypt&helper="
+ SignEncryptHelper.class.getName());
assertEquals("1", IOUtils.readAndCloseStream(url.openStream()));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVLET_DEPLOYMENT)
public void testServerSideUsingConfigProperties() throws Exception
{
- URL url = new URL("http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-sign-encrypt-client?" +
-
"path=/jaxws-samples-wsse-policy-sign-encrypt&method=testSignEncryptUsingConfigProperties&helper="
+ SignEncryptHelper.class.getName());
+ URL url = new URL(baseURL +
"?path=/jaxws-samples-wsse-policy-sign-encrypt&method=testSignEncryptUsingConfigProperties&helper="
+ SignEncryptHelper.class.getName());
assertEquals("1", IOUtils.readAndCloseStream(url.openStream()));
}
}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -23,21 +23,26 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy sign test case
@@ -45,72 +50,85 @@
* @author alessio.soldano(a)jboss.com
* @since 29-Apr-2011
*/
+(a)RunWith(Arquillian.class)
public final class SignTestCase extends JBossWSTest
{
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-sign-ejb.jar") { {
+ private static final String POJO_DEPLOYMENT =
"jaxws-samples-wsse-policy-sign";
+ private static final String EJB3_DEPLOYMENT =
"jaxws-samples-wsse-policy-sign-ejb";
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(name = POJO_DEPLOYMENT, testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, POJO_DEPLOYMENT +
".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/bob.jks"),
"classes/bob.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/bob.properties"),
"classes/bob.properties")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/web.xml"));
+ return archive;
+ }
+
+ @Deployment(name = EJB3_DEPLOYMENT, testable = false)
+ public static JavaArchive createDeployment2() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class, EJB3_DEPLOYMENT +
".jar");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.EJBServiceImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/bob.jks"),
"bob.jks")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/bob.properties"),
"bob.properties")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd");
+ return archive;
+ }
+
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-sign-client.jar") {
{
archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.EJBServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/bob.jks"),
"bob.jks")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/bob.properties"),
"bob.properties")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF-server/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd");
- }
- });
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-sign.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/bob.jks"),
"classes/bob.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/bob.properties"),
"classes/bob.properties")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/WEB-INF/web.xml"));
- }
- });
- list.add(new
JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-sign-client.jar") {
{
- archive
.addManifest()
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF/alice.jks"),
"alice.jks")
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/sign/META-INF/alice.properties"),
"alice.properties");
}
});
- return list.toArray(new BaseDeployment<?>[list.size()]);
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(SignTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
+ @OperateOnDeployment(POJO_DEPLOYMENT)
public void test() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-sign?wsdl");
+ URL wsdlURL = new URL(baseURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy);
assertEquals("Secure Hello World!", proxy.sayHello());
}
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
+ @OperateOnDeployment(EJB3_DEPLOYMENT)
public void testEJB() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-sign-ejb/SecurityService/EJBServiceImpl?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-sign-ejb/SecurityService/EJBServiceImpl?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy);
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/UsernameOverTransportTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/UsernameOverTransportTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/UsernameOverTransportTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -23,24 +23,23 @@
import java.io.File;
import java.net.URL;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
-import org.jboss.wsf.test.JBossWSTestSetup;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy username test case (using secure transport)
@@ -48,61 +47,54 @@
* @author alessio.soldano(a)jboss.com
* @since 29-Apr-2011
*/
+(a)RunWith(Arquillian.class)
public final class UsernameOverTransportTestCase extends JBossWSTest
{
- private final String serviceURL = "https://" + getServerHost() +
":8443/jaxws-samples-wsse-policy-username";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-username.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServerUsernamePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-username.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServerUsernamePasswordCallback.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username/WEB-INF/web.xml"));
+ return archive;
}
-
- public static Test suite()
- {
- /** System properties - currently set at testsuite start time
- System.setProperty("javax.net.ssl.trustStore",
"my.truststore");
- System.setProperty("javax.net.ssl.trustStorePassword",
"changeit");
- System.setProperty("javax.net.ssl.trustStoreType", "jks");
- System.setProperty("org.jboss.security.ignoreHttpsHost",
"true");
- */
- JBossWSTestSetup setup = new
JBossWSCXFTestSetup(UsernameOverTransportTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- Map<String, String> sslOptions = new HashMap<String, String>();
- sslOptions.put("server-identity.ssl.keystore-path",
System.getProperty("org.jboss.ws.testsuite.server.keystore"));
- sslOptions.put("server-identity.ssl.keystore-password",
"changeit");
- sslOptions.put("server-identity.ssl.alias", "tomcat");
- setup.setHttpsConnectorRequirement(sslOptions);
- return setup;
- }
+ /** System properties - currently set at testsuite start time
+ System.setProperty("javax.net.ssl.trustStore", "my.truststore");
+ System.setProperty("javax.net.ssl.trustStorePassword",
"changeit");
+ System.setProperty("javax.net.ssl.trustStoreType", "jks");
+ System.setProperty("org.jboss.security.ignoreHttpsHost", "true");
+ */
+
+ @Test
+ @RunAsClient
public void test() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = getServiceWSDLURL();
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
assertEquals("Secure Hello World!", proxy.sayHello());
}
+ @Test
+ @RunAsClient
public void testWrongPassword() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = getServiceWSDLURL();
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "snoopy");
@@ -116,6 +108,11 @@
//OK
}
}
+
+ private URL getServiceWSDLURL() throws Exception {
+ final int offset = baseURL.getPort() - 8080;
+ return new URL("https", baseURL.getHost(), (8443 + offset),
"/jaxws-samples-wsse-policy-username?wsdl");
+ }
private void setupWsse(ServiceIface proxy, String username)
{
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/UsernameTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/UsernameTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/UsernameTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -23,21 +23,23 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy username test case
@@ -45,53 +47,50 @@
* @author alessio.soldano(a)jboss.com
* @since 29-Apr-2011
*/
+(a)RunWith(Arquillian.class)
public final class UsernameTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-username-unsecure-transport/service";
- private final String javaFirstServiceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-username-unsecure-transport/javafirst-service";
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-username-unsecure-transport.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.JavaFirstServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.JavaFirstServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServerUsernamePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/JavaFirstPolicy.xml"),
"classes/JavaFirstPolicy.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-username-unsecure-transport.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.JavaFirstServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.JavaFirstServiceImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServerUsernamePasswordCallback.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.basic.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/JavaFirstPolicy.xml"),
"classes/JavaFirstPolicy.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/basic/username-unsecure-transport/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(UsernameTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void test() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/service?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse((BindingProvider)proxy, "kermit");
assertEquals("Secure Hello World!", proxy.sayHello());
}
+ @Test
+ @RunAsClient
public void testWrongPassword() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/service?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse((BindingProvider)proxy, "snoopy");
@@ -106,10 +105,12 @@
}
}
+ @Test
+ @RunAsClient
public void testNoCBH() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/service?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsseNoCBH((BindingProvider)proxy, "kermit", "thefrog");
@@ -126,20 +127,24 @@
}
}
+ @Test
+ @RunAsClient
public void testJavaFirst() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"JavaFirstSecurityService");
- URL wsdlURL = new URL(javaFirstServiceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/javafirst-service?wsdl");
Service service = Service.create(wsdlURL, serviceName);
JavaFirstServiceIface proxy =
(JavaFirstServiceIface)service.getPort(JavaFirstServiceIface.class);
setupWsse((BindingProvider)proxy, "kermit");
assertEquals("Secure Hello World!", proxy.sayHello());
}
+ @Test
+ @RunAsClient
public void testJavaFirstWrongPassword() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"JavaFirstSecurityService");
- URL wsdlURL = new URL(javaFirstServiceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "/javafirst-service?wsdl");
Service service = Service.create(wsdlURL, serviceName);
JavaFirstServiceIface proxy =
(JavaFirstServiceIface)service.getPort(JavaFirstServiceIface.class);
setupWsse((BindingProvider)proxy, "snoopy");
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/EJBDigestServiceImpl.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/EJBDigestServiceImpl.java
(rev 0)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/EJBDigestServiceImpl.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.jaas;
+
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.Stateless;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+import org.apache.cxf.interceptor.InInterceptors;
+import org.jboss.logging.Logger;
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ws.api.annotation.EndpointConfig;
+
+
+@Stateless(name = "EjbEndpoint")
+@WebService
+(
+ portName = "SecurityServicePort",
+ serviceName = "SecurityService",
+ wsdlLocation = "META-INF/wsdl/SecurityService.wsdl",
+ targetNamespace =
"http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
+ endpointInterface =
"org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceIface"
+)
+@SecurityDomain("JBossWSDigest")
+@EndpointConfig(configFile = "META-INF/jaxws-endpoint-config.xml", configName =
"Custom WS-Security Endpoint")
+public class EJBDigestServiceImpl
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(EJBDigestServiceImpl.class);
+
+ @WebMethod
+ @RolesAllowed("friend")
+ public String sayHello()
+ {
+ log.info("Saying hello");
+ return "Secure Hello World!";
+ }
+
+ @WebMethod
+ @RolesAllowed("snoopies")
+ public String greetMe()
+ {
+ log.info("Greeting");
+ return "Greetings!";
+ }
+}
Property changes on:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/EJBDigestServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationDigestEjbTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationDigestEjbTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationDigestEjbTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -24,10 +24,7 @@
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -37,15 +34,18 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.wsf.stack.cxf.security.authentication.callback.UsernameTokenCallback;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy username ejb endpoint test case leveraging JAAS container
integration and using digest passwords.
@@ -55,67 +55,51 @@
* @author <a href="mailto:ema@redhat.com"/>Jim Ma<a>
* @since 26-May-2011
*/
+(a)RunWith(Arquillian.class)
public final class UsernameAuthorizationDigestEjbTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-username-jaas-ejb-digest/SecurityService/EJBServiceImpl";
- private QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
-
- public static BaseDeployment<?>[] createDeployments()
- {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-username-jaas-ejb-digest.jar")
{
- { //[JBWS-3843] workaround: add org.jboss.as.webservices.server.integration
dependency to load UsernameTokenCallback for UsernamePasswordLoginModule
- // This dependency should actually never be set for a user deployment, being
it an internal server thing. To be properly replaced after changes in PicketBox.
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n" +
"Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.jboss.as.webservices.server.integration\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.EJBServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsManifestResource(
- new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb-digest/META-INF/jaxws-endpoint-config.xml"),
- "jaxws-endpoint-config.xml")
- .addAsManifestResource(
- new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb-digest/META-INF/wsdl/SecurityService.wsdl"),
- "wsdl/SecurityService.wsdl")
- .addAsManifestResource(
- new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb-digest/META-INF/wsdl/SecurityService_schema1.xsd"),
- "wsdl/SecurityService_schema1.xsd");
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static JavaArchive createDeployment() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class,
"jaxws-samples-wsse-policy-username-jaas-ejb-digest.jar");
+ //[JBWS-3843] workaround: add org.jboss.as.webservices.server.integration
dependency to load UsernameTokenCallback for UsernamePasswordLoginModule
+ // This dependency should actually never be set for a user deployment, being it an
internal server thing. To be properly replaced after changes in PicketBox.
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n" +
"Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.jboss.as.webservices.server.integration\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.EJBDigestServiceImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsManifestResource(
+ new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb-digest/META-INF/jaxws-endpoint-config.xml"),
+ "jaxws-endpoint-config.xml")
+ .addAsManifestResource(
+ new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb-digest/META-INF/wsdl/SecurityService.wsdl"),
+ "wsdl/SecurityService.wsdl")
+ .addAsManifestResource(
+ new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb-digest/META-INF/wsdl/SecurityService_schema1.xsd"),
+ "wsdl/SecurityService_schema1.xsd");
+ return archive;
}
-
- public static Test suite()
- {
- JBossWSCXFTestSetup testSetup;
- testSetup = new JBossWSCXFTestSetup(UsernameAuthorizationDigestEjbTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- Map<String, String> authenticationOptions = new HashMap<String,
String>();
- authenticationOptions.put("usersProperties",
getResourceFile("jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jbossws-users.properties").getAbsolutePath());
- authenticationOptions.put("rolesProperties",
getResourceFile("jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jbossws-roles.properties").getAbsolutePath());
- authenticationOptions.put("hashAlgorithm", "SHA");
- authenticationOptions.put("hashEncoding", "BASE64");
- authenticationOptions.put("hashCharset", "UTF-8");
- authenticationOptions.put("hashUserPassword", "false");
- authenticationOptions.put("hashStorePassword", "true");
- authenticationOptions.put("storeDigestCallback",
UsernameTokenCallback.class.getName());
- authenticationOptions.put("unauthenticatedIdentity",
"anonymous");
- testSetup.addSecurityDomainRequirement("JBossWS",
authenticationOptions);
- return testSetup;
- }
-
+
+ @Test
+ @RunAsClient
public void test() throws Exception
{
- URL wsdlURL = new URL(serviceURL + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas-ejb-digest/SecurityService/EJBDigestServiceImpl?wsdl");
+ Service service = Service.create(wsdlURL, new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService"));
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
assertEquals("Secure Hello World!", proxy.sayHello());
}
//JBWS-3843
+ @Test
+ @RunAsClient
public void testConcurrent() throws Exception
{
ExecutorService executor = Executors.newFixedThreadPool(20);
@@ -135,12 +119,12 @@
}
- public class TestRunner implements Callable<String>
+ private class TestRunner implements Callable<String>
{
public String call() throws Exception
{
- URL wsdlURL = new URL(serviceURL + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas-ejb-digest/SecurityService/EJBDigestServiceImpl?wsdl");
+ Service service = Service.create(wsdlURL, new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService"));
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
return proxy.sayHello();
@@ -149,10 +133,12 @@
}
+ @Test
+ @RunAsClient
public void testUnauthenticated() throws Exception
{
- URL wsdlURL = new URL(serviceURL + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas-ejb-digest/SecurityService/EJBDigestServiceImpl?wsdl");
+ Service service = Service.create(wsdlURL, new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService"));
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
try
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationDigestTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationDigestTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationDigestTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -23,24 +23,23 @@
import java.io.File;
import java.net.URL;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.wsf.stack.cxf.security.authentication.callback.UsernameTokenCallback;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy username test case leveraging JAAS container integration and using
digest passwords.
@@ -49,67 +48,50 @@
* @author alessio.soldano(a)jboss.com
* @since 26-May-2011
*/
+(a)RunWith(Arquillian.class)
public final class UsernameAuthorizationDigestTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-username-jaas-digest";
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-username-jaas-digest.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n")) //cxf impl required due
to custom interceptor in deployment
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.POJOEndpointAuthorizationInterceptor.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jboss-web.xml"),
"jboss-web.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-username-jaas-digest.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n")) //cxf impl required due
to custom interceptor in deployment
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.POJOEndpointAuthorizationInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jboss-web.xml"),
"jboss-web.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- JBossWSCXFTestSetup testSetup;
- testSetup = new JBossWSCXFTestSetup(UsernameAuthorizationDigestTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
- Map<String, String> authenticationOptions = new HashMap<String,
String>();
- authenticationOptions.put("usersProperties",
-
getResourceFile("jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jbossws-users.properties").getAbsolutePath());
- authenticationOptions.put("rolesProperties",
-
getResourceFile("jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jbossws-roles.properties").getAbsolutePath());
- authenticationOptions.put("hashAlgorithm", "SHA");
- authenticationOptions.put("hashEncoding", "BASE64");
- authenticationOptions.put("hashCharset", "UTF-8");
- authenticationOptions.put("hashUserPassword", "false");
- authenticationOptions.put("hashStorePassword", "true");
- authenticationOptions.put("storeDigestCallback",
UsernameTokenCallback.class.getName());
- authenticationOptions.put("unauthenticatedIdentity",
"anonymous");
- testSetup.addSecurityDomainRequirement("JBossWSDigest",
authenticationOptions);
- return testSetup;
- }
-
+ @Test
+ @RunAsClient
public void test() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas-digest?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
assertEquals("Secure Hello World!", proxy.sayHello());
}
+ @Test
+ @RunAsClient
public void testUnauthenticated() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas-digest?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "snoopy");
@@ -124,10 +106,12 @@
}
}
+ @Test
+ @RunAsClient
public void testUnauthorized() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas-digest?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationEJBTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationEJBTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationEJBTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -23,21 +23,23 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-SecurityPolicy (v.1.2) UT testcase with JAAS integration (EJB3)
@@ -45,49 +47,47 @@
* @author alessio.soldano(a)jboss.com
* @since 26-May-2011
*/
+(a)RunWith(Arquillian.class)
public class UsernameAuthorizationEJBTestCase extends JBossWSTest
{
- public final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-username-jaas-ejb/SecurityService/EJBServiceImpl";
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-username-jaas-ejb.jar")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.EJBServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb/META-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb/META-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb/META-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd");
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static JavaArchive createDeployment() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class,
"jaxws-samples-wsse-policy-username-jaas-ejb.jar");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.EJBServiceImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb/META-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb/META-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/ejb/META-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd");
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(UsernameAuthorizationEJBTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()), true);
- }
-
+ @Test
+ @RunAsClient
public void test() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas-ejb/SecurityService/EJBServiceImpl?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
assertEquals("Secure Hello World!", proxy.sayHello());
}
+ @Test
+ @RunAsClient
public void testUnauthenticated() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas-ejb/SecurityService/EJBServiceImpl?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "snoopy");
@@ -102,10 +102,12 @@
}
}
+ @Test
+ @RunAsClient
public void testUnauthorized() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas-ejb/SecurityService/EJBServiceImpl?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaas/UsernameAuthorizationTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -23,21 +23,23 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
-import org.jboss.wsf.test.JBossWSTestHelper.BaseDeployment;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy username test case leveraging JAAS container integration.
@@ -46,52 +48,51 @@
* @author alessio.soldano(a)jboss.com
* @since 26-May-2011
*/
+(a)RunWith(Arquillian.class)
public final class UsernameAuthorizationTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-username-jaas";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-username-jaas.war") {
{
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n")) //cxf impl required due
to custom interceptor in deployment
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.POJOEndpointAuthorizationInterceptor.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/jboss-web.xml"),
"jboss-web.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-username-jaas.war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n")) //cxf impl required due
to custom interceptor in deployment
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.POJOEndpointAuthorizationInterceptor.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaas.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/jboss-web.xml"),
"jboss-web.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaas/auth/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(UsernameAuthorizationTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()), true);
- }
-
+ @Test
+ @RunAsClient
public void test() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
assertEquals("Secure Hello World!", proxy.sayHello());
}
+ @Test
+ @RunAsClient
public void testUnauthenticated() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "snoopy");
@@ -106,10 +107,12 @@
}
}
+ @Test
+ @RunAsClient
public void testUnauthorized() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jaas?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaspi/JaspiAuthenticationTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaspi/JaspiAuthenticationTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/jaspi/JaspiAuthenticationTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -23,132 +23,102 @@
import java.io.File;
import java.net.URL;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import javax.security.auth.login.Configuration;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.security.auth.login.XMLLoginConfigImpl;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.ws.common.IOUtils;
-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;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* TestCase to demonstrate jaspi authentication
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*/
+(a)RunWith(Arquillian.class)
public final class JaspiAuthenticationTestCase extends JBossWSTest
{
- private final String serviceEndpointURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-username-endpoint-jaspi";
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-username-jbws-jaspi";
+ private static final String DEP_EP_JASPI =
"jaxws-samples-wsse-policy-username-endpoint-jaspi";
+ private static final String DEP_JBWS_JASPI =
"jaxws-samples-wsse-policy-username-jbws-jaspi";
+ private static final String DEP_CLIENT =
"jaxws-samples-wsse-policy-username-jaspi-client";
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-username-jbws-jaspi.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF2/jboss-webservices.xml"),
"jboss-webservices.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF2/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF2/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF2/web.xml"));
- }
- });
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-username-jaspi-client.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n"))
- .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/META-INF/jaxws-client-config.xml"),
"META-INF/jaxws-client-config.xml")
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.Helper.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.UsernamePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addClass(org.jboss.wsf.test.ClientHelper.class)
- .addClass(org.jboss.wsf.test.TestServlet.class);
- }
- });
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-username-endpoint-jaspi.war")
{ {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceEndpointImpl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceIface.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(name = DEP_JBWS_JASPI, testable = false)
+ public static WebArchive createDeployment1() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-username-jbws-jaspi.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF2/jboss-webservices.xml"),
"jboss-webservices.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF2/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF2/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF2/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- TestSetup testSetup = new JBossWSCXFTestSetup(JaspiAuthenticationTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments())) {
+ @Deployment(name = DEP_CLIENT, testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-username-jaspi-client.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n"))
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/META-INF/jaxws-client-config.xml"),
"META-INF/jaxws-client-config.xml")
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.Helper.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceIface.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.UsernamePasswordCallback.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class);
+ return archive;
+ }
- public void setUp() throws Exception
- {
- Map<String, String> loginModuleOptions = new HashMap<String,
String>();
- String usersPropFile =
System.getProperty("org.jboss.ws.testsuite.securityDomain.users.propfile");
- String rolesPropFile =
System.getProperty("org.jboss.ws.testsuite.securityDomain.roles.propfile");
- if (usersPropFile != null)
- {
- loginModuleOptions.put("usersProperties", usersPropFile);
- }
- if (rolesPropFile != null)
- {
- loginModuleOptions.put("rolesProperties", rolesPropFile);
- }
-
- Map<String, String> authModuleOptions = new HashMap<String,
String>();
- JBossWSTestHelper.addJaspiSecurityDomain("jaspi",
"jaas-lm-stack", loginModuleOptions,
"org.jboss.wsf.stack.cxf.jaspi.module.UsernameTokenServerAuthModule",
- authModuleOptions);
- JBossWSTestHelper.addJaspiSecurityDomain("clientJaspi",
"jaas-lm-stack", loginModuleOptions,
"org.jboss.wsf.stack.cxf.jaspi.client.module.SOAPClientAuthModule",
- authModuleOptions);
- super.setUp();
- }
-
- public void tearDown() throws Exception
- {
- JBossWSTestHelper.removeSecurityDomain("jaspi");
- JBossWSTestHelper.removeSecurityDomain("clientJaspi");
- super.tearDown();
-
- }
- };
- return testSetup;
+ @Deployment(name = DEP_EP_JASPI, testable = false)
+ public static WebArchive createDeployment3() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-username-endpoint-jaspi.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies:
org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl\n"))
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceEndpointImpl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaspi.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMe.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.GreetMeResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF/jaxws-endpoint-config.xml"),
"jaxws-endpoint-config.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF/wsdl/SecurityService.wsdl"),
"wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/jaspi/WEB-INF/web.xml"));
+ return archive;
}
-
-
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP_JBWS_JASPI)
public void testWebserviceMDEnableAuthenticated() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-jbws-jaspi?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
@@ -156,20 +126,26 @@
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP_EP_JASPI)
public void testEndpointEnableAuthenticated() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceEndpointURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-endpoint-jaspi?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
assertEquals("Secure Hello World!", proxy.sayHello());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP_EP_JASPI)
public void testUnauthenticated() throws Exception
{
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceEndpointURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-endpoint-jaspi?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "snoopy");
@@ -183,6 +159,10 @@
//OK
}
}
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP_EP_JASPI)
public void testClientAuthModule() throws Exception
{
//load client side jaspi config
@@ -194,7 +174,7 @@
xli.loadConfig();
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy",
"SecurityService");
- URL wsdlURL = new URL(serviceEndpointURL + "?wsdl");
+ URL wsdlURL = new URL(baseURL +
"/jaxws-samples-wsse-policy-username-endpoint-jaspi?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
setupWsse(proxy, "kermit");
@@ -202,19 +182,18 @@
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP_CLIENT)
public void testInContainerClientAuthModule() throws Exception
{
- Helper helper = new Helper();
- helper.setTargetEndpoint("http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-username-endpoint-jaspi");
assertEquals("1", runTestInContainer("testJaspiClient"));
}
private String runTestInContainer(String test) throws Exception
{
- URL url = new URL("http://" + getServerHost()
- +
":8080/jaxws-samples-wsse-policy-username-jaspi-client?path=/jaxws-samples-wsse-policy-username-endpoint-jaspi&method="
+ test
- + "&helper=" + Helper.class.getName());
+ URL url = new URL(baseURL +
"?path=/jaxws-samples-wsse-policy-username-endpoint-jaspi&method=" + test +
"&helper=" + Helper.class.getName());
return IOUtils.readAndCloseStream(url.openStream());
}
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/DeploymentArchives.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/DeploymentArchives.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/DeploymentArchives.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -55,27 +55,6 @@
}
});
- public static final String SERVER_21X_WAR = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-oasis-21x.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServerUsernamePasswordCallback.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2111Impl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2112Impl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2113Impl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2121Impl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service213Impl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service214Impl.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServiceIface.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/WEB-INF/bob.jks"),
"classes/bob.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/WEB-INF/bob.properties"),
"classes/bob.properties")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService21x.wsdl"),
"wsdl/SecurityService21x.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd");
- }
- });
-
public static final String SERVER_23X_WAR = JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-oasis-23x.war") { {
archive
.setManifest(new StringAsset("Manifest-Version: 1.0\n"
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples21xTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples21xTestCase.java 2014-11-19
13:50:36 UTC (rev 19108)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples21xTestCase.java 2014-11-20
20:56:33 UTC (rev 19109)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -21,19 +21,26 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse.policy.oasis;
+import java.io.File;
import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.ws.security.SecurityConstants;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+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.WebArchive;
import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy examples
@@ -44,39 +51,59 @@
* @author alessio.soldano(a)jboss.com
* @since 10-Sep-2012
*/
+(a)RunWith(Arquillian.class)
public final class WSSecurityPolicyExamples21xTestCase extends JBossWSTest
{
private final String NS =
"http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy/oasis-samples";
- private final String serviceURL = "http://" + getServerHost() +
":8080/jaxws-samples-wsse-policy-oasis-21x/";
- private final String serviceURLHttps = "https://" + getServerHost() +
":8443/jaxws-samples-wsse-policy-oasis-21x/";
private final QName serviceName = new QName(NS, "SecurityService");
- public static Test suite()
- {
- /** System properties - currently set at testsuite start time
- System.setProperty("javax.net.ssl.trustStore",
"my.truststore");
- System.setProperty("javax.net.ssl.trustStorePassword",
"changeit");
- System.setProperty("javax.net.ssl.trustStoreType", "jks");
- System.setProperty("org.jboss.security.ignoreHttpsHost",
"true");
- */
- JBossWSCXFTestSetup setup = new
JBossWSCXFTestSetup(WSSecurityPolicyExamples21xTestCase.class,
- DeploymentArchives.SERVER_21X_WAR + " " +
DeploymentArchives.CLIENT_JAR);
- Map<String, String> sslOptions = new HashMap<String, String>();
- sslOptions.put("server-identity.ssl.keystore-path",
System.getProperty("org.jboss.ws.testsuite.server.keystore"));
- sslOptions.put("server-identity.ssl.keystore-password",
"changeit");
- sslOptions.put("server-identity.ssl.alias", "tomcat");
- setup.setHttpsConnectorRequirement(sslOptions);
- return setup;
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-wsse-policy-oasis-21x.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client\n"))
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHello.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServerUsernamePasswordCallback.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2111Impl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2112Impl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2113Impl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2121Impl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service213Impl.class)
+
.addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service214Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServiceIface.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/WEB-INF/bob.jks"),
"classes/bob.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/WEB-INF/bob.properties"),
"classes/bob.properties")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService21x.wsdl"),
"wsdl/SecurityService21x.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService_schema1.xsd"),
"wsdl/SecurityService_schema1.xsd");
+ return archive;
}
-
+
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-oasis-21x-client.jar")
{ {
+ archive
+ .addManifest()
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/META-INF/alice.jks"), "alice.jks")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/wsse/policy/oasis/META-INF/alice.properties"),
"alice.properties");
+ }
+ });
+ }
+
/**
* 2.1.1.1 UsernameToken with plain text password
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2111() throws Exception
{
- Service service = Service.create(new URL(serviceURL +
"SecurityService2111?wsdl"), serviceName);
+ Service service = Service.create(new URL(baseURL +
"/SecurityService2111?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS,
"SecurityService2111Port"), ServiceIface.class);
setupWsse(proxy, true);
assertTrue(proxy.sayHello().equals("Hello - UsernameToken with plain text
password"));
@@ -87,9 +114,12 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2112() throws Exception
{
- Service service = Service.create(new URL(serviceURL +
"SecurityService2112?wsdl"), serviceName);
+ Service service = Service.create(new URL(baseURL +
"/SecurityService2112?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS,
"SecurityService2112Port"), ServiceIface.class);
setupWsse(proxy, false);
assertTrue(proxy.sayHello().equals("Hello - UsernameToken without
password"));
@@ -100,9 +130,12 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2113() throws Exception
{
- Service service = Service.create(new URL(serviceURL +
"SecurityService2113?wsdl"), serviceName);
+ Service service = Service.create(new URL(baseURL +
"/SecurityService2113?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS,
"SecurityService2113Port"), ServiceIface.class);
setupWsse(proxy, true);
assertTrue(proxy.sayHello().equals("Hello - UsernameToken with timestamp,
nonce and password hash"));
@@ -113,9 +146,12 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2121() throws Exception
{
- Service service = Service.create(new URL(serviceURLHttps +
"SecurityService2121?wsdl"), serviceName);
+ Service service = Service.create(new URL("https", baseURL.getHost(),
(baseURL.getPort() - 8080 + 8443),
"/jaxws-samples-wsse-policy-oasis-21x/SecurityService2121?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS,
"SecurityService2121Port"), ServiceIface.class);
setupWsse(proxy, false);
assertTrue(proxy.sayHello().equals("Hello - UsernameToken as supporting
token"));
@@ -126,9 +162,12 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test213() throws Exception
{
- Service service = Service.create(new URL(serviceURL +
"SecurityService213?wsdl"), serviceName);
+ Service service = Service.create(new URL(baseURL +
"/SecurityService213?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS,
"SecurityService213Port"), ServiceIface.class);
setupWsse(proxy, true);
assertTrue(proxy.sayHello().equals("Hello - (WSS 1.0) UsernameToken with
Mutual X.509v3 Authentication, Sign, Encrypt"));
@@ -139,14 +178,17 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test214() throws Exception
{
- Service service = Service.create(new URL(serviceURL +
"SecurityService214?wsdl"), serviceName);
+ Service service = Service.create(new URL(baseURL +
"/SecurityService214?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS,
"SecurityService214Port"), ServiceIface.class);
setupWsse(proxy, false);
assertTrue(proxy.sayHello().equals("Hello - (WSS 1.1) User Name with
Certificates, Sign, Encrypt"));
}
-
+
private void setupWsse(ServiceIface proxy, boolean streaming)
{
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.USERNAME,
"kermit");
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy
(rev 0)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy 2014-11-20
20:56:33 UTC (rev 19109)
@@ -0,0 +1,133 @@
+def root = new XmlParser().parse(project.properties['inputFile'])
+
+/**
+ * Add a security-domain block like this:
+ *
+ * <security-domain name="JBossWS" cache-type="default">
+ * <authentication>
+ * <login-module code="UsersRoles" flag="required">
+ * <module-option name="usersProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/jbossws-users.properties"/>
+ * <module-option name="unauthenticatedIdentity"
value="anonymous"/>
+ * <module-option name="rolesProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/jbossws-roles.properties"/>
+ * </login-module>
+ * </authentication>
+ * </security-domain>
+ *
+ */
+
+def securityDomains = root.profile.subsystem.'security-domains'[0]
+def securityDomain = securityDomains.appendNode('security-domain',
['name':'JBossWS','cache-type':'default'])
+def authentication = securityDomain.appendNode('authentication')
+def loginModule = authentication.appendNode('login-module',
['code':'UsersRoles','flag':'required'])
+loginModule.appendNode('module-option',
['name':'unauthenticatedIdentity','value':'anonymous'])
+loginModule.appendNode('module-option',
['name':'usersProperties','value':project.properties['usersPropFile']])
+loginModule.appendNode('module-option',
['name':'rolesProperties','value':project.properties['rolesPropFile']])
+
+/**
+ * Add a security-domain block like this:
+ *
+ * <security-domain name="JBossWSDigest" cache-type="default">
+ * <authentication>
+ * <login-module code="UsersRoles" flag="required">
+ * <module-option name="hashUserPassword"
value="false"/>
+ * <module-option name="hashCharset" value="UTF-8"/>
+ * <module-option name="usersProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-resources/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jbossws-users.properties"/>
+ * <module-option name="hashAlgorithm" value="SHA"/>
+ * <module-option name="unauthenticatedIdentity"
value="anonymous"/>
+ * <module-option name="hashEncoding" value="BASE64"/>
+ * <module-option name="rolesProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-resources/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jbossws-roles.properties"/>
+ * <module-option name="storeDigestCallback"
value="org.jboss.wsf.stack.cxf.security.authentication.callback.UsernameTokenCallback"/>
+ * <module-option name="hashStorePassword"
value="true"/>
+ * </login-module>
+ * </authentication>
+ * </security-domain>
+ *
+ */
+
+def securityDomainDigest = securityDomains.appendNode('security-domain',
['name':'JBossWSDigest','cache-type':'default'])
+def authenticationDigest = securityDomainDigest.appendNode('authentication')
+def loginModuleDigest = authenticationDigest.appendNode('login-module',
['code':'UsersRoles','flag':'required'])
+loginModuleDigest.appendNode('module-option',
['name':'hashUserPassword','value':'false'])
+loginModuleDigest.appendNode('module-option',
['name':'hashCharset','value':'UTF-8'])
+loginModuleDigest.appendNode('module-option',
['name':'hashAlgorithm','value':'SHA'])
+loginModuleDigest.appendNode('module-option',
['name':'hashEncoding','value':'BASE64'])
+loginModuleDigest.appendNode('module-option',
['name':'storeDigestCallback','value':'org.jboss.wsf.stack.cxf.security.authentication.callback.UsernameTokenCallback'])
+loginModuleDigest.appendNode('module-option',
['name':'hashStorePassword','value':'true'])
+loginModuleDigest.appendNode('module-option',
['name':'unauthenticatedIdentity','value':'anonymous'])
+loginModuleDigest.appendNode('module-option',
['name':'usersProperties','value':project.properties['testResourcesDir']
+ '/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jbossws-users.properties'])
+loginModuleDigest.appendNode('module-option',
['name':'rolesProperties','value':project.properties['testResourcesDir']
+ '/jaxws/samples/wsse/policy/jaas/digest/WEB-INF/jbossws-roles.properties'])
+
+/**
+ * Add two security-domain blocks for JASPI tests as below:
+ *
+ * <security-domain name="jaspi">
+ * <authentication-jaspi>
+ * <login-module-stack name="jaas-lm-stack">
+ * <login-module code="UsersRoles" flag="required">
+ * <module-option name="usersProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/jbossws-users.properties"/>
+ * <module-option name="rolesProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/jbossws-roles.properties"/>
+ * </login-module>
+ * </login-module-stack>
+ * <auth-module
code="org.jboss.wsf.stack.cxf.jaspi.module.UsernameTokenServerAuthModule"
login-module-stack-ref="jaas-lm-stack"/>
+ * </authentication-jaspi>
+ * </security-domain>
+ * <security-domain name="clientJaspi">
+ * <authentication-jaspi>
+ * <login-module-stack name="jaas-lm-stack">
+ * <login-module code="UsersRoles" flag="required">
+ * <module-option name="usersProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/jbossws-users.properties"/>
+ * <module-option name="rolesProperties"
value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/jbossws-roles.properties"/>
+ * </login-module>
+ * </login-module-stack>
+ * <auth-module
code="org.jboss.wsf.stack.cxf.jaspi.client.module.SOAPClientAuthModule"
login-module-stack-ref="jaas-lm-stack"/>
+ * </authentication-jaspi>
+ */
+
+def securityDomainJaspi = securityDomains.appendNode('security-domain',
['name':'jaspi'])
+def authenticationJaspi = securityDomainJaspi.appendNode('authentication-jaspi')
+def loginModuleStack = authenticationJaspi.appendNode('login-module-stack',
['name':'jaas-lm-stack'])
+def loginModuleJaspi = loginModuleStack.appendNode('login-module',
['code':'UsersRoles','flag':'required'])
+loginModuleJaspi.appendNode('module-option',
['name':'usersProperties','value':project.properties['usersPropFile']])
+loginModuleJaspi.appendNode('module-option',
['name':'rolesProperties','value':project.properties['rolesPropFile']])
+authenticationJaspi.appendNode('auth-module',
['code':'org.jboss.wsf.stack.cxf.jaspi.module.UsernameTokenServerAuthModule','login-module-stack-ref':'jaas-lm-stack'])
+
+def securityDomainJaspiClient = securityDomains.appendNode('security-domain',
['name':'clientJaspi'])
+def authenticationJaspiClient =
securityDomainJaspiClient.appendNode('authentication-jaspi')
+def loginModuleStackClient =
authenticationJaspiClient.appendNode('login-module-stack',
['name':'jaas-lm-stack'])
+def loginModuleJaspiClient = loginModuleStackClient.appendNode('login-module',
['code':'UsersRoles','flag':'required'])
+loginModuleJaspiClient.appendNode('module-option',
['name':'usersProperties','value':project.properties['usersPropFile']])
+loginModuleJaspiClient.appendNode('module-option',
['name':'rolesProperties','value':project.properties['rolesPropFile']])
+authenticationJaspiClient.appendNode('auth-module',
['code':'org.jboss.wsf.stack.cxf.jaspi.client.module.SOAPClientAuthModule','login-module-stack-ref':'jaas-lm-stack'])
+
+/**
+ * Add a https connector like this:
+ *
+ * <security-realm name="jbws-test-https-realm">
+ * <server-identities>
+ * <ssl>
+ * <keystore
path="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/test.keystore"
keystore-password="changeit" alias="tomcat"/>
+ * </ssl>
+ * </server-identities>
+ * </security-realm>
+ *
+ */
+
+def securityRealms = root.management.'security-realms'[0]
+def securityRealm = securityRealms.appendNode('security-realm',
['name':'jbws-test-https-realm'])
+def serverIdentities = securityRealm.appendNode('server-identities')
+def ssl = serverIdentities.appendNode('ssl')
+ssl.appendNode('keystore',
['path':project.properties['keystorePath'],'keystore-password':'changeit','alias':'tomcat'])
+
+def server = root.profile.subsystem.server[0]
+server.appendNode('https-listener',
['name':'jbws-test-https-listener','socket-binding':'https','security-realm':'jbws-test-https-realm'])
+
+
+/**
+ * Save the configuration to a new file
+ */
+
+def writer = new StringWriter()
+writer.println('<?xml version="1.0"
encoding="UTF-8"?>')
+new XmlNodePrinter(new PrintWriter(writer)).print(root)
+def f = new File(project.properties['outputFile'])
+f.write(writer.toString())
Modified: stack/cxf/branches/arquillian/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/pom.xml 2014-11-19 13:50:36 UTC (rev
19108)
+++ stack/cxf/branches/arquillian/modules/testsuite/pom.xml 2014-11-20 20:56:33 UTC (rev
19109)
@@ -102,6 +102,11 @@
<type>pom</type>
</dependency>
<dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <version>${arquillian.version}</version>
+ </dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
@@ -801,6 +806,25 @@
<artifactId>wildfly-webservices-tests-integration</artifactId>
<version>${jboss.version}</version>
</dependency>
+ <!-- Arquillian container integration -->
+ <dependency>
+ <groupId>org.wildfly.arquillian</groupId>
+ <artifactId>wildfly-arquillian-container-managed</artifactId>
+ <version>1.0.0.Alpha2</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.slf4j</groupId>
+ <artifactId>slf4j-jboss-logmanager</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- LittleProxy depencency declared in this profile as other profiles require
different exclusions -->
<dependency>
<groupId>org.littleshoot</groupId>
Modified: stack/cxf/branches/arquillian/pom.xml
===================================================================
--- stack/cxf/branches/arquillian/pom.xml 2014-11-19 13:50:36 UTC (rev 19108)
+++ stack/cxf/branches/arquillian/pom.xml 2014-11-20 20:56:33 UTC (rev 19109)
@@ -61,9 +61,9 @@
<!-- Properties -->
<properties>
- <jbossws.api.version>1.0.3.CR2</jbossws.api.version>
- <jbossws.spi.version>3.0.0.Beta3</jbossws.spi.version>
- <jbossws.common.version>3.0.0.Beta2</jbossws.common.version>
+ <jbossws.api.version>1.0.3-SNAPSHOT</jbossws.api.version>
+ <jbossws.spi.version>3.0.0-SNAPSHOT</jbossws.spi.version>
+ <jbossws.common.version>3.0.0-SNAPSHOT</jbossws.common.version>
<jbossws.common.tools.version>1.2.1.CR1</jbossws.common.tools.version>
<jbossws.wildfly800.version>5.0.0-SNAPSHOT</jbossws.wildfly800.version>
<jbossws.wildfly810.version>5.0.0-SNAPSHOT</jbossws.wildfly810.version>
@@ -106,6 +106,7 @@
<wstx.version>4.4.1</wstx.version>
<spring.version>3.2.8.RELEASE</spring.version>
<shrinkwrap.version>1.1.3</shrinkwrap.version>
+ <arquillian.version>1.1.2.Final</arquillian.version>
<jaspi.api.version>1.0.0.Alpha1</jaspi.api.version>
<javax.inject.version>1</javax.inject.version>
</properties>
@@ -1479,6 +1480,19 @@
<ignore />
</action>
</pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <versionRange>[1.5,)</versionRange>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>