You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gg...@apache.org on 2016/07/21 07:13:08 UTC

[1/4] camel git commit: CAMEL-10038: update the expected error message in the test case to match that thrown by DefaultPropertiesParser

Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x 1ac5c475e -> e13c890fa


CAMEL-10038: update the expected error message in the test case to match that thrown by DefaultPropertiesParser

(cherry picked from commit 8c091e874cfef442bcd9b657795632ccb8ef1c6c)
(cherry picked from commit 81374996a94104529b3f7f61a07967eeb2d48058)


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d8ad8365
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d8ad8365
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d8ad8365

Branch: refs/heads/camel-2.17.x
Commit: d8ad8365ed77cf78f525bb898f62fd3e0057874f
Parents: 2ffd8e0
Author: Matthew Zipay <ma...@ninthtest.net>
Authored: Tue Jul 19 15:41:33 2016 -0400
Committer: Grzegorz Grzybek <gr...@gmail.com>
Committed: Thu Jul 21 08:59:57 2016 +0200

----------------------------------------------------------------------
 .../blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d8ad8365/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java
index 260d2e1..63f61c0 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java
@@ -31,7 +31,7 @@ public class ConfigAdminNoDefaultValuesBlueprintCreationTest extends CamelBluepr
             super.setUp();
             fail("Should fail, because Blueprint XML uses property placeholders, but we didn't define any property sources");
         } catch (Exception e) {
-            assertThat(e.getCause().getCause().getMessage(), equalTo("Property placeholder key: destination not found"));
+            assertThat(e.getCause().getCause().getMessage(), equalTo("Property with key [destination] not found in properties from text: {{destination}}"));
         }
     }
 


[2/4] camel git commit: CAMEL-10038 don't throw exception if BlueprintPropertiesParser#parseProperty would return null (breaks fallbackToUnaugmentedProperty behavior, and an exception will be thrown anyway by the parent DefaultPropertiesParser if the val

Posted by gg...@apache.org.
CAMEL-10038 don't throw exception if BlueprintPropertiesParser#parseProperty would return null (breaks fallbackToUnaugmentedProperty behavior, and an exception will be thrown anyway by the parent DefaultPropertiesParser if the value is still null after fallback)

(cherry picked from commit affda62f8654a2862650cdf5142371ebb4649703)
(cherry picked from commit 5127a6598582cb370dd46de6c510d0762695daaa)


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2ffd8e0d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2ffd8e0d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2ffd8e0d

Branch: refs/heads/camel-2.17.x
Commit: 2ffd8e0d83aa3a79c43cb73186fc7fa1ed07ca0a
Parents: 1ac5c47
Author: Zipay, Matthew <mz...@contractor.express.com>
Authored: Wed Jul 13 17:51:15 2016 -0400
Committer: Grzegorz Grzybek <gr...@gmail.com>
Committed: Thu Jul 21 08:59:57 2016 +0200

----------------------------------------------------------------------
 .../org/apache/camel/blueprint/BlueprintPropertiesParser.java    | 4 ----
 1 file changed, 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2ffd8e0d/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 efc5347..c04e31e 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
@@ -160,10 +160,6 @@ public class BlueprintPropertiesParser extends DefaultPropertiesParser {
             }
         }
         
-        if (answer == null) {
-            throw new IllegalArgumentException("Property placeholder key: " + key + " not found");
-        }
-
         log.trace("Returning parsed property key: {} as value: {}", key, answer);
         return answer;
     }


[3/4] camel git commit: CAMEL-10038: added unit test for BlueprintPropertiesParser fallbackToUnaugmentedProperty behavior

Posted by gg...@apache.org.
CAMEL-10038: added unit test for BlueprintPropertiesParser fallbackToUnaugmentedProperty behavior

(cherry picked from commit da85e4c86fc7fdb6156b00aafbaac8c35a0168ca)
(cherry picked from commit 55ee517f05515cf3bb257e67930db8be10c26c90)


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2daec6d1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2daec6d1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2daec6d1

Branch: refs/heads/camel-2.17.x
Commit: 2daec6d13fbe037dc4bbac2a17f04ff659e11317
Parents: d8ad836
Author: Matthew Zipay <ma...@ninthtest.net>
Authored: Wed Jul 20 11:54:27 2016 -0400
Committer: Grzegorz Grzybek <gr...@gmail.com>
Committed: Thu Jul 21 08:59:58 2016 +0200

----------------------------------------------------------------------
 ...lueprintAugmentedPropertiesFallbackTest.java | 50 ++++++++++++++++++++
 .../test/resources/etc/augmented.fallback.cfg   | 23 +++++++++
 .../blueprint/augmented-properties-fallback.xml | 48 +++++++++++++++++++
 3 files changed, 121 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2daec6d1/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesFallbackTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesFallbackTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesFallbackTest.java
new file mode 100644
index 0000000..fa12e13
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesFallbackTest.java
@@ -0,0 +1,50 @@
+/**
+ * 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;
+
+/**
+ * A test showing that Blueprint XML property placeholders work correctly with
+ * augmented property names and fallback behavior.
+ */
+public class BlueprintAugmentedPropertiesFallbackTest extends CamelBlueprintTestSupport {
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/augmented-properties-fallback.xml";
+    }
+
+    @Override
+    protected String[] loadConfigAdminConfigurationFile() {
+        return new String[] {"src/test/resources/etc/augmented.fallback.cfg", "augmented.fallback"};
+    }
+
+    @Test
+    public void testFallbackToUnaugmentedProperty() throws Exception {
+        /*
+         * mock:result only gets the expected body if BlueprintPropertiesParser
+         * correctly fell back from "TEST.destination" to "destination"
+         */
+        getMockEndpoint("mock:result").expectedBodiesReceived("fallbackToUnaugmentedProperty is working");
+
+        template.sendBody("direct:start", null);
+
+        assertMockEndpointsSatisfied();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/2daec6d1/components/camel-test-blueprint/src/test/resources/etc/augmented.fallback.cfg
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/etc/augmented.fallback.cfg b/components/camel-test-blueprint/src/test/resources/etc/augmented.fallback.cfg
new file mode 100644
index 0000000..f6ada0a
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/etc/augmented.fallback.cfg
@@ -0,0 +1,23 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+source = direct:not-from-here
+TEST.source = direct:start
+
+# augmented TEST.destination should fall back to this
+destination = mock:result
+

http://git-wip-us.apache.org/repos/asf/camel/blob/2daec6d1/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-fallback.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-fallback.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-fallback.xml
new file mode 100644
index 0000000..d26d6b9
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-fallback.xml
@@ -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.1.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">
+
+  <!-- blueprint property placeholders -->
+  <cm:property-placeholder id="test-property-placeholder"
+                           persistent-id="augmented.fallback"/>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint"
+                id="test-camelContext"
+                useBlueprintPropertyResolver="true">
+
+    <propertyPlaceholder id="test-propertyPlaceholder"
+                         location="blueprint:test-property-placeholder"
+                         propertyPrefix="TEST."
+                         fallbackToUnaugmentedProperty="true"/>
+
+    <route>
+      <from uri="{{source}}"/>
+      <transform>
+        <simple>fallbackToUnaugmentedProperty is working</simple>
+      </transform>
+      <to uri="{{destination}}"/>
+    </route>
+
+  </camelContext>
+
+</blueprint>


[4/4] camel git commit: [CAMEL-10038] added unit test for BlueprintPropertiesParser fallbackToUnaugmentedProperty=false behavior

Posted by gg...@apache.org.
[CAMEL-10038] added unit test for BlueprintPropertiesParser fallbackToUnaugmentedProperty=false behavior

(cherry picked from commit 1153beb5b5fedbc533a099866b15dd1a380eb99a)


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e13c890f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e13c890f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e13c890f

Branch: refs/heads/camel-2.17.x
Commit: e13c890faf48fd11c3e5f716395edee16457d0fc
Parents: 2daec6d
Author: Grzegorz Grzybek <gr...@gmail.com>
Authored: Thu Jul 21 08:52:30 2016 +0200
Committer: Grzegorz Grzybek <gr...@gmail.com>
Committed: Thu Jul 21 08:59:58 2016 +0200

----------------------------------------------------------------------
 ...eprintAugmentedPropertiesNoFallbackTest.java | 53 ++++++++++++++++++++
 .../resources/etc/augmented.no.fallback.cfg     | 23 +++++++++
 .../augmented-properties-no-fallback.xml        | 48 ++++++++++++++++++
 3 files changed, 124 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e13c890f/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesNoFallbackTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesNoFallbackTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesNoFallbackTest.java
new file mode 100644
index 0000000..4474b7d
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesNoFallbackTest.java
@@ -0,0 +1,53 @@
+/**
+ * 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;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+
+/**
+ * A test showing that Blueprint XML property placeholders work correctly with
+ * augmented property names and fallback behavior.
+ */
+public class BlueprintAugmentedPropertiesNoFallbackTest extends CamelBlueprintTestSupport {
+
+    @Override
+    public void setUp() throws Exception {
+        try {
+            super.setUp();
+            fail("Should fail, because Blueprint XML uses property placeholders, but we didn't resolve the placeholder");
+        } catch (Exception e) {
+            assertThat(e.getCause().getCause().getCause().getMessage(), equalTo("Property with key [TESTYYY.source] not found in properties from text: {{source}}"));
+        }
+    }
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/augmented-properties-no-fallback.xml";
+    }
+
+    @Override
+    protected String[] loadConfigAdminConfigurationFile() {
+        return new String[] {"src/test/resources/etc/augmented.no.fallback.cfg", "augmented.no.fallback"};
+    }
+
+    @Test
+    public void testFallbackToUnaugmentedProperty() throws Exception {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/e13c890f/components/camel-test-blueprint/src/test/resources/etc/augmented.no.fallback.cfg
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/etc/augmented.no.fallback.cfg b/components/camel-test-blueprint/src/test/resources/etc/augmented.no.fallback.cfg
new file mode 100644
index 0000000..4dba59a
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/etc/augmented.no.fallback.cfg
@@ -0,0 +1,23 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+
+source = direct:from-here
+TESTXXX.source = direct:not-from-here
+
+# augmented TEST.destination should fall back to this
+destination = mock:result
+

http://git-wip-us.apache.org/repos/asf/camel/blob/e13c890f/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-no-fallback.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-no-fallback.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-no-fallback.xml
new file mode 100644
index 0000000..5949cd5
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-no-fallback.xml
@@ -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.1.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">
+
+  <!-- blueprint property placeholders -->
+  <cm:property-placeholder id="test-property-placeholder"
+                           persistent-id="augmented.no.fallback"/>
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint"
+                id="test-camelContext"
+                useBlueprintPropertyResolver="true">
+
+    <propertyPlaceholder id="test-propertyPlaceholder"
+                         location="blueprint:test-property-placeholder"
+                         propertyPrefix="TESTYYY."
+                         fallbackToUnaugmentedProperty="false"/>
+
+    <route>
+      <from uri="{{source}}"/>
+      <transform>
+        <simple>fallbackToUnaugmentedProperty is working</simple>
+      </transform>
+      <to uri="{{destination}}"/>
+    </route>
+
+  </camelContext>
+
+</blueprint>