Source Code Cross Referenced for DelegateGlobalTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » chart » bo » 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.chart.bo 
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.chart.bo;
017:
018:        import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
019:
020:        import java.util.ArrayList;
021:        import java.util.List;
022:
023:        import org.apache.commons.logging.Log;
024:        import org.apache.commons.logging.LogFactory;
025:        import org.kuali.core.bo.GlobalBusinessObject;
026:        import org.kuali.core.bo.PersistableBusinessObject;
027:        import org.kuali.core.document.MaintenanceDocument;
028:        import org.kuali.core.exceptions.BusinessObjectNotFoundException;
029:        import org.kuali.core.maintenance.Maintainable;
030:        import org.kuali.core.service.DocumentService;
031:        import org.kuali.core.util.DateUtils;
032:        import org.kuali.core.util.KualiDecimal;
033:        import org.kuali.kfs.context.KualiTestBase;
034:        import org.kuali.kfs.context.SpringContext;
035:        import org.kuali.test.ConfigureContext;
036:
037:        import edu.iu.uis.eden.exception.WorkflowException;
038:
039:        @ConfigureContext(session=KHUNTLEY)
040:        public class DelegateGlobalTest extends KualiTestBase {
041:
042:            private static final String GLOBAL_DELEGATE_TYPENAME = "DelegateGlobalMaintenanceDocument";
043:
044:            private static final Log LOG = LogFactory
045:                    .getLog(DelegateGlobalTest.class);
046:
047:            private static final java.sql.Date START_DATE_1 = DateUtils
048:                    .newDate(2006, 6, 1);
049:            private static final java.sql.Date START_DATE_2 = DateUtils
050:                    .newDate(2006, 5, 1);
051:            private static final String DELEGATE_ID_1 = "4287701175"; // AFGORMAN BL-UDIV
052:            private static final String DELEGATE_ID_2 = "1571201547"; // BBURGER BL-VPIT
053:            private static final String DELEGATE_ID_3 = "1872708343"; // CSWINSON BL-VPGA
054:            private static final KualiDecimal FROM_AMOUNT_1 = new KualiDecimal(
055:                    0);
056:            private static final KualiDecimal FROM_AMOUNT_2 = new KualiDecimal(
057:                    0);
058:            private static final KualiDecimal FROM_AMOUNT_3 = new KualiDecimal(
059:                    1000);
060:            private static final KualiDecimal TO_AMOUNT_1 = new KualiDecimal(0);
061:            private static final KualiDecimal TO_AMOUNT_2 = new KualiDecimal(
062:                    10000);
063:            private static final KualiDecimal TO_AMOUNT_3 = new KualiDecimal(
064:                    5000);
065:            private static final String DOC_TYPE_ALL = "ALL";
066:            private static final String DOC_TYPE_ACCT = "ACCT";
067:            private static final String DOC_TYPE_CR = "CR";
068:            private static final String DOC_TYPE_TF = "TF";
069:            private static final String COA1 = "BL";
070:            private static final String ACCOUNT1 = "1031400";
071:            private static final String ACCOUNT2 = "1031420";
072:            private static final String ACCOUNT3 = "1031467";
073:            private static final String ACCOUNT_BAD = "1031421";
074:
075:            public void testApplyGlobalChanges_Empty() throws WorkflowException {
076:
077:                MaintenanceDocument document;
078:                document = (MaintenanceDocument) SpringContext.getBean(
079:                        DocumentService.class).getNewDocument(
080:                        GLOBAL_DELEGATE_TYPENAME);
081:                document.getDocumentHeader().setFinancialDocumentDescription(
082:                        "blah");
083:
084:                // get local references to the Maintainable and the BO
085:                Maintainable newMaintainable = document
086:                        .getNewMaintainableObject();
087:                DelegateGlobal bo = (DelegateGlobal) newMaintainable
088:                        .getBusinessObject();
089:
090:                List<DelegateGlobalDetail> changeDocuments = new ArrayList();
091:                bo.setDelegateGlobals(changeDocuments);
092:
093:                List<AccountGlobalDetail> accountDetails = new ArrayList();
094:                bo.setAccountGlobalDetails(accountDetails);
095:
096:                GlobalBusinessObject gbo = (GlobalBusinessObject) bo;
097:                List<PersistableBusinessObject> persistables = gbo
098:                        .generateGlobalChangesToPersist();
099:
100:                assertTrue("Global Changes returned should be an empty list.",
101:                        persistables.isEmpty());
102:            }
103:
104:            @SuppressWarnings("deprecation")
105:            public void testApplyGlobalChanges1() throws WorkflowException {
106:
107:                MaintenanceDocument document;
108:                document = (MaintenanceDocument) SpringContext.getBean(
109:                        DocumentService.class).getNewDocument(
110:                        GLOBAL_DELEGATE_TYPENAME);
111:                document.getDocumentHeader().setFinancialDocumentDescription(
112:                        "blah");
113:
114:                // get local references to the Maintainable and the BO
115:                Maintainable newMaintainable = document
116:                        .getNewMaintainableObject();
117:                DelegateGlobal bo = (DelegateGlobal) newMaintainable
118:                        .getBusinessObject();
119:                String finDocNumber = document.getDocumentHeader()
120:                        .getDocumentNumber();
121:
122:                // create the lists
123:                List<DelegateGlobalDetail> changeDocuments = new ArrayList();
124:                List<AccountGlobalDetail> accountDetails = new ArrayList();
125:
126:                // add a delegate change document
127:                DelegateGlobalDetail change = new DelegateGlobalDetail();
128:                change.setDocumentNumber(finDocNumber);
129:                change.setAccountDelegatePrimaryRoutingIndicator(true);
130:                change.setAccountDelegateStartDate(START_DATE_1);
131:                change.setAccountDelegateUniversalId(DELEGATE_ID_1);
132:                change.setApprovalFromThisAmount(FROM_AMOUNT_1);
133:                change.setApprovalToThisAmount(TO_AMOUNT_1);
134:                change.setFinancialDocumentTypeCode(DOC_TYPE_ALL);
135:                changeDocuments.add(change);
136:
137:                bo.setDelegateGlobals(changeDocuments);
138:
139:                // add account change detail records
140:                AccountGlobalDetail account;
141:                account = new AccountGlobalDetail();
142:                account.setDocumentNumber(finDocNumber);
143:                account.setChartOfAccountsCode(COA1);
144:                account.setAccountNumber(ACCOUNT1);
145:                accountDetails.add(account);
146:
147:                account = new AccountGlobalDetail();
148:                account.setDocumentNumber(finDocNumber);
149:                account.setChartOfAccountsCode(COA1);
150:                account.setAccountNumber(ACCOUNT2);
151:                accountDetails.add(account);
152:
153:                account = new AccountGlobalDetail();
154:                account.setDocumentNumber(finDocNumber);
155:                account.setChartOfAccountsCode(COA1);
156:                account.setAccountNumber(ACCOUNT3);
157:                accountDetails.add(account);
158:
159:                bo.setAccountGlobalDetails(accountDetails);
160:
161:                GlobalBusinessObject gbo = (GlobalBusinessObject) bo;
162:                List<PersistableBusinessObject> persistables = gbo
163:                        .generateGlobalChangesToPersist();
164:
165:                assertFalse("The list should not be empty.", persistables
166:                        .isEmpty());
167:                assertEquals("There should be three output records.", 3,
168:                        persistables.size());
169:
170:            }
171:
172:            @SuppressWarnings("deprecation")
173:            public void testApplyGlobalChanges2() throws WorkflowException {
174:
175:                MaintenanceDocument document;
176:                document = (MaintenanceDocument) SpringContext.getBean(
177:                        DocumentService.class).getNewDocument(
178:                        GLOBAL_DELEGATE_TYPENAME);
179:                document.getDocumentHeader().setFinancialDocumentDescription(
180:                        "blah");
181:
182:                // get local references to the Maintainable and the BO
183:                Maintainable newMaintainable = document
184:                        .getNewMaintainableObject();
185:                DelegateGlobal bo = (DelegateGlobal) newMaintainable
186:                        .getBusinessObject();
187:                String finDocNumber = document.getDocumentHeader()
188:                        .getDocumentNumber();
189:
190:                // create the lists
191:                List<DelegateGlobalDetail> changeDocuments = new ArrayList();
192:                List<AccountGlobalDetail> accountDetails = new ArrayList();
193:
194:                // add a delegate change document
195:                DelegateGlobalDetail change;
196:                change = new DelegateGlobalDetail();
197:                change.setDocumentNumber(finDocNumber);
198:                change.setAccountDelegatePrimaryRoutingIndicator(true);
199:                change.setAccountDelegateStartDate(START_DATE_1);
200:                change.setAccountDelegateUniversalId(DELEGATE_ID_1);
201:                change.setApprovalFromThisAmount(FROM_AMOUNT_1);
202:                change.setApprovalToThisAmount(TO_AMOUNT_1);
203:                change.setFinancialDocumentTypeCode(DOC_TYPE_ALL);
204:                changeDocuments.add(change);
205:
206:                change = new DelegateGlobalDetail();
207:                change.setDocumentNumber(finDocNumber);
208:                change.setAccountDelegatePrimaryRoutingIndicator(true);
209:                change.setAccountDelegateStartDate(START_DATE_2);
210:                change.setAccountDelegateUniversalId(DELEGATE_ID_2);
211:                change.setApprovalFromThisAmount(FROM_AMOUNT_3);
212:                change.setApprovalToThisAmount(TO_AMOUNT_3);
213:                change.setFinancialDocumentTypeCode(DOC_TYPE_ACCT);
214:                changeDocuments.add(change);
215:
216:                bo.setDelegateGlobals(changeDocuments);
217:
218:                // add account change detail records
219:                AccountGlobalDetail account;
220:                account = new AccountGlobalDetail();
221:                account.setDocumentNumber(finDocNumber);
222:                account.setChartOfAccountsCode(COA1);
223:                account.setAccountNumber(ACCOUNT1);
224:                accountDetails.add(account);
225:
226:                account = new AccountGlobalDetail();
227:                account.setDocumentNumber(finDocNumber);
228:                account.setChartOfAccountsCode(COA1);
229:                account.setAccountNumber(ACCOUNT2);
230:                accountDetails.add(account);
231:
232:                account = new AccountGlobalDetail();
233:                account.setDocumentNumber(finDocNumber);
234:                account.setChartOfAccountsCode(COA1);
235:                account.setAccountNumber(ACCOUNT3);
236:                accountDetails.add(account);
237:
238:                bo.setAccountGlobalDetails(accountDetails);
239:
240:                GlobalBusinessObject gbo = (GlobalBusinessObject) bo;
241:                List<PersistableBusinessObject> persistables = gbo
242:                        .generateGlobalChangesToPersist();
243:
244:                assertFalse("The list should not be empty.", persistables
245:                        .isEmpty());
246:                assertEquals("There should be six output records.", 6,
247:                        persistables.size());
248:
249:            }
250:
251:            @SuppressWarnings("deprecation")
252:            public void testApplyGlobalChanges3() throws WorkflowException {
253:
254:                MaintenanceDocument document;
255:                document = (MaintenanceDocument) SpringContext.getBean(
256:                        DocumentService.class).getNewDocument(
257:                        GLOBAL_DELEGATE_TYPENAME);
258:                document.getDocumentHeader().setFinancialDocumentDescription(
259:                        "blah");
260:
261:                // get local references to the Maintainable and the BO
262:                Maintainable newMaintainable = document
263:                        .getNewMaintainableObject();
264:                DelegateGlobal bo = (DelegateGlobal) newMaintainable
265:                        .getBusinessObject();
266:                String finDocNumber = document.getDocumentHeader()
267:                        .getDocumentNumber();
268:
269:                // create the lists
270:                List<DelegateGlobalDetail> changeDocuments = new ArrayList();
271:                List<AccountGlobalDetail> accountDetails = new ArrayList();
272:
273:                // add a delegate change document
274:                DelegateGlobalDetail change = new DelegateGlobalDetail();
275:                change.setDocumentNumber(finDocNumber);
276:                change.setAccountDelegatePrimaryRoutingIndicator(true);
277:                change.setAccountDelegateStartDate(START_DATE_1);
278:                change.setAccountDelegateUniversalId(DELEGATE_ID_1);
279:                change.setApprovalFromThisAmount(FROM_AMOUNT_1);
280:                change.setApprovalToThisAmount(TO_AMOUNT_1);
281:                change.setFinancialDocumentTypeCode(DOC_TYPE_ALL);
282:                changeDocuments.add(change);
283:
284:                bo.setDelegateGlobals(changeDocuments);
285:
286:                // add account change detail records
287:                AccountGlobalDetail account;
288:                account = new AccountGlobalDetail();
289:                account.setDocumentNumber(finDocNumber);
290:                account.setChartOfAccountsCode(COA1);
291:                account.setAccountNumber(ACCOUNT1);
292:                accountDetails.add(account);
293:
294:                account = new AccountGlobalDetail();
295:                account.setDocumentNumber(finDocNumber);
296:                account.setChartOfAccountsCode(COA1);
297:                account.setAccountNumber(ACCOUNT2);
298:                accountDetails.add(account);
299:
300:                account = new AccountGlobalDetail();
301:                account.setDocumentNumber(finDocNumber);
302:                account.setChartOfAccountsCode(COA1);
303:                account.setAccountNumber(ACCOUNT_BAD);
304:                accountDetails.add(account);
305:
306:                bo.setAccountGlobalDetails(accountDetails);
307:
308:                GlobalBusinessObject gbo = (GlobalBusinessObject) bo;
309:
310:                boolean errorHappened = false;
311:                try {
312:                    List<PersistableBusinessObject> persistables = gbo
313:                            .generateGlobalChangesToPersist();
314:                } catch (BusinessObjectNotFoundException e) {
315:                    errorHappened = true;
316:                }
317:
318:                assertTrue("The expected error should have occurred.",
319:                        errorHappened);
320:            }
321:
322:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.