[jbossws-commits] JBossWS SVN: r19251 - stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1841.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Dec 24 15:20:00 EST 2014


Author: rsearls
Date: 2014-12-24 15:20:00 -0500 (Wed, 24 Dec 2014)
New Revision: 19251

Modified:
   stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1841/JBWS1841TestCase.java
Log:
arquillian migration jbws1841 test

Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1841/JBWS1841TestCase.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1841/JBWS1841TestCase.java	2014-12-24 20:01:08 UTC (rev 19250)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1841/JBWS1841TestCase.java	2014-12-24 20:20:00 UTC (rev 19251)
@@ -31,7 +31,15 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
 
-import junit.framework.Test;
+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.JavaArchive;
 
 import org.jboss.wsf.test.CleanupOperation;
 import org.jboss.wsf.test.JBossWSTest;
@@ -46,17 +54,19 @@
  *
  * @author Heiko.Braun at jboss.com
  */
+ at RunWith(Arquillian.class)
 public class JBWS1841TestCase extends JBossWSTest
 {
-   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbws1841/EndpointService/EJB3Bean";
-
    private static EndpointInterface port;
    private static StatelessRemote remote;
    private static InitialContext ctx;
 
-   public static BaseDeployment<?>[] createDeployments() {
-      List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
-      list.add(new JBossWSTestHelper.JarDeployment("jaxws-jbws1841.jar") { {
+   @ArquillianResource
+   private URL baseURL;
+
+   @Deployment(testable = false)
+   public static JavaArchive createDeployments() {
+      JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "jaxws-jbws1841.jar");
          archive
                .addManifest()
                .addClass(org.jboss.test.ws.jaxws.jbws1841.EJB3Bean.class)
@@ -70,73 +80,80 @@
                .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws1841/META-INF/jboss.xml"), "jboss.xml")
                .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws1841/META-INF/permissions.xml"), "permissions.xml")
                .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws1841/META-INF/wsdl/TestService.wsdl"), "wsdl/TestService.wsdl");
-         }
-      });
-      return list.toArray(new BaseDeployment<?>[list.size()]);
+      return archive;
    }
 
-   public static Test suite()
-   {
-      return new JBossWSTestSetup(JBWS1841TestCase.class, JBossWSTestHelper.writeToFile(createDeployments()), new CleanupOperation() {
-         @Override
-         public void cleanUp() {
-            port = null;
-            remote = null;
-            if (ctx != null)
-            {
-               final InitialContext c = ctx;
-               ctx = null;
-               try {
-                  c.close();
-               } catch (NamingException ne) {
-                  throw new RuntimeException(ne);
-               }
-            }
+   private void cleanUp() {
+      port = null;
+      remote = null;
+      if (ctx != null) {
+         final InitialContext c = ctx;
+         ctx = null;
+         try {
+            c.close();
+         } catch (NamingException ne) {
+            throw new RuntimeException(ne);
          }
-      });
+      }
    }
 
-   protected void setUp() throws Exception
-   {
-      if (port == null)
-      {
-         URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
-         QName serviceName = new QName("http://www.openuri.org/2004/04/HelloWorld", "EndpointService");
-         port = Service.create(wsdlURL, serviceName).getPort(EndpointInterface.class);
+   protected void setUp() throws Exception {
+      URL wsdlURL = new URL(baseURL + "/jaxws-jbws1841/EndpointService/EJB3Bean?wsdl");
+      QName serviceName = new QName("http://www.openuri.org/2004/04/HelloWorld", "EndpointService");
+      port = Service.create(wsdlURL, serviceName).getPort(EndpointInterface.class);
 
-         ctx = getServerInitialContext();
-         remote = (StatelessRemote)ctx.lookup("ejb:/jaxws-jbws1841//" + StatelessBean.class.getSimpleName() + "!" + StatelessRemote.class.getName());
-      }
+      ctx = getServerInitialContext();
+      remote = (StatelessRemote) ctx.lookup("ejb:/jaxws-jbws1841//" + StatelessBean.class.getSimpleName() + "!" + StatelessRemote.class.getName());
    }
 
+   @Test
+   @RunAsClient
    public void testDirectWSInvocation() throws Exception
    {
+      setUp();
       String result = port.echo("DirectWSInvocation");
       assertEquals("DirectWSInvocation", result);
+      cleanUp();
    }
 
+   @Test
+   @RunAsClient
    public void testEJBRelay1() throws Exception
    {
+      setUp();
       String result = remote.echo1("Relay1");
       assertEquals("Relay1", result);
+      cleanUp();
    }
 
+   @Test
+   @RunAsClient
    public void testEJBRelay2() throws Exception
    {
+      setUp();
       String result = remote.echo2("Relay2");
       assertEquals("Relay2", result);
+      cleanUp();
    }
 
+   @Test
+   @RunAsClient
    public void testEJBRelay3() throws Exception
    {
+      setUp();
       String result = remote.echo3("Relay3");
       assertEquals("Relay3", result);
+      cleanUp();
    }
 
+   @Test
+   @RunAsClient
    public void testEJBRelay4() throws Exception
    {
+      setUp();
       String result = remote.echo4("Relay4");
       assertEquals("Relay4", result);
+      cleanUp();
    }
 
 }



More information about the jbossws-commits mailing list