Source Code Cross Referenced for CollectorServiceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » 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.module.gl.service 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 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.module.gl.service;
017:
018:        import org.apache.commons.lang.StringUtils;
019:        import org.kuali.core.util.GlobalVariables;
020:        import org.kuali.kfs.KFSKeyConstants;
021:        import org.kuali.kfs.KFSConstants.SystemGroupParameterNames;
022:        import org.kuali.kfs.context.KualiTestBase;
023:        import org.kuali.kfs.context.SpringContext;
024:        import org.kuali.kfs.service.MockCollectorBatch;
025:        import org.kuali.kfs.service.ParameterService;
026:        import org.kuali.module.gl.batch.collector.CollectorStep;
027:        import org.kuali.module.gl.bo.CollectorDetail;
028:        import org.kuali.module.gl.bo.OriginEntryFull;
029:        import org.kuali.test.ConfigureContext;
030:
031:        // import org.kuali.test.suite.RelatesTo;
032:
033:        /**
034:         * Test the CollectorService.
035:         */
036:        @ConfigureContext
037:        public class CollectorServiceTest extends KualiTestBase {
038:            private ParameterService parameterService;
039:            private CollectorHelperService collectorHelperService;
040:
041:            /**
042:             * Initializes services needed by this test
043:             * @see junit.framework.TestCase#setUp()
044:             */
045:            @Override
046:            protected void setUp() throws Exception {
047:                super .setUp();
048:
049:                parameterService = SpringContext
050:                        .getBean(ParameterService.class);
051:                collectorHelperService = SpringContext
052:                        .getBean(CollectorHelperService.class);
053:            }
054:
055:            /**
056:             * Verifies system parameters needed to send the collector email exists.
057:             */
058:            // @RelatesTo(RelatesTo.JiraIssue.KULUT31)
059:            public final void testEmailSystemParametersExist() throws Exception {
060:                String subject = parameterService
061:                        .getParameterValue(
062:                                CollectorStep.class,
063:                                SystemGroupParameterNames.COLLECTOR_VALIDATOR_EMAIL_SUBJECT_PARAMETER_NAME);
064:                assertTrue(
065:                        "system parameter "
066:                                + SystemGroupParameterNames.COLLECTOR_VALIDATOR_EMAIL_SUBJECT_PARAMETER_NAME
067:                                + " is not setup or is empty", StringUtils
068:                                .isNotBlank(subject));
069:
070:                String[] documentTypes = parameterService
071:                        .getParameterValues(
072:                                CollectorStep.class,
073:                                SystemGroupParameterNames.COLLECTOR_EQUAL_DC_TOTAL_DOCUMENT_TYPES)
074:                        .toArray(new String[] {});
075:                assertTrue(
076:                        "system parameter "
077:                                + SystemGroupParameterNames.COLLECTOR_EQUAL_DC_TOTAL_DOCUMENT_TYPES
078:                                + " is not setup or is empty",
079:                        documentTypes.length > 0);
080:            }
081:
082:            /**
083:             * Verifies an error is added when the batch header is a duplicate (a batch loaded previously had the same header).
084:             */
085:            // @RelatesTo(RelatesTo.JiraIssue.KULUT31)
086:            public final void testPerformValidate_duplicateHeader()
087:                    throws Exception {
088:
089:            }
090:
091:            /**
092:             * Verifies an error is added when the batch entries contain multiple document types. Note: Actual test values here do not have
093:             * to be valid document types, only need to be different.
094:             */
095:            // @RelatesTo(RelatesTo.JiraIssue.KULUT31)
096:            public final void testPerformValidation_mixedDocumentTypes()
097:                    throws Exception {
098:                MockCollectorBatch collectorBatch = new MockCollectorBatch();
099:
100:                OriginEntryFull entry1 = new OriginEntryFull();
101:                entry1.setFinancialDocumentTypeCode("foo1");
102:                collectorBatch.addOriginEntry(entry1);
103:
104:                OriginEntryFull entry2 = new OriginEntryFull();
105:                entry2.setFinancialDocumentTypeCode("foo2");
106:                collectorBatch.addOriginEntry(entry2);
107:
108:                boolean isValid = collectorHelperService
109:                        .performValidation(collectorBatch);
110:                assertFalse(
111:                        "returned batch was valid but there were multiple document types",
112:                        isValid);
113:                assertTrue(
114:                        "error message for mixed document types does not exist",
115:                        GlobalVariables.getErrorMap().containsMessageKey(
116:                                KFSKeyConstants.Collector.MIXED_DOCUMENT_TYPES));
117:            }
118:
119:            /**
120:             * Verifies an error is added when a collector detail key does not have a matching gl entry. Note: Actual test values do have to
121:             * be valid, only need to be different from the gl record to the detail
122:             */
123:            // @RelatesTo(RelatesTo.JiraIssue.KULUT31)
124:            public final void testPerformValidation_unmatchedDetailKey()
125:                    throws Exception {
126:                MockCollectorBatch collectorBatch = new MockCollectorBatch();
127:
128:                OriginEntryFull entry = new OriginEntryFull();
129:                entry.setUniversityFiscalYear(new Integer(2007));
130:                entry.setChartOfAccountsCode("BA");
131:                entry.setAccountNumber("1912610");
132:                collectorBatch.addOriginEntry(entry);
133:
134:                CollectorDetail collectorDetail = new CollectorDetail();
135:                collectorDetail.setUniversityFiscalYear(new Integer(2007));
136:                collectorDetail.setChartOfAccountsCode("UA");
137:                collectorDetail.setAccountNumber("1912660");
138:                collectorBatch.addCollectorDetail(collectorDetail);
139:
140:                boolean isValid = collectorHelperService
141:                        .performValidation(collectorBatch);
142:                assertFalse(
143:                        "returned batch was valid but there was detail record without a matching gl entry",
144:                        isValid);
145:                assertTrue(
146:                        "error message for unmatched detail key does not exist",
147:                        GlobalVariables
148:                                .getErrorMap()
149:                                .containsMessageKey(
150:                                        KFSKeyConstants.Collector.NONMATCHING_DETAIL_KEY));
151:            }
152:
153:            /**
154:             * Verifies an error is added when the batch entries contain multiple balance types. Note: Actual test values here do not have
155:             * to be valid balance types, only need to be different.
156:             */
157:            // @RelatesTo(RelatesTo.JiraIssue.KULUT31)
158:            public final void testPerformValidation_mixedBalanceTypes()
159:                    throws Exception {
160:                MockCollectorBatch collectorBatch = new MockCollectorBatch();
161:
162:                OriginEntryFull entry1 = new OriginEntryFull();
163:                entry1.setFinancialBalanceTypeCode("AC");
164:                collectorBatch.addOriginEntry(entry1);
165:
166:                OriginEntryFull entry2 = new OriginEntryFull();
167:                entry2.setFinancialBalanceTypeCode("IE");
168:                collectorBatch.addOriginEntry(entry2);
169:
170:                boolean isValid = collectorHelperService
171:                        .performValidation(collectorBatch);
172:                assertFalse(
173:                        "returned batch was valid but there were multiple balance types",
174:                        isValid);
175:                assertTrue(
176:                        "error message for mixed balance types does not exist",
177:                        GlobalVariables.getErrorMap().containsMessageKey(
178:                                KFSKeyConstants.Collector.MIXED_BALANCE_TYPES));
179:            }
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.