diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-09-08 23:26:39 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-09-08 23:26:39 (GMT) |
commit | aa6c3a1257a29cc5bcf8b94893732ee553f27582 (patch) | |
tree | 625adb1a353a17ffed2c7e0bac686d705aaec93f /test/samples/apache | |
download | uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.zip uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.tar.gz uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.tar.bz2 |
Initial upload
Still somewhat quirky to build but fairly feature complete
Diffstat (limited to 'test/samples/apache')
84 files changed, 4707 insertions, 0 deletions
diff --git a/test/samples/apache/actions-initial-test.xml b/test/samples/apache/actions-initial-test.xml new file mode 100644 index 0000000..d2d3e48 --- /dev/null +++ b/test/samples/apache/actions-initial-test.xml @@ -0,0 +1,57 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initial="actionsTest"> + + <state id="actionsTest"> + <initial> + <transition target="child1"> + <cs:var name="foo"/> + <cs:var name="delta" expr="${1+2+3}" /> + <cs:var name="eventsent"/> + <if cond="${delta le 3}"> + <assign name="foo" expr="bar" /> + <elseif cond="${delta eq 3}"/> + <assign name="foo" expr="fubar" /> + <else/> + <assign name="foo" expr="foobar" /> + </if> + <cs:var name="drink" expr="water" /> + <cs:var name="eat" expr="flies" /> + <send sendid="send12345" target="freddy" type="frog" + event="croak" namelist="drink eat" hints="h2o bzz" + delay="${1000+500}" /> + <cancel sendId="send12345"/> + <log expr="leaving" label="entry001" /> + <event name="event.test"/> + <!-- exit will be ignored, makes little sense in initial --> + <cs:exit expr="later" namelist="freddy" /> + </transition> + </initial> + + <transition event="event.test"> + <assign name="eventsent" expr="true"/> + </transition> + + <state id="child1"/> + + </state> + +</scxml>
\ No newline at end of file diff --git a/test/samples/apache/actions-parallel-test.xml b/test/samples/apache/actions-parallel-test.xml new file mode 100644 index 0000000..be9d25c --- /dev/null +++ b/test/samples/apache/actions-parallel-test.xml @@ -0,0 +1,55 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initial="actionsTest"> + + <parallel id="actionsTest"> + <onentry> + <cs:var name="foo"/> + <cs:var name="delta" expr="${1+2+3}" /> + <cs:var name="eventsent"/> + <if cond="${delta le 3}"> + <assign name="foo" expr="bar" /> + <elseif cond="${delta eq 3}"/> + <assign name="foo" expr="fubar" /> + <else/> + <assign name="foo" expr="foobar" /> + </if> + <cs:var name="drink" expr="water" /> + <cs:var name="eat" expr="flies" /> + <send sendid="send12345" target="freddy" type="frog" + event="croak" namelist="drink eat" hints="h2o bzz" + delay="${1000+500}" /> + <cancel sendId="send12345"/> + <log expr="leaving" label="entry001" /> + <event name="event.test"/> + <cs:exit expr="later" namelist="freddy" /> + </onentry> + + <transition event="event.test"> + <assign name="eventsent" expr="true"/> + </transition> + + <!-- dummy regions --> + <state id="state01"/> + <state id="state02"/> + </parallel> + +</scxml>
\ No newline at end of file diff --git a/test/samples/apache/actions-state-test.xml b/test/samples/apache/actions-state-test.xml new file mode 100644 index 0000000..3374e21 --- /dev/null +++ b/test/samples/apache/actions-state-test.xml @@ -0,0 +1,52 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="actionsTest"> + + <state id="actionsTest" final="true"> + <onentry> + <cs:var name="foo"/> + <cs:var name="delta" expr="${1+2+3}" /> + <cs:var name="eventsent"/> + <if cond="${delta le 3}"> + <assign name="foo" expr="bar" /> + <elseif cond="${delta eq 3}"/> + <assign name="foo" expr="fubar" /> + <else/> + <assign name="foo" expr="foobar" /> + </if> + <cs:var name="drink" expr="water" /> + <cs:var name="eat" expr="flies" /> + <send sendid="send12345" target="freddy" type="frog" + event="croak" namelist="drink eat" hints="h2o bzz" + delay="${1000+500}" /> + <cancel sendId="send12345"/> + <log expr="leaving" label="entry001" /> + <event name="event.test"/> + <cs:exit expr="later" namelist="freddy" /> + </onentry> + + <transition event="event.test"> + <assign name="eventsent" expr="true"/> + </transition> + + </state> + +</scxml>
\ No newline at end of file diff --git a/test/samples/apache/assign-test-01.xml b/test/samples/apache/assign-test-01.xml new file mode 100644 index 0000000..ed7e977 --- /dev/null +++ b/test/samples/apache/assign-test-01.xml @@ -0,0 +1,70 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Test "src" attribute of assign element --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:rad="http://foo/bar" + version="1.0" + initialstate="assign1"> + + <state id="assign1" final="true"> + + <datamodel> + <data id="foo"> + <root xmlns=""> + <foo/> + </root> + </data> + <data id="bar"> + <root xmlns=""> + <bar>5</bar> + </root> + </data> + </datamodel> + + <onentry> + <assign location="Data(foo,'root/foo')" src="assign-src.xml"/> + </onentry> + + <transition cond="Data(foo,'root/foo/a') + Data(bar,'root/bar') eq 15" + target="assign2" /> + + </state> + + <state id="assign2"> + + <datamodel> + <data id="jira51data1"> + <rad:timeout>10</rad:timeout> + </data> + <data id="jira51data2"> + <rad:short xmlns="">20</rad:short> + </data> + </datamodel> + + <onentry> + <assign location="Data(jira51data1,'rad:timeout')" expr="Data(jira51data2,'rad:short')"/> + </onentry> + + <transition cond="Data(jira51data1,'rad:timeout') eq 20" + target="assign3" /> + + </state> + + <state id="assign3" final="true"/> + +</scxml> diff --git a/test/samples/apache/assign-test-02.xml b/test/samples/apache/assign-test-02.xml new file mode 100644 index 0000000..38ab9b3 --- /dev/null +++ b/test/samples/apache/assign-test-02.xml @@ -0,0 +1,46 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Regress JIRA 89, incomplete child removal --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:rad="http://foo/bar" version="1.0" initialstate="assign1"> + <datamodel> + <data name="source"> + <rad:foo> + <rad:a>1</rad:a> + <rad:b>2</rad:b> + </rad:foo> + </data> + <data name="destination"> + <rad:bar> + <rad:a>3</rad:a> + <rad:b>4</rad:b> + </rad:bar> + </data> + </datamodel> + <!-- verify the destination contents --> + <state id="assign1" final="true"> + <transition cond="Data(destination,'rad:bar/rad:a') eq 3 and Data(destination,'rad:bar/rad:b') eq 4" target="assign2" /> + </state> + <!-- copy the new contents and verify --> + <state id="assign2"> + <onentry> + <assign location="Data(destination,'rad:bar')" expr="Data(source,'rad:foo')" /> + </onentry> + <transition cond="Data(destination,'rad:bar/rad:a') eq 1 and Data(destination,'rad:bar/rad:b') eq 2" target="assign3" /> + </state> + <state id="assign3" final="true" /> +</scxml> diff --git a/test/samples/apache/bar.xml b/test/samples/apache/bar.xml new file mode 100644 index 0000000..3901080 --- /dev/null +++ b/test/samples/apache/bar.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="bar"> + + <state id="bar"/> + +</scxml> + diff --git a/test/samples/apache/custom-hello-world-01.xml b/test/samples/apache/custom-hello-world-01.xml new file mode 100644 index 0000000..5d8a348 --- /dev/null +++ b/test/samples/apache/custom-hello-world-01.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for comparison with hello-world.xml by + CustomActionTest.java in model package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:my="http://my.custom-actions.domain/CUSTOM1" + xmlns:foo="http://my.custom-actions.domain/CUSTOM2" + version="1.0" + initialstate="custom"> + + <state id="custom" final="true"> + + <onentry> + <my:hello name="world" /> + <!-- foo:bar also maps to Hello action --> + <foo:bar name="custom action" /> + </onentry> + + </state> + +</scxml> + diff --git a/test/samples/apache/custom-hello-world-02.xml b/test/samples/apache/custom-hello-world-02.xml new file mode 100644 index 0000000..7b27ccf --- /dev/null +++ b/test/samples/apache/custom-hello-world-02.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for CustomActionTest.java in model package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:my="http://my.custom-actions.domain/CUSTOM" + version="1.0" + initialstate="custom"> + + <state id="custom" final="true"> + + <onentry> + <my:hello name="child (included) document" /> + </onentry> + + </state> + +</scxml> + diff --git a/test/samples/apache/custom-hello-world-03.xml b/test/samples/apache/custom-hello-world-03.xml new file mode 100644 index 0000000..c8cfc5e --- /dev/null +++ b/test/samples/apache/custom-hello-world-03.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for CustomActionTest.java in model package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:my="http://my.custom-actions.domain/CUSTOM" + version="1.0" + initialstate="custom"> + + <state id="custom" final="true"> + + <onentry> + <my:send name="overridden local name" /> + </onentry> + + </state> + +</scxml> + diff --git a/test/samples/apache/custom-hello-world-04-el.xml b/test/samples/apache/custom-hello-world-04-el.xml new file mode 100644 index 0000000..0d5300b --- /dev/null +++ b/test/samples/apache/custom-hello-world-04-el.xml @@ -0,0 +1,44 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for CustomActionTest.java in model package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:my="http://my.custom-actions.domain/CUSTOM" + version="1.0" initialstate="init"> + <datamodel> + <data id="helloName1" /> + </datamodel> + + <state id="init"> + <onentry> + <my:hello name="custom04" /> + </onentry> + + <transition event="helloevent" target="middle1"> + <assign name="helloName1" expr="${_eventdatamap.helloevent}" /> + </transition> + </state> + + <state id="middle1"> + <transition target="custom" cond="${helloName1 eq 'custom04'}" /> + </state> + + <state id="custom" final="true"/> + +</scxml> + + diff --git a/test/samples/apache/custom-hello-world-04-jexl.xml b/test/samples/apache/custom-hello-world-04-jexl.xml new file mode 100644 index 0000000..c44e9b3 --- /dev/null +++ b/test/samples/apache/custom-hello-world-04-jexl.xml @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for CustomActionTest.java in model package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:my="http://my.custom-actions.domain/CUSTOM" + version="1.0" initialstate="init"> + <datamodel> + <data id="helloName1" /> + </datamodel> + + <state id="init"> + <onentry> + <my:hello name="custom04a" /> + </onentry> + + <transition event="helloevent" target="middle1"> + <assign name="helloName1" expr="_eventdatamap['helloevent']" /> + </transition> + </state> + + <state id="middle1"> + <transition target="custom1" cond="helloName1 eq 'custom04a'" /> + </state> + + <state id="custom1"> + <transition event="custom.next" target="custom2"/> + </state> + + <state id="custom2"> + <onentry> + <my:hello name="custom04b" /> + </onentry> + + <transition event="helloevent" target="custom3"> + <assign name="helloName1" expr="_eventdatamap.helloevent" /> + </transition> + </state> + + <state id="custom3"> + <transition target="end" cond="helloName1 eq 'custom04b'" /> + </state> + + <state id="end" final="true"/> + +</scxml> + + diff --git a/test/samples/apache/datamodel-01.xml b/test/samples/apache/datamodel-01.xml new file mode 100644 index 0000000..cc874fb --- /dev/null +++ b/test/samples/apache/datamodel-01.xml @@ -0,0 +1,107 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- A fictitious state machine used by test cases. + Meant to illustrate the usage of SCXML <datamodel> element + and the Commons SCXML Data() function --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="main"> + + <!-- Root or document datamodel --> + <datamodel> + <data id="docdata"> + <root xmlns=""> + <foo>foo</foo> + </root> + </data> + </datamodel> + + <state id="main"> + + <initial> + <transition target="ten"/> + </initial> + + <!-- datamodel scoped to state "main" --> + <datamodel> + <data id="mainvar" expr="${0}" /> + <data id="maindata"> + <root xmlns=""> + <foo> + <bar>bar</bar> + </foo> + </root> + </data> + </datamodel> + + <state id="ten"> + <onentry> + <!-- Assign Usage 1: name is previously defined + <var> or degenerate <data> (as in this case) --> + <assign name="mainvar" expr="${10}" /> + </onentry> + <!-- Commons SCXML defines a Data() function to use in conjunction + with the Commons EL expression language. The + first argument is the named XML data tree and the second is + the XPath expression to a node whose value is to be + examined --> + <transition event="ten.done" + cond="${mainvar eq 10 and Data(maindata,'root/foo/bar') eq 'bar'}" + target="twenty" /> + <onexit> + <!-- Assign Usage 2: location must point to an existing + node --> + <assign location="${Data(maindata,'root/foo/bar')}" expr="baz" /> + </onexit> + </state> + + <state id="twenty"> + <onentry> + <assign name="mainvar" expr="${20}" /> + </onentry> + <transition event="twenty.done" + cond="${Data(maindata,'root/foo/bar') eq 'baz' and mainvar eq 20}" + target="thirty" /> + <onexit> + <!-- Assign Usage 3: location points to an existing + node, and expr points to an existing node. + In this case, location adopts expr's child nodes. --> + <assign location="${Data(docdata,'root/foo')}" + expr="${Data(maindata,'root/foo')}" /> + <assign location="${Data(docdata,'root/foo/bar')}" + expr="${10}" /> + </onexit> + </state> + + <state id="thirty"> + <!-- Arithmetic operations are possible with results from + the Data() function. Note that data "docdata" + did not have a node at 'root/foo/bar' to begin with, + the XML tree was manipulated by the <assign> above --> + <transition event="thirty.done" + cond="${Data(docdata,'root/foo/bar') gt 5}" + target="forty" /> + </state> + + <state id="forty" final="true" /> + + </state> + +</scxml> + + diff --git a/test/samples/apache/datamodel-02.xml b/test/samples/apache/datamodel-02.xml new file mode 100644 index 0000000..b719b8b --- /dev/null +++ b/test/samples/apache/datamodel-02.xml @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- A fictitious state machine used by test cases. Meant to illustrate + prefixed XPath expressions in the Commons SCXML Data() function --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <!-- Start with a prefixless XPath (see transition cond) --> + <state id="ten"> + + <datamodel> + <data id="data10"> + <root xmlns=""> + <foo>10</foo> + </root> + </data> + </datamodel> + + <transition event="ten.done" cond="${Data(data10,'root/foo') eq 10}" + target="twenty" /> + + </state> + + <!-- Already defined (and identical) prefixes --> + <state id="twenty" xmlns:ns1="http://namespace.test.domain/1" + xmlns:ns2="http://namespace.test.domain/2"> + + <datamodel> + <!-- Start with a prefixless XPath --> + <data id="data20"> + <ns1:root> + <ns2:foo>20</ns2:foo> + </ns1:root> + </data> + </datamodel> + + <transition event="twenty.done" cond="${Data(data20,'ns1:root/ns2:foo') eq 20}" + target="thirty" /> + + </state> + + <!-- Data without prefixes --> + <state id="thirty"> + + <datamodel> + <!-- Start with a prefixless XPath --> + <data id="data30"> + <root xmlns="http://namespace.test.domain/1"> + <foo xmlns="http://namespace.test.domain/2">30</foo> + </root> + </data> + </datamodel> + + <transition event="thirty.done" + xmlns:ns1="http://namespace.test.domain/1" + xmlns:ns2="http://namespace.test.domain/2" + xmlns:ns3="http://namespace.test.domain/3" + cond="${Data(data30,'ns1:root/ns2:foo') eq 30}" + target="forty" /> + + </state> + + <state id="forty" final="true" /> + +</scxml> + + diff --git a/test/samples/apache/datamodel-03.xml b/test/samples/apache/datamodel-03.xml new file mode 100644 index 0000000..f8a3310 --- /dev/null +++ b/test/samples/apache/datamodel-03.xml @@ -0,0 +1,259 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- A fictitious state machine used by test cases. Meant to illustrate + prefixed XPath expressions in the Commons SCXML Data() function. + Used by org.apache.commons.scxml.NamespacePrefixedPathsTest + Also serves as testing the underlying functionality of the + underlying parsing technology (here, Digester 1.8) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="ten"> + + <!-- Root data model --> + <datamodel> + + <!-- We'll use this for XPaths --> + <data id="rootdata" + xmlns:ns1="scheme://namespace.test.domain/1" + xmlns:ns2="scheme://namespace.test.domain/2" + xmlns:ns3="scheme://namespace.test.domain/3"> + <ns1:root> + <ns2:foo> + <ns3:bar>1</ns3:bar> + </ns2:foo> + </ns1:root> + </data> + + <!-- We'll use this for the JUnit test + NamespacePrefixedPathsTest.java (scxml package) --> + <data id="retval" /> + + </datamodel> + + <!-- State data model --> + <state id="ten"> + + <datamodel> + + <data id="data10" xmlns:ns4="scheme://namespace.test.domain/1"> + <root xmlns=""> + <ns4:foo> + <bar>10</bar> + </ns4:foo> + </root> + </data> + + </datamodel> + + <onentry> + <cs:var xmlns:pre1="scheme://namespace.test.domain/1" + xmlns:pre2="scheme://namespace.test.domain/2" + xmlns:pre3="scheme://namespace.test.domain/3" + name="tentest" + expr="${Data(rootdata,'pre1:root/pre2:foo/pre3:bar') + Data(data10,'root/pre1:foo/bar')}" /> + </onentry> + + <transition event="ten.done" + cond="${tentest eq 11}" + target="twenty" /> + + <onexit> + <assign name="retval" + expr="${tentest}" /> + </onexit> + + </state> + + <!-- Already defined (and different) prefixes --> + <state id="twenty" xmlns:ns1="scheme://namespace.test.domain/1" + xmlns:ns2="scheme://namespace.test.domain/2" + xmlns:ns3="scheme://namespace.test.domain/3"> + + <datamodel> + + <data id="data20"> + <ns1:root> + <ns2:foo>20</ns2:foo> + </ns1:root> + </data> + + </datamodel> + + <onentry> + <assign location="${Data(rootdata,'ns1:root/ns2:foo/ns3:bar')}" + expr="${2}" /> + </onentry> + + + <!-- Redefine namespace prefixes --> + <transition event="twenty.done" + xmlns:ns1="scheme://namespace.test.domain/1" + xmlns:ns2="scheme://namespace.test.domain/2" + cond="${Data(data20,'ns1:root/ns2:foo') eq 20 and Data(rootdata,'ns1:root/ns2:foo/ns3:bar') eq 2}" + target="thirty" /> + + <onexit> + + <!-- Redefine different prefixes bound to above namespaces --> + <if xmlns:pre1="scheme://namespace.test.domain/1" + xmlns:pre2="scheme://namespace.test.domain/2" + cond="${Data(data20,'pre1:root/pre2:foo') lt 20}"> + + <assign name="retval" expr="Less than 20" /> + + <elseif cond="${Data(data20,'pre1:root/pre2:foo') eq 20}" /> + + <assign name="retval" expr="Equal to 20" /> + + <else/> + + <assign name="retval" expr="Greater than 20" /> + + </if> + + </onexit> + + </state> + + <!-- XPath looking at attribute --> + <state id="thirty"> + + <datamodel> + + <data id="data30"> + <root xmlns="scheme://namespace.test.domain/1"> + <foo xmlns="scheme://namespace.test.domain/2" + xmlns:ns1="scheme://namespace.test.domain/3" + ns1:attfoo="30" attbar="300"/> + </root> + </data> + + </datamodel> + + <transition event="thirty.done" + xmlns:ns1="scheme://namespace.test.domain/1" + xmlns:ns2="scheme://namespace.test.domain/2" + xmlns:ns3="scheme://namespace.test.domain/3" + cond="${Data(data30,'ns1:root/ns2:foo/@ns3:attfoo') + Data(data30,'ns1:root/ns2:foo/@attbar') eq 330}" + target="forty" /> + + </state> + + <!-- Multiple data, already defined prefixes --> + <state id="forty" xmlns:ns1="scheme://namespace.test.domain/1" + xmlns:ns2="scheme://namespace.test.domain/2" + xmlns:ns3="scheme://namespace.test.domain/3" + xmlns:ns4="scheme://namespace.test.domain/4"> + + <datamodel> + + <data id="data40"> + <root xmlns=""> + <ns1:foo ns2:attfoo="40"/> + </root> + </data> + + <data id="data41"> + <ns3:root> + <ns4:foo>41</ns4:foo> + </ns3:root> + </data> + + </datamodel> + + <transition event="forty.done" + cond="${Data(data40,'root/ns1:foo/@ns2:attfoo') + Data(data41,'ns3:root/ns4:foo') eq 81}" + target="fifty" /> + + </state> + + <!-- Multiple data, prefixes on elements --> + <state id="fifty"> + + <datamodel> + + <data id="data50" xmlns:ns1="scheme://namespace.test.domain/1" + xmlns:ns2="scheme://namespace.test.domain/2" + xmlns:ns3="scheme://namespace.test.domain/3"> + <ns1:root> + <ns2:foo ns3:attfoo="50"/> + </ns1:root> + </data> + + <data id="data51" xmlns:ns3="scheme://namespace.test.domain/3" + xmlns:ns4="scheme://namespace.test.domain/4"> + <ns3:root> + <ns4:foo attfoo="51"/> + </ns3:root> + </data> + + </datamodel> + + <transition event="fifty.done" + xmlns:ns1="scheme://namespace.test.domain/1" + xmlns:ns2="scheme://namespace.test.domain/2" + xmlns:ns3="scheme://namespace.test.domain/3" + xmlns:ns4="scheme://namespace.test.domain/4" + cond="${Data(data50,'ns1:root/ns2:foo/@ns3:attfoo') + Data(rootdata,'ns1:root/ns2:foo/ns3:bar') eq 52}" + target="sixty" /> + + </state> + + <!-- Multiple data, prefixes on datamodel and transition elements --> + <state id="sixty"> + + <datamodel xmlns:ns1="scheme://namespace.test.domain/1" + xmlns:ns2="scheme://namespace.test.domain/2" + xmlns:ns3="scheme://namespace.test.domain/3" + xmlns:ns4="scheme://namespace.test.domain/4"> + + <data id="data60"> + <root xmlns=""> + <ns1:foo ns2:attfoo="60"/> + </root> + </data> + + <data id="data61"> + <ns3:root> + <ns4:foo attfoo="61"/> + </ns3:root> + </data> + + </datamodel> + + <transition event="sixty.done" + xmlns:pre1="scheme://namespace.test.domain/1" + xmlns:pre2="scheme://namespace.test.domain/2" + xmlns:pre3="scheme://namespace.test.domain/3" + xmlns:pre4="scheme://namespace.test.domain/4" + cond="${Data(data60,'root/pre1:foo/@pre2:attfoo') + Data(data61,'pre3:root/pre4:foo/@attfoo') eq 121}" + target="seventy"> + + <!-- should be 121 --> + <log expr="${Data(data60,'root/pre1:foo/@pre2:attfoo') + Data(data61,'pre3:root/pre4:foo/@attfoo')}"/> + + </transition> + + </state> + + <state id="seventy" final="true" /> + +</scxml> + + diff --git a/test/samples/apache/datamodel-04.xml b/test/samples/apache/datamodel-04.xml new file mode 100644 index 0000000..503a858 --- /dev/null +++ b/test/samples/apache/datamodel-04.xml @@ -0,0 +1,48 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- A fictitious state machine used by test cases. + Meant to illustrate the usage of SCXML <datamodel> element + to persist some _eventdata --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <!-- Root or document datamodel --> + <datamodel> + <data id="payload"/> + </datamodel> + + <state id="ten"> + <transition event="ten.done" target="twenty"> + <assign name="payload" expr="_eventdata" /> + </transition> + </state> + + <state id="twenty"> + <transition event="twenty.done" target="thirty" /> + <onexit> + <log label="Persisted eventdata.one" expr="payload.one"/> + <log label="Persisted eventdata.two" expr="payload.two"/> + </onexit> + </state> + + <state id="thirty" final="true"/> + +</scxml> + + diff --git a/test/samples/apache/edit-profile-config.xml b/test/samples/apache/edit-profile-config.xml new file mode 100644 index 0000000..cdab498 --- /dev/null +++ b/test/samples/apache/edit-profile-config.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. + + $Id: edit-profile-config.xml 462838 2006-10-11 16:08:36Z rahul $ + +--> + +<!-- + + Dialog definitions for Shale Use Cases Example Web Application + written out as SCXML to demonstrate use of Commons SCXML as one + of Shale's Dialog Manager implementations. + + Related artifacts from <dialog name="Edit Profile">...</dialog> + in original dialogs definition file from Shale nightlies. + +--> + +<scxml xmlns="http://www.w3.org/2005/01/SCXML" version="1.0" + initialstate="edit"> + + <state id="edit"> + + <initial> + <transition> + <target next="setup"/> + </transition> + </initial> + + <!-- global transitions (within state "edit") --> + + <transition event="faces.outcome" + cond="${outcome eq 'cancel'}"> + <target next="cancel"/> + </transition> + + <transition event="faces.outcome" + cond="${outcome eq 'finish'}"> + <target next="finish"/> + </transition> + + <state id="setup"> + + <onentry> + <var name="setupOutcome" + expr="#{profile$edit.setup}" /> + </onentry> + + <transition cond="${setupOutcome eq 'success'}"> + <target next="page1"/> + </transition> + + </state> + + <state id="page1"> + + <transition event="faces.outcome" + cond="${outcome eq 'next'}"> + <target next="page2"/> + </transition> + + </state> + + <state id="page2"> + + <transition event="faces.outcome" + cond="${outcome eq 'previous'}"> + <target next="page1"/> + </transition> + + <transition event="faces.outcome" + cond="${outcome eq 'next'}"> + <target next="page3"/> + </transition> + + </state> + + <state id="page3"> + + <transition event="faces.outcome" + cond="${outcome eq 'previous'}"> + <target next="page2"/> + </transition> + + <transition event="faces.outcome" + cond="${outcome eq 'next'}"> + <target next="editExit"/> + </transition> + + </state> + + </state> + + <state id="cancel"> + + <onentry> + <var name="cancelOutcome" + expr="#{profile$edit.cancel}" /> + </onentry> + + <transition cond="${cancelOutcome eq 'success'}"> + <var name="outcome" + expr="cancel"/> + <target next="editExit"/> + </transition> + + </state> + + <state id="finish"> + + <onentry> + <var name="finishOutcome" + expr="#{profile$edit.finish}" /> + </onentry> + + <transition cond="${finishOutcome eq 'username'}"> + <target next="page1"/> + </transition> + + <transition cond="${finishOutcome eq 'password'}"> + <target next="page1"/> + </transition> + + <transition cond="${finishOutcome eq 'success'}"> + <var name="outcome" + expr="success"/> + <target next="editExit"/> + </transition> + + </state> + + <state id="editExit" + final="true" /> + +</scxml> diff --git a/test/samples/apache/eventdata-01.xml b/test/samples/apache/eventdata-01.xml new file mode 100644 index 0000000..c07d42d --- /dev/null +++ b/test/samples/apache/eventdata-01.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + datamodel="ecmascript" + initialstate="state1"> + <state id="state1"> + <transition event="event.foo" cond="_event.data == 2" + target="state2"/> + <transition event="event.foo" cond="_event.data == 3" + target="state3"/> + <transition event="event.foo"> + <log expr="'event.name: ' + _event.name" /> + </transition> + </state> + <state id="state2" final="true"/> + <state id="state3"> + <transition event="event.bar" target="state4" + cond="_event.data == 4"/> + <transition event="event.bar" target="state5" + cond="_event.data == 5"/> + <transition event="event.bar" target="state6" + cond="_event.data == 6"/> + </state> + <state id="state4" final="true"/> + <state id="state5" final="true"/> + <state id="state6"> + <transition event="event.baz" target="state7" + cond="_event.data == 7"/> + </state> + <state id="state7" final="true"/> +</scxml> diff --git a/test/samples/apache/eventdata-02.xml b/test/samples/apache/eventdata-02.xml new file mode 100644 index 0000000..df130ae --- /dev/null +++ b/test/samples/apache/eventdata-02.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + datamodel="ecmascript" + initialstate="state0"> + <state id="state0"> + <!-- Payload can be any object, such as a String ... --> + <transition event="connection.alerting" + cond="_event.data == 'line1'" target="state1"/> + <transition event="connection.alerting" + cond="_event.data == 'line2'" target="state2"/> + </state> + <state id="state1" final="true"/> + <state id="state2"> + <!-- ... or an arbitrary, user defined object. --> + <transition event="connection.alerting" + cond="_event.data.line == 3" target="state3"/> + <transition event="connection.alerting" + cond="_event.data.line == 4" target="state4"/> + </state> + <state id="state3" final="true"/> + <state id="state4" final="true"/> +</scxml> diff --git a/test/samples/apache/eventdata-03.xml b/test/samples/apache/eventdata-03.xml new file mode 100644 index 0000000..d4c4388 --- /dev/null +++ b/test/samples/apache/eventdata-03.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="ten"> + + <datamodel> + <data id="rootdata"> + <root xmlns=""> + <one>1</one> + <two>2</two> + </root> + </data> + </datamodel> + + <state id="ten"> + <transition event="event.foo" target="twenty"/> + </state> + + <state id="twenty"> + <onentry> + <cs:var name="one" expr="Data(rootdata,'root/one')"/> + <cs:var name="two" expr="Data(rootdata,'root/two')"/> + <send event="'event.bar'" namelist="one two"/> + </onentry> + <transition event="event.bar" + cond="_eventdatamap['event.bar'].one + _eventdatamap['event.bar'].two eq 3" + target="thirty"/> + </state> + + <state id="thirty" final="true"/> + +</scxml> diff --git a/test/samples/apache/eventdata-04.xml b/test/samples/apache/eventdata-04.xml new file mode 100644 index 0000000..541d2e9 --- /dev/null +++ b/test/samples/apache/eventdata-04.xml @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="start"> + + <parallel id="start"> + + <state id="simulatedUser"> + <datamodel> + <data name="one" expr="1" /> + <data name="two" expr="2" /> + </datamodel> + + <onentry> + <send event="'event.bar'" namelist="one two" delay="'100ms'"/> + </onentry> + <transition event="event.bar"> + <log label="'simulatedUser'" expr="_eventdatamap['event.bar'].one + ', ' + _eventdatamap['event.bar'].two"/> + </transition> + </state> + + <state id="counter"> + <initial> + <transition target="twenty"/> + </initial> + + <state id="twenty"> + <transition event="event.bar" + cond="_eventdatamap['event.bar'].one + _eventdatamap['event.bar'].two eq 3" + target="thirty"/> + <transition event="event.bar"> + <log label="'event.bar in twenty state'" expr="_eventdatamap['event.bar'].one + ', ' + _eventdatamap['event.bar'].two"/> + </transition> + </state> + + <state id="thirty" final="true"/> + </state> + + </parallel> + +</scxml> diff --git a/test/samples/apache/external-hello-world.xml b/test/samples/apache/external-hello-world.xml new file mode 100644 index 0000000..b6d1b9f --- /dev/null +++ b/test/samples/apache/external-hello-world.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for testing custom actions in external document pulled in via + the src attributes by ExternalCustomActionTest.java in model package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:my="http://my.custom-actions.domain/CUSTOM" + version="1.0" + initialstate="external-hello"> + + <state id="external-hello" final="true" src="custom-hello-world-02.xml"> + + <onentry> + <my:hello name="parent document" /> + </onentry> + + </state> + +</scxml> diff --git a/test/samples/apache/foo.xml b/test/samples/apache/foo.xml new file mode 100644 index 0000000..486d36e --- /dev/null +++ b/test/samples/apache/foo.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="foo"> + + <state id="foo"/> + +</scxml> + diff --git a/test/samples/apache/hello-world.xml b/test/samples/apache/hello-world.xml new file mode 100644 index 0000000..7647899 --- /dev/null +++ b/test/samples/apache/hello-world.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for comparison with custom-hello-world.xml by + CustomActionTest.java in model package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="hello"> + + <state id="hello" final="true"> + <onentry> + <log expr="'hello world'" /> + </onentry> + </state> + +</scxml> + diff --git a/test/samples/apache/history-deep-01.xml b/test/samples/apache/history-deep-01.xml new file mode 100644 index 0000000..209a974 --- /dev/null +++ b/test/samples/apache/history-deep-01.xml @@ -0,0 +1,75 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + This document is an example of using deep history +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="flow"> + + <state id="flow"> + <initial> + <transition target="phases"/> + </initial> + + <!-- deep history is specified by setting the type attribute + to "deep" --> + + <history id="hist" type="deep"> + + <!-- This is the transition to be followed if no + prior history is available --> + + <transition target="phases"/> + + </history> + + <state id="phases"> + + <initial> + <transition target="phase1"/> + </initial> + + <state id="phase1"> + <transition event="phase.done" target="phase2"/> + </state> + + <state id="phase2"> + <transition event="phase.done" target="phase3"/> + </state> + + <state id="phase3" final="true" /> + + </state> + + <transition event="flow.pause" target="interrupted"/> + + <transition event="flow.terminate" target="terminated"/> + + </state> + + <state id="interrupted"> + + <transition event="flow.resume" target="hist"/> + + <transition event="flow.terminate" target="terminated"/> + + </state> + + <state id="terminated" final="true"/> + +</scxml> diff --git a/test/samples/apache/history-default-01.xml b/test/samples/apache/history-default-01.xml new file mode 100644 index 0000000..cf2f70f --- /dev/null +++ b/test/samples/apache/history-default-01.xml @@ -0,0 +1,90 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + This document is an example of specifying default transitions for + history states (if the parent state has never been visited before) +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="state1"> + + <state id="state1"> + <initial> + <transition target="history1"/> + </initial> + + <!-- shallow history, explicit default transition --> + + <history id="history1"> + <transition next="state11"/> + </history> + + <state id="state11"> + <transition event="state.next" target="state2"/> + </state> + + </state> + + <state id="state2"> + <initial> + <transition target="history2"/> + </initial> + + <!-- deep history, explicit default transition --> + + <history id="history2" type="deep"> + <transition next="state211"/> + </history> + + <state id="state21"> + + <initial> + <transition target="state212"/> + </initial> + + <state id="state211"> + <transition event="state.next" target="history3"/> + </state> + + <state id="state212"> + <transition event="state.next" target="history3"/> + </state> + + </state> + + </state> + + <state id="state3"> + + <initial> + <transition target="state31"/> + </initial> + + <!-- shallow history, no default transition specified, + reuse initial as default transition --> + + <history id="history3"/> + + <state id="state31"> + <transition event="state.next" target="state4"/> + </state> + + </state> + + <state id="state4" final="true"/> + +</scxml> diff --git a/test/samples/apache/history-shallow-01.xml b/test/samples/apache/history-shallow-01.xml new file mode 100644 index 0000000..20b5bb5 --- /dev/null +++ b/test/samples/apache/history-shallow-01.xml @@ -0,0 +1,67 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + This document is an example of using shallow history +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="flow"> + + <state id="flow"> + <initial> + <transition target="phase1"/> + </initial> + + <!-- history defaults to shallow, optionally one can set + the type attribute to "shallow" for identical results --> + + <history id="hist"> + + <!-- This is the transition to be followed if no + prior history is available --> + + <transition target="phase1"/> + + </history> + + <state id="phase1"> + <transition event="phase.done" target="phase2"/> + </state> + + <state id="phase2"> + <transition event="phase.done" target="phase3"/> + </state> + + <state id="phase3" final="true"/> + + <transition event="flow.pause" target="interrupted"/> + + <transition event="flow.terminate" target="terminated"/> + + </state> + + <state id="interrupted"> + + <transition event="flow.resume" target="hist"/> + + <transition event="flow.terminate" target="terminated"/> + + </state> + + <state id="terminated" final="true"/> + +</scxml> diff --git a/test/samples/apache/invoked-01.xml b/test/samples/apache/invoked-01.xml new file mode 100644 index 0000000..a523995 --- /dev/null +++ b/test/samples/apache/invoked-01.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="state1"> + + <state id="state1"> + <onentry> + <log expr="'foo is ' + foo + ' and bar is ' + bar" /> + </onentry> + <transition event="invoked.next" target="state2" /> + </state> + + <state id="state2" final="true" /> + +</scxml> + diff --git a/test/samples/apache/invoked-02.xml b/test/samples/apache/invoked-02.xml new file mode 100644 index 0000000..b1b471a --- /dev/null +++ b/test/samples/apache/invoked-02.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="state1"> + + <state id="state1"> + <onentry> + <send event="'invoked.next'" /> + </onentry> + <transition event="invoked.next" target="state2" /> + </state> + + <state id="state2" final="true" /> + +</scxml> + diff --git a/test/samples/apache/invoked-03-01.xml b/test/samples/apache/invoked-03-01.xml new file mode 100644 index 0000000..3b73a66 --- /dev/null +++ b/test/samples/apache/invoked-03-01.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used by InvokeTest#testInvoke03Sample() --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="s1"> + + <state id="s1"> + <onentry> + <log expr="' Inner invoke ...'"/> + </onentry> + <transition event="s1.next" target="s2"/> + </state> + + <state id="s2" final="true"/> + +</scxml> + diff --git a/test/samples/apache/invoked-03.xml b/test/samples/apache/invoked-03.xml new file mode 100644 index 0000000..91244e8 --- /dev/null +++ b/test/samples/apache/invoked-03.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used by InvokeTest#testInvoke03Sample() --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="state1"> + + <state id="state1"> + <onentry> + <log expr="' Outer invoke ...'"/> + </onentry> + <invoke type="scxml" src="invoked-03-01.xml"/> + <transition event="state1.next" target="end1" /> + </state> + + <state id="end1" final="true"> + <onentry> + <log expr="' Inner invoke completed'"/> + </onentry> + </state> + +</scxml> diff --git a/test/samples/apache/invoker-01.xml b/test/samples/apache/invoker-01.xml new file mode 100644 index 0000000..5355896 --- /dev/null +++ b/test/samples/apache/invoker-01.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="invoker"> + + <state id="invoker"> + <onentry> + <log expr="'Begin invoke test ...'" /> + </onentry> + <invoke type="scxml" src="invoked-01.xml"> + <param name="foo" expr="'foo'" /> + <param name="bar" expr="'bar'" /> + <finalize> + <log expr="'Finalizing ...'" /> + </finalize> + </invoke> + <transition event="invoker.invoke.done" target="end" /> + </state> + + <state id="end" final="true" /> + +</scxml> diff --git a/test/samples/apache/invoker-02.xml b/test/samples/apache/invoker-02.xml new file mode 100644 index 0000000..a6fb2cb --- /dev/null +++ b/test/samples/apache/invoker-02.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="invoker"> + + <state id="invoker"> + <invoke type="scxml" src="invoked-02.xml"/> + <transition event="invoker.invoke.done" target="end" /> + </state> + + <state id="end" final="true" /> + +</scxml> diff --git a/test/samples/apache/invoker-03.xml b/test/samples/apache/invoker-03.xml new file mode 100644 index 0000000..be2d1fa --- /dev/null +++ b/test/samples/apache/invoker-03.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used by InvokeTest#testInvoke03Sample() --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="invoker"> + + <state id="invoker"> + <onentry> + <log expr="'Invoker ...'"/> + </onentry> + <invoke type="scxml" src="invoked-03.xml"/> + <transition event="invoker.invoke.done" target="end"> + <log expr="' Outer invoke completed'"/> + </transition> + </state> + + <state id="end" final="true"> + <onentry> + <log expr="'Invoker completed'"/> + </onentry> + </state> + +</scxml> diff --git a/test/samples/apache/invoker-04.xml b/test/samples/apache/invoker-04.xml new file mode 100644 index 0000000..81c1bb8 --- /dev/null +++ b/test/samples/apache/invoker-04.xml @@ -0,0 +1,55 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- A fictitious state machine used by test cases. + Meant to illustrate the usage of SCXML <param> element as part + of an invocation using a custom invoker --> + +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="wait"> + + <datamodel> + <data id="foo"> + <bar>foo</bar> + </data> + </datamodel> + + <state id="wait"> + <transition event="test.trigger" target="first"/> + </state> + + <state id="first"> + <invoke src="FirstTestSrc" type="x-test"> + <param name="ding" expr="Data(foo,'node()')"/> + </invoke> + <transition event="test.trigger" target="second"/> + </state> + + <state id="second"> + <invoke src="SecondTestSrc" type="x-test"> + <param name="Data(foo,'node()')"/> + </invoke> + <transition event="test.trigger" target="third"/> + </state> + + <state id="third"> + <invoke src="ThirdTestSrc" type="x-test"> + <param name="Data(foo,'gibberish')"/> + </invoke> + </state> +</scxml>
\ No newline at end of file diff --git a/test/samples/apache/issue62-01-ext.xml b/test/samples/apache/issue62-01-ext.xml new file mode 100644 index 0000000..8c65a78 --- /dev/null +++ b/test/samples/apache/issue62-01-ext.xml @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="ext"> + + <state id="ext"> + <transition event="foo"> + <log expr="'Stay transition in issue 62 test'"/> + </transition> + </state> + +</scxml> diff --git a/test/samples/apache/issue62-01.xml b/test/samples/apache/issue62-01.xml new file mode 100644 index 0000000..3599e5e --- /dev/null +++ b/test/samples/apache/issue62-01.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="s1"> + + <state id="s1"> + <initial> + <transition target="s1.1" /> + </initial> + <state id="s1.1" src="issue62-01-ext.xml#ext" /> + <state id="s1.2" src="issue62-01-ext.xml#ext" /> + </state> + +</scxml> diff --git a/test/samples/apache/issue62-02-ext.xml b/test/samples/apache/issue62-02-ext.xml new file mode 100644 index 0000000..98da5d6 --- /dev/null +++ b/test/samples/apache/issue62-02-ext.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="e1"> + + <state id="e1"> + <initial> + <transition target="e1.1"/> + </initial> + <state id="e1.1"> + <initial> + <transition target="e1.1.1"/> + </initial> + <state id="e1.1.1"> + <transition event="bar" target="e1.1.2"/> + </state> + <state id="e1.1.2"> + <transition event="baz" target="e1.2"/> + </state> + </state> + <state id="e1.2" final="true"/> + </state> + +</scxml> diff --git a/test/samples/apache/issue62-02.xml b/test/samples/apache/issue62-02.xml new file mode 100644 index 0000000..8e52e42 --- /dev/null +++ b/test/samples/apache/issue62-02.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="s1"> + + <state id="s1"> + <transition event="foo" target="s2" /> + </state> + + <state id="s2"> + <initial> + <transition target="s2.1"/> + </initial> + <state id="s2.1" src="issue62-02-ext.xml#e1" /> + <transition event="s2.1.done" target="s3"/> + </state> + + <state id="s3" final="true"/> + +</scxml> diff --git a/test/samples/apache/issue62-03-ext.xml b/test/samples/apache/issue62-03-ext.xml new file mode 100644 index 0000000..0168447 --- /dev/null +++ b/test/samples/apache/issue62-03-ext.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="e1"> + + <state id="e1"> + <initial> + <transition target="e1.1"/> + </initial> + <state id="e1.1"> + <initial> + <transition target="e1.1.1"/> + </initial> + <state id="e1.1.1"> + <transition event="bar" target="e1.1.2"/> + </state> + <state id="e1.1.2"> + <transition event="baz" target="e1.2"/> + </state> + </state> + <final id="e1.2"/> + </state> + +</scxml> diff --git a/test/samples/apache/issue62-03.xml b/test/samples/apache/issue62-03.xml new file mode 100644 index 0000000..46b8991 --- /dev/null +++ b/test/samples/apache/issue62-03.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="s1"> + + <state id="s1"> + <transition event="foo" target="s2" /> + </state> + + <state id="s2"> + <initial> + <transition target="s2.1"/> + </initial> + <state id="s2.1" src="issue62-03-ext.xml#e1" /> + <transition event="s2.1.done" target="s3"/> + </state> + + <final id="s3"/> + +</scxml> diff --git a/test/samples/apache/issue64-01.xml b/test/samples/apache/issue64-01.xml new file mode 100644 index 0000000..bb848fe --- /dev/null +++ b/test/samples/apache/issue64-01.xml @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Correct SCXML document --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="tranbug"> + + <state id="tranbug"> + <datamodel> + <data id="dummy" expr="'somedata'"/> + </datamodel> + <onentry> + <log expr="'Begin transition bug test ...'" /> + </onentry> + <transition event="show.bug" target="end"> + <log expr="dummy" /> + <log expr="'*****' + dummy" /> + </transition> + </state> + <state id="end" final="true" /> + +</scxml> + + diff --git a/test/samples/apache/issue64-02.xml b/test/samples/apache/issue64-02.xml new file mode 100644 index 0000000..7e44d30 --- /dev/null +++ b/test/samples/apache/issue64-02.xml @@ -0,0 +1,55 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Bad SCXML document, many elements will be ignored with warnings from parser --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:my="http://my.foo.example/" + version="1.0" + initialstate="tranbug"> + + <datamodel> + <data id="foo"> + <alpha xmlns=""> + <beta/> + </alpha> + </data> + <misplaced/> + </datamodel> + + <state id="tranbug"> + <onentry> + <log expr="'Begin transition bug test ...'" /> + <foo/> + <my:bar/> + </onentry> + <transition event="show.bug" target="end"> + <!-- For example, FOLLOWING datamodel IS MISPLACED --> + <datamodel> + <data id="dummy" expr="'somedata'"/> + </datamodel> + <log expr="dummy" /> + <log expr="'*****' + dummy" /> + </transition> + </state> + + <my:baz/> + + <state id="end" final="true" /> + +</scxml> + + diff --git a/test/samples/apache/jsp-rootctx-test.xml b/test/samples/apache/jsp-rootctx-test.xml new file mode 100644 index 0000000..6a71579 --- /dev/null +++ b/test/samples/apache/jsp-rootctx-test.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="rootCtxTest"> + + <state id="rootCtxTest" final="true"> + <onentry> + <!-- 'foo' must exist in host JSP context --> + <assign name="foo" expr="${foo+1}" /> + <cs:var name="bar" expr="a brand new value" /> + </onentry> + </state> + +</scxml> diff --git a/test/samples/apache/log-on-config.xml b/test/samples/apache/log-on-config.xml new file mode 100644 index 0000000..b57780e --- /dev/null +++ b/test/samples/apache/log-on-config.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. + + $Id: log-on-config.xml 462838 2006-10-11 16:08:36Z rahul $ + +--> + +<!-- + + Dialog definitions for Shale Use Cases Example Web Application + written out as SCXML to demonstrate use of Commons SCXML as one + of Shale's Dialog Manager implementations. + + Related artifacts from <dialog name="Log On">...</dialog> + in original dialogs definition file from Shale nightlies. + +--> + +<scxml xmlns="http://www.w3.org/2005/01/SCXML" version="1.0" + initialstate="checkCookie"> + + + <state id="checkCookie"> + + <onentry> + <var name="cookieOutcome" + expr="#{profile$logon.check}" /> + </onentry> + + <transition cond="${cookieOutcome eq 'authenticated'}"> + <target next="exit"/> + </transition> + + <transition cond="${cookieOutcome eq 'unauthenticated'}"> + <target next="logon"/> + </transition> + + </state> + + <state id="logon"> + + <transition event="faces.outcome" + cond="${outcome eq 'authenticated'}"> + <target next="exit"/> + </transition> + + <transition event="faces.outcome" + cond="${outcome eq 'create'}"> + <target next="createProfile"/> + </transition> + + </state> + + <state id="createProfile" + src="edit-profile-config.xml" > + + <transition event="createProfile.done" + cond="${outcome eq 'success' or outcome eq 'cancel'}"> + <target next="exit"/> + </transition> + + </state> + + <state id="exit" + final="true" /> + +</scxml> diff --git a/test/samples/apache/microwave-01.xml b/test/samples/apache/microwave-01.xml new file mode 100644 index 0000000..86efa26 --- /dev/null +++ b/test/samples/apache/microwave-01.xml @@ -0,0 +1,78 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + This document uses JSP 2.0 EL as the expressions language. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="off"> + + <!-- trivial microwave oven example --> + <state id="off"> + <!-- off state --> + <transition event="turn_on" target="on"/> + </state> + + <state id="on"> + <initial> + <transition target="idle"/> + </initial> + + <!-- on/pause state --> + <onentry> + <!-- we assume the cook_time is passed in as a context parameter --> + <if cond="${empty cook_time}"> + <!-- default setting --> + <cs:var name="cook_time" expr="${5}"/> + </if> + <!-- again, door_closed should be a part of a global context --> + <if cond="${empty door_closed}"> + <!-- default setting --> + <cs:var name="door_closed" expr="${true}"/> + </if> + <!-- timer variable --> + <cs:var name="timer" expr="${0}"/> + </onentry> + + <transition event="turn_off" target="off"/> + + <transition cond="${timer ge cook_time}" target="off"/> + + <state id="idle"> + <!-- default immediate transition --> + <transition cond="${door_closed}" target="cooking"/> + + <!-- start cooking --> + <transition event="door_close" target="cooking"> + <assign name="door_closed" expr="${true}"/> + </transition> + </state> + + <state id="cooking"> + <transition event="door_open" target="idle"> + <assign name="door_closed" expr="${false}"/> + </transition> + <transition event="time" target="cooking"> + <assign name="timer" expr="${timer + 1}"/> + </transition> + </state> + + </state> + +</scxml> diff --git a/test/samples/apache/microwave-02-legacy.xml b/test/samples/apache/microwave-02-legacy.xml new file mode 100644 index 0000000..eaeb14a --- /dev/null +++ b/test/samples/apache/microwave-02-legacy.xml @@ -0,0 +1,87 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + This document uses JSP 2.0 EL as the expressions language. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initialstate="microwave"> + + <!-- trivial microwave oven example --> + <!-- using parallel and In() predicate --> + + <state id="microwave"> + <parallel id="parts"> + <state id="oven"> + <initial> + <transition target="off"/> + </initial> + + <state id="off"> + <!-- off state --> + <transition event="turn_on" target="on"/> + </state> + + <state id="on"> + <initial> + <transition target="idle"/> + </initial> + + <!-- on/pause state --> + <onentry> + <!-- we assume the cook_time is passed in as a context parameter --> + <if cond="${empty cook_time}"> + <!-- default setting --> + <var name="cook_time" expr="${5}"/> + </if> + <!-- timer variable --> + <var name="timer" expr="${0}"/> + </onentry> + + <transition event="turn_off" target="off"/> + + <transition cond="${timer ge cook_time}" target="off"/> + + <state id="idle"> + <transition cond="${In('closed')}" target="cooking"/> + </state> + + <state id="cooking"> + <transition cond="${not In('closed')}" target="idle"/> + + <transition event="time" target="cooking"> + <assign name="timer" expr="${timer + 1}"/> + </transition> + </state> + </state> + </state> + + <state id="door"> + <initial> + <transition target="closed"/> + </initial> + <state id="closed"> + <transition event="door_open" target="open"/> + </state> + <state id="open"> + <transition event="door_close" target="closed"/> + </state> + </state> + </parallel> + </state> + +</scxml> diff --git a/test/samples/apache/microwave-02.xml b/test/samples/apache/microwave-02.xml new file mode 100644 index 0000000..c03fe05 --- /dev/null +++ b/test/samples/apache/microwave-02.xml @@ -0,0 +1,87 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + This document uses JSP 2.0 EL as the expressions language. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="microwave"> + + <!-- trivial microwave oven example --> + <!-- using parallel and In() predicate --> + + <parallel id="microwave"> + <state id="oven"> + <initial> + <transition target="off"/> + </initial> + + <state id="off"> + <!-- off state --> + <transition event="turn_on" target="on"/> + </state> + + <state id="on"> + <initial> + <transition target="idle"/> + </initial> + + <!-- on/pause state --> + <onentry> + <!-- we assume the cook_time is passed in as a context parameter --> + <if cond="${empty cook_time}"> + <!-- default setting --> + <cs:var name="cook_time" expr="${5}"/> + </if> + <!-- timer variable --> + <cs:var name="timer" expr="${0}"/> + </onentry> + + <transition event="turn_off" target="off"/> + + <transition cond="${timer ge cook_time}" target="off"/> + + <state id="idle"> + <transition cond="${In('closed')}" target="cooking"/> + </state> + + <state id="cooking"> + <transition cond="${not In('closed')}" target="idle"/> + + <transition event="time" target="cooking"> + <assign name="timer" expr="${timer + 1}"/> + </transition> + </state> + </state> + </state> + + <state id="door"> + <initial> + <transition target="closed"/> + </initial> + <state id="closed"> + <transition event="door_open" target="open"/> + </state> + <state id="open"> + <transition event="door_close" target="closed"/> + </state> + </state> + </parallel> + +</scxml> diff --git a/test/samples/apache/microwave-03.xml b/test/samples/apache/microwave-03.xml new file mode 100644 index 0000000..887b1a6 --- /dev/null +++ b/test/samples/apache/microwave-03.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + This document uses Commons JEXL as the expressions language. + Needs SCXMLParser. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="off"> + + <!-- trivial microwave oven example --> + <state id="off"> + <!-- off state --> + <transition event="turn_on" target="on"/> + </state> + + <state id="on"> + <initial> + <transition target="idle"/> + </initial> + + <!-- on/pause state --> + <onentry> + <!-- we assume the cook_time is passed in as a context parameter --> + <if cond="empty(cook_time)"> + <!-- default setting --> + <cs:var name="cook_time" expr="5"/> + </if> + <!-- again, door_closed should be a part of a global context --> + <if cond="empty(door_closed)"> + <!-- default setting --> + <cs:var name="door_closed" expr="true"/> + </if> + <!-- timer variable --> + <cs:var name="timer" expr="0"/> + </onentry> + + <transition event="turn_off" target="off"/> + + <transition cond="timer ge cook_time" target="off"/> + + <state id="idle"> + <!-- default immediate transition --> + <transition cond="door_closed" target="cooking"/> + + <!-- start cooking --> + <transition event="door_close" target="cooking"> + <assign name="door_closed" expr="true"/> + </transition> + </state> + + <state id="cooking"> + <transition event="door_open" target="idle"> + <assign name="door_closed" expr="false"/> + </transition> + <transition event="time" target="cooking"> + <assign name="timer" expr="timer + 1"/> + </transition> + </state> + + </state> + +</scxml> diff --git a/test/samples/apache/microwave-04.xml b/test/samples/apache/microwave-04.xml new file mode 100644 index 0000000..96656dd --- /dev/null +++ b/test/samples/apache/microwave-04.xml @@ -0,0 +1,90 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + This document uses Commons JEXL as the expressions language. + Needs SCXMLParser. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="microwave"> + + <!-- trivial microwave oven example --> + <!-- using parallel and In() predicate --> + + <parallel id="microwave"> + + <state id="oven"> + <initial> + <transition target="off"/> + </initial> + + <state id="off"> + <!-- off state --> + <transition event="turn_on" target="on"/> + </state> + + <state id="on"> + <initial> + <transition target="idle"/> + </initial> + + <!-- on/pause state --> + <onentry> + <!-- we assume the cook_time is passed in as a context parameter --> + <if cond="empty(cook_time)"> + <!-- default setting, note namespace of this custom action --> + <cs:var name="cook_time" expr="5"/> + </if> + <!-- timer variable --> + <cs:var name="timer" expr="0"/> + </onentry> + + <transition event="turn_off" target="off"/> + + <transition cond="timer ge cook_time" target="off"/> + + <state id="idle"> + <transition cond="In('closed')" target="cooking"/> + </state> + + <state id="cooking"> + <transition cond="not In('closed')" target="idle"/> + + <transition event="time" target="cooking"> + <assign name="timer" expr="timer + 1"/> + </transition> + </state> + </state> + </state> + + <state id="door"> + <initial> + <transition target="closed"/> + </initial> + <state id="closed"> + <transition event="door_open" target="open"/> + </state> + <state id="open"> + <transition event="door_close" target="closed"/> + </state> + </state> + + </parallel> + +</scxml> diff --git a/test/samples/apache/microwave-05.xml b/test/samples/apache/microwave-05.xml new file mode 100644 index 0000000..06b9fc9 --- /dev/null +++ b/test/samples/apache/microwave-05.xml @@ -0,0 +1,98 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + This document uses Commons JEXL as the expressions language. + Needs SCXMLParser. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="microwave"> + + <!-- trivial microwave oven example --> + <!-- using parallel (part of composite state) and In() predicate --> + + <state id="microwave"> + + <initial> + <transition target="parts"/> + </initial> + + <parallel id="parts"> + + <state id="oven"> + <initial> + <transition target="off"/> + </initial> + + <state id="off"> + <!-- off state --> + <transition event="turn_on" target="on"/> + </state> + + <state id="on"> + <initial> + <transition target="idle"/> + </initial> + + <!-- on/pause state --> + <onentry> + <!-- we assume the cook_time is passed in as a context parameter --> + <if cond="empty(cook_time)"> + <!-- default setting, note namespace of this custom action --> + <cs:var name="cook_time" expr="5"/> + </if> + <!-- timer variable --> + <cs:var name="timer" expr="0"/> + </onentry> + + <transition event="turn_off" target="off"/> + + <transition cond="timer ge cook_time" target="off"/> + + <state id="idle"> + <transition cond="In('closed')" target="cooking"/> + </state> + + <state id="cooking"> + <transition cond="not In('closed')" target="idle"/> + + <transition event="time" target="cooking"> + <assign name="timer" expr="timer + 1"/> + </transition> + </state> + </state> + </state> + + <state id="door"> + <initial> + <transition target="closed"/> + </initial> + <state id="closed"> + <transition event="door_open" target="open"/> + </state> + <state id="open"> + <transition event="door_close" target="closed"/> + </state> + </state> + + </parallel> + + </state> + +</scxml> diff --git a/test/samples/apache/parallel-01.xml b/test/samples/apache/parallel-01.xml new file mode 100644 index 0000000..e822285 --- /dev/null +++ b/test/samples/apache/parallel-01.xml @@ -0,0 +1,70 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + Needs SCXMLParser +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="para"> + + <parallel id="para"> + + <state id="para1"> + + <initial> + <transition target="para11"/> + </initial> + + <state id="para11"> + <transition event="foo" target="para12"/> + </state> + + <state id="para12"> + <onexit> + <log expr="'Exiting para12'" /> + </onexit> + </state> + + </state> + + <state id="para2"> + + <initial> + <transition target="para21"/> + </initial> + + <state id="para21"> + <transition cond="In('para12')" target="para22"/> + </state> + + <state id="para22"> + <onexit> + <log expr="'Exiting para22'" /> + </onexit> + + <transition target="end"/> + </state> + + </state> + + </parallel> + + <state id="end" final="true" /> + +</scxml> + diff --git a/test/samples/apache/parallel-02.xml b/test/samples/apache/parallel-02.xml new file mode 100644 index 0000000..106fc86 --- /dev/null +++ b/test/samples/apache/parallel-02.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + Needs SCXMLParser +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="state0"> + + <parallel id="state0"> + <transition event="event1" target="state1" /> + <!-- dummy regions --> + <state id="state01"/> + <state id="state02"/> + </parallel> + <final id="state1"/> + +</scxml> diff --git a/test/samples/apache/parallel-03.xml b/test/samples/apache/parallel-03.xml new file mode 100644 index 0000000..d57196a --- /dev/null +++ b/test/samples/apache/parallel-03.xml @@ -0,0 +1,118 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + Needs SCXMLParser +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initial="para"> + + <datamodel> + <data id="root"> + <root xmlns=""> + <count>0</count> + </root> + </data> + </datamodel> + + <parallel id="para"> + + <onentry> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onentry> + + <state id="para1"> + + <initial> + <transition target="para11"/> + </initial> + <onentry> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onentry> + + <state id="para11"> + <onentry> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onentry> + <transition event="foo" target="para12"/> + <onexit> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onexit> + </state> + + <final id="para12"> + <onentry> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onentry> + <onexit> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onexit> + </final> + + <onexit> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onexit> + + </state> + + <state id="para2"> + + <initial> + <transition target="para21"/> + </initial> + <onentry> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onentry> + + <state id="para21"> + <onentry> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onentry> + <transition event="bar" target="para22"/> + <onexit> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onexit> + </state> + + <final id="para22"> + <onentry> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onentry> + <onexit> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onexit> + </final> + + <onexit> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onexit> + + </state> + + <transition event="para.done" target="end"/> + + <onexit> + <assign location="Data(root, 'root/count')" expr="Data(root, 'root/count') + 1"/> + </onexit> + + </parallel> + + <state id="end" final="true" /> + +</scxml> + diff --git a/test/samples/apache/prefix-01.xml b/test/samples/apache/prefix-01.xml new file mode 100644 index 0000000..79cbe69 --- /dev/null +++ b/test/samples/apache/prefix-01.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml:scxml xmlns:scxml="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <scxml:state id="ten"> + <scxml:transition event="ten.done" target="twenty"/> + </scxml:state> + + <scxml:state id="twenty" final="true" /> + +</scxml:scxml> + diff --git a/test/samples/apache/scxml-initial-attr.xml b/test/samples/apache/scxml-initial-attr.xml new file mode 100644 index 0000000..0965653 --- /dev/null +++ b/test/samples/apache/scxml-initial-attr.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for SrcTest.java in io package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initial="foo"> + + <final id="foo"/> + +</scxml> diff --git a/test/samples/apache/send-01.xml b/test/samples/apache/send-01.xml new file mode 100644 index 0000000..4f3cf40 --- /dev/null +++ b/test/samples/apache/send-01.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <state id="ten"> + <transition event="ten.done" target="twenty"> + <send sendid="send1" delay="'0'" + target="'http://localhost:8080/VXMLInterpreter'" type="'v3'" + xmlns:v3="http://foo.bar.com/vxml3" + xmlns:test="http://my.test.namespace"> + <v3:form id="Confirm"> + <v3:grammar type="application/srgs+xml" + src="/grammars/boolean.grxml"/> + <v3:block> + <v3:prompt>Say yes or no.</v3:prompt> + </v3:block> + </v3:form> + <test:foo id="foo1"> + <test:bar id="bar1" /> + </test:foo> + <test:foo id="foo2"> + <v3:prompt>This is just an example.</v3:prompt> + </test:foo> + </send> + </transition> + </state> + + <state id="twenty" final="true" /> + +</scxml> diff --git a/test/samples/apache/send-02.xml b/test/samples/apache/send-02.xml new file mode 100644 index 0000000..9685385 --- /dev/null +++ b/test/samples/apache/send-02.xml @@ -0,0 +1,89 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Various send usages that fire the events on the existing execution + engine. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <!-- We are expected to just fall all the way through down to + the state "seventy", then hop over and end up in "ninety" --> + <state id="ten"> + <onentry> + <send event="'ten.' + 'done'" /> + </onentry> + <transition event="ten.done" target="twenty" /> + </state> + + <state id="twenty"> + <onentry> + <send event="'twenty.done'" type="'scxml'" /> + </onentry> + <transition event="twenty.done" target="thirty" /> + </state> + + <state id="thirty"> + <onentry> + <send event="'thirty.done'" type="' sCxML '" /> + </onentry> + <transition event="thirty.done" target="forty" /> + </state> + + <state id="forty"> + <onentry> + <send event="'forty.done'" type=" " target=" " /> + </onentry> + <transition event="forty.done" target="fifty" /> + </state> + + <state id="fifty"> + <onentry> + <send event="'fifty.done'" target="' '" /> + </onentry> + <transition event="fifty.done" target="sixty" /> + </state> + + <state id="sixty"> + <onentry> + <send event="'sixty.done'" type="'scxml'" target=" " /> + </onentry> + <transition event="sixty.done" target="seventy" /> + </state> + + <state id="seventy"> + <onentry> + <send event="'seventy.done'" type="'scxml'" target="'foo'" /> + </onentry> + + <!-- This transition should not be followed since + target "foo" is unavailable (any target other + than an empty target is unavailable, empty target + is current execution i.e. this state machine) --> + <transition event="seventy.done" target="eighty" /> + + <!-- Since "foo" it not available, the event + "error.send.targetunavailable" should be raised --> + <transition event="error.send.targetunavailable" target="ninety" /> + + </state> + + <state id="eighty" final="true" /> + + <state id="ninety" final="true" /> + +</scxml> diff --git a/test/samples/apache/src-test-1.xml b/test/samples/apache/src-test-1.xml new file mode 100644 index 0000000..74e6ce2 --- /dev/null +++ b/test/samples/apache/src-test-1.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for SrcTest.java in io package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="srctest1"> + + <state id="srctest1" src="src-test-2.xml"> + <transition event="src.test" target="srctest3end"/> + <transition event="srctest1.done" target="srctest1end"/> + </state> + + <state id="srctest1end" final="true"/> + +</scxml> + diff --git a/test/samples/apache/src-test-2.xml b/test/samples/apache/src-test-2.xml new file mode 100644 index 0000000..16789ab --- /dev/null +++ b/test/samples/apache/src-test-2.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for SrcTest.java in io package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="srctest2"> + + <state id="srctest2" src="src-test-3.xml"> + <transition event="srctest2.done" target="srctest2end"/> + </state> + + <state id="srctest2end" final="true"/> + +</scxml> + diff --git a/test/samples/apache/src-test-3.xml b/test/samples/apache/src-test-3.xml new file mode 100644 index 0000000..d675687 --- /dev/null +++ b/test/samples/apache/src-test-3.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for SrcTest.java in io package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="srctest3"> + + <state id="srctest3"/> + + <state id="srctest3end" final="true"/> + +</scxml> + diff --git a/test/samples/apache/src-test-4.xml b/test/samples/apache/src-test-4.xml new file mode 100644 index 0000000..4fe18e5 --- /dev/null +++ b/test/samples/apache/src-test-4.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for SrcTest.java in io package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="srctest1"> + + <state id="srctest1" src="bad-document-404.xml"> + <transition event="srctest1.done" target="srctest1end"/> + </state> + + <state id="srctest1end" final="true"/> + +</scxml> + diff --git a/test/samples/apache/src-test-5.xml b/test/samples/apache/src-test-5.xml new file mode 100644 index 0000000..a36e112 --- /dev/null +++ b/test/samples/apache/src-test-5.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Used for SrcTest.java in io package --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="srctest1"> + + <state id="srctest1" src="src-test-3.xml#badstateid404"> + <transition event="srctest1.done" target="srctest1end"/> + </state> + + <state id="srctest1end" final="true"/> + +</scxml> + diff --git a/test/samples/apache/state-01.xml b/test/samples/apache/state-01.xml new file mode 100644 index 0000000..22a9018 --- /dev/null +++ b/test/samples/apache/state-01.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="s1"> + + <state id="s1" initial="s11"> + <final id="s11"/> + </state> + +</scxml> diff --git a/test/samples/apache/stateless-01.xml b/test/samples/apache/stateless-01.xml new file mode 100644 index 0000000..1229b8f --- /dev/null +++ b/test/samples/apache/stateless-01.xml @@ -0,0 +1,50 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="main"> + + <state id="main"> + + <initial> + <transition target="ten"/> + </initial> + + <onentry> + <var name="instancevar" expr="${20}" /> + </onentry> + + <state id="ten"> + <transition event="ten.done" cond="${instancevar eq 20}" + target="twenty" /> + <onexit> + <assign name="instancevar" expr="${30}" /> + </onexit> + </state> + + <state id="twenty"> + <transition event="twenty.done" cond="${instancevar eq 30}" + target="thirty" /> + </state> + + <state id="thirty" final="true" /> + + </state> + +</scxml> + diff --git a/test/samples/apache/stateless-parallel-01.xml b/test/samples/apache/stateless-parallel-01.xml new file mode 100644 index 0000000..f2e9017 --- /dev/null +++ b/test/samples/apache/stateless-parallel-01.xml @@ -0,0 +1,54 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="main"> + + <state id="main"> + + <parallel id="main.parallel"> + + <state id="state1"> + <initial> + <transition target="state1.init"/> + </initial> + <state id="state1.init"> + <transition event="state1.event" target="state1.final" /> + </state> + <state id="state1.final" final="true" /> + </state> + + <state id="state2"> + <initial> + <transition target="state2.init"/> + </initial> + <state id="state2.init"> + <transition event="state2.event" target="state2.final" /> + </state> + <state id="state2.final" final="true" /> + </state> + + </parallel> + + <transition event="main.parallel.done" target="next" /> + + </state> + + <state id="next" final="true"/> + +</scxml> diff --git a/test/samples/apache/static-method.xml b/test/samples/apache/static-method.xml new file mode 100644 index 0000000..7ad034a --- /dev/null +++ b/test/samples/apache/static-method.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- Example of invoking a static method when using JEXL, for example: + (public static) java.lang.System#currentTimeMillis() +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="static"> + + <state id="static" final="true"> + <onentry> + <log expr="'Current time millis: ' + System.currentTimeMillis()" /> + </onentry> + </state> + +</scxml> + diff --git a/test/samples/apache/stopwatch.xml b/test/samples/apache/stopwatch.xml new file mode 100644 index 0000000..57572a1 --- /dev/null +++ b/test/samples/apache/stopwatch.xml @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="reset"> + + <state id="reset"> + <transition event="watch.start" target="running"/> + </state> + + <state id="running"> + <transition event="watch.split" target="paused"/> + <transition event="watch.stop" target="stopped"/> + </state> + + <state id="paused"> + <transition event="watch.unsplit" target="running"/> + <transition event="watch.stop" target="stopped"/> + </state> + + <state id="stopped"> + <transition event="watch.reset" target="reset"/> + </state> + +</scxml> + diff --git a/test/samples/apache/tie-breaker-01.xml b/test/samples/apache/tie-breaker-01.xml new file mode 100644 index 0000000..7cff894 --- /dev/null +++ b/test/samples/apache/tie-breaker-01.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + Used by TieBreakerTest +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + <state id="ten"> + <!-- twenty should win, document order --> + <transition event="ten.done" target="twenty" /> + <transition event="ten.done" target="thirty" /> + </state> + + <state id="twenty" final="true" /> + + <state id="thirty" final="true" /> + +</scxml> + diff --git a/test/samples/apache/tie-breaker-02.xml b/test/samples/apache/tie-breaker-02.xml new file mode 100644 index 0000000..62118dd --- /dev/null +++ b/test/samples/apache/tie-breaker-02.xml @@ -0,0 +1,45 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + Used by TieBreakerTest +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <state id="ten"> + <initial> + <transition target="eleven"/> + </initial> + + <transition event="ten.done" target="twenty" /> + + <state id="eleven"> + <!-- thirty wins since eleven trumps + ten in the state heirarchy --> + <transition event="ten.done" target="thirty" /> + </state> + + </state> + + <state id="twenty" final="true" /> + + <state id="thirty" final="true" /> + +</scxml> + diff --git a/test/samples/apache/tie-breaker-03.xml b/test/samples/apache/tie-breaker-03.xml new file mode 100644 index 0000000..d850865 --- /dev/null +++ b/test/samples/apache/tie-breaker-03.xml @@ -0,0 +1,56 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + Used by TieBreakerTest +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <state id="ten"> + <initial> + <transition target="eleven"/> + </initial> + + <transition event="ten.done" target="twenty" /> + + <transition event="ten.done" target="thirty" /> + + <state id="eleven"> + + <!-- forty wins due to document order and the fact + that since eleven trumps ten in the state + heirarchy --> + <transition event="ten.done" target="forty" /> + + <transition event="ten.done" target="fifty" /> + + </state> + + </state> + + <state id="twenty" final="true" /> + + <state id="thirty" final="true" /> + + <state id="forty" final="true" /> + + <state id="fifty" final="true" /> + +</scxml> + diff --git a/test/samples/apache/tie-breaker-04.xml b/test/samples/apache/tie-breaker-04.xml new file mode 100644 index 0000000..df87e63 --- /dev/null +++ b/test/samples/apache/tie-breaker-04.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="s1"> + + <state id="s1"> + <initial> + <transition target="s11"/> + </initial> + + <transition event="event_1"/> + + <transition event="event_2" target="s1"/> + + <state id="s11"> + <transition event="event_1"/> + <transition event="event_2" target="s11"/> + </state> + </state> + + <state id="s2" final="true" /> +</scxml> diff --git a/test/samples/apache/tie-breaker-05.xml b/test/samples/apache/tie-breaker-05.xml new file mode 100644 index 0000000..1fcbd35 --- /dev/null +++ b/test/samples/apache/tie-breaker-05.xml @@ -0,0 +1,64 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="para"> + +<!-- + Testing dispute resolution in regions + {s11,s2111,s212} -event1-> {s12,s2112,s212} +--> + + <parallel id="para"> <!-- Outer parallel --> + + <state id="s1"> + <initial> + <transition target="s11"/> + </initial> + <state id="s11"> + <transition event="event1" target="s12"/> + <transition event="event1" target="s13"/> + </state> + <state id="s12"/> + <state id="s13"/> + </state> + + <state id="s2"> + <initial> + <transition target="para1"/> + </initial> + + <parallel id="para1"> <!-- Inner parallel --> + <state id="s211"> + <initial> + <transition target="s2111"/> + </initial> + <state id="s2111"> + <transition event="event1" target="s2112"/> + <transition event="event1" target="s2113"/> + </state> + <state id="s2112"/> + <state id="s2113"/> + </state> + <state id="s212"/> + </parallel> + + <state id="s22"/> + </state> + + </parallel> + +</scxml> diff --git a/test/samples/apache/tie-breaker-06.xml b/test/samples/apache/tie-breaker-06.xml new file mode 100644 index 0000000..a7f26ff --- /dev/null +++ b/test/samples/apache/tie-breaker-06.xml @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- A fictitious state machine used by test cases. + <send>s in the same executable content block --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="main"> + + <state id="main"> + + <onentry> + <event name="internal_event1"/> + <event name="internal_event2"/> + </onentry> + + <transition event="internal_event1"> + <log label="Expected" + expr="'Transition for first event (internal_event1) followed'"/> + </transition> + <transition event="internal_event2"> + <log label="Unexpected" + expr="'Transition for second event (internal_event2) followed'"/> + </transition> + + </state> + +</scxml> diff --git a/test/samples/apache/transitions-01-legacy.xml b/test/samples/apache/transitions-01-legacy.xml new file mode 100644 index 0000000..f46bc74 --- /dev/null +++ b/test/samples/apache/transitions-01-legacy.xml @@ -0,0 +1,140 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <!-- Start with a simple state --> + <state id="ten"> + <transition event="ten.done" target="twenty" /> + </state> + + <!-- Follow up with a composite state --> + <state id="twenty"> + + <initial> + <transition target="twenty_one"/> + </initial> + + <onentry> + <log expr="'In twenty'" /> + </onentry> + + <state id="twenty_one"> + <transition event="twenty_one.done" target="twenty_two"/> + </state> + + <state id="twenty_two"> + <transition event="twenty_two.done" target="thirty"/> + </state> + + </state> + + <!-- Finally, try an orthogonal state --> + <state id="thirty"> + + <parallel id="thirties_parallel"> + + <!-- The first (of three) regions in thirties_parallel --> + <state id="thirty_one"> + + <initial> + <transition target="thirty_one_child_one"/> + </initial> + <onentry> + <log expr="'Entering thirty_one'" /> + </onentry> + <transition event="thirty_one.done" target="forty"/> + + <state id="thirty_one_child_one"> + <onexit> + <log expr="'Exiting thirty_one_child_one'" /> + </onexit> + <transition event="thirty_one_child_one.done" + target="thirty_one_child_two"/> + </state> + + <state id="thirty_one_child_two"> + <onexit> + <log expr="'Exiting thirty_one_child_two'" /> + </onexit> + </state> + + </state> + + <!-- The second (of three) regions in thirties_parallel --> + <state id="thirty_two"> + + <initial> + <transition target="thirty_two_child_one"/> + </initial> + <onentry> + <log expr="'Entering thirty_two'" /> + </onentry> + + <state id="thirty_two_child_one"> + <onexit> + <log expr="'Exiting thirty_two_child_one'" /> + </onexit> + <transition event="thirty_two_child_one.done" + target="thirty_two_child_two"/> + </state> + + <state id="thirty_two_child_two"> + <onexit> + <log expr="'Exiting thirty_two_child_two'" /> + </onexit> + </state> + + </state> + + <!-- The third (of three) regions in thirties_parallel --> + <state id="thirty_three"> + + <initial> + <transition target="thirty_three_child_one"/> + </initial> + <onentry> + <log expr="'Entering thirty_three'" /> + </onentry> + + <state id="thirty_three_child_one"> + <onexit> + <log expr="'Exiting thirty_three_child_one'" /> + </onexit> + <transition event="thirty_three_child_one.done" + target="thirty_three_child_two"/> + </state> + + <state id="thirty_three_child_two"> + <onexit> + <log expr="'Exiting thirty_three_child_two'" /> + </onexit> + </state> + + </state> + + </parallel> + + </state> + + <!-- Declare victory --> + <state id="forty" final="true" /> + +</scxml> + diff --git a/test/samples/apache/transitions-01.xml b/test/samples/apache/transitions-01.xml new file mode 100644 index 0000000..ee5133f --- /dev/null +++ b/test/samples/apache/transitions-01.xml @@ -0,0 +1,136 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml + version="1.0" + initial="ten"> + + <!-- Start with a simple state --> + <state id="ten"> + <transition event="ten.done" target="twenty" /> + </state> + + <!-- Follow up with a composite state --> + <state id="twenty"> + + <initial> + <transition target="twenty_one"/> + </initial> + + <onentry> + <log expr="'In twenty'" /> + </onentry> + + <state id="twenty_one"> + <transition event="twenty_one.done" target="twenty_two"/> + </state> + + <state id="twenty_two"> + <transition event="twenty_two.done" target="thirty"/> + </state> + + </state> + + <!-- Finally, try an orthogonal state --> + <parallel id="thirty"> + + <!-- The first (of three) regions in thirties_parallel --> + <state id="thirty_one"> + + <initial> + <transition target="thirty_one_child_one"/> + </initial> + <onentry> + <log expr="'Entering thirty_one'" /> + </onentry> + <transition event="thirty_one.done" target="forty"/> + + <state id="thirty_one_child_one"> + <onexit> + <log expr="'Exiting thirty_one_child_one'" /> + </onexit> + <transition event="thirty_one_child_one.done" + target="thirty_one_child_two"/> + </state> + + <state id="thirty_one_child_two"> + <onexit> + <log expr="'Exiting thirty_one_child_two'" /> + </onexit> + </state> + + </state> + + <!-- The second (of three) regions in thirties_parallel --> + <state id="thirty_two"> + + <initial> + <transition target="thirty_two_child_one"/> + </initial> + <onentry> + <log expr="'Entering thirty_two'" /> + </onentry> + + <state id="thirty_two_child_one"> + <onexit> + <log expr="'Exiting thirty_two_child_one'" /> + </onexit> + <transition event="thirty_two_child_one.done" + target="thirty_two_child_two"/> + </state> + + <state id="thirty_two_child_two"> + <onexit> + <log expr="'Exiting thirty_two_child_two'" /> + </onexit> + </state> + + </state> + + <!-- The third (of three) regions in thirties_parallel --> + <state id="thirty_three"> + + <initial> + <transition target="thirty_three_child_one"/> + </initial> + <onentry> + <log expr="'Entering thirty_three'" /> + </onentry> + + <state id="thirty_three_child_one"> + <onexit> + <log expr="'Exiting thirty_three_child_one'" /> + </onexit> + <transition event="thirty_three_child_one.done" + target="thirty_three_child_two"/> + </state> + + <state id="thirty_three_child_two"> + <onexit> + <log expr="'Exiting thirty_three_child_two'" /> + </onexit> + </state> + + </state> + + </parallel> + + <!-- Declare victory --> + <state id="forty" final="true" /> + +</scxml> + diff --git a/test/samples/apache/transitions-02.xml b/test/samples/apache/transitions-02.xml new file mode 100644 index 0000000..7c1dcf5 --- /dev/null +++ b/test/samples/apache/transitions-02.xml @@ -0,0 +1,53 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="ten"> + + <state id="ten"> + + <onentry> + <cs:var name="foo" expr="1" /> + <log expr="'Foo is:' + foo" /> + </onentry> + + <!-- stay transition --> + <transition event="ten.stay"> + <assign name="foo" expr="foo + 1" /> + <log expr="'Foo is:' + foo" /> + </transition> + + <!-- self transition --> + <transition event="ten.self" target="ten"> + <assign name="foo" expr="foo + 1" /> + <log expr="'Foo is:' + foo" /> + </transition> + + <!-- "regular" transition --> + <transition event="ten.done" target="twenty"> + <assign name="foo" expr="foo + 1" /> + <log expr="'Foo is:' + foo" /> + </transition> + + </state> + + <state id="twenty" final="true" /> + +</scxml> + diff --git a/test/samples/apache/transitions-03.xml b/test/samples/apache/transitions-03.xml new file mode 100644 index 0000000..303d673 --- /dev/null +++ b/test/samples/apache/transitions-03.xml @@ -0,0 +1,88 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <state id="ten"> + <transition event="ten.done" + target="twenty_one_2 twenty_two_2 twenty_three_2" /> + </state> + + <parallel id="twenty"> + + <state id="twenty_one"> + + <initial> + <transition target="twenty_one_1"/> + </initial> + + <state id="twenty_one_1"> + <transition event="foo" target="twenty_one_2"/> + </state> + + <state id="twenty_one_2"> + <onexit> + <log expr="'Exiting twenty_two_2'" /> + </onexit> + </state> + + </state> + + <state id="twenty_two"> + + <initial> + <transition target="twenty_two_1"/> + </initial> + + <state id="twenty_two_1"> + <transition event="foo" target="twenty_two_2"/> + </state> + + <state id="twenty_two_2"> + <onexit> + <log expr="'Exiting twenty_two_2'" /> + </onexit> + </state> + + </state> + + <state id="twenty_three"> + + <initial> + <transition target="twenty_three_1"/> + </initial> + + <state id="twenty_three_1"> + <transition event="foo" target="twenty_three_2"/> + </state> + + <state id="twenty_three_2"> + <onexit> + <log expr="'Exiting twenty_three_2'" /> + </onexit> + </state> + + </state> + + </parallel> + + <state id="thirty" final="true" /> + +</scxml> + diff --git a/test/samples/apache/transitions-04.xml b/test/samples/apache/transitions-04.xml new file mode 100644 index 0000000..547b702 --- /dev/null +++ b/test/samples/apache/transitions-04.xml @@ -0,0 +1,93 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<!-- + Needs SCXMLParser +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="ten"> + + <state id="ten"> + <transition event="ten.done" + target="twenty" /> + </state> + + <parallel id="twenty"> + + <state id="twenty_one"> + + <initial> + <transition target="twenty_one_1"/> + </initial> + + <transition event="bar" target="thirty"/> + + <state id="twenty_one_1"> + <transition event="foo" target="twenty_one_2"/> + </state> + + <state id="twenty_one_2"> + <onexit> + <log expr="'Exiting twenty_two_2'" /> + </onexit> + </state> + + </state> + + <state id="twenty_two"> + + <initial> + <transition target="twenty_two_1"/> + </initial> + + <state id="twenty_two_1"> + <transition event="foo" target="twenty_two_2"/> + </state> + + <state id="twenty_two_2"> + <onexit> + <log expr="'Exiting twenty_two_2'" /> + </onexit> + </state> + + </state> + + <state id="twenty_three"> + + <initial> + <transition target="twenty_three_1"/> + </initial> + + <state id="twenty_three_1"> + <transition event="foo" target="twenty_three_2"/> + </state> + + <state id="twenty_three_2"> + <onexit> + <log expr="'Exiting twenty_three_2'" /> + </onexit> + </state> + + </state> + + </parallel> + + <state id="thirty" final="true" /> + +</scxml> + diff --git a/test/samples/apache/transitions-05.xml b/test/samples/apache/transitions-05.xml new file mode 100644 index 0000000..7400359 --- /dev/null +++ b/test/samples/apache/transitions-05.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="init"> + <state id="init"> + <transition event="start" target="onetwo" /> + </state> + <parallel id="onetwo"> + <transition event="onetwo_three" target="three" /> + <state id="one"> + </state> + <state id="two"> + <transition event="two_four" target="four" /> + </state> + </parallel> + <state id="three"> + <transition event="three_one" target="one" /> + <transition event="three_four" target="four" /> + </state> + <state id="four"> + <transition event="four_onetwo" target="onetwo" /> + <transition event="four_three" target="three" /> + </state> +</scxml> diff --git a/test/samples/apache/travel-dialog.xml b/test/samples/apache/travel-dialog.xml new file mode 100644 index 0000000..08ebc99 --- /dev/null +++ b/test/samples/apache/travel-dialog.xml @@ -0,0 +1,54 @@ +<?xml version="1.0"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/01/SCXML" + version="1.0" + initialstate="tripType"> + + <state id="tripType"> + <transition event="tripType.done"> + <target next="departureCity"/> + </transition> + </state> + + <state id="departureCity"> + <transition event="departureCity.done"> + <target next="arrivalCity"/> + </transition> + </state> + + <state id="arrivalCity"> + <transition event="arrivalCity.done"> + <target next="departureDate"/> + </transition> + </state> + + <state id="departureDate"> + <transition event="departureDate.done" + cond="${tripType == 'round'}"> + <target next="arrivalDate"/> + </transition> + <transition event="departureDate.done" + cond="${tripType == '1way'}"> + <exit /> + </transition> + </state> + + <state id="arrivalDate" + final="true" /> + +</scxml> diff --git a/test/samples/apache/wildcard-01.xml b/test/samples/apache/wildcard-01.xml new file mode 100644 index 0000000..9f7ddc3 --- /dev/null +++ b/test/samples/apache/wildcard-01.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + xmlns:cs="http://commons.apache.org/scxml" + version="1.0" + initialstate="state1"> + <state id="state1"> + <onentry> + <cs:var name="switch" expr="4" /> + </onentry> + <!-- We'll trigger 'foo.bar.baz' event, + and therefore, must end up in state4 --> + <transition event="*" cond="switch eq 2" target="state2"/> + <transition event="foo.*" cond="switch eq 3" target="state3"/> + <transition event="foo.bar.*" cond="switch eq 4" target="state4"/> + </state> + <state id="state2" final="true"/> + <state id="state3" final="true"/> + <state id="state4" final="true"/> +</scxml> diff --git a/test/samples/apache/wildcard-02.xml b/test/samples/apache/wildcard-02.xml new file mode 100644 index 0000000..d039f69 --- /dev/null +++ b/test/samples/apache/wildcard-02.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="state1"> + + <state id="state1"> + <onentry> + <event name="success.start"/> + </onentry> + <transition event="success.*" target="state2"/> + </state> + + <state id="state2"/> + +</scxml> + diff --git a/test/samples/apache/wizard-01.xml b/test/samples/apache/wizard-01.xml new file mode 100644 index 0000000..87492a6 --- /dev/null +++ b/test/samples/apache/wizard-01.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="state1"> + <state id="state1"> + <transition event="event2" target="state2"/> + <transition event="event3" target="state3"/> + <transition event="event4" target="state4"/> + </state> + <state id="state2"> + <transition event="event1" target="state1"/> + <transition event="event3" target="state3"/> + <transition event="event4" target="state4"/> + </state> + <state id="state3"> + <transition event="event1" target="state1"/> + <transition event="event2" target="state2"/> + <transition event="event4" target="state4"/> + </state> + <state id="state4"> + <transition event="event1" target="state1"/> + <transition event="event2" target="state2"/> + <transition event="event3" target="state3"/> + </state> +</scxml> diff --git a/test/samples/apache/wizard-02.xml b/test/samples/apache/wizard-02.xml new file mode 100644 index 0000000..924b83f --- /dev/null +++ b/test/samples/apache/wizard-02.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initialstate="state1"> + <state id="state1"> + <onentry> + <!-- Send without a type causes the + default to be chosen as "scxml". + This will cause the first transition + to state2 to be immediately followed. --> + <send event="'event2'" /> + </onentry> + <transition event="event2" target="state2"/> + <transition event="event3" target="state3"/> + <transition event="event4" target="state4"/> + </state> + <state id="state2"> + <onentry> + <var name="aValue" expr="2"/> + <!-- Send with a non-empty (and not "scxml") + type causes the callback on the + EventDispatcher implementation. See + testWizard02Sample() in WizardsTest + (org.apache.commons.scxml test package) --> + <send namelist="aValue" type="'foo'" /> + </onentry> + <transition event="event1" target="state1"/> + <transition event="event3" target="state3"/> + <transition event="event4" target="state4"/> + </state> + <state id="state3"> + <onentry> + <var name="aValue" expr="3"/> + <send namelist="aValue" type="'foo'" /> + </onentry> + <transition event="event1" target="state1"/> + <transition event="event2" target="state2"/> + <transition event="event4" target="state4"/> + </state> + <state id="state4"> + <onentry> + <var name="aValue" expr="4"/> + <send namelist="aValue" type="'foo'" /> + </onentry> + <transition event="event1" target="state1"/> + <transition event="event2" target="state2"/> + <transition event="event3" target="state3"/> + </state> +</scxml>
\ No newline at end of file |