Repository: camel
Updated Branches:
  refs/heads/master 33d0b0df3 -> ae7eafc67


Fixed spark-rest tests


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ae7eafc6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ae7eafc6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ae7eafc6

Branch: refs/heads/master
Commit: ae7eafc67a52da13ff79b61923d4ba6846acb658
Parents: 33d0b0d
Author: Claus Ibsen <davscl...@apache.org>
Authored: Fri Sep 5 10:29:37 2014 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Fri Sep 5 10:29:37 2014 +0200

----------------------------------------------------------------------
 .../camel/component/sparkrest/BaseSparkTest.java      |  5 +----
 .../component/sparkrest/CamelSparkAcceptTest.java     |  4 ++--
 .../component/sparkrest/CamelSparkParamTest.java      |  2 +-
 .../sparkrest/CamelSparkRequestBeanTest.java          |  2 +-
 .../component/sparkrest/CamelSparkSplatTest.java      |  2 +-
 .../camel/component/sparkrest/CamelSparkTest.java     |  2 +-
 .../sparkrest/RestCamelSparkMapHeadersFalseTest.java  |  2 +-
 .../sparkrest/RestCamelSparkPojoInOutTest.java        |  4 ++--
 .../camel/component/sparkrest/RestCamelSparkTest.java |  6 +++---
 .../sparkrest/RestConfigurationCamelSparkTest.java    | 14 ++++----------
 10 files changed, 17 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java
index b7a6c08..77d862e 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/BaseSparkTest.java
@@ -21,7 +21,6 @@ import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.junit4.CamelTestSupport;
 
 public abstract class BaseSparkTest extends CamelTestSupport {
-    //static int count;
 
     protected int port;
 
@@ -31,8 +30,7 @@ public abstract class BaseSparkTest extends CamelTestSupport {
 
     @Override
     public void setUp() throws Exception {
-        //count++;
-        port = AvailablePortFinder.getNextAvailable(4500);
+        port = AvailablePortFinder.getNextAvailable(25500);
         super.setUp();
     }
 
@@ -42,7 +40,6 @@ public abstract class BaseSparkTest extends CamelTestSupport {
 
         SparkComponent spark = context.getComponent("spark-rest", 
SparkComponent.class);
         spark.setPort(port);
-        spark.setIpAddress("127.0.0.1");
 
         return context;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java
index 27cd72a..c5b3727 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkAcceptTest.java
@@ -28,14 +28,14 @@ public class CamelSparkAcceptTest extends BaseSparkTest {
         getMockEndpoint("mock:foo").expectedMessageCount(1);
 
         try {
-            template.requestBodyAndHeader("http://127.0.0.1:"; + getPort() + 
"/hello", null, "Accept", "text/plain", String.class);
+            template.requestBodyAndHeader("http://localhost:"; + getPort() + 
"/hello", null, "Accept", "text/plain", String.class);
             fail("Should fail");
         } catch (CamelExecutionException e) {
             HttpOperationFailedException cause = 
assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
             assertEquals(404, cause.getStatusCode());
         }
 
-        String out2 = template.requestBodyAndHeader("http://127.0.0.1:"; + 
getPort() + "/hello", null, "Accept", "application/json", String.class);
+        String out2 = template.requestBodyAndHeader("http://localhost:"; + 
getPort() + "/hello", null, "Accept", "application/json", String.class);
         assertEquals("{ \"reply\": \"Bye World\" }", out2);
 
         assertMockEndpointsSatisfied();

http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java
index 09c5f43..6431000 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkParamTest.java
@@ -26,7 +26,7 @@ public class CamelSparkParamTest extends BaseSparkTest {
         getMockEndpoint("mock:foo").expectedMessageCount(1);
         getMockEndpoint("mock:foo").expectedHeaderReceived("name", "world");
 
-        String out = template.requestBody("http://0.0.0.0:"; + getPort() + 
"/hello/world", null, String.class);
+        String out = template.requestBody("http://localhost:"; + getPort() + 
"/hello/world", null, String.class);
         assertEquals("Bye world", out);
 
         assertMockEndpointsSatisfied();

http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRequestBeanTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRequestBeanTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRequestBeanTest.java
index c0845f1..78d0ae0 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRequestBeanTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkRequestBeanTest.java
@@ -26,7 +26,7 @@ public class CamelSparkRequestBeanTest extends BaseSparkTest {
     public void testSparkGet() throws Exception {
         getMockEndpoint("mock:foo").expectedMessageCount(1);
 
-        String out = template.requestBody("http://0.0.0.0:"; + getPort() + 
"/hello/camel/to/world", null, String.class);
+        String out = template.requestBody("http://localhost:"; + getPort() + 
"/hello/camel/to/world", null, String.class);
         assertEquals("Bye big world from camel", out);
 
         assertMockEndpointsSatisfied();

http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkSplatTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkSplatTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkSplatTest.java
index 6dd6039..7e500c3 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkSplatTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkSplatTest.java
@@ -25,7 +25,7 @@ public class CamelSparkSplatTest extends BaseSparkTest {
     public void testSparkGet() throws Exception {
         getMockEndpoint("mock:foo").expectedMessageCount(1);
 
-        String out = template.requestBody("http://0.0.0.0:"; + getPort() + 
"/hello/camel/to/world", null, String.class);
+        String out = template.requestBody("http://localhost:"; + getPort() + 
"/hello/camel/to/world", null, String.class);
         assertEquals("Bye big world from camel", out);
 
         assertMockEndpointsSatisfied();

http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkTest.java
index 41c39b7..9f75013 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/CamelSparkTest.java
@@ -25,7 +25,7 @@ public class CamelSparkTest extends BaseSparkTest {
     public void testSparkGet() throws Exception {
         getMockEndpoint("mock:foo").expectedMessageCount(1);
 
-        String out = template.requestBody("http://0.0.0.0:"; + getPort() + 
"/hello", null, String.class);
+        String out = template.requestBody("http://localhost:"; + getPort() + 
"/hello", null, String.class);
         assertEquals("Bye World", out);
 
         assertMockEndpointsSatisfied();

http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkMapHeadersFalseTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkMapHeadersFalseTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkMapHeadersFalseTest.java
index 755b525..6f23189 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkMapHeadersFalseTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkMapHeadersFalseTest.java
@@ -27,7 +27,7 @@ public class RestCamelSparkMapHeadersFalseTest extends 
BaseSparkTest {
         getMockEndpoint("mock:foo").expectedMessageCount(1);
         
getMockEndpoint("mock:foo").message(0).header(Exchange.HTTP_PATH).isNull();
 
-        String out2 = template.requestBodyAndHeader("http://0.0.0.0:"; + 
getPort() + "/hello", null, "Accept", "application/json", String.class);
+        String out2 = template.requestBodyAndHeader("http://localhost:"; + 
getPort() + "/hello", null, "Accept", "application/json", String.class);
         assertEquals("{ \"reply\": \"Bye World\" }", out2);
 
         assertMockEndpointsSatisfied();

http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkPojoInOutTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkPojoInOutTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkPojoInOutTest.java
index faa3dfa..4a97600 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkPojoInOutTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkPojoInOutTest.java
@@ -25,7 +25,7 @@ public class RestCamelSparkPojoInOutTest extends 
BaseSparkTest {
     @Test
     public void testRestletPojoInOut() throws Exception {
         String body = "{\"id\": 123, \"name\": \"Donald Duck\"}";
-        String out = template.requestBody("http://127.0.0.1:"; + getPort() + 
"/users/lives", body, String.class);
+        String out = template.requestBody("http://localhost:"; + getPort() + 
"/users/lives", body, String.class);
 
         assertNotNull(out);
         assertEquals("{\"iso\":\"EN\",\"country\":\"England\"}", out);
@@ -38,7 +38,7 @@ public class RestCamelSparkPojoInOutTest extends 
BaseSparkTest {
             public void configure() throws Exception {
                 // configure to use spark on localhost with the given port
                 // and enable auto binding mode
-                
restConfiguration().component("spark-rest").host("127.0.0.1").port(getPort()).bindingMode(RestBindingMode.auto);
+                
restConfiguration().component("spark-rest").host("localhost").port(getPort()).bindingMode(RestBindingMode.auto);
 
                 // use the rest DSL to define the rest services
                 rest("/users/")

http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkTest.java
index 83137b0..2525872 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestCamelSparkTest.java
@@ -23,13 +23,13 @@ public class RestCamelSparkTest extends BaseSparkTest {
 
     @Test
     public void testSparkHello() throws Exception {
-        String out = template.requestBody("http://0.0.0.0:"; + getPort() + 
"/spark/hello", null, String.class);
+        String out = template.requestBody("http://localhost:"; + getPort() + 
"/spark/hello", null, String.class);
         assertEquals("Hello World", out);
     }
 
     @Test
     public void testSparkBye() throws Exception {
-        String out = template.requestBody("http://0.0.0.0:"; + getPort() + 
"/spark/bye", null, String.class);
+        String out = template.requestBody("http://localhost:"; + getPort() + 
"/spark/bye", null, String.class);
         assertEquals("Bye World", out);
     }
 
@@ -37,7 +37,7 @@ public class RestCamelSparkTest extends BaseSparkTest {
     public void testSparkPost() throws Exception {
         getMockEndpoint("mock:update").expectedBodiesReceived("I did this");
 
-        template.requestBody("http://0.0.0.0:"; + getPort() + "/spark/bye", "I 
did this", String.class);
+        template.requestBody("http://localhost:"; + getPort() + "/spark/bye", 
"I did this", String.class);
 
         assertMockEndpointsSatisfied();
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ae7eafc6/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestConfigurationCamelSparkTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestConfigurationCamelSparkTest.java
 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestConfigurationCamelSparkTest.java
index adcf2a5..1fa421e 100644
--- 
a/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestConfigurationCamelSparkTest.java
+++ 
b/components/camel-spark-rest/src/test/java/org/apache/camel/component/sparkrest/RestConfigurationCamelSparkTest.java
@@ -17,23 +17,19 @@
 package org.apache.camel.component.sparkrest;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class RestConfigurationCamelSparkTest extends CamelTestSupport {
-
-    private int port;
+public class RestConfigurationCamelSparkTest extends BaseSparkTest {
 
     @Test
     public void testSparkHello() throws Exception {
-        String out = template.requestBody("http://127.0.0.1:"; + port + 
"/spark/hello", null, String.class);
+        String out = template.requestBody("http://localhost:"; + port + 
"/spark/hello", null, String.class);
         assertEquals("Hello World", out);
     }
 
     @Test
     public void testSparkBye() throws Exception {
-        String out = template.requestBody("http://127.0.0.1:"; + port + 
"/spark/bye", null, String.class);
+        String out = template.requestBody("http://localhost:"; + port + 
"/spark/bye", null, String.class);
         assertEquals("Bye World", out);
     }
 
@@ -41,7 +37,7 @@ public class RestConfigurationCamelSparkTest extends 
CamelTestSupport {
     public void testSparkPost() throws Exception {
         getMockEndpoint("mock:update").expectedBodiesReceived("I did this");
 
-        template.requestBody("http://127.0.0.1:"; + port + "/spark/bye", "I did 
this", String.class);
+        template.requestBody("http://localhost:"; + port + "/spark/bye", "I did 
this", String.class);
 
         assertMockEndpointsSatisfied();
     }
@@ -51,8 +47,6 @@ public class RestConfigurationCamelSparkTest extends 
CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                port = AvailablePortFinder.getNextAvailable(4510);
-
                 // configure port on rest configuration which spark-rest will 
pickup and use
                 restConfiguration().component("spark-rest").port(port);
 

Reply via email to