camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r1293022 - in /camel/trunk/components/camel-velocity: pom.xml src/test/java/org/apache/camel/component/velocity/VelocityTest.java src/test/resources/org/apache/camel/component/velocity/escape.vm
Date Thu, 23 Feb 2012 23:14:30 GMT
Author: cmueller
Date: Thu Feb 23 23:14:30 2012
New Revision: 1293022

URL: http://svn.apache.org/viewvc?rev=1293022&view=rev
Log:
add unit test for an user forum issue

Added:
    camel/trunk/components/camel-velocity/src/test/resources/org/apache/camel/component/velocity/escape.vm
Modified:
    camel/trunk/components/camel-velocity/pom.xml
    camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java

Modified: camel/trunk/components/camel-velocity/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/pom.xml?rev=1293022&r1=1293021&r2=1293022&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/pom.xml (original)
+++ camel/trunk/components/camel-velocity/pom.xml Thu Feb 23 23:14:30 2012
@@ -69,6 +69,12 @@
         	<version>${commons-io-version}</version>
         	<scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-tools</artifactId>
+            <version>2.0</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>

Modified: camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java?rev=1293022&r1=1293021&r2=1293022&view=diff
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java
(original)
+++ camel/trunk/components/camel-velocity/src/test/java/org/apache/camel/component/velocity/VelocityTest.java
Thu Feb 23 23:14:30 2012
@@ -22,6 +22,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.velocity.tools.generic.EscapeTool;
 import org.junit.Test;
 
 public class VelocityTest extends CamelTestSupport {
@@ -33,13 +34,13 @@ public class VelocityTest extends CamelT
             @Override
             public void process(Exchange exchange) throws Exception {
                 exchange.getIn().addAttachment("item", dataHandler);
-                exchange.getIn().setBody("Monday");
+                exchange.getIn().setBody("Monday & Tuesday");
                 exchange.getIn().setHeader("name", "Christian");
                 exchange.setProperty("item", "7");
             }
         });
 
-        assertEquals("Dear Christian. You ordered item 7 on Monday.", exchange.getOut().getBody());
+        assertEquals("Dear Christian. You ordered item 7 on Monday &amp; Tuesday.", exchange.getOut().getBody());
         assertEquals("Christian", exchange.getOut().getHeader("name"));
         assertSame(dataHandler, exchange.getOut().getAttachment("item"));
     }
@@ -47,10 +48,9 @@ public class VelocityTest extends CamelT
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                // START SNIPPET: example
-                from("direct:a").
-                        to("velocity:org/apache/camel/component/velocity/example.vm");
-                // END SNIPPET: example
+                from("direct:a")
+                    .setHeader("esc", constant(new EscapeTool()))
+                    .to("velocity:org/apache/camel/component/velocity/escape.vm");
             }
         };
     }

Added: camel/trunk/components/camel-velocity/src/test/resources/org/apache/camel/component/velocity/escape.vm
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-velocity/src/test/resources/org/apache/camel/component/velocity/escape.vm?rev=1293022&view=auto
==============================================================================
--- camel/trunk/components/camel-velocity/src/test/resources/org/apache/camel/component/velocity/escape.vm
(added)
+++ camel/trunk/components/camel-velocity/src/test/resources/org/apache/camel/component/velocity/escape.vm
Thu Feb 23 23:14:30 2012
@@ -0,0 +1,17 @@
+## ------------------------------------------------------------------------
+## 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.
+## ------------------------------------------------------------------------
+Dear ${headers.name}. You ordered item ${exchange.properties.item} on $headers.esc.xml(${body}).
\ No newline at end of file



Mime
View raw message