camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r619603 - in /activemq/camel/trunk/components/camel-ognl/src: main/java/org/apache/camel/language/ognl/OgnlExpression.java test/java/org/apache/camel/language/ognl/OgnlTest.java
Date Thu, 07 Feb 2008 19:47:35 GMT
Author: hadrian
Date: Thu Feb  7 11:47:22 2008
New Revision: 619603

URL: http://svn.apache.org/viewvc?rev=619603&view=rev
Log:
CAMEL-310.  Patch applied with thanks!

Modified:
    activemq/camel/trunk/components/camel-ognl/src/main/java/org/apache/camel/language/ognl/OgnlExpression.java
    activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/OgnlTest.java

Modified: activemq/camel/trunk/components/camel-ognl/src/main/java/org/apache/camel/language/ognl/OgnlExpression.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ognl/src/main/java/org/apache/camel/language/ognl/OgnlExpression.java?rev=619603&r1=619602&r2=619603&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ognl/src/main/java/org/apache/camel/language/ognl/OgnlExpression.java
(original)
+++ activemq/camel/trunk/components/camel-ognl/src/main/java/org/apache/camel/language/ognl/OgnlExpression.java
Thu Feb  7 11:47:22 2008
@@ -57,20 +57,12 @@
         // TODO we could use caching here but then we'd have possible
         // concurrency issues
         // so lets assume that the provider caches
-        Map values = new HashMap();
-        populateContext(values, exchange);
         OgnlContext oglContext = new OgnlContext();
         try {
             return Ognl.getValue(expression, oglContext, new RootObject(exchange));
         } catch (OgnlException e) {
             throw new ExpressionEvaluationException(this, exchange, e);
         }
-    }
-
-    protected void populateContext(Map map, Exchange exchange) {
-        map.put("exchange", exchange);
-        map.put("in", exchange.getIn());
-        map.put("out", exchange.getOut());
     }
 
     protected String assertionFailureMessage(Exchange exchange) {

Modified: activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/OgnlTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/OgnlTest.java?rev=619603&r1=619602&r2=619603&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/OgnlTest.java
(original)
+++ activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/OgnlTest.java
Thu Feb  7 11:47:22 2008
@@ -18,18 +18,28 @@
 
 import org.apache.camel.LanguageTestSupport;
 
-
 /**
  * @version $Revision: $
  */
 public class OgnlTest  extends LanguageTestSupport {
-    public void testElExpressions() throws Exception {
+    public void testOgnlExpressions() throws Exception {
         assertExpression("exchange", exchange);
         assertExpression("exchange.getIn().body", "<hello id='m123'>world!</hello>");
         assertExpression("getIn().body", "<hello id='m123'>world!</hello>");
+        assertExpression("request.body", "<hello id='m123'>world!</hello>");
         assertExpression("getIn().headers['foo']", "abc");
         assertExpression("getIn().headers.foo", "abc");
         assertExpression("request.headers.foo", "abc");
+    }
+    
+    public void testGetOutFalseKeepsNullOutMessage() throws Exception {
+        assertExpression("exchange.getOut(false)", null);
+        assertNull(exchange.getOut(false));
+    }
+    
+    public void testResponseCreatesOutMessage() throws Exception {
+       assertExpression("response.body", null);        
+       assertNotNull(exchange.getOut(false));
     }
 
     protected String getLanguageName() {



Mime
View raw message