camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1029041 - /camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java
Date Sat, 30 Oct 2010 12:18:24 GMT
Author: davsclaus
Date: Sat Oct 30 12:18:24 2010
New Revision: 1029041

URL: http://svn.apache.org/viewvc?rev=1029041&view=rev
Log:
Added test based on user forum issue

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java?rev=1029041&r1=1029040&r2=1029041&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java Sat Oct
30 12:18:24 2010
@@ -361,6 +361,26 @@ public class SimpleTest extends Language
         }
     }
 
+    public void testBodyOGNLAsMap() throws Exception {
+        Map map = new HashMap();
+        map.put("foo", "Camel");
+        map.put("bar", 6);
+        exchange.getIn().setBody(map);
+
+        assertExpression("${in.body[foo]}", "Camel");
+        assertExpression("${in.body[bar]}", 6);
+    }
+    
+    public void testBodyOGNLAsMapShorthand() throws Exception {
+        Map map = new HashMap();
+        map.put("foo", "Camel");
+        map.put("bar", 6);
+        exchange.getIn().setBody(map);
+
+        assertExpression("${body[foo]}", "Camel");
+        assertExpression("${body[bar]}", 6);
+    }
+
     public void testBodyOGNLSimple() throws Exception {
         Animal camel = new Animal("Camel", 6);
         exchange.getIn().setBody(camel);
@@ -368,7 +388,7 @@ public class SimpleTest extends Language
         assertExpression("${in.body.getName}", "Camel");
         assertExpression("${in.body.getAge}", 6);
     }
-    
+
     public void testExceptionOGNLSimple() throws Exception {
         exchange.getIn().setHeader(Exchange.AUTHENTICATION_FAILURE_POLICY_ID, "myPolicy");
         exchange.setProperty(Exchange.EXCEPTION_CAUGHT, new CamelAuthorizationException("The
camel authorization exception", exchange));



Mime
View raw message