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/06/19 15:15:11 UTC
[camel-k-runtime] branch master updated (cf7c5ef -> 38aa492)
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 cf7c5ef [maven-release-plugin] prepare for next development iteration
new 617b0e3 Regen
new 38aa492 Integration should fail when no secret is found #363
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/support/KubernetesPropertiesFunction.java | 8 +++++---
.../k/listener/PropertiesFunctionsConfigurerTest.java | 19 ++++++++++++++-----
.../org/apache/camel/component/knative/knative.json | 2 +-
3 files changed, 20 insertions(+), 9 deletions(-)
[camel-k-runtime] 01/02: 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 617b0e3f88029e649e8b300cd4edb58d6f4c24fe
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Fri Jun 19 16:33:32 2020 +0200
Regen
---
.../generated/resources/org/apache/camel/component/knative/knative.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/camel-knative/camel-knative/src/generated/resources/org/apache/camel/component/knative/knative.json b/camel-knative/camel-knative/src/generated/resources/org/apache/camel/component/knative/knative.json
index a0cd44d..58e7dd9 100644
--- a/camel-knative/camel-knative/src/generated/resources/org/apache/camel/component/knative/knative.json
+++ b/camel-knative/camel-knative/src/generated/resources/org/apache/camel/component/knative/knative.json
@@ -11,7 +11,7 @@
"supportLevel": "Preview",
"groupId": "org.apache.camel.k",
"artifactId": "camel-knative",
- "version": "1.3.0-SNAPSHOT",
+ "version": "1.3.1-SNAPSHOT",
"scheme": "knative",
"extendsScheme": "",
"syntax": "knative:type\/name",
[camel-k-runtime] 02/02: Integration should fail when no secret is
found #363
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 38aa4923c48ef47d2592a7ae4c5631e9cdb4010b
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Fri Jun 19 16:33:45 2020 +0200
Integration should fail when no secret is found #363
---
.../camel/k/support/KubernetesPropertiesFunction.java | 8 +++++---
.../k/listener/PropertiesFunctionsConfigurerTest.java | 19 ++++++++++++++-----
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/KubernetesPropertiesFunction.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/KubernetesPropertiesFunction.java
index 3c8443f..e66c5b1 100644
--- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/KubernetesPropertiesFunction.java
+++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/KubernetesPropertiesFunction.java
@@ -41,15 +41,17 @@ public class KubernetesPropertiesFunction implements PropertiesFunction {
@Override
public String apply(String remainder) {
+ final String defaultValue = StringHelper.after(remainder, ":");
+
if (this.root == null) {
- return remainder;
+ return defaultValue;
}
final String name = StringHelper.before(remainder, "/");
final String property = StringHelper.after(remainder, "/");
if (name == null || property == null) {
- return remainder;
+ return defaultValue;
}
Path file = this.root.resolve(name.toLowerCase()).resolve(property);
@@ -61,6 +63,6 @@ public class KubernetesPropertiesFunction implements PropertiesFunction {
}
}
- return remainder;
+ return defaultValue;
}
}
diff --git a/camel-k-runtime-core/src/test/java/org/apache/camel/k/listener/PropertiesFunctionsConfigurerTest.java b/camel-k-runtime-core/src/test/java/org/apache/camel/k/listener/PropertiesFunctionsConfigurerTest.java
index 0c59dc3..c66a38e 100644
--- a/camel-k-runtime-core/src/test/java/org/apache/camel/k/listener/PropertiesFunctionsConfigurerTest.java
+++ b/camel-k-runtime-core/src/test/java/org/apache/camel/k/listener/PropertiesFunctionsConfigurerTest.java
@@ -21,21 +21,30 @@ import org.apache.camel.k.Runtime;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
public class PropertiesFunctionsConfigurerTest {
@Test
- public void testConfigMapFunction() {
-
+ public void testKubernetesFunction() {
Runtime runtime = Runtime.on(new DefaultCamelContext());
runtime.setProperties("my.property", "{{secret:my-secret/my-property}}");
new PropertiesConfigurer().accept(runtime);
- assertThat(runtime.getCamelContext().resolvePropertyPlaceholders("{{secret:my-secret/my-property}}")).isEqualTo("my-secret-property");
- assertThat(runtime.getCamelContext().resolvePropertyPlaceholders("{{secret:none/my-property}}")).isEqualTo("none/my-property");
+ assertThat(runtime.getCamelContext().resolvePropertyPlaceholders("{{secret:my-secret/my-property}}"))
+ .isEqualTo("my-secret-property");
+ assertThat(runtime.getCamelContext().resolvePropertyPlaceholders("{{secret:none/my-property:my-default-secret}}"))
+ .isEqualTo("my-default-secret");
+ assertThatThrownBy(() -> runtime.getCamelContext().resolvePropertyPlaceholders("{{secret:none/my-property}}"))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("returned null value which is not allowed, from input");
assertThat(runtime.getCamelContext().resolvePropertyPlaceholders("{{configmap:my-cm/my-property}}")).isEqualTo("my-cm-property");
- assertThat(runtime.getCamelContext().resolvePropertyPlaceholders("{{configmap:none/my-property}}")).isEqualTo("none/my-property");
+ assertThat(runtime.getCamelContext().resolvePropertyPlaceholders("{{configmap:my-cm/my-property:my-default-cm}}"))
+ .isEqualTo("my-default-cm");
+ assertThatThrownBy(() -> runtime.getCamelContext().resolvePropertyPlaceholders("{{configmap:none/my-property}}"))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("returned null value which is not allowed, from input");
assertThat(runtime.getCamelContext().resolvePropertyPlaceholders("{{my.property}}")).isEqualTo("my-secret-property");
}