You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/04/01 14:29:32 UTC

[camel] branch CAMEL-17893 created (now 00c5536)

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

davsclaus pushed a change to branch CAMEL-17893
in repository https://gitbox.apache.org/repos/asf/camel.git.


      at 00c5536  CAMEL-17893: camel-yaml-dsl - Remove endpoint-dsl notation which was not well known and is also causing problems for tooling and yaml schema validation.

This branch includes the following new commits:

     new 00c5536  CAMEL-17893: camel-yaml-dsl - Remove endpoint-dsl notation which was not well known and is also causing problems for tooling and yaml schema validation.

The 1 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.


[camel] 01/01: CAMEL-17893: camel-yaml-dsl - Remove endpoint-dsl notation which was not well known and is also causing problems for tooling and yaml schema validation.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-17893
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 00c5536dd41ab9faf15fd47b97d9241b22899f0d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Apr 1 16:27:31 2022 +0200

    CAMEL-17893: camel-yaml-dsl - Remove endpoint-dsl notation which was not well known and is also causing problems for tooling and yaml schema validation.
---
 .../ROOT/pages/camel-3x-upgrade-guide-3_17.adoc    | 43 +++++++++++++++++
 .../dsl/yaml/deserializers/ModelDeserializers.java | 54 +++-------------------
 .../dsl/yaml/GenerateYamlDeserializersMojo.java    |  7 ---
 .../camel-yaml-dsl/src/main/docs/yaml-dsl.adoc     | 13 ------
 .../dsl/yaml/YamlRoutesBuilderLoaderSupport.java   |  2 -
 .../org/apache/camel/dsl/yaml/SagaTest.groovy      | 23 ---------
 .../org/apache/camel/dsl/yaml/ToDynamicTest.groovy | 16 -------
 .../groovy/org/apache/camel/dsl/yaml/ToTest.groovy | 15 ------
 .../org/apache/camel/dsl/yaml/WireTapTest.groovy   | 17 +++++++
 9 files changed, 66 insertions(+), 124 deletions(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc
index da36ee0..3cf6a39 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc
@@ -10,6 +10,49 @@ from both 3.0 to 3.1 and 3.1 to 3.2.
 
 Added method `findRouteResourcesFromDirectory` to `org.apache.camel.main.RoutesCollector`.
 
+=== camel-yaml-dsl
+
+Removed _endpoint-dsl_ notation which was not well known,
+causing problems for tools, and yaml-validation against the json-schema standard.
+
+For example the following notation:
+
+[source,yaml]
+----
+- from:
+    uri: "direct:start"
+    steps:
+      - to:
+          kafka:
+            topic: cheese
+            brokers: mykafka:1234
+----
+
+Should be change to:
+
+[source,yaml]
+----
+- from:
+    uri: "direct:start"
+    steps:
+      - to:
+          uri: "kafka:cheese?brokers=mykafka:1234"
+----
+
+Or
+
+[source,yaml]
+----
+- from:
+    uri: "direct:start"
+    steps:
+      - to:
+          uri: "kafka"
+          parameters:
+            topic: "cheese"
+            brokers: "mykafka:1234"
+----
+
 === camel-kafka
 
 The option `autoCommitOnStop` was removed from the Camel Kafka component. When using `autoCommitEnable` (which is enabled by default) the Kafka consumer will automatically commit on close.
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index ac71de3..367490d 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -6606,14 +6606,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     break;
                 }
                 default: {
-                    String uri = EndpointProducerDeserializersResolver.resolveEndpointUri(propertyKey, node);
-                    if (uri == null) {
-                        return false;
-                    }
-                    if (target.getUri() != null) {
-                        throw new IllegalStateException("url must not be set when using Endpoint DSL");
-                    }
-                    target.setUri(uri);
+                    return false;
                 }
             }
             return true;
@@ -6682,14 +6675,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     break;
                 }
                 default: {
-                    String uri = EndpointProducerDeserializersResolver.resolveEndpointUri(propertyKey, node);
-                    if (uri == null) {
-                        return false;
-                    }
-                    if (target.getUri() != null) {
-                        throw new IllegalStateException("url must not be set when using Endpoint DSL");
-                    }
-                    target.setUri(uri);
+                    return false;
                 }
             }
             return true;
@@ -13172,14 +13158,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     break;
                 }
                 default: {
-                    String uri = EndpointProducerDeserializersResolver.resolveEndpointUri(propertyKey, node);
-                    if (uri == null) {
-                        return false;
-                    }
-                    if (target.getUri() != null) {
-                        throw new IllegalStateException("url must not be set when using Endpoint DSL");
-                    }
-                    target.setUri(uri);
+                    return false;
                 }
             }
             return true;
@@ -15733,14 +15712,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     break;
                 }
                 default: {
-                    String uri = EndpointProducerDeserializersResolver.resolveEndpointUri(propertyKey, node);
-                    if (uri == null) {
-                        return false;
-                    }
-                    if (target.getUri() != null) {
-                        throw new IllegalStateException("url must not be set when using Endpoint DSL");
-                    }
-                    target.setUri(uri);
+                    return false;
                 }
             }
             return true;
@@ -15839,14 +15811,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     break;
                 }
                 default: {
-                    String uri = EndpointProducerDeserializersResolver.resolveEndpointUri(propertyKey, node);
-                    if (uri == null) {
-                        return false;
-                    }
-                    if (target.getUri() != null) {
-                        throw new IllegalStateException("url must not be set when using Endpoint DSL");
-                    }
-                    target.setUri(uri);
+                    return false;
                 }
             }
             return true;
@@ -17457,14 +17422,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                     break;
                 }
                 default: {
-                    String uri = EndpointProducerDeserializersResolver.resolveEndpointUri(propertyKey, node);
-                    if (uri == null) {
-                        return false;
-                    }
-                    if (target.getUri() != null) {
-                        throw new IllegalStateException("url must not be set when using Endpoint DSL");
-                    }
-                    target.setUri(uri);
+                    return false;
                 }
             }
             return true;
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-maven-plugin/src/main/java/org/apache/camel/maven/dsl/yaml/GenerateYamlDeserializersMojo.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-maven-plugin/src/main/java/org/apache/camel/maven/dsl/yaml/GenerateYamlDeserializersMojo.java
index e52d7ab..63d0490 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-maven-plugin/src/main/java/org/apache/camel/maven/dsl/yaml/GenerateYamlDeserializersMojo.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-maven-plugin/src/main/java/org/apache/camel/maven/dsl/yaml/GenerateYamlDeserializersMojo.java
@@ -580,15 +580,8 @@ public class GenerateYamlDeserializersMojo extends GenerateYamlSupportMojo {
 
         if (extendsType(info, SEND_DEFINITION_CLASS) || extendsType(info, TO_DYNAMIC_DEFINITION_CLASS)) {
             setProperty.beginControlFlow("default:");
-            setProperty.addStatement("String uri = EndpointProducerDeserializersResolver.resolveEndpointUri(propertyKey, node)");
-            setProperty.beginControlFlow("if (uri == null)");
             setProperty.addStatement("return false");
             setProperty.endControlFlow();
-            setProperty.beginControlFlow("if (target.getUri() != null)");
-            setProperty.addStatement("throw new IllegalStateException(\"url must not be set when using Endpoint DSL\")");
-            setProperty.endControlFlow();
-            setProperty.addStatement("target.setUri(uri)");
-            setProperty.endControlFlow();
 
             properties.add(
                 yamlProperty(
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/docs/yaml-dsl.adoc b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/docs/yaml-dsl.adoc
index e7326e1..b74a106 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/docs/yaml-dsl.adoc
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/docs/yaml-dsl.adoc
@@ -130,19 +130,6 @@ To define an endpoint with the YAML dsl you have three options:
           parameters:
             authorizationToken: "XXX"
 ----
-. Using the YAML implementation of the xref:manual::Endpoint-dsl.adoc[Endpoint DSL]:
-+
-[source,yaml]
-----
-- from:
-    timer:
-      name: "tick"
-      period: "1s"
-    steps:
-      - telegram:
-          type: "bots"
-          authorizationToken: "XXX"
-----
 
 == Defining beans
 
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/YamlRoutesBuilderLoaderSupport.java b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/YamlRoutesBuilderLoaderSupport.java
index 94765fe..de84468 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/YamlRoutesBuilderLoaderSupport.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/main/java/org/apache/camel/dsl/yaml/YamlRoutesBuilderLoaderSupport.java
@@ -30,7 +30,6 @@ import org.apache.camel.dsl.yaml.common.YamlDeserializationContext;
 import org.apache.camel.dsl.yaml.common.YamlDeserializationMode;
 import org.apache.camel.dsl.yaml.common.exception.YamlDeserializationException;
 import org.apache.camel.dsl.yaml.deserializers.CustomResolver;
-import org.apache.camel.dsl.yaml.deserializers.EndpointProducerDeserializersResolver;
 import org.apache.camel.dsl.yaml.deserializers.ModelDeserializersResolver;
 import org.apache.camel.spi.Resource;
 import org.snakeyaml.engine.v2.api.LoadSettings;
@@ -68,7 +67,6 @@ public abstract class YamlRoutesBuilderLoaderSupport extends RouteBuilderLoaderS
         ctx.setCamelContext(getCamelContext());
         ctx.addResolvers(new CustomResolver());
         ctx.addResolvers(new ModelDeserializersResolver());
-        ctx.addResolvers(new EndpointProducerDeserializersResolver());
         return ctx;
     }
 
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/SagaTest.groovy b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/SagaTest.groovy
index dd372d4..731fc0b 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/SagaTest.groovy
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/SagaTest.groovy
@@ -136,29 +136,6 @@ class SagaTest extends YamlTestSupport {
                                  expression:
                                    simple: "${body}"        
                           - to: "mock:result"
-                    '''),
-                asResource('endpoint-dsl', '''
-                    - from:
-                        uri: "direct:start"
-                        steps:    
-                          - saga: 
-                             propagation: "MANDATORY"
-                             completionMode: "MANUAL"
-                             compensation: 
-                               direct:
-                                 name: "compensation"
-                             completion:
-                               direct:
-                                 name: "completion"
-                             steps:
-                               - to: "direct:something"  
-                             option:
-                               - key: o1
-                                 simple: "${body}" 
-                               - key: o2
-                                 expression:
-                                   simple: "${body}"          
-                          - to: "mock:result"
                     ''')
            ]
     }
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/ToDynamicTest.groovy b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/ToDynamicTest.groovy
index 0fd7b92..a87d004 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/ToDynamicTest.groovy
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/ToDynamicTest.groovy
@@ -53,14 +53,6 @@ class ToDynamicTest extends YamlTestSupport {
                               parameters:
                                 name: "start"
                     '''),
-                asResource('endpoint', '''
-                    - from:
-                        uri: "direct:start"
-                        steps:    
-                          - toD: 
-                              direct:
-                                name: "start"
-                    '''),
                 asResource('properties-out-of-order', '''
                     - from:
                         uri: "direct:start"
@@ -104,14 +96,6 @@ class ToDynamicTest extends YamlTestSupport {
                               parameters:
                                 name: "start"
                     '''),
-                    asResource('endpoint', '''
-                    - from:
-                        uri: "direct:start"
-                        steps:    
-                          - toD: 
-                              direct:
-                                name: "start"
-                    '''),
                     asResource('properties-out-of-order', '''
                     - from:
                         uri: "direct:start"
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/ToTest.groovy b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/ToTest.groovy
index 229d78e..1f0082c 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/ToTest.groovy
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/ToTest.groovy
@@ -53,21 +53,6 @@ class ToTest extends YamlTestSupport {
                               parameters:
                                 name: "start"
                     '''),
-                asResource('endpoint', '''
-                    - from:
-                        uri: "direct:start"
-                        steps:    
-                          - to: 
-                              direct:
-                                name: "start"
-                    '''),
-                asResource('endpoint-dsl', '''
-                    - from:
-                        uri: "direct:start"
-                        steps:    
-                          - direct:
-                              name: "start"
-                    '''),
                 asResource('properties-out-of-order', '''
                     - from:
                         uri: "direct:start"
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/WireTapTest.groovy b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/WireTapTest.groovy
index 8250c54..678e5d5 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/WireTapTest.groovy
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/groovy/org/apache/camel/dsl/yaml/WireTapTest.groovy
@@ -37,4 +37,21 @@ class WireTapTest extends YamlTestSupport {
                 uri == "direct:wt"
             }
     }
+
+    def "wire-tap uri parameters (#resource.location)"() {
+        when:
+            loadRoutes '''
+                - from:
+                    uri: "direct:start"
+                    steps:
+                      - wire-tap:
+                         uri: direct
+                         parameters:
+                           name: wt2  
+            '''
+        then:
+            with(context.routeDefinitions[0].outputs[0], WireTapDefinition) {
+                uri == "direct:wt2"
+            }
+    }
 }