JBossWS SVN: r19116 - in stack/cxf/branches/jbossws-cxf-4.1.x: modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-11-27 12:40:48 -0500 (Thu, 27 Nov 2014)
New Revision: 19116
Added:
stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.java
Modified:
stack/cxf/branches/jbossws-cxf-4.1.x/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java
stack/cxf/branches/jbossws-cxf-4.1.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java
stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2321Impl.java
stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/wsdl/SecurityService.wsdl
stack/cxf/branches/jbossws-cxf-4.1.x/pom.xml
Log:
Upgrade to Apache CXF 2.7 series and related Apache dependencies + fix for JBWS-3831
Modified: stack/cxf/branches/jbossws-cxf-4.1.x/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.1.x/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java 2014-11-26 17:51:25 UTC (rev 19115)
+++ stack/cxf/branches/jbossws-cxf-4.1.x/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFConsumerImpl.java 2014-11-27 17:40:48 UTC (rev 19116)
@@ -32,25 +32,23 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.tools.FileObject;
import javax.tools.ForwardingJavaFileManager;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaCompiler.CompilationTask;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
+import javax.tools.JavaFileObject.Kind;
import javax.tools.SimpleJavaFileObject;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
-import javax.tools.ToolProvider;
import javax.xml.ws.spi.Provider;
import org.apache.cxf.common.util.Compiler;
import org.apache.cxf.helpers.FileUtils;
+import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolContext;
import org.apache.cxf.tools.wsdlto.WSDLToJava;
@@ -303,7 +301,6 @@
}
}
}
-
/**
* A CXF Compiler that installs a custom JavaFileManager to load JAXWS and JAXB apis from
* the proper JBoss module (the one providing the JAXWS SPI Provider) instead of from the
@@ -312,22 +309,12 @@
private final class JBossModulesAwareCompiler extends Compiler
{
@Override
- protected boolean useJava6Compiler(String[] files) throws Exception
+ protected JavaFileManager wrapJavaFileManager(StandardJavaFileManager standardJavaFileManger)
{
- JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
- StandardJavaFileManager stdFileManager = compiler.getStandardFileManager(null, null, null);
- Iterable<? extends JavaFileObject> fileList = stdFileManager.getJavaFileObjectsFromStrings(Arrays.asList(files));
- JavaFileManager fileManager = new CustomJavaFileManager(stdFileManager);
-
- List<String> args = new ArrayList<String>();
- addArgs(args);
- CompilationTask task = compiler.getTask(null, fileManager, null, args, null, fileList);
- Boolean ret = task.call();
- fileManager.close();
- return ret;
+ return new CustomJavaFileManager(standardJavaFileManger);
}
}
-
+
final class CustomJavaFileManager extends ForwardingJavaFileManager<JavaFileManager>
{
private ClassLoader classLoader = new ClassLoader(Provider.provider().getClass().getClassLoader())
@@ -364,7 +351,7 @@
}
@Override
- public Iterable<JavaFileObject> list(Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse)
+ public Iterable<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse)
throws IOException
{
Iterable<JavaFileObject> result = super.list(location, packageName, kinds, recurse);
@@ -377,7 +364,7 @@
final JavaFileObject obj = it.next();
final String objName = obj.getName();
Class<?> clazz = null;
- final String className = packageName + "." + objName.substring(0, objName.length() - 6);
+ final String className = getFullClassName(packageName, objName);
try
{
clazz = classLoader.loadClass(className);
@@ -416,6 +403,24 @@
return files;
}
}
+
+ private static String getFullClassName(String packageName, String objName)
+ {
+ // * OpenJDK returns objName strings like:
+ // "/usr/java/java-1.6.0-openjdk-1.6.0.0.x86_64/lib/ct.sym(META-INF/sym/rt.jar/java/lang/AbstractMethodError.class)"
+ // * Oracle & IBM JDK return objName strings like:
+ // "AbstractMethodError.class"
+ // ... from either of those we need to get
+ // "java.lang.AbstractMethodError"
+ String cn = objName.substring(0, objName.indexOf(".class"));
+ int startIdx = Math.max(cn.lastIndexOf("."), cn.lastIndexOf("/"));
+ if (startIdx > 0)
+ {
+ cn = cn.substring(startIdx + 1);
+ }
+ // objName.substring(0, objName.length() - 6)
+ return packageName + "." + cn;
+ }
final class JavaFileObjectImpl extends SimpleJavaFileObject
{
Modified: stack/cxf/branches/jbossws-cxf-4.1.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.1.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2014-11-26 17:51:25 UTC (rev 19115)
+++ stack/cxf/branches/jbossws-cxf-4.1.x/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2014-11-27 17:40:48 UTC (rev 19116)
@@ -141,4 +141,9 @@
// filtering not supported, move on
chain.doFilter(request, response);
}
+
+ protected Bus getBus()
+ {
+ return bus;
+ }
}
Modified: stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2014-11-26 17:51:25 UTC (rev 19115)
+++ stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml 2014-11-27 17:40:48 UTC (rev 19116)
@@ -174,6 +174,7 @@
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service23*Impl.class"/>
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/jaxws/Say*.class"/>
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/KeystorePasswordCallback.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.class"/>
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/oasis/WEB-INF">
<include name="wsdl/*.xsd"/>
Added: stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.java (rev 0)
+++ stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.java 2014-11-27 17:40:48 UTC (rev 19116)
@@ -0,0 +1,9 @@
+package org.jboss.test.ws.jaxws.samples.wsse.policy.oasis;
+
+public class SAMLValidator extends org.apache.ws.security.validate.SamlAssertionValidator
+{
+ public SAMLValidator() {
+ super();
+ setRequireBearerSignature(false);
+ }
+}
Property changes on: stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java 2014-11-26 17:51:25 UTC (rev 19115)
+++ stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java 2014-11-27 17:40:48 UTC (rev 19116)
@@ -24,6 +24,8 @@
import javax.ejb.Stateless;
import javax.jws.WebService;
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
import org.jboss.ws.api.annotation.WebContext;
@WebService
@@ -35,6 +37,10 @@
endpointInterface = "org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServiceIface"
)
@Stateless
+@EndpointProperties(value = {
+ @EndpointProperty(key = "ws-security.saml1.validator", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.SAMLValidator")
+ }
+)
@WebContext(urlPattern = "SecurityService2311")
public class Service2311Impl implements ServiceIface
{
Modified: stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2321Impl.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2321Impl.java 2014-11-26 17:51:25 UTC (rev 19115)
+++ stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2321Impl.java 2014-11-27 17:40:48 UTC (rev 19116)
@@ -41,6 +41,7 @@
@EndpointProperty(key = "ws-security.signature.username", value = "bob"),
@EndpointProperty(key = "ws-security.encryption.properties", value = "bob.properties"),
@EndpointProperty(key = "ws-security.encryption.username", value = "useReqSigCert"),
+ @EndpointProperty(key = "ws-security.saml2.validator", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.SAMLValidator"),
@EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.KeystorePasswordCallback")
}
)
Modified: stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/wsdl/SecurityService.wsdl
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/wsdl/SecurityService.wsdl 2014-11-26 17:51:25 UTC (rev 19115)
+++ stack/cxf/branches/jbossws-cxf-4.1.x/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/wsse/policy/basic/gcm/WEB-INF/wsdl/SecurityService.wsdl 2014-11-27 17:40:48 UTC (rev 19116)
@@ -78,7 +78,7 @@
<sp:OnlySignEntireHeadersAndBody/>
<sp:AlgorithmSuite>
<wsp:Policy>
- <sp-cxf:Basic192GCM xmlns:sp-cxf="http://cxf.apache.org/custom/security-policy"/>
+ <sp-cxf:Basic256GCM xmlns:sp-cxf="http://cxf.apache.org/custom/security-policy"/>
</wsp:Policy>
</sp:AlgorithmSuite>
</wsp:Policy>
Modified: stack/cxf/branches/jbossws-cxf-4.1.x/pom.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.1.x/pom.xml 2014-11-26 17:51:25 UTC (rev 19115)
+++ stack/cxf/branches/jbossws-cxf-4.1.x/pom.xml 2014-11-27 17:40:48 UTC (rev 19116)
@@ -73,7 +73,7 @@
<jboss713.version>7.1.3.Final</jboss713.version>
<jboss720.version>7.2.2-internal-SNAPSHOT</jboss720.version>
<ejb.api.version>1.0.1.Final</ejb.api.version>
- <cxf.version>2.6.8</cxf.version>
+ <cxf.version>2.7.13</cxf.version>
<cxf.asm.version>3.3.1</cxf.asm.version>
<cxf.xjcplugins.version>2.6.0</cxf.xjcplugins.version>
<jboss.common.core.version>2.2.17.GA</jboss.common.core.version>
@@ -103,8 +103,8 @@
<jms.api.version>1.0.0.Final</jms.api.version>
<velocity.version>1.7</velocity.version>
<xerces.version>2.9.1</xerces.version>
- <xmlsec.version>1.5.4</xmlsec.version>
- <wss4j.version>1.6.10</wss4j.version>
+ <xmlsec.version>1.5.7</xmlsec.version>
+ <wss4j.version>1.6.17</wss4j.version>
<wstx.version>4.2.0</wstx.version>
<spring.version>3.0.7.RELEASE</spring.version>
</properties>
10 years
JBossWS SVN: r19115 - stack/cxf/trunk/modules/testsuite.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-11-26 12:51:25 -0500 (Wed, 26 Nov 2014)
New Revision: 19115
Modified:
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3813] Re-enabling test
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2014-11-26 17:13:12 UTC (rev 19114)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2014-11-26 17:51:25 UTC (rev 19115)
@@ -689,9 +689,6 @@
<!-- # [JBWS-3620] Authentication failures w/ Undertow -->
<exclude>org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase*</exclude>
- <!-- # [JBWS-3813] Add exception name to faultstring/detail/stackTrace -->
- <exclude>org/jboss/test/ws/jaxws/cxf/jbws3813/*TestCase*</exclude>
-
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
</excludes>
@@ -771,9 +768,6 @@
<!-- # [JBWS-3620] Authentication failures w/ Undertow -->
<exclude>org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase*</exclude>
- <!-- # [JBWS-3813] Add exception name to faultstring/detail/stackTrace -->
- <exclude>org/jboss/test/ws/jaxws/cxf/jbws3813/*TestCase*</exclude>
-
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
</excludes>
@@ -854,9 +848,6 @@
<!-- # [JBWS-3620] Authentication failures w/ Undertow -->
<exclude>org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase*</exclude>
- <!-- # [JBWS-3813] Add exception name to faultstring/detail/stackTrace -->
- <exclude>org/jboss/test/ws/jaxws/cxf/jbws3813/*TestCase*</exclude>
-
<!-- Manually setup KDC before run this test-->
<exclude>org/jboss/test/ws/jaxws/samples/wsse/kerberos/*TestCase*</exclude>
</excludes>
10 years
JBossWS SVN: r19114 - in stack/cxf/branches/arquillian/modules/testsuite/cxf-tests: src/test/etc and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-11-26 12:13:12 -0500 (Wed, 26 Nov 2014)
New Revision: 19114
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default-config-tests.groovy
Removed:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml
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/cxf/clientConfig/CXFClientConfigurationTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloBasicSecTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpproxy/HTTPProxyTestCaseForked.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy
Log:
More tests converted...
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml 2014-11-26 17:13:12 UTC (rev 19114)
@@ -106,6 +106,20 @@
</properties>
</configuration>
</execution>
+ <execution>
+ <id>testsuite-default-config-tests</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>${basedir}/src/test/scripts/jbws-testsuite-default-config-tests.groovy</source>
+ <properties>
+ <inputFile>${jboss.home}/standalone/configuration/standalone.xml</inputFile>
+ <outputFile>${jboss.home}/standalone/configuration/jbws-testsuite-default-config-tests.xml</outputFile>
+ </properties>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin> <!-- This copies jbossws-cxf-factories jar to endorsed dir before the integration-tests are run -->
Modified: 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 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml 2014-11-26 17:13:12 UTC (rev 19114)
@@ -36,5 +36,22 @@
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>
+ <container qualifier="default-config-tests" mode="manual">
+ <configuration>
+ <property name="jbossHome">${jboss.home}</property>
+ <property name="javaVmArguments">-Djboss.socket.binding.port-offset=20000</property>
+ <!-- <property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/jbossas -Dtest.bind.address=${node0}</property> -->
+ <property name="serverConfig">jbws-testsuite-default-config-tests.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:29990}</property>
+
+ <!-- AS7-4070 -->
+ <property name="waitForPorts">${as.debug.port:28787} ${as.managementPort:29990}</property>
+ <property name="waitForPortsTimeoutInSeconds">8</property>
+ </configuration>
+ </container>
</group>
</arquillian>
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCase.java 2014-11-26 17:13:12 UTC (rev 19114)
@@ -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,13 +21,23 @@
*/
package org.jboss.test.ws.jaxws.cxf.clientConfig;
+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.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestSetup;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Verifies client configuration setup
@@ -35,46 +45,110 @@
* @author alessio.soldano(a)jboss.com
* @since 31-May-2012
*/
+(a)RunWith(Arquillian.class)
public class CXFClientConfigurationTestCase extends JBossWSTest
{
- public static Test suite()
- {
- return new JBossWSTestSetup(CXFClientConfigurationTestCase.class, DeploymentArchives.NAMES);
+ private static final String DEP = "jaxws-cxf-clientConfig";
+ private static final String CLIENT_DEP = "jaxws-cxf-clientConfig-inContainer-client";
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(name = DEP, testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.EndpointImpl.class);
+ return archive;
}
+
+ @Deployment(name = CLIENT_DEP, testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, CLIENT_DEP + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf.impl\n"))
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/clientConfig/META-INF/jaxws-client-config.xml"), "META-INF/jaxws-client-config.xml")
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Helper.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.TestUtils.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/clientConfig/META-INF/permissions.xml"), "permissions.xml");
+ return archive;
+ }
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new JBossWSTestHelper.JarDeployment("jaxws-cxf-clientConfig-client.jar") { {
+ archive
+ .addManifest()
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/clientConfig/META-INF/jaxws-client-config.xml"), "jaxws-client-config.xml");
+ }
+ });
+ }
+
/**
* Verifies a custom client configuration can be read from conf file and set
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationFromFile() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationFromFile());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationOnDispatchFromFile() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationOnDispatchFromFile());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testCustomClientConfigurationFromFileInContainer() throws Exception {
assertEquals("1", runTestInContainer("testCustomClientConfigurationFromFile"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testCustomClientConfigurationOnDispatchFromFileInContainer() throws Exception {
assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatchFromFile"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationFromFileUsingFeature() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationFromFileUsingFeature());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testCustomClientConfigurationOnDispatchFromFileUsingFeature() throws Exception {
assertTrue(getHelper().testCustomClientConfigurationOnDispatchFromFileUsingFeature());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testCustomClientConfigurationFromFileUsingFeatureInContainer() throws Exception {
assertEquals("1", runTestInContainer("testCustomClientConfigurationFromFileUsingFeature"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testCustomClientConfigurationOnDispatchFromFileUsingFeatureInContainer() throws Exception {
assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatchFromFileUsingFeature"));
}
@@ -84,18 +158,32 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testConfigurationChange() throws Exception {
assertTrue(getHelper().testConfigurationChange());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
+ @WrapThreadContextClassLoader
public void testConfigurationChangeOnDispatch() throws Exception {
assertTrue(getHelper().testConfigurationChangeOnDispatch());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testConfigurationChangeInContainer() throws Exception {
assertEquals("1", runTestInContainer("testConfigurationChange"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
public void testConfigurationChangeOnDispatchInContainer() throws Exception {
assertEquals("1", runTestInContainer("testConfigurationChangeOnDispatch"));
}
@@ -104,15 +192,13 @@
private Helper getHelper() {
Helper helper = new Helper();
- helper.setTargetEndpoint("http://" + getServerHost() + ":8080/jaxws-cxf-clientConfig/EndpointImpl");
+ helper.setTargetEndpoint(baseURL + "EndpointImpl");
return helper;
}
private String runTestInContainer(String test) throws Exception
{
- URL url = new URL("http://" + getServerHost()
- + ":8080/jaxws-cxf-clientConfig-inContainer-client?path=/jaxws-cxf-clientConfig/EndpointImpl&method=" + test
- + "&helper=" + Helper.class.getName());
+ URL url = new URL(baseURL + "?path=/jaxws-cxf-clientConfig/EndpointImpl&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/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFClientConfigurationTestCaseForked.java 2014-11-26 17:13:12 UTC (rev 19114)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2013, 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.cxf.clientConfig;
-
-import java.net.URL;
-
-import junit.framework.Test;
-
-import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.wsf.test.JBossWSTestSetup;
-
-/**
- * Verifies client configuration setup (in-container tests, relying on AS model)
- *
- * @author alessio.soldano(a)jboss.com
- * @since 31-May-2012
- */
-public class CXFClientConfigurationTestCaseForked extends JBossWSTest
-{
- public static Test suite()
- {
- return new JBossWSTestSetup(CXFClientConfigurationTestCaseForked.class, DeploymentArchives.NAMES);
- }
-
- /**
- * Verifies the default client configuration from AS model is used
- *
- * @throws Exception
- */
- public void testDefaultClientConfigurationInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testDefaultClientConfiguration"));
- }
-
- public void testDefaultClientConfigurationOnDispatchInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testDefaultClientConfigurationOnDispatch"));
- }
-
- /**
- * Verifies a client configuration from AS model can be set
- *
- * @throws Exception
- */
- public void testCustomClientConfigurationInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testCustomClientConfiguration"));
- }
-
- public void testCustomClientConfigurationOnDispatchInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatch"));
- }
-
- public void testCustomClientConfigurationUsingFeatureInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testCustomClientConfigurationUsingFeature"));
- }
-
- public void testCustomClientConfigurationOnDispatchUsingFeatureInContainer() throws Exception {
- assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatchUsingFeature"));
- }
-
- // -------------------------
-
- private String runTestInContainer(String test) throws Exception
- {
- URL url = new URL("http://" + getServerHost()
- + ":8080/jaxws-cxf-clientConfig-inContainer-client?path=/jaxws-cxf-clientConfig/EndpointImpl&method=" + test
- + "&helper=" + Helper.class.getName());
- return IOUtils.readAndCloseStream(url.openStream());
- }
-}
Added: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.java (rev 0)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.java 2014-11-26 17:13:12 UTC (rev 19114)
@@ -0,0 +1,158 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, 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.cxf.clientConfig;
+
+import java.io.File;
+import java.net.URL;
+
+import org.jboss.arquillian.container.test.api.ContainerController;
+import org.jboss.arquillian.container.test.api.Deployer;
+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.container.test.api.TargetsContainer;
+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.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Verifies client configuration setup (in-container tests, relying on AS model)
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 31-May-2012
+ */
+(a)RunWith(Arquillian.class)
+public class CXFDefaultClientConfigurationTestCase extends JBossWSTest
+{
+ private static final String DEP = "jaxws-cxf-clientConfig-def";
+ private static final String CLIENT_DEP = "jaxws-cxf-clientConfig-inContainer-def-client";
+ private static final String DEFAULT_CONFIG_TESTS_SERVER = "default-config-tests";
+
+ @ArquillianResource
+ private Deployer deployer;
+
+ @ArquillianResource
+ private ContainerController containerController;
+
+ @Deployment(name = DEP, testable = false)
+ @TargetsContainer(DEFAULT_CONFIG_TESTS_SERVER)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.EndpointImpl.class);
+ return archive;
+ }
+
+ @Deployment(name = CLIENT_DEP, testable = false)
+ @TargetsContainer(DEFAULT_CONFIG_TESTS_SERVER)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, CLIENT_DEP + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf.impl\n"))
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/clientConfig/META-INF/jaxws-client-config.xml"), "META-INF/jaxws-client-config.xml")
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.Helper.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.clientConfig.TestUtils.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/clientConfig/META-INF/permissions.xml"), "permissions.xml");
+ return archive;
+ }
+
+ @Before
+ public void startContainerAndDeploy() throws Exception {
+ if (!containerController.isStarted(DEFAULT_CONFIG_TESTS_SERVER)) {
+ containerController.start(DEFAULT_CONFIG_TESTS_SERVER);
+ }
+ }
+
+ /**
+ * Verifies the default client configuration from AS model is used
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testDefaultClientConfigurationInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testDefaultClientConfiguration"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testDefaultClientConfigurationOnDispatchInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testDefaultClientConfigurationOnDispatch"));
+ }
+
+ /**
+ * Verifies a client configuration from AS model can be set
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testCustomClientConfigurationInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfiguration"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testCustomClientConfigurationOnDispatchInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatch"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testCustomClientConfigurationUsingFeatureInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfigurationUsingFeature"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testCustomClientConfigurationOnDispatchUsingFeatureInContainer() throws Exception {
+ assertEquals("1", runTestInContainer("testCustomClientConfigurationOnDispatchUsingFeature"));
+ }
+
+ // -------------------------
+
+ private String runTestInContainer(String test) throws Exception
+ {
+ URL url = new URL("http://" + getServerHost()
+ + ":28080/jaxws-cxf-clientConfig-inContainer-def-client?path=/jaxws-cxf-clientConfig-def/EndpointImpl&method=" + test
+ + "&helper=" + Helper.class.getName());
+ return IOUtils.readAndCloseStream(url.openStream());
+ }
+}
Property changes on: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/clientConfig/CXFDefaultClientConfigurationTestCase.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/cxf/httpauth/HelloBasicSecTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloBasicSecTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloBasicSecTestCase.java 2014-11-26 17:13:12 UTC (rev 19114)
@@ -23,68 +23,55 @@
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.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.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;
/**
* @author ema(a)redhat.com
* @author alessio.soldano(a)jboss.com
*/
+(a)RunWith(Arquillian.class)
public class HelloBasicSecTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() + ":8080/jaxws-cxf-basic-sec";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-basic-sec.war") { {
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.Hello.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloRequest.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloResponse.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.ObjectFactory.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl"), "wsdl/hello.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/basic/jboss-web.xml"), "jboss-web.xml")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/basic/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-cxf-basic-sec.war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.Hello.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloRequest.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.ObjectFactory.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl"), "wsdl/hello.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/basic/jboss-web.xml"), "jboss-web.xml")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/basic/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- JBossWSCXFTestSetup testSetup;
- testSetup = new JBossWSCXFTestSetup(HelloBasicSecTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
- Map<String, String> authenticationOptions = new HashMap<String, String>();
- authenticationOptions.put("usersProperties",
- getResourceFile("jaxws/cxf/httpauth/WEB-INF/ws-users.properties").getAbsolutePath());
- authenticationOptions.put("rolesProperties",
- getResourceFile("jaxws/cxf/httpauth/WEB-INF/ws-roles.properties").getAbsolutePath());
- authenticationOptions.put("password-stacking", "useFirstPass");
- testSetup.addSecurityDomainRequirement("ws-basic-domain", authenticationOptions);
- return testSetup;
- }
-
+ @Test
+ @RunAsClient
public void testBasicAuth() throws Exception
{
QName serviceName = new QName("http://jboss.org/http/security", "HelloService");
URL wsdlURL = getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(Hello.class);
- ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
+ ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL.toString());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "jbossws");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "jbossws");
int result = proxy.helloRequest("number");
@@ -92,13 +79,15 @@
}
+ @Test
+ @RunAsClient
public void testBasicAuthFail() throws Exception
{
QName serviceName = new QName("http://jboss.org/http/security", "HelloService");
URL wsdlURL = getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(Hello.class);
- ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
+ ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL.toString());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "jbossws");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "wrongPwd");
try {
@@ -109,13 +98,15 @@
}
}
+ @Test
+ @RunAsClient
public void testBasicNoAuth() throws Exception
{
QName serviceName = new QName("http://jboss.org/http/security", "HelloService");
URL wsdlURL = getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(Hello.class);
- ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
+ ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL.toString());
try {
proxy.helloRequest("number");
fail("Authorization exception expected!");
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpauth/HelloDigestTestCase.java 2014-11-26 17:13:12 UTC (rev 19114)
@@ -23,72 +23,55 @@
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.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transport.http.auth.DigestAuthSupplier;
+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;
/**
* @author ema(a)redhat.com
* @author alessio.soldano(a)jboss.com
*/
+(a)RunWith(Arquillian.class)
public class HelloDigestTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() + ":8080/jaxws-cxf-digest-sec";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-digest-sec.war") { {
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.Hello.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloRequest.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloResponse.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.ObjectFactory.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl"), "wsdl/hello.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/digest/jboss-web.xml"), "jboss-web.xml")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/digest/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-cxf-digest-sec.war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.Hello.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloRequest.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.HelloResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpauth.ObjectFactory.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl"), "wsdl/hello.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/digest/jboss-web.xml"), "jboss-web.xml")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpauth/digest/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- JBossWSCXFTestSetup testSetup;
- testSetup = new JBossWSCXFTestSetup(HelloDigestTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
- Map<String, String> authenticationOptions = new HashMap<String, String>();
- authenticationOptions.put("usersProperties",
- getResourceFile("jaxws/cxf/httpauth/WEB-INF/ws-users.properties").getAbsolutePath());
- authenticationOptions.put("rolesProperties",
- getResourceFile("jaxws/cxf/httpauth/WEB-INF/ws-roles.properties").getAbsolutePath());
- authenticationOptions.put("hashAlgorithm", "MD5");
- authenticationOptions.put("hashEncoding", "RFC2617");
- authenticationOptions.put("hashUserPassword", "false");
- authenticationOptions.put("hashStorePassword", "true");
- authenticationOptions.put("storeDigestCallback", "org.jboss.security.auth.callback.RFC2617Digest");
- testSetup.addSecurityDomainRequirement("ws-digest-domain", authenticationOptions);
- return testSetup;
- }
-
+ @Test
+ @RunAsClient
public void testDigest() throws Exception
{
final Bus bus = BusFactory.newInstance().createBus();
@@ -98,7 +81,7 @@
URL wsdlURL = getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
Hello proxy = (Hello)service.getPort(Hello.class);
- ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
+ ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL.toString());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "jbossws");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "jbossws");
HTTPConduit cond = (HTTPConduit)ClientProxy.getClient(proxy).getConduit();
@@ -110,6 +93,8 @@
}
}
+ @Test
+ @RunAsClient
public void testDigestAuthFail() throws Exception
{
final Bus bus = BusFactory.newInstance().createBus();
@@ -119,7 +104,7 @@
URL wsdlURL = getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
Hello proxy = (Hello)service.getPort(Hello.class);
- ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
+ ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL.toString());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "jbossws");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "wrongPwd");
HTTPConduit cond = (HTTPConduit)ClientProxy.getClient(proxy).getConduit();
@@ -135,13 +120,15 @@
}
}
+ @Test
+ @RunAsClient
public void testDigestNoAuth() throws Exception
{
QName serviceName = new QName("http://jboss.org/http/security", "HelloService");
URL wsdlURL = getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello)service.getPort(Hello.class);
- ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
+ ((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL.toString());
try {
proxy.helloRequest("number");
fail("Authorization exception expected!");
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpproxy/HTTPProxyTestCaseForked.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpproxy/HTTPProxyTestCaseForked.java 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/httpproxy/HTTPProxyTestCaseForked.java 2014-11-26 17:13:12 UTC (rev 19114)
@@ -42,18 +42,24 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
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.apache.cxf.transports.http.configuration.ProxyServerType;
+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.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.littleshoot.proxy.ChainedProxy;
import org.littleshoot.proxy.ChainedProxyAdapter;
import org.littleshoot.proxy.ChainedProxyManager;
@@ -67,6 +73,7 @@
* @author alessio.soldano(a)jboss.com
* @since 24-May-2011
*/
+(a)RunWith(Arquillian.class)
public class HTTPProxyTestCaseForked extends JBossWSTest
{
private static int proxyPort = 19387;
@@ -75,24 +82,21 @@
private static final String ENDPOINT_PATH = "/jaxws-cxf-httpproxy/HelloWorldService/HelloWorldImpl";
private HttpProxyServer proxyServer;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-httpproxy.war") { {
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.cxf.httpproxy.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.httpproxy.HelloWorldImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpproxy/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-cxf-httpproxy.war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpproxy.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.httpproxy.HelloWorldImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/httpproxy/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(HTTPProxyTestCaseForked.class, JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testHttpProxy() throws Exception
{
if (checkNativeLibraries()) {
@@ -142,6 +146,8 @@
assertEquals(hi, port.echo(hi));
}
+ @Test
+ @RunAsClient
public void testHttpProxyUsingHTTPClientPolicy() throws Exception
{
if (checkNativeLibraries()) {
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/interceptors/InterceptorsTestCase.java 2014-11-26 17:13:12 UTC (rev 19114)
@@ -23,19 +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.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.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;
/**
* Testcase for:
@@ -45,36 +47,34 @@
* @author alessio.soldano(a)jboss.com
* @since 10-Oct-2014
*/
+(a)RunWith(Arquillian.class)
public class InterceptorsTestCase extends JBossWSTest
{
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-interceptors.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.AnotherEndpointImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusInterceptor.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusCounterInterceptor.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.DeclaredInterceptor.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointInterceptor.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointCounterInterceptor.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.Counter.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml"), "jboss-webservices.xml")
- .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.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-cxf-interceptors.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.AnotherEndpointImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusInterceptor.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.BusCounterInterceptor.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.DeclaredInterceptor.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointInterceptor.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.EndpointCounterInterceptor.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.interceptors.Counter.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/interceptors/WEB-INF/jboss-webservices.xml"), "jboss-webservices.xml")
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/interceptors/WEB-INF/jaxws-endpoint-config.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(InterceptorsTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testEndpointWithBothBusAndEndpointInterceptors() throws Exception {
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-cxf-interceptors/MyService" + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "MyService?wsdl");
Service service = Service.create(wsdlURL, new QName("http://org.jboss.ws.jaxws.cxf/interceptors", "MyService"));
Endpoint port = service.getPort(new QName("http://org.jboss.ws.jaxws.cxf/interceptors", "MyEndpointPort"), Endpoint.class);
assertEquals("Hi FooBar! 0", port.echo("Hi"));
@@ -83,8 +83,10 @@
assertEquals("Hi FooBar! 6", port.echo("Hi"));
}
+ @Test
+ @RunAsClient
public void testEndpointWithBusInterceptorsOnly() throws Exception {
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-cxf-interceptors/AnotherService" + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "AnotherService?wsdl");
Service service = Service.create(wsdlURL, new QName("http://org.jboss.ws.jaxws.cxf/interceptors", "AnotherService"));
AnotherEndpoint port = service.getPort(new QName("http://org.jboss.ws.jaxws.cxf/interceptors", "AnotherEndpointPort"), AnotherEndpoint.class);
assertEquals("Hi.Foo!.0", port.echo("Hi"));
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java 2014-11-26 17:13:12 UTC (rev 19114)
@@ -74,8 +74,7 @@
try
{
ClientHelper helper = (ClientHelper) Class.forName(helperClassName).newInstance();
- String hostName = toIPv6URLFormat(System.getProperty("jboss.bind.address", "localhost"));
- helper.setTargetEndpoint("http://" + hostName + ":8080" + path);
+ helper.setTargetEndpoint("http://" + req.getLocalAddr() + ":" + req.getLocalPort() + path);
List<String> failedTests = new LinkedList<String>();
List<String> errorTests = new LinkedList<String>();
Method[] methods = helper.getClass().getMethods();
Added: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default-config-tests.groovy
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default-config-tests.groovy (rev 0)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default-config-tests.groovy 2014-11-26 17:13:12 UTC (rev 19114)
@@ -0,0 +1,34 @@
+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']])
+
+/**
+ * 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/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy 2014-11-26 11:35:37 UTC (rev 19113)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy 2014-11-26 17:13:12 UTC (rev 19114)
@@ -48,6 +48,58 @@
/**
* Add a security-domain block like this:
*
+ * <security-domain name="ws-basic-domain" 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-resources/jaxws/cxf/httpauth/WEB-INF/ws-users.properties"/>
+ * <module-option name="rolesProperties" value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-resources/jaxws/cxf/httpauth/WEB-INF/ws-roles.properties"/>
+ * <module-option name="password-stacking" value="useFirstPass"/>
+ * </login-module>
+ * </authentication>
+ * </security-domain>
+ *
+ */
+
+def securityDomainBasicAuth = securityDomains.appendNode('security-domain', ['name':'ws-basic-domain','cache-type':'default'])
+def authenticationBasicAuth = securityDomainBasicAuth.appendNode('authentication')
+def loginModuleBasicAuth = authenticationBasicAuth.appendNode('login-module', ['code':'UsersRoles','flag':'required'])
+loginModuleBasicAuth.appendNode('module-option', ['name':'usersProperties','value':project.properties['testResourcesDir'] + '/jaxws/cxf/httpauth/WEB-INF/ws-users.properties'])
+loginModuleBasicAuth.appendNode('module-option', ['name':'rolesProperties','value':project.properties['testResourcesDir'] + '/jaxws/cxf/httpauth/WEB-INF/ws-roles.properties'])
+loginModuleBasicAuth.appendNode('module-option', ['name':'password-stacking','value':'useFirstPass'])
+
+/**
+ * Add a security-domain block like this:
+ *
+ * <security-domain name="ws-digest-domain" cache-type="default">
+ * <authentication>
+ * <login-module code="UsersRoles" flag="required">
+ * <module-option name="hashUserPassword" value="false"/>
+ * <module-option name="usersProperties" value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-resources/jaxws/cxf/httpauth/WEB-INF/ws-users.properties"/>
+ * <module-option name="hashAlgorithm" value="MD5"/>
+ * <module-option name="hashEncoding" value="RFC2617"/>
+ * <module-option name="rolesProperties" value="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-resources/jaxws/cxf/httpauth/WEB-INF/ws-roles.properties"/>
+ * <module-option name="storeDigestCallback" value="org.jboss.security.auth.callback.RFC2617Digest"/>
+ * <module-option name="hashStorePassword" value="true"/>
+ * </login-module>
+ * </authentication>
+ * </security-domain>
+ *
+ */
+
+def securityDomainDigestAuth = securityDomains.appendNode('security-domain', ['name':'ws-digest-domain','cache-type':'default'])
+def authenticationDigestAuth = securityDomainDigestAuth.appendNode('authentication')
+def loginModuleDigestAuth = authenticationDigestAuth.appendNode('login-module', ['code':'UsersRoles','flag':'required'])
+loginModuleDigestAuth.appendNode('module-option', ['name':'hashUserPassword','value':'false'])
+loginModuleDigestAuth.appendNode('module-option', ['name':'usersProperties','value':project.properties['testResourcesDir'] + '/jaxws/cxf/httpauth/WEB-INF/ws-users.properties'])
+loginModuleDigestAuth.appendNode('module-option', ['name':'hashAlgorithm','value':'MD5'])
+loginModuleDigestAuth.appendNode('module-option', ['name':'hashEncoding','value':'RFC2617'])
+loginModuleDigestAuth.appendNode('module-option', ['name':'rolesProperties','value':project.properties['testResourcesDir'] + '/jaxws/cxf/httpauth/WEB-INF/ws-roles.properties'])
+loginModuleDigestAuth.appendNode('module-option', ['name':'storeDigestCallback','value':'org.jboss.security.auth.callback.RFC2617Digest'])
+loginModuleDigestAuth.appendNode('module-option', ['name':'hashStorePassword','value':'true'])
+
+/**
+ * Add a security-domain block like this:
+ *
* <security-domain name="JBossWSDigest" cache-type="default">
* <authentication>
* <login-module code="UsersRoles" flag="required">
10 years
JBossWS SVN: r19113 - in stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf: bus and 6 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-11-26 06:35:37 -0500 (Wed, 26 Nov 2014)
New Revision: 19113
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java
Removed:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusReuseTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/EJB3ClientBusTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ServletClientBusTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/DeploymentArchives.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPServletTestCase.java
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/catalog/OasisCatalogHelloWSTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/continuations/ContinuationsTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/TestServlet.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/fastinfoset/FastInfosetTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPTestCase.java
Log:
More tests converted...
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -23,61 +23,61 @@
import java.io.File;
import java.net.URL;
-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.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.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;
/**
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*
*/
+(a)RunWith(Arquillian.class)
public class AsyncClientTestCase extends JBossWSTest
{
- private final String endpointAddress = "http://" + getServerHost() + ":8080/jaxws-cxf-asyncclient";
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-asyncclient.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.asyncclient.EndpointImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/asyncclient/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-cxf-asyncclient.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.asyncclient.EndpointImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/asyncclient/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(AsyncClientTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testAsycClienWithHCAddress() throws Exception
{
Endpoint proxy = initPort();
BindingProvider provider = (BindingProvider)proxy;
Map<String, Object> requestContext = provider.getRequestContext();
- requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "hc://" + endpointAddress);
+ requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "hc://" + baseURL);
assertEquals("Echo:1000", proxy.echo(1000));
}
+ @Test
+ @RunAsClient
public void testAsycClienWithMsgProp() throws Exception
{
Endpoint proxy = initPort();
@@ -87,6 +87,8 @@
assertEquals("Echo:1000", proxy.echo(1000));
}
+ @Test
+ @RunAsClient
public void testAsycClienAsyncOperation() throws Exception
{
Endpoint proxy = initPort();
@@ -96,6 +98,8 @@
assertEquals("Echo:1000", proxy.echoAsync(1000).get());
}
+ @Test
+ @RunAsClient
public void testAysncClientWithPolicy () throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -119,11 +123,9 @@
private Endpoint initPort() throws Exception {
QName serviceName = new QName("http://org.jboss.ws/cxf/asyncclient", "EndpointImplService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
Endpoint proxy = service.getPort(Endpoint.class);
return proxy;
}
-
-
}
\ No newline at end of file
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusReuseTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusReuseTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusReuseTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.cxf.bus;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.WebServiceFeature;
-
-import junit.framework.Test;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.stack.cxf.client.UseNewBusFeature;
-import org.jboss.wsf.stack.cxf.client.UseThreadBusFeature;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A testcase for verifying proper behaviour of the UseNewBusFeature on
- * JAXWS Service creation.
- *
- * @author alessio.soldano(a)jboss.com
- * @since 28-Aug-2013
- *
- */
-public class BusReuseTestCase extends JBossWSTest
-{
- public final String WSDL_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-cxf-bus-wsdl";
-
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(BusReuseTestCase.class, DeploymentArchives.SERVER + ", " + DeploymentArchives.SERVER_2);
- }
-
- public void testReuse() throws Exception
- {
- //odd wsdl GETs return WSDL doc with invalid soap:address
- //even wsdl GETs return WSDL doc with valid soap:address
- final String wsdl1 = readWsdl(WSDL_ADDRESS); //invalid
- final String wsdl2 = readWsdl(WSDL_ADDRESS); //valid
- final String wsdl3 = readWsdl(WSDL_ADDRESS); //invalid
- final String wsdl4 = readWsdl(WSDL_ADDRESS); //valid
- assertEquals(wsdl1, wsdl3);
- assertEquals(wsdl2, wsdl4);
- assertFalse(wsdl1.equals(wsdl2));
-
- Bus bus = BusFactory.newInstance().createBus();
- try {
- BusFactory.setThreadDefaultBus(bus);
- Endpoint port = getPort(WSDL_ADDRESS, bus, new UseThreadBusFeature()); //invalid
- try {
- performInvocation(port);
- fail("Failure expected, as the wsdl soap:address is not valid!");
- } catch (WebServiceException wse) {
- assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
- }
-
- port = getPort(WSDL_ADDRESS, bus, new UseThreadBusFeature()); //valid
- try {
- performInvocation(port);
- fail("Failure expected, as the WSDLManager for the bus will return the invalid wsdl");
- } catch (WebServiceException wse) {
- assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
- }
-
- port = getPort(WSDL_ADDRESS, bus, new UseThreadBusFeature()); //invalid
-
- port = getPort(WSDL_ADDRESS, bus, new UseNewBusFeature()); //valid
- //the port should now actually be built against the valid wsdl
- //as a new bus should have been started (with a new WSDLManager)
- //so the invocation is expected to succeed
- performInvocation(port);
-
- port = getPort(WSDL_ADDRESS, bus, new UseThreadBusFeature()); //invalid
-
- port = getPort(WSDL_ADDRESS, bus, new UseNewBusFeature(false)); //valid
- try {
- performInvocation(port);
- fail("Failure expected, as the WSDLManager for the bus will return the invalid wsdl (disabled feature used)");
- } catch (WebServiceException wse) {
- assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
- }
- } finally {
- bus.shutdown(true);
- }
- }
-
- private String readWsdl(String addr) throws Exception {
- return IOUtils.readAndCloseStream(new URL(addr).openStream());
- }
-
- protected static void performInvocation(Endpoint endpoint)
- {
- String result = endpoint.echo("Alessio");
- assert ("Alessio".equals(result));
- }
-
- protected static Endpoint getPort(String wsdlAddr, Bus currentThreadBus, WebServiceFeature... features) throws MalformedURLException
- {
- QName serviceName = new QName("http://org.jboss.ws/bus", "EndpointService");
- Service service = Service.create(new URL(wsdlAddr), serviceName, features);
- //check the current thread bus has not changed (even if we used the UseNewBusFeature)
- assertEquals(currentThreadBus, BusFactory.getThreadDefaultBus(false));
- QName portQName = new QName("http://org.jboss.ws/bus", "EndpointPort");
- return (Endpoint) service.getPort(portQName, Endpoint.class);
- }
-}
Added: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java (rev 0)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -0,0 +1,304 @@
+/*
+ * 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.cxf.bus;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceFeature;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.jboss.arquillian.container.test.api.Deployer;
+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.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.ws.common.IOUtils;
+import org.jboss.wsf.stack.cxf.client.UseNewBusFeature;
+import org.jboss.wsf.stack.cxf.client.UseThreadBusFeature;
+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 proper behaviour of the UseNewBusFeature on
+ * JAXWS Service creation.
+ *
+ * A test case that verifies a client running inside and endpoint business method
+ * does not use the deployment bus.
+ *
+ * A test case that verifies Bus references do not leak into EJB3 clients
+ *
+ * A test case that verifies Bus references do not leak into servlet clients
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 28-Aug-2013
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class BusTestCase extends JBossWSTest
+{
+ private static final String SERVER = "jaxws-cxf-bus";
+ private static final String WSDL_SERVER = "jaxws-cxf-bus-wsdl";
+ private static final String SERVLET_CLIENT_DEP = "jaxws-cxf-bus-servlet-client";
+ private static final String EJB3_CLIENT_DEP = "jaxws-cxf-bus-ejb3-client";
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @ArquillianResource
+ Deployer deployer;
+
+ @Deployment(name = SERVER, testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, SERVER + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n" + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.ClientEndpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.ClientEndpointImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EndpointImpl.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/bus/META-INF/permissions.xml"), "permissions.xml")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/bus/WEB-INF/web.xml"));
+ return archive;
+ }
+
+ @Deployment(name = WSDL_SERVER, testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, WSDL_SERVER + ".war");
+ archive.addManifest()
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/bus/InvalidAddressEndpoint.wsdl"), "InvalidAddressEndpoint.wsdl")
+ .addAsResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/bus/ValidAddressEndpoint.wsdl"), "ValidAddressEndpoint.wsdl")
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.WSDLServlet.class);
+ return archive;
+ }
+
+ @Deployment(name = SERVLET_CLIENT_DEP, testable = false, managed = false)
+ public static WebArchive createDeployment3() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, SERVLET_CLIENT_DEP + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client services export,com.sun.xml.messaging.saaj services\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.AbstractClient.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.BusTestException.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EndpointService.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.ServletClient.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/bus/WEB-INF-client/wsdl/Endpoint.wsdl"), "wsdl/Endpoint.wsdl")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/bus/WEB-INF-client/web.xml"));
+ return archive;
+ }
+
+ @Deployment(name = EJB3_CLIENT_DEP, testable = false, managed = false)
+ public static JavaArchive createDeployment4() {
+ JavaArchive archive = ShrinkWrap.create(JavaArchive.class, EJB3_CLIENT_DEP + ".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.cxf.bus.AbstractClient.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.BusTestException.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EJB3Client.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EJB3ClientRemoteInterface.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.Endpoint.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.bus.EndpointService.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/bus/META-INF/permissions.xml"), "permissions.xml")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/bus/META-INF/wsdl/Endpoint.wsdl"), "wsdl/Endpoint.wsdl");
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(WSDL_SERVER)
+ public void testReuse() throws Exception
+ {
+ //odd wsdl GETs return WSDL doc with invalid soap:address
+ //even wsdl GETs return WSDL doc with valid soap:address
+ final String wsdl1 = readWsdl(baseURL); //invalid
+ final String wsdl2 = readWsdl(baseURL); //valid
+ final String wsdl3 = readWsdl(baseURL); //invalid
+ final String wsdl4 = readWsdl(baseURL); //valid
+ assertEquals(wsdl1, wsdl3);
+ assertEquals(wsdl2, wsdl4);
+ assertFalse(wsdl1.equals(wsdl2));
+
+ Bus bus = BusFactory.newInstance().createBus();
+ try {
+ BusFactory.setThreadDefaultBus(bus);
+ Endpoint port = getPort(baseURL, bus, new UseThreadBusFeature()); //invalid
+ try {
+ performInvocation(port);
+ fail("Failure expected, as the wsdl soap:address is not valid!");
+ } catch (WebServiceException wse) {
+ assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
+ }
+
+ port = getPort(baseURL, bus, new UseThreadBusFeature()); //valid
+ try {
+ performInvocation(port);
+ fail("Failure expected, as the WSDLManager for the bus will return the invalid wsdl");
+ } catch (WebServiceException wse) {
+ assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
+ }
+
+ port = getPort(baseURL, bus, new UseThreadBusFeature()); //invalid
+
+ port = getPort(baseURL, bus, new UseNewBusFeature()); //valid
+ //the port should now actually be built against the valid wsdl
+ //as a new bus should have been started (with a new WSDLManager)
+ //so the invocation is expected to succeed
+ performInvocation(port);
+
+ port = getPort(baseURL, bus, new UseThreadBusFeature()); //invalid
+
+ port = getPort(baseURL, bus, new UseNewBusFeature(false)); //valid
+ try {
+ performInvocation(port);
+ fail("Failure expected, as the WSDLManager for the bus will return the invalid wsdl (disabled feature used)");
+ } catch (WebServiceException wse) {
+ assertTrue(wse.getCause().getMessage().contains("InvalidEndpoint"));
+ }
+ } finally {
+ bus.shutdown(true);
+ }
+ }
+
+ private String readWsdl(URL addr) throws Exception {
+ return IOUtils.readAndCloseStream(addr.openStream());
+ }
+
+ protected static void performInvocation(Endpoint endpoint)
+ {
+ String result = endpoint.echo("Alessio");
+ assert ("Alessio".equals(result));
+ }
+
+ protected static Endpoint getPort(URL wsdlAddr, Bus currentThreadBus, WebServiceFeature... features) throws MalformedURLException
+ {
+ QName serviceName = new QName("http://org.jboss.ws/bus", "EndpointService");
+ Service service = Service.create(wsdlAddr, serviceName, features);
+ //check the current thread bus has not changed (even if we used the UseNewBusFeature)
+ assertEquals(currentThreadBus, BusFactory.getThreadDefaultBus(false));
+ QName portQName = new QName("http://org.jboss.ws/bus", "EndpointPort");
+ return (Endpoint) service.getPort(portQName, Endpoint.class);
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testBusLeakageInServletClient() throws Exception
+ {
+ deployer.deploy(SERVLET_CLIENT_DEP);
+ try
+ {
+ final String host = baseURL.getHost();
+ final String clientAddress = baseURL.getProtocol() + "://" + host + ":" + baseURL.getPort() + "/jaxws-cxf-bus-servlet-client";
+ URL url = new URL(clientAddress + "?method=testBusCreation");
+ assertEquals("OK testBusCreation", IOUtils.readAndCloseStream(url.openStream()));
+
+ url = new URL(clientAddress + "?method=testSOAPConnection&host=" + host);
+ assertEquals("OK testSOAPConnection", IOUtils.readAndCloseStream(url.openStream()));
+
+ url = new URL(clientAddress + "?method=testWebServiceRef");
+ assertEquals("OK testWebServiceRef", IOUtils.readAndCloseStream(url.openStream()));
+
+ url = new URL(clientAddress + "?method=testWebServiceClient&host=" + host);
+ assertEquals("OK testWebServiceClient", IOUtils.readAndCloseStream(url.openStream()));
+ }
+ finally
+ {
+ deployer.undeploy(SERVLET_CLIENT_DEP);
+ }
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testBusLeakageInEJB3Client() throws Exception
+ {
+ deployer.deploy(EJB3_CLIENT_DEP);
+ InitialContext iniCtx = null;
+ try
+ {
+ String host = getServerHost();
+ iniCtx = getServerInitialContext();
+ Object obj = iniCtx.lookup("ejb:/jaxws-cxf-bus-ejb3-client//EJB3Client!" + EJB3ClientRemoteInterface.class.getName());
+ EJB3ClientRemoteInterface ejb3Remote = (EJB3ClientRemoteInterface)obj;
+ ejb3Remote.testBusCreation();
+ ejb3Remote.testSOAPConnection(host);
+ ejb3Remote.testWebServiceClient(host);
+ ejb3Remote.testWebServiceRef();
+ }
+ finally
+ {
+ if (iniCtx != null)
+ {
+ iniCtx.close();
+ }
+ deployer.undeploy(EJB3_CLIENT_DEP);
+ }
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testClient() throws Exception
+ {
+ ClientEndpoint port = getPort();
+ assertEquals("Foo", port.testClient("Foo", getServerHost()));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testCachedPort() throws Exception
+ {
+ ClientEndpoint port = getPort();
+ assertEquals("Foo", port.testCachedPort("Foo", getServerHost()));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER)
+ public void testCachedService() throws Exception
+ {
+ ClientEndpoint port = getPort();
+ assertEquals("Foo", port.testCachedService("Foo", getServerHost()));
+ }
+
+ private ClientEndpoint getPort() throws Exception {
+ URL wsdlURL = new URL(baseURL + "ClientEndpointService/ClientEndpoint?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/bus", "ClientEndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ QName portQName = new QName("http://org.jboss.ws/bus", "ClientEndpointPort");
+ return (ClientEndpoint) service.getPort(portQName, ClientEndpoint.class);
+ }
+
+}
Property changes on: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/BusTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ClientEndpointBusTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.cxf.bus;
-
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-
-import junit.framework.Test;
-
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A test case that verifies a client running inside and endpoint business method
- * does not use the deployment bus.
- *
- * @author alessio.soldano(a)jboss.com
- * @since 13-Jun-2012
- *
- */
-public class ClientEndpointBusTestCase extends JBossWSTest
-{
- public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-cxf-bus/ClientEndpointService/ClientEndpoint";
-
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(ClientEndpointBusTestCase.class, DeploymentArchives.SERVER);
- }
-
- public void testClient() throws Exception
- {
- ClientEndpoint port = getPort();
- assertEquals("Foo", port.testClient("Foo", getServerHost()));
- }
-
- public void testCachedPort() throws Exception
- {
- ClientEndpoint port = getPort();
- assertEquals("Foo", port.testCachedPort("Foo", getServerHost()));
- }
-
- public void testCachedService() throws Exception
- {
- ClientEndpoint port = getPort();
- assertEquals("Foo", port.testCachedService("Foo", getServerHost()));
- }
-
- private ClientEndpoint getPort() throws Exception {
- URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
- QName serviceName = new QName("http://org.jboss.ws/bus", "ClientEndpointService");
- Service service = Service.create(wsdlURL, serviceName);
- QName portQName = new QName("http://org.jboss.ws/bus", "ClientEndpointPort");
- return (ClientEndpoint) service.getPort(portQName, ClientEndpoint.class);
- }
-}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/EJB3ClientBusTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/EJB3ClientBusTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/EJB3ClientBusTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.cxf.bus;
-
-import javax.naming.InitialContext;
-
-import junit.framework.Test;
-
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A test case that verifies Bus references do not leak into EJB3 clients
- *
- * @author alessio.soldano(a)jboss.com
- * @since 05-Oct-2010
- *
- */
-public class EJB3ClientBusTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(EJB3ClientBusTestCase.class, DeploymentArchives.SERVER);
- }
-
- public void testSingleDeploy() throws Exception
- {
- deploy(DeploymentArchives.EJB3_CLIENT);
- InitialContext iniCtx = null;
- try
- {
- String host = getServerHost();
- iniCtx = getServerInitialContext();
- Object obj = iniCtx.lookup("ejb:/jaxws-cxf-bus-ejb3-client//EJB3Client!" + EJB3ClientRemoteInterface.class.getName());
- EJB3ClientRemoteInterface ejb3Remote = (EJB3ClientRemoteInterface)obj;
- ejb3Remote.testBusCreation();
- ejb3Remote.testSOAPConnection(host);
- ejb3Remote.testWebServiceClient(host);
- ejb3Remote.testWebServiceRef();
- }
- finally
- {
- if (iniCtx != null)
- {
- iniCtx.close();
- }
- undeploy(DeploymentArchives.EJB3_CLIENT);
- }
- }
-}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ServletClientBusTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ServletClientBusTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/bus/ServletClientBusTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -1,70 +0,0 @@
-/*
- * 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.cxf.bus;
-
-import java.net.URL;
-
-import junit.framework.Test;
-
-import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A test case that verifies Bus references do not leak into servlet clients
- *
- * @author alessio.soldano(a)jboss.com
- * @since 01-Mar-2011
- *
- */
-public class ServletClientBusTestCase extends JBossWSTest
-{
- public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-cxf-bus-servlet-client";
-
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(ServletClientBusTestCase.class, DeploymentArchives.SERVER);
- }
-
- public void testSingleDeploy() throws Exception
- {
- deploy(DeploymentArchives.SERVLET_CLIENT);
- try
- {
- URL url = new URL(TARGET_ENDPOINT_ADDRESS + "?method=testBusCreation");
- assertEquals("OK testBusCreation", IOUtils.readAndCloseStream(url.openStream()));
-
- url = new URL(TARGET_ENDPOINT_ADDRESS + "?method=testSOAPConnection&host=" + getServerHost());
- assertEquals("OK testSOAPConnection", IOUtils.readAndCloseStream(url.openStream()));
-
- url = new URL(TARGET_ENDPOINT_ADDRESS + "?method=testWebServiceRef");
- assertEquals("OK testWebServiceRef", IOUtils.readAndCloseStream(url.openStream()));
-
- url = new URL(TARGET_ENDPOINT_ADDRESS + "?method=testWebServiceClient&host=" + getServerHost());
- assertEquals("OK testWebServiceClient", IOUtils.readAndCloseStream(url.openStream()));
- }
- finally
- {
- undeploy(DeploymentArchives.SERVLET_CLIENT);
- }
- }
-}
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/catalog/OasisCatalogHelloWSTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/catalog/OasisCatalogHelloWSTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/catalog/OasisCatalogHelloWSTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -1,71 +1,87 @@
+/*
+ * 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.cxf.catalog;
-import junit.framework.Test;
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.catalog.OASISCatalogManager;
+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.FileAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+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;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-import java.io.File;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.LinkedList;
-import java.util.List;
-
/**
* User: rsearls
* Date: 7/9/14
*/
+(a)RunWith(Arquillian.class)
public class OasisCatalogHelloWSTestCase extends JBossWSTest
{
- private final String endpointAddress = "http://" + getServerHost() + ":8080/jaxws-cxf-catalog/HelloService";
-
- public static BaseDeployment<?>[] createDeployments() {
-
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-catalog.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloRequest.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloResponse.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloWsImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.class)
- .add(new FileAsset(new File(JBossWSTestHelper.getTestResourcesDir() +
- "/jaxws/cxf/catalog/META-INF/jax-ws-catalog.xml")),
- "META-INF/jax-ws-catalog.xml")
-
- // stnd file locations required for successful deployment
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
- + "/jaxws/cxf/catalog/META-INF/wsdl/HelloService.wsdl"), "wsdl/HelloService.wsdl")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
- + "/jaxws/cxf/catalog/META-INF/wsdl/Hello_schema1.xsd"), "wsdl/Hello_schema1.xsd")
-
- // sever side catalog maps to these files.
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
- + "/jaxws/cxf/catalog/META-INF/wsdl/HelloService.wsdl"), "wsdl/foo/HelloService.wsdl")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
- + "/jaxws/cxf/catalog/META-INF/wsdl/Hello_schema1.xsd"), "wsdl/foo/Hello_schema1.xsd")
-
- ;
- }
- });
- 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-cxf-catalog.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloRequest.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloWsImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.class)
+ .add(new FileAsset(new File(JBossWSTestHelper.getTestResourcesDir() +
+ "/jaxws/cxf/catalog/META-INF/jax-ws-catalog.xml")), "META-INF/jax-ws-catalog.xml")
+ // stnd file locations required for successful deployment
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ + "/jaxws/cxf/catalog/META-INF/wsdl/HelloService.wsdl"), "wsdl/HelloService.wsdl")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ + "/jaxws/cxf/catalog/META-INF/wsdl/Hello_schema1.xsd"), "wsdl/Hello_schema1.xsd")
+ // sever side catalog maps to these files.
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ + "/jaxws/cxf/catalog/META-INF/wsdl/HelloService.wsdl"), "wsdl/foo/HelloService.wsdl")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ + "/jaxws/cxf/catalog/META-INF/wsdl/Hello_schema1.xsd"), "wsdl/foo/Hello_schema1.xsd");
+ writeToDisk(archive);
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(OasisCatalogHelloWSTestCase.class,
- JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testCatalogOnClientSide() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -83,7 +99,7 @@
QName serviceName = new QName(
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.TARGET_NAMESPACE,
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.NAME);
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "HelloService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
OASISCatalogManager catalogManager = bus.getExtension(OASISCatalogManager.class);
@@ -98,6 +114,8 @@
}
}
+ @Test
+ @RunAsClient
public void testCatalogInJbosswsCxfClientJar() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -107,7 +125,7 @@
QName serviceName = new QName(
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.TARGET_NAMESPACE,
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.NAME);
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "HelloService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
// jbossws-cxf-client.Jar is on the classpath by default.
@@ -125,6 +143,8 @@
}
+ @Test
+ @RunAsClient
public void testCatalogOnServerSide() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -134,7 +154,7 @@
QName serviceName = new QName(
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.TARGET_NAMESPACE,
org.jboss.test.ws.jaxws.cxf.catalog.HelloWs.NAME);
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "HelloService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
HelloWs proxy = service.getPort(HelloWs.class);
HelloRequest helloReq = new HelloRequest();
@@ -145,4 +165,10 @@
bus.shutdown(true);
}
}
+
+ public static void writeToDisk(WebArchive archive)
+ {
+ File file = new File(JBossWSTestHelper.getTestArchiveDir(), archive.getName());
+ archive.as(ZipExporter.class).exportTo(file, true);
+ }
}
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/continuations/ContinuationsTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/continuations/ContinuationsTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/continuations/ContinuationsTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -23,8 +23,6 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
import java.util.concurrent.Future;
import javax.xml.namespace.QName;
@@ -32,13 +30,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.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;
/**
* Asynchronous web services test case with endpoint impl making
@@ -47,32 +49,28 @@
* @author alessio.soldano(a)jboss.com
* @since 21-Jun-2012
*/
+(a)RunWith(Arquillian.class)
public class ContinuationsTestCase extends JBossWSTest
{
- private String endpointAddress = "http://" + getServerHost() + ":8080/jaxws-cxf-continuations";
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-continuations.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.continuations.EndpointImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/continuations/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-cxf-continuations.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.continuations.EndpointImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/continuations/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(ContinuationsTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testAsyncEndpoint() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/continuations", "EndpointImplService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
Endpoint proxy = service.getPort(Endpoint.class);
final String user = "Kermit";
@@ -80,10 +78,12 @@
assertEquals(user + " (ASYNC)", proxy.echoAsync(user).get());
}
+ @Test
+ @RunAsClient
public void testAsyncEndpointUsingHandler() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/continuations", "EndpointImplService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
Endpoint proxy = service.getPort(Endpoint.class);
final String user = "Kermit";
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endorse/EndorseTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -23,18 +23,21 @@
import java.io.File;
import java.net.URL;
-import java.util.LinkedList;
-import java.util.List;
-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.stack.cxf.client.ProviderImpl;
-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;
/**
* Test required endorsing when using the CXF stack
@@ -42,49 +45,56 @@
* @author alessio.soldano(a)jboss.com
* @since 02-Jun-2010
*/
+(a)RunWith(Arquillian.class)
public class EndorseTestCase extends JBossWSTest
{
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-endorse.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client services export\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.endorse.Helper.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.endorse.TestServlet.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/endorse/WEB-INF/web.xml"));
- }
- });
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-endorse-no-export.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.cxf.endorse.Helper.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.endorse.TestServlet.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/endorse/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ private static final String ENDORSE_DEP= "jaxws-cxf-endorse";
+ private static final String ENDORSE_NO_EXPORT_DEP= "jaxws-cxf-endorse-no-export";
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(name = ENDORSE_DEP, testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, ENDORSE_DEP + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client services export\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.endorse.Helper.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.endorse.TestServlet.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/endorse/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(EndorseTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
+ @Deployment(name = ENDORSE_NO_EXPORT_DEP, testable = false)
+ public static WebArchive createDeployment2() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, ENDORSE_NO_EXPORT_DEP + ".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.cxf.endorse.Helper.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.endorse.TestServlet.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/endorse/WEB-INF/web.xml"));
+ return archive;
}
-
+
public void testClientSide()
{
Helper.verifyCXF();
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(ENDORSE_DEP)
public void testServerSide() throws Exception
{
- runServerTest(new URL("http://" + getServerHost() + ":8080/jaxws-cxf-endorse?provider=" + ProviderImpl.class.getName()));
+ runServerTest(new URL(baseURL + "?provider=" + ProviderImpl.class.getName()));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(ENDORSE_NO_EXPORT_DEP)
public void testServerSideNoExport() throws Exception
{
- runServerTest(new URL("http://" + getServerHost() + ":8080/jaxws-cxf-endorse-no-export?provider=" + ProviderImpl.class.getName()));
+ runServerTest(new URL(baseURL + "?provider=" + ProviderImpl.class.getName()));
}
private static void runServerTest(URL url) throws Exception {
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/EndpointTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -23,70 +23,72 @@
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.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.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;
/**
* @author Magesh Kumar B <mageshbk(a)jboss.com> (C) 2011 Red Hat Inc.
*/
+(a)RunWith(Arquillian.class)
public class EndpointTestCase extends JBossWSTest
{
- private static String publishURL = "http://" + getServerHost() + ":18080/HelloWorldService";
+ private static final String DEP = "jaxws-cxf-endpoint";
+ //TODO! figure out proper way for getting the address
+ private static String publishURL = "http://" + getServerHost() + ":48084/HelloWorldService";
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-endpoint.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.common\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.HelloWorldImpl.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.TestServlet.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/endpoint/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
- }
+ @ArquillianResource
+ Deployer deployer;
- public static Test suite()
- {
- return new JBossWSTestSetup(EndpointTestCase.class, "");
- }
+ @Deployment(name = DEP, testable = false, managed = false)
+ public static WebArchive createDeployment()
+ {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n" + "Dependencies: org.jboss.ws.common\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.HelloWorldImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.endpoint.TestServlet.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/endpoint/WEB-INF/web.xml"));
+ return archive;
+ }
- public void testClassLoader() throws Exception
- {
- final String deploymentName = JBossWSTestHelper.writeToFile(createDeployments());
- deploy(deploymentName);
- HelloWorld port = this.getProxy(publishURL);
- String classLoader1 = port.getClassLoader();
- String deploymentClassLoader1 = port.getDeploymentClassLoader();
- undeploy(deploymentName);
- assertEquals(classLoader1, deploymentClassLoader1);
- deploy(deploymentName);
- port = this.getProxy(publishURL);
- String classLoader2 = port.getClassLoader();
- String deploymentClassLoader2 = port.getDeploymentClassLoader();
- undeploy(deploymentName);
- assertEquals(classLoader2, deploymentClassLoader2);
- assertFalse(classLoader1.equals(classLoader2));
- }
+ @Test
+ @RunAsClient
+ public void testClassLoader() throws Exception
+ {
+ deployer.deploy(DEP);
+ HelloWorld port = this.getProxy(publishURL);
+ String classLoader1 = port.getClassLoader();
+ String deploymentClassLoader1 = port.getDeploymentClassLoader();
+ deployer.undeploy(DEP);
+ assertEquals(classLoader1, deploymentClassLoader1);
+ deployer.deploy(DEP);
+ port = this.getProxy(publishURL);
+ String classLoader2 = port.getClassLoader();
+ String deploymentClassLoader2 = port.getDeploymentClassLoader();
+ deployer.undeploy(DEP);
+ assertEquals(classLoader2, deploymentClassLoader2);
+ assertFalse(classLoader1.equals(classLoader2));
+ }
- private HelloWorld getProxy(String publishURL) throws Exception
- {
- URL wsdlURL = new URL(publishURL + "?wsdl");
- QName qname = new QName("http://org.jboss.ws/jaxws/cxf/endpoint", "HelloWorldService");
- Service service = Service.create(wsdlURL, qname);
- return (HelloWorld)service.getPort(HelloWorld.class);
- }
+ private HelloWorld getProxy(String publishURL) throws Exception
+ {
+ URL wsdlURL = new URL(publishURL + "?wsdl");
+ QName qname = new QName("http://org.jboss.ws/jaxws/cxf/endpoint", "HelloWorldService");
+ Service service = Service.create(wsdlURL, qname);
+ return (HelloWorld) service.getPort(HelloWorld.class);
+ }
}
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/TestServlet.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/TestServlet.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/endpoint/TestServlet.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -40,7 +40,7 @@
public void init(ServletConfig config) throws ServletException
{
String hostName = toIPv6URLFormat(System.getProperty("jboss.bind.address", "localhost"));
- String serviceURL = "http://" + hostName + ":18080/HelloWorldService";
+ String serviceURL = "http://" + hostName + ":48084/HelloWorldService";
_endpoint = Endpoint.publish(serviceURL, new HelloWorldImpl(Thread.currentThread().getContextClassLoader()));
}
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/fastinfoset/FastInfosetTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/fastinfoset/FastInfosetTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/fastinfoset/FastInfosetTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -25,48 +25,46 @@
import java.io.File;
import java.io.PrintWriter;
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.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
+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.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;
+(a)RunWith(Arquillian.class)
public class FastInfosetTestCase extends JBossWSTest
{
- private String endpointURl = "http://" + getServerHost() + ":8080/jaxws-cxf-fastinfoset/HelloWorldService/HelloWorldImpl";
-
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-cxf-fastinfoset.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.fastinfoset.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.fastinfoset.HelloWorldImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/fastinfoset/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-cxf-fastinfoset.war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.fastinfoset.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.fastinfoset.HelloWorldImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/fastinfoset/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(FastInfosetTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
public void testInfoset() throws Exception
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
@@ -79,7 +77,7 @@
bus.getInInterceptors().add(new LoggingInInterceptor(pwIn));
bus.getOutInterceptors().add(new LoggingOutInterceptor(pwOut));
- URL wsdlURL = new URL(endpointURl + "?wsdl");
+ URL wsdlURL = new URL(baseURL + "HelloWorldService/HelloWorldImpl?wsdl");
QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/fastinfoset", "HelloWorldService");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
QName portQName = new QName("http://org.jboss.ws/jaxws/cxf/fastinfoset", "HelloWorldImplPort");
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/DeploymentArchives.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/DeploymentArchives.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/DeploymentArchives.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -1,56 +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.cxf.gzip;
-
-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-cxf-gzip.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.apache.cxf\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorldImpl.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/gzip/WEB-INF/web.xml"));
- }
- });
-
- public static final String CLIENT = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-cxf-gzip-client.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client services,org.apache.cxf.impl\n"))
- .addClass(org.jboss.test.ws.jaxws.cxf.gzip.GZIPEnforcingInInterceptor.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorld.class)
- .addClass(org.jboss.test.ws.jaxws.cxf.gzip.Helper.class)
- .addClass(org.jboss.wsf.test.ClientHelper.class)
- .addClass(org.jboss.wsf.test.TestServlet.class);
- }
- });
-
- private DeploymentArchives() {
- //NO OP
- }
-}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPServletTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPServletTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPServletTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -1,83 +0,0 @@
-/*
- * 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.cxf.gzip;
-
-import java.net.URL;
-
-import junit.framework.Test;
-
-import org.jboss.ws.common.IOUtils;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * This covers the same tests of GZIPTestCase but runs them via a Servlet client
- *
- * @author alessio.soldano(a)jboss.com
- * @since 01-Apr-2011
- *
- */
-public class GZIPServletTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(GZIPServletTestCase.class, DeploymentArchives.SERVER + ", " + DeploymentArchives.CLIENT);
- }
-
- public void testGZIPUsingFeatureOnBus() throws Exception
- {
- assertEquals("1", runTestInContainer("testGZIPUsingFeatureOnBus"));
- }
-
- public void testGZIPUsingFeatureOnClient() throws Exception
- {
- assertEquals("1", runTestInContainer("testGZIPUsingFeatureOnClient"));
- }
-
- public void testGZIPServerSideOnlyInterceptorOnClient() throws Exception
- {
- assertEquals("1", runTestInContainer("testGZIPServerSideOnlyInterceptorOnClient"));
- }
-
- public void testFailureGZIPServerSideOnlyInterceptorOnClient() throws Exception
- {
- assertEquals("1", runTestInContainer("testFailureGZIPServerSideOnlyInterceptorOnClient"));
- }
-
- public void testGZIPServerSideOnlyInterceptorsOnBus() throws Exception
- {
- assertEquals("1", runTestInContainer("testGZIPServerSideOnlyInterceptorsOnBus"));
- }
-
- public void testFailureGZIPServerSideOnlyInterceptorsOnBus() throws Exception
- {
- assertEquals("1", runTestInContainer("testFailureGZIPServerSideOnlyInterceptorsOnBus"));
- }
-
- private String runTestInContainer(String test) throws Exception
- {
- URL url = new URL("http://" + getServerHost()
- + ":8080/jaxws-cxf-gzip-client?path=/jaxws-cxf-gzip/HelloWorldService/HelloWorldImpl&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/cxf/gzip/GZIPTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPTestCase.java 2014-11-24 16:27:07 UTC (rev 19112)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/gzip/GZIPTestCase.java 2014-11-26 11:35:37 UTC (rev 19113)
@@ -21,10 +21,22 @@
*/
package org.jboss.test.ws.jaxws.cxf.gzip;
-import junit.framework.Test;
+import java.io.File;
+import java.net.URL;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
+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.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
*
@@ -32,51 +44,148 @@
* @since 15-Sep-2010
*
*/
+(a)RunWith(Arquillian.class)
public class GZIPTestCase extends JBossWSTest
{
- private String gzipFeatureEndpointURL = "http://" + getServerHost() + ":8080/jaxws-cxf-gzip/HelloWorldService/HelloWorldImpl";
+ private static final String DEP = "jaxws-cxf-gzip";
+ private static final String CLIENT_DEP = "jaxws-cxf-gzip-client";
+ @ArquillianResource
+ private URL baseURL;
+
private Helper helper;
+
+ @Deployment(name = DEP, testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, DEP + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.apache.cxf\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorldImpl.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/cxf/gzip/WEB-INF/web.xml"));
+ return archive;
+ }
- public static Test suite()
+ @Deployment(name = CLIENT_DEP, testable = false)
+ public static WebArchive createClientDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, CLIENT_DEP + ".war");
+ archive.setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client services,org.apache.cxf.impl\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.GZIPEnforcingInInterceptor.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.gzip.Helper.class)
+ .addClass(org.jboss.wsf.test.ClientHelper.class)
+ .addClass(org.jboss.wsf.test.TestServlet.class);
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerGZIPUsingFeatureOnBus() throws Exception
{
- return new JBossWSCXFTestSetup(GZIPTestCase.class, DeploymentArchives.SERVER);
+ assertEquals("1", runTestInContainer("testGZIPUsingFeatureOnBus"));
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerGZIPUsingFeatureOnClient() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testGZIPUsingFeatureOnClient"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerGZIPServerSideOnlyInterceptorOnClient() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testGZIPServerSideOnlyInterceptorOnClient"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerFailureGZIPServerSideOnlyInterceptorOnClient() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testFailureGZIPServerSideOnlyInterceptorOnClient"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerGZIPServerSideOnlyInterceptorsOnBus() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testGZIPServerSideOnlyInterceptorsOnBus"));
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(CLIENT_DEP)
+ public void testInContainerFailureGZIPServerSideOnlyInterceptorsOnBus() throws Exception
+ {
+ assertEquals("1", runTestInContainer("testFailureGZIPServerSideOnlyInterceptorsOnBus"));
+ }
+
+ private String runTestInContainer(String test) throws Exception
+ {
+ URL url = new URL(baseURL + "?path=/jaxws-cxf-gzip/HelloWorldService/HelloWorldImpl&method=" + test
+ + "&helper=" + Helper.class.getName());
+ return IOUtils.readAndCloseStream(url.openStream());
+ }
+
private Helper getHelper()
{
if (helper == null)
{
- helper = new Helper(gzipFeatureEndpointURL);
+ helper = new Helper(baseURL + "HelloWorldService/HelloWorldImpl");
}
return helper;
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testGZIPUsingFeatureOnBus() throws Exception
{
assertTrue(getHelper().testGZIPUsingFeatureOnBus());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testGZIPUsingFeatureOnClient() throws Exception
{
assertTrue(getHelper().testGZIPUsingFeatureOnClient());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testGZIPServerSideOnlyInterceptorOnClient() throws Exception
{
assertTrue(getHelper().testGZIPServerSideOnlyInterceptorOnClient());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testFailureGZIPServerSideOnlyInterceptorOnClient() throws Exception
{
assertTrue(getHelper().testFailureGZIPServerSideOnlyInterceptorOnClient());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testGZIPServerSideOnlyInterceptorsOnBus() throws Exception
{
assertTrue(getHelper().testGZIPServerSideOnlyInterceptorsOnBus());
}
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(DEP)
public void testFailureGZIPServerSideOnlyInterceptorsOnBus() throws Exception
{
assertTrue(getHelper().testFailureGZIPServerSideOnlyInterceptorsOnBus());
10 years
JBossWS SVN: r19112 - stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-11-24 11:27:07 -0500 (Mon, 24 Nov 2014)
New Revision: 19112
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java
Log:
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java 2014-11-24 16:22:05 UTC (rev 19111)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestUtils.java 2014-11-24 16:27:07 UTC (rev 19112)
@@ -21,20 +21,18 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+
import org.apache.cxf.Bus;
import org.apache.cxf.ws.security.SecurityConstants;
import org.apache.cxf.ws.security.trust.STSClient;
import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.ClientCallbackHandler;
import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.UsernameTokenCallbackHandler;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTestHelper;
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* Some client util methods for WS-Trust testcases
*
@@ -43,18 +41,6 @@
*/
public class WSTrustTestUtils
{
- public static JBossWSCXFTestSetup getTestSetup(Class<?> testClass, String archives) {
- JBossWSCXFTestSetup testSetup = new JBossWSCXFTestSetup(testClass, archives);
- Map<String, String> authenticationOptions = new HashMap<String, String>();
- authenticationOptions.put("usersProperties",
- JBossWSTestHelper.getResourceFile("jaxws/samples/wsse/policy/trust/WEB-INF/jbossws-users.properties").getAbsolutePath());
- authenticationOptions.put("rolesProperties",
- JBossWSTestHelper.getResourceFile("jaxws/samples/wsse/policy/trust/WEB-INF/jbossws-roles.properties").getAbsolutePath());
- authenticationOptions.put("unauthenticatedIdentity", "anonymous");
- testSetup.addSecurityDomainRequirement("JBossWS-trust-sts", authenticationOptions);
- return testSetup;
- }
-
public static void setupWsseAndSTSClient(ServiceIface proxy, Bus bus, String stsWsdlLocation, QName stsService, QName stsPort)
{
Map<String, Object> ctx = ((BindingProvider) proxy).getRequestContext();
10 years
JBossWS SVN: r19111 - in stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test: scripts and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-11-24 11:22:05 -0500 (Mon, 24 Nov 2014)
New Revision: 19111
Removed:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/DeploymentArchives.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustBearerTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustHolderOfKeyTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustOnBehalfOfTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy
Log:
Converting WS-Trust tests...
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/DeploymentArchives.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/DeploymentArchives.java 2014-11-21 16:35:25 UTC (rev 19110)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/DeploymentArchives.java 2014-11-24 16:22:05 UTC (rev 19111)
@@ -1,187 +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.trust;
-
-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 STS_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-trust-sts.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl annotations\n")) //cxf impl required to extend STS impl
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.STSCallbackHandler.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.SampleSTS.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"), "jboss-web.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ws-trust-1.4-service.wsdl"), "wsdl/ws-trust-1.4-service.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"), "classes/stsstore.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsKeystore.properties"), "classes/stsKeystore.properties")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/web.xml"));
- }
- });
-
- public static final String SERVER_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-trust.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.trust.service.ServerCallbackHandler.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceImpl.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/SecurityService.wsdl"), "wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/SecurityService_schema1.xsd"), "wsdl/SecurityService_schema1.xsd")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/servicestore.jks"), "classes/servicestore.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/serviceKeystore.properties"), "classes/serviceKeystore.properties");
- }
- });
-
- public static final String CLIENT_JAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-trust-client.jar") { {
- archive
- .addManifest()
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientKeystore.properties"), "clientKeystore.properties")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientstore.jks"), "clientstore.jks");
- }
- });
-
- public static final String SERVER_ACTAS_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-trust-actas.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.jaxws.SayHello.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsCallbackHandler.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceImpl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ActAsService.wsdl"), "wsdl/ActAsService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ActAsService_schema1.xsd"), "wsdl/ActAsService_schema1.xsd")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/actasstore.jks"), "classes/actasstore.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/actasKeystore.properties"), "classes/actasKeystore.properties")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientstore.jks"), "clientstore.jks")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientKeystore.properties"), "clientKeystore.properties")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/permissions.xml"), "permissions.xml");
- }
- });
-
- public static final String SERVER_ONBEHALFOF_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-trust-onbehalfof.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.jaxws.SayHello.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfCallbackHandler.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceImpl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService.wsdl"), "wsdl/OnBehalfOfService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService_schema1.xsd"), "wsdl/OnBehalfOfService_schema1.xsd")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/actasstore.jks"), "classes/actasstore.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/actasKeystore.properties"), "classes/actasKeystore.properties")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientstore.jks"), "clientstore.jks")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientKeystore.properties"), "clientKeystore.properties")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/permissions.xml"), "permissions.xml");
- }
- });
-
- public static final String STS_HOLDEROFKEY_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-trust-sts-holderofkey.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl annotations\n")) //cxf impl required to extend STS impl
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsholderofkey.STSHolderOfKeyCallbackHandler.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsholderofkey.SampleSTSHolderOfKey.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"), "jboss-web.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/holderofkey-ws-trust-1.4-service.wsdl"), "wsdl/holderofkey-ws-trust-1.4-service.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"), "classes/stsstore.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsKeystore.properties"), "classes/stsKeystore.properties")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/holderofkey/web.xml"));
- }
- });
-
- public static final String SERVER_HOLDEROFKEY_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-trust-holderofkey.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.trust.holderofkey.HolderOfKeyCallbackHandler.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.holderofkey.HolderOfKeyIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.holderofkey.HolderOfKeyImpl.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/HolderOfKeyService.wsdl"), "wsdl/HolderOfKeyService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/HolderOfKeyService_schema1.xsd"), "wsdl/HolderOfKeyService_schema1.xsd")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/servicestore.jks"), "classes/servicestore.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/serviceKeystore.properties"), "classes/serviceKeystore.properties");
- }
- });
-
- public static final String STS_PICKETLINK_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-trustPicketLink-sts.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client,org.picketlink\n"))
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.picketlink.PicketLinkSTService.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.STSCallbackHandler.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"), "jboss-web.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/PicketLinkSTS.wsdl"), "wsdl/PicketLinkSTS.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"), "classes/stsstore.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/picketlink-sts.xml"), "classes/picketlink-sts.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsKeystore.properties"), "classes/stsKeystore.properties");
- }
- });
-
- public static final String STS_BEARER_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-trust-sts-bearer.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl annotations\n")) //cxf impl required to extend STS impl
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsbearer.STSBearerCallbackHandler.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsbearer.SampleSTSBearer.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"), "jboss-web.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/bearer-ws-trust-1.4-service.wsdl"), "wsdl/bearer-ws-trust-1.4-service.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"), "classes/stsstore.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsKeystore.properties"), "classes/stsKeystore.properties")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/bearer/web.xml"));
- }
- });
-
- public static final String SERVER_BEARER_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-trust-bearer.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.trust.bearer.BearerIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.bearer.BearerImpl.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/BearerService.wsdl"), "wsdl/BearerService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/BearerService_schema1.xsd"), "wsdl/BearerService_schema1.xsd")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/servicestore.jks"), "classes/servicestore.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/serviceKeystore.properties"), "classes/serviceKeystore.properties");
- }
- });
-
- private DeploymentArchives() {
- //NOOP
- }
-}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java 2014-11-21 16:35:25 UTC (rev 19110)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustActAsTestCase.java 2014-11-24 16:22:05 UTC (rev 19111)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.trust;
-
-import junit.framework.Test;
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface;
-import org.jboss.wsf.test.JBossWSTest;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import java.net.URL;
-
-/**
- * A demo of using WS-Trust ActAs extension.
- *
- * User: rsearls(a)redhat.com
- * Date: 1/26/14
- */
-public class WSTrustActAsTestCase extends JBossWSTest
-{
- private final String serviceURL = "http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-trust-actas/ActAsService";
-
- public static Test suite()
- {
- //deploy client, STS and service; start a security domain to be used by the STS for authenticating client
- return WSTrustTestUtils.getTestSetup(WSTrustActAsTestCase.class,
- DeploymentArchives.CLIENT_JAR + " " + DeploymentArchives.STS_WAR + " " + DeploymentArchives.SERVER_WAR + " " + DeploymentArchives.SERVER_ACTAS_WAR);
- }
-
- /**
- * Request a security token that allows it to act as if it were somebody else.
- *
- * @throws Exception
- */
- public void testActAs() throws Exception
- {
- Bus bus = BusFactory.newInstance().createBus();
- try
- {
- BusFactory.setThreadDefaultBus(bus);
-
- final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy", "ActAsService");
- final URL wsdlURL = new URL(serviceURL + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- ActAsServiceIface proxy = (ActAsServiceIface) service.getPort(ActAsServiceIface.class);
-
- WSTrustTestUtils.setupWsseAndSTSClientActAs((BindingProvider) proxy, bus);
-
- assertEquals("ActAs WS-Trust Hello World!", proxy.sayHello());
- }
- finally
- {
- bus.shutdown(true);
- }
- }
-
-}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustBearerTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustBearerTestCase.java 2014-11-21 16:35:25 UTC (rev 19110)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustBearerTestCase.java 2014-11-24 16:22:05 UTC (rev 19111)
@@ -1,86 +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.trust;
-
-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.Bus;
-import org.apache.cxf.BusFactory;
-import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.bearer.BearerIface;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A demo of using SAML Bearer key type
- *
- * User: rsearls(a)redhat.com
- * Date: 2/24/14
- */
-public class WSTrustBearerTestCase extends JBossWSTest
-{
- private final String serviceURL = "https://" + getServerHost() + ":8443/jaxws-samples-wsse-policy-trust-bearer/BearerService";
-
- public static Test suite()
- {
- //deploy client, STS and service; start a security domain to be used by the STS for authenticating client
- JBossWSCXFTestSetup testSetup = WSTrustTestUtils.getTestSetup(WSTrustBearerTestCase.class,
- DeploymentArchives.CLIENT_JAR + " " + DeploymentArchives.STS_BEARER_WAR + " " + DeploymentArchives.SERVER_BEARER_WAR);
-
- // setup the https connector in the server config file.
- 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");
- testSetup.setHttpsConnectorRequirement(sslOptions);
- return testSetup;
- }
-
- public void testBearer() throws Exception
- {
- Bus bus = BusFactory.newInstance().createBus();
- try
- {
- BusFactory.setThreadDefaultBus(bus);
-
- final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/bearerwssecuritypolicy", "BearerService");
- Service service = Service.create(new URL(serviceURL + "?wsdl"), serviceName);
- BearerIface proxy = (BearerIface) service.getPort(BearerIface.class);
-
- WSTrustTestUtils.setupWsseAndSTSClientBearer((BindingProvider) proxy, bus);
- assertEquals("Bearer WS-Trust Hello World!", proxy.sayHello());
-
- }
- finally
- {
- bus.shutdown(true);
- }
- }
-
-}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustHolderOfKeyTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustHolderOfKeyTestCase.java 2014-11-21 16:35:25 UTC (rev 19110)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustHolderOfKeyTestCase.java 2014-11-24 16:22:05 UTC (rev 19111)
@@ -1,88 +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.trust;
-
-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.Bus;
-import org.apache.cxf.BusFactory;
-import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.holderofkey.HolderOfKeyIface;
-import org.jboss.wsf.test.JBossWSCXFTestSetup;
-import org.jboss.wsf.test.JBossWSTest;
-
-/**
- * A demo of using SAML Holder-of-key
- *
- * User: rsearls(a)redhat.com
- * Date: 3/14/14
- */
-public class WSTrustHolderOfKeyTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- //deploy client, STS and service; start a security domain to be used by the STS for authenticating client
- JBossWSCXFTestSetup testSetup = WSTrustTestUtils.getTestSetup(WSTrustHolderOfKeyTestCase.class,
- DeploymentArchives.CLIENT_JAR + " " + DeploymentArchives.STS_HOLDEROFKEY_WAR + " " + DeploymentArchives.SERVER_HOLDEROFKEY_WAR);
-
- // setup the https connector in the server config file.
- 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");
-
- testSetup.setHttpsConnectorRequirement(sslOptions);
- return testSetup;
-
- }
-
- public void testBearer() throws Exception
- {
-
- Bus bus = BusFactory.newInstance().createBus();
- try
- {
-
- BusFactory.setThreadDefaultBus(bus);
-
- final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/holderofkeywssecuritypolicy", "HolderOfKeyService");
- final URL wsdlURL = new URL("https://" + getServerHost() + ":8443/jaxws-samples-wsse-policy-trust-holderofkey/HolderOfKeyService?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- HolderOfKeyIface proxy = (HolderOfKeyIface) service.getPort(HolderOfKeyIface.class);
-
- WSTrustTestUtils.setupWsseAndSTSClientHolderOfKey((BindingProvider) proxy, bus);
- assertEquals("Holder-Of-Key WS-Trust Hello World!", proxy.sayHello());
-
- } finally
- {
- bus.shutdown(true);
- }
- }
-
-}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustOnBehalfOfTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustOnBehalfOfTestCase.java 2014-11-21 16:35:25 UTC (rev 19110)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustOnBehalfOfTestCase.java 2014-11-24 16:22:05 UTC (rev 19111)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.trust;
-
-import junit.framework.Test;
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface;
-import org.jboss.wsf.test.JBossWSTest;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import java.net.URL;
-
-/**
- * A demo of using WS-Trust ActAs extension.
- *
- * User: rsearls(a)redhat.com
- * Date: 1/26/14
- */
-public class WSTrustOnBehalfOfTestCase extends JBossWSTest
-{
- private final String serviceURL = "http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-trust-onbehalfof/OnBehalfOfService";
-
- public static Test suite()
- {
- //deploy client, STS and service; start a security domain to be used by the STS for authenticating client
- return WSTrustTestUtils.getTestSetup(WSTrustOnBehalfOfTestCase.class,
- DeploymentArchives.CLIENT_JAR + " " + DeploymentArchives.STS_WAR + " " + DeploymentArchives.SERVER_WAR + " " + DeploymentArchives.SERVER_ONBEHALFOF_WAR);
- }
-
- /**
- * Request a security token that allows it to act on behalf of somebody else.
- *
- * @throws Exception
- */
- public void testOnBehalfOf() throws Exception
- {
- Bus bus = BusFactory.newInstance().createBus();
- try
- {
- BusFactory.setThreadDefaultBus(bus);
-
- final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy", "OnBehalfOfService");
- final URL wsdlURL = new URL(serviceURL + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- OnBehalfOfServiceIface proxy = (OnBehalfOfServiceIface) service.getPort(OnBehalfOfServiceIface.class);
-
- /* TODO explain why this is not needed for setup and then remove
- final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
- final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
- */
- WSTrustTestUtils.setupWsseAndSTSClientOnBehalfOf((BindingProvider) proxy, bus);
-
- assertEquals("OnBehalfOf WS-Trust Hello World!", proxy.sayHello());
- }
- finally
- {
- bus.shutdown(true);
- }
- }
-
-}
Deleted: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java 2014-11-21 16:35:25 UTC (rev 19110)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustPicketLinkTestCase.java 2014-11-24 16:22:05 UTC (rev 19111)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2012, 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.trust;
-
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-
-import junit.framework.Test;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.jboss.wsf.test.CryptoHelper;
-import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
-
-/**
- * WS-Trust test case using PicketLink implementation of STS
- *
- * @author alessio.soldano(a)jboss.com
- * @since 30-Apr-2012
- */
-public final class WSTrustPicketLinkTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- //deploy client, STS and service; start a security domain to be used by the STS for authenticating client
- return WSTrustTestUtils.getTestSetup(WSTrustPicketLinkTestCase.class,
- DeploymentArchives.CLIENT_JAR + " " + DeploymentArchives.STS_PICKETLINK_WAR + " " + DeploymentArchives.SERVER_WAR);
- }
-
- public void test() throws Exception
- {
- Bus bus = BusFactory.newInstance().createBus();
- try
- {
- BusFactory.setThreadDefaultBus(bus);
-
- final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
- final URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-trust/SecurityService?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
-
- final QName stsServiceName = new QName("urn:picketlink:identity-federation:sts", "PicketLinkSTS");
- final QName stsPortName = new QName("urn:picketlink:identity-federation:sts", "PicketLinkSTSPort");
- WSTrustTestUtils.setupWsseAndSTSClient(proxy, bus, "http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-trustPicketLink-sts/PicketLinkSTS?wsdl",
- stsServiceName, stsPortName);
-
- try {
- assertEquals("WS-Trust Hello World!", proxy.sayHello());
- } catch (Exception e) {
- throw CryptoHelper.checkAndWrapException(e);
- }
- }
- finally
- {
- bus.shutdown(true);
- }
- }
-}
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java 2014-11-21 16:35:25 UTC (rev 19110)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/trust/WSTrustTestCase.java 2014-11-24 16:22:05 UTC (rev 19111)
@@ -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,18 +21,34 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse.policy.trust;
+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.Bus;
import org.apache.cxf.BusFactory;
+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.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.bearer.BearerIface;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.holderofkey.HolderOfKeyIface;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface;
+import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
import org.jboss.wsf.test.CryptoHelper;
import org.jboss.wsf.test.JBossWSTest;
-import org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Trust test case
@@ -40,25 +56,209 @@
* ported to jbossws-cxf for running over JBoss Application Server.
*
* @author alessio.soldano(a)jboss.com
+ * @author rsearls(a)redhat.com
* @since 08-Feb-2012
*/
+(a)RunWith(Arquillian.class)
public class WSTrustTestCase extends JBossWSTest
{
- private final String serviceURL = "http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-trust/SecurityService";
- private final String stsURL = "http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService";
+ private static final String STS_DEP = "jaxws-samples-wsse-policy-trust-sts";
+ private static final String SERVER_DEP = "jaxws-samples-wsse-policy-trust";
+ private static final String ACT_AS_SERVER_DEP = "jaxws-samples-wsse-policy-trust-actas";
+ private static final String ON_BEHALF_OF_SERVER_DEP = "jaxws-samples-wsse-policy-trust-onbehalfof";
+ private static final String HOLDER_OF_KEY_STS_DEP = "jaxws-samples-wsse-policy-trust-sts-holderofkey";
+ private static final String HOLDER_OF_KEY_SERVER_DEP = "jaxws-samples-wsse-policy-trust-holderofkey";
+ private static final String PL_STS_DEP = "jaxws-samples-wsse-policy-trustPicketLink-sts";
+ private static final String BEARER_STS_DEP = "jaxws-samples-wsse-policy-trust-sts-bearer";
+ private static final String BEARER_SERVER_DEP = "jaxws-samples-wsse-policy-trust-bearer";
- public static Test suite()
- {
- //deploy client, STS and service; start a security domain to be used by the STS for authenticating client
- return WSTrustTestUtils.getTestSetup(WSTrustTestCase.class,
- DeploymentArchives.CLIENT_JAR + " " + DeploymentArchives.STS_WAR + " " + DeploymentArchives.SERVER_WAR);
+ @ArquillianResource
+ private URL serviceURL;
+
+ @Deployment(name = STS_DEP, testable = false)
+ public static WebArchive createSTSDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, STS_DEP + ".war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl annotations\n")) //cxf impl required to extend STS impl
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.STSCallbackHandler.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.SampleSTS.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"), "jboss-web.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ws-trust-1.4-service.wsdl"), "wsdl/ws-trust-1.4-service.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"), "classes/stsstore.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsKeystore.properties"), "classes/stsKeystore.properties")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/web.xml"));
+ return archive;
}
+
+ @Deployment(name = SERVER_DEP, testable = false)
+ public static WebArchive createServerDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, SERVER_DEP + ".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.trust.service.ServerCallbackHandler.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceImpl.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/SecurityService.wsdl"), "wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/SecurityService_schema1.xsd"), "wsdl/SecurityService_schema1.xsd")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/servicestore.jks"), "classes/servicestore.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/serviceKeystore.properties"), "classes/serviceKeystore.properties");
+ return archive;
+ }
+
+ @Override
+ protected String getClientJarPaths() {
+ return JBossWSTestHelper.writeToFile(new JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-trust-client.jar") { {
+ archive
+ .addManifest()
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientKeystore.properties"), "clientKeystore.properties")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientstore.jks"), "clientstore.jks");
+ }
+ });
+ }
+
+ @Deployment(name = ACT_AS_SERVER_DEP, testable = false)
+ public static WebArchive createActAsServerDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, ACT_AS_SERVER_DEP + ".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.jaxws.SayHello.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsCallbackHandler.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ActAsService.wsdl"), "wsdl/ActAsService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/ActAsService_schema1.xsd"), "wsdl/ActAsService_schema1.xsd")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/actasstore.jks"), "classes/actasstore.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/actasKeystore.properties"), "classes/actasKeystore.properties")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientstore.jks"), "clientstore.jks")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientKeystore.properties"), "clientKeystore.properties")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/permissions.xml"), "permissions.xml");
+ return archive;
+ }
+
+ @Deployment(name = ON_BEHALF_OF_SERVER_DEP, testable = false)
+ public static WebArchive createOnBehalfOfServerDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, ON_BEHALF_OF_SERVER_DEP + ".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.jaxws.SayHello.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfCallbackHandler.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.shared.WSTrustAppUtils.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService.wsdl"), "wsdl/OnBehalfOfService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/OnBehalfOfService_schema1.xsd"), "wsdl/OnBehalfOfService_schema1.xsd")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/actasstore.jks"), "classes/actasstore.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/actasKeystore.properties"), "classes/actasKeystore.properties")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientstore.jks"), "clientstore.jks")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/clientKeystore.properties"), "clientKeystore.properties")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/META-INF/permissions.xml"), "permissions.xml");
+ return archive;
+ }
+
+ @Deployment(name = HOLDER_OF_KEY_STS_DEP, testable = false)
+ public static WebArchive createHolderOfKeySTSDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, HOLDER_OF_KEY_STS_DEP + ".war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl annotations\n")) //cxf impl required to extend STS impl
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsholderofkey.STSHolderOfKeyCallbackHandler.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsholderofkey.SampleSTSHolderOfKey.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"), "jboss-web.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/holderofkey-ws-trust-1.4-service.wsdl"), "wsdl/holderofkey-ws-trust-1.4-service.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"), "classes/stsstore.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsKeystore.properties"), "classes/stsKeystore.properties")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/holderofkey/web.xml"));
+ return archive;
+ }
+
+ @Deployment(name = HOLDER_OF_KEY_SERVER_DEP, testable = false)
+ public static WebArchive createHolderOfKeyServerDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, HOLDER_OF_KEY_SERVER_DEP + ".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.trust.holderofkey.HolderOfKeyCallbackHandler.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.holderofkey.HolderOfKeyIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.holderofkey.HolderOfKeyImpl.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/HolderOfKeyService.wsdl"), "wsdl/HolderOfKeyService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/HolderOfKeyService_schema1.xsd"), "wsdl/HolderOfKeyService_schema1.xsd")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/servicestore.jks"), "classes/servicestore.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/serviceKeystore.properties"), "classes/serviceKeystore.properties");
+ return archive;
+ }
+
+ @Deployment(name = PL_STS_DEP, testable = false)
+ public static WebArchive createPicketLinkSTSDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, PL_STS_DEP + ".war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client,org.picketlink\n"))
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.picketlink.PicketLinkSTService.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.sts.STSCallbackHandler.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"), "jboss-web.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/PicketLinkSTS.wsdl"), "wsdl/PicketLinkSTS.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"), "classes/stsstore.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/picketlink-sts.xml"), "classes/picketlink-sts.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsKeystore.properties"), "classes/stsKeystore.properties");
+ return archive;
+ }
+
+ @Deployment(name = BEARER_STS_DEP, testable = false)
+ public static WebArchive createBearerSTSDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, BEARER_STS_DEP + ".war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client,org.apache.cxf.impl annotations\n")) //cxf impl required to extend STS impl
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsbearer.STSBearerCallbackHandler.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.stsbearer.SampleSTSBearer.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/jboss-web.xml"), "jboss-web.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/bearer-ws-trust-1.4-service.wsdl"), "wsdl/bearer-ws-trust-1.4-service.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsstore.jks"), "classes/stsstore.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/stsKeystore.properties"), "classes/stsKeystore.properties")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/bearer/web.xml"));
+ return archive;
+ }
+
+ @Deployment(name = BEARER_SERVER_DEP, testable = false)
+ public static WebArchive createBearerServerDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, BEARER_SERVER_DEP + ".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.trust.bearer.BearerIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.trust.bearer.BearerImpl.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/BearerService.wsdl"), "wsdl/BearerService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/wsdl/BearerService_schema1.xsd"), "wsdl/BearerService_schema1.xsd")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/servicestore.jks"), "classes/servicestore.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/trust/WEB-INF/serviceKeystore.properties"), "classes/serviceKeystore.properties");
+ return archive;
+ }
+
/**
* WS-Trust test with the STS information programmatically provided
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER_DEP)
+ @WrapThreadContextClassLoader
public void test() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -67,13 +267,14 @@
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
- final URL wsdlURL = new URL(serviceURL + "?wsdl");
+ final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
- WSTrustTestUtils.setupWsseAndSTSClient(proxy, bus, stsURL + "?wsdl", stsServiceName, stsPortName);
+ URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
+ WSTrustTestUtils.setupWsseAndSTSClient(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
try {
assertEquals("WS-Trust Hello World!", proxy.sayHello());
@@ -92,6 +293,10 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER_DEP)
+ @WrapThreadContextClassLoader
public void testUsingEPR() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -100,7 +305,7 @@
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
- final URL wsdlURL = new URL(serviceURL + "?wsdl");
+ final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
@@ -123,19 +328,24 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER_DEP)
+ @WrapThreadContextClassLoader
public void testNoClientCallback() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
- final URL wsdlURL = new URL(serviceURL + "?wsdl");
+ final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
- WSTrustTestUtils.setupWsseAndSTSClientNoCallbackHandler(proxy, bus, stsURL + "?wsdl", stsServiceName, stsPortName);
+ URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
+ WSTrustTestUtils.setupWsseAndSTSClientNoCallbackHandler(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
assertEquals("WS-Trust Hello World!", proxy.sayHello());
} finally {
@@ -149,6 +359,10 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER_DEP)
+ @WrapThreadContextClassLoader
public void testNoSignatureUsername() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
@@ -157,13 +371,14 @@
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
- final URL wsdlURL = new URL(serviceURL + "?wsdl");
+ final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
- WSTrustTestUtils.setupWsseAndSTSClientNoSignatureUsername(proxy, bus, stsURL + "?wsdl", stsServiceName, stsPortName);
+ URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
+ WSTrustTestUtils.setupWsseAndSTSClientNoSignatureUsername(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
assertEquals("WS-Trust Hello World!", proxy.sayHello());
}
@@ -173,4 +388,157 @@
}
}
+
+ /**
+ * Request a security token that allows it to act as if it were somebody else.
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(ACT_AS_SERVER_DEP)
+ @WrapThreadContextClassLoader
+ public void testActAs() throws Exception
+ {
+ Bus bus = BusFactory.newInstance().createBus();
+ try
+ {
+ BusFactory.setThreadDefaultBus(bus);
+
+ final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy", "ActAsService");
+ final URL wsdlURL = new URL(serviceURL + "ActAsService?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ ActAsServiceIface proxy = (ActAsServiceIface) service.getPort(ActAsServiceIface.class);
+
+ WSTrustTestUtils.setupWsseAndSTSClientActAs((BindingProvider) proxy, bus);
+
+ assertEquals("ActAs WS-Trust Hello World!", proxy.sayHello());
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+ }
+
+ /**
+ * Request a security token that allows it to act on behalf of somebody else.
+ *
+ * @throws Exception
+ */
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(ON_BEHALF_OF_SERVER_DEP)
+ @WrapThreadContextClassLoader
+ public void testOnBehalfOf() throws Exception
+ {
+ Bus bus = BusFactory.newInstance().createBus();
+ try
+ {
+ BusFactory.setThreadDefaultBus(bus);
+
+ final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/onbehalfofwssecuritypolicy", "OnBehalfOfService");
+ final URL wsdlURL = new URL(serviceURL + "OnBehalfOfService?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ OnBehalfOfServiceIface proxy = (OnBehalfOfServiceIface) service.getPort(OnBehalfOfServiceIface.class);
+
+ /* TODO explain why this is not needed for setup and then remove
+ final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
+ final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
+ */
+ WSTrustTestUtils.setupWsseAndSTSClientOnBehalfOf((BindingProvider) proxy, bus);
+
+ assertEquals("OnBehalfOf WS-Trust Hello World!", proxy.sayHello());
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(HOLDER_OF_KEY_SERVER_DEP)
+ @WrapThreadContextClassLoader
+ public void testHolderOfKey() throws Exception
+ {
+
+ Bus bus = BusFactory.newInstance().createBus();
+ try
+ {
+
+ BusFactory.setThreadDefaultBus(bus);
+
+ final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/holderofkeywssecuritypolicy", "HolderOfKeyService");
+ final URL wsdlURL = new URL("https", serviceURL.getHost(), serviceURL.getPort() - 8080 + 8443, "/jaxws-samples-wsse-policy-trust-holderofkey/HolderOfKeyService?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ HolderOfKeyIface proxy = (HolderOfKeyIface) service.getPort(HolderOfKeyIface.class);
+
+ WSTrustTestUtils.setupWsseAndSTSClientHolderOfKey((BindingProvider) proxy, bus);
+ assertEquals("Holder-Of-Key WS-Trust Hello World!", proxy.sayHello());
+
+ } finally
+ {
+ bus.shutdown(true);
+ }
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(SERVER_DEP)
+ @WrapThreadContextClassLoader
+ public void testPicketLink() throws Exception
+ {
+ Bus bus = BusFactory.newInstance().createBus();
+ try
+ {
+ BusFactory.setThreadDefaultBus(bus);
+
+ final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
+ final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
+
+ final QName stsServiceName = new QName("urn:picketlink:identity-federation:sts", "PicketLinkSTS");
+ final QName stsPortName = new QName("urn:picketlink:identity-federation:sts", "PicketLinkSTSPort");
+ final URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trustPicketLink-sts/PicketLinkSTS?wsdl");
+ WSTrustTestUtils.setupWsseAndSTSClient(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
+
+ try {
+ assertEquals("WS-Trust Hello World!", proxy.sayHello());
+ } catch (Exception e) {
+ throw CryptoHelper.checkAndWrapException(e);
+ }
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+ }
+
+ @Test
+ @RunAsClient
+ @OperateOnDeployment(BEARER_SERVER_DEP)
+ @WrapThreadContextClassLoader
+ public void testBearer() throws Exception
+ {
+ Bus bus = BusFactory.newInstance().createBus();
+ try
+ {
+ BusFactory.setThreadDefaultBus(bus);
+
+ final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/bearerwssecuritypolicy", "BearerService");
+ Service service = Service.create(new URL(serviceURL + "BearerService?wsdl"), serviceName);
+ BearerIface proxy = (BearerIface) service.getPort(BearerIface.class);
+
+ WSTrustTestUtils.setupWsseAndSTSClientBearer((BindingProvider) proxy, bus);
+ assertEquals("Bearer WS-Trust Hello World!", proxy.sayHello());
+
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+ }
+
+
}
Modified: 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 2014-11-21 16:35:25 UTC (rev 19110)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-default.groovy 2014-11-24 16:22:05 UTC (rev 19111)
@@ -26,6 +26,28 @@
/**
* Add a security-domain block like this:
*
+ * <security-domain name="JBossWS-trust-sts" 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-resources/jaxws/samples/wsse/policy/trust/WEB-INF/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-resources/jaxws/samples/wsse/policy/trust/WEB-INF/jbossws-roles.properties"/>
+ * </login-module>
+ * </authentication>
+ * </security-domain>
+ *
+ */
+
+def securityDomainSts = securityDomains.appendNode('security-domain', ['name':'JBossWS-trust-sts','cache-type':'default'])
+def authenticationSts = securityDomainSts.appendNode('authentication')
+def loginModuleSts = authenticationSts.appendNode('login-module', ['code':'UsersRoles','flag':'required'])
+loginModuleSts.appendNode('module-option', ['name':'unauthenticatedIdentity','value':'anonymous'])
+loginModuleSts.appendNode('module-option', ['name':'usersProperties','value':project.properties['testResourcesDir'] + '/jaxws/samples/wsse/policy/trust/WEB-INF/jbossws-users.properties'])
+loginModuleSts.appendNode('module-option', ['name':'rolesProperties','value':project.properties['testResourcesDir'] + '/jaxws/samples/wsse/policy/trust/WEB-INF/jbossws-roles.properties'])
+
+/**
+ * Add a security-domain block like this:
+ *
* <security-domain name="JBossWSDigest" cache-type="default">
* <authentication>
* <login-module code="UsersRoles" flag="required">
10 years
JBossWS SVN: r19110 - in stack/cxf/branches/arquillian/modules/testsuite/cxf-tests: src/test/etc and 3 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-11-21 11:35:25 -0500 (Fri, 21 Nov 2014)
New Revision: 19110
Added:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-ssl-mutual-auth.groovy
Removed:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/DeploymentArchives.java
Modified:
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml
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/oasis/WSSecurityPolicyExamples22xTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples23xTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/secconv/SecureConversationTestCase.java
Log:
Converted few more tests and added a new server configuration; still to figure out a decent way for getting the host/port(offset) in testcases using manual mode containers...
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml 2014-11-20 20:56:33 UTC (rev 19109)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/pom.xml 2014-11-21 16:35:25 UTC (rev 19110)
@@ -90,6 +90,22 @@
</properties>
</configuration>
</execution>
+ <execution>
+ <id>testsuite-ssl-mutual-auth</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>${basedir}/src/test/scripts/jbws-testsuite-ssl-mutual-auth.groovy</source>
+ <properties>
+ <inputFile>${jboss.home}/standalone/configuration/standalone.xml</inputFile>
+ <outputFile>${jboss.home}/standalone/configuration/jbws-testsuite-ssl-mutual-auth.xml</outputFile>
+ <keystorePath>${project.build.directory}/test-classes/test.keystore</keystorePath>
+ <truststorePath>${project.build.directory}/test-classes/test.truststore</truststorePath>
+ </properties>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin> <!-- This copies jbossws-cxf-factories jar to endorsed dir before the integration-tests are run -->
Modified: 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 2014-11-20 20:56:33 UTC (rev 19109)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml 2014-11-21 16:35:25 UTC (rev 19110)
@@ -19,5 +19,22 @@
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>
+ <container qualifier="ssl-mutual-auth" mode="manual">
+ <configuration>
+ <property name="jbossHome">${jboss.home}</property>
+ <property name="javaVmArguments">-Djboss.socket.binding.port-offset=10000</property>
+ <!-- <property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/jbossas -Dtest.bind.address=${node0}</property> -->
+ <property name="serverConfig">jbws-testsuite-ssl-mutual-auth.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:19990}</property>
+
+ <!-- AS7-4070 -->
+ <property name="waitForPorts">${as.debug.port:18787} ${as.managementPort:19990}</property>
+ <property name="waitForPortsTimeoutInSeconds">8</property>
+ </configuration>
+ </container>
</group>
</arquillian>
Deleted: 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-20 20:56:33 UTC (rev 19109)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/DeploymentArchives.java 2014-11-21 16:35:25 UTC (rev 19110)
@@ -1,86 +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.oasis;
-
-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 CLIENT_JAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-oasis-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");
- }
- });
-
- public static final String SERVER_22X_WAR = JBossWSTestHelper.writeToFile(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-oasis-22x.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.KeystorePasswordCallback.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service221Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service222Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service223Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service224Impl.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/SecurityService.wsdl"), "wsdl/SecurityService.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"
- + "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.KeystorePasswordCallback.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2311Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2312Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2313Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2314Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2315Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2321Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2322Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2323Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2324Impl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.SAMLValidator.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/SecurityService23x.wsdl"), "wsdl/SecurityService23x.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/oasis/WEB-INF/wsdl/SecurityService_schema1.xsd"), "wsdl/SecurityService_schema1.xsd");
- }
- });
-
- private DeploymentArchives() {
- //NOOP
- }
-}
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples22xTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples22xTestCase.java 2014-11-20 20:56:33 UTC (rev 19109)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples22xTestCase.java 2014-11-21 16:35:25 UTC (rev 19110)
@@ -21,19 +21,28 @@
*/
package org.jboss.test.ws.jaxws.samples.wsse.policy.oasis;
+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.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.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback;
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-Security Policy examples
@@ -44,17 +53,45 @@
* @author alessio.soldano(a)jboss.com
* @since 07-Sep-2012
*/
+(a)RunWith(Arquillian.class)
public final class WSSecurityPolicyExamples22xTestCase 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-22x/";
private final QName serviceName = new QName(NS, "SecurityService");
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(WSSecurityPolicyExamples22xTestCase.class,
- DeploymentArchives.SERVER_22X_WAR + " " + DeploymentArchives.CLIENT_JAR);
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-samples-wsse-policy-oasis-22x.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.KeystorePasswordCallback.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service221Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service222Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service223Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service224Impl.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/SecurityService.wsdl"), "wsdl/SecurityService.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-22x-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.2.1 (WSS1.0) X.509 Certificates, Sign, Encrypt
@@ -64,9 +101,12 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test221() throws Exception
{
- Service service = Service.create(new URL(serviceURL + "SecurityService221?wsdl"), serviceName);
+ Service service = Service.create(new URL(baseURL + "SecurityService221?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS, "SecurityService221Port"), ServiceIface.class);
setupWsse(proxy, true);
try {
@@ -86,9 +126,12 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test222() throws Exception
{
- Service service = Service.create(new URL(serviceURL + "SecurityService222?wsdl"), serviceName);
+ Service service = Service.create(new URL(baseURL + "SecurityService222?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS, "SecurityService222Port"), ServiceIface.class);
setupWsse(proxy, true);
try {
@@ -108,9 +151,12 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test223() throws Exception
{
- Service service = Service.create(new URL(serviceURL + "SecurityService223?wsdl"), serviceName);
+ Service service = Service.create(new URL(baseURL + "SecurityService223?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS, "SecurityService223Port"), ServiceIface.class);
setupWsse(proxy, true);
try {
@@ -130,9 +176,12 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test224() throws Exception
{
- Service service = Service.create(new URL(serviceURL + "SecurityService224?wsdl"), serviceName);
+ Service service = Service.create(new URL(baseURL + "SecurityService224?wsdl"), serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(new QName(NS, "SecurityService224Port"), ServiceIface.class);
setupWsse(proxy, false);
try {
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples23xTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples23xTestCase.java 2014-11-20 20:56:33 UTC (rev 19109)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/WSSecurityPolicyExamples23xTestCase.java 2014-11-21 16:35:25 UTC (rev 19110)
@@ -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,20 +21,33 @@
*/
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.arquillian.container.test.api.ContainerController;
+import org.jboss.arquillian.container.test.api.Deployer;
+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.container.test.api.TargetsContainer;
+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.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.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* WS-Security Policy examples
@@ -45,43 +58,82 @@
* @author alessio.soldano(a)jboss.com
* @since 10-Sep-2012
*/
+(a)RunWith(Arquillian.class)
public final class WSSecurityPolicyExamples23xTestCase extends JBossWSTest
{
+ private static final String DEPLOYMENT = "jaxws-samples-wsse-policy-oasis-23x";
+ private static final String SSL_MUTUAL_AUTH_SERVER = "ssl-mutual-auth";
+
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-23x/";
- private final String serviceURLHttps = "https://" + getServerHost() + ":8443/jaxws-samples-wsse-policy-oasis-23x/";
+ //TODO use a proper mechanism for figuring out host/port
+ private final String serviceURL = "http://" + getServerHost() + ":18080/jaxws-samples-wsse-policy-oasis-23x/";
+ private final String serviceURLHttps = "https://" + getServerHost() + ":18443/jaxws-samples-wsse-policy-oasis-23x/";
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("javax.net.ssl.keyStore", "my.keystore");
- System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
- System.setProperty("javax.net.ssl.keyStoreType", "jks");
- System.setProperty("org.jboss.security.ignoreHttpsHost", "true");
- */
- JBossWSCXFTestSetup setup = new JBossWSCXFTestSetup(WSSecurityPolicyExamples23xTestCase.class,
- DeploymentArchives.SERVER_23X_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");
- //enable SSL mutual authentication (https client cert is checked on server side)
- sslOptions.put("verify-client", "REQUESTED");
- sslOptions.put("authentication.truststore.keystore-path", System.getProperty("org.jboss.ws.testsuite.server.truststore"));
- sslOptions.put("authentication.truststore.keystore-password", "changeit");
- setup.setHttpsConnectorRequirement(sslOptions);
- return setup;
+// @ArquillianResource
+// private URL baseURL;
+
+ @ArquillianResource
+ private Deployer deployer;
+
+ @ArquillianResource
+ private ContainerController containerController;
+
+ @Deployment(name = DEPLOYMENT, testable = false, managed = false)
+ @TargetsContainer(SSL_MUTUAL_AUTH_SERVER)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, 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.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.KeystorePasswordCallback.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2311Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2312Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2313Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2314Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2315Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2321Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2322Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2323Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.Service2324Impl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.SAMLValidator.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/SecurityService23x.wsdl"), "wsdl/SecurityService23x.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-23x-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");
+ }
+ });
+ }
+
+ @Before
+ public void startContainerAndDeploy() throws Exception {
+ if (!containerController.isStarted(SSL_MUTUAL_AUTH_SERVER)) {
+ containerController.start(SSL_MUTUAL_AUTH_SERVER);
+ deployer.deploy(DEPLOYMENT);
+ }
+ }
+
/**
* 2.3.1.1 (WSS1.0) SAML1.1 Assertion (Bearer)
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
+ @OperateOnDeployment(DEPLOYMENT)
public void test2311() throws Exception
{
Service service = Service.create(new URL(serviceURL + "SecurityService2311?wsdl"), serviceName);
@@ -95,6 +147,10 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
+ @OperateOnDeployment(DEPLOYMENT)
public void test2312() throws Exception
{
Service service = Service.create(new URL(serviceURLHttps + "SecurityService2312?wsdl"), serviceName);
@@ -110,6 +166,9 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2313() throws Exception
{
Service service = Service.create(new URL(serviceURLHttps + "SecurityService2313?wsdl"), serviceName);
@@ -130,6 +189,9 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2314() throws Exception
{
Service service = Service.create(new URL(serviceURL + "SecurityService2314?wsdl"), serviceName);
@@ -155,6 +217,9 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2315() throws Exception
{
Service service = Service.create(new URL(serviceURL + "SecurityService2315?wsdl"), serviceName);
@@ -181,6 +246,9 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2321() throws Exception
{
Service service = Service.create(new URL(serviceURL + "SecurityService2321?wsdl"), serviceName);
@@ -203,6 +271,9 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2322() throws Exception
{
Service service = Service.create(new URL(serviceURLHttps + "SecurityService2322?wsdl"), serviceName);
@@ -219,6 +290,9 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2323() throws Exception
{
Service service = Service.create(new URL(serviceURLHttps + "SecurityService2323?wsdl"), serviceName);
@@ -240,6 +314,9 @@
*
* @throws Exception
*/
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test2324() throws Exception
{
Service service = Service.create(new URL(serviceURL + "SecurityService2324?wsdl"), serviceName);
Modified: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/secconv/SecureConversationTestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/secconv/SecureConversationTestCase.java 2014-11-20 20:56:33 UTC (rev 19109)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/secconv/SecureConversationTestCase.java 2014-11-21 16:35:25 UTC (rev 19110)
@@ -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,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 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.shrinkwrap.api.spec.WebArchive;
import org.jboss.test.ws.jaxws.samples.wsse.policy.basic.KeystorePasswordCallback;
-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.jboss.wsf.test.WrapThreadContextClassLoader;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Secure Conversation testcase
@@ -51,40 +54,43 @@
* @author alessio.soldano(a)jboss.com
* @since 06-Sep-2012
*/
+(a)RunWith(Arquillian.class)
public final class SecureConversationTestCase extends JBossWSTest
{
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-samples-wsse-policy-secconv.war") { {
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-samples-wsse-policy-secconv.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.secconv.KeystorePasswordCallback.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.secconv.ServiceIface.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.secconv.ServiceImpl.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/WEB-INF/bob.jks"), "classes/bob.jks")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/WEB-INF/bob.properties"), "classes/bob.properties")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/WEB-INF/wsdl/SecurityService.wsdl"), "wsdl/SecurityService.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/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-secconv-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.jaxws.SayHello.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.jaxws.SayHelloResponse.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.secconv.KeystorePasswordCallback.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.secconv.ServiceIface.class)
- .addClass(org.jboss.test.ws.jaxws.samples.wsse.policy.secconv.ServiceImpl.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/WEB-INF/bob.jks"), "classes/bob.jks")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/WEB-INF/bob.properties"), "classes/bob.properties")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/WEB-INF/wsdl/SecurityService.wsdl"), "wsdl/SecurityService.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/WEB-INF/wsdl/SecurityService_schema1.xsd"), "wsdl/SecurityService_schema1.xsd");
- }
- });
- list.add(new JBossWSTestHelper.JarDeployment("jaxws-samples-wsse-policy-secconv-client.jar") { {
- archive
.addManifest()
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/META-INF/alice.jks"), "alice.jks")
.addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/samples/wsse/policy/secconv/META-INF/alice.properties"), "alice.properties");
}
});
- return list.toArray(new BaseDeployment<?>[list.size()]);
}
- public static Test suite()
- {
- return new JBossWSCXFTestSetup(SecureConversationTestCase.class, JBossWSTestHelper.writeToFile(createDeployments()));
- }
-
+ @Test
+ @RunAsClient
+ @WrapThreadContextClassLoader
public void test() throws Exception
{
QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
Added: stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-ssl-mutual-auth.groovy
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-ssl-mutual-auth.groovy (rev 0)
+++ stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-ssl-mutual-auth.groovy 2014-11-21 16:35:25 UTC (rev 19110)
@@ -0,0 +1,42 @@
+def root = new XmlParser().parse(project.properties['inputFile'])
+
+/**
+ * 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>
+ * <authentication>
+ * <truststore path="/mnt/ssd/jbossws/stack/cxf/trunk/modules/testsuite/cxf-tests/target/test-classes/test.truststore" keystore-password="changeit"/>
+ * </authentication>
+ * </security-realm>
+ *
+ * ...
+ *
+ * <https-listener name="jbws-test-https-listener" socket-binding="https" security-realm="jbws-test-https-realm" verify-client="REQUESTED"/>
+ */
+
+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 authentication = securityRealm.appendNode('authentication')
+authentication.appendNode('truststore', ['path':project.properties['truststorePath'],'keystore-password':'changeit'])
+
+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','verify-client':'REQUESTED'])
+
+
+/**
+ * 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())
10 years, 1 month
JBossWS SVN: r19109 - in stack/cxf/branches/arquillian: modules/test-utils/src/main/java/org/jboss/wsf/test and 16 other directories.
by jbossws-commits@lists.jboss.org
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/\"><soap:Body>"
+ "<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>
10 years, 1 month
JBossWS SVN: r19108 - in projects/wsi-bp-test/branches/jboss7x/bsp11-tests: src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: rsvoboda(a)redhat.com
Date: 2014-11-19 08:50:36 -0500 (Wed, 19 Nov 2014)
New Revision: 19108
Added:
projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.java
Modified:
projects/wsi-bp-test/branches/jboss7x/bsp11-tests/scripts/cxf-samples-jars-jaxws.xml
projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java
projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2321Impl.java
Log:
WSI BSP update for WSS-512 changes, details in BZ 1165622 and BZ 1153968
Modified: projects/wsi-bp-test/branches/jboss7x/bsp11-tests/scripts/cxf-samples-jars-jaxws.xml
===================================================================
--- projects/wsi-bp-test/branches/jboss7x/bsp11-tests/scripts/cxf-samples-jars-jaxws.xml 2014-11-17 17:09:53 UTC (rev 19107)
+++ projects/wsi-bp-test/branches/jboss7x/bsp11-tests/scripts/cxf-samples-jars-jaxws.xml 2014-11-19 13:50:36 UTC (rev 19108)
@@ -89,6 +89,7 @@
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service23*Impl.class"/>
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/jaxws/Say*.class"/>
<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/KeystorePasswordCallback.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.class"/>
</classes>
<webinf dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/oasis/WEB-INF">
<include name="wsdl/*.xsd"/>
Added: projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.java
===================================================================
--- projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.java (rev 0)
+++ projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/SAMLValidator.java 2014-11-19 13:50:36 UTC (rev 19108)
@@ -0,0 +1,30 @@
+/*
+ * 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.oasis;
+
+public class SAMLValidator extends org.apache.ws.security.validate.SamlAssertionValidator {
+
+ public SAMLValidator() {
+ super();
+ setRequireBearerSignature(false);
+ }
+}
Modified: projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java
===================================================================
--- projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java 2014-11-17 17:09:53 UTC (rev 19107)
+++ projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2311Impl.java 2014-11-19 13:50:36 UTC (rev 19108)
@@ -24,6 +24,8 @@
import javax.ejb.Stateless;
import javax.jws.WebService;
+import org.apache.cxf.annotations.EndpointProperties;
+import org.apache.cxf.annotations.EndpointProperty;
import org.jboss.ws.api.annotation.WebContext;
@WebService
@@ -35,6 +37,10 @@
endpointInterface = "org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.ServiceIface"
)
@Stateless
+@EndpointProperties(value = {
+ @EndpointProperty(key = "ws-security.saml1.validator", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.SAMLValidator")
+ }
+)
@WebContext(urlPattern = "SecurityService2311")
public class Service2311Impl implements ServiceIface
{
Modified: projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2321Impl.java
===================================================================
--- projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2321Impl.java 2014-11-17 17:09:53 UTC (rev 19107)
+++ projects/wsi-bp-test/branches/jboss7x/bsp11-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/oasis/Service2321Impl.java 2014-11-19 13:50:36 UTC (rev 19108)
@@ -41,6 +41,7 @@
@EndpointProperty(key = "ws-security.signature.username", value = "bob"),
@EndpointProperty(key = "ws-security.encryption.properties", value = "bob.properties"),
@EndpointProperty(key = "ws-security.encryption.username", value = "useReqSigCert"),
+ @EndpointProperty(key = "ws-security.saml2.validator", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.SAMLValidator"),
@EndpointProperty(key = "ws-security.callback-handler", value = "org.jboss.test.ws.jaxws.samples.wsse.policy.oasis.KeystorePasswordCallback")
}
)
10 years, 1 month
JBossWS SVN: r19107 - stack/cxf/branches.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2014-11-17 12:09:53 -0500 (Mon, 17 Nov 2014)
New Revision: 19107
Added:
stack/cxf/branches/arquillian/
Log:
Creating branch for working on testsuite migration to Arquillian
10 years, 1 month