You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/03/02 09:36:05 UTC

[camel] 02/03: CAMEL-16241: Added unit test

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 4ca6675762717af2bad85006dc95b74ad555bd2a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 2 10:16:50 2021 +0100

    CAMEL-16241: Added unit test
---
 .../apache/camel/builder/endpoint/HttpsBasicAuthTest.java   | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/HttpsBasicAuthTest.java b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/HttpsBasicAuthTest.java
index 1677e08..7ec754a 100644
--- a/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/HttpsBasicAuthTest.java
+++ b/core/camel-endpointdsl/src/test/java/org/apache/camel/builder/endpoint/HttpsBasicAuthTest.java
@@ -22,6 +22,8 @@ import org.apache.camel.builder.endpoint.dsl.HttpEndpointBuilderFactory;
 import org.apache.camel.component.http.HttpEndpoint;
 import org.junit.jupiter.api.Test;
 
+import java.util.Properties;
+
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
@@ -34,6 +36,11 @@ public class HttpsBasicAuthTest extends ContextTestSupport {
 
     @Test
     public void testHttps() throws Exception {
+        Properties props = new Properties();
+        props.put("prop.username", "scott");
+        props.put("prop.password", "tiger");
+        context.getPropertiesComponent().setInitialProperties(props);
+
         context.start();
 
         context.addRoutes(new EndpointRouteBuilder() {
@@ -41,13 +48,13 @@ public class HttpsBasicAuthTest extends ContextTestSupport {
             public void configure() throws Exception {
                 HttpEndpointBuilderFactory.HttpEndpointBuilder builder
                         = https("inline").authenticationPreemptive(true).authMethod("Basic")
-                        .authUsername("prop.username").authPassword("prop.password");
+                        .authUsername("{{prop.username}}").authPassword("{{prop.password}}");
 
                 Endpoint endpoint = builder.resolve(context);
                 assertNotNull(endpoint);
                 HttpEndpoint he = assertIsInstanceOf(HttpEndpoint.class, endpoint);
-                assertEquals("prop.username", he.getAuthUsername());
-                assertEquals("prop.password", he.getAuthPassword());
+                assertEquals("scott", he.getAuthUsername());
+                assertEquals("tiger", he.getAuthPassword());
             }
         });