Source Code Cross Referenced for SequentialRoutingTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » engine » 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 » ERP CRM Financial » Kuali Financial System » edu.iu.uis.eden.engine 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 The Kuali Foundation.
003:         * 
004:         * 
005:         * Licensed under the Educational Community License, Version 1.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         * 
009:         * http://www.opensource.org/licenses/ecl1.php
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package edu.iu.uis.eden.engine;
018:
019:        import java.util.List;
020:
021:        import org.junit.Test;
022:        import org.kuali.workflow.test.WorkflowTestCase;
023:
024:        import edu.iu.uis.eden.EdenConstants;
025:        import edu.iu.uis.eden.KEWServiceLocator;
026:        import edu.iu.uis.eden.clientapp.WorkflowDocument;
027:        import edu.iu.uis.eden.clientapp.vo.ActionRequestVO;
028:        import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
029:        import edu.iu.uis.eden.engine.node.RouteNodeInstance;
030:        import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
031:
032:        public class SequentialRoutingTest extends WorkflowTestCase {
033:
034:            private static final String DOCUMENT_TYPE_NAME = "SeqDocType";
035:            private static final String ADHOC_NODE = "AdHoc";
036:            private static final String WORKFLOW_DOCUMENT_NODE = "WorkflowDocument";
037:            private static final String ACKNOWLEDGE_1_NODE = "Acknowledge1";
038:            private static final String ACKNOWLEDGE_2_NODE = "Acknowledge2";
039:
040:            protected void loadTestData() throws Exception {
041:                loadXmlFile("EngineConfig.xml");
042:            }
043:
044:            @Test
045:            public void testSequentialRoute() throws Exception {
046:                WorkflowDocument document = new WorkflowDocument(
047:                        new NetworkIdVO("ewestfal"), DOCUMENT_TYPE_NAME);
048:                document.saveRoutingData();
049:                assertNotNull(document.getRouteHeaderId());
050:                assertTrue("Document should be initiatied", document
051:                        .stateIsInitiated());
052:                assertEquals("Invalid route level.", new Integer(0), document
053:                        .getRouteHeader().getDocRouteLevel());
054:                String[] nodeNames = document.getNodeNames();
055:                assertEquals("Wrong number of node names.", 1, nodeNames.length);
056:                assertEquals("Wrong node name.", ADHOC_NODE, nodeNames[0]);
057:                document.routeDocument("Routing sequentially.");
058:
059:                // should have generated a request to "bmcgough"
060:                document = new WorkflowDocument(new NetworkIdVO("bmcgough"),
061:                        document.getRouteHeaderId());
062:                assertTrue("Document should be enroute", document
063:                        .stateIsEnroute());
064:                assertEquals("Invalid route level.", new Integer(1), document
065:                        .getRouteHeader().getDocRouteLevel());
066:                nodeNames = document.getNodeNames();
067:                assertEquals("Wrong number of node names.", 1, nodeNames.length);
068:                assertEquals("Wrong node name.", WORKFLOW_DOCUMENT_NODE,
069:                        nodeNames[0]);
070:                ActionRequestVO[] requests = document.getActionRequests();
071:                assertEquals(1, requests.length);
072:                ActionRequestVO request = requests[0];
073:                assertEquals("bmcgough", request.getUserVO().getNetworkId());
074:                assertEquals(EdenConstants.ACTION_REQUEST_APPROVE_REQ, request
075:                        .getActionRequested());
076:                assertEquals(new Integer(1), request.getRouteLevel());
077:                assertTrue(document.isApprovalRequested());
078:                document.approve("Test approve by bmcgough");
079:
080:                document = new WorkflowDocument(new NetworkIdVO("temay"),
081:                        document.getRouteHeaderId());
082:                assertTrue("Document should be processed.", document
083:                        .stateIsProcessed());
084:                requests = document.getActionRequests();
085:                assertEquals(3, requests.length);
086:                boolean toTemay = false;
087:                boolean toJhopf = false;
088:                for (int i = 0; i < requests.length; i++) {
089:                    ActionRequestVO requestVO = requests[i];
090:                    if (requestVO.getUserVO().getNetworkId().equals("temay")) {
091:                        toTemay = true;
092:                        assertEquals(
093:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ,
094:                                requestVO.getActionRequested());
095:                        assertEquals(new Integer(2), requestVO.getRouteLevel());
096:                        assertEquals(EdenConstants.ACTION_REQUEST_ACTIVATED,
097:                                requestVO.getStatus());
098:                    } else if (requestVO.getUserVO().getNetworkId().equals(
099:                            "jhopf")) {
100:                        toJhopf = true;
101:                        assertEquals(
102:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ,
103:                                requestVO.getActionRequested());
104:                        assertEquals(new Integer(3), requestVO.getRouteLevel());
105:                        assertEquals(EdenConstants.ACTION_REQUEST_ACTIVATED,
106:                                requestVO.getStatus());
107:                    }
108:                }
109:                assertTrue("Should be an acknowledge to temay", toTemay);
110:                assertTrue("Should be an acknowledge to jhopf", toJhopf);
111:                //        assertEquals(ACKNOWLEDGE_2_NODE, document.getRouteHeader().getNodeNames()[0]);
112:                // have temay take her acknowledge
113:                document.acknowledge("Temay taking acknowledge");
114:
115:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
116:                        document.getRouteHeaderId());
117:                assertTrue("Document should be processed.", document
118:                        .stateIsProcessed());
119:                requests = document.getActionRequests();
120:                toTemay = false;
121:                toJhopf = false;
122:                for (int i = 0; i < requests.length; i++) {
123:                    ActionRequestVO requestVO = requests[i];
124:                    if (requestVO.getUserVO().getNetworkId().equals("temay")) {
125:                        toTemay = true;
126:                        assertEquals(
127:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ,
128:                                requestVO.getActionRequested());
129:                        assertEquals(EdenConstants.ACTION_REQUEST_DONE_STATE,
130:                                requestVO.getStatus());
131:                    } else if (requestVO.getUserVO().getNetworkId().equals(
132:                            "jhopf")) {
133:                        toJhopf = true;
134:                        assertEquals(
135:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ,
136:                                requestVO.getActionRequested());
137:                        assertEquals(new Integer(3), requestVO.getRouteLevel());
138:                        assertEquals(EdenConstants.ACTION_REQUEST_ACTIVATED,
139:                                requestVO.getStatus());
140:                    }
141:                }
142:                assertTrue("Should be a DONE acknowledge to temay", toTemay);
143:                assertTrue("Should be an acknowledge to jhopf", toJhopf);
144:                // have jhopf take his acknowledge, this should cause the document to go final
145:                document.acknowledge("Jhopf taking acknowledge");
146:
147:                // TODO when we are able to, we should also verify the RouteNodeInstances are correct
148:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
149:                        document.getRouteHeaderId());
150:                assertTrue("Document should be final.", document.stateIsFinal());
151:
152:                verifyRoutingPath(document.getRouteHeaderId());
153:            }
154:
155:            private void verifyRoutingPath(Long documentId) {
156:                DocumentRouteHeaderValue document = KEWServiceLocator
157:                        .getRouteHeaderService().getRouteHeader(documentId);
158:                List initial = document.getInitialRouteNodeInstances();
159:                assertEquals(1, initial.size());
160:                RouteNodeInstance adhoc = (RouteNodeInstance) initial.get(0);
161:                assertEquals(ADHOC_NODE, adhoc.getRouteNode()
162:                        .getRouteNodeName());
163:                assertEquals(0, adhoc.getPreviousNodeInstances().size());
164:
165:                List next = adhoc.getNextNodeInstances();
166:                assertEquals(1, next.size());
167:                RouteNodeInstance wd = (RouteNodeInstance) next.get(0);
168:                assertEquals(WORKFLOW_DOCUMENT_NODE, wd.getRouteNode()
169:                        .getRouteNodeName());
170:                assertEquals(1, wd.getPreviousNodeInstances().size());
171:
172:                next = wd.getNextNodeInstances();
173:                assertEquals(1, next.size());
174:                RouteNodeInstance ack1 = (RouteNodeInstance) next.get(0);
175:                assertEquals(ACKNOWLEDGE_1_NODE, ack1.getRouteNode()
176:                        .getRouteNodeName());
177:                assertEquals(1, ack1.getPreviousNodeInstances().size());
178:
179:                next = ack1.getNextNodeInstances();
180:                assertEquals(1, next.size());
181:                RouteNodeInstance ack2 = (RouteNodeInstance) next.get(0);
182:                assertEquals(ACKNOWLEDGE_2_NODE, ack2.getRouteNode()
183:                        .getRouteNodeName());
184:                assertEquals(1, ack2.getPreviousNodeInstances().size());
185:
186:                next = ack2.getNextNodeInstances();
187:                assertEquals(0, next.size());
188:            }
189:
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.