Source Code Cross Referenced for ForwardEncumbranceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » batch » 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.batch 
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.batch;
017:
018:        import java.util.Calendar;
019:        import java.util.GregorianCalendar;
020:
021:        import org.kuali.core.util.KualiDecimal;
022:        import org.kuali.kfs.KFSConstants;
023:        import org.kuali.kfs.context.SpringContext;
024:        import org.kuali.module.chart.service.A21SubAccountService;
025:        import org.kuali.module.chart.service.PriorYearAccountService;
026:        import org.kuali.module.chart.service.SubFundGroupService;
027:        import org.kuali.module.financial.service.UniversityDateService;
028:        import org.kuali.module.gl.OriginEntryTestBase;
029:        import org.kuali.module.gl.batch.closing.year.service.impl.helper.EncumbranceClosingRuleHelper;
030:        import org.kuali.module.gl.batch.closing.year.util.EncumbranceClosingOriginEntryFactory;
031:        import org.kuali.module.gl.bo.Encumbrance;
032:        import org.kuali.module.gl.util.OriginEntryOffsetPair;
033:        import org.kuali.test.ConfigureContext;
034:
035:        /**
036:         * Tests that the forward encumbrance process is generating cost share encumbrance forwarding origin entries correctly
037:         */
038:        @ConfigureContext
039:        public class ForwardEncumbranceTest extends OriginEntryTestBase {
040:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
041:                    .getLogger(ForwardEncumbranceTest.class);
042:
043:            /**
044:             * An enum with a set of encumbrances to test; here, we've only got one encumbrance, an encumbrance
045:             * that should force forward encumbrances to generate a cost share forwarding entry/offset pair
046:             */
047:            enum ENCUMBRANCE_FIXTURE {
048:                COST_SHARE_ENCUMBRANCE("BL", "4531413", "CS001", "7100", "EX",
049:                        "EE");
050:
051:                // to find account: select ca_prior_yr_acct_t.fin_coa_cd, ca_prior_yr_acct_t.ACCOUNT_NBR, CA_A21_SUB_ACCT_T.sub_acct_nbr
052:                // from (ca_prior_yr_acct_t join ca_sub_fund_grp_t on ca_prior_yr_acct_t.SUB_FUND_GRP_CD =
053:                // ca_sub_fund_grp_t.SUB_FUND_GRP_CD) join CA_A21_SUB_ACCT_T on CA_PRIOR_YR_ACCT_T.fin_coa_cd = CA_A21_SUB_ACCT_T.fin_coa_cd
054:                // and CA_PRIOR_YR_ACCT_T.account_nbr = CA_A21_SUB_ACCT_T.account_nbr where ca_sub_fund_grp_t.FUND_GRP_CD = 'CG' and
055:                // CA_A21_SUB_ACCT_T.sub_acct_typ_cd = 'CS'
056:                // this was a rough one, it needed a cost share sub account and a CG sub fund group fund group type
057:
058:                private String chart;
059:                private String accountNumber;
060:                private String subAccountNumber;
061:                private String objectCode;
062:                private String balanceType;
063:                private String objectTypeCode;
064:
065:                /**
066:                 * Constructs a ForwardEncumbranceTest.ENCUMBRANCE_FIXTURE
067:                 * @param chart the chart of the encumbrance
068:                 * @param accountNumber the account of the encumbrance
069:                 * @param subAccountNumber the sub account of the encumbrance
070:                 * @param objectCode the object code of the encumbrance
071:                 * @param balanceType the balance type code of the encumbrance
072:                 * @param objectTypeCode the object type code of the encumbrance
073:                 */
074:                private ENCUMBRANCE_FIXTURE(String chart, String accountNumber,
075:                        String subAccountNumber, String objectCode,
076:                        String balanceType, String objectTypeCode) {
077:                    this .chart = chart;
078:                    this .accountNumber = accountNumber;
079:                    this .subAccountNumber = subAccountNumber;
080:                    this .objectCode = objectCode;
081:                    this .balanceType = balanceType;
082:                    this .objectTypeCode = objectTypeCode;
083:                }
084:
085:                /**
086:                 * Converts one of the members of this enum to an actual Encumbrance
087:                 * 
088:                 * @return a real encumbrance!
089:                 */
090:                public Encumbrance convertToEncumbrance() {
091:                    Encumbrance e = new Encumbrance();
092:                    Integer fy = new Integer(SpringContext.getBean(
093:                            UniversityDateService.class).getCurrentFiscalYear()
094:                            .intValue() - 1);
095:                    e.setUniversityFiscalYear(fy);
096:                    e.setChartOfAccountsCode(chart);
097:                    e.setAccountNumber(accountNumber);
098:                    e.setSubAccountNumber(subAccountNumber);
099:                    e.setObjectCode(objectCode);
100:                    e.setSubObjectCode(KFSConstants
101:                            .getDashFinancialSubObjectCode());
102:                    e.setBalanceTypeCode(balanceType);
103:                    e.setDocumentTypeCode("EXEN"); // we don't need this field
104:                    e.setOriginCode("EP");
105:                    e.setDocumentNumber("000001"); // we don't need this field
106:                    GregorianCalendar lastYear = new GregorianCalendar();
107:                    lastYear.add(Calendar.YEAR, -1);
108:                    e.setTransactionEncumbranceDate(new java.sql.Date(lastYear
109:                            .getTimeInMillis()));
110:                    e
111:                            .setTransactionEncumbranceDescription("MONKEYS-R-US IS THE NEWEST AND GREATEST STORE IN THE ENTIRE TRI-STATE AREA");
112:                    e.setAccountLineEncumbranceAmount(new KualiDecimal(1000));
113:                    e.setAccountLineEncumbranceClosedAmount(KualiDecimal.ZERO);
114:                    return e;
115:                }
116:
117:                /**
118:                 * Returns the object type code of this enum
119:                 * 
120:                 * @return this enum's object type code
121:                 */
122:                public String getObjectType() {
123:                    return this .objectTypeCode;
124:                }
125:            }
126:
127:            /**
128:             * Tests that the expected encumbrance fixtures would be selected by the forward encumbrance process
129:             */
130:            public void testEncumbranceSelection() {
131:                EncumbranceClosingRuleHelper helper = new EncumbranceClosingRuleHelper();
132:                helper.setA21SubAccountService(SpringContext
133:                        .getBean(A21SubAccountService.class));
134:                helper.setKualiConfigurationService(kualiConfigurationService);
135:                helper.setPriorYearAccountService(SpringContext
136:                        .getBean(PriorYearAccountService.class));
137:                helper.setSubFundGroupService(SpringContext
138:                        .getBean(SubFundGroupService.class));
139:
140:                assertTrue(helper
141:                        .anEntryShouldBeCreatedForThisEncumbrance(ENCUMBRANCE_FIXTURE.COST_SHARE_ENCUMBRANCE
142:                                .convertToEncumbrance()));
143:            }
144:
145:            /**
146:             * Tests that the expted fixtures would be selected for cost share entry/offset generation by the forward encumbrance process
147:             * 
148:             * @throws Exception thrown if something goes wrong
149:             */
150:            public void testCostShareSelection() throws Exception {
151:                EncumbranceClosingRuleHelper helper = new EncumbranceClosingRuleHelper();
152:                helper.setA21SubAccountService(SpringContext
153:                        .getBean(A21SubAccountService.class));
154:                helper.setKualiConfigurationService(kualiConfigurationService);
155:                helper.setPriorYearAccountService(SpringContext
156:                        .getBean(PriorYearAccountService.class));
157:                helper.setSubFundGroupService(SpringContext
158:                        .getBean(SubFundGroupService.class));
159:
160:                Encumbrance encumbrance = ENCUMBRANCE_FIXTURE.COST_SHARE_ENCUMBRANCE
161:                        .convertToEncumbrance();
162:                OriginEntryOffsetPair entryPair = EncumbranceClosingOriginEntryFactory
163:                        .createBeginningBalanceEntryOffsetPair(encumbrance,
164:                                SpringContext.getBean(
165:                                        UniversityDateService.class)
166:                                        .getCurrentFiscalYear(),
167:                                new java.sql.Date(new GregorianCalendar()
168:                                        .getTimeInMillis()));
169:
170:                assertTrue(helper.isEncumbranceEligibleForCostShare(entryPair
171:                        .getEntry(), entryPair.getOffset(), encumbrance,
172:                        ENCUMBRANCE_FIXTURE.COST_SHARE_ENCUMBRANCE
173:                                .getObjectType()));
174:
175:                OriginEntryOffsetPair costShareEntryPair = EncumbranceClosingOriginEntryFactory
176:                        .createCostShareBeginningBalanceEntryOffsetPair(
177:                                encumbrance, new java.sql.Date(
178:                                        new GregorianCalendar()
179:                                                .getTimeInMillis()));
180:                LOG.info(costShareEntryPair.getEntry().getLine());
181:                LOG.info(costShareEntryPair.getOffset().getLine());
182:
183:                assertTrue(costShareEntryPair.getOffset().getLine().indexOf(
184:                        "GENERATED") >= 0);
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.