Author: rsearls
Date: 2014-12-26 21:53:22 -0500 (Fri, 26 Dec 2014)
New Revision: 19271
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/eardeployment/EarTestCase.java
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/eardeployment/WSDLPublishTestCase.java
Log:
arquillian migration eardeployment test
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/eardeployment/EarTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/eardeployment/EarTestCase.java 2014-12-26
04:27:21 UTC (rev 19270)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/eardeployment/EarTestCase.java 2014-12-27
02:53:22 UTC (rev 19271)
@@ -31,7 +31,20 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.wsf.test.JBossWSTest;
@@ -46,56 +59,55 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:richard.opalka@jboss.org">Richard
Opalka</a>
*/
+(a)RunWith(Arquillian.class)
public class EarTestCase extends JBossWSTest
{
- public static final class EarTestCaseDeploymentArchive {
- public static final String NAME = getName();
-
- private static String getName() {
- JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-samples-eardeployment-ejb3.jar") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.logging\n"))
-
.addClass(org.jboss.test.ws.jaxws.samples.eardeployment.EJB3Bean.class)
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ "/jaxws/samples/eardeployment/WEB-INF/wsdl/Endpoint.wsdl"),
"wsdl/Endpoint.wsdl")
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ "/jaxws/samples/eardeployment/WEB-INF/wsdl/TestService.xsd"),
"wsdl/TestService.xsd");
- }
- });
- JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.WarDeployment("jaxws-samples-eardeployment-pojo.war") { {
- archive
- .setManifest(new StringAsset("Manifest-Version: 1.0\n"
- + "Dependencies:
org.jboss.logging,org.jboss.ws.common\n"))
- .addClass(org.jboss.test.ws.jaxws.samples.eardeployment.JSEBean.class)
-
.addClass(org.jboss.test.ws.jaxws.samples.eardeployment.SupportServlet.class)
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/jboss-web.xml"),
"jboss-web.xml")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/wsdl/Endpoint.wsdl"),
"wsdl/Endpoint.wsdl")
- .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/wsdl/TestService.xsd"),
"wsdl/TestService.xsd")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/web.xml"));
- }
- });
- return JBossWSTestHelper.writeToFile(new
JBossWSTestHelper.JarDeployment("jaxws-samples-eardeployment.ear") { {
- archive
- .addManifest()
- .addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(),
"jaxws-samples-eardeployment-ejb3.jar"))
- .addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(),
"jaxws-samples-eardeployment-pojo.war"))
- .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir()
+ "/jaxws/samples/eardeployment/META-INF/permissions.xml"),
"permissions.xml");
- }
- });
- }
-
- private EarTestCaseDeploymentArchive() {
- //NO OP
- }
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static EnterpriseArchive createDeployment() {
+ JavaArchive archive1 = ShrinkWrap.create(JavaArchive.class,
"jaxws-samples-eardeployment-ejb3.jar");
+ archive1
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.logging\n"))
+ .addClass(org.jboss.test.ws.jaxws.samples.eardeployment.EJB3Bean.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/wsdl/Endpoint.wsdl"),
"wsdl/Endpoint.wsdl")
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/wsdl/TestService.xsd"),
"wsdl/TestService.xsd");
+ writeToDisk(archive1);
+
+ WebArchive archive2 = ShrinkWrap.create(WebArchive.class,
"jaxws-samples-eardeployment-pojo.war");
+ archive2
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.logging,org.jboss.ws.common\n"))
+ .addClass(org.jboss.test.ws.jaxws.samples.eardeployment.JSEBean.class)
+ .addClass(org.jboss.test.ws.jaxws.samples.eardeployment.SupportServlet.class)
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/jboss-web.xml"),
"jboss-web.xml")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/wsdl/Endpoint.wsdl"),
"wsdl/Endpoint.wsdl")
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/wsdl/TestService.xsd"),
"wsdl/TestService.xsd")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/WEB-INF/web.xml"));
+ writeToDisk(archive2);
+
+ EnterpriseArchive archive = ShrinkWrap.create(EnterpriseArchive.class,
"jaxws-samples-eardeployment.ear");
+ archive
+ .addManifest()
+ .addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(),
"jaxws-samples-eardeployment-ejb3.jar"))
+ .addAsResource(new File(JBossWSTestHelper.getTestArchiveDir(),
"jaxws-samples-eardeployment-pojo.war"))
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/samples/eardeployment/META-INF/permissions.xml"),
"permissions.xml");
+ return archive;
}
-
- public static Test suite()
+
+ private static void writeToDisk(Archive archive)
{
- return new JBossWSTestSetup(EarTestCase.class, EarTestCaseDeploymentArchive.NAME);
+ File file = new File(JBossWSTestHelper.getTestArchiveDir(), archive.getName());
+ archive.as(ZipExporter.class).exportTo(file, true);
}
+ @Test
+ @RunAsClient
public void testEJB3Endpoint() throws Exception
{
- String soapAddress = "http://" + getServerHost() +
":8080/earejb3/EndpointService/Endpoint";
+ String soapAddress = "http://" + baseURL.getHost() +
":8080/earejb3/EndpointService/Endpoint";
QName serviceName = new QName("http://eardeployment.jaxws/",
"EndpointService");
Service service = Service.create(new URL(soapAddress + "?wsdl"),
serviceName);
Endpoint port = service.getPort(Endpoint.class);
@@ -112,9 +124,11 @@
assertEquals(helloWorld, retObj);
}
+ @Test
+ @RunAsClient
public void testJSEEndpoint() throws Exception
{
- String soapAddress = "http://" + getServerHost() +
":8080/earjse/JSEBean";
+ String soapAddress = baseURL + "JSEBean";
QName serviceName = new QName("http://eardeployment.jaxws/",
"EndpointService");
Service service = Service.create(new URL(soapAddress + "?wsdl"),
serviceName);
Endpoint port = service.getPort(Endpoint.class);
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/eardeployment/WSDLPublishTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/eardeployment/WSDLPublishTestCase.java 2014-12-26
04:27:21 UTC (rev 19270)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/samples/eardeployment/WSDLPublishTestCase.java 2014-12-27
02:53:22 UTC (rev 19271)
@@ -29,9 +29,14 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
-import junit.framework.Test;
-
-import
org.jboss.test.ws.jaxws.samples.eardeployment.EarTestCase.EarTestCaseDeploymentArchive;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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.spec.EnterpriseArchive;
import org.jboss.ws.common.IOUtils;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
@@ -42,20 +47,25 @@
*
* @author alessio.soldano(a)jboss.com
*/
+(a)RunWith(Arquillian.class)
public class WSDLPublishTestCase extends JBossWSTest
{
private File wsdlFileDir;
- private static long testStart;
-
- public static Test suite()
- {
- testStart = System.currentTimeMillis();
- return new JBossWSTestSetup(WSDLPublishTestCase.class,
EarTestCaseDeploymentArchive.NAME);
+ private static long testStart = System.currentTimeMillis();
+
+ @ArquillianResource
+ private URL baseURL;
+
+ @Deployment(testable = false)
+ public static EnterpriseArchive createDeployment() {
+ return EarTestCase.createDeployment();
}
+ @Test
+ @RunAsClient
public void testEJB3Endpoint() throws Exception
{
- String soapAddress = "http://" + getServerHost() +
":8080/earejb3/EndpointService/Endpoint";
+ String soapAddress = "http://" + baseURL.getHost() +
":8080/earejb3/EndpointService/Endpoint";
QName serviceName = new QName("http://eardeployment.jaxws/",
"EndpointService");
File file = new File(getWsdlFileDir().getAbsolutePath() + File.separator +
"jaxws-samples-eardeployment.ear" + File.separator
@@ -77,9 +87,11 @@
assertEquals(helloWorld, retObj);
}
+ @Test
+ @RunAsClient
public void testJSEEndpoint() throws Exception
{
- String soapAddress = "http://" + getServerHost() +
":8080/earjse/JSEBean";
+ String soapAddress = baseURL + "JSEBean";
QName serviceName = new QName("http://eardeployment.jaxws/",
"EndpointService");
File file = new File(getWsdlFileDir().getAbsolutePath() + File.separator +
"jaxws-samples-eardeployment.ear" + File.separator
@@ -105,7 +117,7 @@
{
if (wsdlFileDir == null)
{
- URL url = new URL("http://" + getServerHost() +
":8080/earjse/support");
+ URL url = new URL("http://" + baseURL.getHost() +
":8080/earjse/support");
wsdlFileDir = new File(IOUtils.readAndCloseStream(url.openStream()),
"wsdl");
}
return wsdlFileDir;