Source Code Cross Referenced for ValidateProcDef.java in  » Workflow-Engines » wfmopen-2.1.1 » procdef » 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 » procdef 
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:         * $Id: ValidateProcDef.java,v 1.7 2006/11/17 21:41:22 mlipp Exp $
020:         *
021:         * $Log: ValidateProcDef.java,v $
022:         * Revision 1.7  2006/11/17 21:41:22  mlipp
023:         * Added Java type tests.
024:         *
025:         * Revision 1.6  2006/10/13 13:58:32  drmlipp
026:         * Adapted to new environment.
027:         *
028:         * Revision 1.5  2006/10/07 20:41:34  mlipp
029:         * Merged J2EE 1.4 adaptions from test branch.
030:         *
031:         * Revision 1.4  2006/09/29 12:32:09  drmlipp
032:         * Consistently using WfMOpen as projct name now.
033:         *
034:         * Revision 1.3  2006/03/08 14:46:43  drmlipp
035:         * Synchronized with 1.3.3p5.
036:         *
037:         * Revision 1.2  2005/04/08 11:28:06  drmlipp
038:         * Merged changes from 1.3 branch up to 1.3p6.
039:         *
040:         * Revision 1.1.1.4.6.1  2005/03/03 16:32:47  drmlipp
041:         * Added test.
042:         *
043:         * Revision 1.1.1.4  2004/08/18 15:18:46  drmlipp
044:         * Update to 1.2
045:         *
046:         * Revision 1.39  2004/03/18 12:53:01  lipp
047:         * Support for XML as actual parameter.
048:         *
049:         * Revision 1.38  2004/01/27 11:45:33  lipp
050:         * Preserve newlines when reading process definitions.
051:         *
052:         * Revision 1.37  2003/10/21 21:00:45  lipp
053:         * Moved EJBClientTest to new junit sub-package.
054:         *
055:         * Revision 1.36  2003/10/07 15:55:57  lipp
056:         * Made tests weblogic compatible.
057:         *
058:         * Revision 1.35  2003/07/11 10:49:26  huaiyang
059:         * Fix the tip error with the error key.
060:         *
061:         * Revision 1.34  2003/07/11 10:30:24  huaiyang
062:         * Error messages further improved.
063:         *
064:         * Revision 1.33  2003/07/10 12:44:17  huaiyang
065:         * Fix the tip error of transition.
066:         *
067:         * Revision 1.32  2003/07/09 07:54:01  huaiyang
068:         * compare the error message with its key.
069:         *
070:         * Revision 1.31  2003/06/27 09:44:13  lipp
071:         * Fixed copyright/license information.
072:         *
073:         * Revision 1.30  2003/06/03 15:37:42  huaiyang
074:         * add the tests of paramTypeMismatch.
075:         *
076:         * Revision 1.29  2003/05/31 18:30:57  lipp
077:         * Fixed test case.
078:         *
079:         * Revision 1.28  2003/05/26 14:31:58  huaiyang
080:         * add the check of loop activities.
081:         *
082:         * Revision 1.27  2003/05/26 12:43:22  huaiyang
083:         * add the test of illegalScriptType and illegalScriptVersion.
084:         *
085:         * Revision 1.26  2003/05/13 08:38:40  huaiyang
086:         * add the test for checking actual params in calling subflow.
087:         *
088:         * Revision 1.25  2003/05/12 09:14:26  huaiyang
089:         * add the test of invalidPriority.
090:         *
091:         * Revision 1.24  2003/05/08 15:01:27  huaiyang
092:         * add the test of emptyActivitySet.
093:         *
094:         * Revision 1.23  2003/04/26 16:46:55  lipp
095:         * Made unittests and systemtests coexist in eclipse.
096:         *
097:         * Revision 1.22  2003/04/16 19:25:04  lipp
098:         * Adapted to jdk 1.4
099:         *
100:         * Revision 1.21  2003/03/31 16:50:29  huaiyang
101:         * Logging using common-logging.
102:         *
103:         * Revision 1.20  2003/03/28 12:15:28  huaiyang
104:         * the error text of noprocdata modified.
105:         *
106:         * Revision 1.19  2003/03/07 14:11:51  huaiyang
107:         * set the default locale as chinese, then restore it.
108:         *
109:         * Revision 1.18  2003/03/07 09:35:42  huaiyang
110:         * Changed because of the new ImportMessage.properties.
111:         *
112:         * Revision 1.17  2003/03/07 08:03:48  huaiyang
113:         * retrieve the error message for the Locale.ENGLISH.
114:         *
115:         * Revision 1.16  2003/03/04 13:43:09  huaiyang
116:         * add the test of invalidBlockActivityId.
117:         *
118:         * Revision 1.15  2003/02/17 09:53:53  lipp
119:         * Fixed typo in filename.
120:         *
121:         * Revision 1.14  2002/12/04 16:05:49  lipp
122:         * Fixed minor compilation problem.
123:         *
124:         * Revision 1.13  2002/12/02 16:19:31  huaiyang
125:         * ImportProcessDefinition throws now ImportException.
126:         *
127:         * Revision 1.12  2002/11/25 09:28:53  huaiyang
128:         * New test of validApplicationId.
129:         *
130:         * Revision 1.11  2002/11/13 11:25:43  huaiyang
131:         * NMTOKEN compatible.
132:         *
133:         * Revision 1.10  2002/11/12 14:16:11  huaiyang
134:         * Add test for validating transition restrictions of activity.
135:         *
136:         * Revision 1.9  2002/11/06 12:15:51  huaiyang
137:         * Add the test of invalidExtendedAttribute.
138:         *
139:         * Revision 1.8  2002/11/04 10:57:29  huaiyang
140:         * Add tests for validating transition of activitySet.
141:         *
142:         * Revision 1.7  2002/11/01 12:22:21  huaiyang
143:         * Add the tests of invalidActivitySetTransRefId and invalidActivityTransRefId
144:         *
145:         * Revision 1.6  2002/09/24 12:21:04  huaiyang
146:         * Add test of checking match of formal and actual parameter.
147:         *
148:         * Revision 1.5  2002/09/23 12:04:34  huaiyang
149:         * Remove the test of invalidTool.
150:         *
151:         * Revision 1.4  2002/09/18 14:32:54  huaiyang
152:         * Add testing of participant.
153:         *
154:         * Revision 1.3  2002/09/16 15:31:28  huaiyang
155:         * Add the correct application class.
156:         *
157:         * Revision 1.2  2002/08/30 13:37:05  lipp
158:         * Using Workflow engine facade now.
159:         *
160:         * Revision 1.1  2002/08/15 15:03:19  huaiyang
161:         * Initial.
162:         *
163:         *
164:         */
165:        package procdef;
166:
167:        import java.io.BufferedReader;
168:        import java.io.InputStream;
169:        import java.io.InputStreamReader;
170:
171:        import java.util.ArrayList;
172:        import java.util.Iterator;
173:        import java.util.List;
174:
175:        import javax.naming.InitialContext;
176:        import javax.security.auth.login.LoginException;
177:
178:        import de.danet.an.util.EJBUtil;
179:        import de.danet.an.util.junit.EJBClientTest;
180:
181:        import de.danet.an.workflow.api.ImportException;
182:        import de.danet.an.workflow.api.PrioritizedMessage;
183:        import de.danet.an.workflow.api.ProcessDefinitionDirectory;
184:        import de.danet.an.workflow.api.WorkflowServiceFactory;
185:
186:        import de.danet.an.workflow.ejbs.admin.ProcessDefinitionDirectoryHome;
187:
188:        import common.UTLoginContext;
189:        import junit.framework.Test;
190:        import junit.framework.TestCase;
191:        import junit.framework.TestSuite;
192:
193:        /**
194:         * test the functionality of the class 
195:         * <code>de.danet.an.workflow.domain.ProcDefValidator</code>.
196:         */
197:        public class ValidateProcDef extends TestCase {
198:            /** logger of this class */
199:            static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory
200:                    .getLog(ValidateProcDef.class);
201:
202:            private static UTLoginContext plc = null;
203:            static {
204:                try {
205:                    plc = new UTLoginContext();
206:                    plc.login();
207:                } catch (LoginException e) {
208:                    throw new IllegalStateException(e.getMessage());
209:                }
210:            }
211:
212:            /**
213:             * constructor of this test case.
214:             * @param name name of this test case.
215:             */
216:            public ValidateProcDef(String name) {
217:                super (name);
218:            }
219:
220:            /**
221:             * build this test suite.
222:             * @return the built test suite. 
223:             */
224:            public static Test suite() {
225:                TestSuite suite = new TestSuite();
226:                suite.addTest(new ValidateProcDef("doubleActivityId"));
227:                suite.addTest(new ValidateProcDef("doubleApplicationId"));
228:                suite.addTest(new ValidateProcDef("doubleProcessId"));
229:                suite.addTest(new ValidateProcDef("doubleTransitionId"));
230:                suite.addTest(new ValidateProcDef(
231:                        "doubleTransitionIdOfActivitySet"));
232:                suite.addTest(new ValidateProcDef(
233:                        "invalidRefActFromIdInTransition"));
234:                suite.addTest(new ValidateProcDef(
235:                        "invalidRefActFromIdInTransitionOfActivitySet"));
236:                suite.addTest(new ValidateProcDef(
237:                        "invalidRefActToIdInTransition"));
238:                suite.addTest(new ValidateProcDef(
239:                        "invalidRefActToIdInTransitionOfActivitySet"));
240:                suite
241:                        .addTest(new ValidateProcDef(
242:                                "invalidRefToolIdInActivity"));
243:                suite.addTest(new ValidateProcDef(
244:                        "invalidRefToolIdInActivitySet"));
245:                suite.addTest(new ValidateProcDef(
246:                        "invalidActivitySetTransRefId"));
247:                suite.addTest(new ValidateProcDef("invalidActivityTransRefId"));
248:                suite.addTest(new ValidateProcDef("invalidBlockActivityId"));
249:                suite.addTest(new ValidateProcDef("invalidExtendedAttribute"));
250:                suite.addTest(new ValidateProcDef(
251:                        "invalidTransitionRestriction"));
252:                suite.addTest(new ValidateProcDef("validApplicationId"));
253:                suite.addTest(new ValidateProcDef("incompleteApplicationDef"));
254:                suite.addTest(new ValidateProcDef("participantNotFound"));
255:                suite.addTest(new ValidateProcDef("doubleParticipantId"));
256:                suite.addTest(new ValidateProcDef(
257:                        "notMatchedFormalAndActualParams"));
258:                suite.addTest(new ValidateProcDef("noProcDataForActualParam"));
259:                suite.addTest(new ValidateProcDef("emptyActivitySet"));
260:                suite.addTest(new ValidateProcDef("invalidPriority"));
261:                suite.addTest(new ValidateProcDef(
262:                        "noMatchedDataFieldInCallingSubFlow"));
263:                suite.addTest(new ValidateProcDef(
264:                        "noMatchedActualParamsInCallingSubFlow"));
265:                suite.addTest(new ValidateProcDef(
266:                        "noMatchedActualParamTypeCallingSubFlow"));
267:                suite.addTest(new ValidateProcDef("illegalScriptType"));
268:                suite.addTest(new ValidateProcDef("illegalScriptVersion"));
269:                suite.addTest(new ValidateProcDef("loopActivities"));
270:                suite.addTest(new ValidateProcDef("subFlowParamTypeMismatch"));
271:                suite.addTest(new ValidateProcDef("toolParamTypeMismatch"));
272:                suite.addTest(new ValidateProcDef("XMLParamsOK"));
273:                suite.addTest(new ValidateProcDef("XMLToolParamBuggy"));
274:                suite.addTest(new ValidateProcDef("XMLSubflowParamBuggy"));
275:                suite.addTest(new ValidateProcDef("invalidJavaType"));
276:                suite.addTest(new ValidateProcDef("illegalJavaType"));
277:                suite.addTest(new ValidateProcDef("incompatibleJavaType1"));
278:                suite.addTest(new ValidateProcDef("incompatibleJavaType2"));
279:                return new EJBClientTest(plc, suite);
280:            }
281:
282:            private ProcessDefinitionDirectory pdd = null;
283:
284:            /**
285:             * Simple test to check the jndi settings 
286:             */
287:            private void connect() throws Exception {
288:                InitialContext ic = new InitialContext();
289:                assertTrue(ic != null);
290:                pdd = getProcessDefinitionDirectory();
291:            }
292:
293:            private ProcessDefinitionDirectory getProcessDefinitionDirectory()
294:                    throws Exception {
295:                ProcessDefinitionDirectory pdd = WorkflowServiceFactory
296:                        .newInstance().newWorkflowService()
297:                        .processDefinitionDirectory();
298:                return pdd;
299:            }
300:
301:            /**
302:             * validate the process definitions from a XPDL file doubleActivityId.xml
303:             * using the ProcessDefinitionDirectory bean.
304:             * @throws Exception if any eror ocurred.
305:             */
306:            public void doubleActivityId() throws Exception {
307:                validate("/procdef/doubleActivityId.xml",
308:                        "ImportMessages#procdef.activity.ununique");
309:            }
310:
311:            /**
312:             * validate the process definitions from a XPDL file doubleActivityId.xml
313:             * using the ProcessDefinitionDirectory bean.
314:             * @throws Exception if any eror ocurred.
315:             */
316:            public void doubleActivityIdOfActivitySet() throws Exception {
317:                validate("/procdef/doubleActivityIdOfActivitySet.xml",
318:                        "ImportMessages#procdef.activityset.activity.ununique");
319:            }
320:
321:            /**
322:             * validate the process definitions from a XPDL file 
323:             * doubleApplicationId.xml using the ProcessDefinitionDirectory bean.
324:             * @throws Exception if any eror ocurred.
325:             */
326:            public void doubleApplicationId() throws Exception {
327:                validate("/procdef/doubleApplicationId.xml",
328:                        "ImportMessages#procdef.application.ununique");
329:            }
330:
331:            /**
332:             * validate the process definitions from a XPDL file 
333:             * validApplicationId.xml using the ProcessDefinitionDirectory bean.
334:             * @throws Exception if any eror ocurred.
335:             */
336:            public void validApplicationId() throws Exception {
337:                validate("/procdef/validApplicationId.xml", null);
338:            }
339:
340:            /**
341:             * validate the process definitions from a XPDL file 
342:             * validApplicationId.xml using the ProcessDefinitionDirectory bean.
343:             * @throws Exception if any eror ocurred.
344:             */
345:            public void incompleteApplicationDef() throws Exception {
346:                validate("/procdef/incompleteApplicationDef.xml",
347:                        "ImportMessages#procdef.application.toolAgentClass");
348:            }
349:
350:            /**
351:             * validate the process definitions from a XPDL file 
352:             * doubleProcessId.xml using the ProcessDefinitionDirectory bean.
353:             * @throws Exception if any eror ocurred.
354:             */
355:            public void doubleProcessId() throws Exception {
356:                validate("/procdef/doubleProcessId.xml",
357:                        "ImportMessages#procdef.process.ununique");
358:            }
359:
360:            /**
361:             * validate the process definitions from a XPDL file 
362:             * doubleTransitionId.xml using the ProcessDefinitionDirectory bean.
363:             * @throws Exception if any eror ocurred.
364:             */
365:            public void doubleTransitionId() throws Exception {
366:                validate("/procdef/doubleTransitionId.xml",
367:                        "ImportMessages#procdef.transition.ununique");
368:            }
369:
370:            /**
371:             * validate the process definitions from a XPDL file 
372:             * doubleTransitionIdOfActivitySet.xml using the ProcessDefinitionDirectory
373:             * bean.
374:             * @throws Exception if any eror ocurred.
375:             */
376:            public void doubleTransitionIdOfActivitySet() throws Exception {
377:                validate("/procdef/doubleTransitionIdOfActivitySet.xml",
378:                        "ImportMessages#procdef.activityset.transition.ununique");
379:            }
380:
381:            /**
382:             * validate the process definitions from a XPDL file 
383:             * invalidRefActFromIdInTransition.xml using the 
384:             * ProcessDefinitionDirectory bean.
385:             * @throws Exception if any eror ocurred.
386:             */
387:            public void invalidRefActFromIdInTransition() throws Exception {
388:                validate("/procdef/invalidRefActFromIdInTransition.xml",
389:                        "ImportMessages#procdef.transition.activityid.notfound");
390:            }
391:
392:            /**
393:             * validate the process definitions from a XPDL file 
394:             * invalidRefActFromIdInTransitionOfActivitySet.xml using the 
395:             * ProcessDefinitionDirectory bean.
396:             * @throws Exception if any eror ocurred.
397:             */
398:            public void invalidRefActFromIdInTransitionOfActivitySet()
399:                    throws Exception {
400:                validate(
401:                        "/procdef/invalidRefActFromIdInTransitionOfActivitySet.xml",
402:                        "ImportMessages#procdef.activityset.transition.activityid.notfound");
403:            }
404:
405:            /**
406:             * validate the process definitions from a XPDL file 
407:             * invalidRefActToIdInTransition.xml using the 
408:             * ProcessDefinitionDirectory bean.
409:             * @throws Exception if any eror ocurred.
410:             */
411:            public void invalidRefActToIdInTransition() throws Exception {
412:                validate("/procdef/invalidRefActToIdInTransition.xml",
413:                        "ImportMessages#procdef.transition.activityid.notfound");
414:            }
415:
416:            /**
417:             * validate the process definitions from a XPDL file 
418:             * invalidRefActToIdInTransitionOfActivitySet.xml using the 
419:             * ProcessDefinitionDirectory bean.
420:             * @throws Exception if any eror ocurred.
421:             */
422:            public void invalidRefActToIdInTransitionOfActivitySet()
423:                    throws Exception {
424:                validate(
425:                        "/procdef/invalidRefActToIdInTransitionOfActivitySet.xml",
426:                        "ImportMessages#procdef.activityset.transition.activityid.notfound");
427:            }
428:
429:            /**
430:             * validate the process definitions from a XPDL file 
431:             * invalidRefToolIdInActivity.xml using the 
432:             * ProcessDefinitionDirectory bean.
433:             * @throws Exception if any eror ocurred.
434:             */
435:            public void invalidRefToolIdInActivity() throws Exception {
436:                validate("/procdef/invalidRefToolIdInActivity.xml",
437:                        "ImportMessages#procdef.tool.notfound");
438:            }
439:
440:            /**
441:             * validate the process definitions from a XPDL file 
442:             * invalidRefToolIdInActivitySet.xml using the 
443:             * ProcessDefinitionDirectory bean.
444:             * @throws Exception if any eror ocurred.
445:             */
446:            public void invalidRefToolIdInActivitySet() throws Exception {
447:                validate("/procdef/invalidRefToolIdInActivitySet.xml",
448:                        "ImportMessages#procdef.tool.notfound");
449:            }
450:
451:            /**
452:             * validate the process definitions from a XPDL file 
453:             * invalidActivitySetTransRefId.xml using the 
454:             * ProcessDefinitionDirectory bean.
455:             * @throws Exception if any eror ocurred.
456:             */
457:            public void invalidActivitySetTransRefId() throws Exception {
458:                validate("/procdef/invalidActivitySetTransRefId.xml",
459:                        "ImportMessages#procdef.transitionid.notfound");
460:            }
461:
462:            /**
463:             * Check if all the referenced BlockActivity are defined.
464:             * @throws Exception if any eror ocurred.
465:             */
466:            public void invalidBlockActivityId() throws Exception {
467:                validate("/procdef/invalidBlockActivityId.xml",
468:                        "ImportMessages#procdef.activity.activityset.invalid");
469:            }
470:
471:            /**
472:             * validate the process definitions from a XPDL file 
473:             * invalidActivitySetTransRefId.xml using the 
474:             * ProcessDefinitionDirectory bean.
475:             * @throws Exception if any eror ocurred.
476:             */
477:            public void invalidActivityTransRefId() throws Exception {
478:                validate("/procdef/invalidActivityTransRefId.xml",
479:                        "ImportMessages#procdef.transitionid.notfound");
480:            }
481:
482:            /**
483:             * validate the process definitions from a XPDL file 
484:             * invalidExtendedAttribute.xml using the ProcessDefinitionDirectory bean. 
485:             * The extended attribute should have a value as AUTOMATIC or MANUAL, 
486:             * otherwise error raised. 
487:             * @throws Exception if any eror ocurred.
488:             */
489:            public void invalidExtendedAttribute() throws Exception {
490:                validate("/procdef/invalidExtendedAttribute.xml",
491:                        "ImportMessages#procdef.extendedattr.value.notallowed");
492:            }
493:
494:            /**
495:             * Check if all TransitionRestrictions are valid.
496:             * @throws Exception if any eror ocurred.
497:             */
498:            public void invalidTransitionRestriction() throws Exception {
499:                validate("/procdef/invalidTransitionRestriction.xml",
500:                        "ImportMessages#procdef.activityset.split.transition.notcomplete");
501:            }
502:
503:            /**
504:             * Check if all defined Participant are valid.
505:             * @throws Exception if any eror ocurred.
506:             */
507:            public void participantNotFound() throws Exception {
508:                validate("/procdef/ParticipantNotFound.xml",
509:                        "ImportMessages#procdef.performer.notfound");
510:            }
511:
512:            /**
513:             * Check if any duplicate Participant are defined.
514:             * @throws Exception if any eror ocurred.
515:             */
516:            public void doubleParticipantId() throws Exception {
517:                validate("/procdef/doubleParticipantId.xml",
518:                        "ImportMessages#procdef.participant.ununique");
519:            }
520:
521:            /**
522:             * Check if ActualParameters and FormalParameters are matched.
523:             * @throws Exception if any eror ocurred.
524:             */
525:            public void notMatchedFormalAndActualParams() throws Exception {
526:                validate("/procdef/notMatchedFormalAndActualParams.xml",
527:                        "ImportMessages#procdef.toolimpl.params.notmatched");
528:
529:            }
530:
531:            /**
532:             * Check if all the defined ActualParameters have responding entries
533:             * in DataFields.
534:             * @throws Exception if any eror ocurred.
535:             */
536:            public void noProcDataForActualParam() throws Exception {
537:                validate("/procdef/noProcDataForActualParam.xml",
538:                        "ImportMessages#procdef.toolimpl.params.datanotfound");
539:
540:            }
541:
542:            /**
543:             * Check if the process definition includes an empty activity set.
544:             * @throws Exception if any eror ocurred.
545:             */
546:            public void emptyActivitySet() throws Exception {
547:                validate("/procdef/emptyActivitySet.xml",
548:                        "ImportMessages#procdef.process.activityset.empty");
549:            }
550:
551:            /**
552:             * Check if the process definition includes an invalid priority.
553:             * @throws Exception if any eror ocurred.
554:             */
555:            public void invalidPriority() throws Exception {
556:                validate("/procdef/invalidPriority.xml",
557:                        "ImportMessages#procdef.activity.priority.notallowed");
558:            }
559:
560:            /**
561:             * Check if all the formal OUT- or INOUT- parameters of the called subflow 
562:             * reference an existing actual parameter with an existing Datafield.
563:             */
564:            public void noMatchedDataFieldInCallingSubFlow() throws Exception {
565:                validate("/procdef/noMatchedDataFieldInCallingSubFlow.xml",
566:                        "ImportMessages#procdef.activity.subflow.datanotfound");
567:            }
568:
569:            /**
570:             * Check if all the formal OUT- or INOUT- parameters of the called subflow 
571:             * reference an existing actual parameter with an existing Datafield.
572:             */
573:            public void noMatchedActualParamTypeCallingSubFlow()
574:                    throws Exception {
575:                validate("/procdef/noMatchedActualParamTypeCallingSubFlow.xml",
576:                        "ImportMessages#procdef.activity.subflow.paramdatatype.notmatched");
577:            }
578:
579:            /**
580:             * Check if all the formal OUT- or INOUT- parameters of the called subflow 
581:             * reference an existing actual parameter.
582:             */
583:            public void noMatchedActualParamsInCallingSubFlow()
584:                    throws Exception {
585:                validate("/procdef/noMatchedActualParamsInCallingSubFlow.xml",
586:                        "ImportMessages#procdef.activity.subflow.params.notmatched");
587:            }
588:
589:            /**
590:             * Check if the defined script is supported.
591:             */
592:            public void illegalScriptType() throws Exception {
593:                validate("/procdef/illegalScriptType.xml",
594:                        "ImportMessages#package.script.type.unsupported");
595:            }
596:
597:            /**
598:             * Check if the defined script is supported.
599:             */
600:            public void illegalScriptVersion() throws Exception {
601:                validate("/procdef/illegalScriptVersion.xml",
602:                        "ImportMessages#package.script.version.unsupported");
603:            }
604:
605:            /**
606:             * Check if all the activities build a loop
607:             */
608:            public void loopActivities() throws Exception {
609:                validate("/procdef/loopActivities.xml",
610:                        "ImportMessages#procdef.transition.noentry");
611:            }
612:
613:            /**
614:             * Check if formal- and actualParameters match in calling SubFlow.
615:             */
616:            public void subFlowParamTypeMismatch() throws Exception {
617:                validate("/procdef/subFlowParamTypeMismatch.xml",
618:                        "ImportMessages#procdef.activity.subflow.paramdatatype.notmatched");
619:            }
620:
621:            /**
622:             * Check if formal- and actualParameters match in calling tools.
623:             */
624:            public void toolParamTypeMismatch() throws Exception {
625:                validate("/procdef/toolParamTypeMismatch.xml",
626:                        "ImportMessages#procdef.toolimpl.paramsdatatype.notmatched");
627:            }
628:
629:            /**
630:             * Check validity of actual parameters as XML string
631:             */
632:            public void XMLParamsOK() throws Exception {
633:                validate("/procdef/xmlParamsOK.xml", null);
634:            }
635:
636:            /**
637:             * Check validity of actual parameters as XML string
638:             */
639:            public void XMLToolParamBuggy() throws Exception {
640:                validate("/procdef/xmlToolParamBuggy.xml",
641:                        "ImportMessages#procdef.toolimpl.params.invalidXML");
642:            }
643:
644:            /**
645:             * Check validity of actual parameters as XML string
646:             */
647:            public void XMLSubflowParamBuggy() throws Exception {
648:                validate("/procdef/xmlSubflowParamBuggy.xml",
649:                        "ImportMessages#procdef.subflow.params.invalidXML");
650:            }
651:
652:            /**
653:             * Check validity of actual parameters as XML string
654:             */
655:            public void invalidJavaType() throws Exception {
656:                validate("/procdef/invalidJavaType.xml",
657:                        "ImportMessages#procdef.data.invalidJavaType");
658:            }
659:
660:            /**
661:             * Check validity of actual parameters as XML string
662:             */
663:            public void illegalJavaType() throws Exception {
664:                validate("/procdef/illegalJavaType.xml",
665:                        "ImportMessages#procdef.data.notSerializable");
666:            }
667:
668:            /**
669:             * Check validity of actual parameters as XML string
670:             */
671:            public void incompatibleJavaType1() throws Exception {
672:                validate("/procdef/incompatibleJavaType1.xml",
673:                        "ImportMessages#procdef.toolimpl.paramsdatatype.notmatched");
674:            }
675:
676:            /**
677:             * Check validity of actual parameters as XML string
678:             */
679:            public void incompatibleJavaType2() throws Exception {
680:                validate("/procdef/incompatibleJavaType2.xml",
681:                        "ImportMessages#procdef.toolimpl.paramsdatatype.notmatched");
682:            }
683:
684:            private void validate(String file, String errorMessage)
685:                    throws Exception {
686:                boolean gotException = false;
687:                // Create process definition directory bean
688:                if (pdd == null) {
689:                    pdd = getProcessDefinitionDirectory();
690:                }
691:
692:                InputStream is = getClass().getResourceAsStream(file);
693:                assertTrue(is != null);
694:                BufferedReader br = new BufferedReader(new InputStreamReader(
695:                        is, "ISO-8859-1"));
696:                StringBuffer sb = new StringBuffer();
697:                String st;
698:                while ((st = br.readLine()) != null) {
699:                    sb.append(st + "\n");
700:                }
701:                List pms = null;
702:                try {
703:                    pms = pdd.importProcessDefinitions(sb.toString());
704:                    if (pms.size() == 0 && errorMessage != null) {
705:                        fail("Failed to identify the errors in imported xpdl files");
706:                    }
707:                } catch (ImportException pe) {
708:                    pms = pe.messages();
709:                }
710:                List unmappedPms = new ArrayList();
711:                StringBuffer mb = new StringBuffer();
712:                for (Iterator i = pms.iterator(); i.hasNext();) {
713:                    PrioritizedMessage pm = (PrioritizedMessage) i.next();
714:                    unmappedPms.add(pm.unmappedMessage());
715:                    mb.append(" " + pm.unmappedMessage());
716:                }
717:                if (errorMessage != null) {
718:                    assertTrue("Expected " + errorMessage + ", got"
719:                            + mb.toString(), unmappedPms.contains(errorMessage));
720:                }
721:            }
722:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.