Source Code Cross Referenced for ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess.java in  » Workflow-Engines » wfmopen-2.1.1 » process » 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 » wfmopen 2.1.1 » process 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package process;
002:
003:        import java.util.Iterator;
004:
005:        import de.danet.an.workflow.omgcore.CannotStopException;
006:
007:        import junit.framework.Test;
008:        import junit.framework.TestSuite;
009:        import de.danet.an.util.junit.EJBClientTest;
010:
011:        /**
012:         * Describe class 
013:         * <code>ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess</code> here.
014:         *
015:         * @author mao
016:         * @version 1.0
017:         */
018:        public class ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess
019:                extends WfMOpenTestCase {
020:            /**
021:             * Constructor of this TestCase
022:             * @param name a <code>String</code> value
023:             */
024:            public ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
025:                    String name) {
026:                super (name);
027:            }
028:
029:            /**
030:             * Construct this test suit.
031:             * @return a <code>Test</code> value
032:             */
033:            public static Test suite() {
034:                TestSuite suite = new TestSuite();
035:                suite
036:                        .addTest(new ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
037:                                "importProcessDefinitions"));
038:                suite
039:                        .addTest(new ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
040:                                "checkP0T1T01"));
041:                suite
042:                        .addTest(new ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
043:                                "checkP1T3T3"));
044:                suite
045:                        .addTest(new ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
046:                                "checkP1T4T4"));
047:                suite
048:                        .addTest(new ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
049:                                "checkP0T5T5"));
050:                suite
051:                        .addTest(new ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
052:                                "checkP0T7T7"));
053:                suite
054:                        .addTest(new ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
055:                                "checkP2T8T6"));
056:                suite
057:                        .addTest(new ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
058:                                "checkP1T0TnotExisting"));
059:                suite
060:                        .addTest(new ProcLifeCycleEngineTriggeredActivityTriggeringSubProcess(
061:                                "checkP3T7CannotStopException"));
062:                return new EJBClientTest(plc, suite);
063:            }
064:
065:            /**
066:             * Initialisation.
067:             * The <code>setUp</code> method defines the way a state change is 
068:             * realized. Override this method to change this way.
069:             * @exception Exception if an error occurs
070:             */
071:            protected void setUp() throws Exception {
072:                xpdlFile = "/process/systestproc5.xml";
073:                super .setUp();
074:            }
075:
076:            /**
077:             * The engine start a process and its first activity is started 
078:             * automatically. The state of this activity and its implemented subflow
079:             * must be open.running.
080:             * @exception Exception if an error occurs.
081:             */
082:            public void checkP0T1T01() throws Exception {
083:                // create the process
084:                SmartWfProcess process = createProcess("st-process5", "P0");
085:                assertState(process, NOT_STARTED);
086:                process.start();
087:                assertState(process, RUNNING);
088:                Iterator activitiesIt = process.steps().iterator();
089:                while (activitiesIt.hasNext()) {
090:                    SmartWfActivity activity = (SmartWfActivity) activitiesIt
091:                            .next();
092:                    if (activity.name().equals("A0.1SAA")) {
093:                        assertState(activity, RUNNING);
094:                        Thread.sleep(1000);
095:                        Iterator performersIt = activity.performers()
096:                                .iterator();
097:                        SmartWfProcess subFlowProcess = (SmartWfProcess) performersIt
098:                                .next();
099:                        assertState(subFlowProcess, RUNNING);
100:                    }
101:                }
102:            }
103:
104:            /**
105:             * The engine set the state of a activity from suspended to running. The 
106:             * state of its implemented subflow must be also running.
107:             * @exception Exception if an error occurs
108:             */
109:            public void checkP1T3T3() throws Exception {
110:                // create the process
111:                SmartWfProcess process = createProcess("st-process5", "P1");
112:                assertState(process, NOT_STARTED);
113:                process.start();
114:                assertState(process, RUNNING);
115:
116:                Iterator activitiesIt = process.steps().iterator();
117:                while (activitiesIt.hasNext()) {
118:                    SmartWfActivity activity = (SmartWfActivity) activitiesIt
119:                            .next();
120:                    if (activity.name().equals("A1.1SAA")) {
121:                        assertState(activity, SUSPENDED);
122:                        activity.setupWaitForState(RUNNING);
123:                        activity.resume();
124:                        activity.waitForState();
125:                        assertState(activity, RUNNING);
126:                        Thread.sleep(1000);
127:                        Iterator performersIt = activity.performers()
128:                                .iterator();
129:                        SmartWfProcess subFlowProcess = (SmartWfProcess) performersIt
130:                                .next();
131:                        assertState(subFlowProcess, RUNNING);
132:                    }
133:                }
134:            }
135:
136:            /**
137:             * The engine set the state of a activity from running to suspended. The 
138:             * state of its implemented subflow must be also suspended.
139:             * @exception Exception if an error occurs
140:             */
141:            public void checkP1T4T4() throws Exception {
142:                // create the process
143:                SmartWfProcess process = createProcess("st-process5", "P0");
144:                assertState(process, NOT_STARTED);
145:                process.start();
146:                assertState(process, RUNNING);
147:                Iterator activitiesIt = process.steps().iterator();
148:                while (activitiesIt.hasNext()) {
149:                    SmartWfActivity activity = (SmartWfActivity) activitiesIt
150:                            .next();
151:                    if (activity.name().equals("A0.1SAA")) {
152:                        Thread.sleep(1000);
153:                        assertState(activity, RUNNING);
154:                        Thread.sleep(1000);
155:                        Iterator performersIt = activity.performers()
156:                                .iterator();
157:                        SmartWfProcess subFlowProcess = (SmartWfProcess) performersIt
158:                                .next();
159:                        assertState(subFlowProcess, RUNNING);
160:                        // set the state of a activity from running to suspended
161:                        subFlowProcess.setupWaitForState(SUSPENDED);
162:                        activity.setupWaitForState(SUSPENDED);
163:                        activity.suspend();
164:                        activity.waitForState();
165:                        assertState(activity, SUSPENDED);
166:                        // its subflow must have a state of suspended
167:                        subFlowProcess.waitForState();
168:                        assertState(subFlowProcess, SUSPENDED);
169:                    }
170:                }
171:            }
172:
173:            /**
174:             * The engine set the state of a activity from suspended to aborted. The 
175:             * state of its implemented subflow must be also aborted.
176:             * @exception Exception if an error occurs
177:             */
178:            public void checkP0T5T5() throws Exception {
179:                // create the process
180:                SmartWfProcess process = createProcess("st-process5", "P0");
181:                assertState(process, NOT_STARTED);
182:                process.start();
183:                assertState(process, RUNNING);
184:
185:                Iterator activitiesIt = process.steps().iterator();
186:                while (activitiesIt.hasNext()) {
187:                    SmartWfActivity activity = (SmartWfActivity) activitiesIt
188:                            .next();
189:                    if (activity.name().equals("A0.1SAA")) {
190:                        Thread.sleep(1000);
191:                        assertState(activity, RUNNING);
192:                        Thread.sleep(1000);
193:                        Iterator performersIt = activity.performers()
194:                                .iterator();
195:                        SmartWfProcess subFlowProcess = (SmartWfProcess) performersIt
196:                                .next();
197:                        assertState(subFlowProcess, RUNNING);
198:                        // set the activity to suspended
199:                        activity.setupWaitForState(SUSPENDED);
200:                        activity.suspend();
201:                        activity.waitForState();
202:                        assertState(activity, SUSPENDED);
203:                        assertState(subFlowProcess, SUSPENDED);
204:                        // set the activity to closed
205:                        activity.setupWaitForState(ABORTED);
206:                        activity.abort();
207:                        activity.waitForState();
208:                        assertState(activity, ABORTED);
209:                        assertState(subFlowProcess, ABORTED);
210:                    }
211:                }
212:            }
213:
214:            /**
215:             * The engine set the state of a activity from running to terminated. The 
216:             * state of its implemented subflow must be also terminated.
217:             * @exception Exception if an error occurs
218:             */
219:            public void checkP0T7T7() throws Exception {
220:                // create the process
221:                SmartWfProcess process = createProcess("st-process5", "P0");
222:                assertState(process, NOT_STARTED);
223:                process.start();
224:                assertState(process, RUNNING);
225:
226:                Iterator activitiesIt = process.steps().iterator();
227:                while (activitiesIt.hasNext()) {
228:                    SmartWfActivity activity = (SmartWfActivity) activitiesIt
229:                            .next();
230:                    if (activity.name().equals("A0.1SAA")) {
231:                        assertState(activity, RUNNING);
232:                        Thread.sleep(1000);
233:                        Iterator performersIt = activity.performers()
234:                                .iterator();
235:                        SmartWfProcess subFlowProcess = (SmartWfProcess) performersIt
236:                                .next();
237:                        assertState(subFlowProcess, RUNNING);
238:                        subFlowProcess.setupWaitForState(TERMINATED);
239:                        // set the activity to terminated
240:                        activity.setupWaitForState(TERMINATED);
241:                        activity.terminate();
242:                        activity.waitForState();
243:                        assertState(activity, TERMINATED);
244:                        subFlowProcess.waitForState();
245:                        assertState(subFlowProcess, TERMINATED);
246:                    }
247:                }
248:            }
249:
250:            /**
251:             * The engine starts a process. It runs automatically. At the end the state
252:             * of a activity must be terminated. The same is for its implemented 
253:             * subflow.
254:             * @exception Exception if an error occurs
255:             */
256:            public void checkP2T8T6() throws Exception {
257:                // create the process
258:                SmartWfProcess process = createProcess("st-process5", "P2");
259:                assertState(process, NOT_STARTED);
260:                process.start();
261:                assertState(process, RUNNING);
262:
263:                Iterator activitiesIt = process.steps().iterator();
264:                while (activitiesIt.hasNext()) {
265:                    SmartWfActivity activity = (SmartWfActivity) activitiesIt
266:                            .next();
267:                    if (activity.name().equals("A2.1SAA")) {
268:                        Thread.sleep(1000);
269:                        Iterator performersIt = activity.performers()
270:                                .iterator();
271:                        SmartWfProcess subFlowProcess = (SmartWfProcess) performersIt
272:                                .next();
273:                        if (!subFlowProcess.hasState(COMPLETED)) {
274:                            subFlowProcess.setupWaitForState(COMPLETED);
275:                            subFlowProcess.waitForState();
276:                            assertState(subFlowProcess, COMPLETED);
277:                        }
278:                        if (!activity.hasState(COMPLETED)) {
279:                            activity.setupWaitForState(COMPLETED);
280:                            activity.waitForState();
281:                            assertState(activity, COMPLETED);
282:                        }
283:                    }
284:                }
285:                if (!process.hasState(COMPLETED)) {
286:                    process.setupWaitForState(COMPLETED);
287:                    process.waitForState();
288:                    assertState(process, COMPLETED);
289:                }
290:            }
291:
292:            /**
293:             * The engine starts the process, the start mode of its first activity is 
294:             * manual and the state of this activity is then suspended. Its implemented
295:             * subflow process is not existing.
296:             * @exception Exception if an error occurs
297:             */
298:            public void checkP1T0TnotExisting() throws Exception {
299:                // create the process
300:                SmartWfProcess process = createProcess("st-process5", "P1");
301:                assertState(process, NOT_STARTED);
302:
303:                Iterator activitiesIt = process.steps().iterator();
304:                while (activitiesIt.hasNext()) {
305:                    SmartWfActivity activity = (SmartWfActivity) activitiesIt
306:                            .next();
307:                    if (activity.name().equals("A1.1SAA")) {
308:                        assertState(activity, NOT_STARTED);
309:                        Thread.sleep(1000);
310:                        // the subflow process is not existing
311:                        assertTrue(activity.performers().size() == 0);
312:                    }
313:                }
314:            }
315:
316:            /**
317:             * As the subprocess Delayer runs, complete the activity. Exception will
318:             * be thrown.
319:             * @exception Exception if an error occurs
320:             */
321:            public void checkP3T7CannotStopException() throws Exception {
322:                // create the process
323:                SmartWfProcess process = createProcess("st-process5", "P3");
324:                assertState(process, NOT_STARTED);
325:                process.start();
326:                assertState(process, RUNNING);
327:
328:                Iterator activitiesIt = process.steps().iterator();
329:                while (activitiesIt.hasNext()) {
330:                    SmartWfActivity activity = (SmartWfActivity) activitiesIt
331:                            .next();
332:                    if (activity.name().equals("A3.1SAA")) {
333:                        Thread.sleep(1000);
334:                        assertState(activity, RUNNING);
335:                        Thread.sleep(1000);
336:                        Iterator performersIt = activity.performers()
337:                                .iterator();
338:                        SmartWfProcess subFlowProcess = (SmartWfProcess) performersIt
339:                                .next();
340:                        boolean canBeStop = true;
341:                        try {
342:                            assertState(subFlowProcess, RUNNING);
343:                            activity.terminate();
344:                        } catch (CannotStopException cce) {
345:                            canBeStop = false;
346:                        }
347:                        assertTrue(!canBeStop);
348:                    }
349:                }
350:            }
351:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.