Source Code Cross Referenced for RoutingReportServiceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » routemodule » 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.routemodule 
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.routemodule;
018:
019:        import java.util.Collection;
020:        import java.util.List;
021:
022:        import org.junit.Test;
023:        import org.kuali.workflow.test.WorkflowTestCase;
024:
025:        import edu.iu.uis.eden.EdenConstants;
026:        import edu.iu.uis.eden.KEWServiceLocator;
027:        import edu.iu.uis.eden.clientapp.WorkflowDocument;
028:        import edu.iu.uis.eden.clientapp.WorkflowInfo;
029:        import edu.iu.uis.eden.clientapp.vo.ActionRequestVO;
030:        import edu.iu.uis.eden.clientapp.vo.DocumentDetailVO;
031:        import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
032:        import edu.iu.uis.eden.clientapp.vo.ReportCriteriaVO;
033:        import edu.iu.uis.eden.engine.node.RouteNodeInstance;
034:
035:        public class RoutingReportServiceTest extends WorkflowTestCase {
036:
037:            protected void loadTestData() throws Exception {
038:                loadXmlFile("RouteModuleConfig.xml");
039:            }
040:
041:            /**
042:             * Tests the report() method against a sequential document type.
043:             */
044:            @Test
045:            public void testReportSequential() throws Exception {
046:
047:                // route a document to the first node
048:                WorkflowDocument document = new WorkflowDocument(
049:                        new NetworkIdVO("ewestfal"),
050:                        SeqSetup.DOCUMENT_TYPE_NAME);
051:                document.routeDocument("");
052:
053:                // there should now be 1 active node and 2 pending requests on the document
054:                Collection activeNodeInstances = KEWServiceLocator
055:                        .getRouteNodeService().getActiveNodeInstances(
056:                                document.getRouteHeaderId());
057:                List requests = KEWServiceLocator.getActionRequestService()
058:                        .findAllActionRequestsByRouteHeaderId(
059:                                document.getRouteHeaderId());
060:                assertEquals("Should be one active node.", 1,
061:                        activeNodeInstances.size());
062:                Long activeNodeId = ((RouteNodeInstance) activeNodeInstances
063:                        .iterator().next()).getRouteNodeInstanceId();
064:                assertEquals("Should be 2 pending requests.", 2, requests
065:                        .size());
066:
067:                // now, lets "get our report on", the WorkflowInfo.routingReport method will call the service's report method.
068:                WorkflowInfo info = new WorkflowInfo();
069:                ReportCriteriaVO criteria = new ReportCriteriaVO(document
070:                        .getRouteHeaderId());
071:
072:                long start = System.currentTimeMillis();
073:                DocumentDetailVO documentDetail = info.routingReport(criteria);
074:                long end = System.currentTimeMillis();
075:                System.out.println("Time to run routing report: "
076:                        + (end - start) + " milliseconds.");
077:
078:                // document detail should have all of our requests on it, 2 activated approves, 1 initialized approve, 2 initialized acknowledges
079:                assertEquals("There should be 5 requests.", 5, documentDetail
080:                        .getActionRequests().length);
081:                boolean approveToBmcgough = false;
082:                boolean approveToRkirkend = false;
083:                boolean approveToPmckown = false;
084:                boolean ackToTemay = false;
085:                boolean ackToJhopf = false;
086:                for (int index = 0; index < documentDetail.getActionRequests().length; index++) {
087:                    ActionRequestVO requestVO = documentDetail
088:                            .getActionRequests()[index];
089:                    String netId = requestVO.getUserVO().getNetworkId();
090:                    if (netId.equals("bmcgough")) {
091:                        assertEquals("Should be approve.",
092:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ,
093:                                requestVO.getActionRequested());
094:                        assertEquals("Should be activated.",
095:                                EdenConstants.ACTION_REQUEST_ACTIVATED,
096:                                requestVO.getStatus());
097:                        assertEquals("Wrong node name",
098:                                SeqSetup.WORKFLOW_DOCUMENT_NODE, requestVO
099:                                        .getNodeName());
100:                        approveToBmcgough = true;
101:                    } else if (netId.equals("rkirkend")) {
102:                        assertEquals("Should be approve.",
103:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ,
104:                                requestVO.getActionRequested());
105:                        assertEquals("Should be activated.",
106:                                EdenConstants.ACTION_REQUEST_ACTIVATED,
107:                                requestVO.getStatus());
108:                        assertEquals("Wrong node name",
109:                                SeqSetup.WORKFLOW_DOCUMENT_NODE, requestVO
110:                                        .getNodeName());
111:                        approveToRkirkend = true;
112:                    } else if (netId.equals("pmckown")) {
113:                        assertEquals("Should be approve.",
114:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ,
115:                                requestVO.getActionRequested());
116:                        assertEquals("Should be initialized.",
117:                                EdenConstants.ACTION_REQUEST_INITIALIZED,
118:                                requestVO.getStatus());
119:                        assertEquals("Wrong node name",
120:                                SeqSetup.WORKFLOW_DOCUMENT_2_NODE, requestVO
121:                                        .getNodeName());
122:                        approveToPmckown = true;
123:                    } else if (netId.equals("temay")) {
124:                        assertEquals("Should be acknowledge.",
125:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ,
126:                                requestVO.getActionRequested());
127:                        assertEquals("Should be initialized.",
128:                                EdenConstants.ACTION_REQUEST_INITIALIZED,
129:                                requestVO.getStatus());
130:                        assertEquals("Wrong node name",
131:                                SeqSetup.ACKNOWLEDGE_1_NODE, requestVO
132:                                        .getNodeName());
133:                        ackToTemay = true;
134:                    } else if (netId.equals("jhopf")) {
135:                        assertEquals("Should be acknowledge.",
136:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ,
137:                                requestVO.getActionRequested());
138:                        assertEquals("Should be initialized.",
139:                                EdenConstants.ACTION_REQUEST_INITIALIZED,
140:                                requestVO.getStatus());
141:                        assertEquals("Wrong node name",
142:                                SeqSetup.ACKNOWLEDGE_2_NODE, requestVO
143:                                        .getNodeName());
144:                        ackToJhopf = true;
145:                    }
146:                    assertNotNull(requestVO.getNodeInstanceId());
147:                }
148:                assertTrue("There should be an approve to bmcgough",
149:                        approveToBmcgough);
150:                assertTrue("There should be an approve to rkirkend",
151:                        approveToRkirkend);
152:                assertTrue("There should be an approve to pmckown",
153:                        approveToPmckown);
154:                assertTrue("There should be an ack to temay", ackToTemay);
155:                assertTrue("There should be an ack to jhopf", ackToJhopf);
156:
157:                // assert that the report call didn't save any of the nodes or requests
158:                activeNodeInstances = KEWServiceLocator.getRouteNodeService()
159:                        .getActiveNodeInstances(document.getRouteHeaderId());
160:                requests = KEWServiceLocator.getActionRequestService()
161:                        .findAllActionRequestsByRouteHeaderId(
162:                                document.getRouteHeaderId());
163:                assertEquals("Should be one active node.", 1,
164:                        activeNodeInstances.size());
165:                assertEquals("Should be at the same node.", activeNodeId,
166:                        ((RouteNodeInstance) activeNodeInstances.iterator()
167:                                .next()).getRouteNodeInstanceId());
168:                assertEquals("Should be 2 pending requests.", 2, requests
169:                        .size());
170:
171:                // test reporting to a specified target node
172:                criteria = new ReportCriteriaVO(document.getRouteHeaderId(),
173:                        SeqSetup.ACKNOWLEDGE_1_NODE);
174:                documentDetail = info.routingReport(criteria);
175:
176:                // document detail should have all of our requests except for the final acknowledge
177:                assertEquals("There should be 4 requets.", 4, documentDetail
178:                        .getActionRequests().length);
179:                // assert that we don't have an acknowledge to jhopf
180:                for (int index = 0; index < documentDetail.getActionRequests().length; index++) {
181:                    ActionRequestVO requestVO = documentDetail
182:                            .getActionRequests()[index];
183:                    if (requestVO.getUserVO().getNetworkId().equals("jhopf")) {
184:                        fail("There should be no request to jhopf");
185:                    }
186:                }
187:            }
188:
189:            private static class SeqSetup {
190:                public static final String DOCUMENT_TYPE_NAME = "SeqDocType";
191:                public static final String ADHOC_NODE = "AdHoc";
192:                public static final String WORKFLOW_DOCUMENT_NODE = "WorkflowDocument";
193:                public static final String WORKFLOW_DOCUMENT_2_NODE = "WorkflowDocument2";
194:                public static final String ACKNOWLEDGE_1_NODE = "Acknowledge1";
195:                public static final String ACKNOWLEDGE_2_NODE = "Acknowledge2";
196:            }
197:
198:            private static class DynSetup {
199:                public static final String DOCUMENT_TYPE_NAME = "DynChartOrgDocType";
200:                public static final String INITIAL_NODE = "Initial";
201:                public static final String CHART_ORG_NODE = "ChartOrg";
202:                public static final String SPLIT_NODE_NAME = "Organization Split";
203:                public static final String JOIN_NODE_NAME = "Organization Join";
204:                public static final String REQUEST_NODE_NAME = "Organization Request";
205:            }
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.