You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/10/26 08:25:59 UTC
svn commit: r1027376 [2/3] - in
/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty:
./ async/ file/ jettyproducer/
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java Tue Oct 26 06:25:56 2010
@@ -17,12 +17,11 @@
package org.apache.camel.component.jetty;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.camel.util.StopWatch;
import org.apache.camel.util.TimeUtils;
import org.junit.Test;
-public class HttpProxyRouteTest extends CamelTestSupport {
+public class HttpProxyRouteTest extends BaseJettyTest {
private int size = 500;
@@ -32,7 +31,7 @@ public class HttpProxyRouteTest extends
StopWatch watch = new StopWatch();
for (int i = 0; i < size; i++) {
- String out = template.requestBody("http://localhost:9080/hello?foo=" + i, null, String.class);
+ String out = template.requestBody("http://localhost:{{port}}/hello?foo=" + i, null, String.class);
assertEquals("Bye " + i, out);
}
@@ -42,10 +41,10 @@ public class HttpProxyRouteTest extends
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
- from("jetty://http://localhost:9080/hello")
- .to("http://localhost:9080/bye?throwExceptionOnFailure=false&bridgeEndpoint=true");
+ from("jetty://http://localhost:{{port}}/hello")
+ .to("http://localhost:{{port}}/bye?throwExceptionOnFailure=false&bridgeEndpoint=true");
- from("jetty://http://localhost:9080/bye").transform(header("foo").prepend("Bye "));
+ from("jetty://http://localhost:{{port}}/bye").transform(header("foo").prepend("Bye "));
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java Tue Oct 26 06:25:56 2010
@@ -21,18 +21,17 @@ import org.apache.camel.Processor;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.HttpOperationFailedException;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* @version $Revision$
*/
-public class HttpRedirectNoLocationTest extends CamelTestSupport {
+public class HttpRedirectNoLocationTest extends BaseJettyTest {
@Test
public void testHttpRedirectNoLocation() throws Exception {
try {
- template.requestBody("http://localhost:9080/test", "Hello World", String.class);
+ template.requestBody("http://localhost:{{port}}/test", "Hello World", String.class);
fail("Should have thrown an exception");
} catch (RuntimeCamelException e) {
HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
@@ -48,7 +47,7 @@ public class HttpRedirectNoLocationTest
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:9080/test")
+ from("jetty://http://localhost:{{port}}/test")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 302);
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectTest.java Tue Oct 26 06:25:56 2010
@@ -21,25 +21,24 @@ import org.apache.camel.Processor;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.HttpOperationFailedException;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* @version $Revision$
*/
-public class HttpRedirectTest extends CamelTestSupport {
+public class HttpRedirectTest extends BaseJettyTest {
@Test
public void testHttpRedirect() throws Exception {
try {
- template.requestBody("http://localhost:9080/test", "Hello World", String.class);
+ template.requestBody("http://localhost:{{port}}/test", "Hello World", String.class);
fail("Should have thrown an exception");
} catch (RuntimeCamelException e) {
HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
assertEquals(301, cause.getStatusCode());
assertEquals(true, cause.isRedirectError());
assertEquals(true, cause.hasRedirectLocation());
- assertEquals("http://localhost:9080/newtest", cause.getRedirectLocation());
+ assertEquals("http://localhost:" + getPort() + "/newtest", cause.getRedirectLocation());
}
}
@@ -48,11 +47,11 @@ public class HttpRedirectTest extends Ca
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:9080/test")
+ from("jetty://http://localhost:{{port}}/test")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 301);
- exchange.getOut().setHeader("location", "http://localhost:9080/newtest");
+ exchange.getOut().setHeader("location", "http://localhost:" + getPort() + "/newtest");
}
});
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRequestResponseTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRequestResponseTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRequestResponseTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRequestResponseTest.java Tue Oct 26 06:25:56 2010
@@ -23,17 +23,16 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.HttpMessage;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test for request response in message
*/
-public class HttpRequestResponseTest extends CamelTestSupport {
+public class HttpRequestResponseTest extends BaseJettyTest {
@Test
public void testHttpServletRequestResponse() throws Exception {
- Object response = template.requestBody("http://localhost:9080/myapp/myservice", "bookid=123");
+ Object response = template.requestBody("http://localhost:{{port}}/myapp/myservice", "bookid=123");
// convert the response to a String
String body = context.getTypeConverter().convertTo(String.class, response);
assertEquals("Written by servlet response<html><body>Book 123 is Camel in Action</body></html>", body);
@@ -44,7 +43,7 @@ public class HttpRequestResponseTest ext
return new RouteBuilder() {
public void configure() throws Exception {
// START SNIPPET: e1
- from("jetty:http://localhost:9080/myapp/myservice").process(new MyBookService());
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new MyBookService());
// END SNIPPET: e1
}
};
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnDataNotInputStreamConvertableTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnDataNotInputStreamConvertableTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnDataNotInputStreamConvertableTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnDataNotInputStreamConvertableTest.java Tue Oct 26 06:25:56 2010
@@ -19,17 +19,16 @@ package org.apache.camel.component.jetty
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* @version $Revision$
*/
-public class HttpReturnDataNotInputStreamConvertableTest extends CamelTestSupport {
+public class HttpReturnDataNotInputStreamConvertableTest extends BaseJettyTest {
@Test
public void testHttpReturnDataNotInputStreamConvertableTest() throws Exception {
- String out = template.requestBody("http://localhost:9080/test", "Hello World", String.class);
+ String out = template.requestBody("http://localhost:{{port}}/test", "Hello World", String.class);
assertEquals("This is the response", out);
}
@@ -38,7 +37,7 @@ public class HttpReturnDataNotInputStrea
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:9080/test")
+ from("jetty://http://localhost:{{port}}/test")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setBody(new MyResponseBean());
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnFaultTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnFaultTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnFaultTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnFaultTest.java Tue Oct 26 06:25:56 2010
@@ -25,11 +25,11 @@ import org.junit.Test;
/**
* @version $Revision$
*/
-public class HttpReturnFaultTest extends CamelTestSupport {
+public class HttpReturnFaultTest extends BaseJettyTest {
@Test
public void testHttpFault() throws Exception {
- String out = template.requestBody("http://localhost:9080/test", "Hello World", String.class);
+ String out = template.requestBody("http://localhost:{{port}}/test", "Hello World", String.class);
assertEquals("This is a fault", out);
}
@@ -38,7 +38,7 @@ public class HttpReturnFaultTest extends
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:9080/test")
+ from("jetty://http://localhost:{{port}}/test")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setFault(true);
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java Tue Oct 26 06:25:56 2010
@@ -29,11 +29,10 @@ import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultHeaderFilterStrategy;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
-public class HttpRoundtripHeaderTest extends CamelTestSupport {
- protected final String uri = "http://localhost:8088/WhichWillGetCloseException";
+public class HttpRoundtripHeaderTest extends BaseJettyTest {
+ protected final String uri = "http://localhost:" + getPort() + "/WhichWillGetCloseException";
protected final String jettyUri = "jetty:" + uri;
protected final String outputText = ":output";
protected String inputText = "input";
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java Tue Oct 26 06:25:56 2010
@@ -18,25 +18,20 @@ package org.apache.camel.component.jetty
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
-import org.apache.camel.builder.ExpressionBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.HttpMessage;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.stream.InputStreamCache;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
@@ -47,11 +42,16 @@ import org.junit.Test;
/**
* @version $Revision$
*/
-public class HttpRouteTest extends CamelTestSupport {
+public class HttpRouteTest extends BaseJettyTest {
protected static final String POST_MESSAGE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "
+ "<test>Hello World</test>";
protected String expectedBody = "<hello>world!</hello>";
+ private int port1;
+ private int port2;
+ private int port3;
+ private int port4;
+
@Test
public void testEndpoint() throws Exception {
MockEndpoint mockEndpoint = getMockEndpoint("mock:a");
@@ -77,7 +77,7 @@ public class HttpRouteTest extends Camel
@Test
public void testHelloEndpoint() throws Exception {
ByteArrayOutputStream os = new ByteArrayOutputStream();
- InputStream is = new URL("http://localhost:9281/hello").openStream();
+ InputStream is = new URL("http://localhost:" + port2 + "/hello").openStream();
int c;
while ((c = is.read()) >= 0) {
os.write(c);
@@ -89,7 +89,7 @@ public class HttpRouteTest extends Camel
@Test
public void testEchoEndpoint() throws Exception {
- String out = template.requestBody("http://localhost:9280/echo", "HelloWorld", String.class);
+ String out = template.requestBody("http://localhost:" + port1 + "/echo", "HelloWorld", String.class);
assertEquals("Get a wrong output " , "HelloWorld", out);
}
@@ -98,7 +98,7 @@ public class HttpRouteTest extends Camel
NameValuePair[] data = {new NameValuePair("request", "PostParameter"),
new NameValuePair("others", "bloggs")};
HttpClient client = new HttpClient();
- PostMethod post = new PostMethod("http://localhost:9280/parameter");
+ PostMethod post = new PostMethod("http://localhost:" + port1 + "/parameter");
post.setRequestBody(data);
client.executeMethod(post);
InputStream response = post.getResponseBodyAsStream();
@@ -109,7 +109,7 @@ public class HttpRouteTest extends Camel
@Test
public void testPostXMLMessage() throws Exception {
HttpClient client = new HttpClient();
- PostMethod post = new PostMethod("http://localhost:9280/postxml");
+ PostMethod post = new PostMethod("http://localhost:" + port1 + "/postxml");
StringRequestEntity entity = new StringRequestEntity(POST_MESSAGE, "application/xml", "UTF-8");
post.setRequestEntity(entity);
client.executeMethod(post);
@@ -121,7 +121,7 @@ public class HttpRouteTest extends Camel
@Test
public void testPostParameterInURI() throws Exception {
HttpClient client = new HttpClient();
- PostMethod post = new PostMethod("http://localhost:9280/parameter?request=PostParameter&others=bloggs");
+ PostMethod post = new PostMethod("http://localhost:" + port1 + "/parameter?request=PostParameter&others=bloggs");
StringRequestEntity entity = new StringRequestEntity(POST_MESSAGE, "application/xml", "UTF-8");
post.setRequestEntity(entity);
client.executeMethod(post);
@@ -133,7 +133,7 @@ public class HttpRouteTest extends Camel
@Test
public void testPutParameterInURI() throws Exception {
HttpClient client = new HttpClient();
- PutMethod put = new PutMethod("http://localhost:9280/parameter?request=PutParameter&others=bloggs");
+ PutMethod put = new PutMethod("http://localhost:" + port1 + "/parameter?request=PutParameter&others=bloggs");
StringRequestEntity entity = new StringRequestEntity(POST_MESSAGE, "application/xml", "UTF-8");
put.setRequestEntity(entity);
client.executeMethod(put);
@@ -145,7 +145,7 @@ public class HttpRouteTest extends Camel
@Test
public void testDisableStreamCache() throws Exception {
String response =
- template.requestBodyAndHeader("http://localhost:9083/noStreamCache",
+ template.requestBodyAndHeader("http://localhost:" + port3 + "/noStreamCache",
new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml", String.class);
assertEquals("Get a wrong output ", "OK", response);
@@ -156,24 +156,30 @@ public class HttpRouteTest extends Camel
InputStream in = this.getClass().getResourceAsStream("/META-INF/LICENSE.txt");
int fileSize = in.available();
String response =
- template.requestBodyAndHeader("http://localhost:9084/requestBufferSize",
+ template.requestBodyAndHeader("http://localhost:" + port4 + "/requestBufferSize",
in, Exchange.CONTENT_TYPE, "application/txt", String.class);
assertEquals("Got a wrong response.", fileSize, response.length());
}
protected void invokeHttpEndpoint() throws IOException {
- template.requestBodyAndHeader("http://localhost:9280/test", expectedBody, "Content-Type", "application/xml");
+ template.requestBodyAndHeader("http://localhost:" + port1 + "/test", expectedBody, "Content-Type", "application/xml");
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
+ port1 = getPort();
+ port2 = getNextPort();
+ port3 = getNextPort();
+ port4 = getNextPort();
+
+
// enable stream cache
context.setStreamCaching(true);
- from("jetty:http://localhost:9280/test").to("mock:a");
+ from("jetty:http://localhost:" + port1 + "/test").to("mock:a");
Processor proc = new Processor() {
public void process(Exchange exchange) throws Exception {
@@ -199,9 +205,9 @@ public class HttpRouteTest extends Camel
cache.reset();
}
};
- from("jetty:http://localhost:9281/hello?sessionSupport=true").process(proc);
+ from("jetty:http://localhost:" + port2 + "/hello?sessionSupport=true").process(proc);
- from("jetty:http://localhost:9280/echo").process(printProcessor).process(printProcessor);
+ from("jetty:http://localhost:" + port1 + "/echo").process(printProcessor).process(printProcessor);
Processor procParameters = new Processor() {
public void process(Exchange exchange) throws Exception {
@@ -217,20 +223,17 @@ public class HttpRouteTest extends Camel
}
};
- from("jetty:http://localhost:9280/parameter").process(procParameters);
-
- from("jetty:http://localhost:9280/postxml").process(new Processor() {
+ from("jetty:http://localhost:" + port1 + "/parameter").process(procParameters);
+ from("jetty:http://localhost:" + port1 + "/postxml").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String value = exchange.getIn().getBody(String.class);
assertEquals("The response message is wrong", value, POST_MESSAGE);
exchange.getOut().setBody("OK");
}
-
});
- from("jetty:http://localhost:9083/noStreamCache?disableStreamCache=true").noStreamCaching().process(new Processor() {
-
+ from("jetty:http://localhost:" + port3 + "/noStreamCache?disableStreamCache=true").noStreamCaching().process(new Processor() {
public void process(Exchange exchange) throws Exception {
InputStream is = (InputStream)exchange.getIn().getBody();
assertTrue("It should be a raw inputstream", is instanceof org.eclipse.jetty.server.HttpInput);
@@ -238,19 +241,14 @@ public class HttpRouteTest extends Camel
assertEquals("Got a wrong request", "This is a test", request);
exchange.getOut().setBody("OK");
}
-
});
-
- from("jetty:http://localhost:9084/requestBufferSize").process(new Processor() {
-
+ from("jetty:http://localhost:" + port4 + "/requestBufferSize").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String string = exchange.getIn().getBody(String.class);
exchange.getOut().setBody(string);
}
-
});
-
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java Tue Oct 26 06:25:56 2010
@@ -23,13 +23,12 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* @version $Revision$
*/
-public class HttpSendFileTest extends CamelTestSupport {
+public class HttpSendFileTest extends BaseJettyTest {
@Test
public void testSendImage() throws Exception {
@@ -38,7 +37,7 @@ public class HttpSendFileTest extends Ca
mock.message(0).body().isInstanceOf(InputStream.class);
mock.message(0).header("Content-Type").isEqualTo("image/jpeg");
- Exchange out = template.send("http://localhost:9080/myapp/myservice", new Processor() {
+ Exchange out = template.send("http://localhost:{{port}}/myapp/myservice", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody(new File("src/test/data/logo.jpeg"));
exchange.getIn().setHeader("Content-Type", "image/jpeg");
@@ -55,7 +54,7 @@ public class HttpSendFileTest extends Ca
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:9080/myapp/myservice")
+ from("jetty:http://localhost:{{port}}/myapp/myservice")
.to("mock:result")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileTest.java Tue Oct 26 06:25:56 2010
@@ -24,14 +24,13 @@ import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.HttpOperationFailedException;
import org.apache.camel.converter.stream.CachedOutputStream;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Before;
import org.junit.Test;
/**
* @version $Revision$
*/
-public class HttpStreamCacheFileTest extends CamelTestSupport {
+public class HttpStreamCacheFileTest extends BaseJettyTest {
private String body = "12345678901234567890123456789012345678901234567890";
@@ -88,9 +87,9 @@ public class HttpStreamCacheFileTest ext
context.setStreamCaching(true);
// use a route so we got an unit of work
- from("direct:start").to("http://localhost:8123/myserver");
+ from("direct:start").to("http://localhost:{{port}}/myserver");
- from("jetty://http://localhost:8123/myserver")
+ from("jetty://http://localhost:{{port}}/myserver")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
if (exchange.getIn().getBody() == null) {
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpToFileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpToFileTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpToFileTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpToFileTest.java Tue Oct 26 06:25:56 2010
@@ -22,21 +22,20 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.converter.IOConverter;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Before;
import org.junit.Test;
/**
- * Unit testing demonstrating how to store incoming requests as files and serving a reponse back.
+ * Unit testing demonstrating how to store incoming requests as files and serving a response back.
*/
-public class HttpToFileTest extends CamelTestSupport {
+public class HttpToFileTest extends BaseJettyTest {
@Test
public void testToJettyAndSaveToFile() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World");
- Object out = template.requestBody("http://localhost:9080/myworld", "Hello World");
+ Object out = template.requestBody("http://localhost:{{port}}/myworld", "Hello World");
String response = context.getTypeConverter().convertTo(String.class, out);
assertEquals("Response from Jetty", "We got the file", response);
@@ -65,7 +64,10 @@ public class HttpToFileTest extends Came
return new RouteBuilder() {
public void configure() throws Exception {
// put the incoming data on the seda queue and return a fixed response that we got the file
- from("jetty:http://localhost:9080/myworld").convertBodyTo(String.class).to("seda:in").setBody(constant("We got the file"));
+ from("jetty:http://localhost:{{port}}/myworld")
+ .convertBodyTo(String.class)
+ .to("seda:in")
+ .setBody(constant("We got the file"));
// store the content from the queue as a file
from("seda:in")
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoEndpointTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoEndpointTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoEndpointTest.java Tue Oct 26 06:25:56 2010
@@ -19,13 +19,12 @@ package org.apache.camel.component.jetty
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* @version $Revision$
*/
-public class HttpTwoEndpointTest extends CamelTestSupport {
+public class HttpTwoEndpointTest extends BaseJettyTest {
@Test
public void testTwoEndpoints() throws Exception {
@@ -49,11 +48,11 @@ public class HttpTwoEndpointTest extends
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("direct:a").to("http://localhost:9888/myapp?foo=123&bar=cheese");
+ from("direct:a").to("http://localhost:{{port}}/myapp?foo=123&bar=cheese");
- from("direct:b").to("http://localhost:9888/myapp?foo=456&bar=cake");
+ from("direct:b").to("http://localhost:{{port}}/myapp?foo=456&bar=cake");
- from("jetty://http://localhost:9888/myapp").process(new Processor() {
+ from("jetty://http://localhost:{{port}}/myapp").process(new Processor() {
public void process(Exchange exchange) throws Exception {
int foo = exchange.getIn().getHeader("foo", Integer.class);
String bar = exchange.getIn().getHeader("bar", String.class);
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java Tue Oct 26 06:25:56 2010
@@ -19,13 +19,15 @@ package org.apache.camel.component.jetty
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* @version $Revision$
*/
-public class HttpTwoServerPortsTest extends CamelTestSupport {
+public class HttpTwoServerPortsTest extends BaseJettyTest {
+
+ private int port1;
+ private int port2;
@Test
public void testTwoServerPorts() throws Exception {
@@ -47,18 +49,21 @@ public class HttpTwoServerPortsTest exte
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("direct:a").to("http://localhost:9777/myapp");
+ port1 = getPort();
+ port2 = getNextPort();
+
+ from("direct:a").to("http://localhost:" + port1 + "/myapp");
- from("direct:b").to("http://localhost:9888/myotherapp");
+ from("direct:b").to("http://localhost:" + port2 + "/myotherapp");
- from("jetty://http://localhost:9777/myapp").process(new Processor() {
+ from("jetty://http://localhost:" + port1 + "/myapp").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String in = exchange.getIn().getBody(String.class);
exchange.getOut().setBody("Bye " + in);
}
});
- from("jetty://http://localhost:9888/myotherapp").process(new Processor() {
+ from("jetty://http://localhost:" + port2 + "/myotherapp").process(new Processor() {
public void process(Exchange exchange) throws Exception {
String in = exchange.getIn().getBody(String.class);
exchange.getOut().setBody("Hi " + in);
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteAddSslConnectorPropertiesTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteAddSslConnectorPropertiesTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteAddSslConnectorPropertiesTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteAddSslConnectorPropertiesTest.java Tue Oct 26 06:25:56 2010
@@ -29,6 +29,9 @@ public class HttpsRouteAddSslConnectorPr
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws URISyntaxException {
+ port1 = getPort();
+ port2 = getNextPort();
+
// START SNIPPET: e1
// keystore path
URL keyStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.ks");
@@ -47,16 +50,16 @@ public class HttpsRouteAddSslConnectorPr
context.addComponent("jetty", jetty);
// END SNIPPET: e1
- from("jetty:https://localhost:9080/test").to("mock:a");
+ from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
Processor proc = new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setBody("<b>Hello World</b>");
}
};
- from("jetty:https://localhost:9080/hello").process(proc);
+ from("jetty:https://localhost:" + port1 + "/hello").process(proc);
- from("jetty:https://localhost:9090/test").to("mock:b");
+ from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSetupWithSystemPropsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSetupWithSystemPropsTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSetupWithSystemPropsTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSetupWithSystemPropsTest.java Tue Oct 26 06:25:56 2010
@@ -47,16 +47,19 @@ public class HttpsRouteSetupWithSystemPr
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() {
- from("jetty:https://localhost:9080/test").to("mock:a");
+ port1 = getPort();
+ port2 = getNextPort();
+
+ from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
Processor proc = new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setBody("<b>Hello World</b>");
}
};
- from("jetty:https://localhost:9080/hello").process(proc);
+ from("jetty:https://localhost:" + port1 + "/hello").process(proc);
- from("jetty:https://localhost:9090/test").to("mock:b");
+ from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java Tue Oct 26 06:25:56 2010
@@ -37,12 +37,13 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-
-public class HttpsRouteTest extends CamelTestSupport {
+public class HttpsRouteTest extends BaseJettyTest {
private static final String NULL_VALUE_MARKER = CamelTestSupport.class.getCanonicalName();
protected String expectedBody = "<hello>world!</hello>";
protected String pwd = "changeit";
protected Properties originalValues = new Properties();
+ protected int port1;
+ protected int port2;
public String getHttpProducerScheme() {
return "https://";
@@ -120,7 +121,7 @@ public class HttpsRouteTest extends Came
MockEndpoint mockEndpoint = resolveMandatoryEndpoint("mock:a", MockEndpoint.class);
try {
- template.sendBodyAndHeader("http://localhost:9080/test", expectedBody, "Content-Type", "application/xml");
+ template.sendBodyAndHeader("http://localhost:" + port1 + "/test", expectedBody, "Content-Type", "application/xml");
fail("expect exception on access to https endpoint via http");
} catch (RuntimeCamelException expected) {
}
@@ -135,7 +136,7 @@ public class HttpsRouteTest extends Came
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
- InputStream is = new URL("https://localhost:9080/hello").openStream();
+ InputStream is = new URL("https://localhost:" + port1 + "/hello").openStream();
int c;
while ((c = is.read()) >= 0) {
os.write(c);
@@ -153,21 +154,23 @@ public class HttpsRouteTest extends Came
}
try {
- new URL("http://localhost:9080/hello").openStream();
+ new URL("http://localhost:" + port1 + "/hello").openStream();
fail("expected SocketException on use ot http");
} catch (SocketException expected) {
}
}
protected void invokeHttpEndpoint() throws IOException {
- template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:9080/test", expectedBody, "Content-Type", "application/xml");
- template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:9090/test", expectedBody, "Content-Type", "application/xml");
+ template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:" + port1 + "/test", expectedBody, "Content-Type", "application/xml");
+ template.sendBodyAndHeader(getHttpProducerScheme() + "localhost:" + port2 + "/test", expectedBody, "Content-Type", "application/xml");
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws URISyntaxException {
+ port1 = getPort();
+ port2 = getNextPort();
JettyHttpComponent componentJetty = (JettyHttpComponent) context.getComponent("jetty");
componentJetty.setSslPassword(pwd);
@@ -175,16 +178,16 @@ public class HttpsRouteTest extends Came
URL keyStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.ks");
componentJetty.setKeystore(keyStoreUrl.toURI().getPath());
- from("jetty:https://localhost:9080/test").to("mock:a");
+ from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
Processor proc = new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setBody("<b>Hello World</b>");
}
};
- from("jetty:https://localhost:9080/hello").process(proc);
+ from("jetty:https://localhost:" + port1 + "/hello").process(proc);
- from("jetty:https://localhost:9090/test").to("mock:b");
+ from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteWithSslConnectorPropertiesTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteWithSslConnectorPropertiesTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteWithSslConnectorPropertiesTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteWithSslConnectorPropertiesTest.java Tue Oct 26 06:25:56 2010
@@ -31,6 +31,9 @@ public class HttpsRouteWithSslConnectorP
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws URISyntaxException {
+ port1 = getPort();
+ port2 = getNextPort();
+
// START SNIPPET: e1
// keystore path
URL keyStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.ks");
@@ -51,16 +54,16 @@ public class HttpsRouteWithSslConnectorP
context.addComponent("jetty", jetty);
// END SNIPPET: e1
- from("jetty:https://localhost:9080/test").to("mock:a");
+ from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
Processor proc = new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setBody("<b>Hello World</b>");
}
};
- from("jetty:https://localhost:9080/hello").process(proc);
+ from("jetty:https://localhost:" + port1 + "/hello").process(proc);
- from("jetty:https://localhost:9090/test").to("mock:b");
+ from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java Tue Oct 26 06:25:56 2010
@@ -30,8 +30,7 @@ import org.junit.Test;
public class InterfacesTest extends CamelTestSupport {
private static boolean isMacOS = System.getProperty("os.name").startsWith("Mac");
private String remoteInterfaceAddress;
-
-
+
public InterfacesTest() throws IOException {
// Retrieve an address of some remote network interface
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java Tue Oct 26 06:25:56 2010
@@ -19,20 +19,19 @@ package org.apache.camel.component.jetty
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* @version $Revision$
*/
-public class JettyCallHttpThenExceptionTest extends CamelTestSupport {
+public class JettyCallHttpThenExceptionTest extends BaseJettyTest {
@Test
public void testJettyCallHttpThenException() throws Exception {
getMockEndpoint("mock:foo").expectedBodiesReceived("World");
getMockEndpoint("mock:bar").expectedBodiesReceived("Bye World");
- Exchange reply = template.request("http://localhost:8234/myserver?throwExceptionOnFailure=false", new Processor() {
+ Exchange reply = template.request("http://localhost:{{port}}/myserver?throwExceptionOnFailure=false", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody("World");
}
@@ -50,17 +49,17 @@ public class JettyCallHttpThenExceptionT
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty://http://localhost:8234/myserver")
+ from("jetty://http://localhost:{{port}}/myserver")
.to("log:A")
// remove http headers before and after invoking http service
.removeHeaders("CamelHttp*")
- .to("http://localhost:8234/other")
+ .to("http://localhost:{{port}}/other")
.removeHeaders("CamelHttp*")
.to("mock:bar")
// now just force an exception immediately
.throwException(new IllegalArgumentException("I cannot do this"));
- from("jetty://http://localhost:8234/other")
+ from("jetty://http://localhost:{{port}}/other")
.convertBodyTo(String.class)
.to("log:C")
.to("mock:foo")
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java Tue Oct 26 06:25:56 2010
@@ -18,15 +18,14 @@ package org.apache.camel.component.jetty
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test with a simple route test.
*/
-public class JettyContentBasedRouteTest extends CamelTestSupport {
+public class JettyContentBasedRouteTest extends BaseJettyTest {
- private String serverUri = "http://localhost:9080/myservice";
+ private String serverUri = "http://localhost:" + getPort() + "/myservice";
@Test
public void testSendOne() throws Exception {
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java Tue Oct 26 06:25:56 2010
@@ -20,7 +20,6 @@ import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.MessageHelper;
import org.junit.Test;
@@ -28,10 +27,10 @@ import org.junit.Test;
/**
* Unit test for content-type
*/
-public class JettyContentTypeTest extends CamelTestSupport {
+public class JettyContentTypeTest extends BaseJettyTest {
protected void sendMessageWithContentType(boolean usingGZip) {
- Endpoint endpoint = context.getEndpoint("http://localhost:9080/myapp/myservice");
+ Endpoint endpoint = context.getEndpoint("http://localhost:{{port}}/myapp/myservice");
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody("<order>123</order>");
exchange.getIn().setHeader("User", "Claus");
@@ -59,7 +58,7 @@ public class JettyContentTypeTest extend
@Test
public void testMixedContentType() throws Exception {
- Endpoint endpoint = context.getEndpoint("http://localhost:9080/myapp/myservice");
+ Endpoint endpoint = context.getEndpoint("http://localhost:{{port}}/myapp/myservice");
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody("<order>123</order>");
exchange.getIn().setHeader("Content-Type", "text/xml");
@@ -74,7 +73,7 @@ public class JettyContentTypeTest extend
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:9080/myapp/myservice").process(new MyBookService());
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new MyBookService());
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java Tue Oct 26 06:25:56 2010
@@ -19,7 +19,6 @@ package org.apache.camel.component.jetty
import java.lang.management.ManagementFactory;
import java.util.List;
import java.util.Set;
-
import javax.management.MBeanServer;
import javax.management.MBeanServerConnection;
import javax.management.MBeanServerFactory;
@@ -27,20 +26,14 @@ import javax.management.ObjectName;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
-
-public class JettyEnableJmxTest extends CamelTestSupport {
+public class JettyEnableJmxTest extends BaseJettyTest {
- private String serverUri0 =
- "http://localhost:9080/myservice?enableJmx=true";
- private String serverUri1 =
- "http://localhost:9081/myservice?enableJmx=true";
- private String serverUri2 =
- "http://localhost:9082/myservice?enableJmx=false";
- private String serverUri3 =
- "http://localhost:9083/myservice?enableJmx=false";
+ private String serverUri0;
+ private String serverUri1;
+ private String serverUri2;
+ private String serverUri3;
private MBeanServerConnection mbsc;
@Override
@@ -119,6 +112,11 @@ public class JettyEnableJmxTest extends
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
+ serverUri0 = "http://localhost:" + getPort() + "/myservice?enableJmx=true";
+ serverUri1 = "http://localhost:" + getNextPort() + "/myservice?enableJmx=true";
+ serverUri2 = "http://localhost:" + getNextPort() + "/myservice?enableJmx=false";
+ serverUri3 = "http://localhost:" + getNextPort() + "/myservice?enableJmx=false";
+
from("jetty:" + serverUri0)
.routeId("route0")
.setBody().simple("<html><body>${in.header.x}</body></html>")
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java Tue Oct 26 06:25:56 2010
@@ -22,7 +22,6 @@ import org.apache.camel.builder.RouteBui
import org.apache.camel.component.http.HttpOperationFailedException;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.processor.aggregate.AggregationStrategy;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
@@ -30,10 +29,10 @@ import org.junit.Test;
*
* @version $Revision$
*/
-public class JettyHandle404Test extends CamelTestSupport {
+public class JettyHandle404Test extends BaseJettyTest {
public String getProducerUrl() {
- return "http://localhost:8123/myserver?user=Camel";
+ return "http://localhost:{{port}}/myserver?user=Camel";
}
@Test
@@ -83,7 +82,7 @@ public class JettyHandle404Test extends
// this is our jetty server where we simulate the 404
- from("jetty://http://localhost:8123/myserver")
+ from("jetty://http://localhost:{{port}}/myserver")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getOut().setBody("Page not found");
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java Tue Oct 26 06:25:56 2010
@@ -24,23 +24,22 @@ import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.DefaultHttpBinding;
import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test for http binding ref option.
*/
-public class JettyHttpBindingRefTest extends CamelTestSupport {
+public class JettyHttpBindingRefTest extends BaseJettyTest {
@Test
public void testDefaultHttpBinding() throws Exception {
- Object out = template.requestBody("http://localhost:9080/myapp/myservice", "Hello World");
+ Object out = template.requestBody("http://localhost:{{port}}/myapp/myservice", "Hello World");
assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, out));
}
@Test
public void testCustomHttpBinding() throws Exception {
- Object out = template.requestBody("http://localhost:9081/myapp/myotherservice", "Hello World");
+ Object out = template.requestBody("http://localhost:{{port}}/myapp/myotherservice", "Hello World");
assertEquals("Something went wrong but we dont care", context.getTypeConverter().convertTo(String.class, out));
}
@@ -59,9 +58,9 @@ public class JettyHttpBindingRefTest ext
public void configure() throws Exception {
errorHandler(noErrorHandler());
- from("jetty:http://localhost:9080/myapp/myservice?httpBindingRef=default").transform().constant("Bye World");
+ from("jetty:http://localhost:{{port}}/myapp/myservice?httpBindingRef=default").transform().constant("Bye World");
- from("jetty:http://localhost:9081/myapp/myotherservice?httpBindingRef=myownbinder").process(new Processor() {
+ from("jetty:http://localhost:{{port}}/myapp/myotherservice?httpBindingRef=myownbinder").process(new Processor() {
public void process(Exchange exchange) throws Exception {
throw new IllegalStateException("Not implemented");
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java Tue Oct 26 06:25:56 2010
@@ -19,24 +19,23 @@ package org.apache.camel.component.jetty
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.HttpEndpoint;
import org.apache.camel.component.http.HttpProducer;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test for http client options.
*/
-public class JettyHttpClientOptionsTest extends CamelTestSupport {
+public class JettyHttpClientOptionsTest extends BaseJettyTest {
@Test
public void testCustomHttpBinding() throws Exception {
// assert jetty was configured with our timeout
- HttpEndpoint jettyEndpoint = context.getEndpoint("http://localhost:8080/myapp/myservice?httpClient.soTimeout=5555", HttpEndpoint.class);
+ HttpEndpoint jettyEndpoint = context.getEndpoint("http://localhost:{{port}}/myapp/myservice?httpClient.soTimeout=5555", HttpEndpoint.class);
assertNotNull("Jetty endpoint should not be null ", jettyEndpoint);
HttpProducer producer = (HttpProducer)jettyEndpoint.createProducer();
assertEquals("Get the wrong http client parameter", 5555, producer.getHttpClient().getParams().getSoTimeout());
// send and receive
- Object out = template.requestBody("http://localhost:9080/myapp/myservice", "Hello World");
+ Object out = template.requestBody("http://localhost:{{port}}/myapp/myservice", "Hello World");
assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, out));
}
@@ -45,7 +44,7 @@ public class JettyHttpClientOptionsTest
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:9080/myapp/myservice?httpClient.soTimeout=5555").transform().constant("Bye World");
+ from("jetty:http://localhost:{{port}}/myapp/myservice?httpClient.soTimeout=5555").transform().constant("Bye World");
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java Tue Oct 26 06:25:56 2010
@@ -17,15 +17,14 @@
package org.apache.camel.component.jetty;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test to verify that the Jetty HTTP connector is correctly disconnected on shutdown
*/
-public class JettyHttpEndpointDisconnectTest extends CamelTestSupport {
+public class JettyHttpEndpointDisconnectTest extends BaseJettyTest {
- private String serverUri = "http://localhost:9080/myservice";
+ private String serverUri = "http://localhost:" + getPort() + "/myservice";
@Test
public void testContextShutdownRemovesHttpConnector() throws Exception {
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java Tue Oct 26 06:25:56 2010
@@ -19,15 +19,14 @@ package org.apache.camel.component.jetty
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test to verify that we can have URI options for external system (endpoint is lenient)
*/
-public class JettyHttpGetWithParamAsExchangeHeaderTest extends CamelTestSupport {
+public class JettyHttpGetWithParamAsExchangeHeaderTest extends BaseJettyTest {
- private String serverUri = "http://localhost:9080/myservice";
+ private String serverUri = "http://localhost:" + getPort() + "/myservice";
@Test
public void testHttpGetWithParamsViaURI() throws Exception {
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java Tue Oct 26 06:25:56 2010
@@ -17,21 +17,19 @@
package org.apache.camel.component.jetty;
import junit.framework.Assert;
-
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.HttpMessage;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test to verify that we can have URI options for external system (endpoint is lenient)
*/
-public class JettyHttpGetWithParamTest extends CamelTestSupport {
+public class JettyHttpGetWithParamTest extends BaseJettyTest {
- private String serverUri = "http://localhost:9080/myservice";
+ private String serverUri = "http://localhost:" + getPort() + "/myservice";
private MyParamsProcessor processor = new MyParamsProcessor();
@Test
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyImageFileTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyImageFileTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyImageFileTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyImageFileTest.java Tue Oct 26 06:25:56 2010
@@ -22,17 +22,16 @@ import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.apache.camel.util.MessageHelper;
import org.junit.Test;
/**
* Unit test for exposing a http server that returns images
*/
-public class JettyImageFileTest extends CamelTestSupport {
+public class JettyImageFileTest extends BaseJettyTest {
private void sendImageContent(boolean usingGZip) throws Exception {
- Endpoint endpoint = context.getEndpoint("http://localhost:9080/myapp/myservice");
+ Endpoint endpoint = context.getEndpoint("http://localhost:{{port}}/myapp/myservice");
Exchange exchange = endpoint.createExchange();
if (usingGZip) {
exchange.getIn().setHeader(Exchange.CONTENT_ENCODING, "gzip");
@@ -57,7 +56,7 @@ public class JettyImageFileTest extends
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:9080/myapp/myservice").process(new MyImageService());
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new MyImageService());
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyMinMaxThreadPoolTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyMinMaxThreadPoolTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyMinMaxThreadPoolTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyMinMaxThreadPoolTest.java Tue Oct 26 06:25:56 2010
@@ -26,10 +26,9 @@ import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.SynchronizationAdapter;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
-public class JettyMinMaxThreadPoolTest extends CamelTestSupport {
+public class JettyMinMaxThreadPoolTest extends BaseJettyTest {
@Override
protected CamelContext createCamelContext() throws Exception {
@@ -50,7 +49,7 @@ public class JettyMinMaxThreadPoolTest e
log.info("Sending 10 messages");
for (int i = 0; i < 10; i++) {
- template.asyncCallbackRequestBody("http://localhost:9080/myapp/myservice", "" + i, new SynchronizationAdapter() {
+ template.asyncCallbackRequestBody("http://localhost:{{port}}/myapp/myservice", "" + i, new SynchronizationAdapter() {
@Override
public void onDone(Exchange exchange) {
String body = exchange.getOut().getBody(String.class);
@@ -76,7 +75,7 @@ public class JettyMinMaxThreadPoolTest e
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
- from("jetty:http://localhost:9080/myapp/myservice")
+ from("jetty:http://localhost:{{port}}/myapp/myservice")
.to("log:input")
.delay(1000)
.transform(body().prepend("Bye "))
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyOnExceptionHandledTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyOnExceptionHandledTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyOnExceptionHandledTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyOnExceptionHandledTest.java Tue Oct 26 06:25:56 2010
@@ -18,17 +18,16 @@ package org.apache.camel.component.jetty
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* @version $Revision$
*/
-public class JettyOnExceptionHandledTest extends CamelTestSupport {
+public class JettyOnExceptionHandledTest extends BaseJettyTest {
@Test
public void testJettyOnException() throws Exception {
- Exchange reply = template.request("http://localhost:8234/myserver?throwExceptionOnFailure=false", null);
+ Exchange reply = template.request("http://localhost:{{port}}/myserver?throwExceptionOnFailure=false", null);
assertNotNull(reply);
assertEquals("Dude something went wrong", reply.getOut().getBody(String.class));
@@ -41,7 +40,7 @@ public class JettyOnExceptionHandledTest
@Override
public void configure() throws Exception {
// START SNIPPET: e1
- from("jetty://http://localhost:8234/myserver")
+ from("jetty://http://localhost:{{port}}/myserver")
// use onException to catch all exceptions and return a custom reply message
.onException(Exception.class)
.handled(true)
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java Tue Oct 26 06:25:56 2010
@@ -21,18 +21,17 @@ import org.apache.camel.Processor;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.http.HttpOperationFailedException;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test for HttpOperationFailedException should contain response body
*/
-public class JettyResponseBodyWhenErrorTest extends CamelTestSupport {
+public class JettyResponseBodyWhenErrorTest extends BaseJettyTest {
@Test
public void testResponseBodyWhenError() throws Exception {
try {
- template.requestBody("http://localhost:9080/myapp/myservice", "bookid=123");
+ template.requestBody("http://localhost:{{port}}/myapp/myservice", "bookid=123");
fail("Should have thrown an exception");
} catch (RuntimeCamelException e) {
HttpOperationFailedException cause = (HttpOperationFailedException) e.getCause();
@@ -51,7 +50,7 @@ public class JettyResponseBodyWhenErrorT
return new RouteBuilder() {
public void configure() throws Exception {
errorHandler(noErrorHandler());
- from("jetty:http://localhost:9080/myapp/myservice").process(new MyBookService());
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new MyBookService());
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java Tue Oct 26 06:25:56 2010
@@ -21,17 +21,16 @@ import javax.servlet.http.HttpServletReq
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test for wiki demonstration.
*/
-public class JettyRouteTest extends CamelTestSupport {
+public class JettyRouteTest extends BaseJettyTest {
@Test
public void testSendToJetty() throws Exception {
- Object response = template.requestBody("http://localhost:9080/myapp/myservice", "bookid=123");
+ Object response = template.requestBody("http://localhost:{{port}}/myapp/myservice", "bookid=123");
// convert the response to a String
String body = context.getTypeConverter().convertTo(String.class, response);
assertEquals("<html><body>Book 123 is Camel in Action</body></html>", body);
@@ -42,7 +41,7 @@ public class JettyRouteTest extends Came
return new RouteBuilder() {
public void configure() throws Exception {
// START SNIPPET: e1
- from("jetty:http://localhost:9080/myapp/myservice").process(new MyBookService());
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new MyBookService());
// END SNIPPET: e1
}
};
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithSocketPropertiesTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithSocketPropertiesTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithSocketPropertiesTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithSocketPropertiesTest.java Tue Oct 26 06:25:56 2010
@@ -23,17 +23,16 @@ import javax.servlet.http.HttpServletReq
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
/**
* Unit test for wiki demonstration.
*/
-public class JettyRouteWithSocketPropertiesTest extends CamelTestSupport {
+public class JettyRouteWithSocketPropertiesTest extends BaseJettyTest {
@Test
public void testSendToJetty() throws Exception {
- Object response = template.requestBody("http://localhost:9080/myapp/myservice", "bookid=123");
+ Object response = template.requestBody("http://localhost:{{port}}/myapp/myservice", "bookid=123");
// convert the response to a String
String body = context.getTypeConverter().convertTo(String.class, response);
assertEquals("<html><body>Book 123 is Camel in Action</body></html>", body);
@@ -58,7 +57,7 @@ public class JettyRouteWithSocketPropert
context.addComponent("jetty", jetty);
// END SNIPPET: e1
- from("jetty:http://localhost:9080/myapp/myservice").process(new MyBookService());
+ from("jetty:http://localhost:{{port}}/myapp/myservice").process(new MyBookService());
}
};
}
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java Tue Oct 26 06:25:56 2010
@@ -20,10 +20,9 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
-public class JettyRouteWithUnknownSocketPropertiesTest extends CamelTestSupport {
+public class JettyRouteWithUnknownSocketPropertiesTest extends BaseJettyTest {
@Override
public boolean isUseRouteBuilder() {
@@ -49,7 +48,7 @@ public class JettyRouteWithUnknownSocket
// add jetty to camel context
context.addComponent("jetty", jetty);
- from("jetty:http://localhost:9080/myapp/myservice").to("log:foo");
+ from("jetty:http://localhost:{{port}}/myapp/myservice").to("log:foo");
}
});
try {
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java Tue Oct 26 06:25:56 2010
@@ -20,10 +20,9 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
-public class JettyRouteWithUnknownSslSocketPropertiesTest extends CamelTestSupport {
+public class JettyRouteWithUnknownSslSocketPropertiesTest extends BaseJettyTest {
@Override
public boolean isUseRouteBuilder() {
@@ -49,7 +48,7 @@ public class JettyRouteWithUnknownSslSoc
// add jetty to camel context
context.addComponent("jetty", jetty);
- from("jetty:https://localhost:9080/myapp/myservice").to("log:foo");
+ from("jetty:https://localhost:{{port}}/myapp/myservice").to("log:foo");
}
});
try {
Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySessionSupportTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySessionSupportTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySessionSupportTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySessionSupportTest.java Tue Oct 26 06:25:56 2010
@@ -17,15 +17,12 @@
package org.apache.camel.component.jetty;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
-import static org.apache.camel.language.simple.SimpleLanguage.simple;
-
/**
* @version $Revision$
*/
-public class JettySessionSupportTest extends CamelTestSupport {
+public class JettySessionSupportTest extends BaseJettyTest {
@Override
public boolean isUseRouteBuilder() {
@@ -37,16 +34,16 @@ public class JettySessionSupportTest ext
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:9282/hello").to("mock:foo");
+ from("jetty:http://localhost:{{port}}/hello").to("mock:foo");
- from("jetty:http://localhost:9282/bye?sessionSupport=true").to("mock:bar");
+ from("jetty:http://localhost:{{port}}/bye?sessionSupport=true").to("mock:bar");
}
});
try {
context.start();
fail("Should have thrown an exception");
} catch (IllegalStateException e) {
- assertEquals("Server has already been started. Cannot enabled sessionSupport on http:localhost:9282", e.getMessage());
+ assertEquals("Server has already been started. Cannot enabled sessionSupport on http:localhost:" + getPort(), e.getMessage());
}
}
@@ -55,16 +52,16 @@ public class JettySessionSupportTest ext
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
- from("jetty:http://localhost:9283/hello?sessionSupport=true").transform(simple("Bye ${body}"));
+ from("jetty:http://localhost:{{port}}/hello?sessionSupport=true").transform(simple("Bye ${body}"));
}
});
context.start();
try {
- String reply = template.requestBody("http://localhost:9283/hello", "World", String.class);
+ String reply = template.requestBody("http://localhost:{{port}}/hello", "World", String.class);
assertEquals("Bye World", reply);
- reply = template.requestBody("http://localhost:9283/hello", "Moon", String.class);
+ reply = template.requestBody("http://localhost:{{port}}/hello", "Moon", String.class);
assertEquals("Bye Moon", reply);
} finally {
context.stop();