Author: veithen
Date: Sun Jan  6 18:23:40 2019
New Revision: 1850582

URL: http://svn.apache.org/viewvc?rev=1850582&view=rev
Log:
Merge r1850551 to the 1.7 branch.

Modified:
    axis/axis2/java/core/branches/1_7/   (props changed)
    
axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java
    axis/axis2/java/core/branches/1_7/modules/testutils/   (props changed)
    
axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AbstractConfigurationContextRule.java

Propchange: axis/axis2/java/core/branches/1_7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jan  6 18:23:40 2019
@@ -1,4 +1,4 @@
 /axis/axis2/java/core/branches/1_6:1295540
 /axis/axis2/java/core/branches/AXIOM-420:1334386-1336397
 
/axis/axis2/java/core/branches/AXIS2-4318:1230452,1295542,1324772,1327468,1329571,1332141,1335355,1335357,1340985
-/axis/axis2/java/core/trunk:1726494,1726509,1726513,1727171,1727174,1727177,1727180,1729891,1730095,1730139,1730180,1730186,1730195,1730197,1730222,1730300,1730308,1730310,1730317,1730322,1730335,1730369,1730427,1730618,1731425,1731441,1731446,1731448,1732354,1733137,1733225,1733663,1733713,1733766,1733770,1733773,1733850,1734176,1735331,1735795,1735801,1736512,1736543,1737030,1737567,1739001,1739186,1739343,1739346,1739348,1739493,1739592,1739594-1739595,1739815,1739826,1740693-1740694,1741976,1742201,1743824,1745826,1745860,1745869,1745875,1745912,1745924,1745929,1745941,1746001,1746028,1746109,1746782,1746784,1746787,1746813,1746842,1746880,1746883,1746889,1746894,1747448,1747466,1747503,1747575,1747578,1747601,1747773,1747920,1751057,1752039,1765132,1765183,1765188,1765192-1765193,1775081,1775102,1776253,1776585,1776594,1778204,1779069,1779074,1779816,1780290,1780684,1780714,1780723,1780726,1780733,1787632,1787676,1789029,1792353,1792376,1792650,1792655,1792802,1792804,1793723-1
 
793724,1793728,1794114,1794192,1797821,1797823,1799068,1800495,1803414,1805563,1806088,1806288,1806292,1806303-1806305,1806309,1806319,1806344,1806349-1806350,1806577,1806581,1806719,1807643,1807837,1807941,1807943,1808789,1809384-1809385,1809411,1809504,1809507,1809514,1809517,1810596,1810600,1810603,1815035,1815137,1815139,1817866,1817872,1819246,1819265,1819304,1820601,1821801,1821809,1823604,1823614,1823712,1826036,1831475,1831477,1831917,1832205,1835900,1836506,1837506-1837507,1837540,1838336,1843339,1843344,1844184,1844999,1845031,1845035,1845166,1845183,1848535,1848643-1848644,1848708,1848721,1848799,1849034,1849255,1849801,1850485
+/axis/axis2/java/core/trunk:1726494,1726509,1726513,1727171,1727174,1727177,1727180,1729891,1730095,1730139,1730180,1730186,1730195,1730197,1730222,1730300,1730308,1730310,1730317,1730322,1730335,1730369,1730427,1730618,1731425,1731441,1731446,1731448,1732354,1733137,1733225,1733663,1733713,1733766,1733770,1733773,1733850,1734176,1735331,1735795,1735801,1736512,1736543,1737030,1737567,1739001,1739186,1739343,1739346,1739348,1739493,1739592,1739594-1739595,1739815,1739826,1740693-1740694,1741976,1742201,1743824,1745826,1745860,1745869,1745875,1745912,1745924,1745929,1745941,1746001,1746028,1746109,1746782,1746784,1746787,1746813,1746842,1746880,1746883,1746889,1746894,1747448,1747466,1747503,1747575,1747578,1747601,1747773,1747920,1751057,1752039,1765132,1765183,1765188,1765192-1765193,1775081,1775102,1776253,1776585,1776594,1778204,1779069,1779074,1779816,1780290,1780684,1780714,1780723,1780726,1780733,1787632,1787676,1789029,1792353,1792376,1792650,1792655,1792802,1792804,1793723-1
 
793724,1793728,1794114,1794192,1797821,1797823,1799068,1800495,1803414,1805563,1806088,1806288,1806292,1806303-1806305,1806309,1806319,1806344,1806349-1806350,1806577,1806581,1806719,1807643,1807837,1807941,1807943,1808789,1809384-1809385,1809411,1809504,1809507,1809514,1809517,1810596,1810600,1810603,1815035,1815137,1815139,1817866,1817872,1819246,1819265,1819304,1820601,1821801,1821809,1823604,1823614,1823712,1826036,1831475,1831477,1831917,1832205,1835900,1836506,1837506-1837507,1837540,1838336,1843339,1843344,1844184,1844999,1845031,1845035,1845166,1845183,1848535,1848643-1848644,1848708,1848721,1848799,1849034,1849255,1849801,1850485,1850551

Modified: 
axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java?rev=1850582&r1=1850581&r2=1850582&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java
 (original)
+++ 
axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/PausingHandlerExecutionTest.java
 Sun Jan  6 18:23:40 2019
@@ -19,6 +19,9 @@
 
 package org.apache.axis2.engine;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -31,13 +34,11 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
@@ -48,58 +49,44 @@ import org.apache.axis2.engine.util.Test
 import org.apache.axis2.handlers.AbstractHandler;
 import org.apache.axis2.integration.TestingUtils;
 import org.apache.axis2.integration.UtilServer;
-import org.apache.axis2.integration.UtilServerBasedTestCase;
 import org.apache.axis2.phaseresolver.PhaseMetadata;
+import org.apache.axis2.testutils.Axis2Server;
 import org.apache.axis2.util.Utils;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+public class PausingHandlerExecutionTest implements TestConstants {
+    @ClassRule
+    public static final Axis2Server server = new 
Axis2Server(TestingUtils.prefixBaseDirectory(Constants.TESTING_REPOSITORY));
 
-public class PausingHandlerExecutionTest extends UtilServerBasedTestCase 
implements TestConstants {
-    private static boolean initDone = false;
     private static ArrayList testResults;
-    private AxisService testService;
     private static TestHandler middleGlobalInHandler;
-    private TestHandler firstOperationInHandler;
-    private TestHandler middleOperationInHandler;
-    private TestHandler middleOperationOutHandler;
-
-    public PausingHandlerExecutionTest() {
-        super(PausingHandlerExecutionTest.class.getName());
-    }
 
-    public PausingHandlerExecutionTest(String testName) {
-        super(testName);
-    }
-
-    public static Test suite() {
-        return getTestSetup(new TestSuite(PausingHandlerExecutionTest.class));
-    }
-
-    protected void setUp() throws Exception {
-        //org.apache.log4j.BasicConfigurator.configure();
+    @BeforeClass
+    public static void setUp() throws Exception {
+        AxisConfiguration axisConfiguration = 
server.getConfigurationContext().getAxisConfiguration();
 
         testResults = new ArrayList();
 
-        if (!initDone) {
-            initDone = true;
-            List globalInPhases =
-                    
UtilServer.getConfigurationContext().getAxisConfiguration().getInFlowPhases();
-            for (int i = 0; i < globalInPhases.size(); i++) {
-                Phase globalInPhase = (Phase)globalInPhases.get(i);
-                if 
(PhaseMetadata.PHASE_PRE_DISPATCH.equals(globalInPhase.getPhaseName())) {
-                    System.out.println("Adding handlers to  globalInPhase   
name [" +
-                            globalInPhase.getPhaseName() + "]  ...");
-                    globalInPhase.addHandler(new TestHandler("In1"));
-                    middleGlobalInHandler = new TestHandler("In2");
-                    globalInPhase.addHandler(middleGlobalInHandler);
-                    globalInPhase.addHandler(new TestHandler("In3"));
-                    System.out.println("...done adding handlers to  
globalInPhase   name [" +
-                            globalInPhase.getPhaseName() + "]  ...");
-                }
+        List globalInPhases = axisConfiguration.getInFlowPhases();
+        for (int i = 0; i < globalInPhases.size(); i++) {
+            Phase globalInPhase = (Phase)globalInPhases.get(i);
+            if 
(PhaseMetadata.PHASE_PRE_DISPATCH.equals(globalInPhase.getPhaseName())) {
+                System.out.println("Adding handlers to  globalInPhase   name 
[" +
+                        globalInPhase.getPhaseName() + "]  ...");
+                globalInPhase.addHandler(new TestHandler("In1"));
+                middleGlobalInHandler = new TestHandler("In2");
+                globalInPhase.addHandler(middleGlobalInHandler);
+                globalInPhase.addHandler(new TestHandler("In3"));
+                System.out.println("...done adding handlers to  globalInPhase  
 name [" +
+                        globalInPhase.getPhaseName() + "]  ...");
             }
         }
 
-        testService = Utils.createSimpleService(serviceName, 
Echo.class.getName(),
-                                                operationName);
-        UtilServer.deployService(testService);
+        AxisService testService = Utils.createSimpleService(serviceName, 
Echo.class.getName(),
+                                                            operationName);
+        axisConfiguration.addService(testService);
         AxisOperation operation = testService.getOperation(operationName);
 
         ArrayList operationSpecificPhases = new ArrayList();
@@ -111,9 +98,9 @@ public class PausingHandlerExecutionTest
             Phase operationSpecificPhase = (Phase)phaseList.get(i);
             if (PhaseMetadata.PHASE_POLICY_DETERMINATION
                     .equals(operationSpecificPhase.getPhaseName())) {
-                firstOperationInHandler = new TestHandler("In4");
+                TestHandler firstOperationInHandler = new TestHandler("In4");
                 operationSpecificPhase.addHandler(firstOperationInHandler);
-                middleOperationInHandler = new TestHandler("In5");
+                TestHandler middleOperationInHandler = new TestHandler("In5");
                 operationSpecificPhase.addHandler(middleOperationInHandler);
                 operationSpecificPhase.addHandler(new TestHandler("In6"));
             }
@@ -129,21 +116,16 @@ public class PausingHandlerExecutionTest
             if (PhaseMetadata.PHASE_POLICY_DETERMINATION
                     .equals(operationSpecificPhase.getPhaseName())) {
                 operationSpecificPhase.addHandler(new TestHandler("Out1"));
-                middleOperationOutHandler = new TestHandler("Out2");
+                TestHandler middleOperationOutHandler = new 
TestHandler("Out2");
                 operationSpecificPhase.addHandler(middleOperationOutHandler);
                 operationSpecificPhase.addHandler(new TestHandler("Out3"));
             }
         }
     }
 
-    protected void tearDown() throws Exception {
-        UtilServer.unDeployService(serviceName);
-        UtilServer.unDeployClientService();
-    }
-
     private ServiceClient createClient() throws Exception {
         Options options = new Options();
-        options.setTo(targetEPR);
+        options.setTo(new EndpointReference("http://127.0.0.1:"; + 
server.getPort() + "/axis2/services/EchoXMLService/echoOMElement"));
         options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
         options.setAction(operationName.getLocalPart());
@@ -164,6 +146,7 @@ public class PausingHandlerExecutionTest
         TestingUtils.compareWithCreatedOMElement(result);
     }
 
+    @Test
     public void testSuccessfulInvocation() throws Exception {
         System.out.println("Starting testSuccessfulInvocation");
         middleGlobalInHandler.shouldPause(true);
@@ -198,7 +181,7 @@ public class PausingHandlerExecutionTest
 
     }
 
-    private class TestHandler extends AbstractHandler {
+    private static class TestHandler extends AbstractHandler {
         private String handlerName;
         private boolean shouldFail = false;
         private boolean shouldPause = false;
@@ -360,7 +343,7 @@ public class PausingHandlerExecutionTest
 
     }
 
-    private class Worker extends Thread {
+    private static class Worker extends Thread {
         private byte[] serializedMessageContext = null;
         private ConfigurationContext configurationContext = null;
         private File theFile = null;

Propchange: axis/axis2/java/core/branches/1_7/modules/testutils/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jan  6 18:23:40 2019
@@ -1,4 +1,4 @@
 /axis/axis2/java/core/branches/1_6/modules/testutils:1295540
 /axis/axis2/java/core/branches/AXIOM-420/modules/testutils:1334386-1336397
 
/axis/axis2/java/core/branches/AXIS2-4318/modules/testutils:1230452,1295542,1324772,1327468,1329571,1332141,1335355,1335357,1340985
-/axis/axis2/java/core/trunk/modules/testutils:1726494,1726509,1726513,1727171,1727174,1727177,1727180,1729891,1730095,1730139,1730180,1730186,1730195,1730197,1730222,1730300,1730308,1730310,1730317,1730322,1730335,1730369,1730427,1730618,1731425,1731441,1731446,1731448,1732354,1733137,1733225,1733663,1733713,1733766,1733770,1733773,1733850,1734176,1735331,1735795,1735801,1736512,1736543,1737030,1737567,1739001,1739186,1739343,1739346,1739348,1739493,1739592,1739594-1739595,1739815,1739826,1740693-1740694,1741976-1741977,1742201,1743824,1745826,1745860,1745869,1745875,1745912,1745924,1745929,1745941,1746001,1746028,1746109,1746782,1746784,1746787,1746813,1746842,1746880,1746883,1746889,1746894,1747448,1747466,1747503,1747575,1747578,1747601,1747773,1747920,1751057,1752039,1765132,1765183,1765188,1765192-1765193,1775081,1775102,1776253,1776585,1776594,1778204,1779069,1779074,1779816,1780290,1780684,1780714,1780723-1780724,1780726,1780733,1780738,1787632,1787676,1789029,1792353,1792376
 
,1792650,1792655,1792802,1792804,1793723-1793724,1793728,1794114,1794192,1797821,1797823,1799068,1800495,1803414,1805563,1806088,1806288,1806292,1806303-1806305,1806309,1806319,1806344,1806349-1806350,1806577,1806581,1806719,1807643,1807837,1807941,1807943,1808789,1809384-1809385,1809411,1809504,1809507,1809514,1809517,1810596,1810600,1810603,1815035,1815137,1815139,1817866,1817872,1819246,1819265,1819304,1820601,1821801,1821809,1823604,1823614,1823712,1826036,1831475,1831477,1831917,1832205,1835900,1836506,1837506-1837507,1837540,1838336,1843339,1843344,1844999,1845031,1845035,1845166,1845183,1848535,1848643-1848644,1848708,1848721,1848799,1849034,1849255,1849801,1850485
+/axis/axis2/java/core/trunk/modules/testutils:1726494,1726509,1726513,1727171,1727174,1727177,1727180,1729891,1730095,1730139,1730180,1730186,1730195,1730197,1730222,1730300,1730308,1730310,1730317,1730322,1730335,1730369,1730427,1730618,1731425,1731441,1731446,1731448,1732354,1733137,1733225,1733663,1733713,1733766,1733770,1733773,1733850,1734176,1735331,1735795,1735801,1736512,1736543,1737030,1737567,1739001,1739186,1739343,1739346,1739348,1739493,1739592,1739594-1739595,1739815,1739826,1740693-1740694,1741976-1741977,1742201,1743824,1745826,1745860,1745869,1745875,1745912,1745924,1745929,1745941,1746001,1746028,1746109,1746782,1746784,1746787,1746813,1746842,1746880,1746883,1746889,1746894,1747448,1747466,1747503,1747575,1747578,1747601,1747773,1747920,1751057,1752039,1765132,1765183,1765188,1765192-1765193,1775081,1775102,1776253,1776585,1776594,1778204,1779069,1779074,1779816,1780290,1780684,1780714,1780723-1780724,1780726,1780733,1780738,1787632,1787676,1789029,1792353,1792376
 
,1792650,1792655,1792802,1792804,1793723-1793724,1793728,1794114,1794192,1797821,1797823,1799068,1800495,1803414,1805563,1806088,1806288,1806292,1806303-1806305,1806309,1806319,1806344,1806349-1806350,1806577,1806581,1806719,1807643,1807837,1807941,1807943,1808789,1809384-1809385,1809411,1809504,1809507,1809514,1809517,1810596,1810600,1810603,1815035,1815137,1815139,1817866,1817872,1819246,1819265,1819304,1820601,1821801,1821809,1823604,1823614,1823712,1826036,1831475,1831477,1831917,1832205,1835900,1836506,1837506-1837507,1837540,1838336,1843339,1843344,1844999,1845031,1845035,1845166,1845183,1848535,1848643-1848644,1848708,1848721,1848799,1849034,1849255,1849801,1850485,1850551

Modified: 
axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AbstractConfigurationContextRule.java
URL: 
http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AbstractConfigurationContextRule.java?rev=1850582&r1=1850581&r2=1850582&view=diff
==============================================================================
--- 
axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AbstractConfigurationContextRule.java
 (original)
+++ 
axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AbstractConfigurationContextRule.java
 Sun Jan  6 18:23:40 2019
@@ -18,6 +18,8 @@
  */
 package org.apache.axis2.testutils;
 
+import java.io.File;
+
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.junit.rules.ExternalResource;
@@ -43,8 +45,25 @@ public abstract class AbstractConfigurat
 
     @Override
     protected void before() throws Throwable {
+        String axis2xml;
+        if (repositoryPath == null) {
+            axis2xml = null;
+        } else {
+            File repo = new File(repositoryPath);
+            File axis2xmlFile = new File(repo, "axis2.xml");
+            if (axis2xmlFile.exists()) {
+                axis2xml = axis2xmlFile.getAbsolutePath();
+            } else {
+                axis2xmlFile = new File(new File(repo, "conf"), "axis2.xml");
+                if (axis2xmlFile.exists()) {
+                    axis2xml = axis2xmlFile.getAbsolutePath();
+                } else {
+                    axis2xml = null;
+                }
+            }
+        }
         configurationContext =
-                
ConfigurationContextFactory.createConfigurationContextFromFileSystem(repositoryPath);
+                
ConfigurationContextFactory.createConfigurationContextFromFileSystem(repositoryPath,
 axis2xml);
     }
 
     @Override


Reply via email to