Source Code Cross Referenced for AuxiliaryVoucherDocumentTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » financial » document » 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.financial.document 
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.financial.document;
017:
018:        import static org.kuali.kfs.KFSConstants.GL_CREDIT_CODE;
019:        import static org.kuali.kfs.KFSConstants.GL_DEBIT_CODE;
020:        import static org.kuali.module.financial.document.AccountingDocumentTestUtils.testGetNewDocument_byDocumentClass;
021:        import static org.kuali.test.fixtures.AccountingLineFixture.LINE15;
022:        import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
023:
024:        import java.util.ArrayList;
025:        import java.util.List;
026:
027:        import org.kuali.core.document.Document;
028:        import org.kuali.core.service.DataDictionaryService;
029:        import org.kuali.core.service.DocumentService;
030:        import org.kuali.core.service.TransactionalDocumentDictionaryService;
031:        import org.kuali.kfs.bo.SourceAccountingLine;
032:        import org.kuali.kfs.bo.TargetAccountingLine;
033:        import org.kuali.kfs.context.KualiTestBase;
034:        import org.kuali.kfs.context.SpringContext;
035:        import org.kuali.test.ConfigureContext;
036:        import org.kuali.test.DocumentTestUtils;
037:        import org.kuali.test.fixtures.AccountingLineFixture;
038:
039:        /**
040:         * This class is used to test NonCheckDisbursementDocumentTest.
041:         */
042:        @ConfigureContext(session=KHUNTLEY)
043:        public class AuxiliaryVoucherDocumentTest extends KualiTestBase {
044:
045:            public static final Class<AuxiliaryVoucherDocument> DOCUMENT_CLASS = AuxiliaryVoucherDocument.class;
046:
047:            private Document getDocumentParameterFixture() throws Exception {
048:                // AV document has a restriction on accounting period cannot be more than 2 periods behind current
049:                return DocumentTestUtils.createDocument(SpringContext
050:                        .getBean(DocumentService.class),
051:                        AuxiliaryVoucherDocument.class);
052:            }
053:
054:            private List<AccountingLineFixture> getSourceAccountingLineParametersFromFixtures() {
055:                List<AccountingLineFixture> list = new ArrayList<AccountingLineFixture>();
056:                list.add(LINE15);
057:                return list;
058:            }
059:
060:            private AuxiliaryVoucherDocument buildDocument() throws Exception {
061:                // put accounting lines into document parameter for later
062:                AuxiliaryVoucherDocument document = (AuxiliaryVoucherDocument) getDocumentParameterFixture();
063:
064:                // set accountinglines to document
065:                for (AccountingLineFixture sourceFixture : getSourceAccountingLineParametersFromFixtures()) {
066:                    SourceAccountingLine line = sourceFixture
067:                            .createAccountingLine(SourceAccountingLine.class,
068:                                    document.getDocumentNumber(), document
069:                                            .getPostingYear(), document
070:                                            .getNextSourceLineNumber());
071:                    SourceAccountingLine balance = sourceFixture
072:                            .createAccountingLine(SourceAccountingLine.class,
073:                                    document.getDocumentNumber(), document
074:                                            .getPostingYear(), document
075:                                            .getNextSourceLineNumber());
076:                    balance.setDebitCreditCode(GL_DEBIT_CODE.equals(line
077:                            .getDebitCreditCode()) ? GL_CREDIT_CODE
078:                            : GL_DEBIT_CODE);
079:                    document.addSourceAccountingLine(line);
080:                    document.addSourceAccountingLine(balance);
081:
082:                }
083:
084:                return document;
085:            }
086:
087:            private int getExpectedPrePeCount() {
088:                return 2;
089:            }
090:
091:            public final void testAddAccountingLine() throws Exception {
092:                List<SourceAccountingLine> sourceLines = generateSouceAccountingLines();
093:                List<TargetAccountingLine> targetLines = new ArrayList<TargetAccountingLine>();
094:                int expectedSourceTotal = sourceLines.size();
095:                int expectedTargetTotal = targetLines.size();
096:                AccountingDocumentTestUtils.testAddAccountingLine(
097:                        DocumentTestUtils
098:                                .createDocument(SpringContext
099:                                        .getBean(DocumentService.class),
100:                                        DOCUMENT_CLASS), sourceLines,
101:                        targetLines, expectedSourceTotal, expectedTargetTotal);
102:            }
103:
104:            public final void testGetNewDocument() throws Exception {
105:                testGetNewDocument_byDocumentClass(DOCUMENT_CLASS,
106:                        SpringContext.getBean(DocumentService.class));
107:            }
108:
109:            public final void testConvertIntoErrorCorrection_documentAlreadyCorrected()
110:                    throws Exception {
111:                AccountingDocumentTestUtils
112:                        .testConvertIntoErrorCorrection_documentAlreadyCorrected(
113:                                buildDocument(),
114:                                SpringContext
115:                                        .getBean(TransactionalDocumentDictionaryService.class));
116:            }
117:
118:            public final void testConvertIntoErrorCorrection_errorCorrectionDisallowed()
119:                    throws Exception {
120:                AccountingDocumentTestUtils
121:                        .testConvertIntoErrorCorrection_errorCorrectionDisallowed(
122:                                buildDocument(), SpringContext
123:                                        .getBean(DataDictionaryService.class));
124:            }
125:
126:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
127:            public final void testRouteDocument() throws Exception {
128:                AccountingDocumentTestUtils.testRouteDocument(buildDocument(),
129:                        SpringContext.getBean(DocumentService.class));
130:            }
131:
132:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
133:            public void testSaveDocument() throws Exception {
134:                AccountingDocumentTestUtils.testSaveDocument(buildDocument(),
135:                        SpringContext.getBean(DocumentService.class));
136:            }
137:
138:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
139:            public void testConvertIntoCopy() throws Exception {
140:                AccountingDocumentTestUtils.testConvertIntoCopy(
141:                        buildDocument(), SpringContext
142:                                .getBean(DocumentService.class),
143:                        getExpectedPrePeCount());
144:            }
145:
146:            // test util mehtods
147:            private List<SourceAccountingLine> generateSouceAccountingLines()
148:                    throws Exception {
149:                List<SourceAccountingLine> sourceLines = new ArrayList<SourceAccountingLine>();
150:                // set accountinglines to document
151:                for (AccountingLineFixture sourceFixture : getSourceAccountingLineParametersFromFixtures()) {
152:                    sourceLines.add(sourceFixture.createSourceAccountingLine());
153:                    sourceLines
154:                            .add(sourceFixture
155:                                    .createAccountingLine(
156:                                            SourceAccountingLine.class,
157:                                            GL_DEBIT_CODE
158:                                                    .equals(sourceFixture.debitCreditCode) ? GL_CREDIT_CODE
159:                                                    : GL_DEBIT_CODE));
160:                }
161:
162:                return sourceLines;
163:            }
164:
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.