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/27 08:40:48 UTC

svn commit: r1819320 - in /axis/axis2/java/core/trunk/modules/jaxws-integration: ./ src/test/java/org/apache/axis2/jaxws/framework/ src/test/java/org/apache/axis2/jaxws/provider/ src/test/java/org/apache/axis2/jaxws/xmlhttp/

Author: veithen
Date: Wed Dec 27 08:40:48 2017
New Revision: 1819320

URL: http://svn.apache.org/viewvc?rev=1819320&view=rev
Log:
Don't rely on system properties to configure the client configuration context in jaxws-integration, so that tests can be executed as is in an IDE.

Added:
    axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/ClientConfigurationContextBinder.java   (with props)
Modified:
    axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml
    axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/AddressingProviderTests.java
    axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
    axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java

Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml?rev=1819320&r1=1819319&r2=1819320&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml Wed Dec 27 08:40:48 2017
@@ -249,6 +249,7 @@
                         </goals>
                         <configuration>
                             <outputDirectory>${project.build.directory}/client-repo</outputDirectory>
+                            <axis2xml>test-resources/axis2.xml</axis2xml>
                             <modules>addressing</modules>
                         </configuration>
                     </execution>
@@ -1413,16 +1414,6 @@
                             <name>javax.xml.soap.MetaFactory</name>
                             <value>org.apache.axis2.saaj.SAAJMetaFactoryImpl</value>
                         </property>
-                        <!-- Need this for the client side to pickup an axis2.xml to configure SoapMessageMUProviderChecker -->
-                        <property>
-                            <name>org.apache.axis2.jaxws.config.path</name>
-                            <value>./target/test-classes/axis2.xml</value>
-                        </property>
-                        <!-- Need this for the client side to pickup the addressing mar -->
-                        <property>
-                            <name>org.apache.axis2.jaxws.repo.path</name>
-                            <value>./target/client-repo</value>
-                        </property>
                         <!-- Prevent Mac OS X from showing an icon in the dock during the test run -->
                         <property>
                             <name>java.awt.headless</name>

Added: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/ClientConfigurationContextBinder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/ClientConfigurationContextBinder.java?rev=1819320&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/ClientConfigurationContextBinder.java (added)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/ClientConfigurationContextBinder.java Wed Dec 27 08:40:48 2017
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.framework;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.jaxws.ClientConfigurationFactory;
+import org.apache.axis2.metadata.registry.MetadataFactoryRegistry;
+import org.apache.axis2.testutils.AbstractConfigurationContextRule;
+
+public class ClientConfigurationContextBinder extends AbstractConfigurationContextRule {
+    private ClientConfigurationFactory savedClientConfigurationFactory;
+
+    public ClientConfigurationContextBinder(String repositoryPath) {
+        super(repositoryPath);
+    }
+
+    @Override
+    protected void before() throws Throwable {
+        super.before();
+        savedClientConfigurationFactory = (ClientConfigurationFactory)MetadataFactoryRegistry.getFactory(ClientConfigurationFactory.class);
+        MetadataFactoryRegistry.setFactory(ClientConfigurationFactory.class, new ClientConfigurationFactory() {
+            @Override
+            public synchronized ConfigurationContext getClientConfigurationContext() {
+                return ClientConfigurationContextBinder.this.getConfigurationContext();
+            }
+        });
+    }
+
+    @Override
+    protected void after() {
+        MetadataFactoryRegistry.setFactory(ClientConfigurationFactory.class, savedClientConfigurationFactory);
+        super.after();
+    }
+}

Propchange: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/ClientConfigurationContextBinder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/AddressingProviderTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/AddressingProviderTests.java?rev=1819320&r1=1819319&r2=1819320&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/AddressingProviderTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/AddressingProviderTests.java Wed Dec 27 08:40:48 2017
@@ -36,6 +36,7 @@ import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPMessage;
 
+import org.apache.axis2.jaxws.framework.ClientConfigurationContextBinder;
 import org.apache.axis2.jaxws.spi.Binding;
 import org.apache.axis2.testutils.Axis2Server;
 
@@ -54,6 +55,9 @@ public class AddressingProviderTests {
     @ClassRule
     public static Axis2Server server = new Axis2Server("target/addressing-repo");
 
+    @ClassRule
+    public static final ClientConfigurationContextBinder binder = new ClientConfigurationContextBinder("target/client-repo");
+
     private QName serviceName = new QName("http://addressing.provider.jaxws.axis2.apache.org", "AddressingProviderService");
     private QName portName = new QName("http://addressing.provider.jaxws.axis2.apache.org", "AddressingProviderPort");
         

Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java?rev=1819320&r1=1819319&r2=1819320&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageMUProviderTests.java Wed Dec 27 08:40:48 2017
@@ -28,6 +28,7 @@ import javax.xml.ws.Response;
 import javax.xml.ws.Service;
 import javax.xml.ws.soap.SOAPBinding;
 
+import org.apache.axis2.jaxws.framework.ClientConfigurationContextBinder;
 import org.apache.axis2.testutils.Axis2Server;
 import org.junit.ClassRule;
 import org.junit.Test;
@@ -55,6 +56,9 @@ public class SoapMessageMUProviderTests
     @ClassRule
     public static final Axis2Server server = new Axis2Server("target/repo");
 
+    @ClassRule
+    public static final ClientConfigurationContextBinder binder = new ClientConfigurationContextBinder("target/client-repo");
+
     public static final QName serviceName =
             new QName("http://ws.apache.org/axis2", "SoapMessageMUProviderService");
     public static final QName portName =

Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java?rev=1819320&r1=1819319&r2=1819320&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageDataSourceTests.java Wed Dec 27 08:40:48 2017
@@ -19,6 +19,7 @@
 
 package org.apache.axis2.jaxws.xmlhttp;
 
+import org.apache.axis2.jaxws.framework.ClientConfigurationContextBinder;
 import org.apache.axis2.jaxws.provider.DataSourceImpl;
 import org.apache.axis2.testutils.Axis2Server;
 import org.junit.Before;
@@ -55,6 +56,9 @@ import java.util.HashMap;
 public class DispatchXMessageDataSourceTests {
     @ClassRule
     public static Axis2Server server = new Axis2Server("target/repo");
+
+    @ClassRule
+    public static final ClientConfigurationContextBinder binder = new ClientConfigurationContextBinder("target/client-repo");
     
     private QName SERVICE_NAME  = new QName("http://ws.apache.org/axis2", "XMessageDataSourceProvider");
     private QName PORT_NAME  = new QName("http://ws.apache.org/axis2", "XMessageDataSourceProviderPort");