You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/01/15 18:00:46 UTC
svn commit: r1433521 - in /camel/trunk/tests/camel-itest-osgi/src/test:
java/org/apache/camel/itest/osgi/ java/org/apache/camel/itest/osgi/blueprint/
resources/org/apache/camel/itest/osgi/blueprint/
Author: davsclaus
Date: Tue Jan 15 17:00:46 2013
New Revision: 1433521
URL: http://svn.apache.org/viewvc?rev=1433521&view=rev
Log:
CAMEL-5973: Fixed property placeholder with blueprint and delegate not working such as when using jasypt.
Added:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/BlueprintPropertiesJasyptRouteTest.java
- copied, changed from r1433290, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/BlueprintPropertiesRouteTest.java
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-26.xml
- copied, changed from r1433290, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-17.xml
camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/myproperties.properties
- copied, changed from r1433290, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/cheese.properties
Modified:
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
Modified: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java?rev=1433521&r1=1433520&r2=1433521&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/OSGiIntegrationTestSupport.java Tue Jan 15 17:00:46 2013
@@ -26,6 +26,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.osgi.CamelContextFactory;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption;
+import org.openengsb.labs.paxexam.karaf.options.LogLevelOption;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
@@ -36,6 +37,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.logLevel;
import static org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.replaceConfigurationFile;
import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
@@ -139,6 +141,9 @@ public class OSGiIntegrationTestSupport
// override the config.properties (to fix pax-exam bug)
replaceConfigurationFile("etc/config.properties", new File("src/test/resources/org/apache/camel/itest/karaf/config.properties")),
replaceConfigurationFile("etc/custom.properties", new File("src/test/resources/org/apache/camel/itest/karaf/custom.properties")),
+
+ // we need INFO logging otherwise we cannot see what happens
+ logLevel(LogLevelOption.LogLevel.INFO),
// install the cxf jaxb spec as the karaf doesn't provide it by default
scanFeatures(getCamelKarafFeatureUrl(), "cxf-jaxb", "camel-core", "camel-spring", "camel-test")};
Copied: camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/BlueprintPropertiesJasyptRouteTest.java (from r1433290, camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/BlueprintPropertiesRouteTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/BlueprintPropertiesJasyptRouteTest.java?p2=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/BlueprintPropertiesJasyptRouteTest.java&p1=camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/BlueprintPropertiesRouteTest.java&r1=1433290&r2=1433521&rev=1433521&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/BlueprintPropertiesRouteTest.java (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/BlueprintPropertiesJasyptRouteTest.java Tue Jan 15 17:00:46 2013
@@ -33,12 +33,12 @@ import static org.ops4j.pax.swissbox.tin
*
*/
@RunWith(JUnit4TestRunner.class)
-public class BlueprintPropertiesRouteTest extends OSGiBlueprintTestSupport {
+public class BlueprintPropertiesJasyptRouteTest extends OSGiBlueprintTestSupport {
- private String name = BlueprintPropertiesRouteTest.class.getName();
+ private String name = BlueprintPropertiesJasyptRouteTest.class.getName();
@Test
- public void testBlueprintProperties() throws Exception {
+ public void testBlueprintJasyptProperties() throws Exception {
// start bundle
getInstalledBundle(name).start();
@@ -51,13 +51,13 @@ public class BlueprintPropertiesRouteTes
// do our testing
MockEndpoint foo = ctx.getEndpoint("mock:foo", MockEndpoint.class);
foo.expectedMessageCount(1);
- MockEndpoint result = ctx.getEndpoint("mock:result", MockEndpoint.class);
- result.expectedMessageCount(1);
+ MockEndpoint tiger = ctx.getEndpoint("mock:tiger", MockEndpoint.class);
+ tiger.expectedMessageCount(1);
myTemplate.sendBody("direct:start", "Hello World");
foo.assertIsSatisfied();
- result.assertIsSatisfied();
+ tiger.assertIsSatisfied();
myTemplate.stop();
}
@@ -69,13 +69,14 @@ public class BlueprintPropertiesRouteTes
getDefaultCamelKarafOptions(),
bundle(newBundle()
- .add("OSGI-INF/blueprint/test.xml", BlueprintPropertiesRouteTest.class.getResource("blueprint-17.xml"))
- .set(Constants.BUNDLE_SYMBOLICNAME, BlueprintPropertiesRouteTest.class.getName())
+ .add("OSGI-INF/blueprint/test.xml", BlueprintPropertiesJasyptRouteTest.class.getResource("blueprint-26.xml"))
+ .set(Constants.BUNDLE_SYMBOLICNAME, BlueprintPropertiesJasyptRouteTest.class.getName())
.set(Constants.BUNDLE_VERSION, "1.0.0")
+ .set(Constants.DYNAMICIMPORT_PACKAGE, "*")
.build()).noStart(),
// using the features to install the camel components
- loadCamelFeatures("camel-blueprint"));
+ loadCamelFeatures("camel-blueprint", "camel-jasypt"));
return options;
}
Copied: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-26.xml (from r1433290, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-17.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-26.xml?p2=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-26.xml&p1=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-17.xml&r1=1433290&r2=1433521&rev=1433521&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-17.xml (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-26.xml Tue Jan 15 17:00:46 2013
@@ -22,25 +22,31 @@
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
- <!-- OSGI blueprint property placeholder -->
- <cm:property-placeholder id="myblueprint.placeholder" persistent-id="camel.blueprint">
- <!-- list some properties for this test -->
- <cm:default-properties>
- <cm:property name="result" value="mock:result"/>
- </cm:default-properties>
- </cm:property-placeholder>
-
- <camelContext xmlns="http://camel.apache.org/schema/blueprint">
-
- <!-- in the route we can use {{ }} placeholders which will lookup in blueprint
- as Camel will auto detect the OSGi blueprint property placeholder and use it -->
- <route>
- <from uri="direct:start"/>
- <to uri="mock:foo"/>
- <to uri="{{result}}"/>
- </route>
+ <!-- OSGI blueprint property placeholder -->
+ <cm:property-placeholder id="myblueprint.placeholder" persistent-id="camel.blueprint">
+ <cm:default-properties>
+ <cm:property name="cool.password" value="ENC(bsW9uV37gQ0QHFu7KO03Ww==)"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
- </camelContext>
+ <bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
+ <property name="password" value="secret"/>
+ </bean>
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+ <!-- use placeholder, and refer to the jasyp parser so we support the encrypted values -->
+ <propertyPlaceholder id="properties" location="blueprint:myblueprint.placeholder" propertiesParserRef="jasypt"/>
+
+ <!-- in the route we can use {{ }} placeholders which will lookup in blueprint
+ as Camel will auto detect the OSGi blueprint property placeholder and use it -->
+ <route>
+ <from uri="direct:start"/>
+ <to uri="mock:foo"/>
+ <to uri="mock:{{cool.password}}"/>
+ </route>
+
+ </camelContext>
</blueprint>
<!-- END SNIPPET: e1 -->
Copied: camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/myproperties.properties (from r1433290, camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/cheese.properties)
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/myproperties.properties?p2=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/myproperties.properties&p1=camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/cheese.properties&r1=1433290&r2=1433521&rev=1433521&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/cheese.properties (original)
+++ camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/myproperties.properties Tue Jan 15 17:00:46 2013
@@ -15,6 +15,9 @@
## limitations under the License.
## ------------------------------------------------------------------------
-input=direct:start
-max=3
+# refer to a mock endpoint name by that encrypted password
+cool.result=mock:{{cool.password}}
+
+# here is a password which is encrypted
+cool.password=ENC(bsW9uV37gQ0QHFu7KO03Ww==)