camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/4] camel git commit: CAMEL-10133 - Use lumberjack for SSL too, remove lumberjacks
Date Fri, 15 Jul 2016 07:09:54 GMT
Repository: camel
Updated Branches:
  refs/heads/master 920a88d2c -> f496aac76


CAMEL-10133 - Use lumberjack for SSL too, remove lumberjacks


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

Branch: refs/heads/master
Commit: 12dcc564673c26b49102876f1e075db7ac944f1c
Parents: 3d0379d
Author: Antoine DESSAIGNE <antoine.dessaigne@gmail.com>
Authored: Mon Jul 11 10:24:09 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jul 15 08:59:27 2016 +0200

----------------------------------------------------------------------
 .../src/main/docs/lumberjack.adoc               |   6 +-
 .../lumberjack/LumberjackComponent.java         |   9 +-
 .../lumberjack/LumberjackConsumer.java          |   2 +-
 .../lumberjack/LumberjackEndpoint.java          |  25 +++--
 .../lumberjack/LumberjacksComponent.java        |  31 ------
 .../lumberjack/LumberjacksEndpoint.java         |  45 --------
 .../org/apache/camel/component/lumberjacks      |  17 ---
 .../lumberjack/LumberjackComponentSSLTest.java  | 109 +++++++++++++++++++
 .../lumberjack/LumberjackComponentTest.java     |   2 +-
 .../lumberjack/LumberjacksComponentTest.java    | 109 -------------------
 docs/user-manual/en/SUMMARY.md                  |   1 +
 11 files changed, 137 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/main/docs/lumberjack.adoc
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/docs/lumberjack.adoc b/components/camel-lumberjack/src/main/docs/lumberjack.adoc
index 51c2fca..8d87a21 100644
--- a/components/camel-lumberjack/src/main/docs/lumberjack.adoc
+++ b/components/camel-lumberjack/src/main/docs/lumberjack.adoc
@@ -30,7 +30,6 @@ URI format
 ------------------------------------
 lumberjack:host
 lumberjack:host:port
-lumberjacks:host:port?sslContextParameters=#ssl
 ------------------------------------
 
 You can append query options to the URI in the following format,
@@ -47,8 +46,9 @@ The Lumberjack component has no options.
 
 
 
+
 // endpoint options: START
-The Lumberjack component supports 6 endpoint options which are listed below:
+The Lumberjack component supports 7 endpoint options which are listed below:
 
 {% raw %}
 [width="100%",cols="2s,1,1m,1m,5",options="header"]
@@ -56,6 +56,7 @@ The Lumberjack component supports 6 endpoint options which are listed below:
 | Name | Group | Default | Java Type | Description
 | host | common |  | String | *Required* Network interface on which to listen for Lumberjack
 | port | common | 5044 | int | Network port on which to listen for Lumberjack
+| sslContextParameters | common |  | SSLContextParameters | SSL configuration
 | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the
Camel routing Error Handler which mean any exceptions occurred while the consumer is trying
to pickup incoming messages or the likes will now be processed as a message and handled by
the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler
to deal with exceptions that will be logged at WARN/ERROR level and ignored.
 | exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use
a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options
is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR
level and ignored.
 | exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern
when creating an exchange
@@ -66,6 +67,7 @@ The Lumberjack component supports 6 endpoint options which are listed below:
 
 
 
+
 [[Lumberjack-Result]]
 Result
 ^^^^^^

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
index 1cb9dda..83e9e4e 100644
--- a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackComponent.java
@@ -24,7 +24,7 @@ import org.apache.camel.impl.UriEndpointComponent;
 /**
  * The class is the Camel component for the Lumberjack server
  */
-public class LumberjackComponent extends UriEndpointComponent {
+public final class LumberjackComponent extends UriEndpointComponent {
     static final int DEFAULT_PORT = 5044;
 
     public LumberjackComponent() {
@@ -49,12 +49,9 @@ public class LumberjackComponent extends UriEndpointComponent {
             port = DEFAULT_PORT;
         }
 
-        Endpoint answer = createEndpoint(uri, host, port);
+        // Create the endpoint
+        Endpoint answer = new LumberjackEndpoint(uri, this, host, port);
         setProperties(answer, parameters);
         return answer;
     }
-
-    protected LumberjackEndpoint createEndpoint(String uri, String host, int port) {
-        return new LumberjackEndpoint(uri, this, host, port);
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackConsumer.java
b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackConsumer.java
index affdaaf..fd3fc78 100644
--- a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackConsumer.java
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackConsumer.java
@@ -26,7 +26,7 @@ import org.apache.camel.component.lumberjack.io.LumberjackServer;
 import org.apache.camel.impl.DefaultConsumer;
 import org.apache.camel.util.concurrent.CamelThreadFactory;
 
-class LumberjackConsumer extends DefaultConsumer {
+final class LumberjackConsumer extends DefaultConsumer {
     private final LumberjackServer lumberjackServer;
 
     LumberjackConsumer(LumberjackEndpoint endpoint, Processor processor, String host, int
port, SSLContext sslContext) {

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
index 0b0d37e..0db9dbd 100644
--- a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
+++ b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjackEndpoint.java
@@ -5,9 +5,9 @@
  * 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
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * 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.
@@ -16,20 +16,26 @@
  */
 package org.apache.camel.component.lumberjack;
 
+import javax.net.ssl.SSLContext;
+
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
+import org.apache.camel.util.jsse.SSLContextParameters;
 
 @UriEndpoint(scheme = "lumberjack", title = "Lumberjack", syntax = "lumberjack:host:port",
consumerClass = LumberjackConsumer.class, label = "log")
-class LumberjackEndpoint extends DefaultEndpoint {
+final class LumberjackEndpoint extends DefaultEndpoint {
     @UriPath(description = "Network interface on which to listen for Lumberjack")
     @Metadata(required = "true")
-    final String host;
+    private final String host;
     @UriPath(description = "Network port on which to listen for Lumberjack", defaultValue
= "" + LumberjackComponent.DEFAULT_PORT)
-    final int port;
+    private final int port;
+    @UriParam(description = "SSL configuration")
+    private SSLContextParameters sslContextParameters;
 
     LumberjackEndpoint(String endpointUri, LumberjackComponent component, String host, int
port) {
         super(endpointUri, component);
@@ -44,11 +50,16 @@ class LumberjackEndpoint extends DefaultEndpoint {
 
     @Override
     public LumberjackConsumer createConsumer(Processor processor) throws Exception {
-        return new LumberjackConsumer(this, processor, host, port, null);
+        SSLContext sslContext = sslContextParameters != null ? sslContextParameters.createSSLContext(getCamelContext())
: null;
+        return new LumberjackConsumer(this, processor, host, port, sslContext);
     }
 
     @Override
     public boolean isSingleton() {
         return true;
     }
+
+    public void setSslContextParameters(SSLContextParameters sslContextParameters) {
+        this.sslContextParameters = sslContextParameters;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksComponent.java
b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksComponent.java
deleted file mode 100644
index 3d5bfb2..0000000
--- a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksComponent.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.lumberjack;
-
-/**
- * The class is the Camel component for the Lumberjack server with SSL
- */
-public class LumberjacksComponent extends LumberjackComponent {
-    public LumberjacksComponent() {
-        super(LumberjacksEndpoint.class);
-    }
-
-    @Override
-    protected LumberjacksEndpoint createEndpoint(String uri, String host, int port) {
-        return new LumberjacksEndpoint(uri, this, host, port);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksEndpoint.java
b/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksEndpoint.java
deleted file mode 100644
index db02d3b..0000000
--- a/components/camel-lumberjack/src/main/java/org/apache/camel/component/lumberjack/LumberjacksEndpoint.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.lumberjack;
-
-import org.apache.camel.Processor;
-import org.apache.camel.spi.UriEndpoint;
-import org.apache.camel.spi.UriParam;
-import org.apache.camel.util.jsse.SSLContextParameters;
-
-@UriEndpoint(scheme = "lumberjacks", title = "Lumberjacks", syntax = "lumberjacks:host:port",
consumerClass = LumberjackConsumer.class, label = "log")
-class LumberjacksEndpoint extends LumberjackEndpoint {
-    @UriParam(description = "SSL configuration")
-    private SSLContextParameters sslContextParameters;
-
-    LumberjacksEndpoint(String endpointUri, LumberjackComponent component, String host, int
port) {
-        super(endpointUri, component, host, port);
-    }
-
-    @Override
-    public LumberjackConsumer createConsumer(Processor processor) throws Exception {
-        if (sslContextParameters == null) {
-            throw new IllegalStateException("The sslContextParameters attribute must be defined
for lumberjacks");
-        }
-        return new LumberjackConsumer(this, processor, host, port, sslContextParameters.createSSLContext(getCamelContext()));
-    }
-
-    @SuppressWarnings("unused")
-    public void setSslContextParameters(SSLContextParameters sslContextParameters) {
-        this.sslContextParameters = sslContextParameters;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjacks
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjacks
b/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjacks
deleted file mode 100644
index e542717..0000000
--- a/components/camel-lumberjack/src/main/resources/META-INF/services/org/apache/camel/component/lumberjacks
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-#
-
-class=org.apache.camel.component.lumberjack.LumberjacksComponent

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentSSLTest.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentSSLTest.java
b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentSSLTest.java
new file mode 100644
index 0000000..bcb52be
--- /dev/null
+++ b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentSSLTest.java
@@ -0,0 +1,109 @@
+/**
+ * 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.lumberjack;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.jsse.KeyManagersParameters;
+import org.apache.camel.util.jsse.KeyStoreParameters;
+import org.apache.camel.util.jsse.SSLContextParameters;
+import org.apache.camel.util.jsse.TrustManagersParameters;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@SuppressWarnings("unchecked")
+public class LumberjackComponentSSLTest extends CamelTestSupport {
+    private static int port;
+
+    @BeforeClass
+    public static void beforeClass() {
+        port = AvailablePortFinder.getNextAvailable();
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("ssl", createServerSSLContextParameters());
+        return registry;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                // Lumberjack configured with SSL
+                from("lumberjack:0.0.0.0:" + port + "?sslContextParameters=#ssl").to("mock:output");
+            }
+        };
+    }
+
+    @Test
+    public void shouldListenToMessagesOverSSL() throws Exception {
+        // We're expecting 25 messages with Maps
+        MockEndpoint mock = getMockEndpoint("mock:output");
+        mock.expectedMessageCount(25);
+        mock.allMessages().body().isInstanceOf(Map.class);
+
+        // When sending messages
+        List<Integer> responses = LumberjackUtil.sendMessages(port, createClientSSLContextParameters());
+
+        // Then we should have the messages we're expecting
+        mock.assertIsSatisfied();
+
+        // And we should have replied with 2 acknowledgments for each window frame
+        assertEquals(Arrays.asList(10, 15), responses);
+    }
+
+    /**
+     * Creates the {@link SSLContextParameters} Camel object for the Lumberjack component
+     *
+     * @return The {@link SSLContextParameters} Camel object for the Lumberjack component
+     */
+    private SSLContextParameters createServerSSLContextParameters() {
+        SSLContextParameters sslContextParameters = new SSLContextParameters();
+
+        KeyManagersParameters keyManagersParameters = new KeyManagersParameters();
+        KeyStoreParameters keyStore = new KeyStoreParameters();
+        keyStore.setPassword("changeit");
+        keyStore.setResource("org/apache/camel/component/lumberjack/keystore.jks");
+        keyManagersParameters.setKeyPassword("changeit");
+        keyManagersParameters.setKeyStore(keyStore);
+        sslContextParameters.setKeyManagers(keyManagersParameters);
+
+        return sslContextParameters;
+    }
+
+    private SSLContextParameters createClientSSLContextParameters() {
+        SSLContextParameters sslContextParameters = new SSLContextParameters();
+
+        TrustManagersParameters trustManagersParameters = new TrustManagersParameters();
+        KeyStoreParameters trustStore = new KeyStoreParameters();
+        trustStore.setPassword("changeit");
+        trustStore.setResource("org/apache/camel/component/lumberjack/keystore.jks");
+        trustManagersParameters.setKeyStore(trustStore);
+        sslContextParameters.setTrustManagers(trustManagersParameters);
+
+        return sslContextParameters;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentTest.java
b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentTest.java
index 3a0d0f9..ec8026a 100644
--- a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentTest.java
+++ b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackComponentTest.java
@@ -64,6 +64,6 @@ public class LumberjackComponentTest extends CamelTestSupport {
         assertEquals("/home/qatest/collectNetwork/log/data-integration/00000000-f000-0000-1541-8da26f200001/absorption.log",
first.get("source"));
 
         // And we should have replied with 2 acknowledgments for each window frame
-        assertEquals(responses, Arrays.asList(10, 15));
+        assertEquals(Arrays.asList(10, 15), responses);
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjacksComponentTest.java
----------------------------------------------------------------------
diff --git a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjacksComponentTest.java
b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjacksComponentTest.java
deleted file mode 100644
index 29e9397..0000000
--- a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjacksComponentTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * 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.lumberjack;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.util.jsse.KeyManagersParameters;
-import org.apache.camel.util.jsse.KeyStoreParameters;
-import org.apache.camel.util.jsse.SSLContextParameters;
-import org.apache.camel.util.jsse.TrustManagersParameters;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-@SuppressWarnings("unchecked")
-public class LumberjacksComponentTest extends CamelTestSupport {
-    private static int port;
-
-    @BeforeClass
-    public static void beforeClass() {
-        port = AvailablePortFinder.getNextAvailable();
-    }
-
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = super.createRegistry();
-        registry.bind("ssl", createServerSSLContextParameters());
-        return registry;
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() {
-        return new RouteBuilder() {
-            public void configure() {
-                // Lumberjack configured with SSL
-                from("lumberjacks:0.0.0.0:" + port + "?sslContextParameters=#ssl").to("mock:output");
-            }
-        };
-    }
-
-    @Test
-    public void shouldListenToMessagesOverSSL() throws Exception {
-        // We're expecting 25 messages with Maps
-        MockEndpoint mock = getMockEndpoint("mock:output");
-        mock.expectedMessageCount(25);
-        mock.allMessages().body().isInstanceOf(Map.class);
-
-        // When sending messages
-        List<Integer> responses = LumberjackUtil.sendMessages(port, createClientSSLContextParameters());
-
-        // Then we should have the messages we're expecting
-        mock.assertIsSatisfied();
-
-        // And we should have replied with 2 acknowledgments for each window frame
-        assertEquals(responses, Arrays.asList(10, 15));
-    }
-
-    /**
-     * Creates the {@link SSLContextParameters} Camel object for the Lumberjack component
-     *
-     * @return The {@link SSLContextParameters} Camel object for the Lumberjack component
-     */
-    private SSLContextParameters createServerSSLContextParameters() {
-        SSLContextParameters sslContextParameters = new SSLContextParameters();
-
-        KeyManagersParameters keyManagersParameters = new KeyManagersParameters();
-        KeyStoreParameters keyStore = new KeyStoreParameters();
-        keyStore.setPassword("changeit");
-        keyStore.setResource("org/apache/camel/component/lumberjack/keystore.jks");
-        keyManagersParameters.setKeyPassword("changeit");
-        keyManagersParameters.setKeyStore(keyStore);
-        sslContextParameters.setKeyManagers(keyManagersParameters);
-
-        return sslContextParameters;
-    }
-
-    private SSLContextParameters createClientSSLContextParameters() {
-        SSLContextParameters sslContextParameters = new SSLContextParameters();
-
-        TrustManagersParameters trustManagersParameters = new TrustManagersParameters();
-        KeyStoreParameters trustStore = new KeyStoreParameters();
-        trustStore.setPassword("changeit");
-        trustStore.setResource("org/apache/camel/component/lumberjack/keystore.jks");
-        trustManagersParameters.setKeyStore(trustStore);
-        sslContextParameters.setTrustManagers(trustManagersParameters);
-
-        return sslContextParameters;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/12dcc564/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 85f0056..1db0dcc 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -222,6 +222,7 @@
     * [LevelDB](leveldb.adoc)
     * [Linkedin](linkedin.adoc)
     * [Lucene](lucene.adoc)
+    * [Lumberjack](lumberjack.adoc)
     * [Mail](mail.adoc)
         * [IMAP](imap.adoc)
         * [IMAPs](imaps.adoc)


Mime
View raw message