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 ef99f7b2594224d7f42822ab5a2651904a2b5422
Author: lburgazzoli <lburgazz...@gmail.com>
AuthorDate: Fri Oct 18 14:20:34 2019 +0200

    groovy: improve dsl
---
 camel-k-loader-groovy/pom.xml                      | 10 +++
 ...nfiguration.groovy => BeanConfiguration.groovy} | 39 ++++-----
 ...figuration.groovy => CamelConfiguration.groovy} | 18 +++--
 .../groovy/dsl/ComponentsConfiguration.groovy      | 46 ++++++-----
 .../groovy/dsl/DataFormatsConfiguration.groovy     | 92 ++++++++++++++++++++++
 .../groovy/dsl/IntegrationConfiguration.groovy     |  4 +-
 ...ration.groovy => LanguagesConfiguration.groovy} | 60 +++++++-------
 .../k/loader/groovy/dsl/IntegrationTest.groovy     | 46 ++++++++---
 ...ith-component-wrong-method-configuration.groovy |  2 +-
 ...h-component-wrong-property-configuration.groovy |  2 +-
 ...=> routes-with-components-configuration.groovy} |  4 +-
 ...> routes-with-dataformats-configuration.groovy} | 20 +++--
 ... => routes-with-languages-configuration.groovy} | 20 +++--
 13 files changed, 262 insertions(+), 101 deletions(-)

diff --git a/camel-k-loader-groovy/pom.xml b/camel-k-loader-groovy/pom.xml
index 75a893f..6c58ec1 100644
--- a/camel-k-loader-groovy/pom.xml
+++ b/camel-k-loader-groovy/pom.xml
@@ -99,6 +99,16 @@
             <artifactId>camel-properties</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-bean</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-jackson</artifactId>
+            <scope>test</scope>
+        </dependency>
 
         <!-- ******************************* -->
         <!-- test deps :: misc               -->
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/BeanConfiguration.groovy
similarity index 65%
rename from 
camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentConfiguration.groovy
rename to 
camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/BeanConfiguration.groovy
index 6d58fb2..5616e13 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/BeanConfiguration.groovy
@@ -16,17 +16,19 @@
  */
 package org.apache.camel.k.loader.groovy.dsl
 
+import groovy.util.logging.Slf4j
+import org.apache.camel.CamelContext
 import org.apache.camel.ExtendedCamelContext
 import org.apache.camel.support.PropertyBindingSupport
-import org.slf4j.Logger
-import org.slf4j.LoggerFactory
 
-class ComponentConfiguration {
-    private static final Logger LOG = 
LoggerFactory.getLogger(ComponentConfiguration.class);
-    private final org.apache.camel.Component component
+@Slf4j
+class BeanConfiguration {
+    private final CamelContext context
+    private final Object target
 
-    ComponentConfiguration(org.apache.camel.Component component) {
-        this.component = component
+    BeanConfiguration(CamelContext camelContext, Object target) {
+        this.context = camelContext
+        this.target = target
     }
 
     def methodMissing(String name, arguments) {
@@ -38,13 +40,13 @@ class ComponentConfiguration {
         } else if (args.length == 1) {
             value = args[0]
         } else {
-            throw new IllegalArgumentException("Unable to set property 
'${name}' on component '${component.class.name}'")
+            throw new IllegalArgumentException("Unable to set property 
'${name}' on target '${target.class.name}'")
         }
 
         if (value instanceof Closure<?>) {
-            def m = this.component.metaClass.getMetaMethod(name, Closure.class)
+            def m = this.target.metaClass.getMetaMethod(name, Closure.class)
             if (m) {
-                m.invoke(component, args)
+                m.invoke(target, args)
 
                 // done
                 return
@@ -52,33 +54,34 @@ class ComponentConfiguration {
         }
 
         boolean bound = PropertyBindingSupport.build()
-            .withCamelContext(component.camelContext)
-            .withTarget(component)
+            .withCamelContext(context)
+            .withTarget(target)
             .withProperty(name, value)
             .bind()
 
         if (!bound) {
-            throw new MissingMethodException(name, this.component.class, args 
as Object[])
+            throw new MissingMethodException(name, this.target.class, args as 
Object[])
         }
     }
 
     def propertyMissing(String name, value) {
         boolean bound = PropertyBindingSupport.build()
-            .withCamelContext(component.camelContext)
-            .withTarget(component)
+            .withCamelContext(context)
+            .withTarget(target)
             .withProperty(name, value)
             .bind()
 
         if (!bound) {
-            throw new MissingPropertyException(name, this.component.class)
+            throw new MissingPropertyException(name, this.target.class)
         }
     }
 
     def propertyMissing(String name) {
         def props = new HashMap<String, Object>()
-        def context = 
component.getCamelContext().adapt(ExtendedCamelContext.class)
 
-        context.getBeanIntrospection().getProperties(component, props, null, 
false)
+        context.adapt(ExtendedCamelContext.class)
+            .getBeanIntrospection()
+            .getProperties(target, props, null, false)
 
         return props[name]
     }
diff --git 
a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ContextConfiguration.groovy
 
b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/CamelConfiguration.groovy
similarity index 73%
rename from 
camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ContextConfiguration.groovy
rename to 
camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/CamelConfiguration.groovy
index 8cba11b..d7ba226 100644
--- 
a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ContextConfiguration.groovy
+++ 
b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/CamelConfiguration.groovy
@@ -18,22 +18,28 @@ package org.apache.camel.k.loader.groovy.dsl
 
 import org.apache.camel.CamelContext
 
-class ContextConfiguration {
+class CamelConfiguration {
     private final CamelContext context
 
-    ContextConfiguration(CamelContext context) {
+    CamelConfiguration(CamelContext context) {
         this.context = context
     }
 
-    def registry(@DelegatesTo(RegistryConfiguration) Closure<?> callable) {
+    def components(@DelegatesTo(ComponentsConfiguration) Closure<?> callable) {
         callable.resolveStrategy = Closure.DELEGATE_FIRST
-        callable.delegate = new RegistryConfiguration(this.context.registry)
+        callable.delegate = new ComponentsConfiguration(context)
         callable.call()
     }
 
-    def components(@DelegatesTo(ComponentsConfiguration) Closure<?> callable) {
+    def dataFormats(@DelegatesTo(DataFormatsConfiguration) Closure<?> 
callable) {
         callable.resolveStrategy = Closure.DELEGATE_FIRST
-        callable.delegate = new ComponentsConfiguration(context)
+        callable.delegate = new DataFormatsConfiguration(context)
+        callable.call()
+    }
+
+    def languages(@DelegatesTo(LanguagesConfiguration) Closure<?> callable) {
+        callable.resolveStrategy = Closure.DELEGATE_FIRST
+        callable.delegate = new LanguagesConfiguration(context)
         callable.call()
     }
 }
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 4a5dff3..ed69798 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
@@ -16,9 +16,11 @@
  */
 package org.apache.camel.k.loader.groovy.dsl
 
+import groovy.util.logging.Slf4j
 import org.apache.camel.CamelContext
 import org.apache.camel.Component
 
+@Slf4j
 class ComponentsConfiguration {
     private final CamelContext context
 
@@ -26,36 +28,42 @@ class ComponentsConfiguration {
         this.context = context
     }
 
-    def component(String name, @DelegatesTo(ComponentConfiguration) Closure<?> 
callable) {
-        def component = context.getComponent(name, true, false)
+    def component(String name, Closure<?> callable) {
+        def target = context.getComponent(name, true, false)
+        if (target == null) {
+            throw new IllegalArgumentException("Unable to find a component 
with name: ${name}")
+        }
+
         // Just make sure the closure context is belong to component
         callable.resolveStrategy = Closure.DELEGATE_ONLY
-        callable.delegate = new ComponentConfiguration(component)
+        callable.delegate = new BeanConfiguration(context, target)
         callable.call()
     }
 
-    def component(String name, Class<? extends Component> type, 
@DelegatesTo(ComponentConfiguration) Closure <?> callable) {
-        def component = context.getComponent(name, true, false)
+    def component(String name, Class<? extends Component> type, Closure <?> 
callable) {
+        def target = context.getComponent(name, true, false)
+        def bind = false
+
+        if (target != null && !type.isInstance(target)) {
+            throw new IllegalArgumentException("Type mismatch, expected: 
${type} , got: ${target.class}")
+        }
 
         // if the component is not found, let's create a new one. This is
         // equivalent to create a new named component, useful to create
         // multiple instances of the same component but with different setup
-        if (component == null) {
-            component = context.injector.newInstance(type)
-
-            // let's the camel context be aware of the new component
-            context.addComponent(name, component)
+        if (target == null) {
+            target = context.injector.newInstance(type)
+            bind = true
         }
 
-        if (type.isAssignableFrom(component.class)) {
-            // Just make sure the closure context is belong to component
-            callable.resolveStrategy = Closure.DELEGATE_ONLY
-            callable.delegate = new ComponentConfiguration(component)
-            callable.call()
-            return
-        }
+        // Just make sure the closure context is belong to component
+        callable.resolveStrategy = Closure.DELEGATE_ONLY
+        callable.delegate = new BeanConfiguration(context, target)
+        callable.call()
 
-        throw new IllegalArgumentException("Type mismatch, expected: " + type 
+ ", got: " + component.class)
+        if (bind) {
+            context.registry.bind(name, type, target)
+        }
     }
 
     def methodMissing(String name, arguments) {
@@ -74,7 +82,7 @@ class ComponentsConfiguration {
                 def clos = args[1]
 
                 if (type instanceof Class && 
Component.class.isAssignableFrom(type) && clos instanceof Closure) {
-                    return component(name,type, clos)
+                    return component(name, type, clos)
                 }
             }
         }
diff --git 
a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/DataFormatsConfiguration.groovy
 
b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/DataFormatsConfiguration.groovy
new file mode 100644
index 0000000..e87f507
--- /dev/null
+++ 
b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/DataFormatsConfiguration.groovy
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.k.loader.groovy.dsl
+
+import org.apache.camel.CamelContext
+import org.apache.camel.spi.DataFormat
+
+class DataFormatsConfiguration {
+    private final CamelContext context
+
+    DataFormatsConfiguration(CamelContext context) {
+        this.context = context
+    }
+
+    def dataFormat(String name, Closure<?> callable) {
+        def target = context.resolveDataFormat(name)
+        if (target == null) {
+            throw new IllegalArgumentException("Unable to find a dataformat 
with name: ${name}")
+        }
+
+        // Just make sure the closure context is belong to component
+        callable.resolveStrategy = Closure.DELEGATE_ONLY
+        callable.delegate = new BeanConfiguration(context, target)
+        callable.call()
+
+        // let's the camel context be aware of the new dataformat
+        context.registry.bind(name, DataFormat.class, target)
+    }
+
+    def dataFormat(String name, Class<? extends DataFormat> type, Closure <?> 
callable) {
+        def target = context.registry.lookupByNameAndType(name, type)
+        def bind = false
+
+        // if the dataformat is not found, let's create a new one. This is
+        // equivalent to create a new named dataformat, useful to create
+        // multiple instances of the same dataformat but with different setup
+        if (target == null) {
+            target = context.injector.newInstance(type)
+
+            bind = true
+        }
+
+        // Just make sure the closure context is belong to dataformat
+        callable.resolveStrategy = Closure.DELEGATE_ONLY
+        callable.delegate = new BeanConfiguration(context, target)
+        callable.call()
+
+        if (bind) {
+            // let's the camel context be aware of the new dataformat
+            context.registry.bind(name, type, target)
+        }
+    }
+
+    def methodMissing(String name, arguments) {
+        final Object[] args = arguments as Object[]
+
+        if (args != null) {
+            if (args.length == 1) {
+                def clos = args[0]
+
+                if (clos instanceof Closure) {
+                    return dataFormat(name, clos)
+                }
+            }
+            if (args.length == 2) {
+                def type = args[0]
+                def clos = args[1]
+
+                if (type instanceof Class && 
DataFormat.class.isAssignableFrom(type) && clos instanceof Closure) {
+                    return dataFormat(name,type, clos)
+                }
+            }
+        }
+
+        throw new MissingMethodException(name, this, args)
+    }
+
+}
diff --git 
a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationConfiguration.groovy
 
b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationConfiguration.groovy
index ec4b89d..1776ad8 100644
--- 
a/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationConfiguration.groovy
+++ 
b/camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationConfiguration.groovy
@@ -49,9 +49,9 @@ class IntegrationConfiguration extends BuilderSupport 
implements Support, Endpoi
         callable.call()
     }
 
-    def context(@DelegatesTo(ContextConfiguration) Closure<?> callable) {
+    def camel(@DelegatesTo(CamelConfiguration) Closure<?> callable) {
         callable.resolveStrategy = Closure.DELEGATE_FIRST
-        callable.delegate = new ContextConfiguration(context)
+        callable.delegate = new CamelConfiguration(context)
         callable.call()
     }
 
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/LanguagesConfiguration.groovy
similarity index 50%
copy from 
camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/ComponentsConfiguration.groovy
copy to 
camel-k-loader-groovy/src/main/groovy/org/apache/camel/k/loader/groovy/dsl/LanguagesConfiguration.groovy
index 4a5dff3..f694a1e 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/LanguagesConfiguration.groovy
@@ -17,45 +17,52 @@
 package org.apache.camel.k.loader.groovy.dsl
 
 import org.apache.camel.CamelContext
-import org.apache.camel.Component
+import org.apache.camel.spi.Language
 
-class ComponentsConfiguration {
+class LanguagesConfiguration {
     private final CamelContext context
 
-    ComponentsConfiguration(CamelContext context) {
+    LanguagesConfiguration(CamelContext context) {
         this.context = context
     }
 
-    def component(String name, @DelegatesTo(ComponentConfiguration) Closure<?> 
callable) {
-        def component = context.getComponent(name, true, false)
+    def language(String name, Closure<?> callable) {
+        def target = context.resolveLanguage(name)
+        if (target == null) {
+            throw new IllegalArgumentException("Unable to find a language with 
name: ${name}")
+        }
+
         // Just make sure the closure context is belong to component
         callable.resolveStrategy = Closure.DELEGATE_ONLY
-        callable.delegate = new ComponentConfiguration(component)
+        callable.delegate = new BeanConfiguration(context, target)
         callable.call()
+
+        // let's the camel context be aware of the new dataformat
+        context.registry.bind(name, Language.class, target)
     }
 
-    def component(String name, Class<? extends Component> type, 
@DelegatesTo(ComponentConfiguration) Closure <?> callable) {
-        def component = context.getComponent(name, true, false)
+    def language(String name, Class<? extends Language> type, Closure <?> 
callable) {
+        def target = context.registry.lookupByNameAndType(name, type)
+        def bind = false
 
-        // if the component is not found, let's create a new one. This is
-        // equivalent to create a new named component, useful to create
-        // multiple instances of the same component but with different setup
-        if (component == null) {
-            component = context.injector.newInstance(type)
+        // if the language is not found, let's create a new one. This is
+        // equivalent to create a new named language, useful to create
+        // multiple instances of the same language but with different setup
+        if (target == null) {
+            target = context.injector.newInstance(type)
 
-            // let's the camel context be aware of the new component
-            context.addComponent(name, component)
+            bind = true
         }
 
-        if (type.isAssignableFrom(component.class)) {
-            // Just make sure the closure context is belong to component
-            callable.resolveStrategy = Closure.DELEGATE_ONLY
-            callable.delegate = new ComponentConfiguration(component)
-            callable.call()
-            return
-        }
+        // Just make sure the closure context is belong to dataformat
+        callable.resolveStrategy = Closure.DELEGATE_ONLY
+        callable.delegate = new BeanConfiguration(context, target)
+        callable.call()
 
-        throw new IllegalArgumentException("Type mismatch, expected: " + type 
+ ", got: " + component.class)
+        if (bind) {
+            // let's the camel context be aware of the new dataformat
+            context.registry.bind(name, type, target)
+        }
     }
 
     def methodMissing(String name, arguments) {
@@ -66,20 +73,19 @@ class ComponentsConfiguration {
                 def clos = args[0]
 
                 if (clos instanceof Closure) {
-                    return component(name, clos)
+                    return language(name, clos)
                 }
             }
             if (args.length == 2) {
                 def type = args[0]
                 def clos = args[1]
 
-                if (type instanceof Class && 
Component.class.isAssignableFrom(type) && clos instanceof Closure) {
-                    return component(name,type, clos)
+                if (type instanceof Class && 
Language.class.isAssignableFrom(type) && clos instanceof Closure) {
+                    return language(name,type, clos)
                 }
             }
         }
 
         throw new MissingMethodException(name, this, args)
     }
-
 }
diff --git 
a/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationTest.groovy
 
b/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationTest.groovy
index 1761321..2bd60ad 100644
--- 
a/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationTest.groovy
+++ 
b/camel-k-loader-groovy/src/test/groovy/org/apache/camel/k/loader/groovy/dsl/IntegrationTest.groovy
@@ -18,10 +18,12 @@ package org.apache.camel.k.loader.groovy.dsl
 
 import org.apache.camel.Predicate
 import org.apache.camel.Processor
+import org.apache.camel.component.jackson.JacksonDataFormat
 import org.apache.camel.component.log.LogComponent
 import org.apache.camel.component.seda.SedaComponent
 import org.apache.camel.impl.DefaultCamelContext
 import org.apache.camel.k.Runtime
+import org.apache.camel.language.bean.BeanLanguage
 import org.apache.camel.model.ModelCamelContext
 import org.apache.camel.model.rest.GetVerbDefinition
 import org.apache.camel.model.rest.PostVerbDefinition
@@ -108,19 +110,9 @@ class IntegrationTest extends Specification {
             context.registry.lookupByName('myPredicate') instanceof Predicate
     }
 
-    def "load integration with bindings"()  {
+    def "load integration with components configuration"()  {
         when:
-            
forRoutes('classpath:routes-with-bindings.groovy').accept(Runtime.Phase.ConfigureRoutes,
 runtime)
-
-        then:
-            context.registry.lookupByName('myEntry1') == 'myRegistryEntry1'
-            context.registry.lookupByName('myEntry2') == 'myRegistryEntry2'
-            context.registry.lookupByName('myEntry3') instanceof Processor
-    }
-
-    def "load integration with component configuration"()  {
-        when:
-            
forRoutes('classpath:routes-with-component-configuration.groovy').accept(Runtime.Phase.ConfigureRoutes,
 runtime)
+            
forRoutes('classpath:routes-with-components-configuration.groovy').accept(Runtime.Phase.ConfigureRoutes,
 runtime)
 
         then:
             with(context.getComponent('seda', SedaComponent)) {
@@ -136,6 +128,36 @@ class IntegrationTest extends Specification {
             }
     }
 
+    def "load integration with languages configuration"()  {
+        when:
+            
forRoutes('classpath:routes-with-languages-configuration.groovy').accept(Runtime.Phase.ConfigureRoutes,
 runtime)
+
+        then:
+            with(context.resolveLanguage('bean'), BeanLanguage) {
+                beanType == String.class
+                method == "toUpperCase"
+            }
+            with(context.resolveLanguage('myBean'), BeanLanguage) {
+                beanType == String.class
+                method == "toLowerCase"
+            }
+    }
+
+    def "load integration with dataformats configuration"()  {
+        when:
+            
forRoutes('classpath:routes-with-dataformats-configuration.groovy').accept(Runtime.Phase.ConfigureRoutes,
 runtime)
+
+        then:
+            with(context.resolveDataFormat('json-jackson'), JacksonDataFormat) 
{
+                unmarshalType == Map.class
+                prettyPrint == true
+            }
+            with(context.resolveDataFormat('my-jackson'), JacksonDataFormat) {
+                unmarshalType == String.class
+                prettyPrint == false
+            }
+    }
+
     def "load integration with component error property configuration"()  {
         when:
             
forRoutes('classpath:routes-with-component-wrong-property-configuration.groovy').accept(Runtime.Phase.ConfigureRoutes,
 runtime)
diff --git 
a/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-method-configuration.groovy
 
b/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-method-configuration.groovy
index f2b4fb6..0496fe6 100644
--- 
a/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-method-configuration.groovy
+++ 
b/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-method-configuration.groovy
@@ -16,7 +16,7 @@
  */
 import org.apache.camel.component.seda.SedaComponent
 
-context {
+camel {
     components {
         mySeda(SedaComponent) {
             // a wrong method name
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 07a7422..e34832c 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
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-context {
+camel {
     components {
         seda {
             // a wrong property name
diff --git 
a/camel-k-loader-groovy/src/test/resources/routes-with-component-configuration.groovy
 
b/camel-k-loader-groovy/src/test/resources/routes-with-components-configuration.groovy
similarity index 95%
rename from 
camel-k-loader-groovy/src/test/resources/routes-with-component-configuration.groovy
rename to 
camel-k-loader-groovy/src/test/resources/routes-with-components-configuration.groovy
index abc4b04..b7ef80d 100644
--- 
a/camel-k-loader-groovy/src/test/resources/routes-with-component-configuration.groovy
+++ 
b/camel-k-loader-groovy/src/test/resources/routes-with-components-configuration.groovy
@@ -16,7 +16,7 @@
  */
 import org.apache.camel.component.seda.SedaComponent
 
-context {
+camel {
     components {
         seda {
             // set value as method
@@ -28,7 +28,7 @@ context {
 
         mySeda(SedaComponent) {
             // set value as method
-            queueSize 4321
+            queueSize = 4321
 
             // set value as property
             concurrentConsumers = 21
diff --git 
a/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-method-configuration.groovy
 
b/camel-k-loader-groovy/src/test/resources/routes-with-dataformats-configuration.groovy
similarity index 70%
copy from 
camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-method-configuration.groovy
copy to 
camel-k-loader-groovy/src/test/resources/routes-with-dataformats-configuration.groovy
index f2b4fb6..68b55bf 100644
--- 
a/camel-k-loader-groovy/src/test/resources/routes-with-component-wrong-method-configuration.groovy
+++ 
b/camel-k-loader-groovy/src/test/resources/routes-with-dataformats-configuration.groovy
@@ -14,16 +14,22 @@
  * 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) {
-            // a wrong method name
-            queueNumber 33
+import org.apache.camel.component.jackson.JacksonDataFormat
+
+camel {
+    dataFormats {
+        dataFormat("json-jackson") {
+            unmarshalType = Map.class
+            prettyPrint = true
+        }
+        dataFormat("my-jackson", JacksonDataFormat) {
+            unmarshalType = String.class
+            prettyPrint = false
         }
     }
 }
 
+
 from('timer:tick')
-        .to('log:info')
+    .to('log:info')
\ No newline at end of file
diff --git 
a/camel-k-loader-groovy/src/test/resources/routes-with-bindings.groovy 
b/camel-k-loader-groovy/src/test/resources/routes-with-languages-configuration.groovy
similarity index 73%
rename from camel-k-loader-groovy/src/test/resources/routes-with-bindings.groovy
rename to 
camel-k-loader-groovy/src/test/resources/routes-with-languages-configuration.groovy
index b6941f7..707e057 100644
--- a/camel-k-loader-groovy/src/test/resources/routes-with-bindings.groovy
+++ 
b/camel-k-loader-groovy/src/test/resources/routes-with-languages-configuration.groovy
@@ -14,15 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-context {
-    registry {
-        myEntry1 = 'myRegistryEntry1'
-        myEntry2 = 'myRegistryEntry2'
-        myEntry3 = processor {
-            it.in.headers['test'] = 'value'
+
+import org.apache.camel.language.bean.BeanLanguage
+
+camel {
+
+    languages {
+        bean {
+            beanType = String.class
+            method = "toUpperCase"
+        }
+        myBean(BeanLanguage) {
+            beanType = String.class
+            method = "toLowerCase"
         }
     }
 }
 
+
 from('timer:tick')
     .to('log:info')
\ No newline at end of file

Reply via email to