Source Code Cross Referenced for DisapproveActionTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » actions » 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.actions 
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.actions;
018:
019:        import mocks.MockEmailNotificationService;
020:
021:        import org.junit.Ignore;
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.actions.BlanketApproveTest.NotifySetup;
028:        import edu.iu.uis.eden.clientapp.WorkflowDocument;
029:        import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
030:        import edu.iu.uis.eden.exception.WorkflowException;
031:        import edu.iu.uis.eden.test.TestUtilities;
032:
033:        public class DisapproveActionTest extends WorkflowTestCase {
034:
035:            protected void loadTestData() throws Exception {
036:                loadXmlFile("ActionsConfig.xml");
037:            }
038:
039:            @Test
040:            public void testDisapprove() throws Exception {
041:                WorkflowDocument document = new WorkflowDocument(
042:                        new NetworkIdVO("ewestfal"),
043:                        NotifySetup.DOCUMENT_TYPE_NAME);
044:                document.routeDocument("");
045:
046:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
047:                        document.getRouteHeaderId());
048:                assertTrue("This user should have an approve request", document
049:                        .isApprovalRequested());
050:                document.approve("");
051:
052:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
053:                        document.getRouteHeaderId());
054:                assertTrue("This user should have an approve request", document
055:                        .isApprovalRequested());
056:                document.approve("");//ewestfal had ignore previous rule
057:
058:                document = new WorkflowDocument(new NetworkIdVO("rkirkend"),
059:                        document.getRouteHeaderId());
060:                assertTrue("This user should have an approve request", document
061:                        .isApprovalRequested());
062:                document.approve("");
063:
064:                //this be the role delegate of jitrue
065:                document = new WorkflowDocument(new NetworkIdVO("natjohns"),
066:                        document.getRouteHeaderId());
067:                assertTrue("This user should have an approve request", document
068:                        .isApprovalRequested());
069:                document.approve("");
070:
071:                document = new WorkflowDocument(new NetworkIdVO("bmcgough"),
072:                        document.getRouteHeaderId());
073:                assertTrue("This user should have an approve request", document
074:                        .isApprovalRequested());
075:                // assert that the document is at the same node before and after disapprove
076:                TestUtilities.assertAtNode(document,
077:                        NotifySetup.NOTIFY_FINAL_NODE);
078:                document.disapprove("");
079:                TestUtilities.assertAtNode(document,
080:                        NotifySetup.NOTIFY_FINAL_NODE);
081:                // reload just to double check
082:                document = new WorkflowDocument(new NetworkIdVO("bmcgough"),
083:                        document.getRouteHeaderId());
084:                TestUtilities.assertAtNode(document,
085:                        NotifySetup.NOTIFY_FINAL_NODE);
086:
087:                assertTrue("Document should be disapproved", document
088:                        .stateIsDisapproved());
089:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
090:                        document.getRouteHeaderId());
091:                assertTrue(
092:                        "ack should be requested as part of disapprove notification",
093:                        document.isAcknowledgeRequested());
094:
095:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
096:                        document.getRouteHeaderId());
097:                assertTrue(
098:                        "ack should be requested as part of disapprove notification",
099:                        document.isAcknowledgeRequested());
100:
101:                document = new WorkflowDocument(new NetworkIdVO("rkirkend"),
102:                        document.getRouteHeaderId());
103:                assertTrue(
104:                        "ack should be requested as part of disapprove notification",
105:                        document.isAcknowledgeRequested());
106:
107:                //jitrue while part of original approval chain did not take approve action and therefore should
108:                //not get action
109:                document = new WorkflowDocument(new NetworkIdVO("jitrue"),
110:                        document.getRouteHeaderId());
111:                assertFalse(
112:                        "ack should be requested as part of disapprove notification",
113:                        document.isAcknowledgeRequested());
114:
115:                document = new WorkflowDocument(new NetworkIdVO("natjohns"),
116:                        document.getRouteHeaderId());
117:                assertTrue(
118:                        "ack should be requested as part of disapprove notification",
119:                        document.isAcknowledgeRequested());
120:
121:                //shenl part of approval chain but didn't take action
122:                document = new WorkflowDocument(new NetworkIdVO("shenl"),
123:                        document.getRouteHeaderId());
124:                assertFalse(
125:                        "ack should be requested as part of disapprove notification",
126:                        document.isAcknowledgeRequested());
127:
128:                //check that all the emailing went right.
129:                assertEquals("jhopf should have been sent an approve email", 1,
130:                        getMockEmailService().emailsSent("jhopf",
131:                                document.getRouteHeaderId(),
132:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ));
133:                assertEquals("jhopf should have been sent an ack email", 1,
134:                        getMockEmailService().emailsSent("jhopf",
135:                                document.getRouteHeaderId(),
136:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ));
137:
138:                assertEquals("ewestfal should have been sent an approve email",
139:                        1, getMockEmailService().emailsSent("ewestfal",
140:                                document.getRouteHeaderId(),
141:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ));
142:                assertEquals("ewestfal should have been sent an ack email", 1,
143:                        getMockEmailService().emailsSent("ewestfal",
144:                                document.getRouteHeaderId(),
145:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ));
146:
147:                //rkirkend is a primary delegate and therefore should not receive email notification
148:                assertEquals(
149:                        "rkirkend should not have been sent an approve email",
150:                        0, getMockEmailService().emailsSent("rkirkend",
151:                                document.getRouteHeaderId(),
152:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ));
153:                assertEquals("rkirkend should have been sent an ack email", 1,
154:                        getMockEmailService().emailsSent("rkirkend",
155:                                document.getRouteHeaderId(),
156:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ));
157:
158:                //temay is rkirkend primary delegate she should have received notification
159:                assertEquals("temay should have been sent an approve email", 1,
160:                        getMockEmailService().emailsSent("temay",
161:                                document.getRouteHeaderId(),
162:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ));
163:
164:                //there should be no ack emails for temay
165:                assertEquals("temay should have been sent an ack email", 0,
166:                        getMockEmailService().emailsSent("temay",
167:                                document.getRouteHeaderId(),
168:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ));
169:
170:                // pmckown is a secondary delegate here so he should NOT have received a notification
171:                assertEquals(
172:                        "pmckown should not have been sent an approve email",
173:                        0, getMockEmailService().emailsSent("pmckown",
174:                                document.getRouteHeaderId(),
175:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ));
176:                assertEquals("pmckown should not have been sent an ack email",
177:                        0, getMockEmailService().emailsSent("pmckown",
178:                                document.getRouteHeaderId(),
179:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ));
180:
181:                //this is a secondary delegator and should receive notifications
182:                assertEquals("jitrue should have been sent an approve email",
183:                        1, getMockEmailService().emailsSent("jitrue",
184:                                document.getRouteHeaderId(),
185:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ));
186:                //no ack emails to jitrue
187:                assertEquals("jitrue should have been sent an ack email", 0,
188:                        getMockEmailService().emailsSent("jitrue",
189:                                document.getRouteHeaderId(),
190:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ));
191:
192:                //the 2nd delegates should NOT receive notifications by default
193:                assertEquals(
194:                        "natjohns should not have been sent an approve email",
195:                        0, getMockEmailService().emailsSent("natjohns",
196:                                document.getRouteHeaderId(),
197:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ));
198:                //2ndary delegate
199:                assertEquals("natjohns should not have been sent an ack email",
200:                        1, getMockEmailService().emailsSent("natjohns",
201:                                document.getRouteHeaderId(),
202:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ));
203:                assertEquals(
204:                        "shenl should not have been sent an approve email", 0,
205:                        getMockEmailService().emailsSent("shenl",
206:                                document.getRouteHeaderId(),
207:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ));
208:                assertEquals("shenl should not have been sent an ack email", 0,
209:                        getMockEmailService().emailsSent("shenl",
210:                                document.getRouteHeaderId(),
211:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ));
212:
213:                assertEquals("bmcgough should have been sent an approve email",
214:                        1, getMockEmailService().emailsSent("bmcgough",
215:                                document.getRouteHeaderId(),
216:                                EdenConstants.ACTION_REQUEST_APPROVE_REQ));
217:                assertEquals("bmcgough should not have been sent an ack email",
218:                        0, getMockEmailService().emailsSent("bmcgough",
219:                                document.getRouteHeaderId(),
220:                                EdenConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ));
221:            }
222:
223:            /**
224:             * Tests whether the person who disapproved a doc gets an acknowledgement
225:             *
226:             * This test will fail until EN-637 is resolved.
227:             */
228:            @Ignore
229:            @Test
230:            public void testInitiatorRoleDisapprove() throws WorkflowException {
231:                // test initiator disapproval of their own doc via InitiatorRoleAttribute
232:                WorkflowDocument document = new WorkflowDocument(
233:                        new NetworkIdVO("arh14"), "InitiatorRoleApprovalTest");
234:                document.routeDocument("routing document");
235:
236:                document = new WorkflowDocument(new NetworkIdVO("arh14"),
237:                        document.getRouteHeaderId());
238:                document.disapprove("disapproving the document");
239:
240:                document = new WorkflowDocument(new NetworkIdVO("arh14"),
241:                        document.getRouteHeaderId());
242:                assertFalse(
243:                        "Initiator was sent redundant Ack request after personal disapproval - This test will fail until EN-637 is resolved",
244:                        document.isAcknowledgeRequested());
245:            }
246:
247:            /**
248:             * This test will fail until EN-637 is resolved.
249:             */
250:            @Ignore
251:            @Test
252:            public void testInitiatorDisapprove() throws WorkflowException {
253:                // test initiator disapproval, via normal request with ignoreprevious=true
254:                WorkflowDocument document = new WorkflowDocument(
255:                        new NetworkIdVO("ewestfal"),
256:                        NotifySetup.DOCUMENT_TYPE_NAME);
257:                document.routeDocument("");
258:
259:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
260:                        document.getRouteHeaderId());
261:                document.disapprove("");
262:
263:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
264:                        document.getRouteHeaderId());
265:                assertFalse(
266:                        "Initiator was sent redundant Ack request after personal disapproval - This test will fail until EN-637 is resolved",
267:                        document.isAcknowledgeRequested());
268:            }
269:
270:            @Test
271:            public void testDisapproveByArbitraryRecipient()
272:                    throws WorkflowException {
273:                // test approval by some other person
274:                WorkflowDocument document = new WorkflowDocument(
275:                        new NetworkIdVO("ewestfal"),
276:                        "BlanketApproveSequentialTest");
277:                document.routeDocument("");
278:
279:                document = new WorkflowDocument(new NetworkIdVO("bmcgough"),
280:                        document.getRouteHeaderId());
281:                document.disapprove("disapproving as bmcgough");
282:
283:                document = new WorkflowDocument(new NetworkIdVO("bmcgough"),
284:                        document.getRouteHeaderId());
285:                assertFalse(
286:                        "Acknowledge was incorrectly sent to non-initiator disapprover",
287:                        document.isAcknowledgeRequested());
288:
289:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
290:                        document.getRouteHeaderId());
291:                assertTrue("Acknowledge was not sent to initiator", document
292:                        .isAcknowledgeRequested());
293:            }
294:
295:            private MockEmailNotificationService getMockEmailService() {
296:                return (MockEmailNotificationService) KEWServiceLocator
297:                        .getActionListEmailService();
298:            }
299:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.