Cannot create more than one subclass of AbstractStateMachine ------------------------------------------------------------
Key: SCXML-48 URL: https://issues.apache.org/jira/browse/SCXML-48 Project: Commons SCXML Issue Type: Bug Reporter: Michael Heuer Attachments: abstract-state-machine-test-src.tar.gz Similar to the issue described in SCXML-47, the following test case will fail: public void testMoreThanOneScxmlDocument() throws Exception { URL fooScxmlDocument = getClass().getResource("foo.xml"); URL barScxmlDocument = getClass().getResource("bar.xml"); Foo foo = new Foo(fooScxmlDocument); Bar bar = new Bar(barScxmlDocument); assertTrue(fooCalled); // bar's initialstate "bar" never called, since bar's AbstractStateMachine has // static reference to stateMachine for foo.xml assertTrue(barCalled); } private class Foo extends AbstractStateMachine { public Foo(final URL scxmlDocument) { super(scxmlDocument); } public void foo() { fooCalled = true; } } private class Bar extends AbstractStateMachine { public Bar(final URL scxmlDocument) { super(scxmlDocument); } public void bar() { barCalled = true; } } with simple SCXML files foo.xml: <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="foo"> <state id="foo"/> </scxml> bar.xml: <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="bar"> <state id="bar"/> </scxml> [junit] Running org.apache.commons.scxml.env.EnvTestSuite org.apache.commons.scxml.env.AbstractStateMachineTest$Bar.foo() java.lang.NoSuchMethodException: org.apache.commons.scxml.env.AbstractStateMachineTest$Bar.foo() at java.lang.Class.getDeclaredMethod(Class.java:1937) at org.apache.commons.scxml.env.AbstractStateMachine.invoke(AbstractStateMachine.java:212) at org.apache.commons.scxml.env.AbstractStateMachine$EntryListener.onEntry(AbstractStateMachine.java:269) Testsuite: org.apache.commons.scxml.env.EnvTestSuite Tests run: 21, Failures: 2, Errors: 0, Time elapsed: 0.391 sec Testcase: testMoreThanOneScxmlDocument(org.apache.commons.scxml.env.AbstractStateMachineTest): FAILED junit.framework.AssertionFailedError at org.apache.commons.scxml.env.AbstractStateMachineTest.testMoreThanOneScxmlDocument(AbstractStateMachineTest.java:60) Testcase: testStopWatch(org.apache.commons.scxml.env.StopWatchTest): FAILED expected:<reset> but was:<foo> junit.framework.ComparisonFailure: expected:<reset> but was:<foo> at org.apache.commons.scxml.env.StopWatchTest.testStopWatch(StopWatchTest.java:56) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]