You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/07/23 10:02:39 UTC

[camel] branch master updated (77643e3 -> 9de7d6b)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 77643e3  Upgrade RXJava to version 2.1.17
     new 9364ce0  CAMEL-12670 - Camel-Nats: add authentication example
     new 9de7d6b  Fixed CS

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/nats/NatsConfiguration.java       |  1 -
 ...atsProducerTest.java => NatsAuthProducerTest.java} |  2 +-
 ...{NatsTestSupport.java => NatsAuthTestSupport.java} | 19 +++++++++++++++----
 3 files changed, 16 insertions(+), 6 deletions(-)
 copy components/camel-nats/src/test/java/org/apache/camel/component/nats/{NatsProducerTest.java => NatsAuthProducerTest.java} (95%)
 copy components/camel-nats/src/test/java/org/apache/camel/component/nats/{NatsTestSupport.java => NatsAuthTestSupport.java} (71%)


[camel] 02/02: Fixed CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9de7d6bdfce909e8772066ebf75c5c1ed97fd708
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Jul 23 12:01:52 2018 +0200

    Fixed CS
---
 .../src/main/java/org/apache/camel/component/nats/NatsConfiguration.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java
index 9e1d018f..481d66b 100644
--- a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java
+++ b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java
@@ -26,7 +26,6 @@ import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 import org.apache.camel.spi.UriPath;
-import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.jsse.SSLContextParameters;
 
 @UriParams


[camel] 01/02: CAMEL-12670 - Camel-Nats: add authentication example

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9364ce0d1c6dbe1fd8605817cad4bfeeec3e2c9b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Jul 23 11:49:00 2018 +0200

    CAMEL-12670 - Camel-Nats: add authentication example
---
 .../camel/component/nats/NatsConfiguration.java    |  2 +-
 .../camel/component/nats/NatsAuthProducerTest.java | 39 +++++++++++++++
 .../camel/component/nats/NatsAuthTestSupport.java  | 57 ++++++++++++++++++++++
 3 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java
index 4ecc74095..9e1d018f 100644
--- a/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java
+++ b/components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsConfiguration.java
@@ -26,6 +26,7 @@ import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 import org.apache.camel.spi.UriPath;
+import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.jsse.SSLContextParameters;
 
 @UriParams
@@ -75,7 +76,6 @@ public class NatsConfiguration {
     private boolean secure;
     @UriParam(label = "security")
     private SSLContextParameters sslContextParameters;
-
     /**
      * URLs to one or more NAT servers. Use comma to separate URLs when
      * specifying multiple servers.
diff --git a/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsAuthProducerTest.java b/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsAuthProducerTest.java
new file mode 100644
index 0000000..c6c822d
--- /dev/null
+++ b/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsAuthProducerTest.java
@@ -0,0 +1,39 @@
+/**
+ * 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.nats;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Test;
+
+public class NatsAuthProducerTest extends NatsAuthTestSupport {
+    
+    @Test
+    public void sendTest() throws Exception {
+        
+        template.sendBody("direct:send", "pippo");
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:send").to("nats://" + getNatsUrl() + "?topic=test");
+            }
+        };
+    }
+}
diff --git a/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsAuthTestSupport.java b/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsAuthTestSupport.java
new file mode 100644
index 0000000..45856b5
--- /dev/null
+++ b/components/camel-nats/src/test/java/org/apache/camel/component/nats/NatsAuthTestSupport.java
@@ -0,0 +1,57 @@
+/**
+ * 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.nats;
+
+import org.apache.camel.test.testcontainers.ContainerAwareTestSupport;
+import org.apache.camel.test.testcontainers.Wait;
+import org.testcontainers.containers.GenericContainer;
+
+public class NatsAuthTestSupport extends ContainerAwareTestSupport {
+
+    public static final String CONTAINER_IMAGE = "nats:1.2.0";
+    public static final String CONTAINER_NAME = "nats-auth";
+    public static final String USERNAME = "admin";
+    public static final String PASSWORD = "password";
+    
+    @Override
+    protected GenericContainer<?> createContainer() {
+        return natsContainer();
+    }
+
+    public static GenericContainer natsContainer() {
+        return new GenericContainer(CONTAINER_IMAGE)
+            .withNetworkAliases(CONTAINER_NAME)
+            .waitingFor(Wait.forLogMessageContaining("Server is ready", 1))
+            .withCommand(
+                         "-DV",
+                         "--user",
+                         USERNAME,
+                         "--pass",
+                         PASSWORD
+                     );
+    }
+    
+    public String getNatsUrl() {
+        return String.format(
+            "%s:%s@%s:%d",
+            USERNAME,
+            PASSWORD,
+            getContainerHost(CONTAINER_NAME),
+            getContainerPort(CONTAINER_NAME, 4222)
+        );
+    }
+}