camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Huston <>
Subject Seeking to understand properties
Date Tue, 15 Nov 2016 22:58:44 GMT
I am struggling to understand something I fear is very basic, but I just don't see it. Hoping
someone can help me understand this.

Properties... I can use them in route definitions, but I don't seem to be able to obtain their
values in regular Java code.

Example (using Camel 2.16.3):

I have a route builder:

public class MyRouteBuilder extends RouteBuilder {
    public void configure() {

And a unit test:

public class UnitTest extends CamelTestSupport {

	private String fileName;

	    protected RouteBuilder createRouteBuilder() {
	    	return new MyRouteBuilder();

	    public Boolean ignoreMissingLocationWithPropertiesComponent() {
	    	return true;

	    protected Properties useOverridePropertiesWithPropertiesComponent() {
		    Properties override = new Properties();
		    override.put("dataFile", "overridden-file");
		    return override;

		public void testPropertyGetting() throws Exception {
	    	fileName = context().getProperty("dataFile");
	    	assert(fileName != null);

When I run this test, the output includes:

INFO  Route: route1 started and consuming from: Endpoint[file://overridden-file?noop=true]

So the override property set above did get filled into the route definition.
However, when I try to get the property in the testPropertyGetting() method, the value is



View raw message