Author: veithen
Date: Sun Apr 17 13:10:47 2016
New Revision: 1739601

URL: http://svn.apache.org/viewvc?rev=1739601&view=rev
Log:
Use the new Axis2Server JUnit rule.

Modified:
    
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java
    
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java
    
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageStringTests.java
    
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadJAXBTests.java
    
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java
    
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadStringTests.java

Modified: 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java?rev=1739601&r1=1739600&r2=1739601&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java
 Sun Apr 17 13:10:47 2016
@@ -19,10 +19,11 @@
 
 package org.apache.axis2.jaxws.xmlhttp;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
 import org.apache.axis2.jaxws.provider.DataSourceImpl;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
 import org.apache.axiom.util.UIDGenerator;
 import org.apache.axiom.util.io.IOUtils;
 
@@ -39,6 +40,8 @@ import javax.xml.ws.handler.MessageConte
 import javax.xml.ws.http.HTTPBinding;
 
 import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.awt.*;
 import java.io.File;
@@ -49,11 +52,10 @@ import java.util.Arrays;
 import java.util.Map;
 import java.util.HashMap;
 
-public class DispatchXMessageDataSourceTests extends AbstractTestCase {
-
-    public String HOSTPORT = "http://localhost:6060";;
-        
-    private String ENDPOINT_URL = HOSTPORT + 
"/axis2/services/XMessageDataSourceProvider.XMessageDataSourceProviderPort";
+public class DispatchXMessageDataSourceTests {
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo");
+    
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2";, 
"XMessageDataSourceProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2";, 
"XMessageDataSourceProviderPort");
  
@@ -61,10 +63,7 @@ public class DispatchXMessageDataSourceT
     private FileDataSource txtDS;
     private DataSource attachmentDS;
 
-    public static Test suite() {
-        return getTestSetup(new 
TestSuite(DispatchXMessageDataSourceTests.class));
-    }
- 
+    @Before
     public void setUp() throws Exception {
         String imageResourceDir = 
System.getProperty("basedir",".")+"/"+"test-resources"+File.separator+"image";
 
@@ -89,11 +88,12 @@ public class DispatchXMessageDataSourceT
     
     public Dispatch<DataSource> getDispatch() {
        Service service = Service.create(SERVICE_NAME);
-       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING, 
"http://localhost:"; + server.getPort() + 
"/axis2/services/XMessageDataSourceProvider.XMessageDataSourceProviderPort");
        Dispatch<DataSource> dispatch = service.createDispatch(PORT_NAME, 
DataSource.class, Service.Mode.MESSAGE);
        return dispatch;
     }
     
+    @Test
     public void testDataSourceWithTXT() throws Exception {
         Dispatch<DataSource> dispatch = getDispatch();
         DataSource request = txtDS;
@@ -105,6 +105,7 @@ public class DispatchXMessageDataSourceT
         assertEquals(req, res);
     }
 
+    @Test
     public void testDataSourceWithImage() throws Exception {
         Dispatch<DataSource> dispatch = getDispatch();
         DataSource request = imageDS;
@@ -115,6 +116,7 @@ public class DispatchXMessageDataSourceT
                 getStreamAsByteArray(response.getInputStream())));
     }
 
+    @Test
     public void testDataSourceWithTXTPlusAttachment() throws Exception {
         Dispatch<DataSource> dispatch = getDispatch();
 
@@ -142,6 +144,7 @@ public class DispatchXMessageDataSourceT
         assertEquals(attachments2.size(), 1);
     }
 
+    @Test
     public void testDataSourceWithImagePlusAttachment() throws Exception {
         Dispatch<DataSource> dispatch = getDispatch();
 
@@ -163,6 +166,7 @@ public class DispatchXMessageDataSourceT
         assertEquals(attachments2.size(), 1);
     }
 
+    @Test
     public void testDataSourceWithTXTPlusTwoAttachments() throws Exception {
         Dispatch<DataSource> dispatch = getDispatch();
 

Modified: 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java?rev=1739601&r1=1739600&r2=1739601&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java
 Sun Apr 17 13:10:47 2016
@@ -19,10 +19,10 @@
 
 package org.apache.axis2.jaxws.xmlhttp;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
 import org.apache.axis2.jaxws.message.util.Reader2Writer;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
@@ -34,16 +34,20 @@ import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
 import javax.xml.ws.http.HTTPBinding;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 
-public class DispatchXMessageSourceTests extends AbstractTestCase {
+public class DispatchXMessageSourceTests {
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo");
 
     private static XMLInputFactory inputFactory = 
XMLInputFactory.newInstance();
 
-    public String HOSTPORT = "http://localhost:6060";;
-        
-    private String ENDPOINT_URL = HOSTPORT + 
"/axis2/services/XMessageSourceProvider.XMessageSourceProviderPort";
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2";, 
"XMessageSourceProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2";, 
"XMessageSourceProviderPort");
  
@@ -52,13 +56,9 @@ public class DispatchXMessageSourceTests
     
     private static String GET_RESPONSE = "<response>GET</response>";
     
-    public static Test suite() {
-        return getTestSetup(new TestSuite(DispatchXMessageSourceTests.class));
-    }
-
     public Dispatch<Source> getDispatch() {
        Service service = Service.create(SERVICE_NAME);
-       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING, 
"http://localhost:"; + server.getPort() + 
"/axis2/services/XMessageSourceProvider.XMessageSourceProviderPort");
        Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, 
Source.class, Service.Mode.MESSAGE);
        return dispatch;
     }
@@ -67,6 +67,7 @@ public class DispatchXMessageSourceTests
      * Simple XML/HTTP Message Test
      * @throws Exception
      */
+    @Test
     public void testSimple() throws Exception {
         Dispatch<Source> dispatch = getDispatch();
         String request = XML_TEXT;
@@ -98,6 +99,7 @@ public class DispatchXMessageSourceTests
         assertTrue(request.equals(response));
     }
     
+    @Test
     public void testGetRequest() throws Exception {
         Dispatch<Source> dispatch = getDispatch();
 

Modified: 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageStringTests.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageStringTests.java?rev=1739601&r1=1739600&r2=1739601&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageStringTests.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageStringTests.java
 Sun Apr 17 13:10:47 2016
@@ -19,34 +19,31 @@
 
 package org.apache.axis2.jaxws.xmlhttp;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
 import javax.xml.ws.http.HTTPBinding;
 
-public class DispatchXMessageStringTests extends AbstractTestCase {
+public class DispatchXMessageStringTests {
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo");
 
-    public String HOSTPORT = "http://localhost:6060";;
-        
-    private String ENDPOINT_URL = HOSTPORT + 
"/axis2/services/XMessageStringProvider.XMessageStringProviderPort";
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2";, 
"XMessageStringProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2";, 
"XMessageStringProviderPort");
  
     private static String XML_TEXT = "<p:echo xmlns:p=\"http://sample\";>hello 
world</p:echo>";
     private static String XML_TEXT_NPE = "<p:echo 
xmlns:p=\"http://sample\";>NPE</p:echo>";
 
-    public static Test suite() {
-        return getTestSetup(new TestSuite(DispatchXMessageStringTests.class));
-    }
-
     public Dispatch<String> getDispatch() {
        Service service = Service.create(SERVICE_NAME);
-       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING, 
"http://localhost:"; + server.getPort() + 
"/axis2/services/XMessageStringProvider.XMessageStringProviderPort");
        Dispatch<String> dispatch = service.createDispatch(PORT_NAME, 
String.class, Service.Mode.MESSAGE);
        return dispatch;
     }
@@ -55,6 +52,7 @@ public class DispatchXMessageStringTests
      * Simple XML/HTTP Message Test
      * @throws Exception
      */
+    @Test
     public void testSimple() throws Exception {
         Dispatch<String> dispatch = getDispatch();
         String request = XML_TEXT;

Modified: 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadJAXBTests.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadJAXBTests.java?rev=1739601&r1=1739600&r2=1739601&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadJAXBTests.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadJAXBTests.java
 Sun Apr 17 13:10:47 2016
@@ -19,40 +19,36 @@
 
 package org.apache.axis2.jaxws.xmlhttp;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
 import test.EchoString;
 import test.ObjectFactory;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
 import javax.xml.ws.http.HTTPBinding;
 
-public class DispatchXPayloadJAXBTests extends AbstractTestCase {
+public class DispatchXPayloadJAXBTests {
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo");
     
-    private static XMLInputFactory inputFactory = 
XMLInputFactory.newInstance();
-
-    public String HOSTPORT = "http://localhost:6060";;
-        
-    private String ENDPOINT_URL = HOSTPORT + 
"/axis2/services/XPayloadSourceProvider.XPayloadSourceProviderPort";
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2";, 
"XPayloadSourceProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2";, 
"XPayloadSourceProviderPort");
 
     String XML_TEXT = "<p:echo xmlns:p=\"http://sample\";>hello world</p:echo>";
     
-    public static Test suite() {
-        return getTestSetup(new TestSuite(DispatchXPayloadJAXBTests.class));
-    }
-
     public Dispatch<Object> getDispatch() throws JAXBException {
         Service service = Service.create(SERVICE_NAME);
-        service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+        service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING, 
"http://localhost:"; + server.getPort() + 
"/axis2/services/XPayloadSourceProvider.XPayloadSourceProviderPort");
         JAXBContext jbc = JAXBContext.newInstance("test");
         Dispatch<Object> dispatch = service.createDispatch(PORT_NAME, jbc, 
Service.Mode.PAYLOAD);
         return dispatch;
@@ -62,6 +58,7 @@ public class DispatchXPayloadJAXBTests e
     * Simple XML/HTTP Message Test
     * @throws Exception
     */
+    @Test
    public void testSimple() throws Exception {
        Dispatch<Object> dispatch = getDispatch();
        ObjectFactory factory = new ObjectFactory();

Modified: 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java?rev=1739601&r1=1739600&r2=1739601&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java
 Sun Apr 17 13:10:47 2016
@@ -19,10 +19,10 @@
 
 package org.apache.axis2.jaxws.xmlhttp;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
 import org.apache.axis2.jaxws.message.util.Reader2Writer;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
@@ -32,29 +32,27 @@ import javax.xml.transform.stream.Stream
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
 import javax.xml.ws.http.HTTPBinding;
+
+import static org.junit.Assert.assertTrue;
+
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 
-public class DispatchXPayloadSourceTests extends AbstractTestCase {
+public class DispatchXPayloadSourceTests {
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo");
 
     private static XMLInputFactory inputFactory = 
XMLInputFactory.newInstance();
 
-    public String HOSTPORT = "http://localhost:6060";;
-        
-    private String ENDPOINT_URL = HOSTPORT + 
"/axis2/services/XMessageSourceProvider.XMessageSourceProviderPort";
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2";, 
"XPayloadSourceProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2";, 
"XPayloadSourceProviderPort");
  
     private static String XML_TEXT = "<p:echo xmlns:p=\"http://sample\";>hello 
world</p:echo>";
     private static String XML_TEXT_NPE = "<p:echo 
xmlns:p=\"http://sample\";>NPE</p:echo>";
     
-    public static Test suite() {
-        return getTestSetup(new TestSuite(DispatchXPayloadSourceTests.class));
-    }
-  
     public Dispatch<Source> getDispatch() {
        Service service = Service.create(SERVICE_NAME);
-       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING, 
"http://localhost:"; + server.getPort() + 
"/axis2/services/XMessageSourceProvider.XMessageSourceProviderPort");
        Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, 
Source.class, Service.Mode.PAYLOAD);
        return dispatch;
     }
@@ -63,6 +61,7 @@ public class DispatchXPayloadSourceTests
      * Simple XML/HTTP Payload Test
      * @throws Exception
      */
+    @Test
     public void testSimple() throws Exception {
         Dispatch<Source> dispatch = getDispatch();
         String request = XML_TEXT;

Modified: 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadStringTests.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadStringTests.java?rev=1739601&r1=1739600&r2=1739601&view=diff
==============================================================================
--- 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadStringTests.java
 (original)
+++ 
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadStringTests.java
 Sun Apr 17 13:10:47 2016
@@ -19,34 +19,31 @@
 
 package org.apache.axis2.jaxws.xmlhttp;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
 import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service;
 import javax.xml.ws.http.HTTPBinding;
 
-public class DispatchXPayloadStringTests extends AbstractTestCase {
-
-    public String HOSTPORT = "http://localhost:6060";;
-        
-    private String ENDPOINT_URL = HOSTPORT + 
"/axis2/services/XPayloadStringProvider.XPayloadStringProviderPort";
+public class DispatchXPayloadStringTests {
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo");
+    
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2";, 
"XPayloadStringProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2";, 
"XPayloadStringProviderPort");
  
     private static String XML_TEXT = "<p:echo xmlns:p=\"http://sample\";>hello 
world</p:echo>";
     private static String XML_TEXT_NPE = "<p:echo 
xmlns:p=\"http://sample\";>NPE</p:echo>";
     
-    public static Test suite() {
-        return getTestSetup(new TestSuite(DispatchXPayloadStringTests.class));
-    }
-
     public Dispatch<String> getDispatch() {
        Service service = Service.create(SERVICE_NAME);
-       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING,ENDPOINT_URL);
+       service.addPort(PORT_NAME, HTTPBinding.HTTP_BINDING, 
"http://localhost:"; + server.getPort() + 
"/axis2/services/XPayloadStringProvider.XPayloadStringProviderPort");
        Dispatch<String> dispatch = service.createDispatch(PORT_NAME, 
String.class, Service.Mode.PAYLOAD);
        return dispatch;
     }
@@ -55,6 +52,7 @@ public class DispatchXPayloadStringTests
      * Simple XML/HTTP Payload Test
      * @throws Exception
      */
+    @Test
     public void testSimple() throws Exception {
         Dispatch<String> dispatch = getDispatch();
         String request = XML_TEXT;


Reply via email to