commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r391142 - in /jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml: EventDataTest.java SCXMLExecutorTest.java SCXMLTestHelper.java WizardsTest.java
Date Mon, 03 Apr 2006 20:31:31 GMT
Author: rahul
Date: Mon Apr  3 13:31:29 2006
New Revision: 391142

URL: http://svn.apache.org/viewcvs?rev=391142&view=rev
Log:
Minor renaming / refactoring in test classes.

Modified:
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
    jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java?rev=391142&r1=391141&r2=391142&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java
(original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java
Mon Apr  3 13:31:29 2006
@@ -84,7 +84,7 @@
             TriggerEvent[] evts = new TriggerEvent[] { te,
                 new TriggerEvent("event.bar", TriggerEvent.SIGNAL_EVENT,
                 new Integer(6))};
-            currentStates = SCXMLTestHelper.fireEvent(exec, evts);
+            currentStates = SCXMLTestHelper.fireEvents(exec, evts);
             assertEquals(1, currentStates.size());
             assertEquals("state6", ((State)currentStates.iterator().
                 next()).getId());

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java?rev=391142&r1=391141&r2=391142&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
(original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
Mon Apr  3 13:31:29 2006
@@ -108,15 +108,15 @@
         exec = SCXMLTestHelper.getExecutor(transitions01);
         assertNotNull(exec);
         try {
-            Set currentStates = fireEvent("ten.done");
+            Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
             assertEquals(1, currentStates.size());
             assertEquals("twenty_one", ((State)currentStates.iterator().
                 next()).getId());
-            currentStates = fireEvent("twenty_one.done");
+            currentStates = SCXMLTestHelper.fireEvent(exec, "twenty_one.done");
             assertEquals(1, currentStates.size());
             assertEquals("twenty_two", ((State)currentStates.iterator().
                 next()).getId());
-            currentStates = fireEvent("twenty_two.done");
+            currentStates = SCXMLTestHelper.fireEvent(exec, "twenty_two.done");
             assertEquals(3, exec.getCurrentStatus().getStates().size());
         } catch (Exception e) {
             fail(e.getMessage());
@@ -136,20 +136,9 @@
         }
     }
 
-    private Set fireEvent(String name) {
-        TriggerEvent[] evts = {new TriggerEvent(name,
-                TriggerEvent.SIGNAL_EVENT, null)};
-        try {
-            exec.triggerEvents(evts);
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
-        return exec.getCurrentStatus().getStates();
-    }
-
     private void checkMicrowave01Sample() {
         try {
-            Set currentStates = fireEvent("turn_on");
+            Set currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
             assertEquals(1, currentStates.size());
             assertEquals("cooking", ((State)currentStates.iterator().
                 next()).getId());
@@ -160,7 +149,7 @@
 
     private void checkMicrowave02Sample() {
         try {
-            Set currentStates = fireEvent("turn_on");
+            Set currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
             assertEquals(2, currentStates.size());
             String id = ((State)currentStates.iterator().next()).getId();
             assertTrue(id.equals("closed") || id.equals("cooking"));

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java?rev=391142&r1=391141&r2=391142&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
(original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
Mon Apr  3 13:31:29 2006
@@ -177,7 +177,7 @@
         return exec.getCurrentStatus().getStates();
     }
 
-    public static Set fireEvent(SCXMLExecutor exec, TriggerEvent[] evts) {
+    public static Set fireEvents(SCXMLExecutor exec, TriggerEvent[] evts) {
         try {
             exec.triggerEvents(evts);
         } catch (Exception e) {

Modified: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java?rev=391142&r1=391141&r2=391142&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java
(original)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java
Mon Apr  3 13:31:29 2006
@@ -80,19 +80,19 @@
             assertEquals(1, currentStates.size());
             assertEquals("state1", ((State)currentStates.iterator().
                 next()).getId());
-            currentStates = fireEvent("event2");
+            currentStates = SCXMLTestHelper.fireEvent(exec, "event2");
             assertEquals(1, currentStates.size());
             assertEquals("state2", ((State)currentStates.iterator().
                 next()).getId());
-            currentStates = fireEvent("event4");
+            currentStates = SCXMLTestHelper.fireEvent(exec, "event4");
             assertEquals(1, currentStates.size());
             assertEquals("state4", ((State)currentStates.iterator().
                 next()).getId());
-            currentStates = fireEvent("event3");
+            currentStates = SCXMLTestHelper.fireEvent(exec, "event3");
             assertEquals(1, currentStates.size());
             assertEquals("state3", ((State)currentStates.iterator().
                 next()).getId());
-            currentStates = fireEvent("event3"); // ensure we stay put
+            currentStates = SCXMLTestHelper.fireEvent(exec, "event3"); // ensure we stay
put
             assertEquals(1, currentStates.size());
             assertEquals("state3", ((State)currentStates.iterator().
                 next()).getId());
@@ -114,7 +114,7 @@
             assertEquals(1, currentStates.size());
             assertEquals("state2", ((State)currentStates.iterator().
                 next()).getId());
-            currentStates = fireEvent("event4");
+            currentStates = SCXMLTestHelper.fireEvent(exec, "event4");
             assertEquals(1, currentStates.size());
             assertEquals("state4", ((State)currentStates.iterator().
                 next()).getId());
@@ -147,17 +147,6 @@
             // should never be called
             fail("<cancel> TestEventDispatcher callback unexpected");
         }
-    }
-
-    private Set fireEvent(String name) {
-        TriggerEvent[] evts = {new TriggerEvent(name,
-                TriggerEvent.SIGNAL_EVENT, null)};
-        try {
-            exec.triggerEvents(evts);
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
-        return exec.getCurrentStatus().getStates();
     }
 
     public static void main(String args[]) {



---------------------------------------------------------------------
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