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 5110518986baddac734562e9ad27dc4a1ce1657e Author: Andrea Cosentino <[email protected]> AuthorDate: Tue Feb 22 11:15:02 2022 +0100 CAMEL-17691 - Camel Google Secret Manager: Add more operations --- .../manager/integration/GoogleSecretManagerIT.java | 2 +- .../unit/GoogleSecretManagerConfigurationTest.java | 31 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerIT.java b/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerIT.java index ab6b240..0530675 100644 --- a/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerIT.java +++ b/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/integration/GoogleSecretManagerIT.java @@ -52,7 +52,7 @@ public class GoogleSecretManagerIT extends CamelTestSupport { .to("mock:createSecret"); from("direct:getSecretVersion").to("google-secret-manager://" + project + "?serviceAccountKey=" - + serviceAccountKeyFile + "&operation=getSecretVersion") + + serviceAccountKeyFile + "&operation=getSecretVersion") .to("mock:getSecret"); } diff --git a/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/unit/GoogleSecretManagerConfigurationTest.java b/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/unit/GoogleSecretManagerConfigurationTest.java new file mode 100644 index 0000000..d57a2bc --- /dev/null +++ b/components/camel-google/camel-google-secrets-manager/src/test/java/org/apache/camel/component/google/secret/manager/unit/GoogleSecretManagerConfigurationTest.java @@ -0,0 +1,31 @@ +package org.apache.camel.component.google.secret.manager.unit; + +import org.apache.camel.component.google.secret.manager.GoogleSecretManagerComponent; +import org.apache.camel.component.google.secret.manager.GoogleSecretManagerEndpoint; +import org.apache.camel.component.google.secret.manager.GoogleSecretManagerOperations; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class GoogleSecretManagerConfigurationTest extends CamelTestSupport { + + @Test + public void createEndpointConfiguration() throws Exception { + final String serviceAccountKeyFile = "somefile.json"; + final String project = "project123"; + final GoogleSecretManagerOperations operation = GoogleSecretManagerOperations.createSecret; + final boolean pojoRequest = false; + + GoogleSecretManagerComponent component = context.getComponent("google-secret-manager", + GoogleSecretManagerComponent.class); + GoogleSecretManagerEndpoint endpoint = (GoogleSecretManagerEndpoint) component.createEndpoint(String.format( + "google-secret-manager://%s?serviceAccountKey=%s&operation=%s&pojoRequest=%s", + project, serviceAccountKeyFile, operation.name(), pojoRequest)); + + assertEquals(endpoint.getConfiguration().getServiceAccountKey(), serviceAccountKeyFile); + assertEquals(endpoint.getConfiguration().getProject(), project); + assertEquals(endpoint.getConfiguration().getOperation(), operation); + assertEquals(endpoint.getConfiguration().isPojoRequest(), pojoRequest); + } +}
