camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r1395382 - in /camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty: ./ jettyproducer/
Date Sun, 07 Oct 2012 20:46:13 GMT
Author: cmueller
Date: Sun Oct  7 20:46:12 2012
New Revision: 1395382

URL: http://svn.apache.org/viewvc?rev=1395382&view=rev
Log:
simplyfied the junit test

Modified:
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/BaseJettyTest.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/ExplicitHttpsSslContextParametersRouteTest.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/HttpsRouteSslContextParametersInComponentTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInUriTest.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/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerSslContextInUriTest.java

Modified: 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=1395382&r1=1395381&r2=1395382&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/BaseJettyTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/BaseJettyTest.java
Sun Oct  7 20:46:12 2012
@@ -25,10 +25,8 @@ import org.apache.camel.test.AvailablePo
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.BeforeClass;
 
-/**
- * @version
- */
 public abstract class BaseJettyTest extends CamelTestSupport {
+
     private static volatile int port;
 
     @BeforeClass
@@ -56,11 +54,14 @@ public abstract class BaseJettyTest exte
     }
 
     protected int getNextPort() {
-        port = AvailablePortFinder.getNextAvailable(port + 1);
-        return port;
+        return AvailablePortFinder.getNextAvailable(port + 1);
+    }
+
+    protected int getNextPort(int startWithPort) {
+        return AvailablePortFinder.getNextAvailable(startWithPort);
     }
 
-    protected int getPort() {
+    protected static int getPort() {
         return port;
     }
 

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=1395382&r1=1395381&r2=1395382&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
Sun Oct  7 20:46:12 2012
@@ -45,9 +45,6 @@ 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>();

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java?rev=1395382&r1=1395381&r2=1395382&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/ExplicitHttpsSslContextParametersRouteTest.java
Sun Oct  7 20:46:12 2012
@@ -55,9 +55,6 @@ public class ExplicitHttpsSslContextPara
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                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>();

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=1395382&r1=1395381&r2=1395382&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
Sun Oct  7 20:46:12 2012
@@ -29,9 +29,6 @@ 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");

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=1395382&r1=1395381&r2=1395382&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
Sun Oct  7 20:46:12 2012
@@ -47,9 +47,6 @@ public class HttpsRouteSetupWithSystemPr
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                port1 = getPort();
-                port2 = getNextPort();
-
                 from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
 
                 Processor proc = new Processor() {

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java?rev=1395382&r1=1395381&r2=1395382&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInComponentTest.java
Sun Oct  7 20:46:12 2012
@@ -31,9 +31,6 @@ public class HttpsRouteSslContextParamet
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws URISyntaxException {
-                port1 = getPort();
-                port2 = getNextPort();
-
                 // create jetty component
                 JettyHttpComponent jetty = new JettyHttpComponent();
                 

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInUriTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInUriTest.java?rev=1395382&r1=1395381&r2=1395382&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInUriTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpsRouteSslContextParametersInUriTest.java
Sun Oct  7 20:46:12 2012
@@ -51,9 +51,6 @@ public class HttpsRouteSslContextParamet
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws URISyntaxException {
-                port1 = getPort();
-                port2 = getNextPort();
-
                 // create jetty component
                 JettyHttpComponent jetty = new JettyHttpComponent();
                 

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=1395382&r1=1395381&r2=1395382&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
Sun Oct  7 20:46:12 2012
@@ -38,7 +38,9 @@ import org.junit.Before;
 import org.junit.Test;
 
 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();
@@ -52,6 +54,9 @@ public class HttpsRouteTest extends Base
     @Override
     @Before
     public void setUp() throws Exception {
+        port1 = getNextPort();
+        port2 = getNextPort(port1 + 1);
+        
         super.setUp();
         // ensure jsse clients can validate the self signed dummy localhost cert, 
         // use the server keystore as the trust store for these tests
@@ -169,9 +174,6 @@ public class HttpsRouteTest extends Base
     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);
                 componentJetty.setSslKeyPassword(pwd);

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=1395382&r1=1395381&r2=1395382&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
Sun Oct  7 20:46:12 2012
@@ -31,9 +31,6 @@ 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");

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java?rev=1395382&r1=1395381&r2=1395382&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerRouteSetupWithSystemPropsTest.java
Sun Oct  7 20:46:12 2012
@@ -53,9 +53,6 @@ public class JettyHttpsProducerRouteSetu
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                port1 = getPort();
-                port2 = getNextPort();
-
                 from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
 
                 Processor proc = new Processor() {

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerSslContextInUriTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerSslContextInUriTest.java?rev=1395382&r1=1395381&r2=1395382&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerSslContextInUriTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpsProducerSslContextInUriTest.java
Sun Oct  7 20:46:12 2012
@@ -64,12 +64,8 @@ public class JettyHttpsProducerSslContex
     
     @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);
                 componentJetty.setSslKeyPassword(pwd);



Mime
View raw message