Author: jim.ma
Date: 2015-01-06 04:19:52 -0500 (Tue, 06 Jan 2015)
New Revision: 19325
Modified:
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
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/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1581/JBWS1581TestCase.java
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3282/HandlerChainTestCaseForked.java
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/webparam/WebParamTestCase.java
Log:
Convert WebParamTestCase to arquillan test;Fix JBWS1581TestCase and more clean up
Modified:
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
===================================================================
---
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2015-01-05
15:13:41 UTC (rev 19324)
+++
stack/cxf/branches/arquillian/modules/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2015-01-06
09:19:52 UTC (rev 19325)
@@ -41,6 +41,7 @@
import javax.xml.ws.Service.Mode;
import javax.xml.ws.soap.SOAPBinding;
+import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.exporter.ZipExporter;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
@@ -401,6 +402,14 @@
getDeployer().restart();
}
+ @SuppressWarnings("rawtypes")
+ public static void writeToFile(Archive archive)
+ {
+ File archiveDir = assertArchiveDirExists();
+ File file = new File(archiveDir, archive.getName());
+ archive.as(ZipExporter.class).exportTo(file, true);
+ }
+
public static abstract class BaseDeployment<T extends
org.jboss.shrinkwrap.api.Archive<T>>
{
protected T archive;
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 2015-01-05
15:13:41 UTC (rev 19324)
+++
stack/cxf/branches/arquillian/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/asynch/AsynchTestCase.java 2015-01-06
09:19:52 UTC (rev 19325)
@@ -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;
@@ -35,12 +33,12 @@
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.junit.Test;
import org.junit.runner.RunWith;
@@ -53,21 +51,9 @@
@RunWith(Arquillian.class)
public class AsynchTestCase extends JBossWSTest
{
- private String endpointAddress = "http://" + getServerHost() +
":8080/jaxws-samples-asynch";
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("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 list.toArray(new BaseDeployment<?>[list.size()]);
- }
-
@Deployment(testable = false)
public static WebArchive createDep() {
WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-asynch.war");
@@ -83,7 +69,7 @@
public void testEndpoint() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/samples/asynch",
"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";
@@ -95,7 +81,7 @@
public void testAsyncEndpoint() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/samples/asynch",
"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";
@@ -108,7 +94,7 @@
public void testAsyncEndpointUsingHandler() throws Exception
{
QName serviceName = new QName("http://org.jboss.ws/cxf/samples/asynch",
"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/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1581/JBWS1581TestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1581/JBWS1581TestCase.java 2015-01-05
15:13:41 UTC (rev 19324)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1581/JBWS1581TestCase.java 2015-01-06
09:19:52 UTC (rev 19325)
@@ -34,7 +34,6 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.exporter.ZipExporter;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
@@ -71,7 +70,7 @@
.addClass(org.jboss.test.ws.jaxws.jbws1581.EndpointBean.class)
.addClass(org.jboss.test.ws.jaxws.jbws1581.EndpointInterface.class)
.setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/jbws1581/WEB-INF/web.xml"));
- writeToDisk(archive);
+ JBossWSTestHelper.writeToFile(archive);
return archive;
}
@@ -97,13 +96,6 @@
.addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(), WAR_DEPLOYMENT
+ ".war"));
return archive;
}
-
- public static void writeToDisk(WebArchive archive)
- {
- File file = new File(JBossWSTestHelper.getTestArchiveDir(), archive.getName());
- archive.as(ZipExporter.class).exportTo(file, true);
- }
-
@Test
@RunAsClient
public void testWSDLAccessWar() throws Exception {
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3282/HandlerChainTestCaseForked.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3282/HandlerChainTestCaseForked.java 2015-01-05
15:13:41 UTC (rev 19324)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws3282/HandlerChainTestCaseForked.java 2015-01-06
09:19:52 UTC (rev 19325)
@@ -65,7 +65,6 @@
@Deployment(name = INCONTAINER_CLIENT, testable = false)
public static WebArchive createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
WebArchive archive = ShrinkWrap.create(WebArchive.class, INCONTAINER_CLIENT +
".war");
archive
.setManifest(new StringAsset("Manifest-Version: 1.0\n"
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/webparam/WebParamTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/webparam/WebParamTestCase.java 2015-01-05
15:13:41 UTC (rev 19324)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/webparam/WebParamTestCase.java 2015-01-06
09:19:52 UTC (rev 19325)
@@ -23,20 +23,22 @@
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.Holder;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
-import org.jboss.wsf.test.CleanupOperation;
+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.jboss.wsf.test.JBossWSTestSetup;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Test the JSR-181 annotation: javax.jws.WebParam
@@ -44,38 +46,26 @@
* @author Thomas.Diesler(a)jboss.org
* @since 07-Oct-2005
*/
+(a)RunWith(Arquillian.class)
public class WebParamTestCase extends JBossWSTest
{
- private String targetNS = "http://www.openuri.org/jsr181/WebParamExample";
-
+ private String targetNS = "http://www.openuri.org/jsr181/WebParamExample";
private static PingService port;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new
JBossWSTestHelper.WarDeployment("jaxws-samples-webparam.war") { {
- archive
- .addManifest()
- .addClass(org.jboss.test.ws.jaxws.samples.webparam.PingDocument.class)
- .addClass(org.jboss.test.ws.jaxws.samples.webparam.PingServiceImpl.class)
- .addClass(org.jboss.test.ws.jaxws.samples.webparam.SecurityHeader.class)
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/webparam/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ @Deployment(testable = false)
+ public static WebArchive createDeployment1() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-webparam.war");
+ archive.addManifest()
+ .addClass(org.jboss.test.ws.jaxws.samples.webparam.PingDocument.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.webparam.PingServiceImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.webparam.SecurityHeader.class)
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/webparam/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
+ @Before
+ public void createPort() throws Exception
{
- return new JBossWSTestSetup(WebParamTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()), new CleanupOperation() {
- @Override
- public void cleanUp() {
- port = null;
- }
- });
- }
-
- public void setUp() throws Exception
- {
if (port == null)
{
QName serviceName = new QName(targetNS, "PingServiceService");
@@ -85,7 +75,8 @@
port = service.getPort(PingService.class);
}
}
-
+ @Test
+ @RunAsClient
public void testEcho() throws Exception
{
PingDocument doc = new PingDocument();
@@ -93,14 +84,16 @@
PingDocument retObj = port.echo(doc);
assertEquals(doc.getContent(), retObj.getContent());
}
-
+ @Test
+ @RunAsClient
public void testPingOneWay() throws Exception
{
PingDocument doc = new PingDocument();
doc.setContent("Hello Kermit");
port.pingOneWay(doc);
}
-
+ @Test
+ @RunAsClient
public void testPingTwoWay() throws Exception
{
PingDocument doc = new PingDocument();
@@ -110,7 +103,8 @@
port.pingTwoWay(holder);
assertEquals("Hello Kermit Response", holder.value.getContent());
}
-
+ @Test
+ @RunAsClient
public void testSecurePing() throws Exception
{
PingDocument doc = new PingDocument();
@@ -120,4 +114,9 @@
port.securePing(doc, secHeader);
}
+
+ @After
+ public void resetPort() {
+ port = null;
+ }
}