You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gg...@apache.org on 2015/12/12 19:06:03 UTC

[1/2] camel git commit: [CAMEL-9313][CAMEL-9377] camel-test-blueprint supports initialization of configadmin configs

Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 2a66cb220 -> 2410bfa5b
  refs/heads/master a68c79d68 -> 13760a4a5


[CAMEL-9313][CAMEL-9377] camel-test-blueprint supports initialization of configadmin configs


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/13760a4a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/13760a4a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/13760a4a

Branch: refs/heads/master
Commit: 13760a4a5f1672d54997aa8ede30aefed951505a
Parents: a68c79d
Author: Grzegorz Grzybek <gr...@gmail.com>
Authored: Sat Dec 12 18:46:15 2015 +0100
Committer: Grzegorz Grzybek <gr...@gmail.com>
Committed: Sat Dec 12 18:46:15 2015 +0100

----------------------------------------------------------------------
 .../test/blueprint/CamelBlueprintHelper.java    | 113 ++++++++++++++++++-
 .../blueprint/CamelBlueprintTestSupport.java    |  58 ++++++----
 .../org/apache/camel/test/blueprint/Main.java   |  17 ++-
 ...minLoadConfigurationFileAndOverrideTest.java |  10 +-
 .../ConfigAdminLoadConfigurationFileTest.java   |   2 +-
 ...onfigAdminNoReloadDefaultPropertiesTest.java |  40 +++++++
 ...oadLoadConfigurationFileAndOverrideTest.java |  13 ++-
 ...dConfigurationFileDefaultPropertiesTest.java |  49 ++++++++
 ...gAdminNoReloadLoadConfigurationFileTest.java |   4 +-
 .../camel/test/blueprint/MainNoPidTest.java     |  46 ++++++++
 .../camel/test/blueprint/MainNoReloadTest.java  |  50 ++++++++
 .../blueprint/configadmin-loadfileoverride.xml  |   4 +-
 ...configadmin-no-reload-default-properties.xml |  50 ++++++++
 ...in-no-reload-loadfile-default-properties.xml |  50 ++++++++
 .../configadmin-no-reload-loadfileoverride.xml  |   4 +-
 .../test/blueprint/main-no-pid-loadfile.xml     |  47 ++++++++
 .../test/blueprint/main-no-reload-loadfile.xml  |  42 +++++++
 17 files changed, 550 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java
index 0dc3919..33e9097 100644
--- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java
+++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java
@@ -16,13 +16,17 @@
  */
 package org.apache.camel.test.blueprint;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.StringWriter;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -32,21 +36,25 @@ import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.jar.JarInputStream;
 
 import org.apache.camel.impl.DefaultClassResolver;
+import org.apache.camel.model.dataformat.Base64DataFormat;
 import org.apache.camel.spi.ClassResolver;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ResourceHelper;
 import org.apache.felix.connect.PojoServiceRegistryFactoryImpl;
+import org.apache.felix.connect.felix.framework.util.Util;
 import org.apache.felix.connect.launch.BundleDescriptor;
 import org.apache.felix.connect.launch.ClasspathScanner;
 import org.apache.felix.connect.launch.PojoServiceRegistry;
@@ -54,14 +62,20 @@ import org.apache.felix.connect.launch.PojoServiceRegistryFactory;
 import org.ops4j.pax.swissbox.tinybundles.core.TinyBundle;
 import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.SynchronousBundleListener;
 import org.osgi.service.blueprint.container.BlueprintEvent;
 import org.osgi.service.blueprint.container.BlueprintListener;
 import org.osgi.service.cm.Configuration;
@@ -97,12 +111,14 @@ public final class CamelBlueprintHelper {
     }
     
     public static BundleContext createBundleContext(String name, String descriptors, boolean includeTestBundle,
-                                                    String bundleFilter, String testBundleVersion, String testBundleDirectives) throws Exception {
+                                                    String bundleFilter, String testBundleVersion, String testBundleDirectives,
+                                                    String[] ... configAdminPidFiles) throws Exception {
         TinyBundle bundle = null;
 
         if (includeTestBundle) {
             // add ourselves as a bundle
-            bundle = createTestBundle(testBundleDirectives == null ? name : name + ';' + testBundleDirectives, testBundleVersion, descriptors);
+            bundle = createTestBundle(testBundleDirectives == null ? name : name + ';' + testBundleDirectives,
+                    testBundleVersion, descriptors, configAdminPidFiles);
         }
 
         return createBundleContext(name, bundleFilter, bundle);
@@ -120,14 +136,32 @@ public final class CamelBlueprintHelper {
         // fully deleted between tests
         createDirectory("target/test-bundles");
 
-        // get the bundles
-        List<BundleDescriptor> bundles = getBundleDescriptors(bundleFilter);
+        List<BundleDescriptor> bundles = new LinkedList<>();
 
         if (bundle != null) {
             String jarName = name.toLowerCase(Locale.ENGLISH) + "-" + uid + ".jar";
             bundles.add(getBundleDescriptor("target/test-bundles/" + jarName, bundle));
         }
 
+        List<BundleDescriptor> bundleDescriptors = getBundleDescriptors(bundleFilter);
+        // let's put configadmin before blueprint.core
+        int idx1=-1, idx2=-1;
+        for (int i = 0; i < bundleDescriptors.size(); i++) {
+            BundleDescriptor bd = bundleDescriptors.get(i);
+            if ("org.apache.felix.configadmin".equals(bd.getHeaders().get("Bundle-SymbolicName"))) {
+                idx1 = i;
+            }
+            if ("org.apache.aries.blueprint.core".equals(bd.getHeaders().get("Bundle-SymbolicName"))) {
+                idx2 = i;
+            }
+        }
+        if (idx1 >= 0 && idx2 >= 0 && idx1 > idx2) {
+            bundleDescriptors.add(idx2, bundleDescriptors.remove(idx1));
+        }
+
+        // get the bundles
+        bundles.addAll(bundleDescriptors);
+
         if (LOG.isDebugEnabled()) {
             for (int i = 0; i < bundles.size(); i++) {
                 BundleDescriptor desc = bundles.get(i);
@@ -298,16 +332,35 @@ public final class CamelBlueprintHelper {
         registration.unregister();
     }
 
-    protected static TinyBundle createTestBundle(String name, String version, String descriptors) throws FileNotFoundException, MalformedURLException {
+    protected static TinyBundle createTestBundle(String name, String version, String descriptors, String[] ... configAdminPidFiles) throws IOException {
         TinyBundle bundle = TinyBundles.newBundle();
         for (URL url : getBlueprintDescriptors(descriptors)) {
             LOG.info("Using Blueprint XML file: " + url.getFile());
             bundle.add("OSGI-INF/blueprint/blueprint-" + url.getFile().replace("/", "-"), url);
         }
+        StringWriter configAdminInit = null;
+        for (String[] configAdminPidFile : configAdminPidFiles) {
+            if (configAdminPidFile == null) {
+                continue;
+            }
+            if (configAdminInit == null) {
+                configAdminInit = new StringWriter();
+            } else {
+                configAdminInit.append(',');
+            }
+            configAdminInit.append(configAdminPidFile[1]).append("=");
+            configAdminInit.append(new File(configAdminPidFile[0]).toURI().toString());
+        }
+        bundle.add(TestBundleActivator.class);
+        bundle.add(Util.class);
         bundle.set("Manifest-Version", "2")
                 .set("Bundle-ManifestVersion", "2")
                 .set("Bundle-SymbolicName", name)
-                .set("Bundle-Version", version);
+                .set("Bundle-Version", version)
+                .set("Bundle-Activator", TestBundleActivator.class.getName());
+        if (configAdminInit != null) {
+            bundle.set("X-Camel-Blueprint-ConfigAdmin-Init", configAdminInit.toString());
+        }
         return bundle;
     }
 
@@ -444,4 +497,52 @@ public final class CamelBlueprintHelper {
         return answer;
     }
 
+    /**
+     * Bundle activator that will be invoked in right time to set initial configadmin configuration
+     * for blueprint container.
+     */
+    public static class TestBundleActivator implements BundleActivator {
+        @Override
+        public void start(BundleContext bundleContext) throws Exception {
+            final String configAdminInit = bundleContext.getBundle().getHeaders().get("X-Camel-Blueprint-ConfigAdmin-Init");
+            if (configAdminInit != null) {
+                final BundleContext sysContext = bundleContext.getBundle(0).getBundleContext();
+                // we are started before blueprint.core and felix.configadmin
+                // we are sure that felix.configadmin is started before blueprint.core
+                sysContext.addBundleListener(new SynchronousBundleListener() {
+                    @Override
+                    public void bundleChanged(BundleEvent event) {
+                        if (event.getType() == BundleEvent.STARTED
+                                && "org.apache.felix.configadmin".equals(event.getBundle().getSymbolicName())) {
+                            // configadmin should have already been started
+                            ServiceReference<?> sr = sysContext.getServiceReference("org.osgi.service.cm.ConfigurationAdmin");
+                            if (sr != null && sysContext.getService(sr) != null) {
+                                initializeConfigAdmin(sysContext, configAdminInit);
+                            }
+                        }
+                    }
+                });
+            }
+        }
+
+        private void initializeConfigAdmin(BundleContext context, String configAdminInit) {
+            String[] pidFiles = configAdminInit.split(",");
+            for (String pidFile : pidFiles) {
+                String[] pf = pidFile.split("=");
+                try {
+                    CamelBlueprintHelper.setPersistentFileForConfigAdmin(context, pf[0], new URI(pf[1]).getPath(),
+                            new Properties(), null, null, false);
+                } catch (IOException | URISyntaxException e) {
+                    throw new RuntimeException(e.getMessage(), e);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                    throw new RuntimeException(e.getMessage(), e);
+                }
+            }
+        }
+
+        @Override
+        public void stop(BundleContext bundleContext) throws Exception {
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
----------------------------------------------------------------------
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 79563c2..642ee14 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
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.net.URL;
 import java.util.Arrays;
 import java.util.Dictionary;
+import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
@@ -93,9 +94,20 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
     protected BundleContext createBundleContext() throws Exception {
         System.setProperty("org.apache.aries.blueprint.synchronous", Boolean.toString(!useAsynchronousBlueprintStartup()));
 
+        // load configuration file
+        String[] file = loadConfigAdminConfigurationFile();
+        if (file != null) {
+            if (file.length != 2) {
+                throw new IllegalArgumentException("The returned String[] from loadConfigAdminConfigurationFile must be of length 2, was " + file.length);
+            }
+            if (!new File(file[0]).exists()) {
+                throw new IllegalArgumentException("The provided file \"" + file[0] + "\" from loadConfigAdminConfigurationFile doesn't exist");
+            }
+        }
+
         final String symbolicName = getClass().getSimpleName();
         final BundleContext answer = CamelBlueprintHelper.createBundleContext(symbolicName, getBlueprintDescriptor(),
-            includeTestBundle(), getBundleFilter(), getBundleVersion(), getBundleDirectives());
+            includeTestBundle(), getBundleFilter(), getBundleVersion(), getBundleDirectives(), file);
 
         boolean expectReload = expectBlueprintContainerReloadOnConfigAdminUpdate();
 
@@ -126,15 +138,6 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
             }
         }
 
-        // must reuse props as we can do both load from .cfg file and override afterwards
-        final Dictionary props = new Properties();
-
-        // load configuration file
-        String[] file = loadConfigAdminConfigurationFile();
-        if (file != null && file.length != 2) {
-            throw new IllegalArgumentException("The returned String[] from loadConfigAdminConfigurationFile must be of length 2, was " + file.length);
-        }
-
         // if blueprint XML uses <cm:property-placeholder> (any update-strategy and any default properties)
         // - org.apache.aries.blueprint.compendium.cm.ManagedObjectManager.register() is called
         // - ManagedServiceUpdate is scheduled in felix.cm
@@ -153,12 +156,8 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
 
         CamelBlueprintHelper.waitForBlueprintContainer(bpEvents, answer, symbolicName, BlueprintEvent.CREATED, null);
 
-        if (file != null) {
-            if (!new File(file[0]).exists()) {
-                throw new IllegalArgumentException("The provided file \"" + file[0] + "\" from loadConfigAdminConfigurationFile doesn't exist");
-            }
-            CamelBlueprintHelper.setPersistentFileForConfigAdmin(answer, file[1], file[0], props, symbolicName, bpEvents, expectReload);
-        }
+        // must reuse props as we can do both load from .cfg file and override afterwards
+        final Dictionary props = new Properties();
 
         // allow end user to override properties
         String pid = useOverridePropertiesWithConfigAdmin(props);
@@ -172,20 +171,34 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
             if (config == null) {
                 throw new IllegalArgumentException("Cannot find configuration with pid " + pid + " in OSGi ConfigurationAdmin service.");
             }
-            log.info("Updating ConfigAdmin {} by overriding properties {}", config, props);
+            // lets merge configurations
+            Dictionary<String, Object> currentProperties = config.getProperties();
+            final Dictionary newProps = new Properties();
+            if (currentProperties == null) {
+                currentProperties = newProps;
+            }
+            for (Enumeration<String> ek = currentProperties.keys(); ek.hasMoreElements(); ) {
+                String k = ek.nextElement();
+                newProps.put(k, currentProperties.get(k));
+            }
+            for (String p : ((Properties) props).stringPropertyNames()) {
+                newProps.put(p, ((Properties) props).getProperty(p));
+            }
+
+            log.info("Updating ConfigAdmin {} by overriding properties {}", config, newProps);
             if (expectReload) {
                 CamelBlueprintHelper.waitForBlueprintContainer(bpEvents, answer, symbolicName, BlueprintEvent.CREATED, new Runnable() {
                     @Override
                     public void run() {
                         try {
-                            config.update(props);
+                            config.update(newProps);
                         } catch (IOException e) {
                             throw new RuntimeException(e.getMessage(), e);
                         }
                     }
                 });
             } else {
-                config.update(props);
+                config.update(newProps);
             }
         }
 
@@ -309,7 +322,9 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
     }
 
     /**
-     * Override this method to override config admin properties.
+     * Override this method to override config admin properties. Overriden properties will be passed to
+     * {@link Configuration#update(Dictionary)} and may or may not lead to reload of Blueprint container - this
+     * depends on <code>update-strategy="reload|none"</code> in <code>&lt;cm:property-placeholder&gt;</code>
      *
      * @param props properties where you add the properties to override
      * @return the PID of the OSGi {@link ConfigurationAdmin} which are defined in the Blueprint XML file.
@@ -320,7 +335,8 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
 
     /**
      * Override this method and provide the name of the .cfg configuration file to use for
-     * Blueprint ConfigAdmin service.
+     * ConfigAdmin service. Provided file will be used to initialize ConfigAdmin configuration before Blueprint
+     * container is loaded.
      *
      * @return the name of the path for the .cfg file to load, and the persistence-id of the property placeholder.
      */

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
index 3092d2e..0812467 100644
--- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
+++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
@@ -20,7 +20,6 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 
 import org.apache.camel.CamelContext;
@@ -99,11 +98,16 @@ public class Main extends MainSupport {
                 throw new IllegalArgumentException("Descriptors must be provided, with the name of the blueprint XML file");
             }
             LOG.debug("Starting Blueprint XML file: " + descriptors);
-            bundleContext = createBundleContext(bundleName);
+            if (configAdminPid != null && configAdminFileName != null) {
+                // pid/file is used to set INITIAL content of ConfigAdmin to be used when blueprint container is started
+                bundleContext = createBundleContext(bundleName, new String[] { configAdminFileName, configAdminPid });
+            } else {
+                bundleContext = createBundleContext(bundleName);
+            }
             Set<Long> eventHistory = new HashSet<>();
+
             CamelBlueprintHelper.waitForBlueprintContainer(eventHistory, bundleContext, bundleName, BlueprintEvent.CREATED, null);
-            CamelBlueprintHelper.setPersistentFileForConfigAdmin(bundleContext, configAdminPid, configAdminFileName, new Properties(),
-                                                                 bundleName, eventHistory, true);
+
             camelContext = CamelBlueprintHelper.getOsgiService(bundleContext, CamelContext.class);
             if (camelContext == null) {
                 throw new IllegalArgumentException("Cannot find CamelContext in blueprint XML file: " + descriptors);
@@ -137,8 +141,9 @@ public class Main extends MainSupport {
         return createBundleContext(getClass().getSimpleName());
     }
 
-    protected BundleContext createBundleContext(String name) throws Exception {
-        return CamelBlueprintHelper.createBundleContext(name, descriptors, isIncludeSelfAsBundle());
+    protected BundleContext createBundleContext(String name, String[] ... configAdminPidFiles) throws Exception {
+        return CamelBlueprintHelper.createBundleContext(name, descriptors, isIncludeSelfAsBundle(),
+                CamelBlueprintHelper.BUNDLE_FILTER, CamelBlueprintHelper.BUNDLE_VERSION, null, configAdminPidFiles);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java
index 56d45e6..18bdd36 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java
@@ -22,8 +22,8 @@ import org.junit.Test;
 
 // START SNIPPET: e1
 /**
- * This example will load a Blueprint .cfdg file, and also override its property placeholders from this unit test
- * source code directly.
+ * This example will load a Blueprint .cfg file (which will initialize configadmin), and also override its property
+ * placeholders from this unit test source code directly (the change will reload blueprint container).
  */
 public class ConfigAdminLoadConfigurationFileAndOverrideTest extends CamelBlueprintTestSupport {
 
@@ -50,7 +50,11 @@ public class ConfigAdminLoadConfigurationFileAndOverrideTest extends CamelBluepr
 
     @Test
     public void testConfigAdmin() throws Exception {
-        // regular unit test method
+        // mock:original comes from <cm:default-properties>/<cm:property name="destination" value="mock:original" />
+        getMockEndpoint("mock:original").setExpectedMessageCount(0);
+        // mock:result comes from loadConfigAdminConfigurationFile()
+        getMockEndpoint("mock:result").setExpectedMessageCount(0);
+        // mock:extra comes from useOverridePropertiesWithConfigAdmin()
         getMockEndpoint("mock:extra").expectedBodiesReceived("Bye World", "Yay Bye WorldYay Bye World");
 
         template.sendBody("direct:start", "World");

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java
index 7c97f9f..398cbed 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.test.blueprint;
 import org.junit.Test;
 
 /**
- *
+ * Same as {@link ConfigAdminNoReloadLoadConfigurationFileTest} except this time Blueprint container will reloaded
  */
 public class ConfigAdminLoadConfigurationFileTest extends CamelBlueprintTestSupport {
 

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadDefaultPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadDefaultPropertiesTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadDefaultPropertiesTest.java
new file mode 100644
index 0000000..6716b6c
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadDefaultPropertiesTest.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ConfigAdminNoReloadDefaultPropertiesTest extends CamelBlueprintTestSupport {
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml";
+    }
+
+    @Test
+    public void testConfigAdmin() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Good morning World");
+
+        template.sendBody("direct:start", "World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java
index 9f7faaa..292200e 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java
@@ -21,11 +21,9 @@ import java.util.Dictionary;
 import org.junit.Test;
 
 // START SNIPPET: e1
-
 /**
- * This example will load a Blueprint .cfg file, and also override its property placeholders from this unit test
- * source code directly.
- * But having <code>update-strategy="none"</code> means that BP container won't be reloaded
+ * This example will load a Blueprint .cfg file (which will initialize configadmin), and also override its property
+ * placeholders from this unit test source code directly (the change won't reload blueprint container).
  */
 public class ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest extends CamelBlueprintTestSupport {
 
@@ -52,8 +50,11 @@ public class ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest extends Cam
 
     @Test
     public void testConfigAdmin() throws Exception {
-        // regular unit test method
-        getMockEndpoint("mock:original").expectedBodiesReceived("Hello World", "Hey Hello WorldHey Hello World");
+        // mock:original comes from <cm:default-properties>/<cm:property name="destination" value="mock:original" />
+        getMockEndpoint("mock:original").setExpectedMessageCount(0);
+        // mock:result comes from loadConfigAdminConfigurationFile()
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World", "Yay Bye WorldYay Bye World");
+        // mock:extra comes from useOverridePropertiesWithConfigAdmin(), but BP container isn't reloaded
         getMockEndpoint("mock:extra").setExpectedMessageCount(0);
 
         template.sendBody("direct:start", "World");

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest.java
new file mode 100644
index 0000000..9fa7e73
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+import org.junit.Test;
+
+/**
+ * {@link #loadConfigAdminConfigurationFile()} will override properties set by <code>&lt;cm:default-properties&gt;</code>
+ */
+public class ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest extends CamelBlueprintTestSupport {
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml";
+    }
+
+    // START SNIPPET: e1
+    @Override
+    protected String[] loadConfigAdminConfigurationFile() {
+        // String[0] = tell Camel the path of the .cfg file to use for OSGi ConfigAdmin in the blueprint XML file
+        // String[1] = tell Camel the persistence-id of the cm:property-placeholder in the blueprint XML file
+        return new String[]{"src/test/resources/etc/stuff.cfg", "stuff"};
+    }
+    // END SNIPPET: e1
+
+    @Test
+    public void testConfigAdmin() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+        template.sendBody("direct:start", "World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java
index 2196c93..b843e89 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java
@@ -39,9 +39,7 @@ public class ConfigAdminNoReloadLoadConfigurationFileTest extends CamelBlueprint
 
     @Test
     public void testConfigAdmin() throws Exception {
-        // Even if we update config admin configuration, update-strategy="none" won't cause reload of BP
-        // container and reinjection of bean properties
-        getMockEndpoint("mock:result").expectedBodiesReceived("${greeting} World");
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
 
         template.sendBody("direct:start", "World");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoPidTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoPidTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoPidTest.java
new file mode 100644
index 0000000..6dd37c9
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoPidTest.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+
+import org.apache.camel.ProducerTemplate;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class MainNoPidTest {
+
+    @Test
+    public void testMyMain() throws Exception {
+        Main main = new Main();
+        main.setBundleName("MyMainBundle");
+        // as we run this test without packing ourselves as bundle, then include ourselves
+        main.setIncludeSelfAsBundle(true);
+        // setup the blueprint file here
+        main.setDescriptors("org/apache/camel/test/blueprint/main-no-pid-loadfile.xml");
+        main.start();
+
+        ProducerTemplate template = main.getCamelTemplate();
+        assertNotNull("We should get the template here", template);
+
+        String result = template.requestBody("direct:start", "hello", String.class);
+        assertEquals("Get a wrong response", "Good morning hello", result);
+        main.stop();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoReloadTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoReloadTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoReloadTest.java
new file mode 100644
index 0000000..c017587
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoReloadTest.java
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+
+import org.apache.camel.ProducerTemplate;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class MainNoReloadTest {
+
+    @Test
+    public void testMyMain() throws Exception {
+        Main main = new Main();
+        main.setBundleName("MyMainBundle");
+        // as we run this test without packing ourselves as bundle, then include ourselves
+        main.setIncludeSelfAsBundle(true);
+        // setup the blueprint file here
+        main.setDescriptors("org/apache/camel/test/blueprint/main-no-reload-loadfile.xml");
+        // set the configAdmin persistent id
+        main.setConfigAdminPid("stuff");
+        // set the configAdmin persistent file name
+        main.setConfigAdminFileName("src/test/resources/etc/stuff.cfg");
+        main.start();
+
+        ProducerTemplate template = main.getCamelTemplate();
+        assertNotNull("We should get the template here", template);
+
+        String result = template.requestBody("direct:start", "hello", String.class);
+        assertEquals("Get a wrong response", "Bye hello", result);
+        main.stop();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml
index c9e45d3..12cac3e 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml
@@ -26,7 +26,9 @@
   <!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file -->
   <cm:property-placeholder persistent-id="stuff" update-strategy="reload">
     <cm:default-properties>
-      <cm:property name="destination" value="to-be-replaced" />
+      <cm:property name="greeting" value="Hello" />
+      <cm:property name="echo" value="Hey" />
+      <cm:property name="destination" value="mock:original" />
     </cm:default-properties>
   </cm:property-placeholder>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml
new file mode 100644
index 0000000..1c0011e
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xsi:schemaLocation="
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- START SNIPPET: e1 -->
+  <!-- blueprint property placeholders, PID="stuff" is empty during placeholder initialization
+   but we have <cm:default-properties> -->
+  <cm:property-placeholder persistent-id="stuff" update-strategy="none">
+    <cm:default-properties>
+      <cm:property name="greeting" value="Good morning" />
+    </cm:default-properties>
+  </cm:property-placeholder>
+
+  <!-- a bean that uses a blueprint property placeholder -->
+  <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
+    <property name="say" value="${greeting}"/>
+  </bean>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+    <route>
+      <from uri="direct:start"/>
+      <bean ref="myCoolBean" method="saySomething"/>
+      <to uri="mock:result"/>
+    </route>
+
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml
new file mode 100644
index 0000000..a7f54c1
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xsi:schemaLocation="
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- START SNIPPET: e1 -->
+  <!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file
+   overriding <cm:default-properties> -->
+  <cm:property-placeholder persistent-id="stuff" update-strategy="none">
+    <cm:default-properties>
+      <cm:property name="greeting" value="Good morning" />
+    </cm:default-properties>
+  </cm:property-placeholder>
+
+  <!-- a bean that uses a blueprint property placeholder -->
+  <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
+    <property name="say" value="${greeting}"/>
+  </bean>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+    <route>
+      <from uri="direct:start"/>
+      <bean ref="myCoolBean" method="saySomething"/>
+      <to uri="mock:result"/>
+    </route>
+
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml
index 1d5274d..6b7a12b 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml
@@ -26,7 +26,7 @@
   <!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file -->
   <cm:property-placeholder persistent-id="stuff" update-strategy="none">
     <cm:default-properties>
-      <cm:property name="say" value="Hello" />
+      <cm:property name="greeting" value="Hello" />
       <cm:property name="echo" value="Hey" />
       <cm:property name="destination" value="mock:original" />
     </cm:default-properties>
@@ -34,7 +34,7 @@
 
   <!-- a bean that uses a blueprint property placeholder -->
   <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
-    <property name="say" value="${say}"/>
+    <property name="say" value="${greeting}"/>
     <property name="echo" value="${echo}"/>
   </bean>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-pid-loadfile.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-pid-loadfile.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-pid-loadfile.xml
new file mode 100644
index 0000000..27e0248
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-pid-loadfile.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xsi:schemaLocation="
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- blueprint property placeholders which we can configure from outside -->
+  <cm:property-placeholder persistent-id="stuff" update-strategy="none">
+      <cm:default-properties>
+          <cm:property name="greeting" value="Good morning"/>
+          <cm:property name="destination" value="mock:result"/>
+      </cm:default-properties>
+  </cm:property-placeholder>
+
+  <!-- a bean that uses a blueprint property placeholder -->
+  <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
+    <property name="say" value="${greeting}"/>
+  </bean>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+     <route>
+      <from uri="direct:start"/>
+      <bean ref="myCoolBean" method="saySomething"/>
+      <to uri="{{destination}}"/>
+    </route>
+
+  </camelContext>
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/camel/blob/13760a4a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-reload-loadfile.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-reload-loadfile.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-reload-loadfile.xml
new file mode 100644
index 0000000..4902aa5
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-reload-loadfile.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xsi:schemaLocation="
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- blueprint property placeholders which we can configure from outside -->
+  <cm:property-placeholder persistent-id="stuff" update-strategy="none"/>
+
+  <!-- a bean that uses a blueprint property placeholder -->
+  <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
+    <property name="say" value="${greeting}"/>
+  </bean>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+     <route>
+      <from uri="direct:start"/>
+      <bean ref="myCoolBean" method="saySomething"/>
+      <to uri="{{destination}}"/>
+    </route>
+
+  </camelContext>
+
+</blueprint>


[2/2] camel git commit: [CAMEL-9313][CAMEL-9377] camel-test-blueprint supports initialization of configadmin configs

Posted by gg...@apache.org.
[CAMEL-9313][CAMEL-9377] camel-test-blueprint supports initialization of configadmin configs

(cherry picked from commit 13760a4a5f1672d54997aa8ede30aefed951505a)


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2410bfa5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2410bfa5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2410bfa5

Branch: refs/heads/camel-2.16.x
Commit: 2410bfa5b840fd6dd7de86b32fd3e0dee35061c9
Parents: 2a66cb2
Author: Grzegorz Grzybek <gr...@gmail.com>
Authored: Sat Dec 12 18:46:15 2015 +0100
Committer: Grzegorz Grzybek <gr...@gmail.com>
Committed: Sat Dec 12 18:53:34 2015 +0100

----------------------------------------------------------------------
 .../test/blueprint/CamelBlueprintHelper.java    | 113 ++++++++++++++++++-
 .../blueprint/CamelBlueprintTestSupport.java    |  58 ++++++----
 .../org/apache/camel/test/blueprint/Main.java   |  17 ++-
 ...minLoadConfigurationFileAndOverrideTest.java |  10 +-
 .../ConfigAdminLoadConfigurationFileTest.java   |   2 +-
 ...onfigAdminNoReloadDefaultPropertiesTest.java |  40 +++++++
 ...oadLoadConfigurationFileAndOverrideTest.java |  13 ++-
 ...dConfigurationFileDefaultPropertiesTest.java |  49 ++++++++
 ...gAdminNoReloadLoadConfigurationFileTest.java |   4 +-
 .../camel/test/blueprint/MainNoPidTest.java     |  46 ++++++++
 .../camel/test/blueprint/MainNoReloadTest.java  |  50 ++++++++
 .../blueprint/configadmin-loadfileoverride.xml  |   4 +-
 ...configadmin-no-reload-default-properties.xml |  50 ++++++++
 ...in-no-reload-loadfile-default-properties.xml |  50 ++++++++
 .../configadmin-no-reload-loadfileoverride.xml  |   4 +-
 .../test/blueprint/main-no-pid-loadfile.xml     |  47 ++++++++
 .../test/blueprint/main-no-reload-loadfile.xml  |  42 +++++++
 17 files changed, 550 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java
index 0dc3919..33e9097 100644
--- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java
+++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java
@@ -16,13 +16,17 @@
  */
 package org.apache.camel.test.blueprint;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.StringWriter;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -32,21 +36,25 @@ import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.jar.JarInputStream;
 
 import org.apache.camel.impl.DefaultClassResolver;
+import org.apache.camel.model.dataformat.Base64DataFormat;
 import org.apache.camel.spi.ClassResolver;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.ResourceHelper;
 import org.apache.felix.connect.PojoServiceRegistryFactoryImpl;
+import org.apache.felix.connect.felix.framework.util.Util;
 import org.apache.felix.connect.launch.BundleDescriptor;
 import org.apache.felix.connect.launch.ClasspathScanner;
 import org.apache.felix.connect.launch.PojoServiceRegistry;
@@ -54,14 +62,20 @@ import org.apache.felix.connect.launch.PojoServiceRegistryFactory;
 import org.ops4j.pax.swissbox.tinybundles.core.TinyBundle;
 import org.ops4j.pax.swissbox.tinybundles.core.TinyBundles;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.framework.SynchronousBundleListener;
 import org.osgi.service.blueprint.container.BlueprintEvent;
 import org.osgi.service.blueprint.container.BlueprintListener;
 import org.osgi.service.cm.Configuration;
@@ -97,12 +111,14 @@ public final class CamelBlueprintHelper {
     }
     
     public static BundleContext createBundleContext(String name, String descriptors, boolean includeTestBundle,
-                                                    String bundleFilter, String testBundleVersion, String testBundleDirectives) throws Exception {
+                                                    String bundleFilter, String testBundleVersion, String testBundleDirectives,
+                                                    String[] ... configAdminPidFiles) throws Exception {
         TinyBundle bundle = null;
 
         if (includeTestBundle) {
             // add ourselves as a bundle
-            bundle = createTestBundle(testBundleDirectives == null ? name : name + ';' + testBundleDirectives, testBundleVersion, descriptors);
+            bundle = createTestBundle(testBundleDirectives == null ? name : name + ';' + testBundleDirectives,
+                    testBundleVersion, descriptors, configAdminPidFiles);
         }
 
         return createBundleContext(name, bundleFilter, bundle);
@@ -120,14 +136,32 @@ public final class CamelBlueprintHelper {
         // fully deleted between tests
         createDirectory("target/test-bundles");
 
-        // get the bundles
-        List<BundleDescriptor> bundles = getBundleDescriptors(bundleFilter);
+        List<BundleDescriptor> bundles = new LinkedList<>();
 
         if (bundle != null) {
             String jarName = name.toLowerCase(Locale.ENGLISH) + "-" + uid + ".jar";
             bundles.add(getBundleDescriptor("target/test-bundles/" + jarName, bundle));
         }
 
+        List<BundleDescriptor> bundleDescriptors = getBundleDescriptors(bundleFilter);
+        // let's put configadmin before blueprint.core
+        int idx1=-1, idx2=-1;
+        for (int i = 0; i < bundleDescriptors.size(); i++) {
+            BundleDescriptor bd = bundleDescriptors.get(i);
+            if ("org.apache.felix.configadmin".equals(bd.getHeaders().get("Bundle-SymbolicName"))) {
+                idx1 = i;
+            }
+            if ("org.apache.aries.blueprint.core".equals(bd.getHeaders().get("Bundle-SymbolicName"))) {
+                idx2 = i;
+            }
+        }
+        if (idx1 >= 0 && idx2 >= 0 && idx1 > idx2) {
+            bundleDescriptors.add(idx2, bundleDescriptors.remove(idx1));
+        }
+
+        // get the bundles
+        bundles.addAll(bundleDescriptors);
+
         if (LOG.isDebugEnabled()) {
             for (int i = 0; i < bundles.size(); i++) {
                 BundleDescriptor desc = bundles.get(i);
@@ -298,16 +332,35 @@ public final class CamelBlueprintHelper {
         registration.unregister();
     }
 
-    protected static TinyBundle createTestBundle(String name, String version, String descriptors) throws FileNotFoundException, MalformedURLException {
+    protected static TinyBundle createTestBundle(String name, String version, String descriptors, String[] ... configAdminPidFiles) throws IOException {
         TinyBundle bundle = TinyBundles.newBundle();
         for (URL url : getBlueprintDescriptors(descriptors)) {
             LOG.info("Using Blueprint XML file: " + url.getFile());
             bundle.add("OSGI-INF/blueprint/blueprint-" + url.getFile().replace("/", "-"), url);
         }
+        StringWriter configAdminInit = null;
+        for (String[] configAdminPidFile : configAdminPidFiles) {
+            if (configAdminPidFile == null) {
+                continue;
+            }
+            if (configAdminInit == null) {
+                configAdminInit = new StringWriter();
+            } else {
+                configAdminInit.append(',');
+            }
+            configAdminInit.append(configAdminPidFile[1]).append("=");
+            configAdminInit.append(new File(configAdminPidFile[0]).toURI().toString());
+        }
+        bundle.add(TestBundleActivator.class);
+        bundle.add(Util.class);
         bundle.set("Manifest-Version", "2")
                 .set("Bundle-ManifestVersion", "2")
                 .set("Bundle-SymbolicName", name)
-                .set("Bundle-Version", version);
+                .set("Bundle-Version", version)
+                .set("Bundle-Activator", TestBundleActivator.class.getName());
+        if (configAdminInit != null) {
+            bundle.set("X-Camel-Blueprint-ConfigAdmin-Init", configAdminInit.toString());
+        }
         return bundle;
     }
 
@@ -444,4 +497,52 @@ public final class CamelBlueprintHelper {
         return answer;
     }
 
+    /**
+     * Bundle activator that will be invoked in right time to set initial configadmin configuration
+     * for blueprint container.
+     */
+    public static class TestBundleActivator implements BundleActivator {
+        @Override
+        public void start(BundleContext bundleContext) throws Exception {
+            final String configAdminInit = bundleContext.getBundle().getHeaders().get("X-Camel-Blueprint-ConfigAdmin-Init");
+            if (configAdminInit != null) {
+                final BundleContext sysContext = bundleContext.getBundle(0).getBundleContext();
+                // we are started before blueprint.core and felix.configadmin
+                // we are sure that felix.configadmin is started before blueprint.core
+                sysContext.addBundleListener(new SynchronousBundleListener() {
+                    @Override
+                    public void bundleChanged(BundleEvent event) {
+                        if (event.getType() == BundleEvent.STARTED
+                                && "org.apache.felix.configadmin".equals(event.getBundle().getSymbolicName())) {
+                            // configadmin should have already been started
+                            ServiceReference<?> sr = sysContext.getServiceReference("org.osgi.service.cm.ConfigurationAdmin");
+                            if (sr != null && sysContext.getService(sr) != null) {
+                                initializeConfigAdmin(sysContext, configAdminInit);
+                            }
+                        }
+                    }
+                });
+            }
+        }
+
+        private void initializeConfigAdmin(BundleContext context, String configAdminInit) {
+            String[] pidFiles = configAdminInit.split(",");
+            for (String pidFile : pidFiles) {
+                String[] pf = pidFile.split("=");
+                try {
+                    CamelBlueprintHelper.setPersistentFileForConfigAdmin(context, pf[0], new URI(pf[1]).getPath(),
+                            new Properties(), null, null, false);
+                } catch (IOException | URISyntaxException e) {
+                    throw new RuntimeException(e.getMessage(), e);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                    throw new RuntimeException(e.getMessage(), e);
+                }
+            }
+        }
+
+        @Override
+        public void stop(BundleContext bundleContext) throws Exception {
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
----------------------------------------------------------------------
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 79563c2..642ee14 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
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.net.URL;
 import java.util.Arrays;
 import java.util.Dictionary;
+import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
@@ -93,9 +94,20 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
     protected BundleContext createBundleContext() throws Exception {
         System.setProperty("org.apache.aries.blueprint.synchronous", Boolean.toString(!useAsynchronousBlueprintStartup()));
 
+        // load configuration file
+        String[] file = loadConfigAdminConfigurationFile();
+        if (file != null) {
+            if (file.length != 2) {
+                throw new IllegalArgumentException("The returned String[] from loadConfigAdminConfigurationFile must be of length 2, was " + file.length);
+            }
+            if (!new File(file[0]).exists()) {
+                throw new IllegalArgumentException("The provided file \"" + file[0] + "\" from loadConfigAdminConfigurationFile doesn't exist");
+            }
+        }
+
         final String symbolicName = getClass().getSimpleName();
         final BundleContext answer = CamelBlueprintHelper.createBundleContext(symbolicName, getBlueprintDescriptor(),
-            includeTestBundle(), getBundleFilter(), getBundleVersion(), getBundleDirectives());
+            includeTestBundle(), getBundleFilter(), getBundleVersion(), getBundleDirectives(), file);
 
         boolean expectReload = expectBlueprintContainerReloadOnConfigAdminUpdate();
 
@@ -126,15 +138,6 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
             }
         }
 
-        // must reuse props as we can do both load from .cfg file and override afterwards
-        final Dictionary props = new Properties();
-
-        // load configuration file
-        String[] file = loadConfigAdminConfigurationFile();
-        if (file != null && file.length != 2) {
-            throw new IllegalArgumentException("The returned String[] from loadConfigAdminConfigurationFile must be of length 2, was " + file.length);
-        }
-
         // if blueprint XML uses <cm:property-placeholder> (any update-strategy and any default properties)
         // - org.apache.aries.blueprint.compendium.cm.ManagedObjectManager.register() is called
         // - ManagedServiceUpdate is scheduled in felix.cm
@@ -153,12 +156,8 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
 
         CamelBlueprintHelper.waitForBlueprintContainer(bpEvents, answer, symbolicName, BlueprintEvent.CREATED, null);
 
-        if (file != null) {
-            if (!new File(file[0]).exists()) {
-                throw new IllegalArgumentException("The provided file \"" + file[0] + "\" from loadConfigAdminConfigurationFile doesn't exist");
-            }
-            CamelBlueprintHelper.setPersistentFileForConfigAdmin(answer, file[1], file[0], props, symbolicName, bpEvents, expectReload);
-        }
+        // must reuse props as we can do both load from .cfg file and override afterwards
+        final Dictionary props = new Properties();
 
         // allow end user to override properties
         String pid = useOverridePropertiesWithConfigAdmin(props);
@@ -172,20 +171,34 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
             if (config == null) {
                 throw new IllegalArgumentException("Cannot find configuration with pid " + pid + " in OSGi ConfigurationAdmin service.");
             }
-            log.info("Updating ConfigAdmin {} by overriding properties {}", config, props);
+            // lets merge configurations
+            Dictionary<String, Object> currentProperties = config.getProperties();
+            final Dictionary newProps = new Properties();
+            if (currentProperties == null) {
+                currentProperties = newProps;
+            }
+            for (Enumeration<String> ek = currentProperties.keys(); ek.hasMoreElements(); ) {
+                String k = ek.nextElement();
+                newProps.put(k, currentProperties.get(k));
+            }
+            for (String p : ((Properties) props).stringPropertyNames()) {
+                newProps.put(p, ((Properties) props).getProperty(p));
+            }
+
+            log.info("Updating ConfigAdmin {} by overriding properties {}", config, newProps);
             if (expectReload) {
                 CamelBlueprintHelper.waitForBlueprintContainer(bpEvents, answer, symbolicName, BlueprintEvent.CREATED, new Runnable() {
                     @Override
                     public void run() {
                         try {
-                            config.update(props);
+                            config.update(newProps);
                         } catch (IOException e) {
                             throw new RuntimeException(e.getMessage(), e);
                         }
                     }
                 });
             } else {
-                config.update(props);
+                config.update(newProps);
             }
         }
 
@@ -309,7 +322,9 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
     }
 
     /**
-     * Override this method to override config admin properties.
+     * Override this method to override config admin properties. Overriden properties will be passed to
+     * {@link Configuration#update(Dictionary)} and may or may not lead to reload of Blueprint container - this
+     * depends on <code>update-strategy="reload|none"</code> in <code>&lt;cm:property-placeholder&gt;</code>
      *
      * @param props properties where you add the properties to override
      * @return the PID of the OSGi {@link ConfigurationAdmin} which are defined in the Blueprint XML file.
@@ -320,7 +335,8 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
 
     /**
      * Override this method and provide the name of the .cfg configuration file to use for
-     * Blueprint ConfigAdmin service.
+     * ConfigAdmin service. Provided file will be used to initialize ConfigAdmin configuration before Blueprint
+     * container is loaded.
      *
      * @return the name of the path for the .cfg file to load, and the persistence-id of the property placeholder.
      */

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
index 3092d2e..0812467 100644
--- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
+++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java
@@ -20,7 +20,6 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.Map;
-import java.util.Properties;
 import java.util.Set;
 
 import org.apache.camel.CamelContext;
@@ -99,11 +98,16 @@ public class Main extends MainSupport {
                 throw new IllegalArgumentException("Descriptors must be provided, with the name of the blueprint XML file");
             }
             LOG.debug("Starting Blueprint XML file: " + descriptors);
-            bundleContext = createBundleContext(bundleName);
+            if (configAdminPid != null && configAdminFileName != null) {
+                // pid/file is used to set INITIAL content of ConfigAdmin to be used when blueprint container is started
+                bundleContext = createBundleContext(bundleName, new String[] { configAdminFileName, configAdminPid });
+            } else {
+                bundleContext = createBundleContext(bundleName);
+            }
             Set<Long> eventHistory = new HashSet<>();
+
             CamelBlueprintHelper.waitForBlueprintContainer(eventHistory, bundleContext, bundleName, BlueprintEvent.CREATED, null);
-            CamelBlueprintHelper.setPersistentFileForConfigAdmin(bundleContext, configAdminPid, configAdminFileName, new Properties(),
-                                                                 bundleName, eventHistory, true);
+
             camelContext = CamelBlueprintHelper.getOsgiService(bundleContext, CamelContext.class);
             if (camelContext == null) {
                 throw new IllegalArgumentException("Cannot find CamelContext in blueprint XML file: " + descriptors);
@@ -137,8 +141,9 @@ public class Main extends MainSupport {
         return createBundleContext(getClass().getSimpleName());
     }
 
-    protected BundleContext createBundleContext(String name) throws Exception {
-        return CamelBlueprintHelper.createBundleContext(name, descriptors, isIncludeSelfAsBundle());
+    protected BundleContext createBundleContext(String name, String[] ... configAdminPidFiles) throws Exception {
+        return CamelBlueprintHelper.createBundleContext(name, descriptors, isIncludeSelfAsBundle(),
+                CamelBlueprintHelper.BUNDLE_FILTER, CamelBlueprintHelper.BUNDLE_VERSION, null, configAdminPidFiles);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java
index 56d45e6..18bdd36 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileAndOverrideTest.java
@@ -22,8 +22,8 @@ import org.junit.Test;
 
 // START SNIPPET: e1
 /**
- * This example will load a Blueprint .cfdg file, and also override its property placeholders from this unit test
- * source code directly.
+ * This example will load a Blueprint .cfg file (which will initialize configadmin), and also override its property
+ * placeholders from this unit test source code directly (the change will reload blueprint container).
  */
 public class ConfigAdminLoadConfigurationFileAndOverrideTest extends CamelBlueprintTestSupport {
 
@@ -50,7 +50,11 @@ public class ConfigAdminLoadConfigurationFileAndOverrideTest extends CamelBluepr
 
     @Test
     public void testConfigAdmin() throws Exception {
-        // regular unit test method
+        // mock:original comes from <cm:default-properties>/<cm:property name="destination" value="mock:original" />
+        getMockEndpoint("mock:original").setExpectedMessageCount(0);
+        // mock:result comes from loadConfigAdminConfigurationFile()
+        getMockEndpoint("mock:result").setExpectedMessageCount(0);
+        // mock:extra comes from useOverridePropertiesWithConfigAdmin()
         getMockEndpoint("mock:extra").expectedBodiesReceived("Bye World", "Yay Bye WorldYay Bye World");
 
         template.sendBody("direct:start", "World");

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java
index 7c97f9f..398cbed 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminLoadConfigurationFileTest.java
@@ -19,7 +19,7 @@ package org.apache.camel.test.blueprint;
 import org.junit.Test;
 
 /**
- *
+ * Same as {@link ConfigAdminNoReloadLoadConfigurationFileTest} except this time Blueprint container will reloaded
  */
 public class ConfigAdminLoadConfigurationFileTest extends CamelBlueprintTestSupport {
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadDefaultPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadDefaultPropertiesTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadDefaultPropertiesTest.java
new file mode 100644
index 0000000..6716b6c
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadDefaultPropertiesTest.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+import org.junit.Test;
+
+/**
+ *
+ */
+public class ConfigAdminNoReloadDefaultPropertiesTest extends CamelBlueprintTestSupport {
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml";
+    }
+
+    @Test
+    public void testConfigAdmin() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Good morning World");
+
+        template.sendBody("direct:start", "World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java
index 9f7faaa..292200e 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest.java
@@ -21,11 +21,9 @@ import java.util.Dictionary;
 import org.junit.Test;
 
 // START SNIPPET: e1
-
 /**
- * This example will load a Blueprint .cfg file, and also override its property placeholders from this unit test
- * source code directly.
- * But having <code>update-strategy="none"</code> means that BP container won't be reloaded
+ * This example will load a Blueprint .cfg file (which will initialize configadmin), and also override its property
+ * placeholders from this unit test source code directly (the change won't reload blueprint container).
  */
 public class ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest extends CamelBlueprintTestSupport {
 
@@ -52,8 +50,11 @@ public class ConfigAdminNoReloadLoadConfigurationFileAndOverrideTest extends Cam
 
     @Test
     public void testConfigAdmin() throws Exception {
-        // regular unit test method
-        getMockEndpoint("mock:original").expectedBodiesReceived("Hello World", "Hey Hello WorldHey Hello World");
+        // mock:original comes from <cm:default-properties>/<cm:property name="destination" value="mock:original" />
+        getMockEndpoint("mock:original").setExpectedMessageCount(0);
+        // mock:result comes from loadConfigAdminConfigurationFile()
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World", "Yay Bye WorldYay Bye World");
+        // mock:extra comes from useOverridePropertiesWithConfigAdmin(), but BP container isn't reloaded
         getMockEndpoint("mock:extra").setExpectedMessageCount(0);
 
         template.sendBody("direct:start", "World");

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest.java
new file mode 100644
index 0000000..9fa7e73
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+import org.junit.Test;
+
+/**
+ * {@link #loadConfigAdminConfigurationFile()} will override properties set by <code>&lt;cm:default-properties&gt;</code>
+ */
+public class ConfigAdminNoReloadLoadConfigurationFileDefaultPropertiesTest extends CamelBlueprintTestSupport {
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml";
+    }
+
+    // START SNIPPET: e1
+    @Override
+    protected String[] loadConfigAdminConfigurationFile() {
+        // String[0] = tell Camel the path of the .cfg file to use for OSGi ConfigAdmin in the blueprint XML file
+        // String[1] = tell Camel the persistence-id of the cm:property-placeholder in the blueprint XML file
+        return new String[]{"src/test/resources/etc/stuff.cfg", "stuff"};
+    }
+    // END SNIPPET: e1
+
+    @Test
+    public void testConfigAdmin() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+        template.sendBody("direct:start", "World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java
index 2196c93..b843e89 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoReloadLoadConfigurationFileTest.java
@@ -39,9 +39,7 @@ public class ConfigAdminNoReloadLoadConfigurationFileTest extends CamelBlueprint
 
     @Test
     public void testConfigAdmin() throws Exception {
-        // Even if we update config admin configuration, update-strategy="none" won't cause reload of BP
-        // container and reinjection of bean properties
-        getMockEndpoint("mock:result").expectedBodiesReceived("${greeting} World");
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
 
         template.sendBody("direct:start", "World");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoPidTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoPidTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoPidTest.java
new file mode 100644
index 0000000..6dd37c9
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoPidTest.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+
+import org.apache.camel.ProducerTemplate;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class MainNoPidTest {
+
+    @Test
+    public void testMyMain() throws Exception {
+        Main main = new Main();
+        main.setBundleName("MyMainBundle");
+        // as we run this test without packing ourselves as bundle, then include ourselves
+        main.setIncludeSelfAsBundle(true);
+        // setup the blueprint file here
+        main.setDescriptors("org/apache/camel/test/blueprint/main-no-pid-loadfile.xml");
+        main.start();
+
+        ProducerTemplate template = main.getCamelTemplate();
+        assertNotNull("We should get the template here", template);
+
+        String result = template.requestBody("direct:start", "hello", String.class);
+        assertEquals("Get a wrong response", "Good morning hello", result);
+        main.stop();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoReloadTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoReloadTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoReloadTest.java
new file mode 100644
index 0000000..c017587
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MainNoReloadTest.java
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.test.blueprint;
+
+
+import org.apache.camel.ProducerTemplate;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class MainNoReloadTest {
+
+    @Test
+    public void testMyMain() throws Exception {
+        Main main = new Main();
+        main.setBundleName("MyMainBundle");
+        // as we run this test without packing ourselves as bundle, then include ourselves
+        main.setIncludeSelfAsBundle(true);
+        // setup the blueprint file here
+        main.setDescriptors("org/apache/camel/test/blueprint/main-no-reload-loadfile.xml");
+        // set the configAdmin persistent id
+        main.setConfigAdminPid("stuff");
+        // set the configAdmin persistent file name
+        main.setConfigAdminFileName("src/test/resources/etc/stuff.cfg");
+        main.start();
+
+        ProducerTemplate template = main.getCamelTemplate();
+        assertNotNull("We should get the template here", template);
+
+        String result = template.requestBody("direct:start", "hello", String.class);
+        assertEquals("Get a wrong response", "Bye hello", result);
+        main.stop();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml
index c9e45d3..12cac3e 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-loadfileoverride.xml
@@ -26,7 +26,9 @@
   <!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file -->
   <cm:property-placeholder persistent-id="stuff" update-strategy="reload">
     <cm:default-properties>
-      <cm:property name="destination" value="to-be-replaced" />
+      <cm:property name="greeting" value="Hello" />
+      <cm:property name="echo" value="Hey" />
+      <cm:property name="destination" value="mock:original" />
     </cm:default-properties>
   </cm:property-placeholder>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml
new file mode 100644
index 0000000..1c0011e
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-default-properties.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xsi:schemaLocation="
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- START SNIPPET: e1 -->
+  <!-- blueprint property placeholders, PID="stuff" is empty during placeholder initialization
+   but we have <cm:default-properties> -->
+  <cm:property-placeholder persistent-id="stuff" update-strategy="none">
+    <cm:default-properties>
+      <cm:property name="greeting" value="Good morning" />
+    </cm:default-properties>
+  </cm:property-placeholder>
+
+  <!-- a bean that uses a blueprint property placeholder -->
+  <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
+    <property name="say" value="${greeting}"/>
+  </bean>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+    <route>
+      <from uri="direct:start"/>
+      <bean ref="myCoolBean" method="saySomething"/>
+      <to uri="mock:result"/>
+    </route>
+
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml
new file mode 100644
index 0000000..a7f54c1
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfile-default-properties.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xsi:schemaLocation="
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- START SNIPPET: e1 -->
+  <!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file
+   overriding <cm:default-properties> -->
+  <cm:property-placeholder persistent-id="stuff" update-strategy="none">
+    <cm:default-properties>
+      <cm:property name="greeting" value="Good morning" />
+    </cm:default-properties>
+  </cm:property-placeholder>
+
+  <!-- a bean that uses a blueprint property placeholder -->
+  <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
+    <property name="say" value="${greeting}"/>
+  </bean>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+    <route>
+      <from uri="direct:start"/>
+      <bean ref="myCoolBean" method="saySomething"/>
+      <to uri="mock:result"/>
+    </route>
+
+  </camelContext>
+  <!-- END SNIPPET: e1 -->
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml
index 1d5274d..6b7a12b 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-no-reload-loadfileoverride.xml
@@ -26,7 +26,7 @@
   <!-- blueprint property placeholders, that will use etc/stuff.cfg as the properties file -->
   <cm:property-placeholder persistent-id="stuff" update-strategy="none">
     <cm:default-properties>
-      <cm:property name="say" value="Hello" />
+      <cm:property name="greeting" value="Hello" />
       <cm:property name="echo" value="Hey" />
       <cm:property name="destination" value="mock:original" />
     </cm:default-properties>
@@ -34,7 +34,7 @@
 
   <!-- a bean that uses a blueprint property placeholder -->
   <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
-    <property name="say" value="${say}"/>
+    <property name="say" value="${greeting}"/>
     <property name="echo" value="${echo}"/>
   </bean>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-pid-loadfile.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-pid-loadfile.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-pid-loadfile.xml
new file mode 100644
index 0000000..27e0248
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-pid-loadfile.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xsi:schemaLocation="
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- blueprint property placeholders which we can configure from outside -->
+  <cm:property-placeholder persistent-id="stuff" update-strategy="none">
+      <cm:default-properties>
+          <cm:property name="greeting" value="Good morning"/>
+          <cm:property name="destination" value="mock:result"/>
+      </cm:default-properties>
+  </cm:property-placeholder>
+
+  <!-- a bean that uses a blueprint property placeholder -->
+  <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
+    <property name="say" value="${greeting}"/>
+  </bean>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+     <route>
+      <from uri="direct:start"/>
+      <bean ref="myCoolBean" method="saySomething"/>
+      <to uri="{{destination}}"/>
+    </route>
+
+  </camelContext>
+
+</blueprint>

http://git-wip-us.apache.org/repos/asf/camel/blob/2410bfa5/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-reload-loadfile.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-reload-loadfile.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-reload-loadfile.xml
new file mode 100644
index 0000000..4902aa5
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/main-no-reload-loadfile.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+           xsi:schemaLocation="
+             http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- blueprint property placeholders which we can configure from outside -->
+  <cm:property-placeholder persistent-id="stuff" update-strategy="none"/>
+
+  <!-- a bean that uses a blueprint property placeholder -->
+  <bean id="myCoolBean" class="org.apache.camel.test.blueprint.MyCoolBean">
+    <property name="say" value="${greeting}"/>
+  </bean>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+     <route>
+      <from uri="direct:start"/>
+      <bean ref="myCoolBean" method="saySomething"/>
+      <to uri="{{destination}}"/>
+    </route>
+
+  </camelContext>
+
+</blueprint>