You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2019/06/28 15:46:51 UTC
[camel] branch camel-2.x updated: [CAMEL-13693]avoid
useOverridePropertiesWithPropertiesComponent being invoked twice when
running a unit-test with OSGI Blueprint XML.
This is an automated email from the ASF dual-hosted git repository.
ffang pushed a commit to branch camel-2.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.x by this push:
new 9deb209 [CAMEL-13693]avoid useOverridePropertiesWithPropertiesComponent being invoked twice when running a unit-test with OSGI Blueprint XML.
9deb209 is described below
commit 9deb209a68302403f468ac935e47efb1cfdc9dfc
Author: Freeman Fang <fr...@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.
(cherry picked from commit 728bbcbe7cf0b58db367072b08d0ff1444e24b10)
---
.../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 bd5726a..a92794a 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 203a8fb..6929b92 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
@@ -104,6 +104,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;
@@ -365,7 +366,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);
}