This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch properties
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 2d519713c418b95b33a19c282bfcce7e1c680a82
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Jul 3 09:05:58 2019 +0200

    CAMEL-13720: Properties component - Remove complexity of augemented 
properties parser
---
 MIGRATION.md                                       |  4 ++
 .../spi/BridgePropertyPlaceholderConfigurer.java   |  2 +-
 .../properties/SpringPropertiesComponent2Test.xml  |  9 ++--
 .../SpringPropertiesComponentCacheDisabledTest.xml | 10 ++--
 .../BlueprintAugmentedPropertiesFallbackTest.java  | 50 --------------------
 ...BlueprintAugmentedPropertiesNoFallbackTest.java | 55 ----------------------
 .../blueprint/augmented-properties-fallback.xml    | 50 --------------------
 .../blueprint/augmented-properties-no-fallback.xml | 50 --------------------
 8 files changed, 14 insertions(+), 216 deletions(-)

diff --git a/MIGRATION.md b/MIGRATION.md
index 2e075da..7ceaf02 100644
--- a/MIGRATION.md
+++ b/MIGRATION.md
@@ -87,6 +87,10 @@ Migrating Camel applications
 
 The Camel `Main` class has been moved out of `camel-core` into `camel-main` so 
you should add that as dependency if you use Main.
 
+### Properties component
+
+The `properties` component has some advanced options removed: 
`propertyPrefix`, `propertySuffix`, and `fallbackToUnaugmented`; these options 
was never really useable for end users anyway.
+
 ### Removed components
 
 We have removed all deprecated components from Camel 2.x, also including the 
old `camel-http` component. Instead you can use `camel-http4`.
diff --git 
a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
 
b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
index 4257147..22407f2 100644
--- 
a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
+++ 
b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/BridgePropertyPlaceholderConfigurer.java
@@ -158,7 +158,7 @@ public class BridgePropertyPlaceholderConfigurer extends 
PropertyPlaceholderConf
     @Override
     public String parseUri(String text, PropertiesLookup properties, String 
prefixToken, String suffixToken, boolean fallback) throws 
IllegalArgumentException {
         // first let Camel parse the text as it may contain Camel placeholders
-        String answer = parser.parseUri(text, properties, prefixToken, 
suffixToken, false);
+        String answer = parser.parseUri(text, properties, prefixToken, 
suffixToken, fallback);
 
         // then let Spring parse it to resolve any Spring placeholders
         if (answer != null) {
diff --git 
a/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesComponent2Test.xml
 
b/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesComponent2Test.xml
index c4f09d6..5a277e1 100644
--- 
a/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesComponent2Test.xml
+++ 
b/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesComponent2Test.xml
@@ -30,27 +30,26 @@
                              
location="classpath:org/apache/camel/component/properties/cheese.properties"
                              prefixToken="[["
                              suffixToken="]]"
-                             propertyPrefix="cool."
                              xmlns="http://camel.apache.org/schema/spring"/>
 
         <route>
             <from uri="direct:start"/>
-            <to uri="properties:[[end]]"/>
+            <to uri="properties:[[cool.end]]"/>
         </route>
 
         <route>
             <from uri="direct:bar"/>
-            <to uri="properties:mock:[[bar]]"/>
+            <to uri="properties:mock:[[cool.bar]]"/>
         </route>
 
         <route>
             <from uri="direct:start2"/>
-            <to uri="[[end]]"/>
+            <to uri="[[cool.end]]"/>
         </route>
 
         <route>
             <from uri="direct:bar2"/>
-            <to uri="mock:[[bar]]"/>
+            <to uri="mock:[[cool.bar]]"/>
         </route>
     </camelContext>
 
diff --git 
a/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesComponentCacheDisabledTest.xml
 
b/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesComponentCacheDisabledTest.xml
index da674b3..2759551 100644
--- 
a/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesComponentCacheDisabledTest.xml
+++ 
b/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringPropertiesComponentCacheDisabledTest.xml
@@ -25,26 +25,26 @@
   <camelContext xmlns="http://camel.apache.org/schema/spring";>
 
     <propertyPlaceholder id="properties" 
location="classpath:org/apache/camel/component/properties/cheese.properties"
-      cache="false" prefixToken="[[" suffixToken="]]" propertyPrefix="cool." 
xmlns="http://camel.apache.org/schema/spring"; />
+      cache="false" prefixToken="[[" suffixToken="]]" 
xmlns="http://camel.apache.org/schema/spring"; />
 
     <route>
       <from uri="direct:start" />
-      <to uri="properties:[[end]]" />
+      <to uri="properties:[[cool.end]]" />
     </route>
 
     <route>
       <from uri="direct:bar" />
-      <to uri="properties:mock:[[bar]]" />
+      <to uri="properties:mock:[[cool.bar]]" />
     </route>
 
     <route>
       <from uri="direct:start2" />
-      <to uri="[[end]]" />
+      <to uri="[[cool.end]]" />
     </route>
 
     <route>
       <from uri="direct:bar2" />
-      <to uri="mock:[[bar]]" />
+      <to uri="mock:[[cool.bar]]" />
     </route>
   </camelContext>
 
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
deleted file mode 100644
index 4ae3495..0000000
--- 
a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesFallbackTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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();
-    }
-
-}
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
deleted file mode 100644
index 4bf429c..0000000
--- 
a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesNoFallbackTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.Before;
-
-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
-    @Before
-    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 {
-    }
-
-}
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
deleted file mode 100644
index 8483599..0000000
--- 
a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-fallback.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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>
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
deleted file mode 100644
index 099b6eb..0000000
--- 
a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-no-fallback.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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>

Reply via email to