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 2020/09/22 07:12:48 UTC
[camel-k-runtime] branch master updated (193a0cb -> ce00982)
This is an automated email from the ASF dual-hosted git repository.
lburgazzoli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git.
from 193a0cb Updated CHANGELOG.md
new 0f96858 yaml dsl: document how to create beans using YAML #487
new ed49299 yaml dsl: fix indentation for test routes
new ce00982 yaml dsl: fix test names
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../k/loader/yaml/RoutesValidationTest.groovy | 2 +-
...ntTest.groovy => RoutesWithEndpointTest.groovy} | 2 +-
.../test/resources/routes/RoutesTest_beans.yaml | 30 +++++++-------
..._from.yaml => RoutesWithEndpointTest_from.yaml} | 0
...oute.yaml => RoutesWithEndpointTest_route.yaml} | 0
docs/modules/languages/pages/yaml.adoc | 47 +++++++++++++++++++++-
6 files changed, 63 insertions(+), 18 deletions(-)
rename camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/{RouteWithEndpointTest.groovy => RoutesWithEndpointTest.groovy} (98%)
rename camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/{RouteWithEndpointTest_from.yaml => RoutesWithEndpointTest_from.yaml} (100%)
rename camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/{RouteWithEndpointTest_route.yaml => RoutesWithEndpointTest_route.yaml} (100%)
[camel-k-runtime] 03/03: yaml dsl: fix test names
Posted by lb...@apache.org.
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 ce009826e2fc47d7a97cc03d719ed795624bf4c0
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Tue Sep 22 08:30:24 2020 +0200
yaml dsl: fix test names
---
.../groovy/org/apache/camel/k/loader/yaml/RoutesValidationTest.groovy | 2 +-
.../{RouteWithEndpointTest.groovy => RoutesWithEndpointTest.groovy} | 2 +-
...RouteWithEndpointTest_from.yaml => RoutesWithEndpointTest_from.yaml} | 0
...uteWithEndpointTest_route.yaml => RoutesWithEndpointTest_route.yaml} | 0
4 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesValidationTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesValidationTest.groovy
index fdb22da..f8f5800 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesValidationTest.groovy
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesValidationTest.groovy
@@ -51,6 +51,6 @@ class RoutesValidationTest extends Specification {
return Files.list(paths)
// exclude RouteWithEndpointTest_ as there's no Endpoint DSL integration
// with the json schema
- .filter(p -> !p.last().toString().startsWith("RouteWithEndpointTest_"))
+ .filter(p -> !p.last().toString().startsWith("RoutesWithEndpointTest_"))
}
}
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RouteWithEndpointTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithEndpointTest.groovy
similarity index 98%
rename from camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RouteWithEndpointTest.groovy
rename to camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithEndpointTest.groovy
index 723a2a8..1f9cbfc 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RouteWithEndpointTest.groovy
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithEndpointTest.groovy
@@ -21,7 +21,7 @@ import org.apache.camel.component.mock.MockEndpoint
import org.apache.camel.component.telegram.TelegramEndpoint
import org.apache.camel.k.loader.yaml.support.TestSupport
-class RouteWithEndpointTest extends TestSupport {
+class RoutesWithEndpointTest extends TestSupport {
def 'from'() {
setup:
def parameters = [
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithEndpointTest_from.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithEndpointTest_from.yaml
similarity index 100%
rename from camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithEndpointTest_from.yaml
rename to camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithEndpointTest_from.yaml
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithEndpointTest_route.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithEndpointTest_route.yaml
similarity index 100%
rename from camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RouteWithEndpointTest_route.yaml
rename to camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithEndpointTest_route.yaml
[camel-k-runtime] 01/03: yaml dsl: document how to create beans
using YAML #487
Posted by lb...@apache.org.
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 0f96858c5de8e3b40a96c69682a8b08ce69b84d7
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Tue Sep 22 08:28:18 2020 +0200
yaml dsl: document how to create beans using YAML #487
---
docs/modules/languages/pages/yaml.adoc | 47 +++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/docs/modules/languages/pages/yaml.adoc b/docs/modules/languages/pages/yaml.adoc
index 2a8f786..c94e563 100644
--- a/docs/modules/languages/pages/yaml.adoc
+++ b/docs/modules/languages/pages/yaml.adoc
@@ -7,7 +7,7 @@ The YAML DSL is current in preview support level.
== Defining a route
-A route is a sequence of elements, or `steps`, defined as follows:
+A route is collection of elements defined as follows:
[source,yaml]
----
@@ -112,6 +112,51 @@ set-body:
In case you want to use the data-format's default settings, you need to place an empty block as data format parameters, like `json: {}`
====
+== Defining beans
+
+In addition to the general support for creating beans provided by https://camel.apache.org/components/latest/others/main.html#_specifying_custom_beans[Camel Main], the YAML DSL provide a convenient syntax to define and configure them:
+
+[source,yaml]
+----
+- beans:
+ - name: beanFromMap # <1>
+ type: com.acme.MyBean # <2>
+ properties: # <3>
+ foo: bar
+----
+<1> the name of the bean which will be used to bound the instance to the Camel Registry
+<2> the full qualified class name of the bean
+<3> the properties of the bean to be set
+
+The properties of the bean can be defined using either a map or properties style as shown in the example below:
+
+[source,yaml]
+----
+- beans:
+ # map style
+ - name: beanFromMap
+ type: com.acme.MyBean
+ properties:
+ field1: 'f1'
+ field2: 'f2'
+ nested:
+ field1: 'nf1'
+ field2: 'nf2'
+ # properties style
+ - name: beanFromProps
+ type: com.acme.MyBean
+ properties:
+ field1: 'f1_p'
+ field2: 'f2_p'
+ nested.field1: 'nf1_p'
+ nested.field2: 'nf2_p'
+----
+
+[NOTE]
+====
+The `beans` elements can only be used as root element
+====
+
== Extending the DSL
The DSL is designed to be easily extended, so you can provide your own step handler which is discovered at runtime using Camel's factory finder.
[camel-k-runtime] 02/03: yaml dsl: fix indentation for test routes
Posted by lb...@apache.org.
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 ed492992721b86ac803816cbf03109b307466fb2
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Tue Sep 22 08:28:51 2020 +0200
yaml dsl: fix indentation for test routes
---
.../test/resources/routes/RoutesTest_beans.yaml | 30 +++++++++++-----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesTest_beans.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesTest_beans.yaml
index e2eef2b..3bb1a90 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesTest_beans.yaml
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesTest_beans.yaml
@@ -15,18 +15,18 @@
# limitations under the License.
#
- beans:
- - name: myNested
- type: org.apache.camel.k.loader.yaml.support.MyBean
- properties:
- field1: 'f1'
- field2: 'f2'
- nested:
- field1: 'nf1'
- field2: 'nf2'
- - name: myProps
- type: org.apache.camel.k.loader.yaml.support.MyBean
- properties:
- field1: 'f1_p'
- field2: 'f2_p'
- nested.field1: 'nf1_p'
- nested.field2: 'nf2_p'
\ No newline at end of file
+ - name: myNested
+ type: org.apache.camel.k.loader.yaml.support.MyBean
+ properties:
+ field1: 'f1'
+ field2: 'f2'
+ nested:
+ field1: 'nf1'
+ field2: 'nf2'
+ - name: myProps
+ type: org.apache.camel.k.loader.yaml.support.MyBean
+ properties:
+ field1: 'f1_p'
+ field2: 'f2_p'
+ nested.field1: 'nf1_p'
+ nested.field2: 'nf2_p'
\ No newline at end of file