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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0795250  CAMEL-13432: Simple language - Deprecate and remove change 
its start/end token
0795250 is described below

commit 0795250010e6d0030afd6d4233c6c661d281baa3
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu Apr 18 11:50:35 2019 +0200

    CAMEL-13432: Simple language - Deprecate and remove change its start/end 
token
---
 MIGRATION.md                                       |  4 +
 .../SpringChangeFunctionStartFunctionEndTest.java  | 51 -------------
 .../SpringChangeFunctionStartFunctionEndTest.xml   | 46 ------------
 .../camel/language/simple/SimpleLanguage.java      | 56 --------------
 .../camel/language/simple/SimpleTokenizer.java     | 50 -------------
 .../simple/SimpleChangeFunctionTokensTest.java     | 86 ----------------------
 6 files changed, 4 insertions(+), 289 deletions(-)

diff --git a/MIGRATION.md b/MIGRATION.md
index 504c2af..8d17d14 100644
--- a/MIGRATION.md
+++ b/MIGRATION.md
@@ -161,6 +161,10 @@ also been deprecated in Camel 2.x. In Camel 3 we have 
removed the remaining code
 
 The default JSon library with the JSon dataformat has changed from `XStream` 
to `Jackson`.
 
+### Simple language
+
+The functionality to change the simple language tokens for start/end functions 
has been removed. The default tokens with `${xxx}` and `$simple{xxx}` is now 
hardcoded (optimized). The functionality to change these tokens was never 
really in use and would only confuse Camel users if a new syntax are in use.
+
 ### Moved APIs
 
 The following API changes may affect your existing Camel applications, which 
needs to be migrated.
diff --git 
a/components/camel-spring/src/test/java/org/apache/camel/spring/SpringChangeFunctionStartFunctionEndTest.java
 
b/components/camel-spring/src/test/java/org/apache/camel/spring/SpringChangeFunctionStartFunctionEndTest.java
deleted file mode 100644
index 58ad737..0000000
--- 
a/components/camel-spring/src/test/java/org/apache/camel/spring/SpringChangeFunctionStartFunctionEndTest.java
+++ /dev/null
@@ -1,51 +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.spring;
-import org.apache.camel.language.simple.SimpleLanguage;
-import org.junit.After;
-import org.junit.Test;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * Tests changing the function start and function end tokens using a spring 
bean.
- */
-public class SpringChangeFunctionStartFunctionEndTest extends 
SpringTestSupport {
-
-    protected AbstractXmlApplicationContext createApplicationContext() {
-        return new 
ClassPathXmlApplicationContext("org/apache/camel/spring/SpringChangeFunctionStartFunctionEndTest.xml");
-    }
-
-    @Test
-    public void testSimpleWithPrefix() throws Exception {
-        getMockEndpoint("mock:result").expectedBodiesReceived("Custom tokens 
is cool");
-
-        template.sendBody("direct:start", "Custom tokens");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-        // change the tokens back to default after testing
-        SimpleLanguage.changeFunctionStartToken("${", "$simple{");
-        SimpleLanguage.changeFunctionEndToken("}");
-
-        super.tearDown();
-    }
-}
diff --git 
a/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringChangeFunctionStartFunctionEndTest.xml
 
b/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringChangeFunctionStartFunctionEndTest.xml
deleted file mode 100644
index f21a905..0000000
--- 
a/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringChangeFunctionStartFunctionEndTest.xml
+++ /dev/null
@@ -1,46 +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.
-
--->
-<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";>
-
-    <!-- configure Simple to use custom prefix/suffix tokens -->
-    <bean id="simple" class="org.apache.camel.language.simple.SimpleLanguage">
-      <property name="functionStartToken" value="["/>
-      <property name="functionEndToken" value="]"/>
-    </bean>
-
-    <camelContext xmlns="http://camel.apache.org/schema/spring";>
-
-        <!-- This route transforms the body using simple with custom prefix 
and suffix tokens configured by "simple" bean,
-        the text ' is cool' is appended to the body and then routed to 
mock:result. -->
-        <route>
-            <from uri="direct:start"/>
-            <transform>
-                <simple>[body] is cool</simple>
-            </transform>
-            <to uri="mock:result"/>
-        </route>
-
-    </camelContext>
-
-</beans>
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
 
b/core/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
index 08bf4da..947efb1 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
@@ -248,60 +248,4 @@ public class SimpleLanguage extends LanguageSupport 
implements StaticService {
         return SimpleTokenizer.hasFunctionStartToken(expression);
     }
 
-    /**
-     * Change the start tokens used for functions.
-     * <p/>
-     * This can be used to alter the function tokens to avoid clashes with 
other
-     * frameworks etc.
-     * <p/>
-     * The default start tokens is <tt>${</tt> and <tt>$simple{</tt>.
-     *
-     * @param startToken new start token(s) to be used for functions
-     */
-    public static void changeFunctionStartToken(String... startToken) {
-        SimpleTokenizer.changeFunctionStartToken(startToken);
-    }
-    
-    /**
-     * Change the end tokens used for functions.
-     * <p/>
-     * This can be used to alter the function tokens to avoid clashes with 
other
-     * frameworks etc.
-     * <p/>
-     * The default end token is <tt>}</tt>
-     *
-     * @param endToken new end token(s) to be used for functions
-     */
-    public static void changeFunctionEndToken(String... endToken) {
-        SimpleTokenizer.changeFunctionEndToken(endToken);
-    }
-
-    /**
-     * Change the start token used for functions.
-     * <p/>
-     * This can be used to alter the function tokens to avoid clashes with 
other
-     * frameworks etc.
-     * <p/>
-     * The default start tokens is <tt>${</tt> and <tt>$simple{</tt>.
-     *
-     * @param startToken new start token to be used for functions
-     */
-    public void setFunctionStartToken(String startToken) {
-        changeFunctionStartToken(startToken);
-    }
-
-    /**
-     * Change the end token used for functions.
-     * <p/>
-     * This can be used to alter the function tokens to avoid clashes with 
other
-     * frameworks etc.
-     * <p/>
-     * The default end token is <tt>}</tt>
-     *
-     * @param endToken new end token to be used for functions
-     */
-    public void setFunctionEndToken(String endToken) {
-        changeFunctionEndToken(endToken);
-    }
-
 }
diff --git 
a/core/camel-core/src/main/java/org/apache/camel/language/simple/SimpleTokenizer.java
 
b/core/camel-core/src/main/java/org/apache/camel/language/simple/SimpleTokenizer.java
index 4567b09..600a191 100644
--- 
a/core/camel-core/src/main/java/org/apache/camel/language/simple/SimpleTokenizer.java
+++ 
b/core/camel-core/src/main/java/org/apache/camel/language/simple/SimpleTokenizer.java
@@ -105,56 +105,6 @@ public final class SimpleTokenizer {
     }
 
     /**
-     * @see SimpleLanguage#changeFunctionStartToken(String...)
-     */
-    public static void changeFunctionStartToken(String... startToken) {
-        for (SimpleTokenType type : KNOWN_TOKENS) {
-            if (type.getType() == TokenType.functionStart) {
-                KNOWN_TOKENS.remove(type);
-            }
-        }
-
-        if (startToken.length > 2) {
-            throw new IllegalArgumentException("At most 2 start tokens is 
allowed");
-        }
-
-        // reset
-        FUNCTION_START[0] = "";
-        FUNCTION_START[1] = "";
-
-        // add in start of list as its a more common token to be used
-        for (int i = 0; i < startToken.length; i++) {
-            String token = startToken[i];
-            FUNCTION_START[i] = token;
-            KNOWN_TOKENS.add(0, new SimpleTokenType(TokenType.functionStart, 
token));
-        }
-    }
-
-    /**
-     * @see SimpleLanguage#changeFunctionEndToken(String...)
-     */
-    public static void changeFunctionEndToken(String... endToken) {
-        for (SimpleTokenType type : KNOWN_TOKENS) {
-            if (type.getType() == TokenType.functionEnd) {
-                KNOWN_TOKENS.remove(type);
-            }
-        }
-
-        // add after the start tokens
-        int pos = 0;
-        for (SimpleTokenType type : KNOWN_TOKENS) {
-            if (type.getType() == TokenType.functionStart) {
-                pos++;
-            }
-        }
-
-        // add after function start of list as its a more common token to be 
used
-        for (String token : endToken) {
-            KNOWN_TOKENS.add(pos, new SimpleTokenType(TokenType.functionEnd, 
token));
-        }
-    }
-
-    /**
      * Create the next token
      *
      * @param expression  the input expression
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleChangeFunctionTokensTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleChangeFunctionTokensTest.java
deleted file mode 100644
index 63cc2f6..0000000
--- 
a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleChangeFunctionTokensTest.java
+++ /dev/null
@@ -1,86 +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.language.simple;
-import org.apache.camel.LanguageTestSupport;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- *
- */
-public class SimpleChangeFunctionTokensTest extends LanguageTestSupport {
-
-    @Override
-    protected String getLanguageName() {
-        return "simple";
-    }
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-
-        SimpleLanguage.changeFunctionStartToken("[[");
-        SimpleLanguage.changeFunctionEndToken("]]");
-    }
-
-    @Override
-    @After
-    public void tearDown() throws Exception {
-        super.tearDown();
-
-        // replace old tokens
-        SimpleLanguage.changeFunctionStartToken("${", "$simple{");
-        SimpleLanguage.changeFunctionEndToken("}");
-    }
-
-    @Test
-    public void testSimpleBody() throws Exception {
-        assertExpression(exchange, "[[body]]", "<hello 
id='m123'>world!</hello>");
-
-        // old tokens do no longer work
-        assertExpression(exchange, "${body}", "${body}");
-    }
-
-    @Test
-    public void testSimpleConstantAndBody() throws Exception {
-        exchange.getIn().setBody("Camel");
-        assertExpression(exchange, "Hi [[body]] how are you", "Hi Camel how 
are you");
-        assertExpression(exchange, "'Hi '[[body]]' how are you'", "'Hi 'Camel' 
how are you'");
-
-        // old tokens do no longer work
-        assertExpression(exchange, "Hi ${body} how are you", "Hi ${body} how 
are you");
-    }
-
-    @Test
-    public void testSimpleConstantAndBodyAndHeader() throws Exception {
-        exchange.getIn().setBody("Camel");
-        exchange.getIn().setHeader("foo", "Tiger");
-        assertExpression(exchange, "Hi [[body]] how are [[header.foo]]", "Hi 
Camel how are Tiger");
-    }
-
-    @Test
-    public void testSimpleEqOperator() throws Exception {
-        exchange.getIn().setBody("Camel");
-        assertPredicate(exchange, "[[body]] == 'Tiger'", false);
-        assertPredicate(exchange, "[[body]] == 'Camel'", true);
-        assertPredicate(exchange, "[[body]] == \"Tiger\"", false);
-        assertPredicate(exchange, "[[body]] == \"Camel\"", true);
-    }
-
-}

Reply via email to