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 2018/01/03 12:58:45 UTC

svn commit: r1819965 - in /axis/axis2/java/core/trunk/modules/integration: ./ test/org/apache/axis2/engine/ test/org/apache/axis2/integration/ test/org/apache/axis2/rpc/complex/

Author: veithen
Date: Wed Jan  3 12:58:45 2018
New Revision: 1819965

URL: http://svn.apache.org/viewvc?rev=1819965&view=rev
Log:
Change fork mode to Speed up test execution.

Modified:
    axis/axis2/java/core/trunk/modules/integration/pom.xml
    axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/LongRunningServiceTest.java
    axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ServiceClientTest.java
    axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/integration/UtilServer.java
    axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java

Modified: axis/axis2/java/core/trunk/modules/integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/pom.xml?rev=1819965&r1=1819964&r2=1819965&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/integration/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/integration/pom.xml Wed Jan  3 12:58:45 2018
@@ -538,10 +538,6 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <inherited>true</inherited>
                 <configuration>
-                    <!-- The pertest forkMode is not ideal but seems to be necessary
-                         because the test server doesn't shut down properly :-(
-                         Should be removed if possible -->
-                    <forkMode>pertest</forkMode>
                     <argLine>-Xms256m -Xmx512m</argLine>
                     <!-- Enable the next 2 lines if you want to attach a debugger
                  <argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006</argLine>-->

Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/LongRunningServiceTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/LongRunningServiceTest.java?rev=1819965&r1=1819964&r2=1819965&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/LongRunningServiceTest.java (original)
+++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/LongRunningServiceTest.java Wed Jan  3 12:58:45 2018
@@ -65,7 +65,6 @@ public class LongRunningServiceTest exte
     }
 
     protected void setUp() throws Exception {
-        UtilServer.start();
         UtilServer.engageAddressingModule();
         AxisService service =
                 Utils.createSimpleService(serviceName,

Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ServiceClientTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ServiceClientTest.java?rev=1819965&r1=1819964&r2=1819965&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ServiceClientTest.java (original)
+++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ServiceClientTest.java Wed Jan  3 12:58:45 2018
@@ -72,6 +72,7 @@ public class ServiceClientTest extends U
     protected void tearDown() throws Exception {
         UtilServer.unDeployService(new QName("Echo"));
         UtilServer.unDeployClientService();
+        UtilServer.stop();
     }
 
     public static OMElement createDummyOMElement() {

Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/integration/UtilServer.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/integration/UtilServer.java?rev=1819965&r1=1819964&r2=1819965&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/integration/UtilServer.java (original)
+++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/integration/UtilServer.java Wed Jan  3 12:58:45 2018
@@ -39,8 +39,6 @@ import java.io.File;
 import java.io.FilenameFilter;
 
 public class UtilServer {
-    private static int count = 0;
-
     private static SimpleHTTPServer receiver;
 
     public static final int TESTING_PORT = PortAllocator.allocatePort();
@@ -73,26 +71,28 @@ public class UtilServer {
 
 
     public static synchronized void start(String repository) throws Exception {
-        if (count == 0) {
-            ConfigurationContext er = getNewConfigurationContext(repository);
+        if (receiver != null) {
+            throw new IllegalStateException("Server already running");
+        }
 
-            receiver = new SimpleHTTPServer(er, TESTING_PORT);
+        ConfigurationContext er = getNewConfigurationContext(repository);
 
-            try {
-                receiver.start();
-                ListenerManager listenerManager = er.getListenerManager();
-                TransportInDescription trsIn = new TransportInDescription(Constants.TRANSPORT_HTTP);
-                trsIn.setReceiver(receiver);
-                if (listenerManager == null) {
-                    listenerManager = new ListenerManager();
-                    listenerManager.init(er);
-                }
-                listenerManager.addListener(trsIn, true);
-                System.out.print("Server started on port "
-                        + TESTING_PORT + ".....");
-            } catch (Exception e) {
-                e.printStackTrace();
+        receiver = new SimpleHTTPServer(er, TESTING_PORT);
+
+        try {
+            receiver.start();
+            ListenerManager listenerManager = er.getListenerManager();
+            TransportInDescription trsIn = new TransportInDescription(Constants.TRANSPORT_HTTP);
+            trsIn.setReceiver(receiver);
+            if (listenerManager == null) {
+                listenerManager = new ListenerManager();
+                listenerManager.init(er);
             }
+            listenerManager.addListener(trsIn, true);
+            System.out.print("Server started on port "
+                    + TESTING_PORT + ".....");
+        } catch (Exception e) {
+            e.printStackTrace();
         }
 
         try {
@@ -100,9 +100,6 @@ public class UtilServer {
         } catch (InterruptedException e1) {
             throw new AxisFault("Thread interuptted", e1);
         }
-
-
-        count++;
     }
 
     public static ConfigurationContext getNewConfigurationContext(
@@ -131,22 +128,22 @@ public class UtilServer {
     }
 
     public static synchronized void stop() throws AxisFault {
-        if (count == 1) {
-            receiver.stop();
-            while (receiver.isRunning()) {
-                try {
-                    Thread.sleep(1000);
-                } catch (InterruptedException e1) {
-                    //nothing to do here
-                }
+        if (receiver == null) {
+            throw new IllegalStateException();
+        }
+
+        receiver.stop();
+        while (receiver.isRunning()) {
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e1) {
+                //nothing to do here
             }
-            count = 0;
-// tp.doStop();
-            System.out.print("Server stopped .....");
-        } else {
-            count--;
         }
+// tp.doStop();
+        System.out.print("Server stopped .....");
         receiver.getConfigurationContext().terminate();
+        receiver = null;
     }
 
     public static ConfigurationContext getConfigurationContext() {

Modified: axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java?rev=1819965&r1=1819964&r2=1819965&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java (original)
+++ axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java Wed Jan  3 12:58:45 2018
@@ -84,7 +84,6 @@ public class ComplexDataTypesComplexData
 
     protected void setUp() throws Exception {
         String className = "org.tempuri.complex.ComplexDataTypes";
-        UtilServer.start();
         AxisService   service = AxisService.createService(
                 className, UtilServer.getConfigurationContext().getAxisConfiguration());
         service.setElementFormDefault(true);