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 aec9a691683cd0413380752f6c1a9640b3ee9ab1
Author: Andrea Cosentino <[email protected]>
AuthorDate: Mon Feb 14 14:43:12 2022 +0100

    CAMEL-17644 - Support ability to load properties from Vault/Secrets cloud 
services - AWS Secrets Manager
---
 ...PropertiesComponentAWSSecretsManagerTestIT.java | 73 ++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentAWSSecretsManagerTestIT.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentAWSSecretsManagerTestIT.java
new file mode 100644
index 0000000..f1bc020
--- /dev/null
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentAWSSecretsManagerTestIT.java
@@ -0,0 +1,73 @@
+/*
+ * 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.component.properties;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+@EnabledIfEnvironmentVariable(named = "AWS_ACCESS_KEY", matches = ".*")
+@EnabledIfEnvironmentVariable(named = "AWS_SECRET_KEY", matches = ".*")
+@EnabledIfEnvironmentVariable(named = "AWS_REGION", matches = ".*")
+public class PropertiesComponentAWSSecretsManagerTestIT extends 
ContextTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testFunction() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                
from("direct:start").setBody(simple("{{aws:test}}")).to("mock:bar");
+            }
+        });
+        context.start();
+
+        getMockEndpoint("mock:bar").expectedBodiesReceived("hello");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testSecretNotFoundFunction() throws Exception {
+        Exception exception = assertThrows(FailedToCreateRouteException.class, 
() -> {
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() throws Exception {
+                    
from("direct:start").setBody(simple("{{aws:testExample}}")).to("mock:bar");
+                }
+            });
+            context.start();
+
+            getMockEndpoint("mock:bar").expectedBodiesReceived("hello");
+
+            template.sendBody("direct:start", "Hello World");
+
+            assertMockEndpointsSatisfied();
+        });
+    }
+
+}

Reply via email to