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

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1ccc094dae2c414237bbd230b3001efc16ba6ed1
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Mon Sep 9 14:46:45 2024 +0200

    CAMEL-21179 - Secret Properties Functions: Supporting secret name 
containing "/" - Hashicorp Vault
    
    Signed-off-by: Andrea Cosentino <anco...@gmail.com>
---
 .../src/main/docs/hashicorp-vault-component.adoc    |  8 ++++----
 .../HashicorpVaultPropertiesSourceNoEnvTestIT.java  | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git 
a/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc 
b/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
index 6d4eb0ee59e..4a26193777f 100644
--- 
a/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
+++ 
b/components/camel-hashicorp-vault/src/main/docs/hashicorp-vault-component.adoc
@@ -123,7 +123,7 @@ You're able to do get single secret value in your route, in 
the 'secret' engine,
 <camelContext>
     <route>
         <from uri="direct:start"/>
-        <log message="Username is {{hashicorp:secret:database/username}}"/>
+        <log message="Username is {{hashicorp:secret:database#username}}"/>
     </route>
 </camelContext>
 ----
@@ -137,7 +137,7 @@ You could specify a default value in case the particular 
field of secret is not
 <camelContext>
     <route>
         <from uri="direct:start"/>
-        <log message="Username is 
{{hashicorp:secret:database/username:admin}}"/>
+        <log message="Username is 
{{hashicorp:secret:database#username:admin}}"/>
     </route>
 </camelContext>
 ----
@@ -175,7 +175,7 @@ This approach will return the route secret value with 
version '2' or default val
 <camelContext>
     <route>
         <from uri="direct:start"/>
-        <log message="Username is 
{{hashicorp:secret:database/username:admin@2}}"/>
+        <log message="Username is 
{{hashicorp:secret:database#username:admin@2}}"/>
     </route>
 </camelContext>
 ----
@@ -184,4 +184,4 @@ This approach will return the username field of the 
database secret with version
 
 The only requirement is adding the camel-hashicorp-vault jar to your Camel 
application.
 
-include::spring-boot:partial$starter.adoc[]
\ No newline at end of file
+include::spring-boot:partial$starter.adoc[]
diff --git 
a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceNoEnvTestIT.java
 
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceNoEnvTestIT.java
index b1b1ae289f6..246c172491b 100644
--- 
a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceNoEnvTestIT.java
+++ 
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceNoEnvTestIT.java
@@ -555,4 +555,25 @@ public class HashicorpVaultPropertiesSourceNoEnvTestIT 
extends CamelTestSupport
         template.sendBody("direct:engine2", "Hello World");
         MockEndpoint.assertIsSatisfied(context);
     }
+
+    @Test
+    public void testPropertiesWithVersionFieldAndDefaultValueWithVersion() 
throws Exception {
+        
context.getVaultConfiguration().hashicorp().setToken(System.getProperty("camel.vault.hashicorp.token"));
+        
context.getVaultConfiguration().hashicorp().setHost(System.getProperty("camel.vault.hashicorp.host"));
+        
context.getVaultConfiguration().hashicorp().setPort(System.getProperty("camel.vault.hashicorp.port"));
+        
context.getVaultConfiguration().hashicorp().setScheme(System.getProperty("camel.vault.hashicorp.scheme"));
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                
from("direct:version").setBody(simple("{{hashicorp:secret:production/secrets/hello@1}}"))
+                        .to("mock:bar");
+            }
+        });
+        context.start();
+
+        getMockEndpoint("mock:bar").expectedBodiesReceived("{id=21}");
+
+        template.sendBody("direct:version", "Hello World");
+        MockEndpoint.assertIsSatisfied(context);
+    }
 }

Reply via email to