camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r673633 - in /activemq/camel/trunk/components/camel-script/src: main/java/org/apache/camel/builder/script/ test/java/org/apache/camel/builder/script/
Date Thu, 03 Jul 2008 09:19:25 GMT
Author: ningjiang
Date: Thu Jul  3 02:19:24 2008
New Revision: 673633

URL: http://svn.apache.org/viewvc?rev=673633&view=rev
Log:
CAMEL-655 Added some comments for getting the python and jython scripts evaluation result

Modified:
    activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
    activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java
    activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/PythonExpressionTest.java

Modified: activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java?rev=673633&r1=673632&r2=673633&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
(original)
+++ activemq/camel/trunk/components/camel-script/src/main/java/org/apache/camel/builder/script/ScriptBuilder.java
Thu Jul  3 02:19:24 2008
@@ -484,7 +484,7 @@
             populateBindings(getEngine(), exchange);
             Object result = runScript();
             if (LOG.isDebugEnabled()) {
-                LOG.debug("the script result is " + result);
+                LOG.debug("The script evaluation result is: " + result);
             }
             return result;
         } catch (ScriptException e) {
@@ -503,6 +503,8 @@
         if (compiledScript != null) {
             result = compiledScript.eval();
             if (scriptEngineName.equals("python") || scriptEngineName.equals("jython")) {
+                // Retrieve the evaluation result for Python script
+                // Python script should store the evaluation result into result variable
                 result = compiledScript.getEngine().get("result");
             }
         } else {
@@ -512,6 +514,8 @@
                 result = getEngine().eval(createScriptReader());
             }
             if (scriptEngineName.equals("python") || scriptEngineName.equals("jython")) {
+                // Retrieve the evaluation result for python script
+                // Python script should store the evaluation result into result variable
                 result = getEngine().get("result");
             }
         }

Modified: activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java?rev=673633&r1=673632&r2=673633&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java
(original)
+++ activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java
Thu Jul  3 02:19:24 2008
@@ -55,8 +55,6 @@
         return new RouteBuilder() {
             public void configure() throws Exception {
                 from("direct:start").choice().
-                        // The following java script expression should return a boolean
-                        // but it seems to always return false -- what's up with that?
                         when().javaScript("request.headers.get('foo') == 'bar'").to("mock:result")
                         .otherwise().to("mock:unmatched");
             }

Modified: activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/PythonExpressionTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/PythonExpressionTest.java?rev=673633&r1=673632&r2=673633&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/PythonExpressionTest.java
(original)
+++ activemq/camel/trunk/components/camel-script/src/test/java/org/apache/camel/builder/script/PythonExpressionTest.java
Thu Jul  3 02:19:24 2008
@@ -56,8 +56,7 @@
         return new RouteBuilder() {
             public void configure() throws Exception {
                 from("direct:start").choice().
-                        // The following python expression should return a boolean
-                        // but it seems to return null instead -- what's up with that?
+                        // The result variable is used to retrieve the python script evaluation
result
                         when().python("result = request.headers['foo']=='bar'").to("mock:result")
                         .otherwise().to("mock:unmatched");
             }



Mime
View raw message