Source Code Cross Referenced for ProcLifeCycle.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:        /*
002:         * This file is part of the WfMOpen project.
003:         * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004:         * All rights reserved.
005:         *
006:         * This program is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU General Public License as published by
008:         * the Free Software Foundation; either version 2 of the License, or
009:         * (at your option) any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
019:         * 
020:         * $Id: ProcLifeCycle.java,v 1.3 2006/09/29 12:32:07 drmlipp Exp $
021:         *
022:         * $Log: ProcLifeCycle.java,v $
023:         * Revision 1.3  2006/09/29 12:32:07  drmlipp
024:         * Consistently using WfMOpen as projct name now.
025:         *
026:         * Revision 1.2  2004/09/10 10:48:29  drmlipp
027:         * Made tests undividually runnable.
028:         *
029:         * Revision 1.1.1.2  2003/12/19 13:01:44  drmlipp
030:         * Updated to 1.1rc1
031:         *
032:         * Revision 1.21  2003/10/21 21:00:45  lipp
033:         * Moved EJBClientTest to new junit sub-package.
034:         *
035:         * Revision 1.20  2003/10/08 12:39:40  huaiyang
036:         * make test weblogic compatible.
037:         *
038:         * Revision 1.19  2003/06/27 09:44:03  lipp
039:         * Fixed copyright/license information.
040:         *
041:         * Revision 1.18  2003/05/13 14:35:32  lipp
042:         * Fixed name.
043:         *
044:         * Revision 1.17  2003/04/26 16:12:22  lipp
045:         * Moved some classes to reduce package dependencies.
046:         *
047:         * Revision 1.16  2003/04/16 19:58:49  lipp
048:         * Adapted to jdk 1.4
049:         *
050:         * Revision 1.15  2003/02/25 17:08:18  lipp
051:         * Reorganized requester implementation.
052:         *
053:         * Revision 1.14  2003/02/12 16:14:43  lipp
054:         * Delays now based on events.
055:         *
056:         * Revision 1.13  2003/02/05 15:57:06  lipp
057:         * Replaced DummyRequester with DefaultRequester.
058:         *
059:         * Revision 1.12  2002/12/04 10:51:38  weidauer
060:         * allowed a complete call to suspended activities because of state transition 9
061:         *
062:         * Revision 1.11  2002/11/25 17:22:42  weidauer
063:         * refactored with WfMOpenTestCase as base test case and cleaned up classes
064:         *
065:         * Revision 1.10  2002/11/25 15:19:02  weidauer
066:         * modified totally to SmartWfExecutionObjects
067:         *
068:         * Revision 1.9  2002/11/21 16:24:51  weidauer
069:         * added smart handling of WfExecutionObjects
070:         *
071:         * Revision 1.8  2002/11/21 14:09:53  weidauer
072:         * modified test structure
073:         *
074:         * Revision 1.7  2002/11/19 16:15:50  weidauer
075:         * little modification
076:         *
077:         * Revision 1.6  2002/11/18 16:41:26  weidauer
078:         * added waitForState method
079:         *
080:         * Revision 1.5  2002/11/08 12:26:58  weidauer
081:         * successful running test case
082:         *
083:         * Revision 1.4  2002/11/07 17:27:45  weidauer
084:         * changed for not stopable activities
085:         *
086:         * Revision 1.3  2002/11/05 10:58:41  weidauer
087:         * added exception checking
088:         *
089:         * Revision 1.2  2002/11/01 14:49:22  weidauer
090:         * trouble maker
091:         *
092:         * Revision 1.1  2002/10/31 17:36:12  weidauer
093:         * initial system test
094:         *
095:         */
096:        package process;
097:
098:        import java.util.Collection;
099:        import java.util.Iterator;
100:
101:        import de.danet.an.util.junit.EJBClientTest;
102:
103:        import de.danet.an.workflow.omgcore.AlreadyRunningException;
104:        import de.danet.an.workflow.omgcore.AlreadySuspendedException;
105:        import de.danet.an.workflow.omgcore.CannotCompleteException;
106:        import de.danet.an.workflow.omgcore.CannotStopException;
107:        import de.danet.an.workflow.omgcore.NotRunningException;
108:        import de.danet.an.workflow.omgcore.NotSuspendedException;
109:        import de.danet.an.workflow.omgcore.TransitionNotAllowedException;
110:
111:        import junit.framework.Test;
112:        import junit.framework.TestResult;
113:        import junit.framework.TestSuite;
114:
115:        /**
116:         * Test the life cycle of different processes.
117:         * @author <a href="mailto:weidauer@danet.de">Christian Weidauer</a>
118:         * @version 1.0
119:         */
120:        public class ProcLifeCycle extends WfMOpenTestCase {
121:            /**
122:             * Constructor of this TestCase
123:             * @param name a <code>String</code> value
124:             */
125:            public ProcLifeCycle(String name) {
126:                super (name);
127:            }
128:
129:            /**
130:             * Construct this test suite.
131:             * @return a <code>Test</code> value
132:             */
133:            public static Test suite() {
134:                TestSuite suite = new TestSuite();
135:                suite.addTest(new ProcLifeCycle("importProcessDefinitions"));
136:                suite.addTest(new ProcLifeCycle(
137:                        "checkStartAndFinishModeWithProcessP1"));
138:                suite
139:                        .addTest(new ProcLifeCycle(
140:                                "checkExceptionsWithProcessP2"));
141:                return suite;
142:            }
143:
144:            /**
145:             * Initialisation.
146:             * The <code>setUp</code> method defines the way a state change is 
147:             * realized. Override this method to change this way.
148:             * @exception Exception if an error occurs
149:             */
150:            protected void setUp() throws Exception {
151:                xpdlFile = "/process/systestproc1.xml";
152:                super .setUp();
153:            }
154:
155:            /**
156:             * Runs the tests with an appropriate login context.
157:             *
158:             * @param testResult a <code>TestResult</code> value
159:             */
160:            public void run(final TestResult testResult) {
161:                EJBClientTest.run(new Runnable() {
162:                    public void run() {
163:                        ProcLifeCycle.super .run(testResult);
164:                    }
165:                }, plc, testResult);
166:            }
167:
168:            /**
169:             * Test a simple process definition. 
170:             * @exception Exception if an error occurs
171:             */
172:            public void checkStartAndFinishModeWithProcessP1() throws Exception {
173:                // create the process
174:                SmartWfProcess process = createProcess("st-process1", "P1");
175:                assertState(process, NOT_STARTED);
176:                // start the process
177:                process.setupWaitForState(RUNNING);
178:                process.start();
179:                process.waitForState();
180:                assertState(process, RUNNING);
181:                process.setupWaitForState(COMPLETED);
182:                controlStartAndFinishMode(process);
183:                process.waitForState();
184:                assertState(process, COMPLETED);
185:
186:                removeProcess(process);
187:            }
188:
189:            /**
190:             * Controls activities with no implementation.
191:             *
192:             * @param process a <code>WfProcess</code> value
193:             * @exception Exception if an error occurs
194:             */
195:            public void controlStartAndFinishMode(SmartWfProcess process)
196:                    throws Exception {
197:                Collection c = process.steps();
198:                Iterator it = c.iterator();
199:                while (it.hasNext()) {
200:                    SmartWfActivity a = (SmartWfActivity) it.next();
201:                    ActivityNameAnalyser ana = new ActivityNameAnalyser(a
202:                            .name());
203:                    if (ana.startMode() == ana.MANUAL) {
204:                        a.setupWaitForState(SUSPENDED);
205:                        if (!a.hasState(SUSPENDED)) {
206:                            a.waitForState();
207:                        }
208:                        assertState(a, SUSPENDED);
209:                        a.setupWaitForState(RUNNING);
210:                        a.resume();
211:                        a.waitForState();
212:                        // may already no longer be running when here.
213:                    }
214:                    if (ana.finishMode() == ana.MANUAL) {
215:                        a.setupWaitForState(SUSPENDED);
216:                        if (!a.hasState(SUSPENDED)) {
217:                            a.waitForState();
218:                        }
219:                        assertState(a, SUSPENDED);
220:                        a.setupWaitForState(COMPLETED);
221:                        a.resume();
222:                        assertTrue(!a.hasState(SUSPENDED));
223:                        a.waitForState();
224:                        assertState(a, COMPLETED);
225:                    }
226:                }
227:            }
228:
229:            /**
230:             * Test the throwing of exceptions with a simple process definition (P2). 
231:             * @exception Exception if an error occurs
232:             */
233:            public void checkExceptionsWithProcessP2() throws Exception {
234:                // create the process
235:                SmartWfProcess process = createProcess("st-process1", "P2");
236:                Collection c = process.steps();
237:                Iterator it = c.iterator();
238:                SmartWfActivity activity = (SmartWfActivity) it.next();
239:                SmartWfActivity stopableActivity;
240:                SmartWfActivity notStopableActivity;
241:                if ((new ActivityNameAnalyser(activity.name())).number()
242:                        .equals("2.1")) { // activity 2.1 is a webform tool
243:                    stopableActivity = activity; // Webform tool
244:                    notStopableActivity = (SmartWfActivity) it.next(); //JSExecutor tool
245:                } else {
246:                    notStopableActivity = activity; // JSExecutor tool
247:                    stopableActivity = (SmartWfActivity) it.next(); // Webform tool
248:                }
249:                activity = null;
250:                assertState(process, NOT_STARTED);
251:                checkNotStartedProcess(process, setStateDirectly);
252:                assertState(stopableActivity, NOT_STARTED);
253:                checkNotStartedActivity(stopableActivity, setStateDirectly);
254:                assertState(notStopableActivity, NOT_STARTED);
255:                checkNotStartedActivity(notStopableActivity, setStateDirectly);
256:
257:                process.setupWaitForState(RUNNING);
258:                stopableActivity.setupWaitForState(RUNNING);
259:                notStopableActivity.setupWaitForState(RUNNING);
260:                process.start();
261:                process.waitForState();
262:                assertState(process, RUNNING);
263:                checkRunningProcess(process, setStateDirectly);
264:                stopableActivity.waitForState();
265:                assertState(stopableActivity, RUNNING);
266:                checkRunningActivity(stopableActivity, setStateDirectly);
267:                notStopableActivity.waitForState();
268:                assertState(notStopableActivity, RUNNING);
269:                checkNotStopableRunningActivity(notStopableActivity,
270:                        setStateDirectly);
271:
272:                stopableActivity.setupWaitForState(SUSPENDED);
273:                stopableActivity.suspend();
274:                stopableActivity.waitForState();
275:                assertState(stopableActivity, SUSPENDED);
276:                checkSuspendedActivity(stopableActivity, setStateDirectly);
277:                process.setupWaitForState(SUSPENDED);
278:                process.suspend();
279:                process.waitForState();
280:
281:                assertState(process, SUSPENDED);
282:                checkSuspendedProcess(process, setStateDirectly);
283:
284:                assertState(stopableActivity, SUSPENDED);
285:                stopableActivity.setupWaitForState(RUNNING);
286:                stopableActivity.resume();
287:                stopableActivity.waitForState();
288:                assertState(stopableActivity, RUNNING);
289:                stopableActivity.setupWaitForState(TERMINATED);
290:                stopableActivity.terminate();
291:                stopableActivity.waitForState();
292:                assertState(stopableActivity, TERMINATED);
293:                checkClosedActivity(stopableActivity, setStateDirectly);
294:
295:                assertState(notStopableActivity, RUNNING);
296:                notStopableActivity.setupWaitForState(COMPLETED);
297:                notStopableActivity.complete();
298:                notStopableActivity.waitForState();
299:                assertState(notStopableActivity, COMPLETED);
300:
301:                process.setupWaitForState(ABORTED);
302:                process.abort();
303:                process.waitForState();
304:                assertState(process, ABORTED);
305:                checkClosedProcess(process, setStateDirectly);
306:                assertState(process, ABORTED);
307:
308:                removeProcess(process);
309:            }
310:
311:            /**
312:             * Describe <code>checkNotStartedProcess</code> method here.
313:             *
314:             * @param process a <code>WfProcess</code> value
315:             * @param setStateDirectly a <code>boolean</code> value
316:             * @exception Exception if an error occurs
317:             */
318:            protected void checkNotStartedProcess(SmartWfProcess process,
319:                    boolean setStateDirectly) throws Exception {
320:                checkNotStartedExecutionObject(process, setStateDirectly);
321:            }
322:
323:            /**
324:             * Describe <code>checkNotStartedActivity</code> method here.
325:             *
326:             * @param activity a <code>WfActivity</code> value
327:             * @param setStateDirectly a <code>boolean</code> value
328:             * @exception Exception if an error occurs
329:             */
330:            protected void checkNotStartedActivity(SmartWfActivity activity,
331:                    boolean setStateDirectly) throws Exception {
332:                checkNotStartedExecutionObject(activity, setStateDirectly);
333:                boolean exceptionCaught = false;
334:                try {
335:                    activity.complete();
336:                } catch (CannotCompleteException e) {
337:                    exceptionCaught = true;
338:                } catch (TransitionNotAllowedException e) {
339:                    exceptionCaught = true;
340:                }
341:                assertTrue(exceptionCaught);
342:            }
343:
344:            /**
345:             * Describe <code>checkRunningProcess</code> method here.
346:             *
347:             * @param process a <code>WfProcess</code> value
348:             * @param setStateDirectly a <code>boolean</code> value
349:             * @exception Exception if an error occurs
350:             */
351:            protected void checkRunningProcess(SmartWfProcess process,
352:                    boolean setStateDirectly) throws Exception {
353:                checkRunningExecutionObject(process, setStateDirectly);
354:                boolean exceptionCaught = false;
355:                try {
356:                    process.start();
357:                } catch (AlreadyRunningException e) {
358:                    exceptionCaught = true;
359:                } catch (TransitionNotAllowedException e) {
360:                    exceptionCaught = true;
361:                }
362:                assertTrue(exceptionCaught);
363:            }
364:
365:            /**
366:             * Describe <code>checkRunningActivity</code> method here.
367:             *
368:             * @param activity a <code>WfActivity</code> value
369:             * @param setStateDirectly a <code>boolean</code> value
370:             * @exception Exception if an error occurs
371:             */
372:            protected void checkRunningActivity(SmartWfActivity activity,
373:                    boolean setStateDirectly) throws Exception {
374:                checkRunningExecutionObject(activity, setStateDirectly);
375:            }
376:
377:            /**
378:             * Describe <code>checkNotStopableRunningActivity</code> method here.
379:             *
380:             * @param activity a <code>WfActivity</code> value
381:             * @param setStateDirectly a <code>boolean</code> value
382:             * @exception Exception if an error occurs
383:             */
384:            protected void checkNotStopableRunningActivity(
385:                    SmartWfActivity activity, boolean setStateDirectly)
386:                    throws Exception {
387:                checkRunningExecutionObject(activity, setStateDirectly);
388:                boolean exceptionCaught = false;
389:                try {
390:                    activity.terminate();
391:                } catch (CannotStopException e) {
392:                    exceptionCaught = true;
393:                } catch (TransitionNotAllowedException e) {
394:                    exceptionCaught = true;
395:                }
396:                assertTrue(activity.toString() + " could be terminated!",
397:                        exceptionCaught);
398:            }
399:
400:            /**
401:             * Describe <code>checkSuspendedProcess</code> method here.
402:             *
403:             * @param process a <code>WfProcess</code> value
404:             * @param setStateDirectly a <code>boolean</code> value
405:             * @exception Exception if an error occurs
406:             */
407:            protected void checkSuspendedProcess(SmartWfProcess process,
408:                    boolean setStateDirectly) throws Exception {
409:                checkSuspendedExecutionObject(process, setStateDirectly);
410:                boolean exceptionCaught = false;
411:                //changeState(RUNNING) would work from SUSPENDED but start() not
412:                if (!setStateDirectly) {
413:                    try {
414:                        process.start();
415:                    } catch (AlreadyRunningException e) {
416:                        exceptionCaught = true;
417:                    } catch (TransitionNotAllowedException e) {
418:                        exceptionCaught = true;
419:                    }
420:                    assertTrue(exceptionCaught);
421:                }
422:            }
423:
424:            /**
425:             * Describe <code>checkSuspendedActivity</code> method here.
426:             *
427:             * @param activity a <code>WfActivity</code> value
428:             * @param setStateDirectly a <code>boolean</code> value
429:             * @exception Exception if an error occurs
430:             */
431:            protected void checkSuspendedActivity(SmartWfActivity activity,
432:                    boolean setStateDirectly) throws Exception {
433:                checkSuspendedExecutionObject(activity, setStateDirectly);
434:            }
435:
436:            /**
437:             * Describe <code>checkClosedProcess</code> method here.
438:             *
439:             * @param process a <code>WfProcess</code> value
440:             * @param setStateDirectly a <code>boolean</code> value
441:             * @exception Exception if an error occurs
442:             */
443:            protected void checkClosedProcess(SmartWfProcess process,
444:                    boolean setStateDirectly) throws Exception {
445:                checkClosedExecutionObject(process, setStateDirectly);
446:                boolean exceptionCaught = false;
447:                try {
448:                    process.start();
449:                } catch (AlreadyRunningException e) {
450:                    exceptionCaught = true;
451:                } catch (TransitionNotAllowedException e) {
452:                    exceptionCaught = true;
453:                }
454:                assertTrue(exceptionCaught);
455:            }
456:
457:            /**
458:             * Describe <code>checkClosedActivity</code> method here.
459:             *
460:             * @param activity a <code>WfActivity</code> value
461:             * @param setStateDirectly a <code>boolean</code> value
462:             * @exception Exception if an error occurs
463:             */
464:            protected void checkClosedActivity(SmartWfActivity activity,
465:                    boolean setStateDirectly) throws Exception {
466:                checkClosedExecutionObject(activity, setStateDirectly);
467:                boolean exceptionCaught = false;
468:                try {
469:                    activity.complete();
470:                } catch (CannotCompleteException e) {
471:                    exceptionCaught = true;
472:                } catch (TransitionNotAllowedException e) {
473:                    exceptionCaught = true;
474:                }
475:                assertTrue(exceptionCaught);
476:            }
477:
478:            /**
479:             * Describe <code>checkNotStartedExecutionObject</code> method here.
480:             *
481:             * @param executionObject a <code>WfExecutionObject</code> value
482:             * @param setStateDirectly a <code>boolean</code> value
483:             * @exception Exception if an error occurs
484:             */
485:            protected void checkNotStartedExecutionObject(
486:                    SmartWfExecutionObject executionObject,
487:                    boolean setStateDirectly) throws Exception {
488:                boolean exceptionCaught = false;
489:                try {
490:                    executionObject.suspend();
491:                } catch (NotRunningException e) {
492:                    exceptionCaught = true;
493:                } catch (TransitionNotAllowedException e) {
494:                    exceptionCaught = true;
495:                }
496:                assertTrue(exceptionCaught);
497:                //changeState(RUNNING) would work from NOT_STARTED but resume() not
498:                if (!setStateDirectly) {
499:                    exceptionCaught = false;
500:                    try {
501:                        executionObject.resume();
502:                    } catch (NotRunningException e) {
503:                        exceptionCaught = true;
504:                    } catch (TransitionNotAllowedException e) {
505:                        exceptionCaught = true;
506:                    }
507:                    assertTrue(exceptionCaught);
508:                }
509:                exceptionCaught = false;
510:                try {
511:                    executionObject.abort();
512:                } catch (NotRunningException e) {
513:                    exceptionCaught = true;
514:                } catch (TransitionNotAllowedException e) {
515:                    exceptionCaught = true;
516:                }
517:                assertTrue(exceptionCaught);
518:            }
519:
520:            /**
521:             * Describe <code>checkRunningExecutionObject</code> method here.
522:             *
523:             * @param executionObject a <code>WfExecutionObject</code> value
524:             * @param setStateDirectly a <code>boolean</code> value
525:             * @exception Exception if an error occurs
526:             */
527:            protected void checkRunningExecutionObject(
528:                    SmartWfExecutionObject executionObject,
529:                    boolean setStateDirectly) throws Exception {
530:                boolean exceptionCaught = false;
531:                try {
532:                    executionObject.resume();
533:                } catch (NotSuspendedException e) {
534:                    exceptionCaught = true;
535:                } catch (TransitionNotAllowedException e) {
536:                    exceptionCaught = true;
537:                }
538:                assertTrue(exceptionCaught);
539:                exceptionCaught = false;
540:                try {
541:                    executionObject.abort();
542:                } catch (CannotStopException e) {
543:                    exceptionCaught = true;
544:                } catch (TransitionNotAllowedException e) {
545:                    exceptionCaught = true;
546:                }
547:                assertTrue(exceptionCaught);
548:            }
549:
550:            /**
551:             * Describe <code>checkSuspendedExecutionObject</code> method here.
552:             *
553:             * @param executionObject a <code>WfExecutionObject</code> value
554:             * @param setStateDirectly a <code>boolean</code> value
555:             * @exception Exception if an error occurs
556:             */
557:            protected void checkSuspendedExecutionObject(
558:                    SmartWfExecutionObject executionObject,
559:                    boolean setStateDirectly) throws Exception {
560:                boolean exceptionCaught = false;
561:                try {
562:                    executionObject.suspend();
563:                } catch (AlreadySuspendedException e) {
564:                    exceptionCaught = true;
565:                } catch (TransitionNotAllowedException e) {
566:                    exceptionCaught = true;
567:                }
568:                assertTrue(exceptionCaught);
569:                exceptionCaught = false;
570:                try {
571:                    executionObject.terminate();
572:                } catch (NotRunningException e) {
573:                    exceptionCaught = true;
574:                } catch (TransitionNotAllowedException e) {
575:                    exceptionCaught = true;
576:                }
577:                assertTrue(exceptionCaught);
578:            }
579:
580:            /**
581:             * Describe <code>checkClosedExecutionObject</code> method here.
582:             *
583:             * @param executionObject a <code>WfExecutionObject</code> value
584:             * @param setStateDirectly a <code>boolean</code> value
585:             * @exception Exception if an error occurs
586:             */
587:            protected void checkClosedExecutionObject(
588:                    SmartWfExecutionObject executionObject,
589:                    boolean setStateDirectly) throws Exception {
590:                boolean exceptionCaught = false;
591:                try {
592:                    executionObject.suspend();
593:                } catch (NotRunningException e) {
594:                    exceptionCaught = true;
595:                } catch (TransitionNotAllowedException e) {
596:                    exceptionCaught = true;
597:                }
598:                assertTrue(exceptionCaught);
599:                exceptionCaught = false;
600:                try {
601:                    executionObject.resume();
602:                } catch (NotRunningException e) {
603:                    exceptionCaught = true;
604:                } catch (TransitionNotAllowedException e) {
605:                    exceptionCaught = true;
606:                }
607:                assertTrue(exceptionCaught);
608:                exceptionCaught = false;
609:                try {
610:                    executionObject.terminate();
611:                } catch (NotRunningException e) {
612:                    exceptionCaught = true;
613:                } catch (TransitionNotAllowedException e) {
614:                    exceptionCaught = true;
615:                }
616:                assertTrue(exceptionCaught);
617:                exceptionCaught = false;
618:                try {
619:                    executionObject.abort();
620:                } catch (NotRunningException e) {
621:                    exceptionCaught = true;
622:                } catch (TransitionNotAllowedException e) {
623:                    exceptionCaught = true;
624:                }
625:                assertTrue(exceptionCaught);
626:            }
627:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.