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:11 UTC

svn commit: r1433519 - in /camel/trunk/components/camel-jasypt: ./ src/test/java/org/apache/camel/component/jasypt/ src/test/resources/org/apache/camel/component/jasypt/

Author: davsclaus
Date: Tue Jan 15 17:00:10 2013
New Revision: 1433519

URL: http://svn.apache.org/viewvc?rev=1433519&view=rev
Log:
CAMEL-5973: Fixed property placeholder with blueprint and delegate not working such as when using jasypt.

Added:
    camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.java   (with props)
    camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.java   (with props)
    camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.java
      - copied, changed from r1433290, camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/SpringJasyptPropertiesTest.java
    camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.xml   (with props)
    camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.xml   (with props)
    camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.xml
      - copied, changed from r1433290, camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/SpringJasyptPropertiesTest.xml
Modified:
    camel/trunk/components/camel-jasypt/pom.xml

Modified: camel/trunk/components/camel-jasypt/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jasypt/pom.xml?rev=1433519&r1=1433518&r2=1433519&view=diff
==============================================================================
--- camel/trunk/components/camel-jasypt/pom.xml (original)
+++ camel/trunk/components/camel-jasypt/pom.xml Tue Jan 15 17:00:10 2013
@@ -53,6 +53,11 @@
             <artifactId>camel-test-spring</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-blueprint</artifactId>
+            <scope>test</scope>
+        </dependency>
          <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

Added: camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.java?rev=1433519&view=auto
==============================================================================
--- camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.java (added)
+++ camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.java Tue Jan 15 17:00:10 2013
@@ -0,0 +1,40 @@
+/**
+ * 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.jasypt;
+
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class BlueprintJasyptProperties2Test extends CamelBlueprintTestSupport {
+
+    @Test
+    public void testJasyptProperties() throws Exception {
+        getMockEndpoint("mock:tiger").expectedBodiesReceived("Hello World");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.xml";
+    }
+}

Propchange: camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.java?rev=1433519&view=auto
==============================================================================
--- camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.java (added)
+++ camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.java Tue Jan 15 17:00:10 2013
@@ -0,0 +1,40 @@
+/**
+ * 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.jasypt;
+
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
+import org.junit.Test;
+
+/**
+ * @version 
+ */
+public class BlueprintJasyptProperties3Test extends CamelBlueprintTestSupport {
+
+    @Test
+    public void testJasyptProperties() throws Exception {
+        getMockEndpoint("mock:tiger").expectedBodiesReceived("Hello World");
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.xml";
+    }
+}

Propchange: camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.java (from r1433290, camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/SpringJasyptPropertiesTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.java?p2=camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.java&p1=camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/SpringJasyptPropertiesTest.java&r1=1433290&r2=1433519&rev=1433519&view=diff
==============================================================================
--- camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/SpringJasyptPropertiesTest.java (original)
+++ camel/trunk/components/camel-jasypt/src/test/java/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.java Tue Jan 15 17:00:10 2013
@@ -16,15 +16,13 @@
  */
 package org.apache.camel.component.jasypt;
 
-import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
 import org.junit.Test;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**
  * @version 
  */
-public class SpringJasyptPropertiesTest extends CamelSpringTestSupport {
+public class BlueprintJasyptPropertiesTest extends CamelBlueprintTestSupport {
 
     @Test
     public void testJasyptProperties() throws Exception {
@@ -36,8 +34,7 @@ public class SpringJasyptPropertiesTest 
     }
 
     @Override
-    protected AbstractXmlApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext("org/apache/camel/component/jasypt/SpringJasyptPropertiesTest.xml");
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.xml";
     }
-
 }

Added: camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.xml?rev=1433519&view=auto
==============================================================================
--- camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.xml (added)
+++ camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.xml Tue Jan 15 17:00:10 2013
@@ -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://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+    <!-- define the jasypt properties parser with the given password to be used -->
+    <bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
+        <property name="password" value="secret"/>
+    </bean>
+
+    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+      <!-- define the camel properties placeholder, and let it leverage jasypt -->
+      <propertyPlaceholder id="properties"
+                           location="classpath:org/apache/camel/component/jasypt/myproperties.properties"
+                           propertiesParserRef="jasypt"/>
+        <route>
+            <from uri="direct:start"/>
+            <to uri="{{cool.result}}"/>
+        </route>
+    </camelContext>
+
+</blueprint>

Propchange: camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties2Test.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.xml?rev=1433519&view=auto
==============================================================================
--- camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.xml (added)
+++ camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.xml Tue Jan 15 17:00:10 2013
@@ -0,0 +1,48 @@
+<?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://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <cm:property-placeholder id="myblue" persistent-id="mypersistent">
+      <!-- list some properties for this test -->
+      <cm:default-properties>
+          <cm:property name="cool.result" value="mock:{{cool.password}}"/>
+          <cm:property name="cool.password" value="ENC(bsW9uV37gQ0QHFu7KO03Ww==)"/>
+      </cm:default-properties>
+  </cm:property-placeholder>
+
+    <!-- define the jasypt properties parser with the given password to be used -->
+    <bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
+        <property name="password" value="secret"/>
+    </bean>
+
+    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+      <!-- define the camel properties placeholder, and let it leverage jasypt -->
+      <propertyPlaceholder id="properties"
+                           location="blueprint:myblue"
+                           propertiesParserRef="jasypt"/>
+        <route>
+            <from uri="direct:start"/>
+            <to uri="{{cool.result}}"/>
+        </route>
+    </camelContext>
+
+</blueprint>

Propchange: camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptProperties3Test.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.xml (from r1433290, camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/SpringJasyptPropertiesTest.xml)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.xml?p2=camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.xml&p1=camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/SpringJasyptPropertiesTest.xml&r1=1433290&r2=1433519&rev=1433519&view=diff
==============================================================================
--- camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/SpringJasyptPropertiesTest.xml (original)
+++ camel/trunk/components/camel-jasypt/src/test/resources/org/apache/camel/component/jasypt/BlueprintJasyptPropertiesTest.xml Tue Jan 15 17:00:10 2013
@@ -15,12 +15,11 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-    ">
+<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://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
 
     <!-- START SNIPPET: e1 -->
     <!-- define the jasypt properties parser with the given password to be used -->
@@ -37,11 +36,11 @@
     </bean>
     <!-- END SNIPPET: e1 -->
 
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
         <route>
             <from uri="direct:start"/>
             <to uri="{{cool.result}}"/>
         </route>
     </camelContext>
 
-</beans>
+</blueprint>