camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r1293726 - in /camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx: JmsToHttpWithOnExceptionRoute.java JmsToHttpWithRollbackRoute.java
Date Sat, 25 Feb 2012 23:44:06 GMT
Author: cmueller
Date: Sat Feb 25 23:44:05 2012
New Revision: 1293726

URL: http://svn.apache.org/viewvc?rev=1293726&view=rev
Log:
use AvailablePortFinder to prevent the unit tests to fail with address already in use

Modified:
    camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithOnExceptionRoute.java
    camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithRollbackRoute.java

Modified: camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithOnExceptionRoute.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithOnExceptionRoute.java?rev=1293726&r1=1293725&r2=1293726&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithOnExceptionRoute.java
(original)
+++ camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithOnExceptionRoute.java
Sat Feb 25 23:44:05 2012
@@ -20,6 +20,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
 import org.apache.camel.component.http.HttpOperationFailedException;
+import org.apache.camel.test.AvailablePortFinder;
 
 /**
  * Route that listen on a JMS queue and send a request/reply over http
@@ -35,6 +36,8 @@ public class JmsToHttpWithOnExceptionRou
     private String noAccess = "<?xml version=\"1.0\"?><reply><status>Access
denied</status></reply>";
 
     public void configure() throws Exception {
+        int port = AvailablePortFinder.getNextAvailable();
+
         // configure a global transacted error handler
         errorHandler(transactionErrorHandler(required));
 
@@ -50,7 +53,7 @@ public class JmsToHttpWithOnExceptionRou
             // must setup policy to indicate transacted route
             .policy(required)
             // send a request to http and get the response
-            .to("http://localhost:8080/sender")
+            .to("http://localhost:" + port + "/sender")
             // convert the response to String so we can work with it and avoid streams only
be readable once
             // as the http component will return data as a stream
             .convertBodyTo(String.class)
@@ -68,7 +71,7 @@ public class JmsToHttpWithOnExceptionRou
             .end();
 
         // this is our http router
-        from("jetty:http://localhost:8080/sender").process(new Processor() {
+        from("jetty:http://localhost:" + port + "/sender").process(new Processor() {
             public void process(Exchange exchange) throws Exception {
                 // first hit is always a error code 500 to force the caller to retry
                 if (counter++ < 1) {

Modified: camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithRollbackRoute.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithRollbackRoute.java?rev=1293726&r1=1293725&r2=1293726&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithRollbackRoute.java
(original)
+++ camel/branches/camel-2.8.x/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/JmsToHttpWithRollbackRoute.java
Sat Feb 25 23:44:05 2012
@@ -18,6 +18,7 @@ package org.apache.camel.itest.tx;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.test.AvailablePortFinder;
 
 /**
  * Route that listen on a JMS queue and send a request/reply over http
@@ -31,6 +32,8 @@ import org.apache.camel.Processor;
 public class JmsToHttpWithRollbackRoute extends JmsToHttpRoute {
 
     public void configure() throws Exception {
+        int port = AvailablePortFinder.getNextAvailable();
+
         // configure a global transacted error handler
         errorHandler(transactionErrorHandler(required));
 
@@ -38,7 +41,7 @@ public class JmsToHttpWithRollbackRoute 
             // must setup policy for each route due CAMEL-1475 bug
             .policy(required)
             // send a request to http and get the response
-            .to("http://localhost:8080/sender")
+            .to("http://localhost:" + port + "/sender")
             // convert the response to String so we can work with it and avoid streams only
be readable once
             // as the http component will return data as a stream
             .convertBodyTo(String.class)
@@ -57,7 +60,7 @@ public class JmsToHttpWithRollbackRoute 
 
         // this is our http route that will fail the first 2 attempts
         // before it sends an ok response
-        from("jetty:http://localhost:8080/sender").process(new Processor() {
+        from("jetty:http://localhost:" + port + "/sender").process(new Processor() {
             public void process(Exchange exchange) throws Exception {
                 if (counter++ < 2) {
                     exchange.getOut().setBody(nok);



Mime
View raw message