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 09:36:07 UTC
[camel] 02/02: 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
commit cbe39dbfc42f00ac177dfa416f4ee2cf1393a995
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 5 10:35:32 2020 +0100
Fixed test
---
.../rest/openapi/RestOpenApiDelegateHttpsTest.java | 15 +++++++++++----
.../rest/openapi/RestOpenApiDelegateHttpsV3Test.java | 17 ++++++++++++-----
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsTest.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsTest.java
index fcd5cc0d..da1e1e7 100644
--- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsTest.java
+++ b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsTest.java
@@ -18,9 +18,8 @@ package org.apache.camel.component.rest.openapi;
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 RestOpenApiDelegateHttpsTest 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);
+ 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;
diff --git a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsV3Test.java b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsV3Test.java
index 736c09c..d1bb09a 100644
--- a/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsV3Test.java
+++ b/components/camel-rest-openapi/src/test/java/org/apache/camel/component/rest/openapi/RestOpenApiDelegateHttpsV3Test.java
@@ -18,9 +18,8 @@ package org.apache.camel.component.rest.openapi;
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 RestOpenApiDelegateHttpsV3Test extends HttpsV3Test {
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;