This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch multi-engines-test in repository https://gitbox.apache.org/repos/asf/camel.git
commit d1f2100e2d179ac23232609657940e7b89afb1dd Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue May 21 07:05:48 2024 +0200 CAMEL-20775 - Added some tests for Hashicorp Vault and multiple engines Signed-off-by: Andrea Cosentino <anco...@gmail.com> --- .../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); + } }