camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: Camel catalog - Add api to validate
Date Sat, 02 Jan 2016 22:27:16 GMT
Camel catalog - Add api to validate


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

Branch: refs/heads/camel-2.16.x
Commit: 920a0d5f9ef4c4ff8a76c55898b898b0223741c1
Parents: 5e13000
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sat Jan 2 23:26:46 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Jan 2 23:27:07 2016 +0100

----------------------------------------------------------------------
 .../apache/camel/catalog/DefaultCamelCatalog.java  |  6 ++++--
 .../org/apache/camel/catalog/JSonSchemaHelper.java | 17 +++++++++++++++++
 .../org/apache/camel/catalog/CamelCatalogTest.java |  4 ++++
 3 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/920a0d5f/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 607a7e5..fc63bd0 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
@@ -46,6 +46,7 @@ import static org.apache.camel.catalog.CatalogHelper.after;
 import static org.apache.camel.catalog.JSonSchemaHelper.getNames;
 import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyDefaultValue;
 import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyEnum;
+import static org.apache.camel.catalog.JSonSchemaHelper.getPropertyKind;
 import static org.apache.camel.catalog.JSonSchemaHelper.getRow;
 import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyBoolean;
 import static org.apache.camel.catalog.JSonSchemaHelper.isPropertyInteger;
@@ -795,8 +796,9 @@ public class DefaultCamelCatalog implements CamelCatalog {
                     }
                 }
 
-                // is reference lookup of bean
-                if (isPropertyObject(rows, name)) {
+                // is reference lookup of bean (not applicable for @UriPath)
+                String kind = getPropertyKind(rows, name);
+                if (!"path".equals(kind) && isPropertyObject(rows, name)) {
                     // must start with # and be at least 2 characters
                     if (!value.startsWith("#") || value.length() <= 1) {
                         result.addInvalidReference(name, value);

http://git-wip-us.apache.org/repos/asf/camel/blob/920a0d5f/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java
b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java
index d262b6c..a4b27df 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/JSonSchemaHelper.java
@@ -131,6 +131,23 @@ public final class JSonSchemaHelper {
         return false;
     }
 
+    public static String getPropertyKind(List<Map<String, String>> rows, String
name) {
+        for (Map<String, String> row : rows) {
+            String kind = null;
+            boolean found = false;
+            if (row.containsKey("name")) {
+                found = name.equals(row.get("name"));
+            }
+            if (row.containsKey("kind")) {
+                kind = row.get("kind");
+            }
+            if (found) {
+                return kind;
+            }
+        }
+        return null;
+    }
+
     public static boolean isPropertyBoolean(List<Map<String, String>> rows, String
name) {
         for (Map<String, String> row : rows) {
             String type = null;

http://git-wip-us.apache.org/repos/asf/camel/blob/920a0d5f/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 259272b..b58ec15 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
@@ -456,6 +456,10 @@ public class CamelCatalogTest {
         assertFalse(result.isSuccess());
         assertEquals("ggg", result.getInvalidBoolean().get("showAll"));
         assertEquals(1, result.getNumberOfErrors());
+
+        // dataset
+        result = catalog.validateEndpointProperties("dataset:foo?minRate=50");
+        assertTrue(result.isSuccess());
     }
 
     @Test


Mime
View raw message