Source Code Cross Referenced for ActionsTestCase.java in  » Workflow-Engines » OSWorkflow » com » opensymphony » workflow » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » OSWorkflow » com.opensymphony.workflow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2002-2003 by OpenSymphony
003:         * All rights reserved.
004:         */
005:        package com.opensymphony.workflow;
006:
007:        import com.opensymphony.workflow.basic.BasicWorkflow;
008:        import com.opensymphony.workflow.spi.Step;
009:        import com.opensymphony.workflow.spi.WorkflowEntry;
010:
011:        import junit.framework.TestCase;
012:
013:        import java.net.URL;
014:
015:        import java.util.ArrayList;
016:        import java.util.HashMap;
017:        import java.util.List;
018:        import java.util.Map;
019:
020:        /**
021:         * Test that when an auto execute action happens, the correct actions occur.
022:         *
023:         * @author Hani Suleiman (hani@formicary.net)
024:         * Date: May 9, 2003
025:         * Time: 10:26:48 PM
026:         */
027:        public class ActionsTestCase extends TestCase {
028:            //~ Instance fields ////////////////////////////////////////////////////////
029:
030:            //string used by propertyset-create.xml
031:            public String myvar;
032:            private AbstractWorkflow workflow;
033:
034:            //~ Constructors ///////////////////////////////////////////////////////////
035:
036:            public ActionsTestCase(String s) {
037:                super (s);
038:            }
039:
040:            //~ Methods ////////////////////////////////////////////////////////////////
041:
042:            public void testAutoWithSplit() throws Exception {
043:                URL url = getClass().getResource("/samples/auto-split.xml");
044:                long id = workflow.initialize(url.toString(), 1, null);
045:                List currentSteps = workflow.getCurrentSteps(id);
046:                assertEquals("Unexpected number of current steps", 2,
047:                        currentSteps.size());
048:            }
049:
050:            public void testConditionCheck() throws Exception {
051:                long id = workflow.initialize(getClass().getResource(
052:                        "/samples/auto4.xml").toString(), 100, null);
053:                List currentSteps = workflow.getCurrentSteps(id);
054:                assertEquals("Unexpected number of current steps", 1,
055:                        currentSteps.size());
056:                assertEquals("Unexpected current step", 3, ((Step) currentSteps
057:                        .get(0)).getStepId());
058:            }
059:
060:            public void testExecOnlyOne() throws Exception {
061:                long id = workflow.initialize(getClass().getResource(
062:                        "/samples/auto2.xml").toString(), 100, null);
063:                List currentSteps = workflow.getCurrentSteps(id);
064:                assertEquals("Unexpected number of current steps", 1,
065:                        currentSteps.size());
066:                assertEquals("Unexpected current step", 4, ((Step) currentSteps
067:                        .get(0)).getStepId());
068:
069:                List history = workflow.getHistorySteps(id);
070:                assertEquals("Expected to have one history step", 1, history
071:                        .size());
072:                assertEquals("Unexpected history step", 2, ((Step) history
073:                        .get(0)).getStepId());
074:            }
075:
076:            public void testExecTwoActions() throws Exception {
077:                long id = workflow.initialize(getClass().getResource(
078:                        "/samples/auto3.xml").toString(), 100, null);
079:                List currentSteps = workflow.getCurrentSteps(id);
080:                assertEquals("Unexpected number of current steps", 1,
081:                        currentSteps.size());
082:                assertEquals("Unexpected current step", 3, ((Step) currentSteps
083:                        .get(0)).getStepId());
084:
085:                List history = workflow.getHistorySteps(id);
086:                assertEquals("Expected to have two history steps", 2, history
087:                        .size());
088:                assertEquals("Unexpected first history step", 2,
089:                        ((Step) history.get(0)).getStepId());
090:                assertEquals("Unexpected second history step", 1,
091:                        ((Step) history.get(1)).getStepId());
092:            }
093:
094:            public void testPropertySetCreated() throws Exception {
095:                Map inputs = new HashMap();
096:                List list = new ArrayList();
097:                inputs.put("list", list);
098:
099:                long id = workflow.initialize(getClass().getResource(
100:                        "/samples/propertyset-create.xml").toString(), 1,
101:                        inputs);
102:                String value = (String) list.get(0);
103:                assertEquals("Unexpected property set value for key myvar",
104:                        "anything", value);
105:
106:                List currentSteps = workflow.getCurrentSteps(id);
107:                assertEquals("Unexpected number of current steps", 1,
108:                        currentSteps.size());
109:                assertEquals("Unexpected current step", 1, ((Step) currentSteps
110:                        .get(0)).getStepId());
111:            }
112:
113:            public void testSimpleAuto() throws Exception {
114:                long id = workflow.initialize(getClass().getResource(
115:                        "/samples/auto1.xml").toString(), 100, null);
116:                List currentSteps = workflow.getCurrentSteps(id);
117:                assertEquals("Unexpected number of current steps", 1,
118:                        currentSteps.size());
119:                assertEquals("Unexpected current step", 2, ((Step) currentSteps
120:                        .get(0)).getStepId());
121:            }
122:
123:            public void testSimpleFinish() throws Exception {
124:                long id = workflow.initialize(getClass().getResource(
125:                        "/samples/finish1.xml").toString(), 100, null);
126:                workflow.doAction(id, 1, null);
127:                assertTrue("Finished workflow should have no current steps",
128:                        workflow.getCurrentSteps(id).size() == 0);
129:                assertEquals("Unexpected workflow entry state",
130:                        WorkflowEntry.COMPLETED, workflow.getEntryState(id));
131:
132:                List historySteps = workflow.getHistorySteps(id);
133:
134:                //last history step should have status of LastFinished
135:                assertEquals("Unexpected number of history steps", 1,
136:                        historySteps.size());
137:            }
138:
139:            public void testSimpleFinishWithoutRestriction() throws Exception {
140:                long id = workflow.initialize(getClass().getResource(
141:                        "/samples/finish2.xml").toString(), 100, null);
142:                workflow.doAction(id, 1, null);
143:                assertTrue("Finished workflow should have no current steps",
144:                        workflow.getCurrentSteps(id).size() == 0);
145:                assertEquals("Unexpected workflow entry state",
146:                        WorkflowEntry.COMPLETED, workflow.getEntryState(id));
147:
148:                List historySteps = workflow.getHistorySteps(id);
149:
150:                //last history step should have status of LastFinished
151:                assertEquals("Unexpected number of history steps", 1,
152:                        historySteps.size());
153:            }
154:
155:            protected void setUp() throws Exception {
156:                workflow = new BasicWorkflow("testuser");
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.