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/10/23 08:59:04 UTC

[camel-k-runtime] branch master updated (6fe6a1c -> 6c152a1)

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 6fe6a1c  kamelet: ensure properties are correctly propagated to the route template engine
     new 1e69168  yaml: auto wrap secret values wit RAW
     new 6c152a1  yaml: regen

The 2 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:
 .../camel/k/loader/yaml/parser/FromStepParser.java |  7 +-
 .../k/loader/yaml/parser/RouteStepParser.java      | 10 ++-
 .../k/loader/yaml/parser/ToDynamicStepParser.java  |  2 +-
 .../camel/k/loader/yaml/parser/ToStepParser.java   |  2 +-
 .../k/loader/yaml/parser/WireTapStepParser.java    |  2 +-
 .../k/loader/yaml/support/StepParserSupport.java   | 41 ++++++++---
 camel-k-loader-yaml/camel-k-loader-yaml/pom.xml    | 10 +++
 .../src/generated/resources/camel-yaml-dsl.json    |  3 +
 .../loader/yaml/RoutesWithPlaceholdersTest.groovy  |  1 +
 .../k/loader/yaml/RoutesWithSecretsTest.groovy     | 81 ++++++++++++++++++++++
 .../camel/k/loader/yaml/parser/FromTest.groovy     | 57 ++++++++++++++-
 .../camel/k/loader/yaml/parser/ToTest.groovy       | 45 ++++++++++++
 ...route.yaml => RoutesWithSecretsTest_route.yaml} | 11 +--
 ...l => RoutesWithSecretsTest_route_property.yaml} | 11 +--
 ...e.yaml => RoutesWithSecretsTest_route_raw.yaml} | 11 +--
 15 files changed, 261 insertions(+), 33 deletions(-)
 create mode 100644 camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithSecretsTest.groovy
 copy camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/{RoutesWithPlaceholdersTest_route.yaml => RoutesWithSecretsTest_route.yaml} (79%)
 copy camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/{RoutesWithPlaceholdersTest_route.yaml => RoutesWithSecretsTest_route_property.yaml} (78%)
 copy camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/{RoutesWithPlaceholdersTest_route.yaml => RoutesWithSecretsTest_route_raw.yaml} (78%)


[camel-k-runtime] 01/02: yaml: auto wrap secret values wit RAW

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 1e691680c163e71968baa409120d2c8909af10ad
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Thu Oct 22 16:42:54 2020 +0200

    yaml: auto wrap secret values wit RAW
---
 .../camel/k/loader/yaml/parser/FromStepParser.java |  7 +-
 .../k/loader/yaml/parser/RouteStepParser.java      | 10 ++-
 .../k/loader/yaml/parser/ToDynamicStepParser.java  |  2 +-
 .../camel/k/loader/yaml/parser/ToStepParser.java   |  2 +-
 .../k/loader/yaml/parser/WireTapStepParser.java    |  2 +-
 .../k/loader/yaml/support/StepParserSupport.java   | 41 ++++++++---
 camel-k-loader-yaml/camel-k-loader-yaml/pom.xml    | 10 +++
 .../loader/yaml/RoutesWithPlaceholdersTest.groovy  |  1 +
 .../k/loader/yaml/RoutesWithSecretsTest.groovy     | 81 ++++++++++++++++++++++
 .../camel/k/loader/yaml/parser/FromTest.groovy     | 57 ++++++++++++++-
 .../camel/k/loader/yaml/parser/ToTest.groovy       | 45 ++++++++++++
 .../routes/RoutesWithSecretsTest_route.yaml        | 27 ++++++++
 .../RoutesWithSecretsTest_route_property.yaml      | 27 ++++++++
 .../routes/RoutesWithSecretsTest_route_raw.yaml    | 27 ++++++++
 14 files changed, 318 insertions(+), 21 deletions(-)

diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java
index 9d05fb0..cd2b55f 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java
+++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/FromStepParser.java
@@ -36,9 +36,10 @@ public class FromStepParser implements StartStepParser {
             throw new IllegalArgumentException("Either uri or scheme must be set");
         }
 
-        String uri = definition.uri != null
-            ? StepParserSupport.createEndpointUri(definition.uri, definition.parameters)
-            : StepParserSupport.createEndpointUri(context.getCamelContext(), definition.scheme, definition.parameters);
+        String uri = StepParserSupport.createEndpointUri(
+            context.getCamelContext(),
+            definition.uri != null ? definition.uri : definition.scheme,
+            definition.parameters);
 
         // as this is a start converter, steps are mandatory
         StepParserSupport.notNull(definition.steps, "steps");
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java
index a13f02c..9c18760 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java
+++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/RouteStepParser.java
@@ -38,14 +38,16 @@ public class RouteStepParser implements StartStepParser {
             throw new IllegalArgumentException("Either uri or scheme must be set");
         }
 
-        String uri = definition.from.uri != null
-            ? StepParserSupport.createEndpointUri(definition.from.uri, definition.from.parameters)
-            : StepParserSupport.createEndpointUri(context.getCamelContext(), definition.from.scheme, definition.from.parameters);
+        String uri = StepParserSupport.createEndpointUri(
+            context.getCamelContext(),
+            definition.from.uri != null ? definition.from.uri : definition.from.scheme,
+            definition.from.parameters);
 
         RouteDefinition route = context.builder().from(uri);
 
         ObjectHelper.ifNotEmpty(definition.id, route::routeId);
         ObjectHelper.ifNotEmpty(definition.group, route::routeGroup);
+        ObjectHelper.ifNotEmpty(definition.autoStartup, route::autoStartup);
 
         // as this is a start converter, steps are mandatory
         StepParserSupport.notNull(definition.steps, "steps");
@@ -63,6 +65,8 @@ public class RouteStepParser implements StartStepParser {
         public String id;
         @JsonProperty
         public String group;
+        @JsonProperty
+        public Boolean autoStartup;
         @JsonProperty(required = true)
         public From from;
         @JsonProperty(required = true)
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java
index 183e915..2c9ab13 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java
+++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToDynamicStepParser.java
@@ -31,7 +31,7 @@ public class ToDynamicStepParser implements ProcessorStepParser {
     @Override
     public ProcessorDefinition<?> toProcessor(Context context) {
         final Definition definition = context.node(Definition.class);
-        final String uri = StepParserSupport.createEndpointUri(definition.getUri(), definition.parameters);
+        final String uri = StepParserSupport.createEndpointUri(context.getCamelContext(), definition.getUri(), definition.parameters);
         final ToDynamicDefinition answer = new ToDynamicDefinition(uri);
 
         return answer;
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToStepParser.java
index d31c05d..fb224ba 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToStepParser.java
+++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/ToStepParser.java
@@ -31,7 +31,7 @@ public class ToStepParser implements ProcessorStepParser {
     @Override
     public ProcessorDefinition<?> toProcessor(Context context) {
         final Definition definition = context.node(Definition.class);
-        final String uri = StepParserSupport.createEndpointUri(definition.getUri(), definition.parameters);
+        final String uri = StepParserSupport.createEndpointUri(context.getCamelContext(), definition.getUri(), definition.parameters);
         final ToDefinition answer = new ToDefinition(uri);
 
         return answer;
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/WireTapStepParser.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/WireTapStepParser.java
index 7d4776d..73a4489 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/WireTapStepParser.java
+++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/parser/WireTapStepParser.java
@@ -54,7 +54,7 @@ public class WireTapStepParser implements ProcessorStepParser {
         }
 
         answer.setUri(
-            StepParserSupport.createEndpointUri(definition.getUri(), definition.parameters)
+            StepParserSupport.createEndpointUri(context.getCamelContext(), definition.getUri(), definition.parameters)
         );
 
         return answer;
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java
index fc44afe..f4a8c36 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java
+++ b/camel-k-loader-yaml/camel-k-loader-yaml-common/src/main/java/org/apache/camel/k/loader/yaml/support/StepParserSupport.java
@@ -19,6 +19,7 @@ package org.apache.camel.k.loader.yaml.support;
 import java.net.URISyntaxException;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ExtendedCamelContext;
@@ -30,6 +31,7 @@ import org.apache.camel.model.OutputNode;
 import org.apache.camel.model.ProcessorDefinition;
 import org.apache.camel.spi.EndpointUriFactory;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.StringHelper;
 import org.apache.camel.util.URISupport;
 
 public final class StepParserSupport {
@@ -70,26 +72,49 @@ public final class StepParserSupport {
         return parent;
     }
 
-    public static String createEndpointUri(String uri, Map<String, Object> parameters) {
+    public static String createEndpointUri(CamelContext context, String uri, Map<String, Object> parameters) {
         String answer = uri;
 
-        if (parameters != null) {
-            String queryString;
+        if (parameters == null || parameters.isEmpty()) {
+            return answer;
+        }
+
+        if (uri.contains(":")) {
+            final String scheme = StringHelper.before(uri, ":");
+            final EndpointUriFactory factory = getEndpointUriFactory(context, scheme);
+
+            // we want sorted parameters
+            Map<String, Object> map = new TreeMap<>(parameters);
+            for (String secretParameter : factory.secretPropertyNames()) {
+                Object val = map.get(secretParameter);
+                if (val instanceof String) {
+                    String newVal = (String) val;
+                    if (!newVal.startsWith("#") && !newVal.startsWith("RAW(")) {
+                        map.put(secretParameter, "RAW(" + val + ")");
+                    }
+                }
+            }
 
             try {
-                queryString = URISupport.createQueryString(parameters, false);
+                String queryString = URISupport.createQueryString(map, false);
                 if (ObjectHelper.isNotEmpty(queryString)) {
                     answer += "?" + queryString;
                 }
             } catch (URISyntaxException e) {
                 throw new IllegalArgumentException(e);
             }
+        } else {
+            try {
+                answer = getEndpointUriFactory(context, uri).buildUri(uri, parameters);
+            } catch (URISyntaxException e) {
+                throw new IllegalArgumentException(e);
+            }
         }
 
         return answer;
     }
 
-    public static String createEndpointUri(CamelContext context, String scheme, Map<String, Object> parameters) {
+    public static EndpointUriFactory getEndpointUriFactory(CamelContext context, String scheme) {
         final EndpointUriFactory factory = context.adapt(ExtendedCamelContext.class).getEndpointUriFactory(scheme);
 
         if (factory == null) {
@@ -99,10 +124,6 @@ public final class StepParserSupport {
             throw new IllegalArgumentException("Cannot compute endpoint URI: scheme " + scheme + " is not enabled");
         }
 
-        try {
-            return factory.buildUri(scheme, parameters);
-        } catch (URISyntaxException e) {
-            throw new IllegalArgumentException(e);
-        }
+        return factory;
     }
 }
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml b/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml
index 4b6f176..0ff74d1 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/pom.xml
@@ -106,6 +106,16 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-seda</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-timer</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>com.github.java-json-tools</groupId>
             <artifactId>json-schema-validator</artifactId>
             <version>${json-schema-validator-version}</version>
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithPlaceholdersTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithPlaceholdersTest.groovy
index 751b928..fd21446 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithPlaceholdersTest.groovy
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithPlaceholdersTest.groovy
@@ -38,6 +38,7 @@ class RoutesWithPlaceholdersTest extends TestSupport {
         cleanup:
             context?.stop()
     }
+
     def 'from'() {
         setup:
             def parameters = [
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithSecretsTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithSecretsTest.groovy
new file mode 100644
index 0000000..79be91d
--- /dev/null
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/RoutesWithSecretsTest.groovy
@@ -0,0 +1,81 @@
+/*
+ * 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.yaml
+
+
+import org.apache.camel.component.telegram.TelegramEndpoint
+import org.apache.camel.k.loader.yaml.support.TestSupport
+
+class RoutesWithSecretsTest extends TestSupport {
+    static final Properties PROPERTIES = [
+        'telegram.token': 's3cret',
+    ]
+
+    def 'route'() {
+        setup:
+            def context = startContextForSpec {
+                propertiesComponent.initialProperties = PROPERTIES
+            }
+        when:
+            def eps = context.getEndpoints().findAll { it instanceof TelegramEndpoint }
+        then:
+            eps.each {
+                with(it, TelegramEndpoint) {
+                    endpointUri == 'telegram://bots?authorizationToken=RAW(s3cret)'
+                    configuration.authorizationToken == PROPERTIES.getProperty('telegram.token')
+                }
+            }
+        cleanup:
+            context?.stop()
+    }
+
+    def 'route_property'() {
+        setup:
+            def context = startContextForSpec {
+                propertiesComponent.initialProperties = PROPERTIES
+            }
+        when:
+            def eps = context.getEndpoints().findAll { it instanceof TelegramEndpoint }
+        then:
+            eps.each {
+                with(it, TelegramEndpoint) {
+                    endpointUri == 'telegram://bots?authorizationToken=%23property:telegram.token'
+                    configuration.authorizationToken == PROPERTIES.getProperty('telegram.token')
+                }
+            }
+        cleanup:
+            context?.stop()
+    }
+
+    def 'route_raw'() {
+        setup:
+            def context = startContextForSpec {
+                propertiesComponent.initialProperties = PROPERTIES
+            }
+        when:
+            def eps = context.getEndpoints().findAll { it instanceof TelegramEndpoint }
+        then:
+            eps.each {
+                with(it, TelegramEndpoint) {
+                    endpointUri == 'telegram://bots?authorizationToken=RAW(s3cret)'
+                    configuration.authorizationToken == PROPERTIES.getProperty('telegram.token')
+                }
+            }
+        cleanup:
+            context?.stop()
+    }
+}
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/FromTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/FromTest.groovy
index 168c124..1e08f99 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/FromTest.groovy
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/FromTest.groovy
@@ -30,8 +30,7 @@ class FromTest extends TestSupport {
                  parameters:
                    period: "1s"
                  steps:
-                   - log:
-                       message: "test"
+                   - log: "test"
             ''')
         when:
             def processor = new FromStepParser().process(stepContext)
@@ -42,6 +41,60 @@ class FromTest extends TestSupport {
             }
     }
 
+    def "definition with secrets"() {
+        given:
+            def stepContext = stepContext('''
+                 uri: "telegram://bots"
+                 parameters:
+                   authorizationToken: "s3cret"
+                 steps:
+                   - log: "test"
+            ''')
+        when:
+            def processor = new FromStepParser().process(stepContext)
+        then:
+            with(processor, RouteDefinition) {
+                input instanceof FromDefinition
+                input.endpointUri == 'telegram://bots?authorizationToken=RAW(s3cret)'
+            }
+    }
+
+    def "definition with secrets (raw)"() {
+        given:
+            def stepContext = stepContext('''
+                 uri: "telegram://bots"
+                 parameters:
+                   authorizationToken: "RAW(s3cret)"
+                 steps:
+                   - log: "test"
+            ''')
+        when:
+            def processor = new FromStepParser().process(stepContext)
+        then:
+            with(processor, RouteDefinition) {
+                input instanceof FromDefinition
+                input.endpointUri == 'telegram://bots?authorizationToken=RAW(s3cret)'
+            }
+    }
+
+    def "definition with secrets (property)"() {
+        given:
+            def stepContext = stepContext('''
+                 uri: "telegram://bots"
+                 parameters:
+                   authorizationToken: "#property:telegram.token"
+                 steps:
+                   - log: "test"
+            ''')
+        when:
+            def processor = new FromStepParser().process(stepContext)
+        then:
+            with(processor, RouteDefinition) {
+                input instanceof FromDefinition
+                input.endpointUri == 'telegram://bots?authorizationToken=#property:telegram.token'
+            }
+    }
+
     def "should fail without steps"() {
         given:
             def stepContext = stepContext('''
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/ToTest.groovy b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/ToTest.groovy
index e30a09e..c3846e9 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/ToTest.groovy
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/groovy/org/apache/camel/k/loader/yaml/parser/ToTest.groovy
@@ -37,6 +37,51 @@ class ToTest extends TestSupport {
             }
     }
 
+    def "definition with secrets"() {
+        given:
+            def stepContext = stepContext('''
+                 uri: "telegram://bots"
+                 parameters:
+                   authorizationToken: "s3cret"
+            ''')
+        when:
+            def processor = new ToStepParser().toProcessor(stepContext)
+        then:
+            with(processor, ToDefinition) {
+                endpointUri == 'telegram://bots?authorizationToken=RAW(s3cret)'
+            }
+    }
+
+    def "definition with secrets (raw)"() {
+        given:
+            def stepContext = stepContext('''
+                 uri: "telegram://bots"
+                 parameters:
+                   authorizationToken: "RAW(s3cret)"
+            ''')
+        when:
+            def processor = new ToStepParser().toProcessor(stepContext)
+        then:
+            with(processor, ToDefinition) {
+                endpointUri == 'telegram://bots?authorizationToken=RAW(s3cret)'
+            }
+    }
+
+    def "definition with secrets (property)"() {
+        given:
+            def stepContext = stepContext('''
+                 uri: "telegram://bots"
+                 parameters:
+                   authorizationToken: "#property:telegram.token"
+            ''')
+        when:
+            def processor = new ToStepParser().toProcessor(stepContext)
+        then:
+            with(processor, ToDefinition) {
+                endpointUri == 'telegram://bots?authorizationToken=#property:telegram.token'
+            }
+    }
+
     def "definition compact"() {
         given:
             def node = TextNode.valueOf('seda://test')
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithSecretsTest_route.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithSecretsTest_route.yaml
new file mode 100644
index 0000000..f29f6cc
--- /dev/null
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithSecretsTest_route.yaml
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+- route:
+    auto-startup: false
+    from:
+      uri: "telegram:bots"
+      parameters:
+        authorizationToken: "{{telegram.token}}"
+    steps:
+      - to:
+          uri: "telegram:bots"
+          parameters:
+            authorizationToken: "{{telegram.token}}"
\ No newline at end of file
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithSecretsTest_route_property.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithSecretsTest_route_property.yaml
new file mode 100644
index 0000000..d6d80b5
--- /dev/null
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithSecretsTest_route_property.yaml
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+- route:
+    auto-startup: false
+    from:
+      uri: "telegram:bots"
+      parameters:
+        authorizationToken: "#property:telegram.token"
+    steps:
+      - to:
+          uri: "telegram:bots"
+          parameters:
+            authorizationToken: "#property:telegram.token"
\ No newline at end of file
diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithSecretsTest_route_raw.yaml b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithSecretsTest_route_raw.yaml
new file mode 100644
index 0000000..868587e
--- /dev/null
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/test/resources/routes/RoutesWithSecretsTest_route_raw.yaml
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+- route:
+    auto-startup: false
+    from:
+      uri: "telegram:bots"
+      parameters:
+        authorizationToken: "RAW({{telegram.token}})"
+    steps:
+      - to:
+          uri: "telegram:bots"
+          parameters:
+            authorizationToken: "RAW({{telegram.token}})"
\ No newline at end of file


[camel-k-runtime] 02/02: yaml: regen

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 6c152a121cf39d8f3c1310acf0c9780b04c172a4
Author: Luca Burgazzoli <lb...@gmail.com>
AuthorDate: Thu Oct 22 16:43:08 2020 +0200

    yaml: regen
---
 .../camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json b/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json
index 3e90bc7..cdc91e0 100644
--- a/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json
+++ b/camel-k-loader-yaml/camel-k-loader-yaml/src/generated/resources/camel-yaml-dsl.json
@@ -2885,6 +2885,9 @@
       "org.apache.camel.k.loader.yaml.parser.RouteStepParser$Definition" : {
         "type" : "object",
         "properties" : {
+          "auto-startup" : {
+            "type" : "boolean"
+          },
           "from" : {
             "$ref" : "#/items/definitions/org.apache.camel.k.loader.yaml.parser.RouteStepParser$From"
           },