Source Code Cross Referenced for WorkgroupTypeXmlParserTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » workflow » workgroup » 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 » org.kuali.workflow.workgroup 
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 org.kuali.workflow.workgroup;
018:
019:        import org.junit.Test;
020:        import org.kuali.workflow.test.WorkflowTestCase;
021:
022:        import edu.iu.uis.eden.KEWServiceLocator;
023:        import edu.iu.uis.eden.doctype.DocumentType;
024:        import edu.iu.uis.eden.doctype.DocumentTypeService;
025:
026:        /**
027:         *
028:         * @author ewestfal
029:         */
030:        public class WorkgroupTypeXmlParserTest extends WorkflowTestCase {
031:
032:            private WorkgroupTypeService service;
033:
034:            @Override
035:            protected void setUpTransaction() throws Exception {
036:                super .setUpTransaction();
037:                this .service = KEWServiceLocator.getWorkgroupTypeService();
038:            }
039:
040:            /**
041:             * Tests that an existing WorkgroupType can be updated via the XML.
042:             */
043:            @Test
044:            public void testUpdateWorkgroupType() throws Exception {
045:                loadXmlFile("WorkgroupTypeDocTypeConfig.xml");
046:                loadXmlFile("WorkgroupTypeConfig.xml");
047:
048:                WorkgroupType wgt2 = service.findByName("WorkgroupType2");
049:                assertNotNull(wgt2);
050:                assertEquals(2, wgt2.getAttributes().size());
051:                assertEquals(2, wgt2.getActiveAttributes().size());
052:                WorkgroupTypeAttribute attribute1 = wgt2.getAttributes().get(0);
053:                WorkgroupTypeAttribute attribute2 = wgt2.getAttributes().get(1);
054:                assertEquals("WorkgroupTypeAttribute1", attribute1
055:                        .getAttribute().getName());
056:                assertEquals("WorkgroupTypeAttribute2", attribute2
057:                        .getAttribute().getName());
058:
059:                // update WorkgroupType2 to remove WorkgroupTypeAttribute1
060:                loadXmlFile("WorkgroupTypeConfigUpdate1.xml");
061:                wgt2 = service.findByName("WorkgroupType2");
062:                assertNotNull(wgt2);
063:                assertEquals(2, wgt2.getAttributes().size());
064:                assertEquals(1, wgt2.getActiveAttributes().size());
065:                assertEquals("attribute id should be same as before.",
066:                        attribute2.getWorkgroupTypeAttributeId(), wgt2
067:                                .getActiveAttributes().get(0)
068:                                .getWorkgroupTypeAttributeId());
069:
070:                // now let's reactive WorkgroupTypeAttribute1 and add a new one
071:                loadXmlFile("WorkgroupTypeConfigUpdate2.xml");
072:                wgt2 = service.findByName("WorkgroupType2");
073:                assertNotNull(wgt2);
074:                assertEquals(3, wgt2.getAttributes().size());
075:                assertEquals(3, wgt2.getActiveAttributes().size());
076:                WorkgroupTypeAttribute attribute3New = wgt2.getAttributes()
077:                        .get(0);
078:                WorkgroupTypeAttribute attribute1New = wgt2.getAttributes()
079:                        .get(1);
080:                WorkgroupTypeAttribute attribute2New = wgt2.getAttributes()
081:                        .get(2);
082:                assertEquals("WorkgroupTypeAttribute3", attribute3New
083:                        .getAttribute().getName());
084:                assertEquals("WorkgroupTypeAttribute1", attribute1New
085:                        .getAttribute().getName());
086:                assertEquals("WorkgroupTypeAttribute2", attribute2New
087:                        .getAttribute().getName());
088:                assertEquals("attribute 1 id should be same as before.",
089:                        attribute1.getWorkgroupTypeAttributeId(), attribute1New
090:                                .getWorkgroupTypeAttributeId());
091:                assertEquals("attribute 2 id should be same as before.",
092:                        attribute2.getWorkgroupTypeAttributeId(), attribute2New
093:                                .getWorkgroupTypeAttributeId());
094:                assertEquals(0, attribute3New.getOrderIndex());
095:                assertEquals(1, attribute1New.getOrderIndex());
096:                assertEquals(2, attribute2New.getOrderIndex());
097:
098:                // rearrange indexes and verify things are retrieved from the db correclty
099:                attribute1New.setOrderIndex(2);
100:                attribute2New.setOrderIndex(1);
101:                service.save(wgt2);
102:                wgt2 = service.findByName("WorkgroupType2");
103:                assertEquals("WorkgroupTypeAttribute2", wgt2.getAttributes()
104:                        .get(1).getAttribute().getName());
105:                assertEquals("WorkgroupTypeAttribute1", wgt2.getAttributes()
106:                        .get(2).getAttribute().getName());
107:
108:            }
109:
110:            @Test
111:            public void testParseWorkgroupType() throws Exception {
112:                loadXmlFile("WorkgroupTypeDocTypeConfig.xml");
113:                loadXmlFile("WorkgroupTypeConfig.xml");
114:
115:                // check WorkgroupType1
116:                WorkgroupType workgroupType1 = service
117:                        .findByName("WorkgroupType1");
118:                assertNotNull("WorkgroupType1 should have been found.",
119:                        workgroupType1);
120:                assertNotNull("WorkgroupType should have an ID", workgroupType1
121:                        .getWorkgroupTypeId());
122:                assertEquals("WorkgroupType1", workgroupType1.getName());
123:                assertEquals("Should be one attribute.", 1, workgroupType1
124:                        .getAttributes().size());
125:                WorkgroupTypeAttribute workgroupTypeAttribute1 = workgroupType1
126:                        .getAttributes().get(0);
127:                assertEquals(workgroupType1, workgroupTypeAttribute1
128:                        .getWorkgroupType());
129:                assertNotNull(workgroupTypeAttribute1
130:                        .getWorkgroupTypeAttributeId());
131:                assertNotNull(workgroupTypeAttribute1.getAttribute());
132:                assertEquals("Wrong attribute", "WorkgroupTypeAttribute1",
133:                        workgroupTypeAttribute1.getAttribute().getName());
134:
135:                // check WorkgroupType2
136:                WorkgroupType workgroupType2 = service
137:                        .findByName("WorkgroupType2");
138:                assertNotNull("WorkgroupType2 should have been found.",
139:                        workgroupType2);
140:                assertNotNull("WorkgroupType should have an ID", workgroupType2
141:                        .getWorkgroupTypeId());
142:                assertEquals("WorkgroupType2", workgroupType2.getName());
143:                assertEquals("Workgroup Type 2", workgroupType2.getLabel());
144:                assertEquals("The Second Workgroup Type", workgroupType2
145:                        .getDescription());
146:                assertEquals("Should be two attributes.", 2, workgroupType2
147:                        .getAttributes().size());
148:                workgroupTypeAttribute1 = workgroupType2.getAttributes().get(0);
149:                WorkgroupTypeAttribute workgroupTypeAttribute2 = workgroupType2
150:                        .getAttributes().get(1);
151:                assertEquals(workgroupType2, workgroupTypeAttribute1
152:                        .getWorkgroupType());
153:                assertEquals(workgroupType2, workgroupTypeAttribute2
154:                        .getWorkgroupType());
155:                assertNotNull(workgroupTypeAttribute1
156:                        .getWorkgroupTypeAttributeId());
157:                assertNotNull(workgroupTypeAttribute2
158:                        .getWorkgroupTypeAttributeId());
159:                assertNotNull(workgroupTypeAttribute1.getAttribute());
160:                assertNotNull(workgroupTypeAttribute2.getAttribute());
161:                assertEquals("Wrong attribute", "WorkgroupTypeAttribute1",
162:                        workgroupTypeAttribute1.getAttribute().getName());
163:                assertEquals("Wrong attribute", "WorkgroupTypeAttribute2",
164:                        workgroupTypeAttribute2.getAttribute().getName());
165:
166:                // check WorkgroupType3
167:                WorkgroupType workgroupType3 = service
168:                        .findByName("WorkgroupType3");
169:                assertNotNull("WorkgroupType3 should have been found.",
170:                        workgroupType3);
171:                assertNotNull("WorkgroupType should have an ID", workgroupType3
172:                        .getWorkgroupTypeId());
173:                assertEquals("WorkgroupType3", workgroupType3.getName());
174:                assertEquals("WorkgroupType3", workgroupType3.getLabel());
175:                assertNull(workgroupType3.getDescription());
176:                assertEquals("WorkgroupType3DocType", workgroupType3
177:                        .getDocumentTypeName());
178:                DocumentType docType = getDocumentTypeService().findByName(
179:                        workgroupType3.getDocumentTypeName());
180:                assertNotNull(docType);
181:            }
182:
183:            private DocumentTypeService getDocumentTypeService() {
184:                return KEWServiceLocator.getDocumentTypeService();
185:            }
186:
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.