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


001:        /*
002:         * Danet GmbH
003:         * Beratung und Software-Entwicklung
004:         * Geschäftstelle AN
005:         *
006:         * $Id: Engine.java,v 1.5 2006/10/13 13:58:32 drmlipp Exp $
007:         *
008:         * $Log: Engine.java,v $
009:         * Revision 1.5  2006/10/13 13:58:32  drmlipp
010:         * Adapted to new environment.
011:         *
012:         * Revision 1.4  2006/10/07 20:41:34  mlipp
013:         * Merged J2EE 1.4 adaptions from test branch.
014:         *
015:         * Revision 1.3  2005/08/18 14:49:12  drmlipp
016:         * Removed staffmgmt dependend test cases.
017:         *
018:         * Revision 1.2  2004/12/30 12:10:23  mlipp
019:         * Adadpted to JNDI name changes.
020:         *
021:         * Revision 1.1.1.3  2004/08/18 15:18:47  drmlipp
022:         * Update to 1.2
023:         *
024:         * Revision 1.25  2004/02/21 21:31:01  lipp
025:         * Some more refactoring to resolve cyclic dependencies.
026:         *
027:         * Revision 1.24  2003/11/19 14:04:31  lipp
028:         * Proper authentication handling.
029:         *
030:         * Revision 1.23  2003/10/21 21:00:45  lipp
031:         * Moved EJBClientTest to new junit sub-package.
032:         *
033:         * Revision 1.22  2003/10/08 11:52:55  huaiyang
034:         * make test weblogic compatible.
035:         *
036:         * Revision 1.21  2003/05/23 15:42:41  lipp
037:         * Fixed deployment unit dependencies.
038:         *
039:         * Revision 1.20  2003/05/02 14:55:58  lipp
040:         * Resolved some more package dependencies.
041:         *
042:         * Revision 1.19  2003/04/26 16:46:55  lipp
043:         * Made unittests and systemtests coexist in eclipse.
044:         *
045:         * Revision 1.18  2003/04/16 19:25:04  lipp
046:         * Adapted to jdk 1.4
047:         *
048:         * Revision 1.17  2003/02/25 17:08:27  lipp
049:         * Reorganized requester implementation.
050:         *
051:         * Revision 1.16  2003/01/13 20:29:42  lipp
052:         * Classpath fixes.
053:         *
054:         * Revision 1.15  2002/12/19 21:37:42  lipp
055:         * Reorganized interfaces.
056:         *
057:         * Revision 1.14  2002/10/23 11:36:47  lipp
058:         * Got them running again.
059:         *
060:         * Revision 1.13  2002/09/18 21:26:51  lipp
061:         * Removed SAXFacade (integrated with WorkflowEngine).
062:         *
063:         * Revision 1.12  2002/09/18 20:48:21  lipp
064:         * Cleanly separated workflow engine and service.
065:         *
066:         * Revision 1.11  2002/09/18 13:00:26  lipp
067:         * Renamed WorkflowEngine to WorkflowService and introduced
068:         * WorkflowServiceFactory.
069:         *
070:         * Revision 1.10  2002/09/08 18:49:18  lipp
071:         * Proper use of packageId and processId.
072:         *
073:         * Revision 1.9  2002/09/04 20:50:44  lipp
074:         * Adapted to new process manager name schema.
075:         *
076:         * Revision 1.8  2002/08/30 21:32:07  lipp
077:         * Finished transition to WorkflowEngine.
078:         *
079:         * Revision 1.7  2002/08/30 13:37:05  lipp
080:         * Using Workflow engine facade now.
081:         *
082:         * Revision 1.6  2002/08/26 20:23:14  lipp
083:         * Lots of method renames.
084:         *
085:         * Revision 1.5  2002/08/21 22:06:48  lipp
086:         * Finished transition to ProcessMgrStub.
087:         *
088:         * Revision 1.4  2002/08/04 11:39:04  lipp
089:         * Fixed test case.
090:         *
091:         * Revision 1.3  2002/02/03 21:41:42  lipp
092:         * Cleaned up unittests.
093:         *
094:         * Revision 1.2  2002/01/24 14:59:50  huaiyang
095:         * Add test method for autoAssignResources.
096:         *
097:         * Revision 1.1  2002/01/23 14:09:57  huaiyang
098:         * Adapted to API changed and new test case.
099:         *
100:         */
101:        package ras;
102:
103:        import java.util.Collection;
104:        import java.util.Iterator;
105:
106:        import javax.naming.InitialContext;
107:        import javax.rmi.PortableRemoteObject;
108:        import javax.security.auth.login.LoginException;
109:
110:        import de.danet.an.util.EJBUtil;
111:        import de.danet.an.util.junit.EJBClientTest;
112:
113:        import de.danet.an.workflow.omgcore.WfActivity;
114:        import de.danet.an.workflow.omgcore.WfAssignment;
115:        import de.danet.an.workflow.omgcore.WfProcess;
116:        import de.danet.an.workflow.omgcore.WfProcessMgr;
117:        import de.danet.an.workflow.omgcore.WfResource;
118:
119:        import de.danet.an.workflow.api.DefaultRequester;
120:        import de.danet.an.workflow.api.FactoryConfigurationError;
121:        import de.danet.an.workflow.api.ProcessDefinitionDirectory;
122:        import de.danet.an.workflow.api.WorkflowService;
123:        import de.danet.an.workflow.api.WorkflowServiceFactory;
124:
125:        import de.danet.an.workflow.ejbs.WorkflowEngine;
126:        import de.danet.an.workflow.ejbs.WorkflowEngineHome;
127:        import de.danet.an.workflow.spis.ras.ResourceAssignmentService;
128:
129:        import common.UTLoginContext;
130:        import junit.framework.*;
131:
132:        public class Engine extends TestCase {
133:
134:            private static UTLoginContext plc = null;
135:            static {
136:                try {
137:                    plc = new UTLoginContext();
138:                    plc.login();
139:                } catch (LoginException e) {
140:                    throw new IllegalStateException(e.getMessage());
141:                }
142:            }
143:
144:            /**
145:             * Konstruktor zum Erzeugen eines TestCase
146:             */
147:            public Engine(String name) {
148:                super (name);
149:            }
150:
151:            /**
152:             * Stellt diese TestSuite zusammen.
153:             */
154:            public static Test suite() {
155:                TestSuite suite = new TestSuite();
156:                suite.addTest(new Engine("runProcess"));
157:                // 	suite.addTest(new Engine("autoAssignResources"));
158:                return new EJBClientTest(plc, suite);
159:            }
160:
161:            private static ResourceAssignmentService ras = null;
162:
163:            private static WorkflowService wfsCache = null;
164:
165:            private WorkflowService workflowService() {
166:                if (wfsCache == null) {
167:                    try {
168:                        WorkflowServiceFactory wfsf = WorkflowServiceFactory
169:                                .newInstance();
170:                        wfsCache = wfsf.newWorkflowService();
171:                    } catch (FactoryConfigurationError e) {
172:                        throw new IllegalStateException(e.getMessage());
173:                    }
174:                }
175:                return wfsCache;
176:            }
177:
178:            /**
179:             * Initialisierung.
180:             */
181:            protected void setUp() throws Exception {
182:            }
183:
184:            private static WfProcess testProc = null;
185:
186:            /**
187:             * Run the process
188:             */
189:            public void runProcess() throws Exception {
190:                // start process
191:                testProc = createProcess("ut-ras", "ras_test");
192:                assertTrue(testProc != null);
193:                assertTrue(testProc.state().equals(
194:                        "open.not_running.not_started"));
195:                testProc.start();
196:                assertTrue(testProc.state().startsWith("open.running"));
197:                Thread.sleep(1000);
198:            }
199:
200:            //     /**
201:            //      * Check autoAssignResources
202:            //      */
203:            //     public void autoAssignResources() throws Exception {
204:            // 	if (testProc == null)
205:            // 	    runProcess();
206:
207:            // 	String[][] names = {{"M1", "Test, JUnit"},
208:            // 			    {"M2", "Lipp, Michael"},
209:            // 			    {"G?", "Auftragsbearbeitung"}};
210:            // 	InitialContext ic = new InitialContext();
211:            // 	Object objref = ic.lookup("de.danet.an.workflow.StaffDirectory");
212:            // 	StaffDirectoryHome home 
213:            // 	    = (StaffDirectoryHome)PortableRemoteObject.narrow
214:            // 	    (objref, StaffDirectoryHome.class);
215:            // 	StaffDirectory sd = home.create();
216:            // 	StaffGroup sg = sd.findStaffGroupByName (names[2][1]);
217:            // 	names[2][0] = "G" + sg.key();
218:
219:            // 	Collection allActs = testProc.steps();
220:            // 	for (int i = 0; i < 3; i++) {
221:            // 	    assertTrue(assignmentExists(names[i][0], names[i][1]));
222:            // 	}
223:            //     }
224:
225:            /**
226:             * Check if the resource identified by its key is assigned to the 
227:             * activity whose container is the created test process. 
228:             */
229:            private boolean assignmentExists(String key, String name)
230:                    throws Exception {
231:                boolean found = false;
232:                WfResource resource = ras.resourceByKey(key);
233:                Collection assignedActivities = ras.workItems(resource);
234:                for (Iterator i = assignedActivities.iterator(); i.hasNext();) {
235:                    WfAssignment assignment = (WfAssignment) i.next();
236:                    WfActivity act = assignment.activity();
237:                    if (testProc.key().equals(act.container().key())) {
238:                        found = true;
239:                        assertTrue(assignment.assignee().resourceName().equals(
240:                                name));
241:                        break;
242:                    }
243:                }
244:                return found;
245:            }
246:
247:            /**
248:             * Try to create the process identified by the id
249:             */
250:            public WfProcess createProcess(String pkgId, String prcId)
251:                    throws Exception {
252:                ProcessDefinitionDirectory pdd = null;
253:                try {
254:                    pdd = workflowService().processDefinitionDirectory();
255:                    WfProcessMgr pmgr = pdd.processMgr(pkgId, prcId);
256:                    return pmgr.createProcess(new DefaultRequester(
257:                            workflowService()));
258:                } finally {
259:                    workflowService().release(pdd);
260:                }
261:            }
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.