Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I verify that my SCXML defines a valid state machine?

Tags:

java

scxml

I've just started looking at defining state machines and SCXML looks attractive, especially the Apache Commons SCXML for Java. Obviously I can validate the XML (with an appropriate XSD).

However I can't obviously find any way to verify that the defined state machine is valid (no dead-ends, no unreachable states, etc).

But how can I verify a defined state-machine before I execute it? In particular I am interested in tools that can integrated into a build tool-chain (i.e. from the command-line).

like image 757
KevinM Avatar asked Oct 16 '25 19:10

KevinM


1 Answers

The uscxml-analyze tool from the uSCXML distribution will do just that:

$ uscxml-browser -c ../../test/w3c/ecma/test144.scxml

It checks for a whole bunch of issues:

  • Required attributes
  • Valid parent elements
  • Valid default history configurations
  • Valid initial transition
  • Valid initial attributes
  • Unreachable state hierarchies
  • Uniqueness of state id attribute
  • Valid targets for transitions
  • Redundant / unselectable transitions
  • Superfluous history elements
  • Legal configuration of target sets
  • A bunch of attribute / element combination constraints
  • Valid syntax of data-model expressions

The uSCXML interpreter will also check for cycles within a macro-step during interpretation.

like image 128
sradomski Avatar answered Oct 18 '25 09:10

sradomski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!