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 2020/03/05 17:45:50 UTC

[camel] branch master updated: Fixed test

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7f56e934 Fixed test
7f56e934 is described below

commit 7f56e934cf4616d09647877592792aaf0273fd0f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 5 18:45:17 2020 +0100

    Fixed test
---
 .../rest/swagger/RestSwaggerDelegateHttpsTest.java      | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerDelegateHttpsTest.java b/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerDelegateHttpsTest.java
index 44da41b..a9cd380 100644
--- a/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerDelegateHttpsTest.java
+++ b/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerDelegateHttpsTest.java
@@ -18,9 +18,8 @@ package org.apache.camel.component.rest.swagger;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
-import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.spi.BeanIntrospection;
+import org.apache.camel.support.PropertyBindingSupport;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
@@ -31,11 +30,19 @@ public class RestSwaggerDelegateHttpsTest extends HttpsTest {
     protected CamelContext createCamelContext() throws Exception {
         final CamelContext camelContext = super.createCamelContext();
 
+        // since camel context is not started, then we need to manually initialize the delegate
         final Component delegate = ((DefaultCamelContext) camelContext).getComponentResolver()
-            .resolveComponent(componentName, camelContext);
+                .resolveComponent(componentName, camelContext);
+        delegate.setCamelContext(camelContext);
+        delegate.init();
 
-        BeanIntrospection beanIntrospection = camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection();
-        beanIntrospection.setProperty(camelContext, delegate, "sslContextParameters", createHttpsParameters(camelContext));
+        // and configure the ssl context parameters via binding
+        new PropertyBindingSupport.Builder()
+                .withCamelContext(camelContext)
+                .withProperty("sslContextParameters", createHttpsParameters(camelContext))
+                .withTarget(delegate)
+                .withConfigurer(delegate.getComponentPropertyConfigurer())
+                .bind();
         camelContext.addComponent(componentName, delegate);
 
         return camelContext;