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
The following commit(s) were added to refs/heads/main by this push:
new 44be7d6a314 CAMEL-20775 - Added some tests for Hashicorp Vault and
multiple engines (#14201)
44be7d6a314 is described below
commit 44be7d6a314a49e0f5174df7322aaec0a5de3ddf
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue May 21 07:16:16 2024 +0200
CAMEL-20775 - Added some tests for Hashicorp Vault and multiple engines
(#14201)
Signed-off-by: Andrea Cosentino <[email protected]>
---
.../HashicorpVaultPropertiesSourceNoEnvTestIT.java | 25 ++++++++++++++++++++++
.../HashicorpVaultPropertiesSourceTestIT.java | 25 ++++++++++++++++++++++
2 files changed, 50 insertions(+)
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 6eead4ad217..5dbcd03426f 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
@@ -488,4 +488,29 @@ public class HashicorpVaultPropertiesSourceNoEnvTestIT
extends CamelTestSupport
template.sendBody("direct:version", "Hello World");
MockEndpoint.assertIsSatisfied(context);
}
+
+ @Test
+ public void testPropertiesWithDoubleEngines() 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:engine1").setBody(simple("{{hashicorp:secretengine1:hello}}"))
+ .to("mock:bar");
+
+
from("direct:engine2").setBody(simple("{{hashicorp:secretengine2:hello}}"))
+ .to("mock:bar");
+ }
+ });
+ context.start();
+
+ getMockEndpoint("mock:bar").expectedBodiesReceived("{id=21}",
"{id=22}");
+
+ template.sendBody("direct:engine1", "Hello World");
+ template.sendBody("direct:engine2", "Hello World");
+ MockEndpoint.assertIsSatisfied(context);
+ }
}
diff --git
a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceTestIT.java
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceTestIT.java
index 911e9269d3e..a85c929cd9d 100644
---
a/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceTestIT.java
+++
b/components/camel-hashicorp-vault/src/test/java/org/apache/camel/component/hashicorp/vault/integration/HashicorpVaultPropertiesSourceTestIT.java
@@ -456,4 +456,29 @@ public class HashicorpVaultPropertiesSourceTestIT extends
CamelTestSupport {
template.sendBody("direct:version", "Hello World");
MockEndpoint.assertIsSatisfied(context);
}
+
+ @EnabledIfEnvironmentVariable(named = "CAMEL_HASHICORP_VAULT_TOKEN",
matches = ".*")
+ @EnabledIfEnvironmentVariable(named = "CAMEL_HASHICORP_VAULT_HOST",
matches = ".*")
+ @EnabledIfEnvironmentVariable(named = "CAMEL_HASHICORP_VAULT_PORT",
matches = ".*")
+ @EnabledIfEnvironmentVariable(named = "CAMEL_HASHICORP_VAULT_SCHEME",
matches = ".*")
+ @Test
+ public void testPropertiesWithDoubleEngines() throws Exception {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() {
+
from("direct:engine1").setBody(simple("{{hashicorp:secretengine1:hello}}"))
+ .to("mock:bar");
+
+
from("direct:engine2").setBody(simple("{{hashicorp:secretengine2:hello}}"))
+ .to("mock:bar");
+ }
+ });
+ context.start();
+
+ getMockEndpoint("mock:bar").expectedBodiesReceived("{id=21}",
"{id=22}");
+
+ template.sendBody("direct:engine1", "Hello World");
+ template.sendBody("direct:engine2", "Hello World");
+ MockEndpoint.assertIsSatisfied(context);
+ }
}