abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1444390 - in /abdera/java/trunk: extensions/opensearch/pom.xml extensions/opensearch/src/test/java/org/apache/abdera/test/ext/opensearch/server/processors/OpenSearchUrlRequestProcessorTest.java pom.xml
Date Sat, 09 Feb 2013 16:15:47 GMT
Author: veithen
Date: Sat Feb  9 16:15:46 2013
New Revision: 1444390

URL: http://svn.apache.org/r1444390
Log:
Avoid using fixed TCP port numbers in unit tests.

Modified:
    abdera/java/trunk/extensions/opensearch/pom.xml
    abdera/java/trunk/extensions/opensearch/src/test/java/org/apache/abdera/test/ext/opensearch/server/processors/OpenSearchUrlRequestProcessorTest.java
    abdera/java/trunk/pom.xml

Modified: abdera/java/trunk/extensions/opensearch/pom.xml
URL: http://svn.apache.org/viewvc/abdera/java/trunk/extensions/opensearch/pom.xml?rev=1444390&r1=1444389&r2=1444390&view=diff
==============================================================================
--- abdera/java/trunk/extensions/opensearch/pom.xml (original)
+++ abdera/java/trunk/extensions/opensearch/pom.xml Sat Feb  9 16:15:46 2013
@@ -73,6 +73,11 @@
             <artifactId>abdera-extensions-json</artifactId>
             <version>1.2-SNAPSHOT</version>  
             <scope>test</scope>
-        </dependency> 
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.commons.axiom</groupId>
+            <artifactId>axiom-testutils</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

Modified: abdera/java/trunk/extensions/opensearch/src/test/java/org/apache/abdera/test/ext/opensearch/server/processors/OpenSearchUrlRequestProcessorTest.java
URL: http://svn.apache.org/viewvc/abdera/java/trunk/extensions/opensearch/src/test/java/org/apache/abdera/test/ext/opensearch/server/processors/OpenSearchUrlRequestProcessorTest.java?rev=1444390&r1=1444389&r2=1444390&view=diff
==============================================================================
--- abdera/java/trunk/extensions/opensearch/src/test/java/org/apache/abdera/test/ext/opensearch/server/processors/OpenSearchUrlRequestProcessorTest.java
(original)
+++ abdera/java/trunk/extensions/opensearch/src/test/java/org/apache/abdera/test/ext/opensearch/server/processors/OpenSearchUrlRequestProcessorTest.java
Sat Feb  9 16:15:46 2013
@@ -40,18 +40,23 @@ import org.apache.abdera.protocol.server
 import org.apache.abdera.protocol.server.impl.RouteManager;
 import org.apache.abdera.test.ext.opensearch.server.AbstractOpenSearchServerTest;
 import org.apache.abdera.test.ext.opensearch.server.JettyServer;
+import org.apache.axiom.testutils.PortAllocator;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 public class OpenSearchUrlRequestProcessorTest extends AbstractOpenSearchServerTest {
 
-    private JettyServer server = new JettyServer();
+    private int port;
+    private JettyServer server;
     private OpenSearchInfo osInfo;
     private OpenSearchUrlRequestProcessor osUrlProcessor;
 
     @Before
     public void setUp() throws Exception {
+        port = PortAllocator.allocatePort();
+        server = new JettyServer(port);
+        
         this.osInfo = this.createOpenSearchInfo();
         ((SimpleOpenSearchUrlInfo)osInfo.getUrls()[0]).setOpenSearchUrlAdapter(new TestingOpenSearchUrlAdapter1());
         ((SimpleOpenSearchUrlInfo)osInfo.getUrls()[1]).setOpenSearchUrlAdapter(new TestingOpenSearchUrlAdapter2());
@@ -94,10 +99,10 @@ public class OpenSearchUrlRequestProcess
         AbderaClient client = new AbderaClient();
         ClientResponse response = null;
         // Test with first adapter:
-        response = client.get("http://localhost:9002/search1?q=test1&c=1");
+        response = client.get("http://localhost:" + port + "/search1?q=test1&c=1");
         assertEquals(200, response.getStatus());
         // Test with second adapter:
-        client.get("http://localhost:9002/search2?q=test2&c=1");
+        client.get("http://localhost:" + port + "/search2?q=test2&c=1");
         assertEquals(200, response.getStatus());
     }
 
@@ -106,7 +111,7 @@ public class OpenSearchUrlRequestProcess
         AbderaClient client = new AbderaClient();
         ClientResponse response = null;
         // No adapter found for this Open Search url:
-        response = client.get("http://localhost:9002/search3?q=test1&c=1");
+        response = client.get("http://localhost:" + port + "/search3?q=test1&c=1");
         assertEquals(404, response.getStatus());
     }
 

Modified: abdera/java/trunk/pom.xml
URL: http://svn.apache.org/viewvc/abdera/java/trunk/pom.xml?rev=1444390&r1=1444389&r2=1444390&view=diff
==============================================================================
--- abdera/java/trunk/pom.xml (original)
+++ abdera/java/trunk/pom.xml Sat Feb  9 16:15:46 2013
@@ -401,6 +401,12 @@
       </dependency>
       
       <dependency>
+        <groupId>org.apache.ws.commons.axiom</groupId>
+        <artifactId>axiom-testutils</artifactId>
+        <version>1.2.15-SNAPSHOT</version>
+      </dependency>
+      
+      <dependency>
         <groupId>org.codehaus.woodstox</groupId>
         <artifactId>wstx-asl</artifactId>
         <version>3.2.6</version>  



Mime
View raw message