Repository: camel
Updated Branches:
  refs/heads/camel-2.18.x 7d0dbdffb -> e82da57e9


CAMEL-10393: camel-properties: Add an option to disable using default value if 
a property does not exists


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

Branch: refs/heads/camel-2.18.x
Commit: 57da1afee72f3e7b1810eee4c50ff876cb7792ca
Parents: 7d0dbdf
Author: lburgazzoli <lburgazz...@gmail.com>
Authored: Wed Oct 19 17:05:03 2016 +0200
Committer: Gregor Zurowski <gre...@zurowski.org>
Committed: Thu Sep 21 08:09:48 2017 +0100

----------------------------------------------------------------------
 .../src/main/docs/properties-component.adoc     |  3 +-
 ...mentedPropertyNameAwarePropertiesParser.java |  5 +-
 .../properties/DefaultPropertiesParser.java     | 22 ++++---
 .../properties/PropertiesComponent.java         | 19 +++++-
 .../PropertiesComponentDisableDefaultsTest.java | 68 ++++++++++++++++++++
 .../PropertiesComponentConfiguration.java       | 14 ++++
 .../xml/AbstractCamelContextFactoryBean.java    |  3 +
 .../xml/CamelPropertyPlaceholderDefinition.java | 13 ++++
 .../BridgePropertyPlaceholderConfigurer.java    |  4 +-
 .../blueprint/BlueprintDefaultValuesTest.java   | 51 +++++++++++++++
 .../camel/test/blueprint/default-values.xml     | 46 +++++++++++++
 11 files changed, 232 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/camel-core/src/main/docs/properties-component.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/properties-component.adoc 
b/camel-core/src/main/docs/properties-component.adoc
index 1668af9..b55849b 100644
--- a/camel-core/src/main/docs/properties-component.adoc
+++ b/camel-core/src/main/docs/properties-component.adoc
@@ -20,7 +20,7 @@ Options
 ^^^^^^^
 
 // component options: START
-The Properties component supports 15 options which are listed below.
+The Properties component supports 16 options which are listed below.
 
 
 
@@ -37,6 +37,7 @@ The Properties component supports 15 options which are listed 
below.
 | propertyPrefix | String | Optional prefix prepended to property names before 
resolution.
 | propertySuffix | String | Optional suffix appended to property names before 
resolution.
 | fallbackToUnaugmentedProperty | boolean | If true first attempt resolution 
of property name augmented with propertyPrefix and propertySuffix before 
falling back the plain property name specified. If false only the augmented 
property name is searched.
+| disableDefaultValueResolution | boolean | If true the component does not 
attempt to find a default for the key by looking after the colon separator.
 | ignoreMissingLocation | boolean | Whether to silently ignore if a location 
cannot be located such as a properties file not found.
 | prefixToken | String | Sets the value of the prefix token used to identify 
properties to replace. Setting a value of null restores the default token (link 
link DEFAULT_PREFIX_TOKEN).
 | suffixToken | String | Sets the value of the suffix token used to identify 
properties to replace. Setting a value of null restores the default token (link 
link DEFAULT_SUFFIX_TOKEN).

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/camel-core/src/main/java/org/apache/camel/component/properties/AugmentedPropertyNameAwarePropertiesParser.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/properties/AugmentedPropertyNameAwarePropertiesParser.java
 
b/camel-core/src/main/java/org/apache/camel/component/properties/AugmentedPropertyNameAwarePropertiesParser.java
index 0f4d05d..dfe8df7 100644
--- 
a/camel-core/src/main/java/org/apache/camel/component/properties/AugmentedPropertyNameAwarePropertiesParser.java
+++ 
b/camel-core/src/main/java/org/apache/camel/component/properties/AugmentedPropertyNameAwarePropertiesParser.java
@@ -40,6 +40,9 @@ public interface AugmentedPropertyNameAwarePropertiesParser 
extends PropertiesPa
      * @param fallbackToUnaugmentedProperty flag indicating if the originally
      *            parsed property name should by used for resolution if there 
is
      *            no match to the augmented property name
+     * @param disableDefaultValueResolution flag indicating if the value after 
colon
+     *                                      should be the default value to use 
it
+     *                                      the property has not been resolved
      *            
      * @return the parsed text with replaced placeholders
      *
@@ -47,5 +50,5 @@ public interface AugmentedPropertyNameAwarePropertiesParser 
extends PropertiesPa
      *             is not found
      */
     String parseUri(String text, Properties properties, String prefixToken, 
String suffixToken,
-                    String propertyPrefix, String propertySuffix, boolean 
fallbackToUnaugmentedProperty) throws IllegalArgumentException;
+                    String propertyPrefix, String propertySuffix, boolean 
fallbackToUnaugmentedProperty, boolean disableDefaultValueResolution) throws 
IllegalArgumentException;
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java
 
b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java
index 3ab0f73..0bfef5b 100644
--- 
a/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java
+++ 
b/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesParser.java
@@ -20,8 +20,6 @@ import java.util.HashSet;
 import java.util.Properties;
 import java.util.Set;
 
-import static java.lang.String.format;
-
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,12 +51,14 @@ public class DefaultPropertiesParser implements 
AugmentedPropertyNameAwareProper
 
     @Override
     public String parseUri(String text, Properties properties, String 
prefixToken, String suffixToken) throws IllegalArgumentException {
-        return parseUri(text, properties, prefixToken, suffixToken, null, 
null, false);
+        return parseUri(text, properties, prefixToken, suffixToken, null, 
null, false, false);
     }
 
-    public String parseUri(String text, Properties properties, String 
prefixToken, String suffixToken, String propertyPrefix, String propertySuffix,
-                           boolean fallbackToUnaugmentedProperty) throws 
IllegalArgumentException {
-        ParsingContext context = new ParsingContext(properties, prefixToken, 
suffixToken, propertyPrefix, propertySuffix, fallbackToUnaugmentedProperty);
+    @Override
+    public String parseUri(String text, Properties properties,
+                           String prefixToken, String suffixToken, String 
propertyPrefix, String propertySuffix,
+            boolean fallbackToUnaugmentedProperty, boolean 
disableDefaultValueResolution) throws IllegalArgumentException {
+        ParsingContext context = new ParsingContext(properties, prefixToken, 
suffixToken, propertyPrefix, propertySuffix, fallbackToUnaugmentedProperty, 
disableDefaultValueResolution);
         return context.parse(text);
     }
 
@@ -76,15 +76,17 @@ public class DefaultPropertiesParser implements 
AugmentedPropertyNameAwareProper
         private final String propertyPrefix;
         private final String propertySuffix;
         private final boolean fallbackToUnaugmentedProperty;
+        private final boolean disableDefaultValueResolution;
 
         ParsingContext(Properties properties, String prefixToken, String 
suffixToken, String propertyPrefix, String propertySuffix,
-                              boolean fallbackToUnaugmentedProperty) {
+                              boolean fallbackToUnaugmentedProperty, boolean 
disableDefaultValueResolution) {
             this.properties = properties;
             this.prefixToken = prefixToken;
             this.suffixToken = suffixToken;
             this.propertyPrefix = propertyPrefix;
             this.propertySuffix = propertySuffix;
             this.fallbackToUnaugmentedProperty = fallbackToUnaugmentedProperty;
+            this.disableDefaultValueResolution = disableDefaultValueResolution;
         }
 
         /**
@@ -139,7 +141,7 @@ public class DefaultPropertiesParser implements 
AugmentedPropertyNameAwareProper
             // If not found, ensure that there is no valid prefix token in the 
string
             if (suffix == -1) {
                 if (getMatchingPrefixIndex(input, input.length()) != -1) {
-                    throw new IllegalArgumentException(format("Missing %s from 
the text: %s", suffixToken, input));
+                    throw new IllegalArgumentException(String.format("Missing 
%s from the text: %s", suffixToken, input));
                 }
                 return null;
             }
@@ -147,7 +149,7 @@ public class DefaultPropertiesParser implements 
AugmentedPropertyNameAwareProper
             // Find the index of the prefix token that matches the suffix token
             int prefix = getMatchingPrefixIndex(input, suffix);
             if (prefix == -1) {
-                throw new IllegalArgumentException(format("Missing %s from the 
text: %s", prefixToken, input));
+                throw new IllegalArgumentException(String.format("Missing %s 
from the text: %s", prefixToken, input));
             }
 
             String key = input.substring(prefix + prefixToken.length(), 
suffix);
@@ -235,7 +237,7 @@ public class DefaultPropertiesParser implements 
AugmentedPropertyNameAwareProper
 
             // they key may have a get or else expression
             String defaultValue = null;
-            if (key.contains(GET_OR_ELSE_TOKEN)) {
+            if (!disableDefaultValueResolution && 
key.contains(GET_OR_ELSE_TOKEN)) {
                 defaultValue = ObjectHelper.after(key, GET_OR_ELSE_TOKEN);
                 key = ObjectHelper.before(key, GET_OR_ELSE_TOKEN);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
 
b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
index cfc0a39..7bbdefa 100644
--- 
a/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
+++ 
b/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
@@ -100,6 +100,7 @@ public class PropertiesComponent extends 
UriEndpointComponent {
     private String propertySuffix;
     private String propertySuffixResolved;
     private boolean fallbackToUnaugmentedProperty = true;
+    private boolean disableDefaultValueResolution;
     private String prefixToken = DEFAULT_PREFIX_TOKEN;
     private String suffixToken = DEFAULT_SUFFIX_TOKEN;
     private Properties initialProperties;
@@ -206,8 +207,11 @@ public class PropertiesComponent extends 
UriEndpointComponent {
         LOG.trace("Parsing uri {} with properties: {}", uri, prop);
         
         if (propertiesParser instanceof 
AugmentedPropertyNameAwarePropertiesParser) {
-            return ((AugmentedPropertyNameAwarePropertiesParser) 
propertiesParser).parseUri(uri, prop, prefixToken, suffixToken,
-                                                                               
             propertyPrefixResolved, propertySuffixResolved, 
fallbackToUnaugmentedProperty);
+            return ((AugmentedPropertyNameAwarePropertiesParser) 
propertiesParser).parseUri(
+                uri, prop,
+                prefixToken, suffixToken,
+                propertyPrefixResolved, propertySuffixResolved,
+                fallbackToUnaugmentedProperty, disableDefaultValueResolution);
         } else {
             return propertiesParser.parseUri(uri, prop, prefixToken, 
suffixToken);
         }
@@ -340,6 +344,17 @@ public class PropertiesComponent extends 
UriEndpointComponent {
         this.fallbackToUnaugmentedProperty = fallbackToUnaugmentedProperty;
     }
 
+    public boolean isDisableDefaultValueResolution() {
+        return disableDefaultValueResolution;
+    }
+
+    /**
+     * If true, the component does not attempt to find a default for the key 
by looking after the colon separator.
+     */
+    public void setDisableDefaultValueResolution(boolean 
disableDefaultValueResolution) {
+        this.disableDefaultValueResolution = disableDefaultValueResolution;
+    }
+
     public boolean isIgnoreMissingLocation() {
         return ignoreMissingLocation;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDisableDefaultsTest.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDisableDefaultsTest.java
 
b/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDisableDefaultsTest.java
new file mode 100644
index 0000000..2f3af4b
--- /dev/null
+++ 
b/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDisableDefaultsTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.component.properties;
+
+import java.util.Properties;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class PropertiesComponentDisableDefaultsTest extends ContextTestSupport 
{
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    public void testDisableDefaultValueResolution() throws Exception {
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .transform().simple("{{p:message}}")
+                    .to("mock:{{p:mockend}}");
+            }
+        });
+
+        getMockEndpoint("mock:end").expectedMessageCount(1);
+        getMockEndpoint("mock:end").expectedBodiesReceived("my message");
+
+        context.start();
+
+        template.sendBody("direct:start", null);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+
+        Properties props = new Properties();
+        props.put("p:mockend", "end");
+        props.put("p:message", "my message");
+
+        PropertiesComponent component = new PropertiesComponent();
+        component.setDisableDefaultValueResolution(true);
+        component.setInitialProperties(props);
+        context.addComponent("properties", component);
+
+        return context;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java
 
b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java
index 431d43e..55b5f3a 100644
--- 
a/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java
+++ 
b/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java
@@ -79,6 +79,11 @@ public class PropertiesComponentConfiguration {
      */
     private Boolean fallbackToUnaugmentedProperty;
     /**
+     * If true the component does not attempt to find a default for the key by
+     * looking after the colon separator.
+     */
+    private Boolean disableDefaultValueResolution;
+    /**
      * Whether to silently ignore if a location cannot be located such as a
      * properties file not found.
      */
@@ -183,6 +188,15 @@ public class PropertiesComponentConfiguration {
         this.fallbackToUnaugmentedProperty = fallbackToUnaugmentedProperty;
     }
 
+    public Boolean getDisableDefaultValueResolution() {
+        return disableDefaultValueResolution;
+    }
+
+    public void setDisableDefaultValueResolution(
+            Boolean disableDefaultValueResolution) {
+        this.disableDefaultValueResolution = disableDefaultValueResolution;
+    }
+
     public Boolean getIgnoreMissingLocation() {
         return ignoreMissingLocation;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git 
a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
 
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
index 9f17b65..a195ee1 100644
--- 
a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
+++ 
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
@@ -599,6 +599,9 @@ public abstract class AbstractCamelContextFactoryBean<T 
extends ModelCamelContex
             if (def.isFallbackToUnaugmentedProperty() != null) {
                 
pc.setFallbackToUnaugmentedProperty(def.isFallbackToUnaugmentedProperty());
             }
+            if (def.getDisableDefaultValueResolution() != null) {
+                
pc.setDisableDefaultValueResolution(def.getDisableDefaultValueResolution());
+            }
             
             pc.setPrefixToken(def.getPrefixToken());
             pc.setSuffixToken(def.getSuffixToken());

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
----------------------------------------------------------------------
diff --git 
a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
 
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
index 6990a80..7ea2cee 100644
--- 
a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
+++ 
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelPropertyPlaceholderDefinition.java
@@ -54,6 +54,8 @@ public class CamelPropertyPlaceholderDefinition extends 
IdentifiedType {
     private String propertySuffix;
     @XmlAttribute @Metadata(defaultValue = "true")
     private Boolean fallbackToUnaugmentedProperty;
+    @XmlAttribute @Metadata(defaultValue = "false")
+    private Boolean disableDefaultValueResolution;
     @XmlAttribute @Metadata(defaultValue = "{{")
     private String prefixToken;
     @XmlAttribute @Metadata(defaultValue = "}}")
@@ -154,6 +156,17 @@ public class CamelPropertyPlaceholderDefinition extends 
IdentifiedType {
         this.fallbackToUnaugmentedProperty = fallbackToUnaugmentedProperty;
     }
 
+    public Boolean getDisableDefaultValueResolution() {
+        return disableDefaultValueResolution;
+    }
+
+    /**
+     * If true, the component does not attempt to find a default for the key 
by looking after the colon separator.
+     */
+    public void setDisableDefaultValueResolution(Boolean 
disableDefaultValueResolution) {
+        this.disableDefaultValueResolution = disableDefaultValueResolution;
+    }
+
     public Boolean isIgnoreMissingLocation() {
         return ignoreMissingLocation;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
 
b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
index 86728ef..c085fad 100644
--- 
a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
+++ 
b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
@@ -154,13 +154,13 @@ public class BridgePropertyPlaceholderConfigurer extends 
PropertyPlaceholderConf
 
     @Override
     public String parseUri(String text, Properties properties, String 
prefixToken, String suffixToken,
-                           String propertyPrefix, String propertySuffix, 
boolean fallbackToUnaugmentedProperty) throws IllegalArgumentException {
+                           String propertyPrefix, String propertySuffix, 
boolean fallbackToUnaugmentedProperty, boolean disableDefaultValueResolution) 
throws IllegalArgumentException {
 
         // first let Camel parse the text as it may contain Camel placeholders
         String answer;
         if (parser instanceof AugmentedPropertyNameAwarePropertiesParser) {
             answer = ((AugmentedPropertyNameAwarePropertiesParser) 
parser).parseUri(text, properties, prefixToken, suffixToken,
-                    propertyPrefix, propertySuffix, 
fallbackToUnaugmentedProperty);
+                    propertyPrefix, propertySuffix, 
fallbackToUnaugmentedProperty, disableDefaultValueResolution);
         } else {
             answer = parser.parseUri(text, properties, prefixToken, 
suffixToken);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintDefaultValuesTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintDefaultValuesTest.java
 
b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintDefaultValuesTest.java
new file mode 100644
index 0000000..9586e34
--- /dev/null
+++ 
b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintDefaultValuesTest.java
@@ -0,0 +1,51 @@
+/**
+ * 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 java.util.Properties;
+
+import org.junit.Test;
+
+/**
+ * A test showing that Blueprint XML property placeholders work correctly with
+ * placeholders containing colon in the key.
+ */
+
+public class BlueprintDefaultValuesTest extends CamelBlueprintTestSupport {
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/default-values.xml";
+    }
+
+    @Test
+    public void testPropertyResolutionFailure() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("dot=my.value 
colon=my:value");
+
+        template.sendBody("direct:start", null);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected Properties useOverridePropertiesWithPropertiesComponent() {
+        Properties extra = new Properties();
+        extra.put("my:key", "my:value");
+        return extra;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/57da1afe/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/default-values.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/default-values.xml
 
b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/default-values.xml
new file mode 100644
index 0000000..0fd2284
--- /dev/null
+++ 
b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/default-values.xml
@@ -0,0 +1,46 @@
+<?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";>
+
+  <cm:property-placeholder id="default-values" persistent-id="default.values">
+    <cm:default-properties>
+      <cm:property name="my.key" value="my.value" />
+    </cm:default-properties>
+  </cm:property-placeholder>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint";>
+    <propertyPlaceholder id="default-values-camel" 
location="blueprint:default-values" disableDefaultValueResolution="true"/>
+
+    <route>
+      <from uri="direct:start"/>
+      <transform>
+        <simple>dot={{my.key}} colon={{my:key}}</simple>
+      </transform>
+      <to uri="mock:result"/>
+    </route>
+
+  </camelContext>
+
+</blueprint>

Reply via email to