camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/5] camel git commit: Camel component docs - Should include information if an endpoint is lenient properties
Date Tue, 05 Jan 2016 08:32:59 GMT
Camel component docs - Should include information if an endpoint is lenient properties


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

Branch: refs/heads/camel-2.16.x
Commit: 0e77534ba70a4f4c09c3f6664488003f0df8ea2e
Parents: f1aaabd
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Jan 5 09:31:57 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Jan 5 09:32:44 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/component/stub/StubEndpoint.java    | 6 +-----
 .../java/org/apache/camel/catalog/DefaultCamelCatalog.java    | 7 ++++---
 .../test/java/org/apache/camel/catalog/CamelCatalogTest.java  | 6 +++++-
 3 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0e77534b/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java
index 9a96e9d..cd24eba 100644
--- a/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/stub/StubEndpoint.java
@@ -36,7 +36,7 @@ import org.apache.camel.spi.UriEndpoint;
  * query arguments will usually fail. Stub won't though, as it basically ignores all query
parameters
  * to let you quickly stub out one or more endpoints in your route temporarily.
  */
-@UriEndpoint(scheme = "stub", title = "Stub", syntax = "stub:name", consumerClass = VmConsumer.class,
label = "core,testing", lenientProperties = true)
+@UriEndpoint(scheme = "stub", title = "Stub", syntax = "stub:name", consumerClass = VmConsumer.class,
label = "core,testing")
 public class StubEndpoint extends VmEndpoint {
 
     public StubEndpoint(String endpointUri, Component component, BlockingQueue<Exchange>
queue) {
@@ -56,8 +56,4 @@ public class StubEndpoint extends VmEndpoint {
         return new StubConsumer(this, processor);
     }
 
-    @Override
-    public boolean isLenientProperties() {
-        return true;
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/0e77534b/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 83b9c58..5a023c9 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
@@ -738,11 +738,12 @@ public class DefaultCamelCatalog implements CamelCatalog {
         Map<String, String> properties;
         List<Map<String, String>> rows;
         boolean lenientProperties;
+        String scheme;
 
         try {
             // parse the uri
             URI u = normalizeUri(uri);
-            String scheme = u.getScheme();
+            scheme = u.getScheme();
             String json = componentJSonSchema(scheme);
             if (json == null) {
                 result.addUnknownComponent(scheme);
@@ -785,9 +786,9 @@ public class DefaultCamelCatalog implements CamelCatalog {
             if (row == null) {
                 // unknown option
 
-                // only add as error if the component is not lenient properties
+                // only add as error if the component is not lenient properties, or not stub
component
                 // as if we are lenient then the option is a dynamic extra option which we
cannot validate
-                if (!lenientProperties) {
+                if (!lenientProperties && !"stub".equals(scheme)) {
                     result.addUnknown(name);
                     if (suggestionStrategy != null) {
                         String[] suggestions = suggestionStrategy.suggestEndpointOptions(getNames(rows),
name);

http://git-wip-us.apache.org/repos/asf/camel/blob/0e77534b/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 fc804aa..f32597a 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
@@ -485,9 +485,13 @@ public class CamelCatalogTest {
         result = catalog.validateEndpointProperties("file:inbox?delay=5000&scheduler.foo=123&scheduler.bar=456");
         assertTrue(result.isSuccess());
 
-        // lenient
+        // stub
         result = catalog.validateEndpointProperties("stub:foo?me=123&you=456");
         assertTrue(result.isSuccess());
+
+        // lenient
+        result = catalog.validateEndpointProperties("dataformat:string:marshal?foo=bar");
+        assertTrue(result.isSuccess());
     }
 
     @Test


Mime
View raw message