You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ra...@apache.org on 2007/12/04 04:26:00 UTC

svn commit: r600775 - /commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java

Author: rahul
Date: Mon Dec  3 19:26:00 2007
New Revision: 600775

URL: http://svn.apache.org/viewvc?rev=600775&view=rev
Log:
Safer way to create contexts, suggested as part of SCXML-54
Patch by Mike Tillberg <mtillberg at comcast dot net>

Modified:
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java?rev=600775&r1=600774&r2=600775&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java Mon Dec  3 19:26:00 2007
@@ -33,7 +33,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.scxml.env.SimpleDispatcher;
 import org.apache.commons.scxml.env.Tracer;
-import org.apache.commons.scxml.env.jexl.JexlContext;
 import org.apache.commons.scxml.env.jexl.JexlEvaluator;
 import org.apache.commons.scxml.io.SCXMLDigester;
 import org.apache.commons.scxml.io.SCXMLParser;
@@ -138,8 +137,8 @@
 
     public static SCXMLExecutor getExecutor(SCXML scxml,
             SCXMLSemantics semantics) {
-        Context context = new JexlContext();
         Evaluator evaluator = new JexlEvaluator();
+        Context context = evaluator.newContext(null);
         EventDispatcher ed = new SimpleDispatcher();
         Tracer trc = new Tracer();
         return getExecutor(context, evaluator, scxml, ed, trc, semantics);
@@ -148,7 +147,8 @@
     public static SCXMLExecutor getExecutor(Evaluator evaluator, SCXML scxml) {
         EventDispatcher ed = new SimpleDispatcher();
         Tracer trc = new Tracer();
-        Context context = new JexlContext();
+        Assert.assertNotNull("Null evaluator", evaluator);
+        Context context = evaluator.newContext(null);
         return getExecutor(context, evaluator, scxml, ed, trc);
     }