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/04/04 12:17:08 UTC

[camel-spring-boot] 03/04: CAMEL-17686 - Support ability to load properties from Vault/Secrets cloud services - Azure Key Vault

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-spring-boot.git

commit 62e670151a8724ccd2ca7dad5dd236a42349f39a
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Apr 4 12:58:17 2022 +0200

    CAMEL-17686 - Support ability to load properties from Vault/Secrets cloud services - Azure Key Vault
---
 .../boot/vault/AzureVaultAutoConfiguration.java    |  1 -
 .../boot/vault/AzureVaultConfigurationTest.java    | 52 ++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultAutoConfiguration.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultAutoConfiguration.java
index 228a098890d..e9cc0396db2 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultAutoConfiguration.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/vault/AzureVaultAutoConfiguration.java
@@ -17,7 +17,6 @@
 package org.apache.camel.spring.boot.vault;
 
 import org.apache.camel.spring.boot.CamelAutoConfiguration;
-import org.apache.camel.vault.AwsVaultConfiguration;
 import org.apache.camel.vault.AzureVaultConfiguration;
 import org.springframework.boot.autoconfigure.AutoConfigureAfter;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
diff --git a/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationTest.java b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationTest.java
new file mode 100644
index 00000000000..d5834431d04
--- /dev/null
+++ b/core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/vault/AzureVaultConfigurationTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.vault;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.spring.junit5.CamelSpringBootTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+
+@DirtiesContext
+@CamelSpringBootTest
+@EnableAutoConfiguration
+@SpringBootTest(
+        classes = {
+                AzureVaultConfigurationTest.class},
+        properties = {
+                "camel.vault.azure.vaultName=myVault",
+                "camel.vault.azure.clientId=myClientId",
+                "camel.vault.azure.clientSecret=myClientSecret",
+                "camel.vault.azure.tenantId=myTenantId"}
+)
+public class AzureVaultConfigurationTest {
+
+    @Autowired
+    private CamelContext camelContext;
+
+    @Test
+    public void testAzureVault() throws Exception {
+        Assertions.assertEquals("myVault", camelContext.getVaultConfiguration().azure().getVaultName());
+        Assertions.assertEquals("myClientSecret", camelContext.getVaultConfiguration().azure().getClientSecret());
+        Assertions.assertEquals("myClientId", camelContext.getVaultConfiguration().azure().getClientId());
+        Assertions.assertEquals("myTenantId", camelContext.getVaultConfiguration().azure().getTenantId());
+    }
+}