This is an automated email from the ASF dual-hosted git repository. ffang 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 728bbcb [CAMEL-13693]avoid useOverridePropertiesWithPropertiesComponent being invoked twice when running a unit-test with OSGI Blueprint XML. 728bbcb is described below commit 728bbcbe7cf0b58db367072b08d0ff1444e24b10 Author: Freeman Fang <freeman.f...@gmail.com> AuthorDate: Thu Jun 27 11:29:23 2019 -0400 [CAMEL-13693]avoid useOverridePropertiesWithPropertiesComponent being invoked twice when running a unit-test with OSGI Blueprint XML. --- .../org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java | 2 +- .../src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java index 522f5ee..3aa04cc 100644 --- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java +++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java @@ -130,7 +130,7 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport { boolean expectReload = expectBlueprintContainerReloadOnConfigAdminUpdate(); // must register override properties early in OSGi containers - Properties extra = useOverridePropertiesWithPropertiesComponent(); + extra = useOverridePropertiesWithPropertiesComponent(); if (extra != null) { answer.registerService(PropertiesComponent.OVERRIDE_PROPERTIES, extra, null); } diff --git a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java index 1b5fb54..c0fb4d7 100644 --- a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java +++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java @@ -112,6 +112,7 @@ public abstract class CamelTestSupport extends TestSupport { private static ThreadLocal<FluentProducerTemplate> threadFluentTemplate = new ThreadLocal<>(); private static ThreadLocal<ConsumerTemplate> threadConsumer = new ThreadLocal<>(); private static ThreadLocal<Service> threadService = new ThreadLocal<>(); + protected Properties extra; protected volatile ModelCamelContext context; protected volatile ProducerTemplate template; protected volatile FluentProducerTemplate fluentTemplate; @@ -418,7 +419,9 @@ public abstract class CamelTestSupport extends TestSupport { // configure properties component (mandatory for testing) PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class); - Properties extra = useOverridePropertiesWithPropertiesComponent(); + if (extra == null) { + extra = useOverridePropertiesWithPropertiesComponent(); + } if (extra != null && !extra.isEmpty()) { pc.setOverrideProperties(extra); }