This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch properties
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b7f575c50895c0e0df444c37ff3cf41f674aa851
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Jul 3 12:23:15 2019 +0200

    CAMEL-13721: Properties component - Make it simpler by removing not often 
used stuff
---
 .../component/properties/PropertiesComponent.java  | 128 +----
 .../component/properties/PropertiesEndpoint.java   | 114 -----
 .../org/apache/camel/spi/PropertiesComponent.java  |  24 +-
 core/camel-base/src/main/docs/simple-language.adoc |   4 -
 .../camel/impl/engine/AbstractCamelContext.java    |   4 +-
 .../simple/ast/SimpleFunctionExpression.java       |  21 +-
 .../properties/PropertiesComponentDefaultTest.java | 147 ------
 .../PropertiesComponentGetOrElseTest.java          | 103 ----
 ...pertiesComponentLoadPropertiesFromFileTest.java |  37 --
 .../PropertiesComponentLoadPropertiesTest.java     |  32 --
 ...ertiesComponentLocationWithJvmPropertyTest.java |  61 ---
 ...iesComponentLocationWithTwoJvmPropertyTest.java |  40 --
 .../PropertiesComponentSimpleLanguageTest.java     |  72 ---
 .../properties/PropertiesComponentTest.java        | 553 ---------------------
 .../org/apache/camel/support/DefaultComponent.java |   3 +-
 .../camel/support/builder/ExpressionBuilder.java   |  26 +-
 16 files changed, 39 insertions(+), 1330 deletions(-)

diff --git 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
index 1e109c6..53efb27 100644
--- 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
+++ 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
@@ -18,19 +18,18 @@ package org.apache.camel.component.properties;
 
 import java.io.Serializable;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.stream.Collectors;
 
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
 import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.NoFactoryAvailableException;
+import org.apache.camel.StaticService;
 import org.apache.camel.api.management.ManagedAttribute;
 import org.apache.camel.api.management.ManagedOperation;
 import org.apache.camel.api.management.ManagedResource;
@@ -38,7 +37,6 @@ import org.apache.camel.spi.FactoryFinder;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
-import org.apache.camel.support.LRUCacheFactory;
 import org.apache.camel.support.OrderedComparator;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.util.FilePathResolver;
@@ -52,7 +50,7 @@ import org.slf4j.LoggerFactory;
  */
 @Component("properties")
 @ManagedResource(description = "Managed PropertiesComponent")
-public class PropertiesComponent extends DefaultComponent implements 
org.apache.camel.spi.PropertiesComponent {
+public class PropertiesComponent extends DefaultComponent implements 
org.apache.camel.spi.PropertiesComponent, StaticService {
 
     /**
      *  Never check system properties.
@@ -100,8 +98,6 @@ public class PropertiesComponent extends DefaultComponent 
implements org.apache.
 
     private static final Logger LOG = 
LoggerFactory.getLogger(PropertiesComponent.class);
 
-    // TODO: Get rid of cacheMap
-    private final Map<CacheKey, Properties> cacheMap = 
LRUCacheFactory.newLRUSoftCache(1000);
     private transient Properties cachedLoadedProperties;
     private final Map<String, PropertiesFunction> functions = new 
LinkedHashMap<>();
     private PropertiesResolver propertiesResolver = new 
DefaultPropertiesResolver(this);
@@ -151,75 +147,31 @@ public class PropertiesComponent extends DefaultComponent 
implements org.apache.
         setLocations(locations);
     }
 
-    @Override
-    protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
-        List<PropertiesLocation> paths = locations;
-
-        Boolean ignoreMissingLocationLoc = getAndRemoveParameter(parameters, 
"ignoreMissingLocation", Boolean.class);
-        if (ignoreMissingLocationLoc != null) {
-            ignoreMissingLocation = ignoreMissingLocationLoc;
-        }
-
-        // override default locations
-        String locations = getAndRemoveParameter(parameters, "locations", 
String.class);
-        if (locations != null) {
-            log.trace("Overriding default locations with location: {}", 
locations);
-            paths = 
Arrays.stream(locations.split(",")).map(PropertiesLocation::new).collect(Collectors.toList());
-        }
-
-        String endpointUri = parseUri(remaining, paths);
-        log.debug("Endpoint uri parsed as: {}", endpointUri);
-
-        Endpoint delegate = getCamelContext().getEndpoint(endpointUri);
-        PropertiesEndpoint answer = new PropertiesEndpoint(uri, delegate, 
this);
-
-        setProperties(answer, parameters);
-        return answer;
-    }
-
     public String parseUri(String uri) {
         // optimise to only load properties once as we use the configured 
locations
         if (cache) {
             if (cachedLoadedProperties == null) {
-                cachedLoadedProperties = doLoadProperties(null);
+                cachedLoadedProperties = doLoadProperties();
             }
             return parseUri(uri, cachedLoadedProperties);
         } else {
-            Properties prop = doLoadProperties(null);
+            Properties prop = doLoadProperties();
             return parseUri(uri, prop);
         }
     }
 
-    @Deprecated
-    public String parseUri(String uri, String... locations) {
-        return parseUri(
-            uri,
-            locations != null
-                ? 
Arrays.stream(locations).map(PropertiesLocation::new).collect(Collectors.toList())
-                : Collections.emptyList());
-    }
-
     public Properties loadProperties() {
         if (cache) {
             if (cachedLoadedProperties == null) {
-                cachedLoadedProperties = doLoadProperties(null);
+                cachedLoadedProperties = doLoadProperties();
             }
             return cachedLoadedProperties;
         } else {
-            return doLoadProperties(null);
-        }
-    }
-
-    @Deprecated
-    public Properties loadProperties(String... locations) {
-        if (locations != null) {
-            return 
doLoadProperties(Arrays.stream(locations).map(PropertiesLocation::new).collect(Collectors.toList()));
-        } else {
-            return new OrderedProperties();
+            return doLoadProperties();
         }
     }
 
-    protected Properties doLoadProperties(List<PropertiesLocation> 
extraLocations) {
+    protected Properties doLoadProperties() {
         Properties prop = new OrderedProperties();
 
         // use initial properties
@@ -227,40 +179,21 @@ public class PropertiesComponent extends DefaultComponent 
implements org.apache.
             prop.putAll(initialProperties);
         }
 
-        // use the old way with locations
-        if (extraLocations != null) {
-            // location may contain JVM system property or OS environment 
variables
-            // so we need to parse those
-            List<PropertiesLocation> locations = 
parseLocations(extraLocations);
-
-            // check cache first
-            CacheKey key = new CacheKey(locations);
-            Properties locationsProp = cache ? cacheMap.get(key) : null;
-            if (locationsProp == null) {
-                locationsProp = 
propertiesResolver.resolveProperties(getCamelContext(), ignoreMissingLocation, 
locations);
-                if (cache) {
-                    cacheMap.put(key, locationsProp);
+        if (!locationSources.isEmpty()) {
+            for (PropertiesSource ps : locationSources) {
+                if (ps instanceof LoadablePropertiesSource) {
+                    LoadablePropertiesSource lps = (LoadablePropertiesSource) 
ps;
+                    Properties p = lps.loadProperties();
+                    prop.putAll(p);
                 }
             }
-            prop.putAll(locationsProp);
-        } else {
-            // else use the new way with property sources
-            if (!locationSources.isEmpty()) {
-                for (PropertiesSource ps : locationSources) {
-                    if (ps instanceof LoadablePropertiesSource) {
-                        LoadablePropertiesSource lps = 
(LoadablePropertiesSource) ps;
-                        Properties p = lps.loadProperties();
-                        prop.putAll(p);
-                    }
-                }
-            }
-            if (!sources.isEmpty()) {
-                for (PropertiesSource ps : sources) {
-                    if (ps instanceof LoadablePropertiesSource) {
-                        LoadablePropertiesSource lps = 
(LoadablePropertiesSource) ps;
-                        Properties p = lps.loadProperties();
-                        prop.putAll(p);
-                    }
+        }
+        if (!sources.isEmpty()) {
+            for (PropertiesSource ps : sources) {
+                if (ps instanceof LoadablePropertiesSource) {
+                    LoadablePropertiesSource lps = (LoadablePropertiesSource) 
ps;
+                    Properties p = lps.loadProperties();
+                    prop.putAll(p);
                 }
             }
         }
@@ -277,11 +210,6 @@ public class PropertiesComponent extends DefaultComponent 
implements org.apache.
         return prop;
     }
 
-    protected String parseUri(String uri, List<PropertiesLocation> paths) {
-        Properties prop = doLoadProperties(paths);
-        return parseUri(uri, prop);
-    }
-
     protected String parseUri(String uri, Properties prop) {
         // enclose tokens if missing
         if (!uri.contains(prefixToken) && !uri.startsWith(prefixToken)) {
@@ -564,18 +492,11 @@ public class PropertiesComponent extends DefaultComponent 
implements org.apache.
         this.environmentVariableMode = environmentVariableMode;
     }
 
-    @Override
-    public boolean isResolvePropertyPlaceholders() {
-        // its chicken and egg, we cannot resolve placeholders on ourselves
-        return false;
-    }
-
     /**
      * Clears the cache
      */
     @ManagedOperation(description = "Clears the cache")
     public void clearCache() {
-        this.cacheMap.clear();
         this.cachedLoadedProperties = null;
     }
 
@@ -620,8 +541,6 @@ public class PropertiesComponent extends DefaultComponent 
implements org.apache.
 
     @Override
     protected void doStart() throws Exception {
-        super.doStart();
-
         // sort the sources
         locationSources.sort(OrderedComparator.get());
         sources.sort(OrderedComparator.get());
@@ -646,10 +565,13 @@ public class PropertiesComponent extends DefaultComponent 
implements org.apache.
 
     @Override
     protected void doStop() throws Exception {
-        cacheMap.clear();
         cachedLoadedProperties = null;
         ServiceHelper.stopAndShutdownServices(locationSources, sources);
-        super.doStop();
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
+        throw new UnsupportedOperationException("Properties component does not 
support endpoints");
     }
 
     private void addPropertiesLocationsAsPropertiesSource(PropertiesLocation 
location) {
diff --git 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesEndpoint.java
 
b/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesEndpoint.java
deleted file mode 100644
index fccfe1c..0000000
--- 
a/components/camel-properties/src/main/java/org/apache/camel/component/properties/PropertiesEndpoint.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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 org.apache.camel.Component;
-import org.apache.camel.Consumer;
-import org.apache.camel.DelegateEndpoint;
-import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.spi.Metadata;
-import org.apache.camel.spi.UriEndpoint;
-import org.apache.camel.spi.UriParam;
-import org.apache.camel.spi.UriPath;
-import org.apache.camel.support.DefaultEndpoint;
-
-/**
- * The properties component is used for using property placeholders in 
endpoint uris.
- */
-@UriEndpoint(firstVersion = "2.3.0", scheme = "properties", title = 
"Properties", syntax = "properties:key", label = "core,endpoint")
-public class PropertiesEndpoint extends DefaultEndpoint implements 
DelegateEndpoint {
-
-    private volatile Endpoint endpoint;
-
-    @UriPath
-    @Metadata(required = true)
-    private String key;
-    @UriParam
-    private String locations;
-    @UriParam
-    private boolean ignoreMissingLocation;
-
-    public PropertiesEndpoint(String endpointUri, Endpoint delegate, Component 
component) {
-        super(endpointUri, component);
-        this.endpoint = delegate;
-    }
-
-    public String getKey() {
-        return key;
-    }
-
-    /**
-     * Property key to use as placeholder
-     */
-    public void setKey(String key) {
-        this.key = key;
-    }
-
-    public String getLocations() {
-        return locations;
-    }
-
-    /**
-     * A list of locations to load properties. You can use comma to separate 
multiple locations.
-     * This option will override any default locations and only use the 
locations from this option.
-     */
-    public void setLocations(String locations) {
-        this.locations = locations;
-    }
-
-    public boolean isIgnoreMissingLocation() {
-        return ignoreMissingLocation;
-    }
-
-    /**
-     * Whether to silently ignore if a location cannot be located, such as a 
properties file not found.
-     */
-    public void setIgnoreMissingLocation(boolean ignoreMissingLocation) {
-        this.ignoreMissingLocation = ignoreMissingLocation;
-    }
-
-    @Override
-    public Producer createProducer() throws Exception {
-        return endpoint.createProducer();
-    }
-
-    @Override
-    public Consumer createConsumer(Processor processor) throws Exception {
-        return endpoint.createConsumer(processor);
-    }
-
-    @Override
-    public Endpoint getEndpoint() {
-        return endpoint;
-    }
-
-    @Override
-    protected void doStart() throws Exception {
-        // add the endpoint as a service so Camel can manage the endpoint and 
enlist the endpoint in JMX etc.
-        getCamelContext().addService(endpoint);
-        super.doStart();
-    }
-
-    @Override
-    protected void doStop() throws Exception {
-        super.doStop();
-        // noop
-    }
-
-}
diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesComponent.java 
b/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesComponent.java
index d325270..07a7c8e 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesComponent.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesComponent.java
@@ -20,8 +20,9 @@ import java.io.IOError;
 import java.util.Properties;
 
 import org.apache.camel.Component;
+import org.apache.camel.StaticService;
 
-public interface PropertiesComponent extends Component {
+public interface PropertiesComponent extends Component, StaticService {
 
     // TODO: addPropertiesSource to make it easier to add custom sources
 
@@ -54,17 +55,6 @@ public interface PropertiesComponent extends Component {
     String parseUri(String uri);
 
     /**
-     * Parses the input text and resolve all property placeholders.
-     *
-     * @param uri  input text
-     * @param locations locations to load as properties (will not use the 
default locations)
-     * @return text with resolved property placeholders
-     * @throws IllegalArgumentException is thrown if error during parsing
-     */
-    @Deprecated
-    String parseUri(String uri, String... locations);
-
-    /**
      * Loads the properties from the default locations.
      *
      * @return the properties loaded.
@@ -73,16 +63,6 @@ public interface PropertiesComponent extends Component {
     Properties loadProperties();
 
     /**
-     * Loads the properties from the given locations
-     *
-     * @param locations locations to load as properties (will not use the 
default locations)
-     * @return the properties loaded.
-     * @throws IOError is thrown if error loading properties
-     */
-    @Deprecated
-    Properties loadProperties(String... locations);
-
-    /**
      * A list of locations to load properties. You can use comma to separate 
multiple locations.
      * This option will override any default locations and only use the 
locations from this option.
      */
diff --git a/core/camel-base/src/main/docs/simple-language.adoc 
b/core/camel-base/src/main/docs/simple-language.adoc
index 52fdee0..1c5abcd 100644
--- a/core/camel-base/src/main/docs/simple-language.adoc
+++ b/core/camel-base/src/main/docs/simple-language.adoc
@@ -193,10 +193,6 @@ Specifying a method name you must use dot as separator. We 
also support
 the ?method=methodname syntax that is used by the 
xref:bean-component.adoc[Bean]
 component.
 
-|properties-location:_http://locationskey[locations:key]_ |String |Lookup a 
property with the given key. The `locations`
-option is optional. See more at
-Using PropertyPlaceholder.
-
 |`properties:key:default` |String |Lookup a property with the given key. If 
the key does
 not exists or has no value, then an optional default value can be
 specified.
diff --git 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
index 379e383..dc4f22e 100644
--- 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
+++ 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
@@ -484,9 +484,7 @@ public abstract class AbstractCamelContext extends 
ServiceSupport implements Ext
             if (component != null && created.get() && autoStart && 
(isStarted() || isStarting())) {
                 // If the component is looked up after the context is started,
                 // lets start it up.
-                if (component instanceof Service) {
-                    startService((Service)component);
-                }
+                startService(component);
             }
 
             return component;
diff --git 
a/core/camel-base/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
 
b/core/camel-base/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
index ed4ce03..c0a0575 100644
--- 
a/core/camel-base/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
+++ 
b/core/camel-base/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
@@ -220,26 +220,7 @@ public class SimpleFunctionExpression extends 
LiteralExpression {
                 defaultValue = parts[1];
             }
             String key = parts[0];
-            return ExpressionBuilder.propertiesComponentExpression(key, null, 
defaultValue);
-        }
-
-        // properties-location: prefix
-        remainder = ifStartsWithReturnRemainder("properties-location:", 
function);
-        if (remainder != null) {
-            String[] parts = remainder.split(":");
-            if (parts.length > 3) {
-                throw new SimpleParserException("Valid syntax: 
${properties-location:location:key[:default]} was: " + function, 
token.getIndex());
-            }
-            String defaultValue = null;
-            if (parts.length >= 3) {
-                defaultValue = parts[2];
-            }
-            String key = null;
-            if (parts.length >= 2) {
-                key = parts[1];
-            }
-            String locations = parts[0];
-            return ExpressionBuilder.propertiesComponentExpression(key, 
locations, null);
+            return ExpressionBuilder.propertiesComponentExpression(key, 
defaultValue);
         }
 
         // ref: prefix
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDefaultTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDefaultTest.java
deleted file mode 100644
index 34b6432..0000000
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentDefaultTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.io.FileNotFoundException;
-import java.io.IOError;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.ResolveEndpointFailedException;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-
-public class PropertiesComponentDefaultTest extends ContextTestSupport {
-
-    @Test
-    public void testPropertiesComponentDefault() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:bar.end?locations=org/apache/camel/component/properties/bar.properties");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:bar").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentDefaultNoFileFound() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:bar.end?locations=org/apache/camel/component/properties/unknown.properties");
-            }
-        });
-        try {
-            context.start();
-            fail("Should throw exception");
-        } catch (Exception e) {
-            ResolveEndpointFailedException cause = 
assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
-            RuntimeCamelException rce = 
assertIsInstanceOf(RuntimeCamelException.class, cause.getCause());
-            FileNotFoundException fnfe = 
assertIsInstanceOf(FileNotFoundException.class, rce.getCause());
-            assertEquals("Properties file 
org/apache/camel/component/properties/unknown.properties not found in 
classpath", fnfe.getMessage());
-        }
-    }
-
-    @Test
-    public void testIgnoreMissingPropertyFilesOnClasspath() throws Exception {
-        System.setProperty("bar.end", "mock:bar");
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:bar.end?locations=org/apache/camel/component/properties/unknown.properties&ignoreMissingLocation=true");
-            }
-        });
-        context.start();
-        getMockEndpoint("mock:bar").expectedMessageCount(1);
-        template.sendBody("direct:start", "Hello World");
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testIgnoreMissingPropertyFilesFromRegistry() throws Exception {
-        System.setProperty("bar.end", "mock:bar");
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:bar.end?locations=ref:unknown.properties&ignoreMissingLocation=true");
-            }
-        });
-        context.start();
-        getMockEndpoint("mock:bar").expectedMessageCount(1);
-        template.sendBody("direct:start", "Hello World");
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testIgnoreMissingPropertyFilesFromFilePath() throws Exception {
-        System.setProperty("bar.end", "mock:bar");
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:bar.end?locations=file:unknown.properties&ignoreMissingLocation=true");
-            }
-        });
-        context.start();
-        getMockEndpoint("mock:bar").expectedMessageCount(1);
-        template.sendBody("direct:start", "Hello World");
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testIgnoreMissingPropertySystemPropertyOnClasspath() throws 
Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:bar.end?locations=${my.home}/unknown.properties,org/apache/camel/component/properties/bar.properties"
-                        + "&ignoreMissingLocation=true");
-            }
-        });
-        context.start();
-        getMockEndpoint("mock:bar").expectedMessageCount(1);
-        template.sendBody("direct:start", "Hello World");
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testNotIgnoreMissingPropertySystemPropertyOnClasspath() throws 
Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:bar.end?locations=${my.home}/unknown.properties,org/apache/camel/component/properties/bar.properties"
-                        + "&ignoreMissingLocation=false");
-            }
-        });
-        try {
-            context.start();
-            fail("Should have thrown exception");
-        } catch (Exception e) {
-            assertEquals("Cannot find JVM system property with key: my.home", 
e.getCause().getCause().getMessage());
-        }
-    }
-
-    @Override
-    public boolean isUseRouteBuilder() {
-        return false;
-    }
-}
\ No newline at end of file
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentGetOrElseTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentGetOrElseTest.java
deleted file mode 100644
index 351a9b0..0000000
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentGetOrElseTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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 org.apache.camel.CamelContext;
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-
-public class PropertiesComponentGetOrElseTest extends ContextTestSupport {
-
-    @Override
-    public boolean isUseRouteBuilder() {
-        return false;
-    }
-
-    @Test
-    public void testPropertiesComponentFoundKey() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:{{cool.end:mock:wrong}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentUseDefaultValue() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:{{unknown:mock:result}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentSimpleLanguage() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                        .transform().simple("Hi ${body} do you think 
${properties:cool.name} rocks?");
-            }
-        });
-        context.start();
-
-        String reply = template.requestBody("direct:start", "Claus", 
String.class);
-        assertEquals("Hi Claus do you think Camel rocks?", reply);
-    }
-
-    @Test
-    public void testPropertiesComponentSimpleLanguageUsingDefaultValue() 
throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                        .transform().simple("Hi ${body} do you think 
${properties:unknown:Beer} rocks?");
-            }
-        });
-        context.start();
-
-        String reply = template.requestBody("direct:start", "Claus", 
String.class);
-        assertEquals("Hi Claus do you think Beer rocks?", reply);
-    }
-
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext context = super.createCamelContext();
-        context.addComponent("properties", new 
PropertiesComponent("classpath:org/apache/camel/component/properties/myproperties.properties"));
-        return context;
-    }
-
-}
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLoadPropertiesFromFileTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLoadPropertiesFromFileTest.java
deleted file mode 100644
index 11d66af..0000000
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLoadPropertiesFromFileTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 org.apache.camel.CamelContext;
-
-public class PropertiesComponentLoadPropertiesFromFileTest extends 
PropertiesComponentTest {
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext context = super.createCamelContext();
-
-        // remove created from super
-        context.removeComponent("properties");
-
-        PropertiesComponent pc = new PropertiesComponent();
-        pc.setLocations(new 
String[]{"file:./src/test/resources/org/apache/camel/component/properties/myproperties.properties"});
-        context.addComponent("properties", pc);
-
-        return context;
-    }
-
-}
\ No newline at end of file
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLoadPropertiesTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLoadPropertiesTest.java
index c1d8c13..eb9f163 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLoadPropertiesTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLoadPropertiesTest.java
@@ -16,9 +16,7 @@
  */
 package org.apache.camel.component.properties;
 
-import java.util.Iterator;
 import java.util.Properties;
-import java.util.Set;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
@@ -45,36 +43,6 @@ public class PropertiesComponentLoadPropertiesTest extends 
ContextTestSupport {
         assertEquals("10", prop.getProperty("myQueueSize"));
     }
 
-    @Test
-    public void testLoadPropertiesLocation() throws Exception {
-        context.start();
-
-        org.apache.camel.spi.PropertiesComponent pc = 
context.getPropertiesComponent();
-        Properties prop = pc.loadProperties("application.properties", 
"example.properties");
-
-        assertNotNull(prop);
-        assertEquals(5, prop.size());
-
-        assertEquals("World", prop.getProperty("hello"));
-        assertEquals("2000", prop.getProperty("millisecs"));
-
-        // should be ordered keys
-        Iterator it = prop.keySet().iterator();
-        assertEquals("hello", it.next());
-        assertEquals("camel.component.seda.concurrent-consumers", it.next());
-        assertEquals("camel.component.seda.queueSize", it.next());
-        assertEquals("camel.component.direct.timeout", it.next());
-        assertEquals("millisecs", it.next());
-
-        // should be ordered values
-        it = prop.values().iterator();
-        assertEquals("World", it.next());
-        assertEquals("2", it.next());
-        assertEquals("500", it.next());
-        assertEquals("1234", it.next());
-        assertEquals("2000", it.next());
-    }
-
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext context = super.createCamelContext();
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLocationWithJvmPropertyTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLocationWithJvmPropertyTest.java
deleted file mode 100644
index 6f1b7e5..0000000
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLocationWithJvmPropertyTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 org.apache.camel.CamelContext;
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.After;
-import org.junit.Test;
-
-public class PropertiesComponentLocationWithJvmPropertyTest extends 
ContextTestSupport {
-
-    @Test
-    public void testProperty() throws Exception {
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:cool.end");
-            }
-        };
-    }
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext context = super.createCamelContext();
-
-        System.setProperty("propFile", "myproperties.properties");
-        context.addComponent("properties", new 
PropertiesComponent("classpath:org/apache/camel/component/properties/${propFile}"));
-
-        return context;
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-        super.tearDown();
-        System.clearProperty("propFile");
-    }
-}
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLocationWithTwoJvmPropertyTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLocationWithTwoJvmPropertyTest.java
deleted file mode 100644
index 8377486..0000000
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentLocationWithTwoJvmPropertyTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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 org.apache.camel.CamelContext;
-import org.junit.After;
-
-public class PropertiesComponentLocationWithTwoJvmPropertyTest extends 
PropertiesComponentLocationWithJvmPropertyTest {
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext context = super.createCamelContext();
-
-        System.setProperty("propPath", 
"org/apache/camel/component/properties");
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        pc.setLocation("classpath:${propPath}/${propFile}");
-
-        return context;
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-        super.tearDown();
-        System.clearProperty("propPath");
-    }
-}
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentSimpleLanguageTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentSimpleLanguageTest.java
index 30c4be2..f84b418 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentSimpleLanguageTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentSimpleLanguageTest.java
@@ -17,9 +17,7 @@
 package org.apache.camel.component.properties;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.CamelExecutionException;
 import org.apache.camel.ContextTestSupport;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
 
@@ -60,76 +58,6 @@ public class PropertiesComponentSimpleLanguageTest extends 
ContextTestSupport {
         assertEquals("Hi Claus do you think Camel rocks? And do you like Gouda 
cheese?", reply);
     }
 
-    @Test
-    public void testPropertiesComponentSimpleLanguageWithLocations() throws 
Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                    .transform().simple("Hi ${body}. 
${properties-location:org/apache/camel/component/properties/bar.properties:bar.quote}.");
-            }
-        });
-        context.start();
-
-        String reply = template.requestBody("direct:start", "Claus", 
String.class);
-        assertEquals("Hi Claus. Beer taste good.", reply);
-    }
-
-    @Test
-    public void testNoExistingPropertiesComponentWithLocation() throws 
Exception {
-        context.removeComponent("properties");
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                    .transform().simple("Hi ${body}. 
${properties-location:org/apache/camel/component/properties/bar.properties:bar.quote}.");
-            }
-        });
-        context.start();
-
-        String reply = template.requestBody("direct:start", "Claus", 
String.class);
-        assertEquals("Hi Claus. Beer taste good.", reply);
-    }
-
-    @Test
-    public void testNoExistingPropertiesComponentWithLocations() throws 
Exception {
-        context.removeComponent("properties");
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                    .transform().simple("Hi ${body}. 
${properties-location:org/apache/camel/component/properties/bar.properties,"
-                        + 
"org/apache/camel/component/properties/cheese.properties:cheese.quote}.");
-            }
-        });
-        context.start();
-
-        String reply = template.requestBody("direct:start", "Claus", 
String.class);
-        assertEquals("Hi Claus. Camel rocks.", reply);
-    }
-
-    @Test
-    public void testNoExistingPropertiesComponentWithoutLocation() throws 
Exception {
-        context.removeComponent("properties");
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                    .transform().simple("Hi ${body} do you think 
${properties:cheese.quote}?");
-            }
-        });
-        context.start();
-
-        try {
-            template.requestBody("direct:start", "Claus", String.class);
-            fail("Should have thrown exception");
-        } catch (CamelExecutionException e) {
-            RuntimeCamelException rce = 
assertIsInstanceOf(RuntimeCamelException.class, e.getCause());
-            IllegalArgumentException iae = 
assertIsInstanceOf(IllegalArgumentException.class, rce.getCause());
-            assertEquals("PropertiesComponent with name properties must be 
defined in CamelContext to support property placeholders in expressions", 
iae.getMessage());
-        }
-    }
-
     @Override
     protected CamelContext createCamelContext() throws Exception {
         CamelContext context = super.createCamelContext();
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentTest.java
deleted file mode 100644
index 8374138..0000000
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentTest.java
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- * 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 org.apache.camel.CamelContext;
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.ResolveEndpointFailedException;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.Test;
-
-public class PropertiesComponentTest extends ContextTestSupport {
-
-    @Override
-    public boolean isUseRouteBuilder() {
-        return false;
-    }
-
-    @Test
-    public void testPropertiesComponent() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:{{cool.end}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentTwo() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:{{cool.end}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(2);
-
-        template.sendBody("direct:start", "Hello World");
-        template.sendBody("direct:start", "Bye World");
-
-        assertMockEndpointsSatisfied();
-    }
-    
-    @Test
-    public void testPropertiesComponentCustomTokens() throws Exception {
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        pc.setPrefixToken("[[");
-        pc.setSuffixToken("]]");
-        
-        assertEquals("[[", pc.getPrefixToken());
-        assertEquals("]]", pc.getSuffixToken());
-        
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:[[cool.end]]");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-        
-        pc.setPrefixToken(null);
-        pc.setSuffixToken(null);
-        
-        assertEquals(PropertiesComponent.DEFAULT_PREFIX_TOKEN, 
pc.getPrefixToken());
-        assertEquals(PropertiesComponent.DEFAULT_SUFFIX_TOKEN, 
pc.getSuffixToken());
-    }
-
-    @Test
-    public void testPropertiesComponentTemplate() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:cool").to("mock:result");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(2);
-
-        template.sendBody("{{cool.start}}", "Hello World");
-        template.sendBody("{{cool.start}}", "Bye World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentResult() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:mock:{{cool.result}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentMockMock() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:{{cool.mock}}:{{cool.mock}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:mock").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentConcat() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:cool.concat");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentLocationOverride() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:{{bar.end}}?locations=org/apache/camel/component/properties/bar.properties");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:bar").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentLocationsOverride() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:start").to("properties:bar.end?locations=org/apache/camel/component/properties/bar.properties");
-                
from("direct:cheese").to("properties:cheese.end?locations=org/apache/camel/component/properties/bar.properties,"
-                        + 
"classpath:org/apache/camel/component/properties/cheese.properties");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:bar").expectedMessageCount(1);
-        getMockEndpoint("mock:cheese").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-        template.sendBody("direct:cheese", "Hello Cheese");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentInvalidKey() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:{{foo.unknown}}");
-            }
-        });
-        try {
-            context.start();
-            fail("Should throw exception");
-        } catch (Exception e) {
-            ResolveEndpointFailedException cause = 
assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
-            IllegalArgumentException iae = 
assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
-            assertEquals("Property with key [foo.unknown] not found in 
properties from text: {{foo.unknown}}", iae.getMessage());
-        }
-    }
-
-    @Test
-    public void testPropertiesComponentCircularReference() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:cool.a");
-            }
-        });
-        try {
-            context.start();
-            fail("Should throw exception");
-        } catch (Exception e) {
-            ResolveEndpointFailedException cause = 
assertIsInstanceOf(ResolveEndpointFailedException.class, e.getCause());
-            IllegalArgumentException iae = 
assertIsInstanceOf(IllegalArgumentException.class, cause.getCause());
-            assertEquals("Circular reference detected with key [cool.a] from 
text: {{cool.a}}", iae.getMessage());
-        }
-    }
-
-    @Test
-    public void testPropertiesComponentCacheDefault() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                // properties component can also have {{ }} around but its not 
needed
-                from("direct:start").to("properties:{{cool.end}}");
-                from("direct:foo").to("properties:mock:{{cool.result}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(2);
-
-        template.sendBody("direct:start", "Hello World");
-        template.sendBody("direct:foo", "Hello Foo");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentCacheDisabled() throws Exception {
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        pc.setCache(false);
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").to("properties:cool.end");
-                from("direct:foo").to("properties:mock:{{cool.result}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(2);
-
-        template.sendBody("direct:start", "Hello World");
-        template.sendBody("direct:foo", "Hello Foo");
-
-        assertMockEndpointsSatisfied();
-    }
-    
-    @Test
-    public void testJvmSystemPropertyNotFound() throws Exception {
-        try {
-            context.addRoutes(new RouteBuilder() {
-                @Override
-                public void configure() throws Exception {
-                    
from("direct:start").to("properties:xxx?locations=foo/${xxx}");
-                }
-            });
-            context.start();
-            fail("Should thrown an exception");
-        } catch (Exception e) {
-            IllegalArgumentException cause = 
assertIsInstanceOf(IllegalArgumentException.class, e.getCause().getCause());
-            assertEquals("Cannot find JVM system property with key: xxx", 
cause.getMessage());
-        }
-    }
-
-    @Test
-    public void testCache() throws Exception {
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        assertTrue(pc.isCache());
-        assertNotNull(pc);
-
-        for (int i = 0; i < 2000; i++) {
-            String uri = pc.parseUri("{{cool.mock}}:" + i);
-            assertEquals("mock:" + i, uri);
-        }
-    }
-
-    @Test
-    public void testCacheRoute() throws Exception {
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start")
-                    .setBody(simple("${properties:cool.mock}${body}"))
-                    .to("mock:result");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(2000);
-
-        for (int i = 0; i < 2000; i++) {
-            template.sendBody("direct:start", i);
-        }
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testQuotedPrefix() throws Exception {
-        assertEquals("mock", 
context.resolvePropertyPlaceholders("{{cool.mock}}"));
-        assertEquals("'{{' + something + '}}'", 
context.resolvePropertyPlaceholders("'{{' + something + '}}'"));
-        assertEquals("\"{{\" + something + \"}}\"", 
context.resolvePropertyPlaceholders("\"{{\" + something + \"}}\""));
-        assertEquals("mock'", 
context.resolvePropertyPlaceholders("{{cool.mock}}'"));
-        assertEquals("mock\"", 
context.resolvePropertyPlaceholders("{{cool.mock}}\""));
-        assertEquals("'mock", 
context.resolvePropertyPlaceholders("'{{cool.mock}}"));
-        assertEquals("\"mock", 
context.resolvePropertyPlaceholders("\"{{cool.mock}}"));
-    }
-
-    @Test
-    public void testPropertiesComponentOverride() throws Exception {
-        System.setProperty("cool.result", "bar");
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        
pc.setSystemPropertiesMode(PropertiesComponent.SYSTEM_PROPERTIES_MODE_OVERRIDE);
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:foo").to("mock:{{cool.result}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(0);
-        getMockEndpoint("mock:bar").expectedMessageCount(1);
-
-        template.sendBody("direct:foo", "Hello Foo");
-
-        assertMockEndpointsSatisfied();
-
-        System.clearProperty("cool.result");
-    }
-
-    @Test
-    public void testPropertiesComponentFallback() throws Exception {
-        System.setProperty("cool.result", "bar");
-        System.setProperty("beer", "Carlsberg");
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        
pc.setSystemPropertiesMode(PropertiesComponent.SYSTEM_PROPERTIES_MODE_FALLBACK);
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:foo").to("mock:{{beer}}").to("mock:{{cool.result}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-        getMockEndpoint("mock:bar").expectedMessageCount(0);
-        getMockEndpoint("mock:Carlsberg").expectedMessageCount(1);
-
-        template.sendBody("direct:foo", "Hello Foo");
-
-        assertMockEndpointsSatisfied();
-
-        System.clearProperty("cool.result");
-        System.clearProperty("beer");
-    }
-
-    @Test
-    public void testPropertiesComponentNever() throws Exception {
-        System.setProperty("cool.result", "bar");
-        System.setProperty("beer", "Carlsberg");
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        
pc.setSystemPropertiesMode(PropertiesComponent.SYSTEM_PROPERTIES_MODE_NEVER);
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                
from("direct:foo").to("mock:{{beer}}").to("mock:{{cool.result}}");
-            }
-        });
-        try {
-            context.start();
-            fail("Should have thrown exception");
-        } catch (Exception e) {
-            assertEquals("Property with key [beer] not found in properties 
from text: mock:{{beer}}", e.getCause().getMessage());
-        }
-
-        System.clearProperty("cool.result");
-        System.clearProperty("beer");
-    }
-
-    @Test
-    public void testPropertiesComponentEnvOverride() throws Exception {
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        
pc.setEnvironmentVariableMode(PropertiesComponent.ENVIRONMENT_VARIABLES_MODE_OVERRIDE);
-        pc.setLocation("org/apache/camel/component/properties/env.properties");
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:foo").to("mock:{{FOO_SERVICE_HOST}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:hello").expectedMessageCount(0);
-        getMockEndpoint("mock:myserver").expectedMessageCount(1);
-
-        template.sendBody("direct:foo", "Hello Foo");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentEnvOverrideIfDash() throws Exception {
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        
pc.setEnvironmentVariableMode(PropertiesComponent.ENVIRONMENT_VARIABLES_MODE_OVERRIDE);
-        pc.setLocation("org/apache/camel/component/properties/env.properties");
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                // will fallback and lookup as FOO_SERVICE_HOST
-                from("direct:foo").to("mock:{{FOO-SERVICE_host}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:hello").expectedMessageCount(0);
-        getMockEndpoint("mock:myserver").expectedMessageCount(1);
-
-        template.sendBody("direct:foo", "Hello Foo");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentEnvFallback() throws Exception {
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        
pc.setEnvironmentVariableMode(PropertiesComponent.ENVIRONMENT_VARIABLES_MODE_FALLBACK);
-        pc.setLocation("org/apache/camel/component/properties/env.properties");
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:foo").to("mock:{{FOO_SERVICE_PORT}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:8081").expectedMessageCount(1);
-        getMockEndpoint("mock:hello").expectedMessageCount(0);
-        getMockEndpoint("mock:myserver").expectedMessageCount(0);
-
-        template.sendBody("direct:foo", "Hello Foo");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Test
-    public void testPropertiesComponentEnvNever() throws Exception {
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        
pc.setEnvironmentVariableMode(PropertiesComponent.ENVIRONMENT_VARIABLES_MODE_NEVER);
-        pc.setLocation("org/apache/camel/component/properties/env.properties");
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:foo").to("mock:{{UNKNOWN}}");
-            }
-        });
-        try {
-            context.start();
-            fail("Should have thrown exception");
-        } catch (Exception e) {
-            assertEquals("Property with key [UNKNOWN] not found in properties 
from text: mock:{{UNKNOWN}}", e.getCause().getMessage());
-        }
-    }
-
-    @Test
-    public void testPropertiesComponentEnvFallbackJvmOverride() throws 
Exception {
-        PropertiesComponent pc = context.getComponent("properties", 
PropertiesComponent.class);
-        
pc.setEnvironmentVariableMode(PropertiesComponent.ENVIRONMENT_VARIABLES_MODE_FALLBACK);
-        pc.setLocation("org/apache/camel/component/properties/env.properties");
-
-        // lets override the OS environment variable by setting a JVM system 
property
-        System.setProperty("FOO_SERVICE_PORT", "hello");
-
-        context.addRoutes(new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:foo").to("mock:{{FOO_SERVICE_PORT}}");
-            }
-        });
-        context.start();
-
-        getMockEndpoint("mock:8081").expectedMessageCount(0);
-        getMockEndpoint("mock:hello").expectedMessageCount(1);
-        getMockEndpoint("mock:myserver").expectedMessageCount(0);
-
-        template.sendBody("direct:foo", "Hello Foo");
-
-        assertMockEndpointsSatisfied();
-
-        System.clearProperty("FOO_SERVICE_PORT");
-    }
-
-
-    @Test
-    public void testCamelProperties() throws Exception {
-        context.getGlobalOptions().put("foo", "Hello {{cool.name}}");
-        context.getGlobalOptions().put("bar", "cool.name");
-
-        context.start();
-
-        assertEquals("Hello Camel", context.getGlobalOptions().get("foo"));
-        assertEquals("cool.name", context.getGlobalOptions().get("bar"));
-    }
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        CamelContext context = super.createCamelContext();
-        context.addComponent("properties", new 
PropertiesComponent("classpath:org/apache/camel/component/properties/myproperties.properties"));
-        return context;
-    }
-
-}
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
index 99d59e0..97684b1 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/DefaultComponent.java
@@ -34,6 +34,7 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.ResolveEndpointFailedException;
 import org.apache.camel.component.extension.ComponentExtension;
 import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.PropertiesComponent;
 import org.apache.camel.support.service.ServiceSupport;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.URISupport;
@@ -338,7 +339,7 @@ public abstract class DefaultComponent extends 
ServiceSupport implements Compone
 
         if (isResolvePropertyPlaceholders()) {
             // only resolve property placeholders if its in use
-            Component existing = camelContext.getPropertiesComponent(false);
+            PropertiesComponent existing = 
camelContext.getPropertiesComponent(false);
             if (existing != null) {
                 log.debug("Resolving property placeholders on component: {}", 
this);
                 
PropertyPlaceholdersHelper.resolvePropertyPlaceholders(camelContext, this);
diff --git 
a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
 
b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
index f4f2744..e38eb61 100644
--- 
a/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
+++ 
b/core/camel-support/src/main/java/org/apache/camel/support/builder/ExpressionBuilder.java
@@ -1546,29 +1546,19 @@ public class ExpressionBuilder {
         return constantExpression(str);
     }
 
-    public static Expression propertiesComponentExpression(final String key, 
final String locations, final String defaultValue) {
+    public static Expression propertiesComponentExpression(final String key, 
final String defaultValue) {
         return new ExpressionAdapter() {
             public Object evaluate(Exchange exchange) {
                 String text = simpleExpression(key).evaluate(exchange, 
String.class);
-                String text2 = simpleExpression(locations).evaluate(exchange, 
String.class);
                 try {
-                    if (text2 != null) {
-                        // the properties component is optional as we got 
locations
-                        // getComponent will create a new component if none 
already exists
-                        PropertiesComponent pc = 
exchange.getContext().getPropertiesComponent(true);
-                        // enclose key with {{ }} to force parsing
-                        String[] paths = text2.split(",");
-                        return pc.parseUri(pc.getPrefixToken() + text + 
pc.getSuffixToken(), paths);
-                    } else {
-                        // the properties component is mandatory if no 
locations provided
-                        PropertiesComponent pc = 
exchange.getContext().getPropertiesComponent(false);
-                        if (pc == null) {
-                            throw new 
IllegalArgumentException("PropertiesComponent with name properties must be 
defined"
-                                + " in CamelContext to support property 
placeholders in expressions");
-                        }
-                        // enclose key with {{ }} to force parsing
-                        return pc.parseUri(pc.getPrefixToken() + text + 
pc.getSuffixToken());
+                    // the properties component is mandatory if no locations 
provided
+                    PropertiesComponent pc = 
exchange.getContext().getPropertiesComponent(false);
+                    if (pc == null) {
+                        throw new 
IllegalArgumentException("PropertiesComponent with name properties must be 
defined"
+                            + " in CamelContext to support property 
placeholders in expressions");
                     }
+                    // enclose key with {{ }} to force parsing
+                    return pc.parseUri(pc.getPrefixToken() + text + 
pc.getSuffixToken());
                 } catch (Exception e) {
                     // property with key not found, use default value if 
provided
                     if (defaultValue != null) {

Reply via email to