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 2019/01/06 17:46:57 UTC

svn commit: r1850578 - in /axis/axis2/java/core/branches/1_7: ./ modules/integration/ modules/integration/test/org/apache/axis2/engine/map/ modules/testutils/ modules/testutils/src/main/java/org/apache/axis2/testutils/

Author: veithen
Date: Sun Jan  6 17:46:56 2019
New Revision: 1850578

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

Added:
    axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AxisServiceFactory.java
      - copied unchanged from r1819246, axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/AxisServiceFactory.java
    axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/SimpleAxisServiceFactory.java
      - copied unchanged from r1819246, axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/SimpleAxisServiceFactory.java
Modified:
    axis/axis2/java/core/branches/1_7/   (props changed)
    axis/axis2/java/core/branches/1_7/modules/integration/pom.xml
    axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/map/MapServiceTest.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/AbstractAxis2Server.java
    axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/Axis2Server.java
    axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/JettyServer.java

Propchange: axis/axis2/java/core/branches/1_7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jan  6 17:46:56 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,1819265,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,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

Modified: axis/axis2/java/core/branches/1_7/modules/integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/integration/pom.xml?rev=1850578&r1=1850577&r2=1850578&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_7/modules/integration/pom.xml (original)
+++ axis/axis2/java/core/branches/1_7/modules/integration/pom.xml Sun Jan  6 17:46:56 2019
@@ -133,6 +133,12 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
             <scope>test</scope>

Modified: axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/map/MapServiceTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/map/MapServiceTest.java?rev=1850578&r1=1850577&r2=1850578&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/map/MapServiceTest.java (original)
+++ axis/axis2/java/core/branches/1_7/modules/integration/test/org/apache/axis2/engine/map/MapServiceTest.java Sun Jan  6 17:46:56 2019
@@ -19,8 +19,10 @@
 
 package org.apache.axis2.engine.map;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import javax.xml.stream.XMLStreamException;
-import junit.framework.TestCase;
 
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
@@ -31,33 +33,19 @@ import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.AxisServer;
+import org.apache.axis2.testutils.Axis2Server;
+import org.apache.axis2.testutils.SimpleAxisServiceFactory;
+import org.junit.ClassRule;
+import org.junit.Test;
 
 /**
  * The Class MapServiceTest.
  */
-public class MapServiceTest extends TestCase {
-    private AxisServer server;
+public class MapServiceTest {
+    @ClassRule
+    public static Axis2Server server = new Axis2Server(null,
+            new SimpleAxisServiceFactory(MapService.class));
     
-    /** The service. */
-    protected AxisService service;
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see junit.framework.TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        server = new AxisServer();
-        server.deployService(MapService.class.getName());
-    }   
-
-    @Override
-    protected void tearDown() throws Exception {
-        server.stop();
-    }
-
     /**
      * Test string generics map service.
      * 
@@ -66,9 +54,10 @@ public class MapServiceTest extends Test
      * @throws AxisFault
      *             the axis fault
      */
+    @Test
     public void testStringGenericsMapService() throws XMLStreamException,
             AxisFault {
-        String epr = "http://localhost:6060/axis2/services/MapService/stringGenericsMapService";
+        String epr = server.getEndpoint("MapService") + "/stringGenericsMapService";
         Options options = new Options();
         options.setTo(new EndpointReference(epr));
         ServiceClient sender = new ServiceClient();
@@ -94,10 +83,11 @@ public class MapServiceTest extends Test
      * @throws AxisFault
      *             the axis fault
      */
+    @Test
     public void testStringGenericsTreeMapService() throws XMLStreamException,
             AxisFault {
 
-        String epr = "http://localhost:6060/axis2/services/MapService/stringGenericsTreeMapService";
+        String epr = server.getEndpoint("MapService") + "/stringGenericsTreeMapService";
         Options options = new Options();
         options.setTo(new EndpointReference(epr));
         ServiceClient sender = new ServiceClient();

Propchange: axis/axis2/java/core/branches/1_7/modules/testutils/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Jan  6 17:46:56 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,1819265,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,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

Modified: axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AbstractAxis2Server.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AbstractAxis2Server.java?rev=1850578&r1=1850577&r2=1850578&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AbstractAxis2Server.java (original)
+++ axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/AbstractAxis2Server.java Sun Jan  6 17:46:56 2019
@@ -24,17 +24,17 @@ import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.junit.rules.ExternalResource;
 
 public abstract class AbstractAxis2Server extends ExternalResource {
     private final String repositoryPath;
+    private final AxisServiceFactory[] serviceFactories;
     private ConfigurationContext configurationContext;
 
-    public AbstractAxis2Server(String repositoryPath) {
-        if (repositoryPath == null || repositoryPath.trim().length() == 0) {
-            throw new IllegalArgumentException("Axis2 repository must not be null or empty");
-        }
+    public AbstractAxis2Server(String repositoryPath, AxisServiceFactory... serviceFactories) {
         this.repositoryPath = repositoryPath;
+        this.serviceFactories = serviceFactories;
     }
 
     final String getRepositoryPath() {
@@ -52,6 +52,10 @@ public abstract class AbstractAxis2Serve
     protected void before() throws Throwable {
         configurationContext =
                 ConfigurationContextFactory.createConfigurationContextFromFileSystem(repositoryPath);
+        AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
+        for (AxisServiceFactory serviceFactory : serviceFactories) {
+            axisConfiguration.addService(serviceFactory.createService(axisConfiguration));
+        }
         startServer(configurationContext);
     }
 

Modified: axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/Axis2Server.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/Axis2Server.java?rev=1850578&r1=1850577&r2=1850578&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/Axis2Server.java (original)
+++ axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/Axis2Server.java Sun Jan  6 17:46:56 2019
@@ -29,8 +29,8 @@ public class Axis2Server extends Abstrac
     private int port = -1;
     private SimpleHTTPServer server;
 
-    public Axis2Server(String repositoryPath) {
-        super(repositoryPath);
+    public Axis2Server(String repositoryPath, AxisServiceFactory... axisServiceFactories) {
+        super(repositoryPath, axisServiceFactories);
     }
 
     @Override

Modified: axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/JettyServer.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/JettyServer.java?rev=1850578&r1=1850577&r2=1850578&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/JettyServer.java (original)
+++ axis/axis2/java/core/branches/1_7/modules/testutils/src/main/java/org/apache/axis2/testutils/JettyServer.java Sun Jan  6 17:46:56 2019
@@ -85,8 +85,8 @@ public class JettyServer extends Abstrac
      * @param secure
      *            Whether to enable HTTPS.
      */
-    public JettyServer(String repositoryPath, boolean secure) {
-        super(repositoryPath);
+    public JettyServer(String repositoryPath, boolean secure, AxisServiceFactory... axisServiceFactories) {
+        super(repositoryPath, axisServiceFactories);
         this.secure = secure;
     }