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

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Sat Jan 3 12:20:43 EST 2015


Author: rsearls
Date: 2015-01-03 12:20:43 -0500 (Sat, 03 Jan 2015)
New Revision: 19314

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

Modified: stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCaseForked.java
===================================================================
--- stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCaseForked.java	2015-01-03 17:18:51 UTC (rev 19313)
+++ stack/cxf/branches/arquillian/modules/testsuite/shared-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCaseForked.java	2015-01-03 17:20:43 UTC (rev 19314)
@@ -36,7 +36,15 @@
 import javax.xml.ws.Service;
 
 import junit.extensions.TestSetup;
-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.WebArchive;
 
 import org.jboss.ws.common.ObjectNameFactory;
 import org.jboss.wsf.test.JBossWSTest;
@@ -51,51 +59,46 @@
  * @author Thomas.Diesler at jboss.com
  * @since 05-Oct-2006
  */
+ at RunWith(Arquillian.class)
 public class JBWS1178TestCaseForked extends JBossWSTest
 {
-   public static BaseDeployment<?>[] createDeployments() {
-      List<BaseDeployment<?>> list = new LinkedList<BaseDeployment<?>>();
-      list.add(new JBossWSTestHelper.WarDeployment("jaxws-jbws1178.war") { {
+   @ArquillianResource
+   private URL baseURL;
+
+   @Deployment(testable = false)
+   public static WebArchive createDeployments() {
+      WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxws-jbws1178.war");
          archive
                .addManifest()
                .addClass(org.jboss.test.ws.jaxws.jbws1178.EndpointImpl.class)
                .setWebXML(new File(JBossWSTestHelper.getTestResourcesDir() + "/jaxws/jbws1178/WEB-INF/web.xml"));
-         }
-      });
-      return list.toArray(new BaseDeployment<?>[list.size()]);
+      return archive;
    }
 
-   public static Test suite()
-   {
-      TestSetup testSetup = new JBossWSTestSetup(JBWS1178TestCaseForked.class, JBossWSTestHelper.writeToFile(createDeployments()))
-      {
-         private final ObjectName objectName = ObjectNameFactory.create("jboss.ws:service=ServerConfig");
-         private String webServiceHost;
+   private final ObjectName objectName = ObjectNameFactory.create("jboss.ws:service=ServerConfig");
+   private String webServiceHost;
 
-         public void setUp() throws Exception
-         {
-            // Setting the WebServiceHost to an empty string, causes the request host to be used.  
-            // This must be done before deploy time.
-            webServiceHost = (String)getServer().getAttribute(objectName, "WebServiceHost");
-            getServer().setAttribute(objectName, new Attribute("WebServiceHost", ""));
-            super.setUp();
-         }
+   public void setUp() throws Exception {
+      // Setting the WebServiceHost to an empty string, causes the request host to be used.
+      // This must be done before deploy time.
+      webServiceHost = (String) getServer().getAttribute(objectName, "WebServiceHost");
+      getServer().setAttribute(objectName, new Attribute("WebServiceHost", ""));
+      super.setUp();
+   }
 
-         public void tearDown() throws Exception
-         {
-            super.tearDown();
-            getServer().setAttribute(objectName, new Attribute("WebServiceHost", webServiceHost));
-         }
-      };
-      return testSetup;
+   public void tearDown() throws Exception {
+      super.tearDown();
+      getServer().setAttribute(objectName, new Attribute("WebServiceHost", webServiceHost));
    }
 
-
+   @Test
+   @RunAsClient
    public void testHostAddress() throws Exception
    {
+      setUp();
       InetAddress inetAddr = InetAddress.getByName(getServerHost());
       String hostAddress = inetAddr instanceof Inet6Address ? "[" + inetAddr.getHostAddress() + "]" : inetAddr.getHostAddress();
-      URL wsdlURL = new URL("http://" + hostAddress + ":8080/jaxws-jbws1178/testpattern?wsdl");
+      URL wsdlURL = new URL(baseURL + "/testpattern?wsdl");
 
       QName serviceName = new QName("http://org.jboss.ws/jbws1178", "EndpointService");
       Service service = Service.create(wsdlURL, serviceName);
@@ -104,12 +107,16 @@
       URL epURL = new URL((String)reqCtx.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
 
       assertEquals(wsdlURL.getHost(), epURL.getHost());
+      tearDown();
    }
 
+   @Test
+   @RunAsClient
    public void testHostName() throws Exception
    {
+      setUp();
       InetAddress inetAddr = InetAddress.getByName(getServerHost());
-      URL wsdlURL = new URL("http://" + inetAddr.getHostName() + ":8080/jaxws-jbws1178/testpattern?wsdl");
+      URL wsdlURL = new URL(baseURL + "/testpattern?wsdl");
 
       QName serviceName = new QName("http://org.jboss.ws/jbws1178", "EndpointService");
       Service service = Service.create(wsdlURL, serviceName);
@@ -118,5 +125,6 @@
       URL epURL = new URL((String)reqCtx.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
 
       assertEquals(wsdlURL.getHost(), epURL.getHost());
+      tearDown();
    }
 }



More information about the jbossws-commits mailing list