Added an unit for load the properties from bean
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c3c94da6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c3c94da6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c3c94da6 Branch: refs/heads/master Commit: c3c94da6afe96a7d6a71b5727d2ad0ac792f8d36 Parents: 2964825 Author: Willem Jiang <[email protected]> Authored: Thu May 23 14:56:52 2013 +0800 Committer: Willem Jiang <[email protected]> Committed: Thu May 23 15:04:03 2013 +0800 ---------------------------------------------------------------------- .../blueprint/LoadPropertiesFromBeansTest.java | 38 ++++++++++++++ .../apache/camel/test/blueprint/MyProperties.java | 30 +++++++++++ .../test/blueprint/loadPropertiesFromBeans.xml | 40 +++++++++++++++ 3 files changed, 108 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/c3c94da6/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/LoadPropertiesFromBeansTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/LoadPropertiesFromBeansTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/LoadPropertiesFromBeansTest.java new file mode 100644 index 0000000..610125a --- /dev/null +++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/LoadPropertiesFromBeansTest.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.test.blueprint; + +import org.junit.Test; + +public class LoadPropertiesFromBeansTest extends CamelBlueprintTestSupport { + + @Override + protected String getBlueprintDescriptor() { + return "org/apache/camel/test/blueprint/loadPropertiesFromBeans.xml"; + } + + @Test + public void testConfigAdmin() throws Exception { + getMockEndpoint("mock:result").expectedBodiesReceived("Hello World"); + + template.sendBody("direct:start", "World"); + + assertMockEndpointsSatisfied(); + } + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c3c94da6/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MyProperties.java ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MyProperties.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MyProperties.java new file mode 100644 index 0000000..092a51a --- /dev/null +++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/MyProperties.java @@ -0,0 +1,30 @@ +/** + * 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; + +public class MyProperties extends Properties { + + private static final long serialVersionUID = -2082205766653164835L; + + public MyProperties() { + setProperty("greeting", "Hello"); + setProperty("destination", "mock:result"); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c3c94da6/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/loadPropertiesFromBeans.xml ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/loadPropertiesFromBeans.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/loadPropertiesFromBeans.xml new file mode 100644 index 0000000..92ea5cf --- /dev/null +++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/loadPropertiesFromBeans.xml @@ -0,0 +1,40 @@ +<?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.0.0" + xsi:schemaLocation=" + http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd + http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> + + + <bean id="vmProperties" class="org.apache.camel.test.blueprint.MyProperties" /> + + <camelContext xmlns="http://camel.apache.org/schema/blueprint"> + <propertyPlaceholder location="ref:vmProperties" /> + <route> + <from uri="direct:start"/> + <transform> + <simple>{{greeting}} ${body}</simple> + </transform> + <to uri="{{destination}}"/> + </route> + + </camelContext> + +</blueprint>
