Source Code Cross Referenced for MoveDocumentTest.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 java.util.List;
020:        import java.util.Set;
021:
022:        import org.junit.Test;
023:        import org.kuali.workflow.test.WorkflowTestCase;
024:
025:        import edu.iu.uis.eden.KEWServiceLocator;
026:        import edu.iu.uis.eden.actionrequests.ActionRequestValue;
027:        import edu.iu.uis.eden.clientapp.WorkflowDocument;
028:        import edu.iu.uis.eden.clientapp.WorkflowInfo;
029:        import edu.iu.uis.eden.clientapp.vo.MovePointVO;
030:        import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
031:        import edu.iu.uis.eden.clientapp.vo.RouteNodeInstanceVO;
032:        import edu.iu.uis.eden.test.TestUtilities;
033:
034:        public class MoveDocumentTest extends WorkflowTestCase {
035:
036:            protected void loadTestData() throws Exception {
037:                loadXmlFile("ActionsConfig.xml");
038:            }
039:
040:            /**
041:             * Tests that we can move a sequential document forward and backward.
042:             *
043:             */
044:            @Test
045:            public void testMoveDocumentSequential() throws Exception {
046:                WorkflowDocument document = new WorkflowDocument(
047:                        new NetworkIdVO("user1"), SeqSetup.DOCUMENT_TYPE_NAME);
048:                document.routeDocument("");
049:
050:                document = new WorkflowDocument(new NetworkIdVO("bmcgough"),
051:                        document.getRouteHeaderId());
052:                assertTrue("Bmcgough should have an approve.", document
053:                        .isApprovalRequested());
054:                document = new WorkflowDocument(new NetworkIdVO("rkirkend"),
055:                        document.getRouteHeaderId());
056:                assertTrue("Rkirkend should have an approve.", document
057:                        .isApprovalRequested());
058:                assertEquals("Should be at the WorkflowDocument Node.",
059:                        SeqSetup.WORKFLOW_DOCUMENT_NODE, document
060:                                .getNodeNames()[0]);
061:
062:                // move the document forward one node
063:                document.moveDocument(new MovePointVO(
064:                        SeqSetup.WORKFLOW_DOCUMENT_NODE, 1), "");
065:
066:                List actionRequests = KEWServiceLocator
067:                        .getActionRequestService().findPendingByDoc(
068:                                document.getRouteHeaderId());
069:                assertEquals(
070:                        "Should be only 1 pending approve request to pmckown.",
071:                        1, actionRequests.size());
072:                assertEquals("Should be at the WorkflowDocument2 Node.",
073:                        SeqSetup.WORKFLOW_DOCUMENT_2_NODE, document
074:                                .getNodeNames()[0]);
075:
076:                // after moving the document forward, bmcgough and rkirkend should no longer have requests, but phil should
077:                document = new WorkflowDocument(new NetworkIdVO("bmcgough"),
078:                        document.getRouteHeaderId());
079:                assertFalse("Bmcgough should NOT have an approve.", document
080:                        .isApprovalRequested());
081:                document = new WorkflowDocument(new NetworkIdVO("rkirkend"),
082:                        document.getRouteHeaderId());
083:                assertFalse("Rkirkend should NOT have an approve.", document
084:                        .isApprovalRequested());
085:
086:                document = new WorkflowDocument(new NetworkIdVO("pmckown"),
087:                        document.getRouteHeaderId());
088:                assertTrue("Pmckown should have an approve.", document
089:                        .isApprovalRequested());
090:                ActionRequestValue pmckownRequest = (ActionRequestValue) actionRequests
091:                        .get(0);
092:
093:                // now try moving it to itself, effectively refreshing the node
094:                document.moveDocument(new MovePointVO(
095:                        SeqSetup.WORKFLOW_DOCUMENT_2_NODE, 0), "");
096:                assertTrue("Pmckown should still have an approve.", document
097:                        .isApprovalRequested());
098:                actionRequests = KEWServiceLocator.getActionRequestService()
099:                        .findPendingByDoc(document.getRouteHeaderId());
100:                assertEquals(
101:                        "Should be only 1 pending approve request to pmckown.",
102:                        1, actionRequests.size());
103:                assertEquals("Should be at the WorkflowDocument2 Node.",
104:                        SeqSetup.WORKFLOW_DOCUMENT_2_NODE, document
105:                                .getNodeNames()[0]);
106:
107:                // since this should have invoked a refresh, let's ensure that the action request ids are different after the move
108:                assertFalse("Action request ids should be different.",
109:                        pmckownRequest.getActionRequestId().equals(
110:                                ((ActionRequestValue) actionRequests.get(0))
111:                                        .getActionRequestId()));
112:
113:                // now try moving it back
114:                document.moveDocument(new MovePointVO(
115:                        SeqSetup.WORKFLOW_DOCUMENT_2_NODE, -1), "");
116:
117:                // document should now be back at the WorkflowDocumentNode with requests to rkirkend and brian
118:                actionRequests = KEWServiceLocator.getActionRequestService()
119:                        .findPendingByDoc(document.getRouteHeaderId());
120:                assertEquals("Should be 2 pending requests.", 2, actionRequests
121:                        .size());
122:
123:                assertEquals("Should be at the WorkflowDocument Node.",
124:                        SeqSetup.WORKFLOW_DOCUMENT_NODE, document
125:                                .getNodeNames()[0]);
126:                document = new WorkflowDocument(new NetworkIdVO("bmcgough"),
127:                        document.getRouteHeaderId());
128:                assertTrue("Bmcgough should have an approve.", document
129:                        .isApprovalRequested());
130:                document = new WorkflowDocument(new NetworkIdVO("rkirkend"),
131:                        document.getRouteHeaderId());
132:                assertTrue("Rkirkend should have an approve.", document
133:                        .isApprovalRequested());
134:
135:                // Let's do a sanity check to make sure we're still ENROUTE and move the doc to an ack node, rendering it PROCESSED,
136:                // also, we'll check that there are no permissions enforced on the move document action by moving as a random user
137:                document = new WorkflowDocument(new NetworkIdVO("xqi"),
138:                        document.getRouteHeaderId());
139:                assertTrue("Doc should be ENROUTE.", document.stateIsEnroute());
140:                document.moveDocument(new MovePointVO(
141:                        SeqSetup.WORKFLOW_DOCUMENT_NODE, 2), "");
142:                assertTrue("Doc should be PROCESSED.", document
143:                        .stateIsProcessed());
144:            }
145:
146:            /**
147:             * This tests that we can invoke the move document command inside of a sub process.
148:             */
149:            @Test
150:            public void testMoveDocumentInsideProcess() throws Exception {
151:                WorkflowDocument document = new WorkflowDocument(
152:                        new NetworkIdVO("user1"), "MoveInProcessTest");
153:                document.routeDocument("");
154:
155:                // approve as bmcgough and rkirkend to move into process
156:                document = new WorkflowDocument(new NetworkIdVO("bmcgough"),
157:                        document.getRouteHeaderId());
158:                assertTrue("bmcgough should have approve", document
159:                        .isApprovalRequested());
160:                document.approve("");
161:                document = new WorkflowDocument(new NetworkIdVO("rkirkend"),
162:                        document.getRouteHeaderId());
163:                assertTrue("rkirkend should have approve", document
164:                        .isApprovalRequested());
165:                document.approve("");
166:
167:                WorkflowInfo info = new WorkflowInfo();
168:                RouteNodeInstanceVO[] activeNodeInstances = info
169:                        .getActiveNodeInstances(document.getRouteHeaderId());
170:                assertEquals("Should be 1 active node instance.", 1,
171:                        activeNodeInstances.length);
172:                RouteNodeInstanceVO node2 = activeNodeInstances[0];
173:                assertEquals("Should be at the WorkflowDocument2 node.",
174:                        SeqSetup.WORKFLOW_DOCUMENT_2_NODE, node2.getName());
175:                assertTrue("Node should be in a process.",
176:                        node2.getProcessId() != null);
177:
178:                // now try to move the document forward one which will keep us inside the subprocess
179:                document.moveDocument(new MovePointVO(
180:                        SeqSetup.WORKFLOW_DOCUMENT_2_NODE, 1), "");
181:
182:                activeNodeInstances = info.getActiveNodeInstances(document
183:                        .getRouteHeaderId());
184:                RouteNodeInstanceVO node3 = activeNodeInstances[0];
185:                assertEquals("Should be at the WorkflowDocument3 node.",
186:                        SeqSetup.WORKFLOW_DOCUMENT_3_NODE, node3.getName());
187:                assertTrue("Node should be in a process.",
188:                        node3.getProcessId() != null);
189:                assertEquals("Node 2 and 3 should be in the same process.",
190:                        node2.getProcessId(), node3.getProcessId());
191:
192:                document.moveDocument(new MovePointVO(
193:                        SeqSetup.WORKFLOW_DOCUMENT_3_NODE, 0), "");
194:
195:                document.moveDocument(new MovePointVO(
196:                        SeqSetup.WORKFLOW_DOCUMENT_3_NODE, -1), "");
197:            }
198:
199:            @Test
200:            public void testMoveDocumentParallel() throws Exception {
201:                WorkflowDocument document = new WorkflowDocument(
202:                        new NetworkIdVO("ewestfal"),
203:                        ParallelSetup.DOCUMENT_TYPE_NAME);
204:                document.blanketApprove("", new String[] {
205:                        ParallelSetup.WORKFLOW_DOCUMENT_2_B2_NODE,
206:                        ParallelSetup.WORKFLOW_DOCUMENT_3_B1_NODE,
207:                        ParallelSetup.WORKFLOW_DOCUMENT_4_B3_NODE });
208:                Set nodeNames = TestUtilities
209:                        .createNodeInstanceNameSet(KEWServiceLocator
210:                                .getRouteNodeService().getActiveNodeInstances(
211:                                        document.getRouteHeaderId()));
212:                assertEquals("There should be 3 active nodes.", 3, nodeNames
213:                        .size());
214:                assertTrue("Should be at WorkflowDocument3-B1", nodeNames
215:                        .contains(ParallelSetup.WORKFLOW_DOCUMENT_3_B1_NODE));
216:                assertTrue("Should be at WorkflowDocument2-B2", nodeNames
217:                        .contains(ParallelSetup.WORKFLOW_DOCUMENT_2_B2_NODE));
218:                assertTrue("Should be at WorkflowDocument4-B3", nodeNames
219:                        .contains(ParallelSetup.WORKFLOW_DOCUMENT_4_B3_NODE));
220:
221:                // try to move the document from WorkflowDocument3-B1 to WorkflowDocument2-B1
222:                document.moveDocument(new MovePointVO(
223:                        ParallelSetup.WORKFLOW_DOCUMENT_3_B1_NODE, -1), "");
224:                nodeNames = TestUtilities
225:                        .createNodeInstanceNameSet(KEWServiceLocator
226:                                .getRouteNodeService().getActiveNodeInstances(
227:                                        document.getRouteHeaderId()));
228:                assertEquals("There should be 3 active nodes.", 3, nodeNames
229:                        .size());
230:                assertTrue("Should be at WorkflowDocument2-B1", nodeNames
231:                        .contains(ParallelSetup.WORKFLOW_DOCUMENT_2_B1_NODE));
232:                assertTrue("Should be at WorkflowDocument2-B2", nodeNames
233:                        .contains(ParallelSetup.WORKFLOW_DOCUMENT_2_B2_NODE));
234:                assertTrue("Should be at WorkflowDocument4-B3", nodeNames
235:                        .contains(ParallelSetup.WORKFLOW_DOCUMENT_4_B3_NODE));
236:            }
237:
238:            private class SeqSetup {
239:
240:                public static final String DOCUMENT_TYPE_NAME = "MoveSequentialTest";
241:                public static final String ADHOC_NODE = "AdHoc";
242:                public static final String WORKFLOW_DOCUMENT_NODE = "WorkflowDocument";
243:                public static final String WORKFLOW_DOCUMENT_2_NODE = "WorkflowDocument2";
244:                public static final String WORKFLOW_DOCUMENT_3_NODE = "WorkflowDocument3";
245:                public static final String ACKNOWLEDGE_1_NODE = "Acknowledge1";
246:                public static final String ACKNOWLEDGE_2_NODE = "Acknowledge2";
247:
248:            }
249:
250:            private class ParallelSetup {
251:
252:                public static final String DOCUMENT_TYPE_NAME = "BlanketApproveParallelTest";
253:                public static final String ADHOC_NODE = "AdHoc";
254:                public static final String WORKFLOW_DOCUMENT_NODE = "WorkflowDocument";
255:                public static final String WORKFLOW_DOCUMENT_2_B1_NODE = "WorkflowDocument2-B1";
256:                public static final String WORKFLOW_DOCUMENT_2_B2_NODE = "WorkflowDocument2-B2";
257:                public static final String WORKFLOW_DOCUMENT_3_B1_NODE = "WorkflowDocument3-B1";
258:                public static final String WORKFLOW_DOCUMENT_3_B2_NODE = "WorkflowDocument3-B2";
259:                public static final String WORKFLOW_DOCUMENT_4_B3_NODE = "WorkflowDocument4-B3";
260:                public static final String ACKNOWLEDGE_1_NODE = "Acknowledge1";
261:                public static final String ACKNOWLEDGE_2_NODE = "Acknowledge2";
262:                public static final String JOIN_NODE = "Join";
263:                public static final String SPLIT_NODE = "Split";
264:                public static final String WORKFLOW_DOCUMENT_FINAL_NODE = "WorkflowDocumentFinal";
265:
266:            }
267:
268:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.