Source Code Cross Referenced for ScrubberFlexibleOffsetTest.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 2006-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 java.util.Calendar;
019:
020:        import org.kuali.core.util.Guid;
021:        import org.kuali.kfs.KFSConstants;
022:        import org.kuali.kfs.context.SpringContext;
023:        import org.kuali.module.chart.bo.OffsetDefinition;
024:        import org.kuali.module.gl.OriginEntryTestBase;
025:        import org.kuali.module.gl.bo.OriginEntrySource;
026:        import org.kuali.test.ConfigureContext;
027:
028:        /**
029:         * Test Flexible Offset in the scrubber
030:         */
031:        @ConfigureContext
032:        public class ScrubberFlexibleOffsetTest extends OriginEntryTestBase {
033:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
034:                    .getLogger(ScrubberFlexibleOffsetTest.class);
035:
036:            private ScrubberService scrubberService;
037:
038:            /**
039:             * Sets up the services neede for this test and also sets the date/time service's date time to one minute before midnight January 1, 2006
040:             * @see org.kuali.module.gl.OriginEntryTestBase#setUp()
041:             */
042:            @Override
043:            protected void setUp() throws Exception {
044:                super .setUp();
045:
046:                scrubberService = SpringContext.getBean(ScrubberService.class);
047:                scrubberService.setDateTimeService(dateTimeService);
048:                // Get the test date time service so we can specify the date/time of the run
049:                Calendar c = Calendar.getInstance();
050:                c.set(Calendar.DAY_OF_MONTH, 1);
051:                c.set(Calendar.MONTH, Calendar.JANUARY);
052:                c.set(Calendar.YEAR, 2006);
053:
054:                // since the cutoff time is set to 10am (KFSP1/Scrubber+cutoff+time+configuration)
055:                // we want to ensure that the time is always after that time so the cutoff algorithm is not invoked
056:                c.set(Calendar.HOUR_OF_DAY, 23);
057:                c.set(Calendar.MINUTE, 59);
058:                c.set(Calendar.SECOND, 59);
059:
060:                date = c.getTime();
061:                dateTimeService.setCurrentDate(date);
062:            }
063:
064:            /**
065:             * Test to make sure that flexible offset is off when the flag is off
066:             * 
067:             * @throws Exception thrown if any exception is encountered for any reason
068:             */
069:            public void testNonFlexibleOffsetGeneration() throws Exception {
070:
071:                super 
072:                        .setApplicationConfigurationFlag(
073:                                OffsetDefinition.class,
074:                                KFSConstants.SystemGroupParameterNames.FLEXIBLE_OFFSET_ENABLED_FLAG,
075:                                false);
076:
077:                updateDocTypeForScrubberOffsetGeneration();
078:                setOffsetAccounts();
079:
080:                String[] input = new String[] {
081:                        "2007BA9120656-----4190---ACEX02DI  01NOFLEX001     00000TEST FLEXIBLE OFFSET - NO FLEX                    2000.00D2006-01-01          ----------                                       ",
082:                        "2007BA6044900-----4190---ACEX02DI  01NOFLEX002     00000TEST FLEXIBLE OFFSET - FLEX                       1000.00D2006-01-01          ----------                                       ",
083:                        "2007BL1023200-----4190---ACEX02DI  01NOFLEX003     00000TEST FLEXIBLE OFFSET - FLEX                       3000.00D2006-01-01          ----------                                       ",
084:                        "2007BL1023200-----7030---ACEX02DI  01NOFLEX004     00000TEST FLEXIBLE OFFSET - FLEX                       3500.00D2006-01-01          ----------                                       ",
085:                        "2007BL2331473-----4190---ACEX02DI  01NOFLEX005     00000TEST FLEXIBLE OFFSET - FLEX                       4000.00D2006-01-01          ----------                                       ", };
086:
087:                EntryHolder[] output = new EntryHolder[] {
088:                        new EntryHolder(
089:                                OriginEntrySource.BACKUP,
090:                                "2007BA9120656-----4190---ACEX02DI  01NOFLEX001     00000TEST FLEXIBLE OFFSET - NO FLEX                    2000.00D2006-01-01          ----------                                       "),
091:                        new EntryHolder(
092:                                OriginEntrySource.BACKUP,
093:                                "2007BA6044900-----4190---ACEX02DI  01NOFLEX002     00000TEST FLEXIBLE OFFSET - FLEX                       1000.00D2006-01-01          ----------                                       "),
094:                        new EntryHolder(
095:                                OriginEntrySource.BACKUP,
096:                                "2007BL1023200-----4190---ACEX02DI  01NOFLEX003     00000TEST FLEXIBLE OFFSET - FLEX                       3000.00D2006-01-01          ----------                                       "),
097:                        new EntryHolder(
098:                                OriginEntrySource.BACKUP,
099:                                "2007BL1023200-----7030---ACEX02DI  01NOFLEX004     00000TEST FLEXIBLE OFFSET - FLEX                       3500.00D2006-01-01          ----------                                       "),
100:                        new EntryHolder(
101:                                OriginEntrySource.BACKUP,
102:                                "2007BL2331473-----4190---ACEX02DI  01NOFLEX005     00000TEST FLEXIBLE OFFSET - FLEX                       4000.00D2006-01-01          ----------                                       "),
103:                        new EntryHolder(
104:                                OriginEntrySource.SCRUBBER_VALID,
105:                                "2007BA9120656-----4190---ACEX02DI  01NOFLEX001     00000TEST FLEXIBLE OFFSET - NO FLEX                    2000.00D2006-01-01          ----------                                       "),
106:                        new EntryHolder(
107:                                OriginEntrySource.SCRUBBER_VALID,
108:                                "2007BA9120656-----8000---ACAS02DI  01NOFLEX001     00000GENERATED OFFSET                                  2000.00C2006-01-01          ----------                                       "),
109:                        new EntryHolder(
110:                                OriginEntrySource.SCRUBBER_VALID,
111:                                "2007BA6044900-----4190---ACEX02DI  01NOFLEX002     00000TEST FLEXIBLE OFFSET - FLEX                       1000.00D2006-01-01          ----------                                       "),
112:                        new EntryHolder(
113:                                OriginEntrySource.SCRUBBER_VALID,
114:                                "2007BA6044900-----8000---ACAS02DI  01NOFLEX002     00000GENERATED OFFSET                                  1000.00C2006-01-01          ----------                                       "),
115:                        new EntryHolder(
116:                                OriginEntrySource.SCRUBBER_VALID,
117:                                "2007BL1023200-----4190---ACEX02DI  01NOFLEX003     00000TEST FLEXIBLE OFFSET - FLEX                       3000.00D2006-01-01          ----------                                       "),
118:                        new EntryHolder(
119:                                OriginEntrySource.SCRUBBER_VALID,
120:                                "2007BL1023200-----8000---ACAS02DI  01NOFLEX003     00000GENERATED OFFSET                                  3000.00C2006-01-01          ----------                                       "),
121:                        new EntryHolder(
122:                                OriginEntrySource.SCRUBBER_VALID,
123:                                "2007BL9520004-----8611---ACAS02DI  01NOFLEX004     00000GENERATED CAPITALIZATION                          3500.00D2006-01-01          ----------                                       "),
124:                        new EntryHolder(
125:                                OriginEntrySource.SCRUBBER_VALID,
126:                                "2007BL9520004-----9899---ACFB02DI  01NOFLEX004     00000GENERATED CAPITALIZATION                          3500.00C2006-01-01          ----------                                       "),
127:                        new EntryHolder(
128:                                OriginEntrySource.SCRUBBER_VALID,
129:                                "2007BL1023200-----7030---ACEX02DI  01NOFLEX004     00000TEST FLEXIBLE OFFSET - FLEX                       3500.00D2006-01-01          ----------                                       "),
130:                        new EntryHolder(
131:                                OriginEntrySource.SCRUBBER_VALID,
132:                                "2007BL1023200-----8000---ACAS02DI  01NOFLEX004     00000GENERATED OFFSET                                  3500.00C2006-01-01          ----------                                       "),
133:                        new EntryHolder(
134:                                OriginEntrySource.SCRUBBER_VALID,
135:                                "2007BL2331473-----4190---ACEX02DI  01NOFLEX005     00000TEST FLEXIBLE OFFSET - FLEX                       4000.00D2006-01-01          ----------                                       "),
136:                        new EntryHolder(
137:                                OriginEntrySource.SCRUBBER_VALID,
138:                                "2007BL2331473-----8000---ACAS02DI  01NOFLEX005     00000GENERATED OFFSET                                  4000.00C2006-01-01          ----------                                       "), };
139:
140:                scrub(input);
141:                assertOriginEntries(4, output);
142:            }
143:
144:            ///**
145:            // * Test it when the flag is on
146:            // * 
147:            // * @throws Exception thrown if any exception is encountered for any reason
148:            // */
149:            // This test works in Eclipse, but not in Anthil
150:            // public void testFlexibleOffsetGeneration() throws Exception {
151:            //
152:            // resetFlexibleOffsetEnableFlag(true);
153:            //
154:            // updateDocTypeForScrubberOffsetGeneration();
155:            // setOffsetAccounts();
156:            //
157:            // String[] input = new String[] {
158:            // "2007BA9120656-----4190---ACEX02DI  01NOFLEX00100000TEST FLEXIBLE OFFSET - NO FLEX 2000.00D2006-01-01 ---------- ",
159:            // "2007BA6044900-----4190---ACEX02DI  01NOFLEX00200000TEST FLEXIBLE OFFSET - FLEX 1000.00D2006-01-01 ---------- ",
160:            // "2007BL1023200-----4190---ACEX02DI  01NOFLEX00300000TEST FLEXIBLE OFFSET - FLEX 3000.00D2006-01-01 ---------- ",
161:            // "2007BL1023200-----7030---ACEX02DI  01NOFLEX00400000TEST FLEXIBLE OFFSET - FLEX 3500.00D2006-01-01 ---------- ",
162:            // "2007BL2331473-----4190---ACEX02DI  01NOFLEX00500000TEST FLEXIBLE OFFSET - FLEX 4000.00D2006-01-01 ---------- ",
163:            // };
164:            //
165:            // EntryHolder[] output = new EntryHolder[] {
166:            // new EntryHolder(OriginEntrySource.BACKUP, "2007BA9120656-----4190---ACEX02DI  01NOFLEX00100000TEST FLEXIBLE OFFSET - NO FLEX
167:            // 2000.00D2006-01-01 ---------- "),
168:            // new EntryHolder(OriginEntrySource.BACKUP, "2007BA6044900-----4190---ACEX02DI  01NOFLEX00200000TEST FLEXIBLE OFFSET - FLEX
169:            // 1000.00D2006-01-01 ---------- "),
170:            // new EntryHolder(OriginEntrySource.BACKUP, "2007BL1023200-----4190---ACEX02DI  01NOFLEX00300000TEST FLEXIBLE OFFSET - FLEX
171:            // 3000.00D2006-01-01 ---------- "),
172:            // new EntryHolder(OriginEntrySource.BACKUP, "2007BL1023200-----7030---ACEX02DI  01NOFLEX00400000TEST FLEXIBLE OFFSET - FLEX
173:            // 3500.00D2006-01-01 ---------- "),
174:            // new EntryHolder(OriginEntrySource.BACKUP, "2007BL2331473-----4190---ACEX02DI  01NOFLEX00500000TEST FLEXIBLE OFFSET - FLEX
175:            // 4000.00D2006-01-01 ---------- "),
176:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BA9120656-----4190---ACEX02DI  01NOFLEX00100000TEST FLEXIBLE OFFSET -
177:            // NO FLEX 2000.00D2006-01-01 ---------- "),
178:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BA9120656-----8000---ACAS02DI  01NOFLEX00100000GENERATED OFFSET
179:            // 2000.00C2006-01-01 ---------- "),
180:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BA6044900-----4190---ACEX02DI  01NOFLEX00200000TEST FLEXIBLE OFFSET -
181:            // FLEX 1000.00D2006-01-01 ---------- "),
182:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BL2231402-----8000---ACAS02DI  01NOFLEX00200000GENERATED OFFSET
183:            // 1000.00C2006-01-01 ---------- "),
184:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BL1023200-----4190---ACEX02DI  01NOFLEX00300000TEST FLEXIBLE OFFSET -
185:            // FLEX 3000.00D2006-01-01 ---------- "),
186:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BL1023200-----8000---ACAS02DI  01NOFLEX00300000GENERATED OFFSET
187:            // 3000.00C2006-01-01 ---------- "),
188:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BL9520004-----8611---ACAS02DI  01NOFLEX00400000GENERATED
189:            // CAPITALIZATION 3500.00D2006-01-01 ---------- "),
190:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BL2231419-----9899---ACFB02DI  01NOFLEX00400000GENERATED
191:            // CAPITALIZATION 3500.00C2006-01-01 ---------- "),
192:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BL1023200-----7030---ACEX02DI  01NOFLEX00400000TEST FLEXIBLE OFFSET -
193:            // FLEX 3500.00D2006-01-01 ---------- "),
194:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BL1023200-----8000---ACAS02DI  01NOFLEX00400000GENERATED OFFSET
195:            // 3500.00C2006-01-01 ---------- "),
196:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BL2331473-----4190---ACEX02DI  01NOFLEX00500000TEST FLEXIBLE OFFSET -
197:            // FLEX 4000.00D2006-01-01 ---------- "),
198:            // new EntryHolder(OriginEntrySource.SCRUBBER_VALID, "2007BA9120657-----8000---ACAS02DI  01NOFLEX00500000GENERATED OFFSET
199:            // 4000.00C2006-01-01 ---------- "),
200:            // };
201:            //
202:            // scrub(input);
203:            // assertOriginEntries(4, output);
204:            // }
205:            /**
206:             * Updates the DI   doc type, so that scrubber offsets are generated
207:             */
208:            private void updateDocTypeForScrubberOffsetGeneration() {
209:                unitTestSqlDao
210:                        .sqlCommand("update fp_doc_type_t set TRN_SCRBBR_OFST_GEN_IND = 'Y' where fdoc_typ_cd = 'DI'");
211:            }
212:
213:            /**
214:             * Creates offset account fixtures for the test
215:             */
216:            private void setOffsetAccounts() {
217:                unitTestSqlDao
218:                        .sqlCommand("insert into FP_OFST_ACCT_T (FIN_COA_CD,OBJ_ID,ACCOUNT_NBR,FIN_OFST_OBJ_CD,FIN_OFST_COA_CD,FIN_OFST_ACCT_NBR) values ('BL','"
219:                                + new Guid().toString()
220:                                + "','2331473','8000','BA','9120657')");
221:                unitTestSqlDao
222:                        .sqlCommand("insert into FP_OFST_ACCT_T (FIN_COA_CD,OBJ_ID,ACCOUNT_NBR,FIN_OFST_OBJ_CD,FIN_OFST_COA_CD,FIN_OFST_ACCT_NBR) values ('BA','"
223:                                + new Guid().toString()
224:                                + "','6044900','8000','BL','2231402')");
225:                unitTestSqlDao
226:                        .sqlCommand("insert into FP_OFST_ACCT_T (FIN_COA_CD,OBJ_ID,ACCOUNT_NBR,FIN_OFST_OBJ_CD,FIN_OFST_COA_CD,FIN_OFST_ACCT_NBR) values ('BL','"
227:                                + new Guid().toString()
228:                                + "','1023200','9040','BL','2231419')");
229:                unitTestSqlDao
230:                        .sqlCommand("insert into FP_OFST_ACCT_T (FIN_COA_CD,OBJ_ID,ACCOUNT_NBR,FIN_OFST_OBJ_CD,FIN_OFST_COA_CD,FIN_OFST_ACCT_NBR) values ('BL','"
231:                                + new Guid().toString()
232:                                + "','9520004','9899','BL','2231419')");
233:            }
234:
235:            /**
236:             * Runs the scrubber on a given array of transactions
237:             * 
238:             * @param inputTransactions String-formatted entries
239:             */
240:            private void scrub(String[] inputTransactions) {
241:                clearOriginEntryTables();
242:                loadInputTransactions(OriginEntrySource.BACKUP,
243:                        inputTransactions, date);
244:                persistenceService.clearCache();
245:                scrubberService.scrubEntries();
246:            }
247:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.