You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/22 18:42:32 UTC

svn commit: r1819084 - in /axis/axis2/java/core/trunk: databinding-tests/jaxbri-tests/ databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/ databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/identityservice/ databindi...

Author: veithen
Date: Fri Dec 22 18:42:32 2017
New Revision: 1819084

URL: http://svn.apache.org/viewvc?rev=1819084&view=rev
Log:
Remove UtilServer and use the Axis2Server rule instead.

Removed:
    axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/UtilServer.java
Modified:
    axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/pom.xml
    axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/Test01Test.java
    axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/identityservice/IdentityServiceTest.java
    axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java
    axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java
    axis/axis2/java/core/trunk/modules/jibx/pom.xml
    axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java
    axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java
    axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java

Modified: axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/pom.xml?rev=1819084&r1=1819083&r2=1819084&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/pom.xml (original)
+++ axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/pom.xml Fri Dec 22 18:42:32 2017
@@ -293,7 +293,6 @@
                     </execution>
                 </executions>
                 <configuration>
-                    <configurationDirectory>conf</configurationDirectory>
                     <generatedAxis2xml/>
                 </configuration>
             </plugin>

Modified: axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/Test01Test.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/Test01Test.java?rev=1819084&r1=1819083&r2=1819084&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/Test01Test.java (original)
+++ axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/Test01Test.java Fri Dec 22 18:42:32 2017
@@ -20,9 +20,8 @@ package org.apache.axis2.jaxbri;
 
 import static org.junit.Assert.assertEquals;
 
-import org.apache.axis2.testutils.UtilServer;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 import com.foo.wsns.axis2.test01.Test01;
@@ -30,19 +29,12 @@ import com.foo.wsns.axis2.test01.Test01S
 import com.foo.xmlns.axis2.test01.Add;
 
 public class Test01Test {
-    @BeforeClass
-    public static void startServer() throws Exception {
-        UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/Test01");
-    }
-    
-    @AfterClass
-    public static void stopServer() throws Exception {
-        UtilServer.stop();
-    }
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo/Test01");
     
     @Test
     public void test() throws Exception {
-        Test01 stub = new Test01Stub(UtilServer.getConfigurationContext(), "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/Test01");
+        Test01 stub = new Test01Stub(server.getConfigurationContext(), server.getEndpoint("Test01"));
         Add add = new Add();
         add.setArg1(3);
         add.setArg2(4);

Modified: axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/identityservice/IdentityServiceTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/identityservice/IdentityServiceTest.java?rev=1819084&r1=1819083&r2=1819084&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/identityservice/IdentityServiceTest.java (original)
+++ axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/identityservice/IdentityServiceTest.java Fri Dec 22 18:42:32 2017
@@ -18,30 +18,21 @@
  */
 package org.apache.axis2.jaxbri.identityservice;
 
-import org.apache.axis2.testutils.UtilServer;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 /**
  * Regression test for AXIS2-4197.
  */
 public class IdentityServiceTest {
-    private static final String ENDPOINT = "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/IdentityLinkingService";
-    
-    @BeforeClass
-    public static void startServer() throws Exception {
-        UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/identityservice");
-    }
-    
-    @AfterClass
-    public static void stopServer() throws Exception {
-        UtilServer.stop();
-    }
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo/identityservice");
     
     @Test
     public void test() throws Exception {
-        IdentityLinkingService stub = new IdentityLinkingServiceStub(UtilServer.getConfigurationContext(), ENDPOINT);
+        IdentityLinkingService stub = new IdentityLinkingServiceStub(
+                server.getConfigurationContext(), server.getEndpoint("IdentityLinkingService"));
         LinkIdentitiesType linkIdentities = new LinkIdentitiesType();
         linkIdentities.setOwningPlatform("test");
         stub.createLinkedIdentities(linkIdentities);

Modified: axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java?rev=1819084&r1=1819083&r2=1819084&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java (original)
+++ axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/mtom/MtomTest.java Fri Dec 22 18:42:32 2017
@@ -23,27 +23,17 @@ import javax.activation.DataSource;
 
 import org.apache.axiom.testutils.activation.RandomDataSource;
 import org.apache.axiom.testutils.io.IOTestUtils;
-import org.apache.axis2.testutils.UtilServer;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 public class MtomTest {
-    private static final String ENDPOINT = "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/mtom";
-    
-    @BeforeClass
-    public static void startServer() throws Exception {
-        UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/mtom");
-    }
-    
-    @AfterClass
-    public static void stopServer() throws Exception {
-        UtilServer.stop();
-    }
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo/mtom");
     
     @Test
     public void test() throws Exception {
-        MtomStub stub = new MtomStub(UtilServer.getConfigurationContext(), ENDPOINT);
+        MtomStub stub = new MtomStub(server.getConfigurationContext(), server.getEndpoint("mtom"));
         UploadDocument uploadRequest = new UploadDocument();
         DataSource contentDS = new RandomDataSource(1234567L, 1024);
         uploadRequest.setContent(new DataHandler(contentDS));

Modified: axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java?rev=1819084&r1=1819083&r2=1819084&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java (original)
+++ axis/axis2/java/core/trunk/databinding-tests/jaxbri-tests/src/test/java/org/apache/axis2/jaxbri/processor/ProcessorTest.java Fri Dec 22 18:42:32 2017
@@ -36,10 +36,9 @@ import org.apache.axis2.jaxbri.processor
 import org.apache.axis2.jaxbri.processor.client.ProcessorStub;
 import org.apache.axis2.jaxbri.processor.data.ReplyMessage;
 import org.apache.axis2.jaxbri.processor.data.RequestMessage;
-import org.apache.axis2.testutils.UtilServer;
+import org.apache.axis2.testutils.Axis2Server;
 import org.custommonkey.xmlunit.XMLAssert;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.ClassRule;
 import org.junit.Test;
 import org.w3c.dom.Document;
 
@@ -47,21 +46,12 @@ import org.w3c.dom.Document;
  * Regression test for AXIS2-5147.
  */
 public class ProcessorTest {
-    private static final String ENDPOINT = "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/Processor";
-    
-    @BeforeClass
-    public static void startServer() throws Exception {
-        UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/processor");
-    }
-    
-    @AfterClass
-    public static void stopServer() throws Exception {
-        UtilServer.stop();
-    }
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo/processor");
     
     @Test
     public void testStub() throws Exception {
-        Processor stub = new ProcessorStub(UtilServer.getConfigurationContext(), ENDPOINT);
+        Processor stub = new ProcessorStub(server.getConfigurationContext(), server.getEndpoint("Processor"));
         RequestMessage request = new RequestMessage();
         request.setRequestID("A3TN39840");
         request.setRequestData("DATA");
@@ -79,9 +69,9 @@ public class ProcessorTest {
         InputStream in = ProcessorTest.class.getResourceAsStream("request.xml");
         try {
             OMElement request = OMXMLBuilderFactory.createOMBuilder(in).getDocumentElement();
-            ServiceClient client = new ServiceClient(UtilServer.getConfigurationContext(), null);
+            ServiceClient client = new ServiceClient(server.getConfigurationContext(), null);
             Options options = client.getOptions();
-            options.setTo(new EndpointReference(ENDPOINT));
+            options.setTo(new EndpointReference(server.getEndpoint("Processor")));
             try {
                 OMElement omResponse = client.sendReceive(request);
                 TransformerFactory.newInstance().newTransformer().transform(omResponse.getSAXSource(false), new DOMResult(response));

Modified: axis/axis2/java/core/trunk/modules/jibx/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/pom.xml?rev=1819084&r1=1819083&r2=1819084&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jibx/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/jibx/pom.xml Fri Dec 22 18:42:32 2017
@@ -235,7 +235,6 @@
                     </execution>
                 </executions>
                 <configuration>
-                    <configurationDirectory>conf</configurationDirectory>
                     <generatedAxis2xml>
                         <modules>
                             <module>checker</module>

Modified: axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java?rev=1819084&r1=1819083&r2=1819084&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java (original)
+++ axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/Test.java Fri Dec 22 18:42:32 2017
@@ -19,41 +19,29 @@
 
 package org.apache.axis2.jibx;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+
 import org.apache.axis2.jibx.customer.EchoCustomerServiceStub;
-import org.apache.axis2.testutils.UtilServer;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
 
 /**
  * Full code generation and runtime test for JiBX data binding extension. This is based on the
  * XMLBeans test code.
  */
-public class Test extends TestCase {
-    private static final String REPOSITORY_DIR =
-            System.getProperty("basedir", ".") + "/target/repo/echo";
-
-    private void startServer() throws Exception {
-        UtilServer.start(REPOSITORY_DIR);
-    }
-
-    private void stopServer() throws Exception {
-        UtilServer.stop();
-/*        File outputFile = new File(OUTPUT_LOCATION_BASE);
-        if (outputFile.exists() && outputFile.isDirectory()){
-            deleteDir(outputFile);
-        }   */
-    }
+public class Test {
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo/echo");
 
+    @org.junit.Test
     public void testBuildAndRun() throws Exception {
-        startServer();
-
 //         finish by testing a roundtrip call to the echo server
         Person person = new Person(42, "John", "Smith");
         Customer customer = new Customer("Redmond", person, "+14258858080",
                                          "WA", "14619 NE 80th Pl.", new Integer(98052));
-        EchoCustomerServiceStub stub = new EchoCustomerServiceStub(UtilServer.getConfigurationContext(),
-                "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/Echo/echo");
+        EchoCustomerServiceStub stub = new EchoCustomerServiceStub(server.getConfigurationContext(),
+                server.getEndpoint("Echo") + "/echo");
         Customer result = stub.echo(customer);
-        stopServer();
         assertEquals("Result object does not match request object",
                      customer, result);
     }

Modified: axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java?rev=1819084&r1=1819083&r2=1819084&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java (original)
+++ axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/unwrapped/LibraryTest.java Fri Dec 22 18:42:32 2017
@@ -23,25 +23,17 @@ import static org.junit.Assert.assertNot
 
 import org.apache.axis2.jibx.beans.Book;
 import org.apache.axis2.jibx.library.unwrapped.client.LibraryStub;
-import org.apache.axis2.testutils.UtilServer;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 public class LibraryTest {
-    @BeforeClass
-    public static void startServer() throws Exception {
-        UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/library-unwrapped");
-    }
-    
-    @AfterClass
-    public static void stopServer() throws Exception {
-        UtilServer.stop();
-    }
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo/library-unwrapped");
     
     @Test
     public void test1() throws Exception {
-        LibraryStub stub = new LibraryStub(UtilServer.getConfigurationContext(), "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/library");
+        LibraryStub stub = new LibraryStub(server.getConfigurationContext(), server.getEndpoint("library"));
         
         stub.addBook("Paperback", "0618918248", new String[] { "Richard Dawkins" }, "The God Delusion");
         
@@ -61,7 +53,7 @@ public class LibraryTest {
     
     @Test
     public void test2() throws Exception {
-        LibraryStub stub = new LibraryStub(UtilServer.getConfigurationContext(), "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/library");
+        LibraryStub stub = new LibraryStub(server.getConfigurationContext(), server.getEndpoint("library"));
         
         stub.addBookInstance(new Book("Hardcover", "8854401765", "The Voyage of the Beagle", new String[] { "Charles Darwin" }));
         Book book = stub.getBook("8854401765");

Modified: axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java?rev=1819084&r1=1819083&r2=1819084&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java (original)
+++ axis/axis2/java/core/trunk/modules/jibx/src/test/java/org/apache/axis2/jibx/library/wrapped/LibraryTest.java Fri Dec 22 18:42:32 2017
@@ -21,25 +21,17 @@ package org.apache.axis2.jibx.library.wr
 import org.apache.axis2.jibx.beans.Book;
 import org.apache.axis2.jibx.library.wrapped.client.LibraryStub;
 import org.apache.axis2.jibx.wrappers.AddBookRequest;
-import org.apache.axis2.testutils.UtilServer;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 public class LibraryTest {
-    @BeforeClass
-    public static void startServer() throws Exception {
-        UtilServer.start(System.getProperty("basedir", ".") + "/target/repo/library-wrapped");
-    }
-    
-    @AfterClass
-    public static void stopServer() throws Exception {
-        UtilServer.stop();
-    }
+    @ClassRule
+    public static Axis2Server server = new Axis2Server("target/repo/library-wrapped");
     
     @Test
     public void test() throws Exception {
-        LibraryStub stub = new LibraryStub(UtilServer.getConfigurationContext(), "http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis2/services/library");
+        LibraryStub stub = new LibraryStub(server.getConfigurationContext(), server.getEndpoint("library"));
         
         stub.addBook(new AddBookRequest(new Book("Paperback", "0618918248", "The God Delusion", new String[] { "Richard Dawkins" })));
     }