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 2012/11/18 10:10:02 UTC

svn commit: r1410856 - in /axis/axis1/java/trunk: pom.xml samples/mtomstub-sample/pom.xml samples/mtomstub-sample/src/test/java/samples/mtomstub/TestDownloadFile.java

Author: veithen
Date: Sun Nov 18 09:10:01 2012
New Revision: 1410856

URL: http://svn.apache.org/viewvc?rev=1410856&view=rev
Log:
Avoid using hardcoded port numbers in unit tests (to ensure that the build can be run concurrently with other builds).

Modified:
    axis/axis1/java/trunk/pom.xml
    axis/axis1/java/trunk/samples/mtomstub-sample/pom.xml
    axis/axis1/java/trunk/samples/mtomstub-sample/src/test/java/samples/mtomstub/TestDownloadFile.java

Modified: axis/axis1/java/trunk/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/pom.xml?rev=1410856&r1=1410855&r2=1410856&view=diff
==============================================================================
--- axis/axis1/java/trunk/pom.xml (original)
+++ axis/axis1/java/trunk/pom.xml Sun Nov 18 09:10:01 2012
@@ -120,6 +120,11 @@
                 <artifactId>commons-io</artifactId>
                 <version>1.4</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.ws.commons.axiom</groupId>
+                <artifactId>axiom-testutils</artifactId>
+                <version>1.2.13</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <prerequisites>

Modified: axis/axis1/java/trunk/samples/mtomstub-sample/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/samples/mtomstub-sample/pom.xml?rev=1410856&r1=1410855&r2=1410856&view=diff
==============================================================================
--- axis/axis1/java/trunk/samples/mtomstub-sample/pom.xml (original)
+++ axis/axis1/java/trunk/samples/mtomstub-sample/pom.xml Sun Nov 18 09:10:01 2012
@@ -54,6 +54,11 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.ws.commons.axiom</groupId>
+            <artifactId>axiom-testutils</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <dependencyManagement>
         <dependencies>

Modified: axis/axis1/java/trunk/samples/mtomstub-sample/src/test/java/samples/mtomstub/TestDownloadFile.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/samples/mtomstub-sample/src/test/java/samples/mtomstub/TestDownloadFile.java?rev=1410856&r1=1410855&r2=1410856&view=diff
==============================================================================
--- axis/axis1/java/trunk/samples/mtomstub-sample/src/test/java/samples/mtomstub/TestDownloadFile.java (original)
+++ axis/axis1/java/trunk/samples/mtomstub-sample/src/test/java/samples/mtomstub/TestDownloadFile.java Sun Nov 18 09:10:01 2012
@@ -4,6 +4,8 @@ import java.net.URL;
 
 import javax.xml.ws.Endpoint;
 
+import org.apache.axiom.testutils.PortAllocator;
+
 import junit.framework.TestCase;
 import samples.mtomstub.service.DownloadFileImpl;
 import samples.mtomstub.stub.DownloadFile;
@@ -11,8 +13,7 @@ import samples.mtomstub.stub.DownloadFil
 
 public class TestDownloadFile extends TestCase {
     public void test() throws Exception {
-        // TODO: allocate random port here
-        String url = "http://localhost:8080/DownloadFile";
+        String url = "http://localhost:" + PortAllocator.allocatePort() + "/DownloadFile";
         Endpoint endpoint = Endpoint.publish(url, new DownloadFileImpl());
         DownloadFile downloadFile = new DownloadFileServiceLocator().getDownloadFilePort(new URL(url));
         downloadFile.getFile().getFile().writeTo(System.out);