Source Code Cross Referenced for WorkflowDocumentTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » edu » iu » uis » eden » clientapp » 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.clientapp 
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.clientapp;
018:
019:        import org.junit.Ignore;
020:        import org.junit.Test;
021:        import org.kuali.workflow.test.WorkflowTestCase;
022:
023:        import edu.iu.uis.eden.clientapp.vo.EmplIdVO;
024:        import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
025:        import edu.iu.uis.eden.clientapp.vo.RouteNodeInstanceVO;
026:        import edu.iu.uis.eden.clientapp.vo.UserIdVO;
027:        import edu.iu.uis.eden.clientapp.vo.UuIdVO;
028:        import edu.iu.uis.eden.clientapp.vo.WorkflowIdVO;
029:
030:        /**
031:         * Place to test WorkflowDocument.
032:         * 
033:         */
034:        public class WorkflowDocumentTest extends WorkflowTestCase {
035:
036:            protected void loadTestData() throws Exception {
037:                loadXmlFile("ClientAppConfig.xml");
038:            }
039:
040:            @Test
041:            public void testLoadNonExistentDocument() throws Exception {
042:                WorkflowDocument document = new WorkflowDocument(
043:                        new NetworkIdVO("ewestfal"), new Long(123456789));
044:                assertNull("RouteHeaderVO should be null.", document
045:                        .getRouteHeader());
046:            }
047:
048:            @Test
049:            public void testWorkflowDocument() throws Exception {
050:                WorkflowDocument document = new WorkflowDocument(
051:                        new NetworkIdVO("rkirkend"), "UnitTestDocument");
052:                document.routeDocument("");
053:
054:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
055:                        document.getRouteHeaderId());
056:                document.approve("");
057:
058:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
059:                        document.getRouteHeaderId());
060:                document.approve("");
061:
062:                RouteNodeInstanceVO[] nodeInstances = document
063:                        .getRouteNodeInstances();
064:                boolean containsInitiated = false;
065:                boolean containsTemplate1 = false;
066:                boolean containsTemplate2 = false;
067:                for (int j = 0; j < nodeInstances.length; j++) {
068:                    RouteNodeInstanceVO routeNodeInstance = nodeInstances[j];
069:                    if (routeNodeInstance.getName().equals("Initiated")) {
070:                        containsInitiated = true;
071:                    } else if (routeNodeInstance.getName().equals("Template1")) {
072:                        containsTemplate1 = true;
073:                    } else if (routeNodeInstance.getName().equals("Template2")) {
074:                        containsTemplate2 = true;
075:                    }
076:                }
077:
078:                assertTrue("Should have gone through initiated node",
079:                        containsInitiated);
080:                assertTrue("Should have gone through template1 node",
081:                        containsTemplate1);
082:                assertTrue("Should have gone through template2 node",
083:                        containsTemplate2);
084:            }
085:
086:            /**
087:             * Test that the document is being updated appropriately after a return to previous call
088:             * 
089:             * @throws Exception
090:             */
091:            @Test
092:            public void testReturnToPreviousCorrectlyUpdatingDocumentStatus()
093:                    throws Exception {
094:
095:                WorkflowDocument document = new WorkflowDocument(
096:                        new NetworkIdVO("rkirkend"), "UnitTestDocument");
097:                document.routeDocument("");
098:
099:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
100:                        document.getRouteHeaderId());
101:                document.returnToPreviousNode("", "Initiated");
102:
103:                assertFalse("ewestfal should no longer have approval status",
104:                        document.isApprovalRequested());
105:                assertFalse(
106:                        "ewestfal should no long have blanket approve status",
107:                        document.isBlanketApproveCapable());
108:
109:                //just for good measure
110:                document = new WorkflowDocument(new NetworkIdVO("rkirkend"),
111:                        document.getRouteHeaderId());
112:                assertTrue("rkirkend should now have an approve request",
113:                        document.isApprovalRequested());
114:            }
115:
116:            @Test
117:            public void testGetPreviousRouteNodeNames() throws Exception {
118:
119:                WorkflowDocument document = new WorkflowDocument(
120:                        new NetworkIdVO("rkirkend"), "UnitTestDocument");
121:                document.routeDocument("");
122:
123:                document = new WorkflowDocument(new NetworkIdVO("ewestfal"),
124:                        document.getRouteHeaderId());
125:                document.approve("");
126:
127:                document = new WorkflowDocument(new NetworkIdVO("jhopf"),
128:                        document.getRouteHeaderId());
129:                String[] previousNodeNames = document.getPreviousNodeNames();
130:                assertEquals("Should have 2 previous Node Names", 2,
131:                        previousNodeNames.length);
132:                assertEquals("First node name should be last node visited",
133:                        "Template1", previousNodeNames[0]);
134:                assertEquals("Last node name should be the first visisted",
135:                        "Initiated", previousNodeNames[1]);
136:                String[] currentNodes = document.getNodeNames();
137:                assertEquals("Should have 1 current node name", 1,
138:                        currentNodes.length);
139:                assertEquals("Current node name incorrect", "Template2",
140:                        currentNodes[0]);
141:                document.returnToPreviousNode("", "Template1");
142:                previousNodeNames = document.getPreviousNodeNames();
143:                assertEquals("Should have 1 previous Node Name", 1,
144:                        previousNodeNames.length);
145:                assertEquals("Previous Node name incorrect", "Initiated",
146:                        previousNodeNames[0]);
147:
148:            }
149:
150:            @Test
151:            public void testIsRouteCapable() throws Exception {
152:
153:                WorkflowDocument doc = new WorkflowDocument(new NetworkIdVO(
154:                        "rkirkend"), "UnitTestDocument");
155:
156:                verifyIsRouteCapable(false, new NetworkIdVO("ewestfal"), doc
157:                        .getRouteHeaderId());
158:                verifyIsRouteCapable(false, new WorkflowIdVO("1"), doc
159:                        .getRouteHeaderId());
160:                verifyIsRouteCapable(false, new UuIdVO("1"), doc
161:                        .getRouteHeaderId());
162:                verifyIsRouteCapable(false, new EmplIdVO("1"), doc
163:                        .getRouteHeaderId());
164:
165:                verifyIsRouteCapable(true, new NetworkIdVO("rkirkend"), doc
166:                        .getRouteHeaderId());
167:                verifyIsRouteCapable(true, new WorkflowIdVO("2"), doc
168:                        .getRouteHeaderId());
169:                verifyIsRouteCapable(true, new UuIdVO("2"), doc
170:                        .getRouteHeaderId());
171:                verifyIsRouteCapable(true, new EmplIdVO("2"), doc
172:                        .getRouteHeaderId());
173:            }
174:
175:            private void verifyIsRouteCapable(boolean routeCapable,
176:                    UserIdVO userId, Long docId) throws Exception {
177:                WorkflowDocument doc = new WorkflowDocument(userId, docId);
178:                assertEquals(routeCapable, doc.isRouteCapable());
179:            }
180:
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.