Source Code Cross Referenced for ActionRequestScenariosTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » actionrequests » 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.actionrequests 
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.actionrequests;
018:
019:        import java.util.Iterator;
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.vo.NetworkIdVO;
029:        import edu.iu.uis.eden.test.TestUtilities;
030:
031:        /**
032:         * This test exercises various Action Request graph scenarios and tests them for correctness.
033:         * 
034:         * @author Eric Westfall
035:         */
036:        public class ActionRequestScenariosTest extends WorkflowTestCase {
037:
038:            protected void loadTestData() throws Exception {
039:                loadXmlFile("ActionRequestsConfig.xml");
040:            }
041:
042:            /**
043:             * Test that ignore previous works properly in the face of delegations.
044:             * Tests the resolution of KULWF-642.
045:             * 
046:             * @throws Exception
047:             */
048:            @Test
049:            public void testIgnorePreviousWithDelegation() throws Exception {
050:                // at first, we'll route the document so that the bug is not exposed and verify the action request graph
051:                WorkflowDocument document = new WorkflowDocument(
052:                        new NetworkIdVO("user1"),
053:                        "testIgnorePreviousWithDelegation");
054:                document.routeDocument("");
055:                TestUtilities.assertAtNode(document, "Node1");
056:                List rootRequests = KEWServiceLocator.getActionRequestService()
057:                        .findPendingRootRequestsByDocId(
058:                                document.getRouteHeaderId());
059:                assertEquals("Should be 1 root request.", 1, rootRequests
060:                        .size());
061:                ActionRequestValue ewestfalRequest = (ActionRequestValue) rootRequests
062:                        .get(0);
063:                assertTrue(
064:                        "Request to ewestfal should be ignore previous of true",
065:                        ewestfalRequest.getIgnorePrevAction().booleanValue());
066:                assertEquals("Should have 1 child request.", 1, ewestfalRequest
067:                        .getChildrenRequests().size());
068:                ActionRequestValue rkirkendRequest = (ActionRequestValue) ewestfalRequest
069:                        .getChildrenRequests().get(0);
070:                assertFalse(
071:                        "Request to rkirkend should be ignore previous of false",
072:                        rkirkendRequest.getIgnorePrevAction().booleanValue());
073:
074:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
075:                        "testIgnorePreviousWithDelegation");
076:
077:                // After we route the document it should be at the first node in the document where "ewestfal"
078:                // is the primary approver with ignore previous = true and "rkirkend" is the primary
079:                // delegate with ignore previous = false.  In the KULWF-642 bug, the document would have
080:                // progressed past the first node in an auto-approve scenario even though ewestfal's rule
081:                // is ignore previous = true;
082:                document.routeDocument("");
083:
084:                // we should be at the first node in the document
085:                TestUtilities.assertAtNode(document, "Node1");
086:
087:                document.approve("");
088:                assertTrue("Document should be FINAL", document.stateIsFinal());
089:
090:            }
091:
092:            /**
093:             * Test that Role to Role Delegation works properly.
094:             * Implemented to expose the bug and test the fix for KULWF-655. 
095:             */
096:            @Test
097:            public void testRoleToRoleDelegation() throws Exception {
098:                WorkflowDocument document = new WorkflowDocument(
099:                        new NetworkIdVO("user1"), "testRoleToRoleDelegation");
100:                document.routeDocument("");
101:
102:                // after routing the document we should have an approve request to ewestfal, this request should have
103:                // one primary delegate and three secondary delegates
104:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
105:                        document.getRouteHeaderId());
106:                assertTrue("ewestfal should have an approve request.", document
107:                        .isApprovalRequested());
108:                // now check all of ewestfal's delegates
109:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
110:                        document.getRouteHeaderId());
111:                assertTrue("Should have an approve request.", document
112:                        .isApprovalRequested());
113:                document = new WorkflowDocument(new NetworkIdVO("xqi"),
114:                        document.getRouteHeaderId());
115:                assertTrue("Should have an approve request.", document
116:                        .isApprovalRequested());
117:                document = new WorkflowDocument(new NetworkIdVO("jitrue"),
118:                        document.getRouteHeaderId());
119:                assertTrue("Should have an approve request.", document
120:                        .isApprovalRequested());
121:
122:                // now approve as the primary delegator, this is where we were seeing the problem in KULWF-655, the
123:                // action request graph was not getting properly deactivated and it was not getting associated with the
124:                // "ActionTaken" properly
125:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
126:                        document.getRouteHeaderId());
127:                document.approve("Approving as primary delegate.");
128:
129:                // after the primary delegate approves, verify that the entire action request graph was
130:                // deactivated in grand fashion
131:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
132:                        document.getRouteHeaderId());
133:                assertFalse(
134:                        "the primary approver should no longer have an approve request.",
135:                        document.isApprovalRequested());
136:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
137:                        document.getRouteHeaderId());
138:                assertFalse("Should not have an approve request.", document
139:                        .isApprovalRequested());
140:                document = new WorkflowDocument(new NetworkIdVO("xqi"),
141:                        document.getRouteHeaderId());
142:                assertFalse("Should not have an approve request.", document
143:                        .isApprovalRequested());
144:                document = new WorkflowDocument(new NetworkIdVO("jitrue"),
145:                        document.getRouteHeaderId());
146:                assertFalse("Should not have an approve request.", document
147:                        .isApprovalRequested());
148:
149:                List actionRequests = KEWServiceLocator
150:                        .getActionRequestService()
151:                        .findAllActionRequestsByRouteHeaderId(
152:                                document.getRouteHeaderId());
153:                assertEquals("Wrong number of action requests.", 7,
154:                        actionRequests.size());
155:                for (Iterator iterator = actionRequests.iterator(); iterator
156:                        .hasNext();) {
157:                    ActionRequestValue request = (ActionRequestValue) iterator
158:                            .next();
159:                    assertTrue("Request should be deactivated.", request
160:                            .isDeactivated());
161:                    if (request.isRoleRequest()) {
162:                        assertEquals("Should be all approve request",
163:                                EdenConstants.APPROVE_POLICY_ALL_APPROVE,
164:                                request.getApprovePolicy());
165:                    } else {
166:                        assertEquals(
167:                                "Should not have first approve policy set",
168:                                EdenConstants.APPROVE_POLICY_FIRST_APPROVE,
169:                                request.getApprovePolicy());
170:                    }
171:                }
172:
173:            }
174:
175:            //testMixedbagRoleToRoleDelegation
176:
177:            @Test
178:            public void testRoleToRoleMixedApprovePoliciesDelegation()
179:                    throws Exception {
180:                WorkflowDocument document = new WorkflowDocument(
181:                        new NetworkIdVO("user1"),
182:                        "testMixedbagRoleToRoleDelegation");
183:                document.routeDocument("");
184:
185:                // after routing the document we should have an approve request to ewestfal, this request should have
186:                // one primary delegate and three secondary delegates
187:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
188:                        document.getRouteHeaderId());
189:                assertTrue("ewestfal should have an approve request.", document
190:                        .isApprovalRequested());
191:                // now check all of ewestfal's delegates
192:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
193:                        document.getRouteHeaderId());
194:                assertTrue("Should have an approve request.", document
195:                        .isApprovalRequested());
196:                document = new WorkflowDocument(new NetworkIdVO("xqi"),
197:                        document.getRouteHeaderId());
198:                assertTrue("Should have an approve request.", document
199:                        .isApprovalRequested());
200:                document = new WorkflowDocument(new NetworkIdVO("jitrue"),
201:                        document.getRouteHeaderId());
202:                assertTrue("Should have an approve request.", document
203:                        .isApprovalRequested());
204:
205:                // now approve as the primary delegator, this is where we were seeing the problem in KULWF-655, the
206:                // action request graph was not getting properly deactivated and it was not getting associated with the
207:                // "ActionTaken" properly
208:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
209:                        document.getRouteHeaderId());
210:                document.approve("Approving as primary delegate.");
211:
212:                // after the primary delegate approves, verify that the entire action request graph was
213:                // deactivated in grand fashion
214:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
215:                        document.getRouteHeaderId());
216:                assertFalse(
217:                        "the primary approver should no longer have an approve request.",
218:                        document.isApprovalRequested());
219:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
220:                        document.getRouteHeaderId());
221:                assertFalse("Should not have an approve request.", document
222:                        .isApprovalRequested());
223:                document = new WorkflowDocument(new NetworkIdVO("xqi"),
224:                        document.getRouteHeaderId());
225:                assertFalse("Should not have an approve request.", document
226:                        .isApprovalRequested());
227:                document = new WorkflowDocument(new NetworkIdVO("jitrue"),
228:                        document.getRouteHeaderId());
229:                assertFalse("Should not have an approve request.", document
230:                        .isApprovalRequested());
231:
232:                List actionRequests = KEWServiceLocator
233:                        .getActionRequestService()
234:                        .findAllActionRequestsByRouteHeaderId(
235:                                document.getRouteHeaderId());
236:                assertEquals("Wrong number of action requests.", 7,
237:                        actionRequests.size());
238:                for (Iterator iterator = actionRequests.iterator(); iterator
239:                        .hasNext();) {
240:                    ActionRequestValue request = (ActionRequestValue) iterator
241:                            .next();
242:                    assertTrue("Request should be deactivated.", request
243:                            .isDeactivated());
244:                    if (request.isRoleRequest()
245:                            && request.getRoleName().equals(
246:                                    RoleToRoleDelegationRole.MAIN_ROLE)) {
247:                        assertEquals("Should be all approve request",
248:                                EdenConstants.APPROVE_POLICY_ALL_APPROVE,
249:                                request.getApprovePolicy());
250:                    } else if (request.isRoleRequest()
251:                            && request
252:                                    .getRoleName()
253:                                    .equals(
254:                                            RoleToRoleDelegationRole.PRIMARY_DELEGATE_ROLE)) {
255:                        assertEquals("Should be first approve request",
256:                                EdenConstants.APPROVE_POLICY_FIRST_APPROVE,
257:                                request.getApprovePolicy());
258:                    } else if (request.isRoleRequest()
259:                            && request
260:                                    .getRoleName()
261:                                    .equals(
262:                                            RoleToRoleDelegationRole.SECONDARY_DELEGATE_ROLE)) {
263:                        assertEquals("Should be first approve request",
264:                                EdenConstants.APPROVE_POLICY_FIRST_APPROVE,
265:                                request.getApprovePolicy());
266:                    } else if (request.isRoleRequest()) {
267:                        fail("the roles have been messed up");
268:                    } else {
269:                        assertEquals(
270:                                "Should not have first approve policy set",
271:                                EdenConstants.APPROVE_POLICY_FIRST_APPROVE,
272:                                request.getApprovePolicy());
273:                    }
274:                }
275:
276:            }
277:
278:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.