You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/03/01 14:10:46 UTC
[camel] 03/14: CAMEL-17684 - Support ability to load properties from Vault/Secrets cloud services - GCP Secrets Manager
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 acd6847892b454bbcfe844e58a0bcec5378daa44
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 1 13:18:49 2022 +0100
CAMEL-17684 - Support ability to load properties from Vault/Secrets cloud services - GCP Secrets Manager
---
.../java/org/apache/camel/main/MainVaultTest.java | 48 +++++++++++++++++++++-
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java b/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java
index effe4c2..7553d18 100644
--- a/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java
+++ b/core/camel-main/src/test/java/org/apache/camel/main/MainVaultTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.main;
import org.apache.camel.CamelContext;
import org.apache.camel.vault.AwsVaultConfiguration;
+import org.apache.camel.vault.GcpVaultConfiguration;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -26,7 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
public class MainVaultTest {
@Test
- public void testMain() throws Exception {
+ public void testMainAws() throws Exception {
Main main = new Main();
main.addInitialProperty("camel.vault.aws.accessKey", "myKey");
@@ -51,7 +52,7 @@ public class MainVaultTest {
}
@Test
- public void testMainFluent() throws Exception {
+ public void testMainAwsFluent() throws Exception {
Main main = new Main();
main.configure().vault().aws()
.withAccessKey("myKey")
@@ -76,4 +77,47 @@ public class MainVaultTest {
main.stop();
}
+ @Test
+ public void testMainGcp() throws Exception {
+ Main main = new Main();
+
+ main.addInitialProperty("camel.vault.aws.serviceAccountKey", "file:////myKey");
+ main.addInitialProperty("camel.vault.aws.processId", "gcp-project");
+
+ main.start();
+
+ CamelContext context = main.getCamelContext();
+ assertNotNull(context);
+
+ GcpVaultConfiguration cfg = context.getVaultConfiguration().gcp();
+ assertNotNull(cfg);
+
+ Assertions.assertEquals("file:////myKey", cfg.getServiceAccountKey());
+ Assertions.assertEquals("gcp-project", cfg.getProjectId());
+
+ main.stop();
+ }
+
+ @Test
+ public void testMainGcpFluent() throws Exception {
+ Main main = new Main();
+ main.configure().vault().gcp()
+ .withServiceAccountKey("file:////myKey")
+ .withProjectId("gcp-project")
+ .end();
+
+ main.start();
+
+ CamelContext context = main.getCamelContext();
+ assertNotNull(context);
+
+ GcpVaultConfiguration cfg = context.getVaultConfiguration().gcp();
+ assertNotNull(cfg);
+
+ Assertions.assertEquals("file:////myKey", cfg.getServiceAccountKey());
+ Assertions.assertEquals("gcp-project", cfg.getProjectId());
+
+ main.stop();
+ }
+
}