Author: veithen
Date: Mon Dec 25 20:48:44 2017
New Revision: 1819263
URL: http://svn.apache.org/viewvc?rev=1819263&view=rev
Log:
Avoid fixed TCP port numbers in integration tests.
Added:
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Transport.java
(with props)
Modified:
axis/axis2/java/core/trunk/modules/integration/pom.xml
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ThirdPartyResponseRawXMLTest.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/mtom/EchoRawMTOMTest.java
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/swa/EchoRawSwAFileInputTest.java
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.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=1819263&r1=1819262&r2=1819263&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/integration/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/integration/pom.xml Mon Dec 25 20:48:44
2017
@@ -464,6 +464,19 @@
<configuration>
<configurationDirectory>conf</configurationDirectory>
<includeServices>false</includeServices>
+ <generatedAxis2xml>
+ <transportReceivers>
+ <transportReceiver>
+ <name>http</name>
+ <parameters>
+ <parameter>
+ <name>port</name>
+ <value>0</value>
+ </parameter>
+ </parameters>
+ </transportReceiver>
+ </transportReceivers>
+ </generatedAxis2xml>
</configuration>
</plugin>
<plugin>
Modified:
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java?rev=1819263&r1=1819262&r2=1819263&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/EchoRawRuntimeProxyTest.java
Mon Dec 25 20:48:44 2017
@@ -40,7 +40,7 @@ import javax.xml.namespace.QName;
public class EchoRawRuntimeProxyTest extends UtilServerBasedTestCase {
public static final EndpointReference targetEPR = new EndpointReference(
- "http://localhost:5555"
+ "http://localhost:" + UtilServer.TESTING_PORT
+ "/axis2/services/EchoXMLService/echoOMElement");
public static final QName serviceName = new QName("EchoXMLService");
@@ -84,7 +84,7 @@ public class EchoRawRuntimeProxyTest ext
HttpTransportProperties.ProxyProperties proxyproperties =
new HttpTransportProperties.ProxyProperties();
proxyproperties.setProxyName("localhost");
- proxyproperties.setProxyPort(5555);
+ proxyproperties.setProxyPort(UtilServer.TESTING_PORT);
proxyproperties.setDomain("anonymous");
proxyproperties.setPassWord("anonymous");
proxyproperties.setUserName("anonymous");
Modified:
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ThirdPartyResponseRawXMLTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ThirdPartyResponseRawXMLTest.java?rev=1819263&r1=1819262&r2=1819263&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ThirdPartyResponseRawXMLTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/engine/ThirdPartyResponseRawXMLTest.java
Mon Dec 25 20:48:44 2017
@@ -37,6 +37,7 @@ import org.apache.axis2.engine.util.Test
import org.apache.axis2.integration.TestingUtils;
import org.apache.axis2.integration.UtilServer;
import org.apache.axis2.integration.UtilServerBasedTestCase;
+import org.apache.axis2.testutils.PortAllocator;
import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.axis2.util.Utils;
@@ -58,7 +59,7 @@ public class ThirdPartyResponseRawXMLTes
private SimpleHTTPServer receiver;
private String callbackOperation;
private String callbackServiceName = "CallbackService";
- private int callbackserverPort = 17458;
+ private int callbackserverPort = PortAllocator.allocatePort();
protected void setUp() throws Exception {
service = Utils.createSimpleService(serviceName,
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=1819263&r1=1819262&r2=1819263&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
Mon Dec 25 20:48:44 2017
@@ -31,6 +31,7 @@ import org.apache.axis2.description.Axis
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.testutils.PortAllocator;
import org.apache.axis2.transport.http.SimpleHTTPServer;
import javax.xml.namespace.QName;
@@ -42,7 +43,7 @@ public class UtilServer {
private static SimpleHTTPServer receiver;
- public static final int TESTING_PORT = 5555;
+ public static final int TESTING_PORT = PortAllocator.allocatePort();
public static final String FAILURE_MESSAGE = "Intentional Failure";
Modified:
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java?rev=1819263&r1=1819262&r2=1819263&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
Mon Dec 25 20:48:44 2017
@@ -203,7 +203,8 @@ public class EchoRawMTOMTest extends Uti
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
-
TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"),
null);
+
TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"),
+
TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo/conf/axis2.xml"));
ServiceClient sender = new ServiceClient(configContext, null);
sender.engageModule("addressing");
Modified:
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java?rev=1819263&r1=1819262&r2=1819263&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/mtom/MessageSaveAndRestoreWithMTOMTest.java
Mon Dec 25 20:48:44 2017
@@ -138,8 +138,9 @@ public class MessageSaveAndRestoreWithMT
options.setTimeOutInMilliSeconds(50000);
ConfigurationContext configurationContext = ConfigurationContextFactory
-
.createConfigurationContextFromFileSystem(TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"),
- null);
+ .createConfigurationContextFromFileSystem(
+
TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo"),
+
TestingUtils.prefixBaseDirectory("target/test-resources/integrationRepo/conf/axis2.xml"));
ServiceClient sender = new ServiceClient(configurationContext, null);
sender.setOptions(options);
Modified:
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/swa/EchoRawSwAFileInputTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/swa/EchoRawSwAFileInputTest.java?rev=1819263&r1=1819262&r2=1819263&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/swa/EchoRawSwAFileInputTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/swa/EchoRawSwAFileInputTest.java
Mon Dec 25 20:48:44 2017
@@ -79,7 +79,7 @@ public class EchoRawSwAFileInputTest ext
}
public void testEchoXMLSync() throws Exception {
- Socket socket = new Socket("127.0.0.1", 5555);
+ Socket socket = new Socket("127.0.0.1", UtilServer.TESTING_PORT);
OutputStream outStream = socket.getOutputStream();
socket.getInputStream();
InputStream requestMsgInStream = new
FileInputStream(TestingUtils.prefixBaseDirectory("test-resources/swa/swainput.bin"));
Modified:
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java?rev=1819263&r1=1819262&r2=1819263&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
(original)
+++
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
Mon Dec 25 20:48:44 2017
@@ -229,7 +229,7 @@ public abstract class AbstractCreateRepo
}
}
- private void addMessageHandlers(OMElement root, MessageHandler[] handlers,
String localName) {
+ private static void addMessageHandlers(OMElement root, MessageHandler[]
handlers, String localName) {
if (handlers == null) {
return;
}
@@ -240,6 +240,20 @@ public abstract class AbstractCreateRepo
element.addAttribute("class", handler.getClassName(), null);
}
}
+
+ private static void processTransports(OMElement root, Transport[]
transports, String localName) {
+ if (transports == null) {
+ return;
+ }
+ for (Transport transport : transports) {
+ for (Iterator<OMElement> it =
root.getChildrenWithLocalName(localName); it.hasNext(); ) {
+ OMElement transportElement = it.next();
+ if (transportElement.getAttributeValue(new
QName("name")).equals(transport.getName())) {
+ applyParameters(transportElement,
transport.getParameters());
+ }
+ }
+ }
+ }
public void execute() throws MojoExecutionException, MojoFailureException {
Log log = getLog();
@@ -431,6 +445,8 @@ public abstract class AbstractCreateRepo
}
}
applyParameters(root,
generatedAxis2xml.getParameters());
+ processTransports(root,
generatedAxis2xml.getTransportReceivers(), "transportReceiver");
+ processTransports(root,
generatedAxis2xml.getTransportSenders(), "transportSender");
addMessageHandlers(root,
generatedAxis2xml.getMessageBuilders(), "messageBuilder");
addMessageHandlers(root,
generatedAxis2xml.getMessageFormatters(), "messageFormatter");
if (generatedAxis2xml.getHandlers() != null) {
Modified:
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java?rev=1819263&r1=1819262&r2=1819263&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java
(original)
+++
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/GeneratedAxis2Xml.java
Mon Dec 25 20:48:44 2017
@@ -20,6 +20,8 @@ package org.apache.axis2.maven2.repo;
public class GeneratedAxis2Xml {
private Parameter[] parameters;
+ private Transport[] transportReceivers;
+ private Transport[] transportSenders;
private MessageHandler[] messageBuilders;
private MessageHandler[] messageFormatters;
private Handler[] handlers;
@@ -33,6 +35,22 @@ public class GeneratedAxis2Xml {
this.parameters = parameters;
}
+ public Transport[] getTransportReceivers() {
+ return transportReceivers;
+ }
+
+ public void setTransportReceivers(Transport[] transportReceivers) {
+ this.transportReceivers = transportReceivers;
+ }
+
+ public Transport[] getTransportSenders() {
+ return transportSenders;
+ }
+
+ public void setTransportSenders(Transport[] transportSenders) {
+ this.transportSenders = transportSenders;
+ }
+
public MessageHandler[] getMessageBuilders() {
return messageBuilders;
}
Added:
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Transport.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Transport.java?rev=1819263&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Transport.java
(added)
+++
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Transport.java
Mon Dec 25 20:48:44 2017
@@ -0,0 +1,40 @@
+/*
+ * 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.maven2.repo;
+
+public class Transport {
+ private String name;
+ private Parameter[] parameters;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Parameter[] getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Parameter[] parameters) {
+ this.parameters = parameters;
+ }
+}
Propchange:
axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/Transport.java
------------------------------------------------------------------------------
svn:eol-style = native