commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r373330 - /jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
Date Sun, 29 Jan 2006 17:45:29 GMT
Author: rahul
Date: Sun Jan 29 09:45:28 2006
New Revision: 373330

URL: http://svn.apache.org/viewcvs?rev=373330&view=rev
Log:
Update the testing helper class to match changes to SCXML IO and execution.

Modified:
    jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java

Modified: jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java?rev=373330&r1=373329&r2=373330&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
(original)
+++ jakarta/commons/sandbox/scxml/branches/STATELESS_MODEL/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
Sun Jan 29 09:45:28 2006
@@ -19,10 +19,10 @@
 
 import junit.framework.Assert;
 
-import org.apache.commons.scxml.env.jsp.ELEvaluator;
-import org.apache.commons.scxml.env.jsp.ELContext;
 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.model.SCXML;
 
@@ -33,25 +33,15 @@
 public class SCXMLTestHelper {
 
     public static SCXML digest(final URL url) {
-        Evaluator evaluator = new ELEvaluator();
-        Context ctx = new ELContext();
-        return digest(url, null, ctx, evaluator);
+        return digest(url, null);
     }
 
-    public static SCXML digest(final URL url, final Context ctx,
-            final Evaluator evaluator) {
-        return digest(url, null, ctx, evaluator);
-    }
-
-    public static SCXML digest(final URL url, final ErrorHandler errHandler,
-            final Context ctx, final Evaluator evaluator) {
+    public static SCXML digest(final URL url, final ErrorHandler errHandler) {
         Assert.assertNotNull(url);
-        Assert.assertNotNull(ctx);
         // SAX ErrorHandler may be null
-        Assert.assertNotNull(evaluator);
         SCXML scxml = null;
         try {
-            scxml = SCXMLDigester.digest(url, errHandler, ctx, evaluator);
+            scxml = SCXMLDigester.digest(url, errHandler);
         } catch (Exception e) {
             Assert.fail(e.getMessage());
         }
@@ -60,43 +50,54 @@
     }
 
     public static SCXMLExecutor getExecutor(final URL url) {
-        Evaluator evaluator = new ELEvaluator();
-        Context ctx = new ELContext();
-        SCXML scxml = digest(url, null, ctx, evaluator);
+        SCXML scxml = digest(url, null);
+        Evaluator evaluator = new JexlEvaluator();
         return getExecutor(evaluator, scxml);
     }
 
-    public static SCXMLExecutor getExecutor(final URL url, final Context ctx,
+    public static SCXMLExecutor getExecutor(final URL url,
             final Evaluator evaluator) {
-        SCXML scxml = digest(url, null, ctx, evaluator);
+        SCXML scxml = digest(url, null);
         return getExecutor(evaluator, scxml);
     }
 
     public static SCXMLExecutor getExecutor(final URL url,
-            final ErrorHandler errHandler,final Context ctx,
-            final Evaluator evaluator) {
-        SCXML scxml = digest(url, errHandler, ctx, evaluator);
+            final ErrorHandler errHandler) {
+        SCXML scxml = digest(url, errHandler);
+        Evaluator evaluator = new JexlEvaluator();
         return getExecutor(evaluator, scxml);
     }
 
     public static SCXMLExecutor getExecutor(Evaluator evaluator, SCXML scxml) {
         EventDispatcher ed = new SimpleDispatcher();
         Tracer trc = new Tracer();
-        return getExecutor(evaluator, scxml, ed, trc);
+        Context context = new JexlContext();
+        return getExecutor(context, evaluator, scxml, ed, trc);
+    }
+
+    public static SCXMLExecutor getExecutor(final URL url, final Context ctx,
+            final Evaluator evaluator) {
+        SCXML scxml = digest(url, null);
+        EventDispatcher ed = new SimpleDispatcher();
+        Tracer trc = new Tracer();
+        return getExecutor(ctx, evaluator, scxml, ed, trc);
     }
 
-    public static SCXMLExecutor getExecutor(Evaluator evaluator, SCXML scxml,
-            EventDispatcher ed, Tracer trc) {
+    public static SCXMLExecutor getExecutor(Context context,
+            Evaluator evaluator, SCXML scxml, EventDispatcher ed, Tracer trc) {
         Assert.assertNotNull(evaluator);
+        Assert.assertNotNull(context);
         Assert.assertNotNull(scxml);
         Assert.assertNotNull(ed);
         Assert.assertNotNull(trc);
         SCXMLExecutor exec = null;
         try {
             exec = new SCXMLExecutor(evaluator, ed, trc);
-            scxml.addListener(trc);
+            exec.addListener(scxml, trc);
+            exec.setRootContext(context);
             exec.setSuperStep(true);
             exec.setStateMachine(scxml);
+            exec.go();
         } catch (Exception e) {
             Assert.fail(e.getMessage());
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message