Source Code Cross Referenced for GeneralLedgerPendingEntryServiceTest.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 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.module.gl.service;
017:
018:        import java.util.Iterator;
019:
020:        import org.kuali.core.service.DateTimeService;
021:        import org.kuali.core.util.KualiDecimal;
022:        import org.kuali.kfs.KFSConstants;
023:        import org.kuali.kfs.bo.GeneralLedgerPendingEntry;
024:        import org.kuali.kfs.context.KualiTestBase;
025:        import org.kuali.kfs.context.SpringContext;
026:        import org.kuali.kfs.service.GeneralLedgerPendingEntryService;
027:        import org.kuali.test.ConfigureContext;
028:
029:        /**
030:         * This class tests the GeneralLedgerPending service.
031:         */
032:        @ConfigureContext
033:        public class GeneralLedgerPendingEntryServiceTest extends KualiTestBase {
034:            private GeneralLedgerPendingEntryService generalLedgerPendingEntryService;
035:            private final String docHeaderId = "1003";
036:
037:            /**
038:             * Initalizes the services needef or this test; also, since this test creates a fake document, deletes
039:             * any entries from the real version of that document if they exist
040:             * @see junit.framework.TestCase#setUp()
041:             */
042:            @Override
043:            protected void setUp() throws Exception {
044:                super .setUp();
045:
046:                if (generalLedgerPendingEntryService == null) {
047:                    generalLedgerPendingEntryService = SpringContext
048:                            .getBean(GeneralLedgerPendingEntryService.class);
049:                }
050:                // Make sure the document doesn't exist before each test
051:                generalLedgerPendingEntryService.delete(docHeaderId);
052:            }
053:
054:            /**
055:             * Tests that pending entries are saved and retrieved properly
056:             * 
057:             * @throws Exception thrown if any exception is encountered for any reason
058:             */
059:            public void testSave() throws Exception {
060:                GeneralLedgerPendingEntry testEntry = this 
061:                        .createGeneralLedgerPendingEntry();
062:                generalLedgerPendingEntryService.save(testEntry);
063:                GeneralLedgerPendingEntry generalLedgerPendingEntry = generalLedgerPendingEntryService
064:                        .getByPrimaryId(testEntry
065:                                .getTransactionLedgerEntrySequenceNumber(),
066:                                docHeaderId);
067:                assertNotNull("Save didn't save this entry",
068:                        generalLedgerPendingEntry);
069:                generalLedgerPendingEntryService.delete(docHeaderId);
070:            }
071:
072:            /**
073:             * Covers GeneralPendingLedgerEntryService.getByPrimaryId (though, yeah, testSave does too, technically)
074:             * 
075:             * @throws Exception thrown if any exception is encountered for any reason
076:             */
077:            public void testGetByPrimaryId() throws Exception {
078:                GeneralLedgerPendingEntry testEntry = this 
079:                        .createGeneralLedgerPendingEntry();
080:                generalLedgerPendingEntryService.save(testEntry);
081:                GeneralLedgerPendingEntry generalLedgerPendingEntry = generalLedgerPendingEntryService
082:                        .getByPrimaryId(testEntry
083:                                .getTransactionLedgerEntrySequenceNumber(),
084:                                docHeaderId);
085:                assertNotNull("getByPrimaryId didn't get this entry",
086:                        generalLedgerPendingEntry);
087:                generalLedgerPendingEntryService.delete(docHeaderId);
088:            }
089:
090:            /**
091:             * Covers GeneralLedgerPendingEntryService.delete
092:             * 
093:             * @throws Exception thrown if any exception is encountered for any reason
094:             */
095:            public void testDelete() throws Exception {
096:                GeneralLedgerPendingEntry generalLedgerPendingEntry = this 
097:                        .createGeneralLedgerPendingEntry();
098:                generalLedgerPendingEntryService
099:                        .save(generalLedgerPendingEntry);
100:                generalLedgerPendingEntryService.delete(docHeaderId);
101:                generalLedgerPendingEntry = generalLedgerPendingEntryService
102:                        .getByPrimaryId(generalLedgerPendingEntry
103:                                .getTransactionLedgerEntrySequenceNumber(),
104:                                docHeaderId);
105:                assertNull("Delete didn't delete this entry",
106:                        generalLedgerPendingEntry);
107:            }
108:
109:            /**
110:             * Covers GeneralLedgerPendingEntryService.findApprovedPendingLedgerEntries
111:             */
112:            public void testFindApprovedPendingLedgerEntries() {
113:                try {
114:                    GeneralLedgerPendingEntry generalLedgerPendingEntry = this 
115:                            .createGeneralLedgerPendingEntry();
116:                    generalLedgerPendingEntryService
117:                            .save(generalLedgerPendingEntry);
118:
119:                    Iterator entries = generalLedgerPendingEntryService
120:                            .findApprovedPendingLedgerEntries();
121:
122:                    int counter = 0;
123:                    while (entries.hasNext()) {
124:                        generalLedgerPendingEntry = (GeneralLedgerPendingEntry) (entries
125:                                .next());
126:                        ++counter;
127:
128:                        System.out
129:                                .println(counter
130:                                        + ":"
131:                                        + generalLedgerPendingEntry
132:                                                .getDocumentNumber());
133:                    }
134:                } catch (Exception e) {
135:                    assertTrue("Failed to fetch all entries", true);
136:                } finally {
137:                    generalLedgerPendingEntryService.delete(docHeaderId);
138:                }
139:            }
140:
141:            /**
142:             * Creates a pending entry fixture
143:             * 
144:             * @return a pending entry to test against
145:             */
146:            private GeneralLedgerPendingEntry createGeneralLedgerPendingEntry() {
147:                GeneralLedgerPendingEntry generalLedgerPendingEntry = new GeneralLedgerPendingEntry();
148:
149:                generalLedgerPendingEntry
150:                        .setFinancialSystemOriginationCode("01");
151:                generalLedgerPendingEntry.setDocumentNumber(docHeaderId);
152:                generalLedgerPendingEntry.setChartOfAccountsCode("BA");
153:                generalLedgerPendingEntry.setFinancialObjectCode("1130");
154:                generalLedgerPendingEntry.setFinancialBalanceTypeCode("AX");
155:                generalLedgerPendingEntry.setFinancialObjectTypeCode("AS");
156:                generalLedgerPendingEntry.setUniversityFiscalYear(new Integer(
157:                        2005));
158:                generalLedgerPendingEntry.setUniversityFiscalPeriodCode("7");
159:                generalLedgerPendingEntry
160:                        .setTransactionLedgerEntryAmount(new KualiDecimal("8.8"));
161:                generalLedgerPendingEntry
162:                        .setTransactionLedgerEntryDescription("9");
163:                generalLedgerPendingEntry.setTransactionDebitCreditCode("D");
164:                generalLedgerPendingEntry.setTransactionDate(new java.sql.Date(
165:                        SpringContext.getBean(DateTimeService.class)
166:                                .getCurrentDate().getTime()));
167:                generalLedgerPendingEntry.setFinancialDocumentTypeCode("12");
168:                generalLedgerPendingEntry
169:                        .setTransactionLedgerEntrySequenceNumber(new Integer(1));
170:                generalLedgerPendingEntry
171:                        .setFinancialDocumentApprovedCode(KFSConstants.PENDING_ENTRY_APPROVED_STATUS_CODE.APPROVED);
172:                return generalLedgerPendingEntry;
173:            }
174:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.