Author: rsearls
Date: 2014-12-21 20:29:05 -0500 (Sun, 21 Dec 2014)
New Revision: 19175
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/complex/ComplexTestCase.java
Log:
arquillian conversion complex test
Modified:
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/complex/ComplexTestCase.java
===================================================================
---
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/complex/ComplexTestCase.java 2014-12-22
01:02:48 UTC (rev 19174)
+++
stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/complex/ComplexTestCase.java 2014-12-22
01:29:05 UTC (rev 19175)
@@ -22,6 +22,8 @@
package org.jboss.test.ws.jaxws.complex;
import java.io.File;
+import java.lang.Exception;
+import java.lang.System;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -33,7 +35,15 @@
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
-import junit.framework.Test;
+import org.junit.runner.RunWith;
+import org.junit.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.shrinkwrap.api.ArchivePath;
import org.jboss.shrinkwrap.api.Filter;
@@ -48,42 +58,43 @@
* @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
* @author Thomas.Diesler(a)jboss.com
*/
+(a)RunWith(Arquillian.class)
public class ComplexTestCase extends JBossWSTest
{
- private Registration port;
+ @ArquillianResource
+ private URL baseURL;
- public static BaseDeployment<?>[] createDeployments() {
- List<BaseDeployment<?>> list = new
LinkedList<BaseDeployment<?>>();
- list.add(new JBossWSTestHelper.WarDeployment("jaxws-complex.war") { {
+ @Deployment(testable = false)
+ public static WebArchive createDeployments() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-complex.war");
archive
- .addManifest()
- .addPackages(false, new Filter<ArchivePath>() {
- @Override
- public boolean include(ArchivePath path)
- {
- return !path.get().contains("TestCase");
- }
- }, "org.jboss.test.ws.jaxws.complex")
- .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/complex/WEB-INF/web.xml"));
- }
- });
- return list.toArray(new BaseDeployment<?>[list.size()]);
+ .addManifest()
+ .addPackages(false, new Filter<ArchivePath>() {
+ @Override
+ public boolean include(ArchivePath path)
+ {
+ return !path.get().contains("TestCase");
+ }
+ }, "org.jboss.test.ws.jaxws.complex")
+ .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/complex/WEB-INF/web.xml"));
+ return archive;
}
- public static Test suite()
- {
- return new JBossWSTestSetup(ComplexTestCase.class,
JBossWSTestHelper.writeToFile(createDeployments()));
+ private Registration getPort() {
+ Registration port = null;
+ try {
+ URL wsdlURL =
JBossWSTestHelper.getResourceURL("jaxws/complex/META-INF/wsdl/RegistrationService.wsdl");
+ QName serviceName = new
QName("http://complex.jaxws.ws.test.jboss.org/",
"RegistrationService");
+ Service service = Service.create(wsdlURL, serviceName);
+ port = (Registration) service.getPort(Registration.class);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ return port;
}
- protected void setUp() throws Exception
- {
- super.setUp();
- URL wsdlURL =
getResourceURL("jaxws/complex/META-INF/wsdl/RegistrationService.wsdl");
- QName serviceName = new
QName("http://complex.jaxws.ws.test.jboss.org/",
"RegistrationService");
- Service service = Service.create(wsdlURL, serviceName);
- port = (Registration)service.getPort(Registration.class);
- }
-
+ @Test
+ @RunAsClient
public void testRegistration() throws Exception
{
Customer customer = getFredJackson();
@@ -91,7 +102,7 @@
customer.getReferredCustomers().add(getAlCapone());
XMLGregorianCalendar cal = getCalendar();
-
+ Registration port = getPort();
port.register(customer, cal);
customer = getAlCapone();
@@ -106,29 +117,37 @@
}
}
+ @Test
+ @RunAsClient
public void testInvoiceRegistration() throws Exception
{
InvoiceCustomer customer = getInvoiceFredJackson();
customer.getReferredCustomers().add(getJohnDoe());
customer.getReferredCustomers().add(getAlCapone());
-
+ Registration port = getPort();
assertTrue(port.registerForInvoice(customer));
}
+ @Test
+ @RunAsClient
public void testOtherPackage() throws Exception
{
+ Registration port = getPort();
Statistics stats = port.getStatistics(getFredJackson());
System.out.println(stats.getActivationTime());
assertEquals(10, stats.getHits());
}
+ @Test
+ @RunAsClient
public void testBulkRegistration() throws Exception
{
List<Customer> customers = new ArrayList<Customer>();
customers.add(getFredJackson());
customers.add(getJohnDoe());
+ Registration port = getPort();
List<Long> result = port.bulkRegister(customers, getCalendar());
assertEquals(123, result.get(0).longValue());