You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Wolfgang Frech (JIRA)" <ji...@apache.org> on 2007/02/12 18:02:09 UTC

[jira] Commented: (SCXML-38) spec and semantics of initialstate attribute not clear for external state

    [ https://issues.apache.org/jira/browse/SCXML-38?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12472340 ] 

Wolfgang Frech commented on SCXML-38:
-------------------------------------

continued...

In a external state with a substate, the initialstate attribute does not replace the initial child.


Demo
-----
	@Test
	public void externalStateWithInitialSubstate() throws FileNotFoundException,
			IOException, SAXException, ModelException {
		final URL definition = getClass().getClassLoader().getResource(
				"externalStateWithInitialSubstate-external.scxml");
		try {
			SCXMLDigester.digest(definition, new SimpleErrorHandler());
			fail();
		} catch (ModelException e) {
			assertEquals(
					"No initial element available for state with ID \"start\"",
					e.getMessage());
		}
	}
-----
<?xml version="1.0"?>
<scxml
  xmlns="http://www.w3.org/2005/07/scxml"
  version="1.0"
  initialstate="start">
  <state id="start" src="externalStateWithInitialstate-external.scxml"/>
</scxml>
-----
<?xml version="1.0"?>
<scxml
  xmlns="http://www.w3.org/2005/07/scxml"
  version="1.0"
  initialstate="start">
  <state id="start">
    <onentry>
      <log expr="'now in state start'" />
    </onentry>
  </state>
</scxml>
-----



> spec and semantics of initialstate attribute not clear for external state
> -------------------------------------------------------------------------
>
>                 Key: SCXML-38
>                 URL: https://issues.apache.org/jira/browse/SCXML-38
>             Project: Commons SCXML
>          Issue Type: Bug
>    Affects Versions: 0.6
>         Environment: Win XP, Java 5, Eclipse 3.2, JUnit 4
>            Reporter: Wolfgang Frech
>            Priority: Minor
>
> The WD-SCXML is not fully consistent if the initialstate attribute is required for an external state, that is a state that has a src attribute pointing to a file containing its content.
> The attribute details (WD 3.1.1) define the initialstate attribute as required, without any exception for external states.
> The example Test2Sub1.scxml (WD F.1) does not have a initialstate attribute.
> If this is only a minor omission in the example, the real issue is: how does an initialstate attribute affect the behavior of the state chart?
> So far this would be only an issue with the WD.
> The commons SCXML implementation decided to treat the initialstate attribute as required.
> Demonstration code follows.
> The issue with the commons implementation is:
> It is not clear which (state) id can be given in the initialstate attribute of an external state SCXML file and what this means.
> The id of the external state itself is not accepted. See second demonstration code.
> Demo - initialstate required:
> ----
> 	@Test
> 	public void externalStateWithoutInitialstate() throws FileNotFoundException,
> 			IOException, SAXException, ModelException {
> 		final URL definition = getClass().getClassLoader().getResource(
> 				"externalStateWithoutInitialstate-main.scxml");
> 		try {
> 			SCXMLDigester.digest(definition, new SimpleErrorHandler());
> 			fail();
> 		} catch (ModelException e) {
> 			assertEquals(
> 					"Initial state null or not a descendant of state with ID \"start\"",
> 					e.getMessage());
> 		}
> 	}
> ----
> main scxml
> ----
> <?xml version="1.0"?>
> <scxml
>   xmlns="http://www.w3.org/2005/07/scxml"
>   version="1.0"
>   initialstate="start">
>   <state id="start" src="externalStateWithoutInitialstate-external.scxml"/>
> </scxml>
> ----
> included scxml 
> note: no initalstate
> ----
> <?xml version="1.0"?>
> <scxml
>   xmlns="http://www.w3.org/2005/07/scxml"
>   version="1.0">
>   <state id="start" />
> </scxml>
> Demo - with initialstate pointing to external state
> -----
> 	@Test
> 	public void externalStateWithInitialstate() throws FileNotFoundException,
> 			IOException, SAXException, ModelException {
> 		final URL definition = getClass().getClassLoader().getResource(
> 				"externalStateWithInitialstate-main.scxml");
> 		try {
> 			SCXMLDigester.digest(definition, new SimpleErrorHandler());
> 			fail();
> 		} catch (ModelException e) {
> 			assertEquals(
> 					"Initial state null or not a descendant of state with ID \"start\"",
> 					e.getMessage());
> 		}
> 	}
> -----
> main scxml
> -----
> <?xml version="1.0"?>
> <scxml
>   xmlns="http://www.w3.org/2005/07/scxml"
>   version="1.0"
>   initialstate="start">
>   <state id="start" src="externalStateWithInitialstate-external.scxml"/>
> </scxml>
> ----
> included scxml
> note: with initialstate
> ----
> <?xml version="1.0"?>
> <scxml
>   xmlns="http://www.w3.org/2005/07/scxml"
>   version="1.0"
>   initialstate="start">
>   <state id="start">
>     <onentry>
>       <log expr="'now in state start'" />
>     </onentry>
>   </state>
> </scxml>
> ----

-- 
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org