Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 43258 invoked from network); 7 Mar 2007 22:09:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Mar 2007 22:09:27 -0000 Received: (qmail 5357 invoked by uid 500); 7 Mar 2007 22:09:34 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 5303 invoked by uid 500); 7 Mar 2007 22:09:34 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 5292 invoked by uid 500); 7 Mar 2007 22:09:34 -0000 Received: (qmail 5289 invoked by uid 99); 7 Mar 2007 22:09:34 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Mar 2007 14:09:34 -0800 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Mar 2007 14:09:24 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 194251A9838; Wed, 7 Mar 2007 14:09:04 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r515801 - in /jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml: SCXMLTestSuite.java TieBreakerTest.java tie-breaker-01.xml tie-breaker-02.xml tie-breaker-03.xml Date: Wed, 07 Mar 2007 22:09:03 -0000 To: commons-cvs@jakarta.apache.org From: rahul@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070307220904.194251A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rahul Date: Wed Mar 7 14:09:03 2007 New Revision: 515801 URL: http://svn.apache.org/viewvc?view=rev&rev=515801 Log: Upto v0.6, non-deterministic behavior leads to an error condition. Based on the February 2007 WD, such non-determinism should now be resolved based on document order and heirarchy of states within the state machine. Adding a suite of "tie breaker" tests that fail on v0.6, but need to pass on v0.7. Since none of that work is done yet, the tests are commented out. Added: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/TieBreakerTest.java (with props) jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-01.xml (with props) jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-02.xml (with props) jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-03.xml (with props) Modified: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java Modified: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java?view=diff&rev=515801&r1=515800&r2=515801 ============================================================================== --- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java (original) +++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java Wed Mar 7 14:09:03 2007 @@ -54,6 +54,7 @@ suite.addTest(SCXMLExecutorTest.suite()); suite.addTest(SCXMLHelperTest.suite()); suite.addTest(StatusTest.suite()); + suite.addTest(TieBreakerTest.suite()); suite.addTest(TriggerEventTest.suite()); suite.addTest(WildcardTest.suite()); suite.addTest(WizardsTest.suite()); Added: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/TieBreakerTest.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/TieBreakerTest.java?view=auto&rev=515801 ============================================================================== --- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/TieBreakerTest.java (added) +++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/TieBreakerTest.java Wed Mar 7 14:09:03 2007 @@ -0,0 +1,125 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.scxml; + +import java.net.URL; +import java.util.Set; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +import org.apache.commons.scxml.model.State; +/** + * Unit tests for testing conflict resolution amongst multiple transitions + * within the {@link org.apache.commons.scxml.SCXMLExecutor}'s default + * semantics. + * + * Upto v0.6, non-deterministic behavior leads to an error condition. Based + * on the February 2007 WD, such non-determinism should now be resolved + * based on document order and heirarchy of states within the state machine. + * This class tests various such cases where more than one candidate + * transition exists at a particular point, and tie-breaking rules are used + * to make progress, rather than resulting in error conditions. + */ +public class TieBreakerTest extends TestCase { + /** + * Construct a new instance of SCXMLExecutorTest with + * the specified name + */ + public TieBreakerTest(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite = new TestSuite(TieBreakerTest.class); + suite.setName("SCXML Executor Tie-Breaker Tests"); + return suite; + } + + // Test data + private URL tiebreaker01, tiebreaker02, tiebreaker03; + private SCXMLExecutor exec; + + /** + * Set up instance variables required by this test case. + */ + public void setUp() { + tiebreaker01 = this.getClass().getClassLoader(). + getResource("org/apache/commons/scxml/tie-breaker-01.xml"); + tiebreaker02 = this.getClass().getClassLoader(). + getResource("org/apache/commons/scxml/tie-breaker-02.xml"); + tiebreaker03 = this.getClass().getClassLoader(). + getResource("org/apache/commons/scxml/tie-breaker-03.xml"); + } + + /** + * Tear down instance variables required by this test case. + */ + public void tearDown() { + tiebreaker01 = tiebreaker02 = tiebreaker03 = null; + } + + /** + * Test the implementation + */ + /* TODO - These tests must pass before v0.7 + public void testTieBreaker01() { + exec = SCXMLTestHelper.getExecutor(tiebreaker01); + assertNotNull(exec); + Set currentStates = exec.getCurrentStatus().getStates(); + assertEquals(1, currentStates.size()); + assertEquals("ten", ((State)currentStates.iterator(). + next()).getId()); + currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done"); + assertEquals(1, currentStates.size()); + assertEquals("twenty", ((State)currentStates.iterator(). + next()).getId()); + } + + public void testTieBreaker02() { + exec = SCXMLTestHelper.getExecutor(tiebreaker02); + assertNotNull(exec); + Set currentStates = exec.getCurrentStatus().getStates(); + assertEquals(1, currentStates.size()); + assertEquals("eleven", ((State)currentStates.iterator(). + next()).getId()); + currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done"); + assertEquals(1, currentStates.size()); + assertEquals("thirty", ((State)currentStates.iterator(). + next()).getId()); + } + + public void testTieBreaker03() { + exec = SCXMLTestHelper.getExecutor(tiebreaker03); + assertNotNull(exec); + Set currentStates = exec.getCurrentStatus().getStates(); + assertEquals(1, currentStates.size()); + assertEquals("eleven", ((State)currentStates.iterator(). + next()).getId()); + currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done"); + assertEquals(1, currentStates.size()); + assertEquals("forty", ((State)currentStates.iterator(). + next()).getId()); + }*/ + + public static void main(String args[]) { + TestRunner.run(suite()); + } +} + Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/TieBreakerTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/TieBreakerTest.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-01.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-01.xml?view=auto&rev=515801 ============================================================================== --- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-01.xml (added) +++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-01.xml Wed Mar 7 14:09:03 2007 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-01.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-01.xml ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-02.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-02.xml?view=auto&rev=515801 ============================================================================== --- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-02.xml (added) +++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-02.xml Wed Mar 7 14:09:03 2007 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-02.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-02.xml ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Added: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-03.xml URL: http://svn.apache.org/viewvc/jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-03.xml?view=auto&rev=515801 ============================================================================== --- jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-03.xml (added) +++ jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-03.xml Wed Mar 7 14:09:03 2007 @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-03.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/tie-breaker-03.xml ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org