Source Code Cross Referenced for MaintenanceDocumentEntryMapperTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » core » datadictionary » exporter » 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.core.datadictionary.exporter 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005-2007 The Kuali Foundation.
003:         * 
004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         * http://www.opensource.org/licenses/ecl1.php
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.kuali.core.datadictionary.exporter;
017:
018:        import java.util.Map;
019:
020:        import org.junit.Test;
021:        import org.kuali.core.datadictionary.DataDictionary;
022:        import org.kuali.core.datadictionary.DataDictionaryBuilder;
023:        import org.kuali.core.datadictionary.MaintenanceDocumentEntry;
024:        import org.kuali.core.datadictionary.bos.PaymentReasonCode;
025:        import org.kuali.core.impls.RiceTestMaintenanceDocumentRule;
026:        import org.kuali.rice.KNSServiceLocator;
027:        import org.kuali.test.KNSTestBase;
028:        import org.kuali.test.KNSWithTestSpringContext;
029:
030:        /**
031:         * This class is used to test the MaintenanceDocumentEntryExporter.
032:         * 
033:         * 
034:         */
035:        @KNSWithTestSpringContext
036:        public class MaintenanceDocumentEntryMapperTest extends KNSTestBase {
037:            private DataDictionaryBuilder builder;
038:            private DataDictionary dataDictionary;
039:
040:            @Override
041:            public void setUp() throws Exception {
042:                super .setUp();
043:
044:                builder = new DataDictionaryBuilder(KNSServiceLocator
045:                        .getValidationCompletionUtils());
046:                builder.setKualiGroupService(KNSServiceLocator
047:                        .getKualiGroupService());
048:                builder.setKualiConfigurationService(KNSServiceLocator
049:                        .getKualiConfigurationService());
050:
051:                builder
052:                        .addUniqueEntries(
053:                                "classpath:org/kuali/core/datadictionary/test/PaymentReasonCodeMaintenanceDocument.xml",
054:                                true);
055:                dataDictionary = builder.getDataDictionary();
056:            }
057:
058:            public final void testConstructor_nullEntry() {
059:                boolean failedAsExpected = false;
060:
061:                try {
062:                    new MaintenanceDocumentEntryMapper().mapEntry(null);
063:                } catch (IllegalArgumentException e) {
064:                    failedAsExpected = true;
065:                }
066:
067:                assertTrue(failedAsExpected);
068:            }
069:
070:            @Test
071:            public final void testExportSimpleProperties_businessObjectClass() {
072:                Map entryMap = mapAccountMaintenanceDocument();
073:
074:                String path = "businessObjectClass";
075:                String property = (String) ExporterTestUtils.traverseMap(
076:                        entryMap, path);
077:                assertEquals(PaymentReasonCode.class.getName(), property);
078:            }
079:
080:            @Test
081:            public final void testExportSimpleProperties_maintainableClass() {
082:                Map entryMap = mapAccountMaintenanceDocument();
083:
084:                String path = "maintainableClass";
085:                String property = (String) ExporterTestUtils.traverseMap(
086:                        entryMap, path);
087:                assertEquals(
088:                        org.kuali.core.maintenance.KualiMaintainableImpl.class
089:                                .getName(), property);
090:            }
091:
092:            @Test
093:            public final void testExportSimpleProperties_documentTypeName() {
094:                Map entryMap = mapAccountMaintenanceDocument();
095:
096:                String path = "documentTypeName";
097:                String property = (String) ExporterTestUtils.traverseMap(
098:                        entryMap, path);
099:                assertEquals("KualiPaymentReasonCodeMaintenanceDocument",
100:                        property);
101:            }
102:
103:            @Test
104:            public final void testExportSimpleProperties_documentTypeCode() {
105:                Map entryMap = mapAccountMaintenanceDocument();
106:
107:                String path = "documentTypeCode";
108:                String property = (String) ExporterTestUtils.traverseMap(
109:                        entryMap, path);
110:                assertEquals("DVPR", property);
111:            }
112:
113:            @Test
114:            public final void testExportSimpleProperties_businessRulesClass() {
115:                Map entryMap = mapAccountMaintenanceDocument();
116:
117:                String path = "businessRulesClass";
118:                String property = (String) ExporterTestUtils.traverseMap(
119:                        entryMap, path);
120:                assertEquals(RiceTestMaintenanceDocumentRule.class.getName(),
121:                        property);
122:            }
123:
124:            @Test
125:            public final void testExportSimpleProperties_label() {
126:                Map entryMap = mapAccountMaintenanceDocument();
127:
128:                String path = "label";
129:                String property = (String) ExporterTestUtils.traverseMap(
130:                        entryMap, path);
131:                assertEquals("Payment Reason Code Maintenance Document",
132:                        property);
133:            }
134:
135:            @Test
136:            public final void testExportSimpleProperties_shortLabel() {
137:                Map entryMap = mapAccountMaintenanceDocument();
138:
139:                String path = "shortLabel";
140:                String property = (String) ExporterTestUtils.traverseMap(
141:                        entryMap, path);
142:                assertEquals("PayReasonMaintDoc", property);
143:            }
144:
145:            @Test
146:            public final void testExportSimpleProperties_summary() {
147:                Map entryMap = mapAccountMaintenanceDocument();
148:
149:                String path = "summary";
150:                String property = (String) ExporterTestUtils.traverseMap(
151:                        entryMap, path);
152:                assertEquals("Payment Reason Code Maintenance Document",
153:                        property);
154:            }
155:
156:            @Test
157:            public final void testExportSimpleProperties_description() {
158:                Map entryMap = mapAccountMaintenanceDocument();
159:
160:                String path = "description";
161:                String property = (String) ExporterTestUtils.traverseMap(
162:                        entryMap, path);
163:                assertTrue(property
164:                        .equals("Document used to create or update Payment Reason objects"));
165:            }
166:
167:            @Test
168:            public final void testExportSimpleProperties_documentAuthorizerClass() {
169:                Map entryMap = mapAccountMaintenanceDocument();
170:
171:                String path = "documentAuthorizerClass";
172:                String property = (String) ExporterTestUtils.traverseMap(
173:                        entryMap, path);
174:
175:                assertEquals(
176:                        "org.kuali.core.document.authorization.MaintenanceDocumentAuthorizerBase",
177:                        property);
178:            }
179:
180:            @Test
181:            public final void testExportSection() {
182:                Map entryMap = mapAccountMaintenanceDocument();
183:
184:                String titlePath = "maintainableSections.0.title";
185:                String title = (String) ExporterTestUtils.traverseMap(entryMap,
186:                        titlePath);
187:                assertEquals("Edit Payment Reason", title);
188:
189:                String itemsPath = "maintainableSections.0.maintainableItems";
190:                Map items = (Map) ExporterTestUtils.traverseMap(entryMap,
191:                        itemsPath);
192:                assertEquals(5, items.size());
193:
194:                Map item = (Map) items.get("code");
195:                assertEquals("code", item.get("name"));
196:                assertEquals("true", item.get("required"));
197:            }
198:
199:            @Test
200:            public final void testExportSections() {
201:                Map entryMap = mapAccountMaintenanceDocument();
202:
203:                String sectionsPath = "maintainableSections";
204:                Map sections = (Map) ExporterTestUtils.traverseMap(entryMap,
205:                        sectionsPath);
206:                assertEquals(2, sections.size());
207:
208:                // check section metadata
209:                String[][] expectedSectionsData = {
210:                        { "0.title", "Edit Payment Reason" },
211:                        { "1.title", "Maintenance Section 2" } };
212:                ExporterTestUtils.comparePropertyStrings(sections,
213:                        expectedSectionsData);
214:
215:                // check section 0 item data
216:                // ain't nothing but fields, so far
217:                String[][] expectedItemData0 = { { "code.field", "true" },
218:                        { "code.name", "code" }, { "code.required", "true" },
219:                        { "name.field", "true" }, { "name.name", "name" },
220:                        { "name.required", "false" },
221:                        { "description.field", "true" },
222:                        { "description.name", "description" },
223:                        { "description.required", "false" },
224:                        { "active.field", "true" },
225:                        { "active.name", "active" },
226:                        { "active.required", "false" },
227:                        { "versionNumber.field", "true" },
228:                        { "versionNumber.name", "versionNumber" },
229:                        { "versionNumber.required", "false" } };
230:
231:                Map items0 = (Map) ExporterTestUtils.traverseMap(sections,
232:                        "0.maintainableItems");
233:                ExporterTestUtils.comparePropertyStrings(items0,
234:                        expectedItemData0);
235:
236:                String[][] expectedItemData1 = {
237:                        { "section2Field1.field", "true" },
238:                        { "section2Field1.name", "section2Field1" },
239:                        { "section2Field1.required", "true" },
240:                        { "section2Field2.field", "true" },
241:                        { "section2Field2.name", "section2Field2" },
242:                        { "section2Field2.required", "false" } };
243:
244:                Map items2 = (Map) ExporterTestUtils.traverseMap(sections,
245:                        "1.maintainableItems");
246:                ExporterTestUtils.comparePropertyStrings(items2,
247:                        expectedItemData1);
248:
249:            }
250:
251:            /* utility methods */
252:            private Map mapAccountMaintenanceDocument() {
253:                Class entryClass = PaymentReasonCode.class;
254:
255:                MaintenanceDocumentEntry entry = dataDictionary
256:                        .getMaintenanceDocumentEntryForBusinessObjectClass(entryClass);
257:                MaintenanceDocumentEntryMapper mapper = new MaintenanceDocumentEntryMapper();
258:                Map map = mapper.mapEntry(entry).getExportData();
259:
260:                return map;
261:            }
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.