camel git commit: CAMEL-10989: camel-test-blueprint MyMainAppTest is failing

2017-03-10 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master 0157f5608 -> 50bd595e9


CAMEL-10989: camel-test-blueprint MyMainAppTest is failing


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

Branch: refs/heads/master
Commit: 50bd595e95aba55547ae751284961a733480aa20
Parents: 0157f56
Author: Tadayoshi Sato 
Authored: Sat Mar 11 15:51:13 2017 +0900
Committer: Claus Ibsen 
Committed: Sat Mar 11 08:34:09 2017 +0100

--
 .../test/java/org/apache/camel/test/blueprint/MyMainAppTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/50bd595e/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MyMainAppTest.java
--
diff --git 
a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MyMainAppTest.java
 
b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MyMainAppTest.java
index b3fe091..3576ae0 100644
--- 
a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MyMainAppTest.java
+++ 
b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MyMainAppTest.java
@@ -54,7 +54,7 @@ public class MyMainAppTest {
 main.setDescriptors("org/apache/camel/test/blueprint/xpath/*.xml");
 
 // run for 1 second and then stop automatic
-main.setDuration(1000);
+main.setDuration(1);
 main.run();
 }
 }



camel git commit: CAMEL-10986: camel-zookeeper-master - Donation of the master component from fabric8 v1

2017-03-10 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master 03aab77c8 -> 0157f5608


CAMEL-10986: camel-zookeeper-master - Donation of the master component from 
fabric8 v1


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

Branch: refs/heads/master
Commit: 0157f560878286b3549ef3e169406102f8cc1a4e
Parents: 03aab77
Author: Claus Ibsen 
Authored: Sat Mar 11 08:32:56 2017 +0100
Committer: Claus Ibsen 
Committed: Sat Mar 11 08:32:56 2017 +0100

--
 components/pom.xml | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/0157f560/components/pom.xml
--
diff --git a/components/pom.xml b/components/pom.xml
index a40f233..d1bb229 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -289,6 +289,7 @@
 camel-zipfile
 camel-zipkin
 camel-zookeeper
+camel-zookeeper-master
   
 
 



camel git commit: CAMEL-10986: camel-zookeeper-master - Make it install in karaf

2017-03-10 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master 16d6fc385 -> 03aab77c8


CAMEL-10986: camel-zookeeper-master - Make it install in karaf


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

Branch: refs/heads/master
Commit: 03aab77c8ec61e729e9783b9af481154f991a884
Parents: 16d6fc3
Author: Claus Ibsen 
Authored: Fri Mar 10 23:07:34 2017 +0100
Committer: Claus Ibsen 
Committed: Fri Mar 10 23:07:34 2017 +0100

--
 components/camel-zookeeper-master/pom.xml   | 10 +++-
 .../group/internal/ZooKeeperGroup.java  | 63 ++--
 .../features/src/main/resources/features.xml| 12 
 .../itest/karaf/CamelZookeeperMasterTest.java   | 34 +++
 4 files changed, 74 insertions(+), 45 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/03aab77c/components/camel-zookeeper-master/pom.xml
--
diff --git a/components/camel-zookeeper-master/pom.xml 
b/components/camel-zookeeper-master/pom.xml
index 493a266..a1e89a3 100644
--- a/components/camel-zookeeper-master/pom.xml
+++ b/components/camel-zookeeper-master/pom.xml
@@ -31,7 +31,15 @@
   Camel Zookeeper Master Support
 
   
-
org.apache.camel.component.zookeepermaster.*
+
+  !com.google.common.base;,
+  !org.apache.camel.component.zookeepermaster.group,
+  *
+
+
+  org.apache.camel.component.zookeepermaster,
+  org.apache.camel.component.zookeepermaster.group
+
 
org.apache.camel.spi.ComponentResolver;component=zookeeper-master
   
 

http://git-wip-us.apache.org/repos/asf/camel/blob/03aab77c/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
--
diff --git 
a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
 
b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
index 6e58f50..f297e43 100644
--- 
a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
+++ 
b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
@@ -24,6 +24,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -31,6 +32,7 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.UUID;
 import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -38,15 +40,10 @@ import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
 
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
 import org.apache.camel.component.zookeepermaster.group.Group;
 import org.apache.camel.component.zookeepermaster.group.GroupListener;
 import org.apache.camel.component.zookeepermaster.group.NodeState;
@@ -85,7 +82,7 @@ public class ZooKeeperGroup implements 
Group {
 private final EnsurePath ensurePath;
 private final BlockingQueue operations = new 
LinkedBlockingQueue();
 private final ListenerContainer listeners = new 
ListenerContainer();
-private final ConcurrentMap currentData = 
Maps.newConcurrentMap();
+private final ConcurrentMap currentData = new 
ConcurrentHashMap<>();
 private final AtomicBoolean started = new AtomicBoolean();
 private final AtomicBoolean connected = new AtomicBoolean();
 private final SequenceComparator sequenceComparator = new 
SequenceComparator();
@@ -166,7 +163,7 @@ public class ZooKeeperGroup implements 
Group {
  * Start the cache. The cache is not started automatically. You must call 
this method.
   

camel git commit: CAMEL-10983: Fail early and show meaningful log for invalid endpoint URI in Blueprint

2017-03-10 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/camel-2.18.x dc46e915d -> b7b660d00


CAMEL-10983: Fail early and show meaningful log for invalid endpoint URI in 
Blueprint


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

Branch: refs/heads/camel-2.18.x
Commit: b7b660d009497cf54666f5f005460fd9dc8d193b
Parents: dc46e91
Author: Tadayoshi Sato 
Authored: Fri Mar 10 22:05:12 2017 +0900
Committer: Claus Ibsen 
Committed: Fri Mar 10 21:49:50 2017 +0100

--
 .../handler/CamelNamespaceHandler.java  | 37 ++--
 1 file changed, 26 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/b7b660d0/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
--
diff --git 
a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
 
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
index 321b163..ab41dc6 100644
--- 
a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
+++ 
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.blueprint.handler;
 
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
@@ -988,9 +989,9 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
 CamelContextFactoryBean ccfb = (CamelContextFactoryBean) 
blueprintContainer.getComponentInstance(".camelBlueprint.factory." + 
camelContextName);
 CamelContext camelContext = ccfb.getContext();
 
-Set components = new HashSet();
-Set languages = new HashSet();
-Set dataformats = new HashSet();
+Set components = new HashSet<>();
+Set languages = new HashSet<>();
+Set dataformats = new HashSet<>();
 
 // regular camel routes
 for (RouteDefinition rd : camelContext.getRouteDefinitions()) {
@@ -1152,16 +1153,20 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
 
 private void findUriComponent(String uri, Set components) {
 // if the uri is a placeholder then skip it
-if (uri != null && 
uri.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
+if (uri == null || 
uri.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
 return;
 }
 
-if (uri != null) {
-String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 2);
-if (splitURI[1] != null) {
-String scheme = splitURI[0];
-components.add(scheme);
-}
+// validate uri here up-front so a meaningful error can be logged 
for blueprint
+// it will also speed up tests in case of failure
+if (!validateUri(uri)) {
+return;
+}
+
+String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 2);
+if (splitURI[1] != null) {
+String scheme = splitURI[0];
+components.add(scheme);
 }
 }
 
@@ -1187,11 +1192,21 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
 }
 }
 } catch (URISyntaxException e) {
-// ignore
+// ignore as uri should be already validated at 
findUriComponent method
 }
 }
 }
 
+private static boolean validateUri(String uri) {
+try {
+// the same validation as done in 
DefaultCamelContext#normalizeEndpointUri(String)
+URISupport.normalizeUri(uri);
+} catch (URISyntaxException | UnsupportedEncodingException e) {
+LOG.error("Endpoint URI '" + uri + "' is not valid due to: " + 
e.getMessage(), e);
+return false;
+}
+return true;
+}
 }
 
 }



[1/3] camel git commit: CAMEL-10980: removed camel-undertow duplicate handler check

2017-03-10 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master bf82a5ed1 -> 16d6fc385


CAMEL-10980: removed camel-undertow duplicate handler check


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

Branch: refs/heads/master
Commit: 7f7892127b6cba06e69d20093caf12c7900c0618
Parents: ca9d0c1
Author: Scott Cranton 
Authored: Fri Mar 10 12:26:36 2017 -0500
Committer: Claus Ibsen 
Committed: Fri Mar 10 21:40:58 2017 +0100

--
 .../undertow/handlers/CamelMethodHandler.java   |  5 --
 .../rest/RestUndertowHttpGetCorsTest.java   | 53 ++--
 2 files changed, 48 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/7f789212/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelMethodHandler.java
--
diff --git 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelMethodHandler.java
 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelMethodHandler.java
index 26584b5..ed7eb93 100644
--- 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelMethodHandler.java
+++ 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelMethodHandler.java
@@ -51,11 +51,6 @@ public class CamelMethodHandler implements HttpHandler {
 public synchronized void add(String[] methods, HttpHandler handler) {
 Map adding = new HashMap();
 for (String method : methods) {
-HttpHandler existing = methodMap.get(method);
-if (methodMap.get(method) != null) {
-throw new IllegalArgumentException(String.format(
-"Duplicate handler for a method '%s': '%s', '%s'", method, 
existing, handler));
-}
 adding.put(method, handler);
 }
 methodMap.putAll(adding);

http://git-wip-us.apache.org/repos/asf/camel/blob/7f789212/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpGetCorsTest.java
--
diff --git 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpGetCorsTest.java
 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpGetCorsTest.java
index c54fbef..562188b 100644
--- 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpGetCorsTest.java
+++ 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpGetCorsTest.java
@@ -26,9 +26,9 @@ import org.junit.Test;
 public class RestUndertowHttpGetCorsTest extends BaseUndertowTest {
 
 @Test
-public void testCors() throws Exception {
+public void testCorsGet() throws Exception {
 // send OPTIONS first which should not be routed
-getMockEndpoint("mock:input").expectedMessageCount(0);
+getMockEndpoint("mock:inputGet").expectedMessageCount(0);
 
 Exchange out = template.request("http://localhost:; + getPort() + 
"/users/123/basic", new Processor() {
 @Override
@@ -45,11 +45,45 @@ public class RestUndertowHttpGetCorsTest extends 
BaseUndertowTest {
 assertMockEndpointsSatisfied();
 
 resetMocks();
-getMockEndpoint("mock:input").expectedMessageCount(1);
+getMockEndpoint("mock:inputGet").expectedMessageCount(1);
 
 // send GET request which should be routed
 
-String out2 = template.requestBody("http://localhost:; + getPort() + 
"/users/123/basic", null, String.class);
+String out2 = fluentTemplate.to("http://localhost:; + getPort() + 
"/users/123/basic")
+.withHeader(Exchange.HTTP_METHOD, "GET")
+.request(String.class);
+assertEquals("123;Donald Duck", out2);
+
+assertMockEndpointsSatisfied();
+}
+
+@Test
+public void testCorsPut() throws Exception {
+// send OPTIONS first which should not be routed
+getMockEndpoint("mock:inputPut").expectedMessageCount(0);
+
+Exchange out = template.request("http://localhost:; + getPort() + 
"/users/123/basic", new Processor() {
+@Override
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setHeader(Exchange.HTTP_METHOD, "OPTIONS");
+}
+});
+
+

[3/3] camel git commit: Fixed CS. This closes #1520

2017-03-10 Thread davsclaus
Fixed CS. This closes #1520


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

Branch: refs/heads/master
Commit: 16d6fc3857ae633aa2599a91528114ed99e2ebc3
Parents: 7f78921
Author: Claus Ibsen 
Authored: Fri Mar 10 21:43:27 2017 +0100
Committer: Claus Ibsen 
Committed: Fri Mar 10 21:43:27 2017 +0100

--
 .../component/undertow/rest/RestUndertowHttpPojoTypeTest.java  | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/16d6fc38/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpPojoTypeTest.java
--
diff --git 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpPojoTypeTest.java
 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpPojoTypeTest.java
index 1752f54..7541dd6 100644
--- 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpPojoTypeTest.java
+++ 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpPojoTypeTest.java
@@ -16,6 +16,10 @@
  */
 package org.apache.camel.component.undertow.rest;
 
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
@@ -27,8 +31,6 @@ import org.apache.camel.model.rest.RestDefinition;
 import org.apache.camel.model.rest.VerbDefinition;
 import org.junit.Test;
 
-import java.util.*;
-
 public class RestUndertowHttpPojoTypeTest extends BaseUndertowTest {
 private final ObjectMapper mapper = new ObjectMapper();
 



[2/3] camel git commit: added Unit Test showing issue

2017-03-10 Thread davsclaus
added Unit Test showing issue


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

Branch: refs/heads/master
Commit: ca9d0c1234c0c0d816966fce6adfc1f89f5e5bb3
Parents: bf82a5e
Author: Scott Cranton 
Authored: Thu Mar 9 21:52:57 2017 -0500
Committer: Claus Ibsen 
Committed: Fri Mar 10 21:40:58 2017 +0100

--
 .../rest/RestUndertowVerbEnableCorsTest.java| 89 
 1 file changed, 89 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/ca9d0c12/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowVerbEnableCorsTest.java
--
diff --git 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowVerbEnableCorsTest.java
 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowVerbEnableCorsTest.java
new file mode 100644
index 000..ae8577d
--- /dev/null
+++ 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowVerbEnableCorsTest.java
@@ -0,0 +1,89 @@
+/**
+ * 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.undertow.rest;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.undertow.BaseUndertowTest;
+import org.junit.Test;
+
+public class RestUndertowVerbEnableCorsTest extends BaseUndertowTest {
+
+@Test
+public void testGetAll() throws Exception {
+String out = template.requestBodyAndHeader("http://localhost:; + 
getPort() + "/users", null, Exchange.HTTP_METHOD, "GET", String.class);
+assertEquals("[{ \"id\":\"1\", \"name\":\"Scott\" },{ \"id\":\"2\", 
\"name\":\"Claus\" }]", out);
+}
+
+@Test
+public void testGetOne() throws Exception {
+String out = template.requestBodyAndHeader("http://localhost:; + 
getPort() + "/users/1", null, Exchange.HTTP_METHOD, "GET", String.class);
+assertEquals("{ \"id\":\"1\", \"name\":\"Scott\" }", out);
+}
+
+@Test
+public void testPost() throws Exception {
+MockEndpoint mock = getMockEndpoint("mock:create");
+mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST");
+
+template.requestBodyAndHeader("http://localhost:; + getPort() + 
"/users", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, "POST", 
String.class);
+
+assertMockEndpointsSatisfied();
+}
+
+@Test
+public void testPut() throws Exception {
+MockEndpoint mock = getMockEndpoint("mock:update");
+mock.expectedBodiesReceived("{ \"id\":\"1\", \"name\":\"Scott\" }");
+mock.expectedHeaderReceived("id", "1");
+mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "PUT");
+
+template.requestBodyAndHeader("http://localhost:; + getPort() + 
"/users/1", "{ \"id\":\"1\", \"name\":\"Scott\" }", Exchange.HTTP_METHOD, 
"PUT", String.class);
+
+assertMockEndpointsSatisfied();
+}
+
+@Test
+public void testDelete() throws Exception {
+MockEndpoint mock = getMockEndpoint("mock:delete");
+mock.expectedHeaderReceived("id", "1");
+mock.expectedHeaderReceived(Exchange.HTTP_METHOD, "DELETE");
+
+template.requestBodyAndHeader("http://localhost:; + getPort() + 
"/users/1", null, Exchange.HTTP_METHOD, "DELETE", String.class);
+
+assertMockEndpointsSatisfied();
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+

svn commit: r1008100 [2/2] - in /websites/production/camel/content: book-in-one-page.html book-pattern-appendix.html cache/main.pageCache wire-tap.html

2017-03-10 Thread buildbot
Modified: websites/production/camel/content/wire-tap.html
==
--- websites/production/camel/content/wire-tap.html (original)
+++ websites/production/camel/content/wire-tap.html Fri Mar 10 18:20:17 2017
@@ -86,7 +86,7 @@

 
 
-Wire 
Taphttp://www.enterpriseintegrationpatterns.com/WireTap.html; 
rel="nofollow">Wire Tap (from the EIP patterns) allows you to 
route messages to a separate location while they are being forwarded to the 
ultimate destination.http://www.enterpriseintegrationpatterns.com/img/WireTap.gif; 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/WireTap.gif;>StreamsIf you Wire Tap
  a stream message body then you should consider enabling Stream caching to ensure the message body can be 
read at each endpoint. See more details at Stream caching.OptionsNameDefault ValueDescriptionuriMandatory: The URI of the endpoint to 
which the wire-tapped message will be sent. From Camel 2.16 
onwards support dynamic to uris like documented in http://camel.apache.org/message-endpoint.html; 
style="line-height: 1.4285715;">Message EndpointexecutorServiceRefReference identifier of a custom Thread Pool to use when processing the 
wire-tapped messages. If not set, Camel will use a default thread 
pool.processorRefReference identifier of a custom Processor to use for creating a new message (e.g., 
the "send a new message" mode). See below.copytrueCamel 2.3: Whether to copy the Exchange before wire-tapping the 
message.onPrepareRefCamel 2.8: Reference identifier of a 
custom Processor to prepare the copy 
of the Exchange to be wire-tapped. 
This allows you to do any custom logic, such as deep-cloning the message 
payload.cacheSizeCamel 2.16: 
Allows to configure the cache size for 
theProducerCachewhich caches producers for reuse. Will by default use the 
default cache size which is 1000. Setting the value to -1 allows to turn off 
the cache all together.ignoreInvalidEndpointfalseCamel 2.16: Whether to ignore an endpoint URI that could not be 
resolved. If disabled, Camel will throw an exception identifying the invalid 
endpoint URI.WireTap thread poolThe Wire Tap uses a thread pool to process the tapped 
messages. Th
 is thread pool will by default use the settings detailed at Threading Model. In particular, when the pool 
is exhausted (with all threads utilized), further wiretaps will be executed 
synchronously by the calling thread. To remedy this, you can configure an 
explicit thread pool on the Wire Tap 
having either a different rejection policy, a larger worker queue, or more 
worker threads.WireTap nodeCamel's 
Wire Tap node supports two flavors when tapping an Exchange:-With the traditional Wire Tap, Camel 
will copy the original Exchange and 
set its Exchange Pattern to 
InOnly, as we want the tapped Exchange 
to be sent in a fire and forget style. The tapped Exchange is then sent in a separate thread so it can run in parallel 
with the original. Beware that only the Exchange is copied - Wire Tap won't do 
a deep clone (unless you specify a custom processor via onPrepareRef 
which does that). So all copies could share objects from the original 
Exchange.-Camel also provides an option of sending a new Exchange allowing you to populate it with new 
values.Sending a copy 
(traditional wiretap)Using the Fluent Builders
+Wire 
Taphttp://www.enterpriseintegrationpatterns.com/WireTap.html; 
rel="nofollow">Wire Tap (from the EIP patterns) allows you to 
route messages to a separate location while they are being forwarded to the 
ultimate destination.http://www.enterpriseintegrationpatterns.com/img/WireTap.gif; 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/WireTap.gif;>StreamsIf you Wire Tap
  a stream message body then you should consider enabling Stream caching to ensure the message body can be 
read at each endpoint. See more details at Stream caching.OptionsNameDefaultDescriptionuriMandatory: The URI of the endpoint to which the 
wire-tapped message should be sent.From Camel 2.16: 
support for dynamicto URIs is as documented in http://camel.apache.org/message-endpoint.html; 
style="line-height: 1.4285715;">Message Endpoint.executorServiceRefReference ID of a custom Thread Pool to use when processing the 
wire-tapped messages.When not set, Camel will use an instance of the 
default thread pool.processorRefReference ID of a custom Processor to use for creating a new 
message.See "Sending a
  New Exchange" below.copytrueCamel 2.3: Whether to copy the Exchange before wire-tapping the 
message.onPrepareRefCamel 2.8: Reference identifier of a 
custom Processor to prepare the copy 
of the Exchange to be wire-tapped. 
This allows you to do any custom logic, such as deep-cloning the message 
payload.cacheSizeCamel 2.16: Allows to configure the cache size 
for theProducerCachewhich caches producers for reuse. Will by 
default use the default cache size which is 1000. 
Setting the 

svn commit: r1008100 [1/2] - in /websites/production/camel/content: book-in-one-page.html book-pattern-appendix.html cache/main.pageCache wire-tap.html

2017-03-10 Thread buildbot
Author: buildbot
Date: Fri Mar 10 18:20:17 2017
New Revision: 1008100

Log:
Production update by buildbot for camel

Modified:
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/book-pattern-appendix.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/wire-tap.html

Modified: websites/production/camel/content/book-in-one-page.html
==
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Fri Mar 10 18:20:17 
2017
@@ -3542,11 +3542,11 @@ The tutorial has been designed in two pa
 While not actual tutorials you might find working through the source of the 
various Examples useful.
 
 Tutorial on Spring 
Remoting with JMSThanksThis tutorial was kindly donated 
to Apache Camel by Martin Gilday.PrefaceThis tutorial aims to guide the 
reader through the stages of creating a project which uses Camel to facilitate 
the routing of messages from a JMS queue to a http://www.springramework.org; 
rel="nofollow">Spring service. The route works in a synchronous fashion 
returning a response to the client./**/
+/*]]>*/
 Tutorial on Spring 
Remoting with JMSPrefacePrerequisitesDistributionAboutCreate the Camel Project
 Update the POM with 
Dependencies
 Writing the 
Server
@@ -5661,11 +5661,11 @@ So we completed the last piece in the pi
 This example has been removed from Camel 2.9 onwards. 
Apache Axis 1.4 is a very old and unsupported framework. We encourage users to 
use CXF instead of Axis.
 
 /**/
+/*]]>*/
 Tutorial using Axis 
1.4 with Apache Camel
 PrerequisitesDistributionIntroductionSetting up the project to 
run Axis
 Maven 2wsdlConfiguring AxisRunning the 
Example
@@ -15778,7 +15778,7 @@ from(direct:start).choice()
 Using This Pattern
 
 If you would like to use this EIP Pattern then please read the Getting Started, you may also find 
the Architecture useful 
particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out.
-Wire Taphttp://www.enterpriseintegrationpatterns.com/WireTap.html; 
rel="nofollow">Wire Tap (from the EIP patterns) allows you to 
route messages to a separate location while they are being forwarded to the 
ultimate destination.http://www.enterpriseintegrationpatterns.com/img/WireTap.gif; 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/WireTap.gif;>StreamsIf you Wire Tap a stream message body then 
 you should consider enabling Stream 
caching to ensure the message body can be read at each endpoint. See more 
details at Stream 
caching.OptionsNameDefault ValueDescriptionuriMandatory: The URI of the endpoint to 
which the wire-tapped message will be sent. From Camel 2.16 
onwards support dynamic to uris like documented in http://camel.apache.org/message-endpoint.html; style="line-height: 
1.4285715;">Message EndpointexecutorServiceRefReference identifier of a custom Thread Pool to use when processing the 
wire-tapped messages. If not set, Camel will use a default thread 
pool.processorRefReference identifier of a custom Processor to use for creating a new message (e.g., 
the "send a new message" mode). See below.copytrueCamel 2.3: Whether to copy the Exchange before wire-tapping the 
message.onPrepareRefCamel 2.8: Reference identifier of a 
custom Processor to prepare the copy 
of the Exchange to be wire-tapped. 
This allows you to do any custom logic, such as deep-cloning the message 
payload.cacheSizeCamel 2.16: Allows to configure the 
cache size for theProducerCachewhich caches producers for reuse. Will by default use the 
default cache size which is 1000. Setting the value to -1 allows to turn off 
the cache all together.ignoreInvalidEndpointfalseCamel 2.16: Whether to ignore an endpoint URI that could not be 
resolved. If disabled, Camel will throw an exception identifying the invalid 
endpoint URI.WireTap thread poolThe Wire Tap uses a thread pool to process 
the tapped messages. This thread pool wi
 ll by default use the settings detailed at Threading Model. In particular, when the pool 
is exhausted (with all threads utilized), further wiretaps will be 

[2/3] camel git commit: CAMEL-10986: camel-zookeeper-master - Donation of the master component from fabric8 v1

2017-03-10 Thread davsclaus
http://git-wip-us.apache.org/repos/asf/camel/blob/bf82a5ed/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
--
diff --git 
a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
 
b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
new file mode 100644
index 000..6e58f50
--- /dev/null
+++ 
b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
@@ -0,0 +1,671 @@
+/**
+ * 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.zookeepermaster.group.internal;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.UUID;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import org.apache.camel.component.zookeepermaster.group.Group;
+import org.apache.camel.component.zookeepermaster.group.GroupListener;
+import org.apache.camel.component.zookeepermaster.group.NodeState;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.ListenerContainer;
+import org.apache.curator.framework.state.ConnectionState;
+import org.apache.curator.framework.state.ConnectionStateListener;
+import org.apache.curator.utils.EnsurePath;
+import org.apache.curator.utils.ZKPaths;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.data.Stat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A utility that attempts to keep all data from all children of a ZK path 
locally cached. This class
+ * will watch the ZK path, respond to update/create/delete events, pull down 
the data, etc. You can
+ * register a listener that will get notified when changes occur.
+ * 
+ * IMPORTANT - it's not possible to stay transactionally in sync. 
Users of this class must
+ * be prepared for false-positives and false-negatives. Additionally, always 
use the version number
+ * when updating data to avoid overwriting another process' change.
+ */
+public class ZooKeeperGroup implements Group {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(ZooKeeperGroup.class);
+private static ObjectMapper mapper = new 
ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+
+private final Class clazz;
+private final CuratorFramework client;
+private final String path;
+private final ExecutorService executorService;
+private final EnsurePath ensurePath;
+private final BlockingQueue operations = new 
LinkedBlockingQueue();
+private final ListenerContainer listeners = new 
ListenerContainer();
+private final ConcurrentMap currentData = 
Maps.newConcurrentMap();
+private final AtomicBoolean started = new AtomicBoolean();
+private final AtomicBoolean connected = new AtomicBoolean();
+  

[3/3] camel git commit: CAMEL-10986: camel-zookeeper-master - Donation of the master component from fabric8 v1

2017-03-10 Thread davsclaus
CAMEL-10986: camel-zookeeper-master - Donation of the master component from 
fabric8 v1


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

Branch: refs/heads/master
Commit: bf82a5ed1980b96eaf2cc012e8b97ef78ffd2229
Parents: 8e14a77
Author: Claus Ibsen 
Authored: Fri Mar 10 18:49:53 2017 +0100
Committer: Claus Ibsen 
Committed: Fri Mar 10 18:49:53 2017 +0100

--
 apache-camel/pom.xml|   4 +
 .../src/main/descriptors/common-bin.xml |   1 +
 components/camel-zookeeper-master/pom.xml   | 157 +
 .../main/docs/zookeeper-master-component.adoc   |  86 +++
 .../zookeepermaster/CamelNodeState.java |  37 +
 .../zookeepermaster/MasterComponent.java|  76 +++
 .../zookeepermaster/MasterConsumer.java | 157 +
 .../zookeepermaster/MasterEndpoint.java |  98 +++
 .../zookeepermaster/ZKComponentSupport.java | 185 +
 .../component/zookeepermaster/group/Group.java  | 100 +++
 .../zookeepermaster/group/GroupFactory.java |  31 +
 .../zookeepermaster/group/GroupListener.java|  32 +
 .../zookeepermaster/group/MultiGroup.java   |  26 +
 .../zookeepermaster/group/NodeState.java|  69 ++
 .../group/internal/ChildData.java   | 129 
 .../group/internal/CompositeOperation.java  |  56 ++
 .../group/internal/DelegateZooKeeperGroup.java  | 180 +
 .../internal/DelegateZooKeeperMultiGroup.java   |  44 ++
 .../group/internal/EventOperation.java  |  39 ++
 .../group/internal/GetDataOperation.java|  61 ++
 .../group/internal/ManagedGroupFactory.java |  28 +
 .../internal/ManagedGroupFactoryBuilder.java|  50 ++
 .../group/internal/Operation.java   |  23 +
 .../group/internal/RefreshOperation.java|  61 ++
 .../group/internal/SequenceComparator.java  |  27 +
 .../internal/StaticManagedGroupFactory.java |  66 ++
 .../group/internal/UpdateOperation.java |  55 ++
 .../group/internal/ZooKeeperGroup.java  | 671 +++
 .../group/internal/ZooKeeperGroupFactory.java   |  56 ++
 .../group/internal/ZooKeeperMultiGroup.java |  58 ++
 .../internal/osgi/OsgiManagedGroupFactory.java  | 183 +
 .../internal/osgi/TrackingZooKeeperGroup.java   |  65 ++
 .../src/main/resources/META-INF/LICENSE.txt | 203 ++
 .../src/main/resources/META-INF/NOTICE.txt  |  11 +
 .../org/apache/camel/component/zookeeper-master |  17 +
 .../zookeepermaster/CuratorFactoryBean.java |  88 +++
 .../MasterEndpointFailoverTest.java | 147 
 .../zookeepermaster/MasterEndpointTest.java | 100 +++
 .../MasterQuartz2EndpointTest.java  |  76 +++
 .../zookeepermaster/ZKServerFactoryBean.java| 225 +++
 .../zookeepermaster/group/GroupTest.java| 388 +++
 .../group/internal/ZooKeeperGroupTest.java  | 232 +++
 .../src/test/resources/log4j2.properties|  45 ++
 .../MasterEndpointTest-context.xml  |  43 ++
 .../MasterQuartz2EndpointTest-context.xml   |  45 ++
 components/readme.adoc  |   7 +-
 docs/user-manual/en/SUMMARY.md  |   1 +
 parent/pom.xml  |   5 +
 .../camel-zookeeper-master-starter/pom.xml  |  51 ++
 .../MasterComponentAutoConfiguration.java   | 110 +++
 .../MasterComponentConfiguration.java   | 111 +++
 .../src/main/resources/META-INF/LICENSE.txt | 203 ++
 .../src/main/resources/META-INF/NOTICE.txt  |  11 +
 ...dditional-spring-configuration-metadata.json |  10 +
 .../main/resources/META-INF/spring.factories|  19 +
 .../src/main/resources/META-INF/spring.provides |  18 +
 .../spring-boot/components-starter/pom.xml  |   1 +
 57 files changed, 5076 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/bf82a5ed/apache-camel/pom.xml
--
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index e05f958..db37cc5 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -1068,6 +1068,10 @@
   org.apache.camel
   camel-zookeeper
 
+
+  org.apache.camel
+  camel-zookeeper-master
+
 
 
 

http://git-wip-us.apache.org/repos/asf/camel/blob/bf82a5ed/apache-camel/src/main/descriptors/common-bin.xml
--
diff --git a/apache-camel/src/main/descriptors/common-bin.xml 
b/apache-camel/src/main/descriptors/common-bin.xml
index 672ed0e..ad89366 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml

[1/3] camel git commit: CAMEL-10986: camel-zookeeper-master - Donation of the master component from fabric8 v1

2017-03-10 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master 8e14a77d2 -> bf82a5ed1


http://git-wip-us.apache.org/repos/asf/camel/blob/bf82a5ed/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/group/GroupTest.java
--
diff --git 
a/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/group/GroupTest.java
 
b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/group/GroupTest.java
new file mode 100644
index 000..6bc5757
--- /dev/null
+++ 
b/components/camel-zookeeper-master/src/test/java/org/apache/camel/component/zookeepermaster/group/GroupTest.java
@@ -0,0 +1,388 @@
+/**
+ * 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.zookeepermaster.group;
+
+import java.io.File;
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.camel.component.zookeepermaster.group.internal.ChildData;
+import 
org.apache.camel.component.zookeepermaster.group.internal.ZooKeeperGroup;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.RetryNTimes;
+import org.apache.zookeeper.server.NIOServerCnxnFactory;
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.ZooKeeperServer;
+import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+public class GroupTest {
+
+private GroupListener listener = new GroupListener() {
+@Override
+public void groupEvent(Group group, 
GroupListener.GroupEvent event) {
+boolean connected = group.isConnected();
+boolean master = group.isMaster();
+if (connected) {
+Collection members = group.members().values();
+System.err.println("GroupEvent: " + event + " (connected=" + 
connected + ", master=" + master + ", members=" + members + ")");
+} else {
+System.err.println("GroupEvent: " + event + " (connected=" + 
connected + ", master=false)");
+}
+}
+};
+
+private int findFreePort() throws Exception {
+ServerSocket ss = new ServerSocket(0);
+int port = ss.getLocalPort();
+ss.close();
+return port;
+}
+
+private NIOServerCnxnFactory startZooKeeper(int port) throws Exception {
+ServerConfig cfg = new ServerConfig();
+cfg.parse(new String[] {Integer.toString(port), "target/zk/data"});
+
+ZooKeeperServer zkServer = new ZooKeeperServer();
+FileTxnSnapLog ftxn = new FileTxnSnapLog(new 
File(cfg.getDataLogDir()), new File(cfg.getDataDir()));
+zkServer.setTxnLogFactory(ftxn);
+zkServer.setTickTime(cfg.getTickTime());
+zkServer.setMinSessionTimeout(6000);
+zkServer.setMaxSessionTimeout(9000);
+NIOServerCnxnFactory cnxnFactory = new NIOServerCnxnFactory();
+cnxnFactory.configure(cfg.getClientPortAddress(), 
cfg.getMaxClientCnxns());
+cnxnFactory.startup(zkServer);
+return cnxnFactory;
+}
+
+
+@Test
+public void testOrder() throws Exception {
+int port = findFreePort();
+
+CuratorFramework curator = CuratorFrameworkFactory.builder()
+.connectString("localhost:" + port)
+.retryPolicy(new RetryNTimes(10, 100))
+.build();
+curator.start();
+
+
+final String path = "/singletons/test/Order" + 
System.currentTimeMillis();
+ArrayList members = new ArrayList();
+for (int i = 0; i < 4; i++) {
+ZooKeeperGroup group = new 
ZooKeeperGroup(curator, path, NodeState.class);
+group.add(listener);
+members.add(group);
+}
+
+for (ZooKeeperGroup group : members) {
+

[2/2] camel git commit: Updated opentracing-java version to 0.20.10, use constants for DB tags, changed default operation to be component name, added mechanism to enable custom decorator for particula

2017-03-10 Thread davsclaus
Updated opentracing-java version to 0.20.10, use constants for DB tags, changed 
default operation to be component name, added mechanism to enable custom 
decorator for particular component to override standard one, added span 
decorators for direct/vm/seda components


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

Branch: refs/heads/master
Commit: 4f6c340534e1cf59833f9f09d65b883d49c50766
Parents: 7b90764
Author: Gary Brown 
Authored: Fri Mar 10 11:01:17 2017 +
Committer: Claus Ibsen 
Committed: Fri Mar 10 17:08:59 2017 +0100

--
 .../camel/opentracing/OpenTracingTracer.java| 11 +++-
 .../decorators/AbstractHttpSpanDecorator.java   |  5 ++
 .../AbstractInternalSpanDecorator.java  | 31 ++
 .../decorators/AbstractSpanDecorator.java   | 30 +-
 .../decorators/DirectSpanDecorator.java | 26 +
 .../decorators/JdbcSpanDecorator.java   |  6 +-
 .../decorators/MongoDBSpanDecorator.java|  8 ++-
 .../decorators/SedaSpanDecorator.java   | 26 +
 .../decorators/SqlSpanDecorator.java|  6 +-
 .../opentracing/decorators/VmSpanDecorator.java | 26 +
 .../org.apache.camel.opentracing.SpanDecorator  |  4 ++
 .../apache/camel/opentracing/ABCRouteTest.java  | 16 ++---
 .../CamelOpenTracingTestSupport.java|  9 +--
 .../ClientRecipientListRouteTest.java   | 16 ++---
 .../camel/opentracing/MulticastRouteTest.java   | 16 ++---
 .../camel/opentracing/RouteConcurrentTest.java  |  8 +--
 .../apache/camel/opentracing/SpanTestData.java  | 10 
 .../opentracing/TestSEDASpanDecorator.java  | 14 +
 .../camel/opentracing/TwoServiceTest.java   |  8 +--
 .../AbstractHttpSpanDecoratorTest.java  | 61 
 .../decorators/AbstractSpanDecoratorTest.java   | 31 +-
 .../decorators/JdbcSpanDecoratorTest.java   |  6 +-
 .../decorators/MongoDBSpanDecoratorTest.java|  8 ++-
 .../decorators/SqlSpanDecoratorTest.java|  6 +-
 parent/pom.xml  |  2 +-
 25 files changed, 286 insertions(+), 104 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/4f6c3405/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
--
diff --git 
a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
 
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
index 759634f..9a3e34e 100644
--- 
a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
+++ 
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/OpenTracingTracer.java
@@ -70,7 +70,16 @@ public class OpenTracingTracer extends ServiceSupport 
implements RoutePolicyFact
 private CamelContext camelContext;
 
 static {
-ServiceLoader.load(SpanDecorator.class).forEach(d -> 
decorators.put(d.getComponent(), d));
+ServiceLoader.load(SpanDecorator.class).forEach(d -> {
+SpanDecorator existing = decorators.get(d.getComponent());
+// Add span decorator if no existing decorator for the component,
+// or if derived from the existing decorator's class, allowing
+// custom decorators to be added if they extend the standard
+// decorators
+if (existing == null || existing.getClass().isInstance(d)) {
+decorators.put(d.getComponent(), d);
+}
+});
 }
 
 public OpenTracingTracer() {

http://git-wip-us.apache.org/repos/asf/camel/blob/4f6c3405/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
--
diff --git 
a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
 
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
index a498349..25c676d 100644
--- 
a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
+++ 
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractHttpSpanDecorator.java
@@ -29,7 +29,10 @@ public abstract class AbstractHttpSpanDecorator extends 
AbstractSpanDecorator {
 @Override
 public String getOperationName(Exchange exchange, Endpoint endpoint) {
 // Based on HTTP 

[1/2] camel git commit: Sanitize endpoint uri to avoid passwords being visible

2017-03-10 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master 7b9076400 -> 8e14a77d2


Sanitize endpoint uri to avoid passwords being visible


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

Branch: refs/heads/master
Commit: 8e14a77d2db4f54d4757c91746ef1b123ba14992
Parents: 4f6c340
Author: Gary Brown 
Authored: Fri Mar 10 15:45:44 2017 +
Committer: Claus Ibsen 
Committed: Fri Mar 10 17:08:59 2017 +0100

--
 .../camel/opentracing/decorators/AbstractSpanDecorator.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/8e14a77d/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
--
diff --git 
a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
 
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
index 9106258..b87238b 100644
--- 
a/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
+++ 
b/components/camel-opentracing/src/main/java/org/apache/camel/opentracing/decorators/AbstractSpanDecorator.java
@@ -25,6 +25,7 @@ import io.opentracing.tag.Tags;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.opentracing.SpanDecorator;
+import org.apache.camel.util.URISupport;
 
 /**
  * An abstract base implementation of the {@link SpanDecorator} interface.
@@ -66,7 +67,7 @@ public abstract class AbstractSpanDecorator implements 
SpanDecorator {
 
 // Including the endpoint URI provides access to any options that may 
have been provided, for
 // subsequent analysis
-span.setTag("camel.uri", endpoint.getEndpointUri());
+span.setTag("camel.uri", 
URISupport.sanitizeUri(endpoint.getEndpointUri()));
 }
 
 @Override



[2/2] camel git commit: CAMEL-10931: deprecated typeList and outTypeList, and removed references from rest-api doc

2017-03-10 Thread acosentino
CAMEL-10931: deprecated typeList and outTypeList, and removed references from 
rest-api doc


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

Branch: refs/heads/master
Commit: 7017beea4d6cf4e2ec5a868c901aa7e659806e1f
Parents: 38b5d1d
Author: Scott Cranton 
Authored: Fri Mar 10 08:17:00 2017 -0500
Committer: Andrea Cosentino 
Committed: Fri Mar 10 16:03:58 2017 +0100

--
 camel-core/src/main/docs/rest-api-component.adoc  |  8 ++--
 .../org/apache/camel/model/rest/RestDefinition.java   | 14 ++
 2 files changed, 16 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/7017beea/camel-core/src/main/docs/rest-api-component.adoc
--
diff --git a/camel-core/src/main/docs/rest-api-component.adoc 
b/camel-core/src/main/docs/rest-api-component.adoc
index efd4477..2036281 100644
--- a/camel-core/src/main/docs/rest-api-component.adoc
+++ b/camel-core/src/main/docs/rest-api-component.adoc
@@ -409,9 +409,7 @@ rest("/users/")
 
---
 
 To specify input and/or output using an array, append `[]` to the end
-of the canonical class name, or you can alternatively use the Java DSL only
-continence `typeList` and `outTypeList` where you just specify the array 
element type.
-Both approaches are shown in the following Java DSL:
+of the canonical class name as shown in the following Java DSL:
 
 [source,java]
 
---
@@ -422,9 +420,7 @@ 
restConfiguration().component("restlet").host("localhost").port(portNum).binding
 // use the rest DSL to define the rest services
 rest("/users/")
 .post().type(UserPojo[].class).outType(CountryPojo[].class)
-.to("direct:newUser")
-.put().typeList(UserPojo.class).outTypeList(CountryPojo.class)
-.to("direct:updateUser");
+.to("direct:newUser");
 
---
 
 The `UserPojo` is just a plain pojo with getter/setter as shown:

http://git-wip-us.apache.org/repos/asf/camel/blob/7017beea/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java 
b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index 3cd6b2c..fd30e91 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -412,6 +412,13 @@ public class RestDefinition extends 
OptionalIdentifiedDefinition
 return this;
 }
 
+/**
+ * @param classType the canonical class name for the array passed as input
+ *
+ * @deprecated as of 2.19.0. Replaced wtih {@link #type(Class)} with 
{@code []} appended to canonical class name
+ * , e.g. {@code type(MyClass[].class}
+ */
+@Deprecated
 public RestDefinition typeList(Class classType) {
 // add to last verb
 if (getVerbs().isEmpty()) {
@@ -435,6 +442,13 @@ public class RestDefinition extends 
OptionalIdentifiedDefinition
 return this;
 }
 
+/**
+ * @param classType the canonical class name for the array passed as output
+ *
+ * @deprecated as of 2.19.0. Replaced wtih {@link #outType(Class)} with 
{@code []} appended to canonical class name
+ * , e.g. {@code outType(MyClass[].class}
+ */
+@Deprecated
 public RestDefinition outTypeList(Class classType) {
 // add to last verb
 if (getVerbs().isEmpty()) {



[1/2] camel git commit: CAMEL-10983: Fail early and show meaningful log for invalid endpoint URI in Blueprint

2017-03-10 Thread acosentino
Repository: camel
Updated Branches:
  refs/heads/master 38b5d1df2 -> 7b9076400


CAMEL-10983: Fail early and show meaningful log for invalid endpoint URI in 
Blueprint


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

Branch: refs/heads/master
Commit: 7b90764008ef2031d5bb9e4558224ffa0c2a1603
Parents: 7017bee
Author: Tadayoshi Sato 
Authored: Fri Mar 10 22:05:12 2017 +0900
Committer: Andrea Cosentino 
Committed: Fri Mar 10 16:03:58 2017 +0100

--
 .../handler/CamelNamespaceHandler.java  | 37 ++--
 1 file changed, 26 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/7b907640/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
--
diff --git 
a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
 
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
index fde7d7e..3ad1f04 100644
--- 
a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
+++ 
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.blueprint.handler;
 
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
@@ -987,9 +988,9 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
 CamelContextFactoryBean ccfb = (CamelContextFactoryBean) 
blueprintContainer.getComponentInstance(".camelBlueprint.factory." + 
camelContextName);
 CamelContext camelContext = ccfb.getContext();
 
-Set components = new HashSet();
-Set languages = new HashSet();
-Set dataformats = new HashSet();
+Set components = new HashSet<>();
+Set languages = new HashSet<>();
+Set dataformats = new HashSet<>();
 
 // regular camel routes
 for (RouteDefinition rd : camelContext.getRouteDefinitions()) {
@@ -1151,16 +1152,20 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
 
 private void findUriComponent(String uri, Set components) {
 // if the uri is a placeholder then skip it
-if (uri != null && 
uri.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
+if (uri == null || 
uri.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
 return;
 }
 
-if (uri != null) {
-String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 2);
-if (splitURI[1] != null) {
-String scheme = splitURI[0];
-components.add(scheme);
-}
+// validate uri here up-front so a meaningful error can be logged 
for blueprint
+// it will also speed up tests in case of failure
+if (!validateUri(uri)) {
+return;
+}
+
+String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 2);
+if (splitURI[1] != null) {
+String scheme = splitURI[0];
+components.add(scheme);
 }
 }
 
@@ -1186,11 +1191,21 @@ public class CamelNamespaceHandler implements 
NamespaceHandler {
 }
 }
 } catch (URISyntaxException e) {
-// ignore
+// ignore as uri should be already validated at 
findUriComponent method
 }
 }
 }
 
+private static boolean validateUri(String uri) {
+try {
+// the same validation as done in 
DefaultCamelContext#normalizeEndpointUri(String)
+URISupport.normalizeUri(uri);
+} catch (URISyntaxException | UnsupportedEncodingException e) {
+LOG.error("Endpoint URI '" + uri + "' is not valid due to: " + 
e.getMessage(), e);
+return false;
+}
+return true;
+}
 }
 
 }



camel git commit: CAMEL-10984: Creating consumer should inject CamelContext if consumer is aware

2017-03-10 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master 6343f8cce -> 38b5d1df2


CAMEL-10984: Creating consumer should inject CamelContext if consumer is aware


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

Branch: refs/heads/master
Commit: 38b5d1df236d33e3392201b1ef5a12dc8f2dc3a6
Parents: 6343f8c
Author: Claus Ibsen 
Authored: Fri Mar 10 15:33:22 2017 +0100
Committer: Claus Ibsen 
Committed: Fri Mar 10 16:02:54 2017 +0100

--
 .../org/apache/camel/impl/DefaultEndpoint.java  |  5 +++
 .../component/vm/ConsumerCamelContextAware.java | 36 
 2 files changed, 41 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/38b5d1df/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java 
b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
index eb99480..3a3dc07 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
@@ -493,6 +493,11 @@ public abstract class DefaultEndpoint extends 
ServiceSupport implements Endpoint
 }
 
 protected void configureConsumer(Consumer consumer) throws Exception {
+// inject CamelContext
+if (consumer instanceof CamelContextAware) {
+((CamelContextAware) consumer).setCamelContext(getCamelContext());
+}
+
 if (consumerProperties != null) {
 // use a defensive copy of the consumer properties as the methods 
below will remove the used properties
 // and in case we restart routes, we need access to the original 
consumer properties again

http://git-wip-us.apache.org/repos/asf/camel/blob/38b5d1df/camel-core/src/test/java/org/apache/camel/component/vm/ConsumerCamelContextAware.java
--
diff --git 
a/camel-core/src/test/java/org/apache/camel/component/vm/ConsumerCamelContextAware.java
 
b/camel-core/src/test/java/org/apache/camel/component/vm/ConsumerCamelContextAware.java
new file mode 100644
index 000..464e9b2
--- /dev/null
+++ 
b/camel-core/src/test/java/org/apache/camel/component/vm/ConsumerCamelContextAware.java
@@ -0,0 +1,36 @@
+/**
+ * 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.vm;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.ContextTestSupport;
+
+public class ConsumerCamelContextAware extends ContextTestSupport {
+
+@Override
+public boolean isUseRouteBuilder() {
+return false;
+}
+
+public void testConsumerCamelContextAware() throws Exception {
+Consumer consumer = context.getEndpoint("vm:foo").createConsumer(null);
+assertNotNull(consumer);
+
+VmConsumer vm = assertIsInstanceOf(VmConsumer.class, consumer);
+assertEquals(vm.getCamelContext(), context);
+}
+}



[1/4] camel git commit: CAMEL-10795: PingCheck API - includes CAMEL-10923, CAMEL-10924

2017-03-10 Thread lburgazzoli
Repository: camel
Updated Branches:
  refs/heads/master b27c98c95 -> 6343f8cce


http://git-wip-us.apache.org/repos/asf/camel/blob/c6d54c03/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorModel.java
--
diff --git 
a/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorModel.java
 
b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorModel.java
new file mode 100644
index 000..c5ef6ef
--- /dev/null
+++ 
b/connectors/camel-connector/src/main/java/org/apache/camel/component/connector/ConnectorModel.java
@@ -0,0 +1,266 @@
+/**
+ * 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.connector;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Supplier;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import org.apache.camel.util.StringHelper;
+import org.apache.camel.util.function.Suppliers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+final class ConnectorModel {
+private static final Logger LOGGER = 
LoggerFactory.getLogger(ConnectorModel.class);
+
+private static final Pattern NAME_PATTERN = 
Pattern.compile("\"name\"\\s?:\\s?\"([\\w|.]+)\".*");
+private static final Pattern JAVA_TYPE_PATTERN = 
Pattern.compile("\"javaType\"\\s?:\\s?\"([\\w|.]+)\".*");
+private static final Pattern BASE_JAVA_TYPE_PATTERN = 
Pattern.compile("\"baseJavaType\"\\s?:\\s?\"([\\w|.]+)\".*");
+private static final Pattern BASE_SCHEME_PATTERN = 
Pattern.compile("\"baseScheme\"\\s?:\\s?\"([\\w|.]+)\".*");
+
+private final String componentName;
+private final String className;
+private final Supplier lines;
+
+private String baseScheme;
+private String baseJavaType;
+private String connectorJSon;
+private String connectorName;
+private Map defaultComponentOptions;
+private Map defaultEndpointOptions;
+
+public ConnectorModel(String componentName, String className) {
+this.componentName = componentName;
+this.className = className;
+this.lines = Suppliers.memorize(() -> findCamelConnectorJSonSchema());
+}
+
+public String getComponentName() {
+return componentName;
+}
+
+public String getClassName() {
+return className;
+}
+
+public String getBaseScheme() {
+if (baseScheme == null) {
+baseScheme = extractBaseScheme(lines.get());
+}
+
+return baseScheme;
+}
+
+public String getBaseJavaType() {
+if (baseJavaType == null) {
+baseJavaType = extractBaseJavaType(lines.get());
+}
+
+return baseJavaType;
+}
+
+public String getConnectorName() {
+if (connectorName == null) {
+connectorName = extractName(lines.get());
+}
+
+return connectorName;
+}
+
+public String getConnectorJSon() {
+if (connectorJSon == null) {
+connectorJSon = 
lines.get().stream().collect(Collectors.joining("\n"));
+}
+
+return connectorJSon;
+}
+
+public Map getDefaultComponentOptions() {
+if (defaultComponentOptions == null) {
+defaultComponentOptions = 
Collections.unmodifiableMap(extractComponentDefaultValues(lines.get()));
+}
+
+return defaultComponentOptions;
+}
+
+public Map getDefaultEndpointOptions() {
+if (defaultEndpointOptions == null) {
+defaultEndpointOptions = 
Collections.unmodifiableMap(extractEndpointDefaultValues(lines.get()));
+}
+
+return defaultEndpointOptions;
+}
+
+// ***
+// Helpers
+// ***
+
+

[2/4] camel git commit: CAMEL-10795: PingCheck API - includes CAMEL-10923, CAMEL-10924

2017-03-10 Thread lburgazzoli
http://git-wip-us.apache.org/repos/asf/camel/blob/c6d54c03/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponentVerifier.java
--
diff --git 
a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponentVerifier.java
 
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponentVerifier.java
new file mode 100644
index 000..aa459cc
--- /dev/null
+++ 
b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponentVerifier.java
@@ -0,0 +1,211 @@
+/**
+ * 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.http4;
+
+import java.net.UnknownHostException;
+import java.util.Map;
+import java.util.Optional;
+
+import org.apache.camel.ComponentVerifier;
+import org.apache.camel.http.common.HttpHelper;
+import org.apache.camel.impl.verifier.DefaultComponentVerifier;
+import org.apache.camel.impl.verifier.ResultBuilder;
+import org.apache.camel.impl.verifier.ResultErrorBuilder;
+import org.apache.camel.impl.verifier.ResultErrorHelper;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+
+final class HttpComponentVerifier extends DefaultComponentVerifier {
+private final HttpComponent component;
+
+HttpComponentVerifier(HttpComponent component) {
+super(component.getCamelContext());
+
+this.component = component;
+}
+
+// *
+// Parameters validation
+// *
+
+@Override
+protected Result verifyParameters(Map parameters) {
+// The default is success
+ResultBuilder builder = 
ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS);
+
+// The httpUri is mandatory
+builder.error(ResultErrorHelper.requiresOption("httpUri", parameters));
+
+return builder.build();
+}
+
+// *
+// Connectivity validation
+// *
+
+@Override
+protected Result verifyConnectivity(Map parameters) {
+// Default is success
+ResultBuilder builder = 
ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY);
+
+Optional uri = getOption(parameters, "httpUri", String.class);
+if (!uri.isPresent()) {
+// lack of httpUri is a blocking issue
+builder.error(ResultErrorHelper.requiresOption("httpUri", 
parameters));
+} else {
+builder.error(parameters, this::verifyHttpConnectivity);
+}
+
+return builder.build();
+}
+
+private void verifyHttpConnectivity(ResultBuilder builder, Map parameters) throws Exception {
+Optional uri = getOption(parameters, "httpUri", String.class);
+
+CloseableHttpClient httpclient = createHttpClient(parameters);
+HttpUriRequest request = new HttpGet(uri.get());
+
+try (CloseableHttpResponse response = httpclient.execute(request)) {
+int code = response.getStatusLine().getStatusCode();
+String okCodes = getOption(parameters, "okStatusCodeRange", 
String.class).orElse("200-299");
+
+if (!HttpHelper.isStatusCodeOk(code, okCodes)) {
+if (code == 401) {
+// Unauthorized, add authUsername and authPassword to the 
list
+// of parameters in error
+builder.error(
+ResultErrorBuilder.withHttpCode(code)
+
.description(response.getStatusLine().getReasonPhrase())
+.parameter("authUsername")
+.parameter("authPassword")
+.build()
+);
+} else if (code >= 300 && code < 400) {
+// redirect
+   

[3/4] camel git commit: CAMEL-10795: PingCheck API - includes CAMEL-10923, CAMEL-10924

2017-03-10 Thread lburgazzoli
CAMEL-10795: PingCheck API - includes CAMEL-10923, CAMEL-10924


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

Branch: refs/heads/master
Commit: c6d54c0349cc41c41c1aa3ff734da1ab9aa02a03
Parents: b27c98c
Author: lburgazzoli 
Authored: Thu Feb 23 17:15:52 2017 +0100
Committer: lburgazzoli 
Committed: Fri Mar 10 14:35:59 2017 +0100

--
 .../org/apache/camel/ComponentVerifier.java |  80 ++
 .../camel/ComponentVerifierException.java   |  34 +++
 .../apache/camel/IllegalOptionException.java|  39 +++
 .../org/apache/camel/NoSuchOptionException.java |  29 ++
 .../org/apache/camel/VerifiableComponent.java   |  29 ++
 .../management/mbean/ManagedComponentMBean.java |   4 +
 .../org/apache/camel/impl/DefaultComponent.java |   2 +
 .../impl/verifier/DefaultComponentVerifier.java | 129 +
 .../camel/impl/verifier/DefaultResult.java  |  57 
 .../camel/impl/verifier/DefaultResultError.java |  66 +
 .../camel/impl/verifier/ResultBuilder.java  | 134 +
 .../camel/impl/verifier/ResultErrorBuilder.java | 164 +++
 .../camel/impl/verifier/ResultErrorHelper.java  |  43 +++
 .../management/mbean/ManagedComponent.java  |  25 +-
 .../apache/camel/util/IntrospectionSupport.java |   9 +-
 .../camel/util/function/ThrowingBiConsumer.java |  22 ++
 .../camel/util/function/ThrowingConsumer.java   |  22 ++
 .../camel/util/function/ThrowingFunction.java   |  22 ++
 .../camel/util/function/ThrowingHelper.java |  68 +
 .../camel/util/function/ThrowingSupplier.java   |  22 ++
 .../camel/impl/ConfigurationHelperTest.java |   1 +
 .../camel/impl/EndpointConfigurationTest.java   |   1 +
 .../BlueprintComponentResolverTest.java |   1 +
 .../core/osgi/OsgiComponentResolverTest.java|   1 +
 .../component/http/CompositeHttpConfigurer.java |   1 +
 .../camel/component/http/HttpComponent.java |  13 +-
 .../component/http/HttpComponentVerifier.java   | 250 
 .../component/http/HttpProxyConfigurer.java |  45 +++
 .../apache/camel/component/http/HttpUtil.java   |  37 +++
 .../http/CamelComponentVerifierTest.java| 158 +++
 ...BasicAuthenticationHttpClientConfigurer.java |   4 +-
 .../camel/component/http4/HttpComponent.java|  13 +-
 .../component/http4/HttpComponentVerifier.java  | 211 ++
 .../apache/camel/component/http4/HttpUtil.java  |  36 +++
 .../http4/ProxyHttpClientConfigurer.java|   2 +
 .../http4/CamelComponentVerifierTest.java   | 230 +++
 .../camel/component/http4/HttpRedirectTest.java |   1 -
 .../salesforce/SalesforceComponent.java |  18 +-
 .../salesforce/SalesforceComponentVerifier.java | 190 +
 .../SalesforceComponentVerifierTest.java| 143 ++
 .../component/servicenow/ServiceNowClient.java  |  17 +-
 .../servicenow/ServiceNowComponent.java |  14 +-
 .../servicenow/ServiceNowComponentVerifier.java | 113 
 .../servicenow/ServiceNowConfiguration.java |   2 +-
 .../servicenow/ServiceNowException.java |  32 ++-
 .../servicenow/ServiceNowExceptionMapper.java   |  68 -
 .../servicenow/ServiceNowExceptionModel.java|  27 ++
 .../ServiceNowComponentVerifierTest.java| 151 ++
 .../servicenow/ServiceNowTestSupport.java   |  34 ++-
 .../component/twitter/TwitterComponent.java |  11 +-
 .../twitter/TwitterComponentVerifier.java   |  84 ++
 .../component/twitter/TwitterConfiguration.java |   3 +-
 .../twitter/CamelComponentVerifierTest.java | 107 +++
 .../twitter/CamelTwitterTestSupport.java|  12 +
 .../component/connector/ConnectorModel.java | 266 +
 .../connector/DefaultConnectorComponent.java| 282 ++-
 .../tools/apt/EndpointAnnotationProcessor.java  |   9 +
 .../camel/tools/apt/model/ComponentModel.java   |   9 +
 58 files changed, 3291 insertions(+), 306 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/c6d54c03/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java 
b/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java
new file mode 100644
index 000..5628d40
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java
@@ -0,0 +1,80 @@
+/**
+ * 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 

[4/4] camel git commit: CAMEL-10795: PingCheck API - default parameter validation based on camel-catalog

2017-03-10 Thread lburgazzoli
CAMEL-10795: PingCheck API - default parameter validation based on camel-catalog


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

Branch: refs/heads/master
Commit: 6343f8cce9c0253209b6b4465f49ce5209c1bdf2
Parents: c6d54c0
Author: lburgazzoli 
Authored: Thu Mar 9 13:38:44 2017 +0100
Committer: lburgazzoli 
Committed: Fri Mar 10 14:36:00 2017 +0100

--
 .../org/apache/camel/ComponentVerifier.java |   2 +
 .../camel/catalog/AbstractCamelCatalog.java | 192 +++
 .../camel/catalog/EndpointValidationResult.java |  27 ++-
 .../camel/catalog/RuntimeCamelCatalog.java  |   9 +
 .../impl/verifier/DefaultComponentVerifier.java | 111 ---
 .../camel/impl/verifier/DefaultResult.java  |  10 +-
 .../camel/impl/verifier/DefaultResultError.java |  12 +-
 .../camel/impl/verifier/ResultErrorBuilder.java |   7 +
 .../org/apache/camel/util/ObjectHelper.java |   4 +-
 .../java/org/apache/camel/util/StreamUtils.java |  46 +
 .../verifier/DefaultComponentVerifierTest.java  |  80 
 .../component/http/HttpComponentVerifier.java   |   9 +-
 .../component/http4/HttpComponentVerifier.java  |   8 +-
 .../salesforce/SalesforceComponent.java |   2 +-
 .../salesforce/SalesforceComponentVerifier.java |  23 ++-
 .../src/main/docs/servicenow-component.adoc |   4 +-
 .../servicenow/ServiceNowComponentVerifier.java |  16 +-
 .../servicenow/ServiceNowConfiguration.java |   3 +
 .../src/main/docs/twitter-component.adoc|   8 +-
 .../component/twitter/TwitterComponent.java |   2 +-
 .../twitter/TwitterComponentVerifier.java   |  20 +-
 .../component/twitter/TwitterConfiguration.java |   4 +
 .../twitter/CamelComponentVerifierTest.java |  21 +-
 .../camel/catalog/AbstractCamelCatalog.java | 192 +++
 .../camel/catalog/EndpointValidationResult.java |  27 ++-
 .../tools/apt/EndpointAnnotationProcessor.java  |   5 +-
 26 files changed, 752 insertions(+), 92 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/6343f8cc/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java
--
diff --git a/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java 
b/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java
index 5628d40..14bec23 100644
--- a/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java
+++ b/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java
@@ -24,7 +24,9 @@ import java.util.Set;
 public interface ComponentVerifier {
 // Todo: should be an enum ?
 String CODE_EXCEPTION = "exception";
+String CODE_INTERNAL = "internal";
 String CODE_MISSING_OPTION = "missing-option";
+String CODE_UNKNOWN_OPTION = "unknown-option";
 String CODE_ILLEGAL_OPTION = "illegal-option";
 String CODE_ILLEGAL_OPTION_VALUE = "illegal-option-value";
 String CODE_UNSUPPORTED = "unsupported";

http://git-wip-us.apache.org/repos/asf/camel/blob/6343f8cc/camel-core/src/main/java/org/apache/camel/catalog/AbstractCamelCatalog.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/catalog/AbstractCamelCatalog.java 
b/camel-core/src/main/java/org/apache/camel/catalog/AbstractCamelCatalog.java
index 3295ca9..50c5fa3 100644
--- 
a/camel-core/src/main/java/org/apache/camel/catalog/AbstractCamelCatalog.java
+++ 
b/camel-core/src/main/java/org/apache/camel/catalog/AbstractCamelCatalog.java
@@ -26,12 +26,15 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 import static org.apache.camel.catalog.CatalogHelper.after;
 import static org.apache.camel.catalog.JSonSchemaHelper.getNames;
@@ -98,6 +101,195 @@ public abstract class AbstractCamelCatalog {
 return validateEndpointProperties(uri, ignoreLenientProperties, false, 
false);
 }
 
+public EndpointValidationResult validateProperties(String scheme, 
Map properties) {
+EndpointValidationResult result = new EndpointValidationResult(scheme);
+
+String json = jsonSchemaResolver.getComponentJSonSchema(scheme);
+List> rows = 
JSonSchemaHelper.parseJsonSchema("properties", json, true);
+List

[3/3] camel git commit: CAMEL-7862 - cs fixes

2017-03-10 Thread acosentino
CAMEL-7862 - cs fixes


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

Branch: refs/heads/master
Commit: b27c98c957ba78b3979eb4d7e8b54a90ae36c6b0
Parents: c609efd
Author: onders86 
Authored: Fri Mar 10 15:18:44 2017 +0300
Committer: Andrea Cosentino 
Committed: Fri Mar 10 13:37:45 2017 +0100

--
 .../camel/dataformat/bindy/BindyCsvFactory.java |  6 ++---
 .../bindy/csv/BindyCsvDataFormat.java   | 26 +++-
 ...ySimpleCsvMandatoryFieldsUnmarshallTest.java | 10 
 3 files changed, 22 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/b27c98c9/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
--
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
index 4baaa31..b437835 100755
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
@@ -658,7 +658,7 @@ public class BindyCsvFactory extends BindyAbstractFactory 
implements BindyFactor
 return maxpos;
 }
 
-   public boolean isAllowEmptyStream() {
-   return allowEmptyStream;
-   }
+public boolean isAllowEmptyStream() {
+return allowEmptyStream;
+}
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b27c98c9/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
--
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
index 4aa8da6..45b4cd3 100755
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
@@ -106,28 +106,30 @@ public class BindyCsvDataFormat extends 
BindyAbstractDataFormat {
 outputStream.write(bytesCRLF);
 }
 }
-
+
 /**
  * check emptyStream and if CVSRecord is allow to process emptyStreams
  * avoid IllegalArgumentException and return empty list when unmarshalling
  */
 private boolean checkEmptyStream(BindyCsvFactory factory, InputStream 
inputStream) throws IOException {
-   boolean allowEmptyStream = factory.isAllowEmptyStream();
+boolean allowEmptyStream = factory.isAllowEmptyStream();
 boolean isStreamEmpty = false;
 boolean canReturnEmptyListOfModels = false;
 
-if(inputStream == null || inputStream.available() == 0)
-   isStreamEmpty = true;
+if (inputStream == null || inputStream.available() == 0) {
+isStreamEmpty = true;
+}
 
-if(isStreamEmpty == true && allowEmptyStream == true)
-   canReturnEmptyListOfModels = true;
+if (isStreamEmpty && allowEmptyStream) {
+canReturnEmptyListOfModels = true;
+}
 
 return canReturnEmptyListOfModels;
 }
 
 public Object unmarshal(Exchange exchange, InputStream inputStream) throws 
Exception {
 BindyCsvFactory factory = (BindyCsvFactory)getFactory();
-ObjectHelper.notNull(factory, "not instantiated"); 
+ObjectHelper.notNull(factory, "not instantiated");
 
 // List of Pojos
 List> models = new ArrayList>();
@@ -137,9 +139,9 @@ public class BindyCsvDataFormat extends 
BindyAbstractDataFormat {
 InputStreamReader in = null;
 Scanner scanner = null;
 try {
-
-if (checkEmptyStream(factory,inputStream))
-   return models;
+if (checkEmptyStream(factory, inputStream)) {
+return models;
+}
 
 in = new InputStreamReader(inputStream, 
IOHelper.getCharsetName(exchange));
 
@@ -214,10 +216,10 @@ public class BindyCsvDataFormat extends 
BindyAbstractDataFormat {
 }
 
 } finally {
-if(scanner != null) {
+if (scanner != null) {
 scanner.close();
 }
-if(in != null) {
+if (in != null) {
 

[2/3] camel git commit: CAMEL-7862-add CVSRecord annotation attribute to allow empty streams to be processed

2017-03-10 Thread acosentino
CAMEL-7862-add CVSRecord annotation attribute to allow empty streams to be 
processed


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

Branch: refs/heads/master
Commit: ddbbf64e8b93b216f724c66396cd008aafebc04d
Parents: 58dea19
Author: onders86 
Authored: Fri Mar 10 11:45:47 2017 +0300
Committer: Andrea Cosentino 
Committed: Fri Mar 10 13:37:44 2017 +0100

--
 .../model/simple/oneclassemptystream/Order.java | 166 +++
 1 file changed, 166 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/ddbbf64e/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassemptystream/Order.java
--
diff --git 
a/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassemptystream/Order.java
 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassemptystream/Order.java
new file mode 100755
index 000..f63e347
--- /dev/null
+++ 
b/components/camel-bindy/src/test/java/org/apache/camel/dataformat/bindy/model/simple/oneclassemptystream/Order.java
@@ -0,0 +1,166 @@
+/**
+ * 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.dataformat.bindy.model.simple.oneclassemptystream;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import org.apache.camel.dataformat.bindy.annotation.CsvRecord;
+import org.apache.camel.dataformat.bindy.annotation.DataField;
+
+@CsvRecord(separator = ",", allowEmptyStream = true)
+public class Order {
+
+@DataField(pos = 1)
+private int orderNr;
+
+@DataField(pos = 2)
+private String clientNr;
+
+@DataField(pos = 3, defaultValue = "Joe")
+private String firstName;
+
+@DataField(pos = 4)
+private String lastName;
+
+@DataField(pos = 5)
+private String instrumentCode;
+
+@DataField(pos = 6)
+private String instrumentNumber;
+
+@DataField(pos = 7)
+private String orderType;
+
+@DataField(name = "Name", pos = 8)
+private String instrumentType;
+
+@DataField(pos = 9, precision = 2)
+private BigDecimal amount;
+
+@DataField(pos = 10)
+private String currency;
+
+@DataField(pos = 11, pattern = "dd-MM-")
+private Date orderDate;
+
+@DataField(pos = 12, pattern = "dd-MM- HH:mm:ss", timezone = "GMT+4")
+private Date orderDateTime;
+
+public int getOrderNr() {
+return orderNr;
+}
+
+public void setOrderNr(int orderNr) {
+this.orderNr = orderNr;
+}
+
+public String getClientNr() {
+return clientNr;
+}
+
+public void setClientNr(String clientNr) {
+this.clientNr = clientNr;
+}
+
+public String getFirstName() {
+return firstName;
+}
+
+public void setFirstName(String firstName) {
+this.firstName = firstName;
+}
+
+public String getLastName() {
+return lastName;
+}
+
+public void setLastName(String lastName) {
+this.lastName = lastName;
+}
+
+public String getInstrumentCode() {
+return instrumentCode;
+}
+
+public void setInstrumentCode(String instrumentCode) {
+this.instrumentCode = instrumentCode;
+}
+
+public String getInstrumentNumber() {
+return instrumentNumber;
+}
+
+public void setInstrumentNumber(String instrumentNumber) {
+this.instrumentNumber = instrumentNumber;
+}
+
+public String getOrderType() {
+return orderType;
+}
+
+public void setOrderType(String orderType) {
+this.orderType = orderType;
+}
+
+public String getInstrumentType() {
+return instrumentType;
+}
+
+public void setInstrumentType(String instrumentType) {
+this.instrumentType = instrumentType;
+}
+
+public BigDecimal 

[1/3] camel git commit: CAMEL-7862-add CVSRecord annotation attribute to allow empty streams to be processed

2017-03-10 Thread acosentino
Repository: camel
Updated Branches:
  refs/heads/master 58dea1965 -> b27c98c95


CAMEL-7862-add CVSRecord annotation attribute to allow empty streams to be 
processed


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

Branch: refs/heads/master
Commit: c609efd63d25b7868f6869ca4ca2b3bd74b47245
Parents: ddbbf64
Author: onders86 
Authored: Fri Mar 10 11:47:15 2017 +0300
Committer: Andrea Cosentino 
Committed: Fri Mar 10 13:37:44 2017 +0100

--
 .../camel/dataformat/bindy/BindyCsvFactory.java |  9 +++
 .../dataformat/bindy/annotation/CsvRecord.java  |  6 ++
 .../bindy/csv/BindyCsvDataFormat.java   | 83 +---
 ...ySimpleCsvMandatoryFieldsUnmarshallTest.java | 26 ++
 4 files changed, 97 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/c609efd6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
--
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
index 943f85c..4baaa31 100755
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyCsvFactory.java
@@ -67,6 +67,7 @@ public class BindyCsvFactory extends BindyAbstractFactory 
implements BindyFactor
 private String quote;
 private boolean quoting;
 private boolean autospanLine;
+private boolean allowEmptyStream;
 
 public BindyCsvFactory(Class type) throws Exception {
 super(type);
@@ -570,6 +571,10 @@ public class BindyCsvFactory extends BindyAbstractFactory 
implements BindyFactor
 
 autospanLine = record.autospanLine();
 LOG.debug("Autospan line in last record: {}", 
autospanLine);
+
+// Get skipFirstLine parameter
+allowEmptyStream = record.allowEmptyStream();
+LOG.debug("Allo empty stream parameter of the CSV: {}" + 
allowEmptyStream);
 }
 
 if (section != null) {
@@ -652,4 +657,8 @@ public class BindyCsvFactory extends BindyAbstractFactory 
implements BindyFactor
 public int getMaxpos() {
 return maxpos;
 }
+
+   public boolean isAllowEmptyStream() {
+   return allowEmptyStream;
+   }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c609efd6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java
--
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java
index d6573e7..6a1094d 100755
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/CsvRecord.java
@@ -84,5 +84,11 @@ public @interface CsvRecord {
  * Last record spans rest of line (optional)
  */
 boolean autospanLine() default false;
+
+/**
+ * The allowEmptyStream parameter will allow to prcoess 
+ * the unavaiable stream for CSV file.
+ */
+boolean allowEmptyStream() default false;
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c609efd6/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
--
diff --git 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
index 06ead20..4aa8da6 100755
--- 
a/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
+++ 
b/components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/csv/BindyCsvDataFormat.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.dataformat.bindy.csv;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
@@ -105,29 +106,53 @@ public class BindyCsvDataFormat extends 
BindyAbstractDataFormat {
 outputStream.write(bytesCRLF);
 }
 }
+
+/**
+ * check 

camel git commit: CAMEL-10961: Backported parts of CAMEL-10292 in order to fix possible NPE in ZooKeeperProducer.

2017-03-10 Thread acosentino
Repository: camel
Updated Branches:
  refs/heads/camel-2.18.x 8620ae9e5 -> dc46e915d


CAMEL-10961: Backported parts of CAMEL-10292 in order to fix possible NPE in 
ZooKeeperProducer.


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

Branch: refs/heads/camel-2.18.x
Commit: dc46e915da034a0a07ff7348f19b711e0c6e4387
Parents: 8620ae9
Author: Andreas Ländle 
Authored: Fri Mar 10 13:17:12 2017 +0100
Committer: Andreas Ländle 
Committed: Fri Mar 10 13:17:12 2017 +0100

--
 .../org/apache/camel/component/zookeeper/ZooKeeperProducer.java   | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/dc46e915/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperProducer.java
--
diff --git 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperProducer.java
 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperProducer.java
index 449a138..37b236e 100644
--- 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperProducer.java
+++ 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperProducer.java
@@ -64,6 +64,9 @@ public class ZooKeeperProducer extends DefaultProducer {
 
 public void process(Exchange exchange) throws Exception {
 
+if (connection == null) {
+connection = this.zkm.getConnection();
+}
 ProductionContext context = new ProductionContext(connection, 
exchange);
 
 String operation = 
exchange.getIn().getHeader(ZooKeeperMessage.ZOOKEEPER_OPERATION, String.class);



camel git commit: Update Ignite to version 1.9.0 and aligned Karaf feature integration test

2017-03-10 Thread acosentino
Repository: camel
Updated Branches:
  refs/heads/master 5e300c4d2 -> 58dea1965


Update Ignite to version 1.9.0 and aligned Karaf feature integration test


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

Branch: refs/heads/master
Commit: 58dea1965b020dcf8da817201e88eada5d387ef5
Parents: 5e300c4
Author: Andrea Cosentino 
Authored: Fri Mar 10 12:57:25 2017 +0100
Committer: Andrea Cosentino 
Committed: Fri Mar 10 12:57:25 2017 +0100

--
 parent/pom.xml   | 3 +--
 platforms/karaf/features/src/main/resources/features.xml | 2 +-
 .../test/java/org/apache/camel/itest/karaf/CamelIgniteTest.java  | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/58dea196/parent/pom.xml
--
diff --git a/parent/pom.xml b/parent/pom.xml
index 3835a3d..e9245ae 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -274,8 +274,7 @@
 2.3.4.726_4
 2.3.4.726
 1.0.7
-1.8.0
-[1.5.0-b1,1.6)
+1.9.0
 8.2.6.Final
 2.5
 
2.5_1

http://git-wip-us.apache.org/repos/asf/camel/blob/58dea196/platforms/karaf/features/src/main/resources/features.xml
--
diff --git a/platforms/karaf/features/src/main/resources/features.xml 
b/platforms/karaf/features/src/main/resources/features.xml
index b52f404..a805df4 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -875,7 +875,7 @@
 Please refer to the component page 
(https://camel.apache.org/ignite.html) and to the Ignite docs 
(https://apacheignite.readme.io/docs/osgi-installation-in-karaf#preparatory-steps)
 for more information.]]>
 
 camel-core
-ignite-core
+ignite-core
 mvn:org.apache.camel/camel-ignite/${project.version}
   
   

http://git-wip-us.apache.org/repos/asf/camel/blob/58dea196/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelIgniteTest.java
--
diff --git 
a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelIgniteTest.java
 
b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelIgniteTest.java
index 82dffcd..03a5803 100644
--- 
a/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelIgniteTest.java
+++ 
b/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelIgniteTest.java
@@ -47,7 +47,7 @@ public class CamelIgniteTest extends BaseKarafTest {
 @Test
 public void test() throws Exception {
 // install ignite first
-String version = "1.5.0.final";
+String version = "1.9.0";
 LOG.info("Using Apache Ignite version: {}", version);
 URI url = new URI("mvn:org.apache.ignite/ignite-osgi-karaf/" + version 
+ "/xml/features");
 
@@ -58,4 +58,4 @@ public class CamelIgniteTest extends BaseKarafTest {
 testComponent(COMPONENT);
 }
 
-}
\ No newline at end of file
+}



[1/2] camel git commit: CAMEL-10977: Add a camel-hazelcast example on Kubernetes

2017-03-10 Thread acosentino
Repository: camel
Updated Branches:
  refs/heads/master ca6249b06 -> 5e300c4d2


CAMEL-10977: Add a camel-hazelcast example on Kubernetes


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

Branch: refs/heads/master
Commit: b5aa52ee33757323df9d179a3bc41d48c2d9dcf8
Parents: ca6249b
Author: Andrea Cosentino 
Authored: Thu Mar 9 16:27:15 2017 +0100
Committer: Andrea Cosentino 
Committed: Fri Mar 10 11:10:48 2017 +0100

--
 .../LICENSE.md  | 202 +++
 .../ReadMe.md   | 131 
 .../camel-example-hazelcast-kubernetes/pom.xml  | 123 +++
 .../example/kubernetes/fmp/HazelcastRoute.java  |  64 ++
 .../resources/META-INF/spring/camel-context.xml |  36 
 .../resources/fabric8/hazelcast-deployment.yaml |  22 ++
 .../resources/fabric8/hazelcast-service.yaml|  11 +
 .../src/main/resources/log4j.properties |  29 +++
 8 files changed, 618 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/b5aa52ee/examples/camel-example-hazelcast-kubernetes/LICENSE.md
--
diff --git a/examples/camel-example-hazelcast-kubernetes/LICENSE.md 
b/examples/camel-example-hazelcast-kubernetes/LICENSE.md
new file mode 100644
index 000..8f71f43
--- /dev/null
+++ b/examples/camel-example-hazelcast-kubernetes/LICENSE.md
@@ -0,0 +1,202 @@
+ Apache License
+   Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+  "License" shall mean the terms and conditions for use, reproduction,
+  and distribution as defined by Sections 1 through 9 of this document.
+
+  "Licensor" shall mean the copyright owner or entity authorized by
+  the copyright owner that is granting the License.
+
+  "Legal Entity" shall mean the union of the acting entity and all
+  other entities that control, are controlled by, or are under common
+  control with that entity. For the purposes of this definition,
+  "control" means (i) the power, direct or indirect, to cause the
+  direction or management of such entity, whether by contract or
+  otherwise, or (ii) ownership of fifty percent (50%) or more of the
+  outstanding shares, or (iii) beneficial ownership of such entity.
+
+  "You" (or "Your") shall mean an individual or Legal Entity
+  exercising permissions granted by this License.
+
+  "Source" form shall mean the preferred form for making modifications,
+  including but not limited to software source code, documentation
+  source, and configuration files.
+
+  "Object" form shall mean any form resulting from mechanical
+  transformation or translation of a Source form, including but
+  not limited to compiled object code, generated documentation,
+  and conversions to other media types.
+
+  "Work" shall mean the work of authorship, whether in Source or
+  Object form, made available under the License, as indicated by a
+  copyright notice that is included in or attached to the work
+  (an example is provided in the Appendix below).
+
+  "Derivative Works" shall mean any work, whether in Source or Object
+  form, that is based on (or derived from) the Work and for which the
+  editorial revisions, annotations, elaborations, or other modifications
+  represent, as a whole, an original work of authorship. For the purposes
+  of this License, Derivative Works shall not include works that remain
+  separable from, or merely link (or bind by name) to the interfaces of,
+  the Work and Derivative Works thereof.
+
+  "Contribution" shall mean any work of authorship, including
+  the original version of the Work and any modifications or additions
+  to that Work or Derivative Works thereof, that is intentionally
+  submitted to Licensor for inclusion in the Work by the copyright owner
+  or by an individual or Legal Entity authorized to submit on behalf of
+  the copyright owner. For the purposes of this definition, "submitted"
+  means any form of electronic, verbal, or written communication sent
+  to the Licensor or its representatives, including but not limited to
+  communication on electronic mailing lists, source code control systems,
+  and issue tracking systems that are managed by, or on behalf of, the
+  Licensor for the purpose of discussing and 

[2/2] camel git commit: CAMEL-10977: Regen examples docs

2017-03-10 Thread acosentino
CAMEL-10977: Regen examples docs


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

Branch: refs/heads/master
Commit: 5e300c4d244f9dc9a8a328bbf561dd5936d30bd4
Parents: b5aa52e
Author: Andrea Cosentino 
Authored: Fri Mar 10 11:21:07 2017 +0100
Committer: Andrea Cosentino 
Committed: Fri Mar 10 11:21:07 2017 +0100

--
 examples/README.adoc | 4 +++-
 examples/pom.xml | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/5e300c4d/examples/README.adoc
--
diff --git a/examples/README.adoc b/examples/README.adoc
index ab2bd2a..ca4e442 100644
--- a/examples/README.adoc
+++ b/examples/README.adoc
@@ -11,7 +11,7 @@ View the individual example READMEs for details.
 ### Examples
 
 // examples: START
-Number of Examples: 88 (7 deprecated)
+Number of Examples: 89 (7 deprecated)
 
 [width="100%",cols="4,2,4",options="header"]
 |===
@@ -19,6 +19,8 @@ Number of Examples: 88 (7 deprecated)
 
 | link:camel-example-cassandra-kubernetes/ReadMe.md[Cassandra Kubernetes] 
(camel-example-cassandra-kubernetes) |  | Kubernetes Example Cassandra 
Kubernetes
 
+| link:camel-example-hazelcast-kubernetes/ReadMe.md[Hazelcast Kubernetes] 
(camel-example-hazelcast-kubernetes) |  | Kubernetes Example Hazelcast 
Kubernetes
+
 | link:camel-example-cdi/README.md[CDI] (camel-example-cdi) | Beginner | An 
example showing how to work with Camel and CDI for dependency injection
 
 | link:camel-example-cdi-properties/README.md[CDI Properties] 
(camel-example-cdi-properties) | Beginner | DeltaSpike configuration properties 
CDI example

http://git-wip-us.apache.org/repos/asf/camel/blob/5e300c4d/examples/pom.xml
--
diff --git a/examples/pom.xml b/examples/pom.xml
index 21a5b8e..69c1719 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -57,6 +57,7 @@
 camel-example-ftp
 camel-example-guice-jms
 camel-example-groovy
+camel-example-hazelcast-kubernetes
 camel-example-hystrix
 camel-example-java8
 camel-example-java8-rx



[2/3] camel git commit: Added Unit test to camel-undertow to verify type and outType behave as expected with arrays

2017-03-10 Thread davsclaus
Added Unit test to camel-undertow to verify type and outType behave as expected 
with arrays


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

Branch: refs/heads/master
Commit: 1e49195dad6bfbcbc6933eaf9de5cb5af6c5c82c
Parents: fca73e0
Author: Scott Cranton 
Authored: Thu Mar 9 21:33:48 2017 -0500
Committer: Claus Ibsen 
Committed: Fri Mar 10 09:21:26 2017 +0100

--
 .../rest/RestUndertowHttpPojoTypeTest.java  | 332 +++
 1 file changed, 332 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/1e49195d/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpPojoTypeTest.java
--
diff --git 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpPojoTypeTest.java
 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpPojoTypeTest.java
new file mode 100644
index 000..1752f54
--- /dev/null
+++ 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpPojoTypeTest.java
@@ -0,0 +1,332 @@
+/**
+ * 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.undertow.rest;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.undertow.BaseUndertowTest;
+import org.apache.camel.model.rest.RestBindingMode;
+import org.apache.camel.model.rest.RestDefinition;
+import org.apache.camel.model.rest.VerbDefinition;
+import org.junit.Test;
+
+import java.util.*;
+
+public class RestUndertowHttpPojoTypeTest extends BaseUndertowTest {
+private final ObjectMapper mapper = new ObjectMapper();
+
+@Test
+public void testUndertowPojoTypeValidateModel() throws Exception {
+// Wasn't clear if there's a way to put this test into camel-core just 
to test the model
+// perhaps without starting the Camel Context?
+
+List restDefinitions = context().getRestDefinitions();
+assertNotNull(restDefinitions);
+assertTrue(restDefinitions.size() > 0);
+
+RestDefinition restDefinition = restDefinitions.get(0);
+List verbs = restDefinition.getVerbs();
+assertNotNull(verbs);
+
+Map mapVerb = new TreeMap<>();
+
+verbs.forEach(verb -> mapVerb.put(verb.getId(), verb));
+
+assertEquals(UserPojo[].class.getCanonicalName(), 
mapVerb.get("getUsers").getOutType());
+assertEquals(UserPojo[].class.getCanonicalName(), 
mapVerb.get("getUsersList").getOutType());
+assertEquals(UserPojo.class.getCanonicalName(), 
mapVerb.get("getUser").getOutType());
+
+assertEquals(UserPojo.class.getCanonicalName(), 
mapVerb.get("putUser").getType());
+assertEquals(UserPojo[].class.getCanonicalName(), 
mapVerb.get("putUsers").getType());
+assertEquals(UserPojo[].class.getCanonicalName(), 
mapVerb.get("putUsersList").getType());
+}
+
+@Test
+public void testUndertowPojoTypeGetUsers() throws Exception {
+Exchange outExchange = 
template.request("undertow:http://localhost:{{port}}/users;, new Processor() {
+@Override
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setHeader(Exchange.HTTP_METHOD, "GET");
+exchange.getIn().setHeader(Exchange.ACCEPT_CONTENT_TYPE, 
"application/json");
+}
+});
+
+assertNotNull(outExchange);
+assertEquals("application/json", 
outExchange.getOut().getHeader(Exchange.CONTENT_TYPE));
+String out = 

[1/3] camel git commit: Bad bad Claus to not refactor this as well when you changed yesterday

2017-03-10 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master 0d9cb0002 -> ca6249b06


Bad bad Claus to not refactor this as well when you changed yesterday


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

Branch: refs/heads/master
Commit: ca6249b060d6ba3fd954154a5f77df4688606fa6
Parents: 1e49195
Author: Claus Ibsen 
Authored: Fri Mar 10 09:05:14 2017 +0100
Committer: Claus Ibsen 
Committed: Fri Mar 10 09:21:26 2017 +0100

--
 .../nexus/ConnectorCatalogNexusRepository.java  | 25 +++-
 .../LocalFileConnectorNexusRepository.java  |  6 +++--
 2 files changed, 23 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/ca6249b0/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
--
diff --git 
a/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
 
b/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
index ce03701..39b1cd9 100644
--- 
a/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
+++ 
b/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
@@ -82,19 +82,21 @@ public class ConnectorCatalogNexusRepository extends 
BaseNexusRepository {
  * @param dto the artifact
  * @param namethe name of connector
  * @param scheme  the connector scheme
+ * @param javaTypethe connector java type
  * @param description the description of connector
  * @param labels  the labels of connector
  * @param connectorJson   camel-connector JSon
  * @param connectorSchemaJson camel-connector-schema JSon
+ * @param componentSchemaJson camel-component-schema JSon
  */
-protected void addConnector(NexusArtifactDto dto, String name, String 
scheme, String description, String labels,
-String connectorJson, String 
connectorSchemaJson) {
+protected void addConnector(NexusArtifactDto dto, String name, String 
scheme, String javaType, String description, String labels,
+String connectorJson, String 
connectorSchemaJson, String componentSchemaJson) {
 
 String groupId = dto.getGroupId();
 String artifactId = dto.getArtifactId();
 String version = dto.getVersion();
 
-camelConnectorCatalog.addConnector(groupId, artifactId, version, name, 
scheme, description, labels, connectorJson, connectorSchemaJson);
+camelConnectorCatalog.addConnector(groupId, artifactId, version, name, 
scheme, javaType, description, labels, connectorJson, connectorSchemaJson, 
componentSchemaJson);
 log.info("Added connector: {}:{}:{}", dto.getGroupId(), 
dto.getArtifactId(), dto.getVersion());
 }
 
@@ -110,6 +112,7 @@ public class ConnectorCatalogNexusRepository extends 
BaseNexusRepository {
 JsonNode tree = mapper.readTree(json[0]);
 String name = tree.get("name").textValue();
 String scheme = tree.get("scheme").textValue();
+String javaType = tree.get("javaType").textValue();
 String description = tree.get("description").textValue();
 Iterator it = tree.withArray("labels").iterator();
 
@@ -119,15 +122,15 @@ public class ConnectorCatalogNexusRepository extends 
BaseNexusRepository {
 csb.append(text);
 }
 
-addConnector(dto, name, scheme, description, csb.toString(), 
json[0], json[1]);
+addConnector(dto, name, scheme, javaType, description, 
csb.toString(), json[0], json[1], json[2]);
 }
 } catch (IOException e) {
 log.warn("Error scanning JAR for custom Camel components", e);
 }
 }
 
-private String[] loadConnectorJSonSchema(URLClassLoader classLoader) {
-String[] answer = new String[2];
+private String[] loadConnectorJSonSchema(ClassLoader classLoader) {
+String[] answer = new String[3];
 
 String path = "camel-connector.json";
 try {
@@ -149,6 +152,16 @@ public class ConnectorCatalogNexusRepository extends 
BaseNexusRepository {
 log.warn("Error loading " + path + " file", e);
 }
 
+path = "camel-component-schema.json";
+try {
+InputStream is 

[3/3] camel git commit: Cleaned Javadoc and Ascii doc for REST DSL

2017-03-10 Thread davsclaus
Cleaned Javadoc and Ascii doc for REST DSL


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

Branch: refs/heads/master
Commit: fca73e0521105d269b8bbd616aa7af28627f8b4f
Parents: 0d9cb00
Author: Scott Cranton 
Authored: Thu Mar 9 21:33:09 2017 -0500
Committer: Claus Ibsen 
Committed: Fri Mar 10 09:21:26 2017 +0100

--
 .../src/main/docs/rest-api-component.adoc   | 21 +++-
 .../camel/model/rest/RestBindingDefinition.java | 34 +++-
 .../apache/camel/model/rest/VerbDefinition.java | 56 +++-
 3 files changed, 71 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/fca73e05/camel-core/src/main/docs/rest-api-component.adoc
--
diff --git a/camel-core/src/main/docs/rest-api-component.adoc 
b/camel-core/src/main/docs/rest-api-component.adoc
index 2d9429d..efd4477 100644
--- a/camel-core/src/main/docs/rest-api-component.adoc
+++ b/camel-core/src/main/docs/rest-api-component.adoc
@@ -408,6 +408,25 @@ rest("/users/")
 .to("direct:newUser");
 
---
 
+To specify input and/or output using an array, append `[]` to the end
+of the canonical class name, or you can alternatively use the Java DSL only
+continence `typeList` and `outTypeList` where you just specify the array 
element type.
+Both approaches are shown in the following Java DSL:
+
+[source,java]
+---
+// configure to use restlet on localhost with the given port
+// and enable auto binding mode
+restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto);
+
+// use the rest DSL to define the rest services
+rest("/users/")
+.post().type(UserPojo[].class).outType(CountryPojo[].class)
+.to("direct:newUser")
+.put().typeList(UserPojo.class).outTypeList(CountryPojo.class)
+.to("direct:updateUser");
+---
+
 The `UserPojo` is just a plain pojo with getter/setter as shown:
 
 [source,java]
@@ -660,7 +679,7 @@ onException(JsonParseException.class)
 
  
 
-### Parameter default Values
+### Query Parameter default Values
 
 You can specify default values for parameters in the rest-dsl, such as
 the verbose parameter below:

http://git-wip-us.apache.org/repos/asf/camel/blob/fca73e05/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
 
b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
index 8c1c291..1c037d4 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
@@ -244,8 +244,8 @@ public class RestBindingDefinition extends 
OptionalIdentifiedDefinition
- * The default value is off
+ * @param bindingMode the binding mode to use. The default value is {@code 
RestBindingMode.off}.
+ *
+ * @see RestBindingMode
  */
 public void setBindingMode(RestBindingMode bindingMode) {
 this.bindingMode = bindingMode;
@@ -310,6 +309,9 @@ public class RestBindingDefinition extends 
OptionalIdentifiedDefinition
- * The default value is false.
+ * @param enableCORS set to {@code true} to enable CORS headers in the 
HTTP response. The default value is {@code false}.
  */
 public void setEnableCORS(Boolean enableCORS) {
 this.enableCORS = enableCORS;

http://git-wip-us.apache.org/repos/asf/camel/blob/fca73e05/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java 
b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index cc6731e..35f66e9 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -129,7 +129,7 @@ public class VerbDefinition extends 
OptionalIdentifiedDefinition
 }
 
 /**
- * Sets swagger operation response messages
+ * Sets swagger operation response messages.
  */