Source Code Cross Referenced for DataDictionaryServiceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » core » service » 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.service 
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.service;
017:
018:        import java.util.LinkedHashMap;
019:        import java.util.Map;
020:
021:        import org.kuali.core.datadictionary.DataDictionary;
022:        import org.kuali.core.document.DocumentBase;
023:        import org.kuali.core.document.MaintenanceDocument;
024:        import org.kuali.core.document.MaintenanceDocumentBase;
025:        import org.kuali.kfs.context.KualiTestBase;
026:        import org.kuali.kfs.context.SpringContext;
027:        import org.kuali.module.financial.document.InternalBillingDocument;
028:        import org.kuali.test.ConfigureContext;
029:
030:        /**
031:         * This class tests the DataDictionary service. It tests the actual service, after letting Spring initialize it using whatever
032:         * configuration information is in the current, project-wide Spring config file(s)
033:         */
034:        @ConfigureContext
035:        public class DataDictionaryServiceTest extends KualiTestBase {
036:
037:            public final void testGetDataDictionary() {
038:                DataDictionary dataDictionary = SpringContext.getBean(
039:                        DataDictionaryService.class).getDataDictionary();
040:                assertNotNull(dataDictionary);
041:
042:                Map businessObjectEntries = dataDictionary
043:                        .getBusinessObjectEntries();
044:                assertNotNull(businessObjectEntries);
045:
046:                Map documentEntries = dataDictionary.getDocumentEntries();
047:                assertNotNull(documentEntries);
048:            }
049:
050:            public final void testGetDocumentClassByTypeName_nullName() {
051:                boolean failedAsExpected = false;
052:
053:                try {
054:                    SpringContext.getBean(DataDictionaryService.class)
055:                            .getDocumentClassByTypeName(null);
056:                } catch (IllegalArgumentException e) {
057:                    failedAsExpected = true;
058:                }
059:
060:                assertTrue(failedAsExpected);
061:            }
062:
063:            public final void testGetDocumentClassByTypeName_blankName() {
064:                boolean failedAsExpected = false;
065:
066:                try {
067:                    SpringContext.getBean(DataDictionaryService.class)
068:                            .getDocumentClassByTypeName("  ");
069:                } catch (IllegalArgumentException e) {
070:                    failedAsExpected = true;
071:                }
072:
073:                assertTrue(failedAsExpected);
074:            }
075:
076:            public final void testGetDocumentClassByTypeName_unknownName() {
077:                Class clazz = SpringContext
078:                        .getBean(DataDictionaryService.class)
079:                        .getDocumentClassByTypeName("foo");
080:
081:                assertNull(clazz);
082:            }
083:
084:            public final void testGetDocumentClassByTypeName_knownNameTransactionalDocument() {
085:                Class clazz = SpringContext
086:                        .getBean(DataDictionaryService.class)
087:                        .getDocumentClassByTypeName("InternalBillingDocument");
088:
089:                assertEquals(InternalBillingDocument.class, clazz);
090:            }
091:
092:            public final void testGetDocumentClassByTypeName_knownNameMaintenanceDocument() {
093:                boolean passedAsExpected = false;
094:
095:                Class clazz = SpringContext
096:                        .getBean(DataDictionaryService.class)
097:                        .getDocumentClassByTypeName(
098:                                "SubAccountMaintenanceDocument");
099:
100:                try {
101:                    MaintenanceDocument clazzInstance = (MaintenanceDocument) clazz
102:                            .newInstance();
103:                    passedAsExpected = (clazzInstance instanceof  MaintenanceDocumentBase);
104:                } catch (Exception e) {
105:                    passedAsExpected = false;
106:                }
107:
108:                assertTrue(
109:                        "getClassByName failed for known maintenanceDocument type",
110:                        passedAsExpected);
111:            }
112:
113:            public final void testGetDocumentTypeCodeByTypeName_nullName() {
114:                try {
115:                    SpringContext.getBean(DataDictionaryService.class)
116:                            .getDocumentTypeCodeByTypeName(null);
117:                    fail("got null type name");
118:                } catch (IllegalArgumentException e) {
119:                    // good
120:                }
121:            }
122:
123:            public final void testGetDocumentTypeCodeByTypeName_blankName() {
124:                try {
125:                    SpringContext.getBean(DataDictionaryService.class)
126:                            .getDocumentTypeCodeByTypeName("  ");
127:                    fail("got blank type name");
128:                } catch (IllegalArgumentException e) {
129:                    // good
130:                }
131:            }
132:
133:            public final void testGetDocumentTypeCodeByTypeName_unknownName() {
134:                assertNull(SpringContext.getBean(DataDictionaryService.class)
135:                        .getDocumentTypeCodeByTypeName("foo"));
136:            }
137:
138:            public final void testGetDocumentTypeCodeByTypeName_knownNameTransactionalDocument() {
139:                assertEquals("IB", SpringContext.getBean(
140:                        DataDictionaryService.class)
141:                        .getDocumentTypeCodeByTypeName(
142:                                "InternalBillingDocument"));
143:            }
144:
145:            public final void testGetDocumentTypeCodeByTypeName_knownNameMaintenanceDocument() {
146:                assertEquals("SACC", SpringContext.getBean(
147:                        DataDictionaryService.class)
148:                        .getDocumentTypeCodeByTypeName(
149:                                "SubAccountMaintenanceDocument"));
150:            }
151:
152:            public final void testGetDocumentTypeNameByClass_nullClass() {
153:                boolean failedAsExpected = false;
154:
155:                try {
156:                    SpringContext.getBean(DataDictionaryService.class)
157:                            .getDocumentTypeNameByClass(null);
158:                } catch (IllegalArgumentException e) {
159:                    failedAsExpected = true;
160:                }
161:
162:                assertTrue(failedAsExpected);
163:            }
164:
165:            public final void testGetDocumentTypeNameByClass_nonDocClass() {
166:                boolean failedAsExpected = false;
167:
168:                try {
169:                    SpringContext.getBean(DataDictionaryService.class)
170:                            .getDocumentTypeNameByClass(Integer.class);
171:                } catch (IllegalArgumentException e) {
172:                    failedAsExpected = true;
173:                }
174:
175:                assertTrue(failedAsExpected);
176:            }
177:
178:            public final void testGetDocumentTypeNameByClass_unknownDocClass() {
179:                String documentTypeName = SpringContext.getBean(
180:                        DataDictionaryService.class)
181:                        .getDocumentTypeNameByClass(MockDocument.class);
182:
183:                assertNull(documentTypeName);
184:            }
185:
186:            public final void testGetDocumentTypeNameByClass_knownTransactionalDocument() {
187:                String documentTypeName = SpringContext.getBean(
188:                        DataDictionaryService.class)
189:                        .getDocumentTypeNameByClass(
190:                                InternalBillingDocument.class);
191:
192:                assertEquals("InternalBillingDocument", documentTypeName);
193:            }
194:
195:            private static class MockDocument extends DocumentBase {
196:                @Override
197:                public final void populateDocumentForRouting() {
198:                    throw new UnsupportedOperationException();
199:                }
200:
201:                protected LinkedHashMap toStringMapper() {
202:                    return new LinkedHashMap();
203:                }
204:
205:                public boolean getAllowsCopy() {
206:                    return false;
207:                }
208:            }
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.