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 2019/09/25 08:18:53 UTC

[camel-k-runtime] 05/05: Removed the log and polish the test cases

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git

commit 307d7fc766401d9aa7ceed2397431c9ed9a0e82e
Author: Willem Jiang <wi...@gmail.com>
AuthorDate: Mon Sep 23 16:56:52 2019 +0800

    Removed the log and polish the test cases
---
 .../apache/camel/k/loader/groovy/dsl/ComponentConfiguration.groovy   | 2 --
 .../apache/camel/k/loader/groovy/dsl/ComponentsConfiguration.groovy  | 5 ++---
 .../routes-with-component-wrong-property-configuration.groovy        | 3 +--
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentConfiguration.groovy b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentConfiguration.groovy
index 63b4fbf..dd1432c 100644
--- a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentConfiguration.groovy
+++ b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentConfiguration.groovy
@@ -52,14 +52,12 @@ class ComponentConfiguration {
         }
 
         if (!PropertyBindingSupport.build().withCamelContext(component.camelContext).withTarget(component).withProperty(name, value).bind()) {
-            LOG.error("Cannot set the component {} property {}", component.class.getName(), name)
             throw new MissingMethodException(name, this.component.class, args as Object[])
         }
     }
 
     def propertyMissing(String name, value) {
         if (!PropertyBindingSupport.build().withCamelContext(component.camelContext).withTarget(component).withProperty(name, value).bind()) {
-            LOG.error("Cannot set the component {} property {}", component.class.getName(), name)
             throw new MissingPropertyException(name, this.component.class)
         }
     }
diff --git a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentsConfiguration.groovy b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentsConfiguration.groovy
index a5f67d7..4a5dff3 100644
--- a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentsConfiguration.groovy
+++ b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentsConfiguration.groovy
@@ -18,7 +18,6 @@ package org.apache.camel.k.loader.groovy.dsl
 
 import org.apache.camel.CamelContext
 import org.apache.camel.Component
-import org.apache.camel.support.PropertyBindingSupport
 
 class ComponentsConfiguration {
     private final CamelContext context
@@ -29,8 +28,8 @@ class ComponentsConfiguration {
 
     def component(String name, @DelegatesTo(ComponentConfiguration) Closure<?> callable) {
         def component = context.getComponent(name, true, false)
-
-        callable.resolveStrategy = Closure.DELEGATE_FIRST
+        // Just make sure the closure context is belong to component
+        callable.resolveStrategy = Closure.DELEGATE_ONLY
         callable.delegate = new ComponentConfiguration(component)
         callable.call()
     }
diff --git a/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-property-configuration.groovy b/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-property-configuration.groovy
index 7dfa916..07a7422 100644
--- a/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-property-configuration.groovy
+++ b/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-property-configuration.groovy
@@ -14,11 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import org.apache.camel.component.seda.SedaComponent
 
 context {
     components {
-        mySeda(SedaComponent) {
+        seda {
             // a wrong property name
             queueNumber = 33
         }