You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/04/05 14:44:39 UTC

camel git commit: ComponentVerifier : add UNSUPPORTED_COMPONENT to standard error codes

Repository: camel
Updated Branches:
  refs/heads/master 5db412baa -> 83f1225be


ComponentVerifier : add UNSUPPORTED_COMPONENT to standard error codes


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

Branch: refs/heads/master
Commit: 83f1225be1af951e3df2ee53c2fc77d23ef7a74b
Parents: 5db412b
Author: lburgazzoli <lb...@gmail.com>
Authored: Wed Apr 5 16:44:17 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Wed Apr 5 16:44:17 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/ComponentVerifier.java     |  4 ++++
 .../apache/camel/impl/verifier/ResultBuilder.java    |  5 ++---
 .../camel/impl/verifier/ResultErrorBuilder.java      | 15 +++++++++++++--
 3 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/83f1225b/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 f9e2574..bcbda7c 100644
--- a/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java
+++ b/camel-core/src/main/java/org/apache/camel/ComponentVerifier.java
@@ -296,6 +296,10 @@ public interface ComponentVerifier {
              */
             StandardCode UNSUPPORTED_SCOPE = new ComponentVerifierHelper.StandardErrorCode("UNSUPPORTED_SCOPE");
             /**
+             * The requested {@link Component} is not supported
+             */
+            StandardCode UNSUPPORTED_COMPONENT = new ComponentVerifierHelper.StandardErrorCode("UNSUPPORTED_COMPONENT");
+            /**
              * Generic error which is explained in more details with {@link VerificationError#getDetails()}
              */
             StandardCode GENERIC = new ComponentVerifierHelper.StandardErrorCode("GENERIC");

http://git-wip-us.apache.org/repos/asf/camel/blob/83f1225b/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultBuilder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultBuilder.java b/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultBuilder.java
index 8b35a1e..ce049c0 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultBuilder.java
@@ -111,8 +111,8 @@ public final class ResultBuilder {
 
     public ComponentVerifier.Result build() {
         return new DefaultResult(
-            scope.orElseGet(() -> ComponentVerifier.Scope.PARAMETERS),
-            status.orElseGet(() -> ComponentVerifier.Result.Status.UNSUPPORTED),
+            scope.orElse(ComponentVerifier.Scope.PARAMETERS),
+            status.orElse(ComponentVerifier.Result.Status.UNSUPPORTED),
             verificationErrors != null ? Collections.unmodifiableList(verificationErrors) : Collections.emptyList()
         );
     }
@@ -136,5 +136,4 @@ public final class ResultBuilder {
     public static ResultBuilder unsupported() {
         return withStatusAndScope(ComponentVerifier.Result.Status.UNSUPPORTED, ComponentVerifier.Scope.PARAMETERS);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/83f1225b/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultErrorBuilder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultErrorBuilder.java b/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultErrorBuilder.java
index 8052bd0..ae27d9f 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultErrorBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/verifier/ResultErrorBuilder.java
@@ -16,10 +16,15 @@
  */
 package org.apache.camel.impl.verifier;
 
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
 import java.util.function.Supplier;
 
-import org.apache.camel.ComponentVerifier;
 import org.apache.camel.ComponentVerifier.VerificationError;
 import org.apache.camel.util.ObjectHelper;
 
@@ -146,6 +151,12 @@ public final class ResultErrorBuilder {
             .description("Unsupported scope: " + scope);
     }
 
+    public static ResultErrorBuilder withUnsupportedComponent(String component) {
+        return new ResultErrorBuilder()
+            .code(VerificationError.StandardCode.UNSUPPORTED_SCOPE)
+            .description("Unsupported component: " + component);
+    }
+
     public static ResultErrorBuilder withException(Exception exception) {
         return new ResultErrorBuilder()
             .code(VerificationError.StandardCode.EXCEPTION)