You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/01/07 20:17:41 UTC

[1/4] camel git commit: Camel catalog - Fixed validator

Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x adf4c8c08 -> cf474047d
  refs/heads/master fb6208f56 -> eef022e26


Camel catalog - Fixed validator


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

Branch: refs/heads/master
Commit: 2170df830ee21b8719a4d70ca620d204c11d6a5a
Parents: fb6208f
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 20:11:00 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 20:11:00 2016 +0100

----------------------------------------------------------------------
 .../org/apache/camel/catalog/DefaultCamelCatalog.java | 14 ++++++++------
 .../org/apache/camel/catalog/CamelCatalogTest.java    |  4 ++++
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2170df83/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
index e106897..028a43b 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
@@ -794,7 +794,8 @@ public class DefaultCamelCatalog implements CamelCatalog {
 
             String prefix = getPropertyPrefix(rows, name);
             String kind = getPropertyKind(rows, name);
-            boolean placeholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{");
+            boolean namePlaceholder = name.startsWith("{{") && name.endsWith("}}");
+            boolean valuePlaceholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{");
             boolean lookup = value.startsWith("#") && value.length() > 1;
             // we cannot evaluate multi values as strict as the others, as we don't know their expected types
             boolean mulitValue = prefix != null && originalName.startsWith(prefix) && isPropertyMultiValue(rows, name);
@@ -804,8 +805,9 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 // unknown option
 
                 // only add as error if the component is not lenient properties, or not stub component
+                // and the name is not a property placeholder for one or more values
                 // as if we are lenient then the option is a dynamic extra option which we cannot validate
-                if (!lenientProperties && !"stub".equals(scheme)) {
+                if (!namePlaceholder && !lenientProperties && !"stub".equals(scheme)) {
                     result.addUnknown(name);
                     if (suggestionStrategy != null) {
                         String[] suggestions = suggestionStrategy.suggestEndpointOptions(getNames(rows), name);
@@ -830,7 +832,7 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 // is enum but the value is not within the enum range
                 // but we can only check if the value is not a placeholder
                 String enums = getPropertyEnum(rows, name);
-                if (!mulitValue && !placeholder && !lookup && enums != null) {
+                if (!mulitValue && !valuePlaceholder && !lookup && enums != null) {
                     String[] choices = enums.split(",");
                     boolean found = false;
                     for (String s : choices) {
@@ -854,7 +856,7 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 }
 
                 // is boolean
-                if (!mulitValue && !placeholder && !lookup && isPropertyBoolean(rows, name)) {
+                if (!mulitValue && !valuePlaceholder && !lookup && isPropertyBoolean(rows, name)) {
                     // value must be a boolean
                     boolean bool = "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value);
                     if (!bool) {
@@ -863,7 +865,7 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 }
 
                 // is integer
-                if (!mulitValue && !placeholder && !lookup && isPropertyInteger(rows, name)) {
+                if (!mulitValue && !valuePlaceholder && !lookup && isPropertyInteger(rows, name)) {
                     // value must be an integer
                     boolean valid = validateInteger(value);
                     if (!valid) {
@@ -872,7 +874,7 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 }
 
                 // is number
-                if (!mulitValue && !placeholder && !lookup && isPropertyNumber(rows, name)) {
+                if (!mulitValue && !valuePlaceholder && !lookup && isPropertyNumber(rows, name)) {
                     // value must be an number
                     boolean valid = false;
                     try {

http://git-wip-us.apache.org/repos/asf/camel/blob/2170df83/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
index 26b4788..ded4da0 100644
--- a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
+++ b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
@@ -532,6 +532,10 @@ public class CamelCatalogTest {
         // userinfo in authority without password
         result = catalog.validateEndpointProperties("ssh://scott@localhost:8101?certResource=classpath:test_rsa&useFixedDelay=true&delay=5000&pollCommand=features:list%0A");
         assertTrue(result.isSuccess());
+
+        // placeholder for a bunch of optional options
+        result = catalog.validateEndpointProperties("aws-swf://activity?{{options}}");
+        assertTrue(result.isSuccess());
     }
 
     @Test


[3/4] camel git commit: Camel catalog - Fixed validator

Posted by da...@apache.org.
Camel catalog - Fixed validator


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

Branch: refs/heads/camel-2.16.x
Commit: da382fcdda716f7e0c4e72f5c8a1282f5f024e1a
Parents: adf4c8c
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 20:11:00 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 20:17:28 2016 +0100

----------------------------------------------------------------------
 .../org/apache/camel/catalog/DefaultCamelCatalog.java | 14 ++++++++------
 .../org/apache/camel/catalog/CamelCatalogTest.java    |  4 ++++
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/da382fcd/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
index e106897..028a43b 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
@@ -794,7 +794,8 @@ public class DefaultCamelCatalog implements CamelCatalog {
 
             String prefix = getPropertyPrefix(rows, name);
             String kind = getPropertyKind(rows, name);
-            boolean placeholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{");
+            boolean namePlaceholder = name.startsWith("{{") && name.endsWith("}}");
+            boolean valuePlaceholder = value.startsWith("{{") || value.startsWith("${") || value.startsWith("$simple{");
             boolean lookup = value.startsWith("#") && value.length() > 1;
             // we cannot evaluate multi values as strict as the others, as we don't know their expected types
             boolean mulitValue = prefix != null && originalName.startsWith(prefix) && isPropertyMultiValue(rows, name);
@@ -804,8 +805,9 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 // unknown option
 
                 // only add as error if the component is not lenient properties, or not stub component
+                // and the name is not a property placeholder for one or more values
                 // as if we are lenient then the option is a dynamic extra option which we cannot validate
-                if (!lenientProperties && !"stub".equals(scheme)) {
+                if (!namePlaceholder && !lenientProperties && !"stub".equals(scheme)) {
                     result.addUnknown(name);
                     if (suggestionStrategy != null) {
                         String[] suggestions = suggestionStrategy.suggestEndpointOptions(getNames(rows), name);
@@ -830,7 +832,7 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 // is enum but the value is not within the enum range
                 // but we can only check if the value is not a placeholder
                 String enums = getPropertyEnum(rows, name);
-                if (!mulitValue && !placeholder && !lookup && enums != null) {
+                if (!mulitValue && !valuePlaceholder && !lookup && enums != null) {
                     String[] choices = enums.split(",");
                     boolean found = false;
                     for (String s : choices) {
@@ -854,7 +856,7 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 }
 
                 // is boolean
-                if (!mulitValue && !placeholder && !lookup && isPropertyBoolean(rows, name)) {
+                if (!mulitValue && !valuePlaceholder && !lookup && isPropertyBoolean(rows, name)) {
                     // value must be a boolean
                     boolean bool = "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value);
                     if (!bool) {
@@ -863,7 +865,7 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 }
 
                 // is integer
-                if (!mulitValue && !placeholder && !lookup && isPropertyInteger(rows, name)) {
+                if (!mulitValue && !valuePlaceholder && !lookup && isPropertyInteger(rows, name)) {
                     // value must be an integer
                     boolean valid = validateInteger(value);
                     if (!valid) {
@@ -872,7 +874,7 @@ public class DefaultCamelCatalog implements CamelCatalog {
                 }
 
                 // is number
-                if (!mulitValue && !placeholder && !lookup && isPropertyNumber(rows, name)) {
+                if (!mulitValue && !valuePlaceholder && !lookup && isPropertyNumber(rows, name)) {
                     // value must be an number
                     boolean valid = false;
                     try {

http://git-wip-us.apache.org/repos/asf/camel/blob/da382fcd/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
index 26b4788..ded4da0 100644
--- a/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
+++ b/platforms/catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
@@ -532,6 +532,10 @@ public class CamelCatalogTest {
         // userinfo in authority without password
         result = catalog.validateEndpointProperties("ssh://scott@localhost:8101?certResource=classpath:test_rsa&useFixedDelay=true&delay=5000&pollCommand=features:list%0A");
         assertTrue(result.isSuccess());
+
+        // placeholder for a bunch of optional options
+        result = catalog.validateEndpointProperties("aws-swf://activity?{{options}}");
+        assertTrue(result.isSuccess());
     }
 
     @Test


[4/4] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


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

Branch: refs/heads/camel-2.16.x
Commit: cf474047dda27d08c1fae22c080f5cb99bdb9fac
Parents: da382fc
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 20:16:48 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 20:17:33 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/component/restlet/RestletEndpoint.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cf474047/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
index 0deb746..a88a6fb 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
@@ -56,7 +56,7 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra
     private String host = DEFAULT_HOST;
     @UriPath(defaultValue = "80") @Metadata(required = "true")
     private int port = DEFAULT_PORT;
-    @UriPath @Metadata(required = "true")
+    @UriPath
     private String uriPattern;
     @UriParam(label = "producer", defaultValue = "" + DEFAULT_SOCKET_TIMEOUT)
     private int socketTimeout = DEFAULT_SOCKET_TIMEOUT;


[2/4] camel git commit: Component docs

Posted by da...@apache.org.
Component docs


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

Branch: refs/heads/master
Commit: eef022e26d84130cdbcf5402414514a9e6cfad11
Parents: 2170df8
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Jan 7 20:16:48 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 7 20:16:48 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/component/restlet/RestletEndpoint.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/eef022e2/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
index e3bb5ab..5543313 100644
--- a/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
+++ b/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletEndpoint.java
@@ -54,7 +54,7 @@ public class RestletEndpoint extends DefaultEndpoint implements HeaderFilterStra
     private String host = DEFAULT_HOST;
     @UriPath(defaultValue = "80") @Metadata(required = "true")
     private int port = DEFAULT_PORT;
-    @UriPath @Metadata(required = "true")
+    @UriPath
     private String uriPattern;
     @UriParam(label = "producer", defaultValue = "" + DEFAULT_SOCKET_TIMEOUT)
     private int socketTimeout = DEFAULT_SOCKET_TIMEOUT;