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/26 23:46:16 UTC

svn commit: r1819306 - in /axis/axis2/java/core/trunk/modules: adb-tests/ adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5750/ adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ adb-tests/src/test/java/org/apache/axis2/databin...

Author: veithen
Date: Tue Dec 26 23:46:16 2017
New Revision: 1819306

URL: http://svn.apache.org/viewvc?rev=1819306&view=rev
Log:
Remove unnecessary dependency.

Modified:
    axis/axis2/java/core/trunk/modules/adb-tests/pom.xml
    axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5750/ServiceTest.java
    axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java
    axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java
    axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java
    axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java

Modified: axis/axis2/java/core/trunk/modules/adb-tests/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/pom.xml?rev=1819306&r1=1819305&r2=1819306&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-tests/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/adb-tests/pom.xml Tue Dec 26 23:46:16 2017
@@ -44,12 +44,6 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>axis2-transport-local</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
             <artifactId>axis2-transport-http</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
@@ -351,6 +345,15 @@
                 <version>${project.version}</version>
                 <executions>
                     <execution>
+                        <id>client-repo</id>
+                        <goals>
+                            <goal>create-test-repository</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/repo/client</outputDirectory>
+                        </configuration>
+                    </execution>
+                    <execution>
                         <id>repo-axis2-5741</id>
                         <goals>
                             <goal>create-test-repository</goal>

Modified: axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5750/ServiceTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5750/ServiceTest.java?rev=1819306&r1=1819305&r2=1819306&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5750/ServiceTest.java (original)
+++ axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5750/ServiceTest.java Tue Dec 26 23:46:16 2017
@@ -27,9 +27,14 @@ import org.apache.axis2.databinding.axis
 import org.apache.axis2.databinding.axis2_5750.client.FixedValueServiceStub;
 import org.apache.axis2.databinding.axis2_5750.client.NonFixedValue_type1;
 import org.apache.axis2.databinding.axis2_5750.service.FixedValueServiceImpl;
+import org.apache.axis2.testutils.ClientHelper;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 public class ServiceTest {
+    @ClassRule
+    public static final ClientHelper clientHelper = new ClientHelper("target/repo/client");
+
     @Test
     public void test() throws Exception {
         int port = PortAllocator.allocatePort();
@@ -40,7 +45,7 @@ public class ServiceTest {
             NonFixedValue_type1 nonFixedValue_type1 = new NonFixedValue_type1();
             nonFixedValue_type1.setNonFixedValue_type0("SomeId");
             fixedValue.setNonFixedValue(nonFixedValue_type1);
-            FixedValueServiceStub stub = new FixedValueServiceStub(address);
+            FixedValueServiceStub stub = clientHelper.createStub(FixedValueServiceStub.class, address);
             assertThat(stub.test(fixedValue).getOut()).isEqualTo("OK");
         } finally {
             endpoint.stop();

Modified: axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java?rev=1819306&r1=1819305&r2=1819306&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java (original)
+++ axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5758/ServiceTest.java Tue Dec 26 23:46:16 2017
@@ -26,16 +26,21 @@ import org.apache.axiom.testutils.PortAl
 import org.apache.axis2.databinding.axis2_5758.client.StockQuoteServiceStub;
 import org.apache.axis2.databinding.axis2_5758.client.TradePriceRequest;
 import org.apache.axis2.databinding.axis2_5758.service.StockQuoteServiceImpl;
+import org.apache.axis2.testutils.ClientHelper;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 public class ServiceTest {
+    @ClassRule
+    public static final ClientHelper clientHelper = new ClientHelper("target/repo/client");
+
     @Test
     public void test() throws Exception {
         int port = PortAllocator.allocatePort();
         String address = "http://localhost:" + port + "/service";
         Endpoint endpoint = Endpoint.publish(address, new StockQuoteServiceImpl());
         try {
-            StockQuoteServiceStub stub = new StockQuoteServiceStub(address);
+            StockQuoteServiceStub stub = clientHelper.createStub(StockQuoteServiceStub.class, address);
             TradePriceRequest request = new TradePriceRequest();
             request.setTickerSymbol(null);
             assertThat(stub.getLastTradePrice(request).getPrice()).isNaN();

Modified: axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java?rev=1819306&r1=1819305&r2=1819306&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java (original)
+++ axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/axis2_5799/ServiceTest.java Tue Dec 26 23:46:16 2017
@@ -26,16 +26,21 @@ import org.apache.axiom.testutils.PortAl
 import org.apache.axis2.databinding.axis2_5799.client.ComplexTypeWithAttribute;
 import org.apache.axis2.databinding.axis2_5799.client.EchoServiceStub;
 import org.apache.axis2.databinding.axis2_5799.service.EchoImpl;
+import org.apache.axis2.testutils.ClientHelper;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 public class ServiceTest {
+    @ClassRule
+    public static final ClientHelper clientHelper = new ClientHelper("target/repo/client");
+
     @Test
     public void test() throws Exception {
         int port = PortAllocator.allocatePort();
         String address = "http://localhost:" + port + "/service";
         Endpoint endpoint = Endpoint.publish(address, new EchoImpl());
         try {
-            EchoServiceStub stub = new EchoServiceStub(address);
+            EchoServiceStub stub = clientHelper.createStub(EchoServiceStub.class, address);
             ComplexTypeWithAttribute request = new ComplexTypeWithAttribute();
             request.setAttr("value");
             assertThat(stub.echo(request).getAttr()).isEqualTo("value");

Modified: axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java?rev=1819306&r1=1819305&r2=1819306&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java (original)
+++ axis/axis2/java/core/trunk/modules/adb-tests/src/test/java/org/apache/axis2/databinding/mtom/MTOMTest.java Tue Dec 26 23:46:16 2017
@@ -28,16 +28,21 @@ import org.apache.axis2.Constants;
 import org.apache.axis2.databinding.mtom.client.MTOMServiceStub;
 import org.apache.axis2.databinding.mtom.client.MTOMServiceStub.GetContent;
 import org.apache.axis2.databinding.mtom.service.MTOMServiceImpl;
+import org.apache.axis2.testutils.ClientHelper;
+import org.junit.ClassRule;
 import org.junit.Test;
 
 public class MTOMTest {
+    @ClassRule
+    public static final ClientHelper clientHelper = new ClientHelper("target/repo/client");
+
     @Test
     public void test() throws Exception {
         int port = PortAllocator.allocatePort();
         String address = "http://localhost:" + port + "/mtom";
         Endpoint endpoint = Endpoint.publish(address, new MTOMServiceImpl());
         try {
-            MTOMServiceStub stub = new MTOMServiceStub(address);
+            MTOMServiceStub stub = clientHelper.createStub(MTOMServiceStub.class, address);
             // JAX-WS only produces an MTOM response if the request uses MTOM
             stub._getServiceClient().getOptions().setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
             DataHandler content = stub.getContent(new GetContent()).getContent();

Modified: axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java?rev=1819306&r1=1819305&r2=1819306&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java (original)
+++ axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java Tue Dec 26 23:46:16 2017
@@ -43,12 +43,26 @@ public class ClientHelper extends Abstra
         this(server, server.getRepositoryPath());
     }
 
+    public ClientHelper(String repositoryPath) {
+        this(null, repositoryPath);
+    }
+
     @Override
     protected final void before() throws Throwable {
         super.before();
-        SSLContext sslContext = server.getClientSSLContext();
-        if (sslContext != null) {
-            getConfigurationContext().setProperty(SSLContext.class.getName(), sslContext);
+        if (server != null) {
+            SSLContext sslContext = server.getClientSSLContext();
+            if (sslContext != null) {
+                getConfigurationContext().setProperty(SSLContext.class.getName(), sslContext);
+            }
+        }
+    }
+
+    private String getEndpoint(String endpoint) throws Exception {
+        if (server != null && !endpoint.startsWith("http://")) {
+            return server.getEndpoint(endpoint);
+        } else {
+            return endpoint;
         }
     }
 
@@ -80,10 +94,10 @@ public class ClientHelper extends Abstra
         return serviceClient;
     }
 
-    public final <T extends Stub> T createStub(Class<T> type, String serviceName) throws Exception {
+    public final <T extends Stub> T createStub(Class<T> type, String endpoint) throws Exception {
         T stub = type
                 .getConstructor(ConfigurationContext.class, String.class)
-                .newInstance(getConfigurationContext(), server.getEndpoint(serviceName));
+                .newInstance(getConfigurationContext(), getEndpoint(endpoint));
         configureServiceClient(stub._getServiceClient());
         return stub;
     }