You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ra...@apache.org on 2005/08/23 06:50:43 UTC
svn commit: r239346 - in /jakarta/commons/sandbox/scxml/trunk: ./
src/test/java/ src/test/java/org/ src/test/java/org/apache/
src/test/java/org/apache/commons/ src/test/java/org/apache/commons/scxml/
src/test/java/org/apache/commons/scxml/env/ src/test...
Author: rahul
Date: Mon Aug 22 21:50:37 2005
New Revision: 239346
URL: http://svn.apache.org/viewcvs?rev=239346&view=rev
Log:
1) Added JUnit test skeleton and a starter set of tests. Clover reports 46.5% for Commons SCXML (over the previous best of 0% ;-)
2) Updated Digester dependency to 1.7 and added a BeanUtils 1.7.0 (transitive depedency from Digester)
3) Updated the changes document
Added:
jakarta/commons/sandbox/scxml/trunk/src/test/java/
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/AllSCXMLTestSuite.java (with props)
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLDigesterTest.java (with props)
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java (with props)
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java (with props)
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/TriggerEventTest.java (with props)
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java (with props)
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml (with props)
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml (with props)
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/model/
jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ModelTestSuite.java (with props)
Modified:
jakarta/commons/sandbox/scxml/trunk/project.xml
jakarta/commons/sandbox/scxml/trunk/xdocs/changes.xml
jakarta/commons/sandbox/scxml/trunk/xdocs/images/ (props changed)
Modified: jakarta/commons/sandbox/scxml/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/project.xml?rev=239346&r1=239345&r2=239346&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/project.xml (original)
+++ jakarta/commons/sandbox/scxml/trunk/project.xml Mon Aug 22 21:50:37 2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 2002-2004 The Apache Software Foundation
+ Copyright 2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -59,8 +59,12 @@
</dependency>
<dependency>
<id>commons-digester</id>
- <version>1.5</version>
- </dependency>
+ <version>1.7</version>
+ </dependency>
+ <dependency>
+ <id>commons-beanutils</id>
+ <version>1.7.0</version>
+ </dependency>
<dependency>
<id>commons-el</id>
<version>1.0</version>
@@ -105,9 +109,17 @@
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
<unitTest>
<includes>
- <include>**/*Test.java</include>
+ <include>org/apache/commons/scxml/AllSCXMLTestSuite.java</include>
</includes>
</unitTest>
+ <resources>
+ <resource>
+ <directory>${pom.build.unitTestSourceDirectory}</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ </resources>
</build>
<reports>
Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/AllSCXMLTestSuite.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/AllSCXMLTestSuite.java?rev=239346&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/AllSCXMLTestSuite.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/AllSCXMLTestSuite.java Mon Aug 22 21:50:37 2005
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.apache.commons.scxml.env.EnvTestSuite;
+import org.apache.commons.scxml.model.ModelTestSuite;
+
+/**
+ * Test suite for [SCXML].
+ *
+ * Organization adapted from test suite for [lang].
+ */
+public class AllSCXMLTestSuite extends TestCase {
+
+ /**
+ * Construct a new instance.
+ */
+ public AllSCXMLTestSuite(String name) {
+ super(name);
+ }
+
+ /**
+ * Command-line interface.
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ /**
+ * Get the suite of tests
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.setName("Commons-SCXML (all) Tests");
+ suite.addTest(SCXMLTestSuite.suite());
+ suite.addTest(EnvTestSuite.suite());
+ suite.addTest(ModelTestSuite.suite());
+ return suite;
+ }
+}
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/AllSCXMLTestSuite.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/AllSCXMLTestSuite.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLDigesterTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLDigesterTest.java?rev=239346&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLDigesterTest.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLDigesterTest.java Mon Aug 22 21:50:37 2005
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml;
+
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.apache.commons.scxml.env.ELEvaluator;
+import org.apache.commons.scxml.env.ELContext;
+import org.apache.commons.scxml.model.SCXML;
+/**
+ * Unit tests {@link org.apache.commons.scxml.SCXMLDigester}.
+ */
+public class SCXMLDigesterTest extends TestCase {
+ /**
+ * Construct a new instance of SCXMLDigesterTest with
+ * the specified name
+ */
+ public SCXMLDigesterTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(SCXMLDigesterTest.class);
+ suite.setName("SCXML Digester Tests");
+ return suite;
+ }
+
+ // Test data
+ private URL microwave01, microwave02;
+ private Evaluator evaluator;
+ private Context ctx;
+ private SCXML scxml;
+ private String scxmlAsString;
+
+ /**
+ * Set up instance variables required by this test case.
+ */
+ public void setUp() {
+ microwave01 = this.getClass().getClassLoader().
+ getResource("org/apache/commons/scxml/microwave-01.xml");
+ microwave02 = this.getClass().getClassLoader().
+ getResource("org/apache/commons/scxml/microwave-02.xml");
+ }
+
+ /**
+ * Tear down instance variables required by this test case.
+ */
+ public void tearDown() {
+ microwave01 = microwave02 = null;
+ evaluator = null;
+ ctx = null;
+ scxml = null;
+ scxmlAsString = null;
+ }
+
+ /**
+ * Test the implementation
+ */
+ public void testSCXMLDigester() {
+ scxml = digest(microwave01);
+ scxmlAsString = serialize(scxml);
+ scxml = digest(microwave02);
+ scxmlAsString = serialize(scxml);
+ }
+
+ private SCXML digest(final URL url) {
+ assertNotNull(url);
+ evaluator = new ELEvaluator();
+ ctx = new ELContext();
+ try {
+ scxml = SCXMLDigester.digest(url,
+ null, ctx, evaluator);
+ } catch (Exception e) {
+ fail();
+ }
+ assertNotNull(scxml);
+ return scxml;
+ }
+
+ private String serialize(final SCXML scxml) {
+ scxmlAsString = SCXMLDigester.serializeSCXML(scxml);
+ assertNotNull(scxmlAsString);
+ return scxmlAsString;
+ }
+
+ public static void main(String args[]) {
+ TestRunner.run(suite());
+ }
+}
+
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLDigesterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLDigesterTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java?rev=239346&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java Mon Aug 22 21:50:37 2005
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml;
+
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.apache.commons.scxml.env.ELEvaluator;
+import org.apache.commons.scxml.env.ELContext;
+import org.apache.commons.scxml.env.SimpleDispatcher;
+import org.apache.commons.scxml.env.Tracer;
+import org.apache.commons.scxml.model.SCXML;
+/**
+ * Unit tests {@link org.apache.commons.scxml.SCXMLExecutor}.
+ */
+public class SCXMLExecutorTest extends TestCase {
+ /**
+ * Construct a new instance of SCXMLExecutorTest with
+ * the specified name
+ */
+ public SCXMLExecutorTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(SCXMLExecutorTest.class);
+ suite.setName("SCXML Executor Tests");
+ return suite;
+ }
+
+ // Test data
+ private URL microwave01, microwave02;
+ private Evaluator evaluator;
+ private Context ctx;
+ private SCXML scxml;
+ private SCXMLExecutor exec;
+ private EventDispatcher ed;
+ private Tracer trc;
+
+ /**
+ * Set up instance variables required by this test case.
+ */
+ public void setUp() {
+ microwave01 = this.getClass().getClassLoader().
+ getResource("org/apache/commons/scxml/microwave-01.xml");
+ microwave02 = this.getClass().getClassLoader().
+ getResource("org/apache/commons/scxml/microwave-02.xml");
+ }
+
+ /**
+ * Tear down instance variables required by this test case.
+ */
+ public void tearDown() {
+ microwave01 = microwave02 = null;
+ evaluator = null;
+ ctx = null;
+ scxml = null;
+ exec = null;
+ ed = null;
+ trc = null;
+ }
+
+ /**
+ * Test the implementation
+ */
+ public void testSCXMLExecutor() {
+ exec = getExecutor(microwave01);
+ assertNotNull(exec);
+ exec = getExecutor(microwave02);
+ assertNotNull(exec);
+ }
+
+ private SCXMLExecutor getExecutor(final URL url) {
+ assertNotNull(url);
+ evaluator = new ELEvaluator();
+ ctx = new ELContext();
+ try {
+ scxml = SCXMLDigester.digest(url,
+ null, ctx, evaluator);
+ } catch (Exception e) {
+ fail();
+ }
+ assertNotNull(scxml);
+ ed = new SimpleDispatcher();
+ trc = new Tracer();
+ try {
+ exec = new SCXMLExecutor(evaluator, ed, trc);
+ scxml.addListener(trc);
+ exec.setSuperStep(true);
+ exec.setStateMachine(scxml);
+ } catch (Exception e) {
+ fail();
+ }
+ assertNotNull(exec);
+ return exec;
+ }
+
+ public static void main(String args[]) {
+ TestRunner.run(suite());
+ }
+}
+
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java?rev=239346&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java Mon Aug 22 21:50:37 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * Test suite for the SCXML package.
+ *
+ */
+public class SCXMLTestSuite extends TestCase {
+
+ /**
+ * Construct a new instance.
+ */
+ public SCXMLTestSuite(String name) {
+ super(name);
+ }
+
+ /**
+ * Command-line interface.
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ /**
+ * Get the suite of tests
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.setName("Commons-SCXML Tests");
+ suite.addTest(TriggerEventTest.suite());
+ suite.addTest(SCXMLDigesterTest.suite());
+ suite.addTest(SCXMLExecutorTest.suite());
+ return suite;
+ }
+}
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLTestSuite.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/TriggerEventTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/TriggerEventTest.java?rev=239346&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/TriggerEventTest.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/TriggerEventTest.java Mon Aug 22 21:50:37 2005
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * Unit tests {@link org.apache.commons.scxml.TriggerEvent}.
+ */
+public class TriggerEventTest extends TestCase {
+ /**
+ * Construct a new instance of TriggerEventTest with the specified name
+ */
+ public TriggerEventTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(TriggerEventTest.class);
+ suite.setName("TriggerEvent Tests");
+ return suite;
+ }
+
+ // Test data
+ private Map payloadData;
+ private Object payload1, payload2;
+ private TriggerEvent te1, te2, te3, te4, te5, te6, te7;
+
+ /**
+ * Set up instance variables required by this test case.
+ */
+ public void setUp() {
+ payloadData = new HashMap();
+ payloadData.put("property1", "value1");
+ payload1 = (Object) payloadData;
+ payload2 = new Object();
+ te1 = new TriggerEvent("name1", TriggerEvent.CHANGE_EVENT, payload1);
+ te2 = new TriggerEvent("name1", TriggerEvent.CHANGE_EVENT, payload1);
+ te3 = new TriggerEvent("name2", TriggerEvent.CALL_EVENT, payload2);
+ te4 = new TriggerEvent("name2", TriggerEvent.CALL_EVENT, payload2);
+ te5 = new TriggerEvent("name3", TriggerEvent.SIGNAL_EVENT);
+ te6 = new TriggerEvent("name3", TriggerEvent.SIGNAL_EVENT);
+ te7 = new TriggerEvent("name3", TriggerEvent.TIME_EVENT);
+ }
+
+ /**
+ * Tear down instance variables required by this test case.
+ */
+ public void tearDown() {
+ payloadData.clear();
+ payloadData = null;
+ payload1 = payload2 = null;
+ te1 = te2 = te3 = te4 = te5 = te6 = te7 = null;
+ }
+
+ /**
+ * Test the implementation
+ */
+ public void testTriggerEventGetters() {
+ assertEquals(te1.getName(), "name1");
+ assertEquals(te2.getType(), 2);
+ assertNull(te7.getPayload());
+ }
+
+ public void testTriggerEventEquals() {
+ assertTrue(te1.equals(te2));
+ assertTrue(te3.equals(te4));
+ assertTrue(te5.equals(te6));
+ assertFalse(te1.equals(te4));
+ assertFalse(te7.equals(null));
+ }
+
+ public void testTriggerEventToString() {
+ assertEquals("TriggerEvent{name=name3,type=4}", te7.toString());
+ assertEquals("TriggerEvent{name=name1,type=2,payload="
+ + "{property1=value1}}", te2.toString());
+ }
+
+ public void testTriggerEventHashCode() {
+ assertEquals("TriggerEvent{name=name3,type=4}".hashCode(),
+ te7.hashCode());
+ assertEquals("TriggerEvent{name=name3,type=3}".hashCode(),
+ te5.hashCode());
+ }
+
+ public static void main(String args[]) {
+ TestRunner.run(suite());
+ }
+}
+
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/TriggerEventTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/TriggerEventTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java?rev=239346&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java Mon Aug 22 21:50:37 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml.env;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+
+/**
+ * Test suite for SCXML env package.
+ *
+ */
+public class EnvTestSuite extends TestCase {
+
+ /**
+ * Construct a new instance.
+ */
+ public EnvTestSuite(String name) {
+ super(name);
+ }
+
+ /**
+ * Command-line interface.
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ /**
+ * Get the suite of tests
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.setName("Commons-SCXML-env Tests");
+ return suite;
+ }
+}
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/EnvTestSuite.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml?rev=239346&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml Mon Aug 22 21:50:37 2005
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed 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="off">
+
+ <!-- trivial microwave oven example -->
+ <state id="off">
+ <!-- off state -->
+ <transition event="turn_on">
+ <target next="on"/>
+ </transition>
+ </state>
+
+ <state id="on">
+ <initial>
+ <transition>
+ <target next="idle"/>
+ </transition>
+ </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>
+ <!-- again, door_closed should be a part of a global context -->
+ <if cond="${empty door_closed}">
+ <!-- default setting -->
+ <var name="door_closed" expr="${true}"/>
+ </if>
+ <!-- timer variable -->
+ <var name="timer" expr="${0}"/>
+ </onentry>
+
+ <transition event="turn_off">
+ <target next="off"/>
+ </transition>
+
+ <transition cond="${timer ge cook_time}">
+ <target next="off"/>
+ </transition>
+
+ <state id="idle">
+ <transition cond="${door_closed}">
+ <!-- default immediate transition -->
+ <target next="cooking"/>
+ </transition>
+ <transition event="door_close">
+ <assign name="door_closed" expr="${true}"/>
+ <!-- start cooking -->
+ <target next="cooking"/>
+ </transition>
+ </state>
+
+ <state id="cooking">
+ <transition event="door_open">
+ <assign name="door_closed" expr="${false}"/>
+ <target next="idle"/>
+ </transition>
+ <transition event="time">
+ <assign name="timer" expr="${timer + 1}"/>
+ <target next="cooking"/>
+ </transition>
+ </state>
+
+ </state>
+
+</scxml>
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-01.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml?rev=239346&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml Mon Aug 22 21:50:37 2005
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed 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="oven">
+
+ <!-- trivial microwave oven example -->
+ <!-- using parallel and In() predicate -->
+
+ <state id="oven">
+ <parallel id="parts">
+ <state id="engine">
+ <initial>
+ <transition>
+ <target next="off"/>
+ </transition>
+ </initial>
+
+ <state id="off">
+ <!-- off state -->
+ <transition event="turn_on">
+ <target next="on"/>
+ </transition>
+ </state>
+
+ <state id="on">
+ <initial>
+ <transition>
+ <target next="idle"/>
+ </transition>
+ </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 next="off"/>
+ </transition>
+
+ <transition cond="${timer ge cook_time}">
+ <target next="off"/>
+ </transition>
+
+ <state id="idle">
+ <transition cond="${In('closed')}">
+ <target next="cooking"/>
+ </transition>
+ </state>
+
+ <state id="cooking">
+ <transition cond="${not In('closed')}">
+ <target next="idle"/>
+ </transition>
+ <transition event="time">
+ <assign name="timer" expr="${timer + 1}"/>
+ <target next="cooking"/>
+ </transition>
+ </state>
+ </state>
+ </state>
+
+ <state id="door">
+ <initial>
+ <transition>
+ <target next="closed"/>
+ </transition>
+ </initial>
+ <state id="closed">
+ <transition event="door_open">
+ <target next="open"/>
+ </transition>
+ </state>
+ <state id="open">
+ <transition event="door_close">
+ <target next="closed"/>
+ </transition>
+ </state>
+ </state>
+ </parallel>
+ </state>
+
+
+</scxml>
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/microwave-02.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ModelTestSuite.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ModelTestSuite.java?rev=239346&view=auto
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ModelTestSuite.java (added)
+++ jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ModelTestSuite.java Mon Aug 22 21:50:37 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml.model;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+
+/**
+ * Test suite for SCXML model package.
+ *
+ */
+public class ModelTestSuite extends TestCase {
+
+ /**
+ * Construct a new instance.
+ */
+ public ModelTestSuite(String name) {
+ super(name);
+ }
+
+ /**
+ * Command-line interface.
+ */
+ public static void main(String[] args) {
+ TestRunner.run(suite());
+ }
+
+ /**
+ * Get the suite of tests
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.setName("Commons-SCXML-model Tests");
+ return suite;
+ }
+}
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ModelTestSuite.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ModelTestSuite.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: jakarta/commons/sandbox/scxml/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/scxml/trunk/xdocs/changes.xml?rev=239346&r1=239345&r2=239346&view=diff
==============================================================================
--- jakarta/commons/sandbox/scxml/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/sandbox/scxml/trunk/xdocs/changes.xml Mon Aug 22 21:50:37 2005
@@ -31,6 +31,18 @@
</ul>
</section>
+ <release version="pre-beta-1.0-SNAPSHOT-003" date="08-23-2005" description="Test framework check-in">
+ <action dev="rahul" type="add">
+ Added JUnit Test Framework.
+ </action>
+ <action dev="rahul" type="fix">
+ Upgraded Digester version in project dependencies to 1.7.
+ </action>
+ <action dev="rahul" type="add">
+ Added BeanUtils 1.7.0 dependency as needed by Digester.
+ </action>
+ </release>
+
<release version="pre-beta-1.0-SNAPSHOT-002" date="08-20-2005" description="Checkstyle errors fix">
<action dev="rahul" type="fix">
Corrected year of inception in License.
Propchange: jakarta/commons/sandbox/scxml/trunk/xdocs/images/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 22 21:50:37 2005
@@ -0,0 +1 @@
+Thumbs.db
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org