camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1027376 [1/3] - in /camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty: ./ async/ file/ jettyproducer/
Date Tue, 26 Oct 2010 06:25:59 GMT
Author: davsclaus
Date: Tue Oct 26 06:25:56 2010
New Revision: 1027376

URL: http://svn.apache.org/viewvc?rev=1027376&view=rev
Log:
CAMEL-3274: using different port numbers for testing with Jetty to avoid port number already in use issue.

Added:
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/BaseJettyTest.java
Removed:
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteUsingUrlPostTest.java
Modified:
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ConvertPayloadToInputStreamTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HandlerTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpAuthMethodPriorityTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthComponentConfiguredTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpCharacterEncodingTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteEnableChunkedTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGZipEncodingTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderCaseTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpOperationsFailedExceptionUriTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingGetTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerByteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProxyRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectNoLocationTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRedirectTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRequestResponseTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnDataNotInputStreamConvertableTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpReturnFaultTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRoundtripHeaderTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpSendFileTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpStreamCacheFileTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpToFileTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoEndpointTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpTwoServerPortsTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteAddSslConnectorPropertiesTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSetupWithSystemPropsTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteWithSslConnectorPropertiesTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/InterfacesTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyCallHttpThenExceptionTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentBasedRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyContentTypeTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyEnableJmxTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHandle404Test.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBindingRefTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpClientOptionsTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpEndpointDisconnectTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamAsExchangeHeaderTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpGetWithParamTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyImageFileTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyMinMaxThreadPoolTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyOnExceptionHandledTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyResponseBodyWhenErrorTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithSocketPropertiesTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSocketPropertiesTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyRouteWithUnknownSslSocketPropertiesTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySessionSupportTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimplifiedHandle404Test.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySteveIssueTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendResumeTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySuspendWhileInProgressTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyWithXPathChoiceTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiPartFormTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/MultiThreadedHttpGetTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/TwoCamelContextWithJettyRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncCBRTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncFilterTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTransformTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/async/JettyAsyncTryCatchFinallyTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/file/JettyFileConsumerTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoEndpointTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProderReturnFaultTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsyncTimeoutTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerAsynchronousTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConcurrentTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerConnectionFailureTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerContentBasedRouteTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamAsExchangeHeaderTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGetWithParamTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleAsynchronousTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerGoogleTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerQueryParamTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSendFileTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSimulate404ErrorTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSlowResponseTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendResumeTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendWhileInProgressTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousFalseTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSynchronousTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerTimeoutTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHandle404Test.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyProducerHttpsRouteTest.java

Added: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/BaseJettyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/BaseJettyTest.java?rev=1027376&view=auto
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/BaseJettyTest.java (added)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/BaseJettyTest.java Tue Oct 26 06:25:56 2010
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.jetty;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Properties;
+import java.util.Random;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.converter.IOConverter;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * @version $Revision$
+ */
+public abstract class BaseJettyTest extends CamelTestSupport {
+    private static volatile int port;
+
+    @BeforeClass
+    public static void initPort() throws Exception {
+        File file = new File("./target/jettyport.txt");
+        file = file.getAbsoluteFile();
+
+        if (!file.exists()) {
+            // start from somewhere in the 23xxx range
+            port = 23000 + new Random().nextInt(900);
+        } else {
+            // read port number from file
+            String s = IOConverter.toString(file, null);
+            port = Integer.parseInt(s);
+            // use next port
+            port++;
+        }
+
+    }
+
+    @AfterClass
+    public static void savePort() throws Exception {
+        File file = new File("./target/jettyport.txt");
+        file = file.getAbsoluteFile();
+
+        // save to file, do not append
+        FileOutputStream fos = new FileOutputStream(file, false);
+        try {
+            fos.write(String.valueOf(port).getBytes());
+        } finally {
+            fos.close();
+        }
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+        context.addComponent("properties", new PropertiesComponent("ref:prop"));
+        return context;
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        
+        Properties prop = new Properties();
+        prop.setProperty("port", "" + getPort());
+        jndi.bind("prop", prop);
+
+        return jndi;
+    }
+
+    protected int getNextPort() {
+        return ++port;
+    }
+
+    protected int getPort() {
+        return port;
+    }
+
+}

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ConvertPayloadToInputStreamTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ConvertPayloadToInputStreamTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ConvertPayloadToInputStreamTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ConvertPayloadToInputStreamTest.java Tue Oct 26 06:25:56 2010
@@ -18,17 +18,17 @@ package org.apache.camel.component.jetty
 
 import java.io.InputStream;
 import java.util.List;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 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 ConvertPayloadToInputStreamTest extends CamelTestSupport {
+public class ConvertPayloadToInputStreamTest extends BaseJettyTest {
     protected String expectedBody = "<hello>world!</hello>";
 
     @Test
@@ -36,7 +36,7 @@ public class ConvertPayloadToInputStream
         MockEndpoint mockEndpoint = getMockEndpoint("mock:result");
         mockEndpoint.expectedMessageCount(1);
 
-        template.requestBodyAndHeader("http://localhost:9080/test", expectedBody, "Content-Type", "application/xml");
+        template.requestBodyAndHeader("http://localhost:{{port}}/test", expectedBody, "Content-Type", "application/xml");
 
         mockEndpoint.assertIsSatisfied();
         List<Exchange> list = mockEndpoint.getReceivedExchanges();
@@ -55,7 +55,7 @@ public class ConvertPayloadToInputStream
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("jetty:http://localhost:9080/test").
+                from("jetty:http://localhost:{{port}}/test").
                         convertBodyTo(InputStream.class).
                         to("mock:result");
             }

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsRouteTest.java Tue Oct 26 06:25:56 2010
@@ -25,7 +25,6 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
-import org.eclipse.jetty.server.ssl.SslSocketConnector;
 
 public class ExplicitHttpsRouteTest extends HttpsRouteTest {
 
@@ -46,11 +45,14 @@ public class ExplicitHttpsRouteTest exte
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws URISyntaxException {
+                port1 = getPort();
+                port2 = getNextPort();
+
                 // START SNIPPET: e1
                 // create SSL select channel connectors for port 9080 and 9090
                 Map<Integer, SslSelectChannelConnector> connectors = new HashMap<Integer, SslSelectChannelConnector>();
-                connectors.put(9080, createSslSocketConnector());
-                connectors.put(9090, createSslSocketConnector());
+                connectors.put(port1, createSslSocketConnector());
+                connectors.put(port2, createSslSocketConnector());
 
                 // create jetty component
                 JettyHttpComponent jetty = new JettyHttpComponent();
@@ -60,16 +62,16 @@ public class ExplicitHttpsRouteTest exte
                 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/ExplicitJettyRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitJettyRouteTest.java Tue Oct 26 06:25:56 2010
@@ -23,18 +23,17 @@ 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.eclipse.jetty.server.nio.SelectChannelConnector;
 import org.junit.Test;
 
 /**
  * Unit test for wiki demonstration.
  */
-public class ExplicitJettyRouteTest extends CamelTestSupport {
+public class ExplicitJettyRouteTest 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);
@@ -55,7 +54,7 @@ public class ExplicitJettyRouteTest exte
                 // START SNIPPET: e1
                 // create socket connectors for port 9080
                 Map<Integer, SelectChannelConnector> connectors = new HashMap<Integer, SelectChannelConnector>();
-                connectors.put(9080, createSocketConnector());
+                connectors.put(getPort(), createSocketConnector());
 
                 // create jetty component
                 JettyHttpComponent jetty = new JettyHttpComponent();
@@ -65,7 +64,7 @@ public class ExplicitJettyRouteTest exte
                 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/HandlerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HandlerTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HandlerTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HandlerTest.java Tue Oct 26 06:25:56 2010
@@ -24,16 +24,17 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.eclipse.jetty.server.handler.StatisticsHandler;
 import org.junit.Test;
 
-public class HandlerTest extends CamelTestSupport {
+public class HandlerTest extends BaseJettyTest {
     private StatisticsHandler statisticsHandler1 = new StatisticsHandler();
     private StatisticsHandler statisticsHandler2 = new StatisticsHandler();
     private StatisticsHandler statisticsHandler3 = new StatisticsHandler();
 
     private String htmlResponse = "<html><body>Book 123 is Camel in Action</body></html>";
+    private int port1;
+    private int port2;
 
     @Test
     public void testWithOneHandler() throws Exception {
@@ -42,7 +43,7 @@ public class HandlerTest extends CamelTe
         assertEquals(0, statisticsHandler2.getRequests());
         assertEquals(0, statisticsHandler3.getRequests());
         
-        InputStream html = (InputStream) template.requestBody("http://localhost:9080/", "");
+        InputStream html = (InputStream) template.requestBody("http://localhost:" + port1, "");
         BufferedReader br = new BufferedReader(new InputStreamReader(html));
         
         assertEquals(htmlResponse, br.readLine());
@@ -58,7 +59,7 @@ public class HandlerTest extends CamelTe
         assertEquals(0, statisticsHandler2.getRequests());
         assertEquals(0, statisticsHandler3.getRequests());
 
-        InputStream html = (InputStream) template.requestBody("http://localhost:9081/", "");
+        InputStream html = (InputStream) template.requestBody("http://localhost:" + port2, "");
         BufferedReader br = new BufferedReader(new InputStreamReader(html));
         
         assertEquals(htmlResponse, br.readLine());
@@ -80,14 +81,17 @@ public class HandlerTest extends CamelTe
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("jetty:http://localhost:9080/?handlers=#statisticsHandler1")
+                port1 = getPort();
+                port2 = getNextPort();
+
+                from("jetty:http://localhost:" + port1 + "/?handlers=#statisticsHandler1")
                         .process(new Processor() {
                             public void process(Exchange exchange) throws Exception {
                                 exchange.getOut().setBody(htmlResponse);
                             }
                         });
 
-                from("jetty:http://localhost:9081/?handlers=#statisticsHandler2,#statisticsHandler3")
+                from("jetty:http://localhost:" + port2 + "/?handlers=#statisticsHandler2,#statisticsHandler3")
                         .process(new Processor() {
                             public void process(Exchange exchange) throws Exception {
                                 exchange.getOut().setBody(htmlResponse);

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpAuthMethodPriorityTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpAuthMethodPriorityTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpAuthMethodPriorityTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpAuthMethodPriorityTest.java Tue Oct 26 06:25:56 2010
@@ -19,10 +19,8 @@ package org.apache.camel.component.jetty
 import java.io.IOException;
 import java.security.Principal;
 import java.util.Arrays;
-
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.camel.CamelExecutionException;
 import org.apache.camel.Exchange;
 import org.apache.camel.FailedToCreateProducerException;
 import org.apache.camel.Processor;
@@ -30,7 +28,6 @@ import org.apache.camel.RuntimeCamelExce
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.http.HttpOperationFailedException;
 import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.eclipse.jetty.http.security.Constraint;
 import org.eclipse.jetty.security.ConstraintMapping;
 import org.eclipse.jetty.security.ConstraintSecurityHandler;
@@ -42,7 +39,7 @@ import org.junit.Test;
 /**
  * @version $Revision$
  */
-public class HttpAuthMethodPriorityTest extends CamelTestSupport {
+public class HttpAuthMethodPriorityTest extends BaseJettyTest {
 
     @Override
     protected JndiRegistry createRegistry() throws Exception {
@@ -72,20 +69,20 @@ public class HttpAuthMethodPriorityTest 
 
     @Test
     public void testAuthMethodPriorityBasicDigest() throws Exception {
-        String out = template.requestBody("http://localhost:9080/test?authMethod=Basic&authMethodPriority=Basic,Digest&authUsername=donald&authPassword=duck", "Hello World", String.class);
+        String out = template.requestBody("http://localhost:{{port}}/test?authMethod=Basic&authMethodPriority=Basic,Digest&authUsername=donald&authPassword=duck", "Hello World", String.class);
         assertEquals("Bye World", out);
     }
 
     @Test
     public void testAuthMethodPriorityNTLMBasic() throws Exception {
-        String out = template.requestBody("http://localhost:9080/test?authMethod=Basic&authMethodPriority=NTLM,Basic&authUsername=donald&authPassword=duck", "Hello World", String.class);
+        String out = template.requestBody("http://localhost:{{port}}/test?authMethod=Basic&authMethodPriority=NTLM,Basic&authUsername=donald&authPassword=duck", "Hello World", String.class);
         assertEquals("Bye World", out);
     }
 
     @Test
     public void testAuthMethodPriorityInvalid() throws Exception {
         try {
-            template.requestBody("http://localhost:9080/test?authMethod=Basic&authMethodPriority=Basic,foo&authUsername=donald&authPassword=duck", "Hello World", String.class);
+            template.requestBody("http://localhost:{{port}}/test?authMethod=Basic&authMethodPriority=Basic,foo&authUsername=donald&authPassword=duck", "Hello World", String.class);
             fail("Should have thrown an exception");
         } catch (FailedToCreateProducerException e) {
             IllegalArgumentException cause = assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
@@ -96,7 +93,7 @@ public class HttpAuthMethodPriorityTest 
     @Test
     public void testAuthMethodPriorityNTLM() throws Exception {
         try {
-            template.requestBody("http://localhost:9080/test?authMethod=Basic&authMethodPriority=NTLM&authUsername=donald&authPassword=duck", "Hello World", String.class);
+            template.requestBody("http://localhost:{{port}}/test?authMethod=Basic&authMethodPriority=NTLM&authUsername=donald&authPassword=duck", "Hello World", String.class);
         } catch (RuntimeCamelException e) {
             HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
             assertEquals(401, cause.getStatusCode());
@@ -108,7 +105,7 @@ public class HttpAuthMethodPriorityTest 
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty://http://localhost:9080/test?handlers=myAuthHandler")
+                from("jetty://http://localhost:{{port}}/test?handlers=myAuthHandler")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthComponentConfiguredTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthComponentConfiguredTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthComponentConfiguredTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthComponentConfiguredTest.java Tue Oct 26 06:25:56 2010
@@ -19,7 +19,6 @@ package org.apache.camel.component.jetty
 import java.io.IOException;
 import java.security.Principal;
 import java.util.Arrays;
-
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.camel.Exchange;
@@ -29,7 +28,6 @@ import org.apache.camel.component.http.A
 import org.apache.camel.component.http.HttpComponent;
 import org.apache.camel.component.http.HttpConfiguration;
 import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.eclipse.jetty.http.security.Constraint;
 import org.eclipse.jetty.security.ConstraintMapping;
 import org.eclipse.jetty.security.ConstraintSecurityHandler;
@@ -41,7 +39,7 @@ import org.junit.Test;
 /**
  * @version $Revision$
  */
-public class HttpBasicAuthComponentConfiguredTest extends CamelTestSupport {
+public class HttpBasicAuthComponentConfiguredTest extends BaseJettyTest {
 
     @Override
     protected JndiRegistry createRegistry() throws Exception {
@@ -71,7 +69,7 @@ public class HttpBasicAuthComponentConfi
 
     @Test
     public void testHttpBasicAuth() 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("Bye World", out);
     }
 
@@ -88,7 +86,7 @@ public class HttpBasicAuthComponentConfi
                 HttpComponent http = context.getComponent("http", HttpComponent.class);
                 http.setHttpConfiguration(config);
 
-                from("jetty://http://localhost:9080/test?handlers=myAuthHandler")
+                from("jetty://http://localhost:{{port}}/test?handlers=myAuthHandler")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBasicAuthTest.java Tue Oct 26 06:25:56 2010
@@ -40,7 +40,7 @@ import org.junit.Test;
 /**
  * @version $Revision$
  */
-public class HttpBasicAuthTest extends CamelTestSupport {
+public class HttpBasicAuthTest extends BaseJettyTest {
 
     @Override
     protected JndiRegistry createRegistry() throws Exception {
@@ -70,14 +70,14 @@ public class HttpBasicAuthTest extends C
 
     @Test
     public void testHttpBaiscAuth() throws Exception {
-        String out = template.requestBody("http://localhost:9080/test?authMethod=Basic&authUsername=donald&authPassword=duck", "Hello World", String.class);
+        String out = template.requestBody("http://localhost:{{port}}/test?authMethod=Basic&authUsername=donald&authPassword=duck", "Hello World", String.class);
         assertEquals("Bye World", out);
     }
 
     @Test
     public void testHttpBasicAuthInvalidPassword() throws Exception {
         try {
-            template.requestBody("http://localhost:9080/test?authMethod=Basic&authUsername=donald&authPassword=sorry", "Hello World", String.class);
+            template.requestBody("http://localhost:{{port}}/test?authMethod=Basic&authUsername=donald&authPassword=sorry", "Hello World", String.class);
         } catch (RuntimeCamelException e) {
             HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
             assertEquals(401, cause.getStatusCode());
@@ -89,7 +89,7 @@ public class HttpBasicAuthTest extends C
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty://http://localhost:9080/test?handlers=myAuthHandler")
+                from("jetty://http://localhost:{{port}}/test?handlers=myAuthHandler")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             HttpServletRequest req = exchange.getIn().getBody(HttpServletRequest.class);

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBindingPreservePostFormUrlEncodedBodyTest.java Tue Oct 26 06:25:56 2010
@@ -20,14 +20,13 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.http.HttpMethods;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class HttpBindingPreservePostFormUrlEncodedBodyTest extends CamelTestSupport {
+public class HttpBindingPreservePostFormUrlEncodedBodyTest extends BaseJettyTest {
     
     @Test
     public void testSendToJetty() throws Exception {
-        Exchange exchange = template.send("http://localhost:9080/myapp/myservice?query1=a&query2=b", new Processor() {
+        Exchange exchange = template.send("http://localhost:{{port}}/myapp/myservice?query1=a&query2=b", new Processor() {
 
             public void process(Exchange exchange) throws Exception {
                 exchange.getIn().setBody("b1=x&b2=y");
@@ -45,7 +44,7 @@ public class HttpBindingPreservePostForm
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("jetty:http://localhost:9080/myapp/myservice").process(new Processor() {
+                from("jetty:http://localhost:{{port}}/myapp/myservice").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         String body = exchange.getIn().getBody(String.class);
                         

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeMultipartRouteTest.java Tue Oct 26 06:25:56 2010
@@ -16,17 +16,14 @@
  */
 package org.apache.camel.component.jetty;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.http.HttpEndpoint;
 import org.apache.camel.impl.DefaultHeaderFilterStrategy;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.multipart.FilePart;
@@ -35,7 +32,10 @@ import org.apache.commons.httpclient.met
 import org.apache.commons.httpclient.methods.multipart.StringPart;
 import org.junit.Test;
 
-public class HttpBridgeMultipartRouteTest extends CamelTestSupport {
+public class HttpBridgeMultipartRouteTest extends BaseJettyTest {
+
+    private int port1;
+    private int port2;
 
     private class MultipartHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
         public MultipartHeaderFilterStrategy() {
@@ -54,7 +54,7 @@ public class HttpBridgeMultipartRouteTes
         String body = "TEST";
         Part[] parts = new Part[] {new StringPart("body", body), new FilePart(jpg.getName(), jpg)};
         
-        PostMethod method = new PostMethod("http://localhost:9090/test/hello");
+        PostMethod method = new PostMethod("http://localhost:" + port2 + "/test/hello");
         MultipartRequestEntity requestEntity = new MultipartRequestEntity(parts, method.getParams());
         method.setRequestEntity(requestEntity);
         
@@ -71,6 +71,9 @@ public class HttpBridgeMultipartRouteTes
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
+                port1 = getPort();
+                port2 = getNextPort();
+
                 errorHandler(noErrorHandler());
 
                 Processor serviceProc = new Processor() {
@@ -82,13 +85,13 @@ public class HttpBridgeMultipartRouteTes
                     }
                 };
                 
-                HttpEndpoint epOut = (HttpEndpoint) getContext().getEndpoint("http://localhost:9080?bridgeEndpoint=true&throwExceptionOnFailure=false");
+                HttpEndpoint epOut = (HttpEndpoint) getContext().getEndpoint("http://localhost:" + port1 + "?bridgeEndpoint=true&throwExceptionOnFailure=false");
                 epOut.setHeaderFilterStrategy(new MultipartHeaderFilterStrategy());
                 
-                from("jetty:http://localhost:9090/test/hello?enableMultipartFilter=false")
+                from("jetty:http://localhost:" + port2 + "/test/hello?enableMultipartFilter=false")
                     .to(epOut);
                 
-                from("jetty://http://localhost:9080?matchOnUriPrefix=true").process(serviceProc);
+                from("jetty://http://localhost:" + port1 + "?matchOnUriPrefix=true").process(serviceProc);
             }
         };
     }    

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpBridgeRouteTest.java Tue Oct 26 06:25:56 2010
@@ -22,21 +22,24 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class HttpBridgeRouteTest extends CamelTestSupport {
+public class HttpBridgeRouteTest extends BaseJettyTest {
+
+    private int port1;
+    private int port2;
 
     @Test
     public void testHttpClient() throws Exception {
-        String response = template.requestBodyAndHeader("http://localhost:9090/test/hello", new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml", String.class);
+        String response = template.requestBodyAndHeader("http://localhost:" + port2 + "/test/hello",
+                new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml", String.class);
         assertEquals("Get a wrong response", "/", response);
         
-        response = template.requestBody("http://localhost:9080/hello/world", "hello", String.class);
+        response = template.requestBody("http://localhost:" + port1 + "/hello/world", "hello", String.class);
         assertEquals("Get a wrong response", "/hello/world", response);
         
         try {
-            template.requestBody("http://localhost:9090/hello/world", "hello", String.class);
+            template.requestBody("http://localhost:" + port2 + "/hello/world", "hello", String.class);
             fail("Expect exception here!");
         } catch (Exception ex) {
             assertTrue("We should get a RuntimeCamelException", ex instanceof RuntimeCamelException);
@@ -46,6 +49,9 @@ public class HttpBridgeRouteTest extends
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
+                port1 = getPort();
+                port2 = getNextPort();
+
                 errorHandler(noErrorHandler());
 
                 Processor serviceProc = new Processor() {
@@ -55,10 +61,10 @@ public class HttpBridgeRouteTest extends
                         exchange.getOut().setBody(uri);
                     }
                 };
-                from("jetty:http://localhost:9090/test/hello")
-                    .to("http://localhost:9080?throwExceptionOnFailure=false&bridgeEndpoint=true");
+                from("jetty:http://localhost:" + port2 + "/test/hello")
+                    .to("http://localhost:" + port1 + "?throwExceptionOnFailure=false&bridgeEndpoint=true");
                 
-                from("jetty://http://localhost:9080?matchOnUriPrefix=true").process(serviceProc);
+                from("jetty://http://localhost:" + port1 + "?matchOnUriPrefix=true").process(serviceProc);
             }
         };
     }    

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpCharacterEncodingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpCharacterEncodingTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpCharacterEncodingTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpCharacterEncodingTest.java Tue Oct 26 06:25:56 2010
@@ -16,20 +16,16 @@
  */
 package org.apache.camel.component.jetty;
 
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.jetty.JettyRouteTest.MyBookService;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class HttpCharacterEncodingTest extends CamelTestSupport {
+public class HttpCharacterEncodingTest extends BaseJettyTest {
     
     @Test
     public void testSendToJetty() throws Exception {
-        Exchange exchange = template.send("http://localhost:9080/myapp/myservice", new Processor() {
+        Exchange exchange = template.send("http://localhost:{{port}}/myapp/myservice", new Processor() {
 
             public void process(Exchange exchange) throws Exception {
                 exchange.getIn().setBody("Hello World Thai Elephant \u0E08");
@@ -46,12 +42,11 @@ public class HttpCharacterEncodingTest e
     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());
             }
         };
     }
 
-    
     public class MyBookService implements Processor {
         public void process(Exchange exchange) throws Exception {
             // just get the body as a string

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteEnableChunkedTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteEnableChunkedTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteEnableChunkedTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteEnableChunkedTest.java Tue Oct 26 06:25:56 2010
@@ -14,11 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jetty;
 
 import java.io.ByteArrayInputStream;
-import java.io.InputStream;
 import java.util.List;
 import java.util.Map;
 
@@ -27,10 +25,9 @@ import org.apache.camel.Message;
 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;
 
-public class HttpClientRouteEnableChunkedTest extends CamelTestSupport {
+public class HttpClientRouteEnableChunkedTest extends BaseJettyTest {
 
     @Test
     public void testHttpRouteWithOption() throws Exception {
@@ -70,7 +67,7 @@ public class HttpClientRouteEnableChunke
             public void configure() {
                 errorHandler(noErrorHandler());
                 
-                from("direct:start2").to("http://localhost:9081/hello").to("mock:a");
+                from("direct:start2").to("http://localhost:{{port}}/hello").to("mock:a");
                 
                 Processor proc = new Processor() {
                     public void process(Exchange exchange) throws Exception {
@@ -79,10 +76,9 @@ public class HttpClientRouteEnableChunke
                     }
                 };
                 
-                from("jetty:http://localhost:9081/hello").process(proc);
+                from("jetty:http://localhost:{{port}}/hello").process(proc);
             }
         };
     }    
-  
 
 }

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpClientRouteTest.java Tue Oct 26 06:25:56 2010
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.jetty;
 
 import java.io.ByteArrayInputStream;
@@ -27,10 +26,12 @@ import org.apache.camel.Message;
 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;
 
-public class HttpClientRouteTest extends CamelTestSupport {
+public class HttpClientRouteTest extends BaseJettyTest {
+
+    private int port1;
+    private int port2;
 
     @Test
     public void testHttpRouteWithMessageHeader() throws Exception {
@@ -75,7 +76,6 @@ public class HttpClientRouteTest extends
         
         template.sendBody("direct:start3", null);
         mockEndpoint.assertIsSatisfied();        
-        
     }
     
     @Test
@@ -85,12 +85,14 @@ public class HttpClientRouteTest extends
         
         template.sendBody("direct:start4", "test");
         mockEndpoint.assertIsSatisfied();        
-        
     }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
+                port1 = getPort();
+                port2 = getNextPort();
+
                 errorHandler(noErrorHandler());
 
                 Processor clientProc = new Processor() {
@@ -99,10 +101,10 @@ public class HttpClientRouteTest extends
                     }
                 };
                 
-                from("direct:start").to("http://localhost:9080/hello").process(clientProc).convertBodyTo(String.class).to("mock:a");
-                from("direct:start2").to("http://localhost:9081/hello").to("mock:a");
-                from("direct:start3").to("http://localhost:9081/Query%20/test?myQuery=%40%20query").to("mock:a");
-                from("direct:start4").setHeader(Exchange.HTTP_QUERY, simple("id=${body}")).to("http://localhost:9081/querystring").to("mock:a");
+                from("direct:start").to("http://localhost:" + port1 + "/hello").process(clientProc).convertBodyTo(String.class).to("mock:a");
+                from("direct:start2").to("http://localhost:" + port2 + "/hello").to("mock:a");
+                from("direct:start3").to("http://localhost:" + port2 + "/Query%20/test?myQuery=%40%20query").to("mock:a");
+                from("direct:start4").setHeader(Exchange.HTTP_QUERY, simple("id=${body}")).to("http://localhost:" + port2 + "/querystring").to("mock:a");
                 
                 Processor proc = new Processor() {
                     public void process(Exchange exchange) throws Exception {
@@ -110,33 +112,27 @@ public class HttpClientRouteTest extends
                         exchange.getOut().setBody(bis);
                     }
                 };
-                from("jetty:http://localhost:9080/hello").process(proc).setHeader(Exchange.HTTP_CHUNKED).constant(false);
+                from("jetty:http://localhost:" + port1 + "/hello").process(proc).setHeader(Exchange.HTTP_CHUNKED).constant(false);
                 
-                from("jetty:http://localhost:9081/hello?chunked=false").process(proc);
+                from("jetty:http://localhost:" + port2 + "/hello?chunked=false").process(proc);
                 
-                from("jetty:http://localhost:9081/Query%20/test").process(new Processor() {
-
+                from("jetty:http://localhost:" + port2 + "/Query%20/test").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         exchange.getOut().setBody(exchange.getIn().getHeader("myQuery", String.class));                        
                     }
-                    
                 });
                 
-                from("jetty:http://localhost:9081/querystring").process(new Processor() {
-
+                from("jetty:http://localhost:" + port2 + "/querystring").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
-                        
                         String result = exchange.getIn().getHeader("id", String.class);
                         if (result == null) {
                             result = "No id header";
                         }
                         exchange.getOut().setBody(result);
                     }
-                    
                 });
             }
         };
     }    
-  
 
 }

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpConverterTest.java Tue Oct 26 06:25:56 2010
@@ -22,18 +22,16 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.http.HttpConverter;
 import org.apache.camel.component.http.HttpMessage;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version $Revision$
  */
-public class HttpConverterTest extends CamelTestSupport {
+public class HttpConverterTest extends BaseJettyTest {
 
     @Override
     public boolean isUseRouteBuilder() {
@@ -45,7 +43,7 @@ public class HttpConverterTest extends C
         context.addRoutes(new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty://http://localhost:9080/test")
+                from("jetty://http://localhost:{{port}}/test")
                         // add this node to make sure the convert can work within DefaultMessageImpl
                         .convertBodyTo(String.class)             
                         .process(new Processor() {
@@ -62,7 +60,7 @@ public class HttpConverterTest extends C
         });
         context.start();
 
-        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("Bye World", out);
     }
 
@@ -71,7 +69,7 @@ public class HttpConverterTest extends C
         context.addRoutes(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 {
                                 HttpMessage msg = exchange.getIn(HttpMessage.class);
@@ -89,7 +87,7 @@ public class HttpConverterTest extends C
         });
         context.start();
 
-        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("Bye World", out);
     }
 
@@ -98,7 +96,7 @@ public class HttpConverterTest extends C
         context.addRoutes(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 {
                                 HttpMessage msg = exchange.getIn(HttpMessage.class);
@@ -114,7 +112,7 @@ public class HttpConverterTest extends C
         });
         context.start();
 
-        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("Bye World", out);
     }
 

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpFilterCamelHeadersTest.java Tue Oct 26 06:25:56 2010
@@ -22,17 +22,16 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version $Revision$
  */
-public class HttpFilterCamelHeadersTest extends CamelTestSupport {
+public class HttpFilterCamelHeadersTest extends BaseJettyTest {
 
     @Test
     public void testFilterCamelHeaders() throws Exception {
-        Exchange out = template.send("http://localhost:9090/test/filter", new Processor() {
+        Exchange out = template.send("http://localhost:{{port}}/test/filter", new Processor() {
             public void process(Exchange exchange) throws Exception {
                 exchange.getIn().setBody("Claus");
                 exchange.getIn().setHeader("bar", 123);
@@ -66,7 +65,7 @@ public class HttpFilterCamelHeadersTest 
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty:http://localhost:9090/test/filter").beanRef("foo");
+                from("jetty:http://localhost:{{port}}/test/filter").beanRef("foo");
             }
         };
     }

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGZipEncodingTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGZipEncodingTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGZipEncodingTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpGZipEncodingTest.java Tue Oct 26 06:25:56 2010
@@ -17,56 +17,62 @@
 package org.apache.camel.component.jetty;
 
 import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.ExpressionBuilder;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class HttpGZipEncodingTest extends CamelTestSupport {
+public class HttpGZipEncodingTest extends BaseJettyTest {
     
+    private int port1;
+    private int port2;
+
     @Test
     public void testHttpProducerWithGzip() throws Exception {
-        String response = template.requestBodyAndHeader("http://localhost:9081/gzip", new ByteArrayInputStream("<Hello>World</Hello>".getBytes()), Exchange.CONTENT_ENCODING, "gzip", String.class);
+        String response = template.requestBodyAndHeader("http://localhost:" + port1 + "/gzip",
+                new ByteArrayInputStream("<Hello>World</Hello>".getBytes()), Exchange.CONTENT_ENCODING, "gzip", String.class);
         assertEquals("The response is wrong", "<b>Hello World</b>", response);
     }
     
     @Test
     public void testGzipProxy() throws Exception {
         String response = 
-            template.requestBodyAndHeader("http://localhost:9084/route", new ByteArrayInputStream("<Hello>World</Hello>".getBytes()), Exchange.CONTENT_ENCODING, "gzip", String.class);
+            template.requestBodyAndHeader("http://localhost:" + port2 + "/route",
+                    new ByteArrayInputStream("<Hello>World</Hello>".getBytes()), Exchange.CONTENT_ENCODING, "gzip", String.class);
         assertEquals("The response is wrong", "<b>Hello World</b>", response);
     }
     
     @Test
     public void testGzipProducerWithGzipData() throws Exception {
-        String response = template.requestBodyAndHeader("direct:gzip", new ByteArrayInputStream("<Hello>World</Hello>".getBytes()), Exchange.CONTENT_ENCODING, "gzip", String.class);
+        String response = template.requestBodyAndHeader("direct:gzip",
+                new ByteArrayInputStream("<Hello>World</Hello>".getBytes()), Exchange.CONTENT_ENCODING, "gzip", String.class);
         assertEquals("The response is wrong", "<b>Hello World</b>", response);
     }
     
     @Test
     public void testGzipGet() throws Exception {
-        String response = template.requestBodyAndHeader("http://localhost:9081/gzip", null, "Accept-Encoding", "gzip", String.class);
+        String response = template.requestBodyAndHeader("http://localhost:" + port1 + "/gzip",
+                null, "Accept-Encoding", "gzip", String.class);
         assertEquals("The response is wrong", "<b>Hello World for gzip</b>", response);
     }
     
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
+                port1 = getPort();
+                port2 = getNextPort();
+
                 errorHandler(noErrorHandler());
                 
                 from("direct:gzip")
                     .marshal().gzip()
                         .setProperty(Exchange.SKIP_GZIP_ENCODING, ExpressionBuilder.constantExpression(Boolean.TRUE))
-                        .to("http://localhost:9081/gzip").unmarshal().gzip();
+                        .to("http://localhost:" + port1 + "/gzip").unmarshal().gzip();
                 
-                from("jetty:http://localhost:9081/gzip").process(new Processor() {
-
+                from("jetty:http://localhost:" + port1 + "/gzip").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         // check the request method
                         HttpServletRequest request = exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST, HttpServletRequest.class);
@@ -82,15 +88,11 @@ public class HttpGZipEncodingTest extend
                         } else {                            
                             exchange.getOut().setBody("<b>Hello World</b>");
                         }
-                        
-                        
                     }
-                    
                 });
                 
-                from("jetty:http://localhost:9084/route?bridgeEndpoint=true").to("http://localhost:9081/gzip?bridgeEndpoint=true");
-                
-                
+                from("jetty:http://localhost:" + port2 + "/route?bridgeEndpoint=true")
+                    .to("http://localhost:" + port1 + "/gzip?bridgeEndpoint=true");
             }
         };
     }

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderCaseTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderCaseTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderCaseTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderCaseTest.java Tue Oct 26 06:25:56 2010
@@ -22,18 +22,17 @@ import java.util.Map;
 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.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.junit.Test;
 
-public class HttpHeaderCaseTest extends CamelTestSupport {
+public class HttpHeaderCaseTest extends BaseJettyTest {
 
     @Test
     public void testHttpHeaderCase() throws Exception {
         HttpClient client = new HttpClient();
-        HttpMethod method = new PostMethod("http://localhost:9080/myapp/mytest");
+        HttpMethod method = new PostMethod("http://localhost:" + getPort() + "/myapp/mytest");
 
         method.setRequestHeader("clientHeader", "fooBAR");
         method.setRequestHeader("OTHER", "123");
@@ -50,7 +49,7 @@ public class HttpHeaderCaseTest extends 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("jetty:http://localhost:9080/myapp/mytest").process(new Processor() {
+                from("jetty:http://localhost:{{port}}/myapp/mytest").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
 
                         // headers received should be in case as well
@@ -67,7 +66,6 @@ public class HttpHeaderCaseTest extends 
                         exchange.getOut().setHeader("otherCaseHeader", "456DEf");
                     }
                 });
-
             }
         };
     }

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpHeaderTest.java Tue Oct 26 06:25:56 2010
@@ -18,27 +18,19 @@ package org.apache.camel.component.jetty
 
 import java.util.Map;
 import java.util.Map.Entry;
-
 import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
 
-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.component.jetty.JettyContentTypeTest.MyBookService;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.ExchangeHelper;
-import org.apache.camel.util.MessageHelper;
 import org.junit.Test;
 
-public class HttpHeaderTest extends CamelTestSupport {
+public class HttpHeaderTest extends BaseJettyTest {
 
     @Test
     public void testHttpHeaders() throws Exception {
         String result = template.requestBody("direct:start", "hello", String.class);
         assertEquals("Should send a right http header to the server.", "Find the key!", result);
-       
     }
 
     @Override
@@ -48,10 +40,9 @@ public class HttpHeaderTest extends Came
                 from("direct:start").setHeader("SOAPAction", constant("http://xxx.com/interfaces/ticket"))
                     .setHeader("Content-Type", constant("text/xml; charset=utf-8"))
                     .setHeader(Exchange.HTTP_PROTOCOL_VERSION, constant("HTTP/1.0"))
-                    .to("http://localhost:9080/myapp/mytest");
-
-                from("jetty:http://localhost:9080/myapp/mytest").process(new Processor() {
+                    .to("http://localhost:{{port}}/myapp/mytest");
 
+                from("jetty:http://localhost:{{port}}/myapp/mytest").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         Map<String, Object> headers = exchange.getIn().getHeaders();
                         ServletRequest request = exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST, ServletRequest.class);
@@ -65,7 +56,6 @@ public class HttpHeaderTest extends Came
                         }
                         exchange.getOut().setBody("Cannot find the key!");
                     }
-
                 });
 
             }

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpOperationsFailedExceptionUriTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpOperationsFailedExceptionUriTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpOperationsFailedExceptionUriTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpOperationsFailedExceptionUriTest.java Tue Oct 26 06:25:56 2010
@@ -21,23 +21,22 @@ 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 HttpOperationsFailedExceptionUriTest extends CamelTestSupport {
+public class HttpOperationsFailedExceptionUriTest extends BaseJettyTest {
 
     @Test
     public void testHttpOperationsFailedExceptionUri() throws Exception {
         try {
-            template.requestBodyAndHeader("http://localhost:9080/foo?bar=123", null, "foo", 123);
+            template.requestBodyAndHeader("http://localhost:{{port}}/foo?bar=123", null, "foo", 123);
             fail("Should have thrown an exception");
         } catch (RuntimeCamelException e) {
             HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause());
             assertEquals(500, cause.getStatusCode());
-            assertEquals("http://localhost:9080/foo?bar=123", cause.getUri());
+            assertEquals("http://localhost:" + getPort() + "/foo?bar=123", cause.getUri());
         }
     }
 
@@ -46,7 +45,7 @@ public class HttpOperationsFailedExcepti
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty://http://localhost:9080/foo")
+                from("jetty://http://localhost:{{port}}/foo")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 500);

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingConsumerTest.java Tue Oct 26 06:25:56 2010
@@ -20,30 +20,29 @@ import java.net.SocketTimeoutException;
 
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version $Revision$
  */
-public class HttpPollingConsumerTest extends CamelTestSupport {
+public class HttpPollingConsumerTest extends BaseJettyTest {
 
     @Test
     public void testReceive() throws Exception {
-        String body = consumer.receiveBody("http://localhost:9444/test", String.class);
+        String body = consumer.receiveBody("http://localhost:{{port}}/test", String.class);
         assertEquals("Bye World", body);
     }
 
     @Test
     public void testReceiveTimeout() throws Exception {
-        String body = consumer.receiveBody("http://localhost:9444/test", 5000, String.class);
+        String body = consumer.receiveBody("http://localhost:{{port}}/test", 5000, String.class);
         assertEquals("Bye World", body);
     }
 
     @Test
     public void testReceiveTimeoutTriggered() throws Exception {
         try {
-            consumer.receiveBody("http://localhost:9444/test", 250, String.class);
+            consumer.receiveBody("http://localhost:{{port}}/test", 250, String.class);
             fail("Should have thrown an exception");
         } catch (RuntimeCamelException e) {
             assertIsInstanceOf(SocketTimeoutException.class, e.getCause());
@@ -55,7 +54,7 @@ public class HttpPollingConsumerTest ext
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty://http://localhost:9444/test")
+                from("jetty://http://localhost:{{port}}/test")
                     .delay(2000).transform(constant("Bye World"));
             }
         };

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingGetTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingGetTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingGetTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpPollingGetTest.java Tue Oct 26 06:25:56 2010
@@ -24,13 +24,12 @@ import org.apache.camel.Message;
 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 HttpPollingGetTest extends CamelTestSupport {
+public class HttpPollingGetTest extends BaseJettyTest {
 
     protected String expectedText = "<html";
 
@@ -63,9 +62,9 @@ public class HttpPollingGetTest extends 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("http://localhost:5431/myservice?delay=5000").to("mock:results");
+                from("http://localhost:{{port}}/myservice?delay=5000").to("mock:results");
 
-                from("jetty:http://localhost:5431/myservice").process(new Processor() {
+                from("jetty:http://localhost:{{port}}/myservice").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         exchange.getOut().setBody("<html>Bye World</html>");
                     }

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerByteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerByteTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerByteTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerByteTest.java Tue Oct 26 06:25:56 2010
@@ -17,18 +17,17 @@
 package org.apache.camel.component.jetty;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version $Revision$
  */
-public class HttpProducerByteTest extends CamelTestSupport {
+public class HttpProducerByteTest extends BaseJettyTest {
 
     @Test
     public void testHttpProducerByteTest() throws Exception {
         byte[] data = "Hello World".getBytes();
-        String out = template.requestBody("http://localhost:9080/test", data, String.class);
+        String out = template.requestBody("http://localhost:{{port}}/test", data, String.class);
         assertEquals("Bye World", out);
     }
 
@@ -37,7 +36,7 @@ public class HttpProducerByteTest extend
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty://http://localhost:9080/test").transform(constant("Bye World"));
+                from("jetty://http://localhost:{{port}}/test").transform(constant("Bye World"));
             }
         };
     }

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerConcurrentTest.java Tue Oct 26 06:25:56 2010
@@ -26,7 +26,6 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
@@ -34,7 +33,7 @@ import org.junit.Test;
  *
  * @version $Revision$
  */
-public class HttpProducerConcurrentTest extends CamelTestSupport {
+public class HttpProducerConcurrentTest extends BaseJettyTest {
 
     @Test
     public void testNoConcurrentProducers() throws Exception {
@@ -56,7 +55,7 @@ public class HttpProducerConcurrentTest 
             final int index = i;
             Future out = executor.submit(new Callable<Object>() {
                 public Object call() throws Exception {
-                    return template.requestBody("http://localhost:9080/echo", "" + index, String.class);
+                    return template.requestBody("http://localhost:{{port}}/echo", "" + index, String.class);
                 }
             });
             responses.put(index, out);
@@ -81,7 +80,7 @@ public class HttpProducerConcurrentTest 
         return new RouteBuilder() {
             public void configure() throws Exception {
                 // expose a echo service
-                from("jetty:http://localhost:9080/echo")
+                from("jetty:http://localhost:{{port}}/echo")
                     .transform(body().append(body())).to("mock:result");
             }
         };

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerJMXBeansIssueTest.java Tue Oct 26 06:25:56 2010
@@ -21,7 +21,6 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.junit.Test;
@@ -29,7 +28,7 @@ import org.junit.Test;
 /**
  * @version $Revision$
  */
-public class HttpProducerJMXBeansIssueTest extends CamelTestSupport {
+public class HttpProducerJMXBeansIssueTest extends BaseJettyTest {
 
     private static final Log LOG = LogFactory.getLog(HttpProducerJMXBeansIssueTest.class);
 
@@ -46,7 +45,7 @@ public class HttpProducerJMXBeansIssueTe
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty:http://localhost:9080/leak").transform(constant("Bye World"));
+                from("jetty:http://localhost:{{port}}/leak").transform(constant("Bye World"));
 
                 from("direct:leak").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
@@ -71,7 +70,7 @@ public class HttpProducerJMXBeansIssueTe
 
         for (int i = 0; i < 10000; i++) {
             Exchange ex = ep.createExchange();
-            ex.getIn().setHeader("url", "http://localhost:9080/leak?id=" + i);
+            ex.getIn().setHeader("url", "http://localhost:{{port}}/leak?id=" + i);
             p.process(ex);
         }
 

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java?rev=1027376&r1=1027375&r2=1027376&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java (original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerSOTimeoutTest.java Tue Oct 26 06:25:56 2010
@@ -21,7 +21,6 @@ import java.net.SocketTimeoutException;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
@@ -29,14 +28,14 @@ import org.junit.Test;
  *
  * @version $Revision$
  */
-public class HttpProducerSOTimeoutTest extends CamelTestSupport {
+public class HttpProducerSOTimeoutTest extends BaseJettyTest {
 
     @Test
     public void testSendWithSOTimeoutNoTimeout() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
 
-        String out = template.requestBody("http://localhost:9080/myservice?httpClient.soTimeout=5000", null, String.class);
+        String out = template.requestBody("http://localhost:{{port}}/myservice?httpClient.soTimeout=5000", null, String.class);
         assertEquals("Bye World", out);
 
         assertMockEndpointsSatisfied();
@@ -49,7 +48,7 @@ public class HttpProducerSOTimeoutTest e
 
         try {
             // we use a timeout of 1 second
-            template.requestBody("http://localhost:9080/myservice?httpClient.soTimeout=1000", null, String.class);
+            template.requestBody("http://localhost:{{port}}/myservice?httpClient.soTimeout=1000", null, String.class);
             fail("Should throw an exception");
         } catch (RuntimeCamelException e) {
             assertIsInstanceOf(SocketTimeoutException.class, e.getCause());
@@ -63,7 +62,7 @@ public class HttpProducerSOTimeoutTest e
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("jetty://http://localhost:9080/myservice")
+                from("jetty://http://localhost:{{port}}/myservice")
                     // but we wait for 2 sec before reply is sent back
                     .delay(2000)
                     .transform().constant("Bye World").to("mock:result");



Mime
View raw message