You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/07/24 02:44:58 UTC
[1/2] git commit: CAMEL-7630 Updated unit tests for it
Repository: camel
Updated Branches:
refs/heads/master 9f88bcb1d -> 541a3ed8c
CAMEL-7630 Updated unit tests for it
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/541a3ed8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/541a3ed8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/541a3ed8
Branch: refs/heads/master
Commit: 541a3ed8c77ec2cc8a7f1f617c5617e0ce332958
Parents: 07841d5
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Jul 24 08:43:15 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Jul 24 08:44:20 2014 +0800
----------------------------------------------------------------------
tests/camel-blueprint-cxf-test/pom.xml | 18 ++++++++++++++++++
.../camel/test/cxf/blueprint/CxfEndpointBeans.xml | 16 +++++++++++++++-
2 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/541a3ed8/tests/camel-blueprint-cxf-test/pom.xml
----------------------------------------------------------------------
diff --git a/tests/camel-blueprint-cxf-test/pom.xml b/tests/camel-blueprint-cxf-test/pom.xml
index 93728bd..6e5f67c 100644
--- a/tests/camel-blueprint-cxf-test/pom.xml
+++ b/tests/camel-blueprint-cxf-test/pom.xml
@@ -39,6 +39,24 @@
</dependency>
<dependency>
+ <groupId>org.apache.karaf.jaas</groupId>
+ <artifactId>org.apache.karaf.jaas.jasypt</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.servicemix.bundles</groupId>
+ <artifactId>org.apache.servicemix.bundles.jasypt</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>${karaf-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jasypt</groupId>
+ <artifactId>jasypt</artifactId>
+ <version>${jasypt-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<scope>test</scope>
http://git-wip-us.apache.org/repos/asf/camel/blob/541a3ed8/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml
----------------------------------------------------------------------
diff --git a/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml b/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml
index 991d187..cf17a1f 100644
--- a/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml
+++ b/tests/camel-blueprint-cxf-test/src/test/resources/org/apache/camel/test/cxf/blueprint/CxfEndpointBeans.xml
@@ -22,17 +22,20 @@
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:s="http://cxf.apache.org/hello_world_soap_http"
+ xmlns:enc="http://karaf.apache.org/xmlns/jasypt/v1.0.0"
xsi:schemaLocation="
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
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">
+
<!-- blueprint property placeholders -->
<cm:property-placeholder persistent-id="my-placeholders">
<cm:default-properties>
- <cm:property name="router.address" value="http://localhost:9000/routerEndpoint" />
+ <!--cm:property name="router.address" value="http://localhost:9000/routerEndpoint" /-->
+ <cm:property name="router.address" value="ENC(pYMW5lQHCwmrPJvvNb5Nx0+aoaYGymveCroZarDXcNPtQwzP6F2Jj9iBNO9+xGjx)" />
<cm:property name="service.address" value="http://localhost:8000/serviceEndpoint" />
<cm:property name="test.address" value="http://localhost:9000/testEndpoint" />
<cm:property name="bindingId" value="http://schemas.xmlsoap.org/wsdl/soap12/" />
@@ -42,6 +45,17 @@
<cm:property name="wsdlURL" value="wsdl/test.wsdl" />
</cm:default-properties>
</cm:property-placeholder>
+
+ <enc:property-placeholder>
+ <enc:encryptor class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
+ <property name="config">
+ <bean class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
+ <property name="algorithm" value="PBEWithMD5AndDES" />
+ <property name="password" value="password1" />
+ </bean>
+ </property>
+ </enc:encryptor>
+ </enc:property-placeholder>
<cxf:cxfEndpoint id="routerEndpoint" address="{{router.address}}"
serviceClass="org.apache.camel.component.cxf.HelloService"/>
[2/2] git commit: CAMEL-7630 Fixed the BlueprintPropertiesParser
paser issue with multiple PropertyPlaceholders.
Posted by ni...@apache.org.
CAMEL-7630 Fixed the BlueprintPropertiesParser paser issue with multiple PropertyPlaceholders.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/07841d5b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/07841d5b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/07841d5b
Branch: refs/heads/master
Commit: 07841d5be1175be1e9f383497588ff4e29e3008e
Parents: 9f88bcb
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Jul 24 08:42:10 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Jul 24 08:44:20 2014 +0800
----------------------------------------------------------------------
.../blueprint/BlueprintPropertiesParser.java | 29 ++++++++++++--------
1 file changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/07841d5b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesParser.java
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesParser.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesParser.java
index 4069c5f..d1bbde6 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesParser.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintPropertiesParser.java
@@ -122,7 +122,6 @@ public class BlueprintPropertiesParser extends DefaultPropertiesParser {
// lookup key in blueprint and return its value
if (answer == null && key != null) {
for (AbstractPropertyPlaceholder placeholder : placeholders) {
-
boolean isDefault = false;
if (placeholders.size() > 1) {
// okay we have multiple placeholders and we want to return the answer that
@@ -133,28 +132,36 @@ public class BlueprintPropertiesParser extends DefaultPropertiesParser {
}
log.trace("Blueprint property key: {} is part of default properties: {}", key, isDefault);
}
-
- String candidate = (String) ObjectHelper.invokeMethod(method, placeholder, key);
-
- if (candidate != null) {
- if (answer == null || !isDefault) {
- log.trace("Blueprint parsed candidate property key: {} as value: {}", key, answer);
- answer = candidate;
+
+ try {
+ String candidate = (String) ObjectHelper.invokeMethod(method, placeholder, key);
+
+ if (candidate != null) {
+ if (answer == null || !isDefault) {
+ log.trace("Blueprint parsed candidate property key: {} as value: {}", key, answer);
+ answer = candidate;
+ }
}
- }
+ } catch (Exception ex) {
+ // Here we just catch the exception and try to use other candidate
+ }
}
-
log.debug("Blueprint parsed property key: {} as value: {}", key, answer);
}
-
+
// if there is a delegate then let it parse the current answer as it may be jasypt which
// need to decrypt values
if (delegate != null) {
String delegateAnswer = delegate.parseProperty(key, answer != null ? answer : value, properties);
if (delegateAnswer != null) {
answer = delegateAnswer;
+ log.debug("delegate property parser parsed the property key:{} as value: {}", key, answer);
}
}
+
+ if (answer == null) {
+ throw new IllegalArgumentException("Cannot parser the property key: " + key + " with value: " + value);
+ }
log.trace("Returning parsed property key: {} as value: {}", key, answer);
return answer;