CAMEL-8941 fix tests to work on windows, enabled by default now
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5d2fec53 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5d2fec53 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5d2fec53 Branch: refs/heads/master Commit: 5d2fec5396471734e8c1d2ef798652279961fde3 Parents: e095652 Author: Anton Koscejev <anton.kosce...@zoomint.com> Authored: Fri Jul 10 17:13:44 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sun Jul 12 09:31:18 2015 +0200 ---------------------------------------------------------------------- components/camel-restlet/pom.xml | 16 ---------------- .../RestletRequestAndResponseAPITest.java | 8 ++++---- .../restlet/RestletRouteBuilderAuthTest.java | 4 ++-- .../restlet/RestletRouteBuilderTest.java | 19 ++++++++----------- .../component/restlet/RestletSetBodyTest.java | 16 ++++++++-------- 5 files changed, 22 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5d2fec53/components/camel-restlet/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-restlet/pom.xml b/components/camel-restlet/pom.xml index 593ee87..43d6def 100644 --- a/components/camel-restlet/pom.xml +++ b/components/camel-restlet/pom.xml @@ -122,20 +122,4 @@ </plugin> </plugins> </build> - - <!-- skip tests on windows --> - <profiles> - <profile> - <id>windows</id> - <activation> - <os> - <family>Windows</family> - </os> - </activation> - <properties> - <skipTests>true</skipTests> - </properties> - </profile> - </profiles> - </project> http://git-wip-us.apache.org/repos/asf/camel/blob/5d2fec53/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRequestAndResponseAPITest.java ---------------------------------------------------------------------- diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRequestAndResponseAPITest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRequestAndResponseAPITest.java index 4bd220d..779f49d 100644 --- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRequestAndResponseAPITest.java +++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRequestAndResponseAPITest.java @@ -42,7 +42,7 @@ public class RestletRequestAndResponseAPITest extends RestletTestSupport { headers.put("id", 123); headers.put("beverage.beer", "Carlsberg"); - Object out = template.requestBodyAndHeaders("direct:start", null, headers); + String out = template.requestBodyAndHeaders("direct:start", null, headers, String.class); assertEquals("<response>Beer is Good</response>", out); } @@ -61,9 +61,9 @@ public class RestletRequestAndResponseAPITest extends RestletTestSupport { assertNotNull(out); assertEquals("text/xml", out.getOut().getHeader(Exchange.CONTENT_TYPE)); assertEquals(200, out.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE)); - assertEquals("<response>Beer is Good</response>", out.getOut().getBody()); + assertEquals("<response>Beer is Good</response>", out.getOut().getBody(String.class)); - // the restlet response should be accessible if neeeded + // the restlet response should be accessible if needed Response response = out.getOut().getHeader(RestletConstants.RESTLET_RESPONSE, Response.class); assertNotNull(response); assertEquals(200, response.getStatus().getCode()); @@ -80,7 +80,7 @@ public class RestletRequestAndResponseAPITest extends RestletTestSupport { from("restlet:http://localhost:" + portNum + "/users/{id}/like/{beer}") .process(new Processor() { public void process(Exchange exchange) throws Exception { - // the Restlet request should be available if neeeded + // the Restlet request should be available if needed Request request = exchange.getIn().getHeader(RestletConstants.RESTLET_REQUEST, Request.class); assertNotNull("Restlet Request", request); http://git-wip-us.apache.org/repos/asf/camel/blob/5d2fec53/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java ---------------------------------------------------------------------- diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java index 1b63fa0..ad85fe3 100644 --- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java +++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderAuthTest.java @@ -38,8 +38,8 @@ public class RestletRouteBuilderAuthTest extends CamelSpringTestSupport { headers.put(RestletConstants.RESTLET_PASSWORD, "foo"); headers.put("id", id); - String response = (String)template.requestBodyAndHeaders( - "direct:start-auth", "<order foo='1'/>", headers); + String response = template.requestBodyAndHeaders( + "direct:start-auth", "<order foo='1'/>", headers, String.class); // END SNIPPET: auth_request assertEquals("received [<order foo='1'/>] as an order id = " + id, response); http://git-wip-us.apache.org/repos/asf/camel/blob/5d2fec53/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderTest.java index afb9ef5..aedba9f 100644 --- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderTest.java +++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletRouteBuilderTest.java @@ -19,7 +19,6 @@ package org.apache.camel.component.restlet; import java.io.IOException; import org.apache.camel.Exchange; -import org.apache.camel.ExchangePattern; import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; import org.junit.Test; @@ -82,36 +81,34 @@ public class RestletRouteBuilderTest extends RestletTestSupport { @Test public void testProducer() throws IOException { - String response = (String)template.requestBody("direct:start", "<order foo='1'/>"); + String response = template.requestBody("direct:start", "<order foo='1'/>", String.class); assertEquals("received [<order foo='1'/>] as an order id = " + ID, response); - response = (String)template.sendBodyAndHeader( + response = template.requestBodyAndHeader( "restlet:http://localhost:" + portNum + "/orders?restletMethod=post&foo=bar", - ExchangePattern.InOut, - "<order foo='1'/>", "id", "89531"); + "<order foo='1'/>", "id", "89531", String.class); assertEquals("received [<order foo='1'/>] as an order id = " + ID, response); } @Test public void testProducerJSON() throws IOException { - String response = (String)template.sendBodyAndHeader( + String response = template.requestBodyAndHeader( "restlet:http://localhost:" + portNum + "/ordersJSON?restletMethod=post&foo=bar", - ExchangePattern.InOut, JSON, Exchange.CONTENT_TYPE, - MediaType.APPLICATION_JSON); + MediaType.APPLICATION_JSON, + String.class); assertEquals(JSON, response); } @Test public void testProducerJSONFailure() throws IOException { - String response = (String)template.sendBodyAndHeader( + String response = template.requestBodyAndHeader( "restlet:http://localhost:" + portNum + "/ordersJSON?restletMethod=post&foo=bar", - ExchangePattern.InOut, "{'JSON'}", Exchange.CONTENT_TYPE, - MediaType.APPLICATION_JSON); + MediaType.APPLICATION_JSON, String.class); assertEquals("{'JSON'}", response); } http://git-wip-us.apache.org/repos/asf/camel/blob/5d2fec53/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java ---------------------------------------------------------------------- diff --git a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java index f50b4cd..d5ae80c 100644 --- a/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java +++ b/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletSetBodyTest.java @@ -40,14 +40,14 @@ public class RestletSetBodyTest extends RestletTestSupport { @Test public void testSetBody() throws Exception { - String response = template.requestBody("restlet:http://0.0.0.0:" + portNum + "/stock/ORCL?restletMethod=get", null, String.class); + String response = template.requestBody("restlet:http://localhost:" + portNum + "/stock/ORCL?restletMethod=get", null, String.class); assertEquals("110", response); } @Test public void testSetBodyRepresentation() throws Exception { - HttpGet get = new HttpGet("http://0.0.0.0:" + portNum + "/images/123"); + HttpGet get = new HttpGet("http://localhost:" + portNum + "/images/123"); CloseableHttpClient httpclient = HttpClientBuilder.create().build(); InputStream is = null; try { @@ -71,7 +71,7 @@ public class RestletSetBodyTest extends RestletTestSupport { @Test public void testGzipEntity() { - String response = template.requestBody("restlet:http://0.0.0.0:" + portNum + "/gzip/data?restletMethod=get", null, String.class); + String response = template.requestBody("restlet:http://localhost:" + portNum + "/gzip/data?restletMethod=get", null, String.class); assertEquals("Hello World!", response); } @@ -81,12 +81,12 @@ public class RestletSetBodyTest extends RestletTestSupport { return new RouteBuilder() { @Override public void configure() throws Exception { - from("restlet:http://0.0.0.0:" + portNum + "/stock/{symbol}?restletMethods=get") - .to("http://127.0.0.1:" + portNum2 + "/test?bridgeEndpoint=true") + from("restlet:http://localhost:" + portNum + "/stock/{symbol}?restletMethods=get") + .to("http://localhost:" + portNum2 + "/test?bridgeEndpoint=true") //.removeHeader("Transfer-Encoding") .setBody().constant("110"); - from("jetty:http://0.0.0.0:" + portNum2 + "/test").setBody().constant("response is back"); + from("jetty:http://localhost:" + portNum2 + "/test").setBody().constant("response is back"); // create ByteArrayRepresentation for response byte[] image = new byte[10]; @@ -95,10 +95,10 @@ public class RestletSetBodyTest extends RestletTestSupport { } ByteArrayInputStream inputStream = new ByteArrayInputStream(image); - from("restlet:http://0.0.0.0:" + portNum + "/images/{symbol}?restletMethods=get") + from("restlet:http://localhost:" + portNum + "/images/{symbol}?restletMethods=get") .setBody().constant(new InputRepresentation(inputStream, MediaType.IMAGE_PNG, 10)); - from("restlet:http://0.0.0.0:" + portNum + "/gzip/data?restletMethods=get") + from("restlet:http://localhost:" + portNum + "/gzip/data?restletMethods=get") .setBody().constant(new EncodeRepresentation(Encoding.GZIP, new StringRepresentation("Hello World!", MediaType.TEXT_XML))); } };