Source Code Cross Referenced for BudgetIndirectCostServiceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » kra » 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.kra.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.kra.service;
017:
018:        import java.util.ArrayList;
019:        import java.util.Iterator;
020:        import java.util.List;
021:
022:        import org.kuali.core.util.KualiInteger;
023:        import org.kuali.kfs.context.KualiTestBase;
024:        import org.kuali.kfs.context.SpringContext;
025:        import org.kuali.module.kra.bo.BudgetNonpersonnelTest;
026:        import org.kuali.module.kra.bo.BudgetPeriodTest;
027:        import org.kuali.module.kra.budget.bo.Budget;
028:        import org.kuali.module.kra.budget.bo.BudgetIndirectCost;
029:        import org.kuali.module.kra.budget.bo.BudgetNonpersonnel;
030:        import org.kuali.module.kra.budget.bo.BudgetPeriod;
031:        import org.kuali.module.kra.budget.bo.BudgetTask;
032:        import org.kuali.module.kra.budget.bo.BudgetTaskPeriodIndirectCost;
033:        import org.kuali.module.kra.budget.bo.UserAppointmentTaskPeriod;
034:        import org.kuali.module.kra.budget.document.BudgetDocument;
035:        import org.kuali.module.kra.budget.service.BudgetIndirectCostService;
036:        import org.kuali.test.ConfigureContext;
037:
038:        @ConfigureContext
039:        public class BudgetIndirectCostServiceTest extends KualiTestBase {
040:
041:            protected void populateBudgetTasksPeriods(
042:                    BudgetDocument budgetDocument) {
043:
044:                List periods = BudgetPeriodTest.createBudgetPeriods(2);
045:                for (int i = 0; i < periods.size(); i++) {
046:                    BudgetPeriod period = (BudgetPeriod) periods.get(i);
047:                    period.setDocumentNumber("1234");
048:                    period.setBudgetPeriodSequenceNumber(i);
049:                }
050:
051:                BudgetTask task1 = new BudgetTask();
052:                task1.setDocumentNumber("1234");
053:                task1.setBudgetTaskSequenceNumber(new Integer(0));
054:
055:                BudgetTask task2 = new BudgetTask();
056:                task2.setDocumentNumber("1234");
057:                task2.setBudgetTaskSequenceNumber(new Integer(1));
058:
059:                List tasks = new ArrayList();
060:                tasks.add(task1);
061:                tasks.add(task2);
062:
063:                Budget budget = new Budget();
064:                budget.setDocumentNumber("1234");
065:                budget.setTasks(tasks);
066:                budget.setPeriods(periods);
067:
068:                budgetDocument.setBudget(budget);
069:            }
070:
071:            public void testReconcileIndirectCost() {
072:                BudgetDocument budgetDocument = new BudgetDocument();
073:                // Test new document
074:                populateBudgetTasksPeriods(budgetDocument);
075:
076:                SpringContext.getBean(BudgetIndirectCostService.class)
077:                        .reconcileIndirectCost(budgetDocument);
078:
079:                BudgetIndirectCost indirectCost = budgetDocument.getBudget()
080:                        .getIndirectCost();
081:                assertEquals(indirectCost.getDocumentNumber(), "1234");
082:
083:                List idcList = indirectCost
084:                        .getBudgetTaskPeriodIndirectCostItems();
085:                assertEquals(idcList.size(), 4);
086:
087:                BudgetTaskPeriodIndirectCost idc1 = (BudgetTaskPeriodIndirectCost) idcList
088:                        .get(0);
089:                assertEquals(idc1.getDocumentNumber(), "1234");
090:                assertEquals(idc1.getBudgetTaskSequenceNumber(), new Integer(0));
091:                assertEquals(idc1.getBudgetPeriodSequenceNumber(), new Integer(
092:                        0));
093:
094:                BudgetTaskPeriodIndirectCost idc2 = (BudgetTaskPeriodIndirectCost) idcList
095:                        .get(1);
096:                assertEquals(idc2.getDocumentNumber(), "1234");
097:                assertEquals(idc2.getBudgetTaskSequenceNumber(), new Integer(0));
098:                assertEquals(idc2.getBudgetPeriodSequenceNumber(), new Integer(
099:                        1));
100:
101:                BudgetTaskPeriodIndirectCost idc3 = (BudgetTaskPeriodIndirectCost) idcList
102:                        .get(2);
103:                assertEquals(idc3.getDocumentNumber(), "1234");
104:                assertEquals(idc3.getBudgetTaskSequenceNumber(), new Integer(1));
105:                assertEquals(idc3.getBudgetPeriodSequenceNumber(), new Integer(
106:                        0));
107:
108:                BudgetTaskPeriodIndirectCost idc4 = (BudgetTaskPeriodIndirectCost) idcList
109:                        .get(3);
110:                assertEquals(idc4.getDocumentNumber(), "1234");
111:                assertEquals(idc4.getBudgetTaskSequenceNumber(), new Integer(1));
112:                assertEquals(idc4.getBudgetPeriodSequenceNumber(), new Integer(
113:                        1));
114:
115:                // Test existing document to be updated
116:                BudgetTask newBudgetTask = new BudgetTask();
117:                newBudgetTask.setDocumentNumber("1234");
118:                newBudgetTask.setBudgetTaskSequenceNumber(2);
119:
120:                budgetDocument.getBudget().getTasks().add(newBudgetTask);
121:                budgetDocument.getBudget().getPeriods().remove(0);
122:                budgetDocument.getBudget().getTasks().remove(1);
123:
124:                SpringContext.getBean(BudgetIndirectCostService.class)
125:                        .reconcileIndirectCost(budgetDocument);
126:
127:                indirectCost = budgetDocument.getBudget().getIndirectCost();
128:                assertFalse(indirectCost
129:                        .getBudgetIndirectCostCostShareIndicator());
130:                assertFalse(indirectCost
131:                        .getBudgetUnrecoveredIndirectCostIndicator());
132:
133:                idcList = indirectCost.getBudgetTaskPeriodIndirectCostItems();
134:                assertEquals(idcList.size(), 2);
135:
136:                idc1 = (BudgetTaskPeriodIndirectCost) idcList.get(0);
137:                assertEquals(idc1.getDocumentNumber(), "1234");
138:                assertEquals(idc1.getBudgetTaskSequenceNumber(), new Integer(0));
139:                assertEquals(idc1.getBudgetPeriodSequenceNumber(), new Integer(
140:                        1));
141:
142:                idc2 = (BudgetTaskPeriodIndirectCost) idcList.get(1);
143:                assertEquals(idc2.getDocumentNumber(), "1234");
144:                assertEquals(idc2.getBudgetTaskSequenceNumber(), new Integer(2));
145:                assertEquals(idc2.getBudgetPeriodSequenceNumber(), new Integer(
146:                        1));
147:            }
148:
149:            public void testRefreshIndirectCost() {
150:                BudgetDocument budgetDocument = new BudgetDocument();
151:                Budget budget = budgetDocument.getBudget();
152:
153:                List periods = BudgetPeriodTest.createBudgetPeriods(2);
154:                for (int i = 0; i < periods.size(); i++) {
155:                    BudgetPeriod period = (BudgetPeriod) periods.get(i);
156:                    period.setDocumentNumber("1234");
157:                    period.setBudgetPeriodSequenceNumber(i);
158:                }
159:                budget.setPeriods(periods);
160:
161:                String[] categories = { "CO", "CO", "FL", "SC" };
162:                String[] subCategories = { "C1", "C1", "F5", "R2" };
163:                String[] subcontractorNumber = { "", "", "", "1" };
164:                List nonpersonnelItems = BudgetNonpersonnelTest
165:                        .createBudgetNonpersonnel(categories, subCategories,
166:                                subcontractorNumber);
167:                for (Iterator iter = nonpersonnelItems.iterator(); iter
168:                        .hasNext();) {
169:                    BudgetNonpersonnel nonpersonnel = (BudgetNonpersonnel) iter
170:                            .next();
171:                    nonpersonnel.setBudgetPeriodSequenceNumber(new Integer(2));
172:                }
173:                budget.setNonpersonnelItems(nonpersonnelItems);
174:
175:                List userAppointmentTaskPeriods = new ArrayList();
176:
177:                assertFalse("Budget periods should not be empty.", budget
178:                        .getPeriods().isEmpty());
179:                BudgetPeriod period1 = (BudgetPeriod) budget.getPeriods()
180:                        .get(0);
181:
182:                UserAppointmentTaskPeriod taskPeriod = new UserAppointmentTaskPeriod();
183:                taskPeriod.setBudgetPeriodSequenceNumber(period1
184:                        .getBudgetPeriodSequenceNumber());
185:                taskPeriod.setAgencyRequestTotalAmount(new KualiInteger(39000));
186:                taskPeriod.setAgencyFringeBenefitTotalAmount(new KualiInteger(
187:                        13000));
188:                userAppointmentTaskPeriods.add(taskPeriod);
189:
190:                UserAppointmentTaskPeriod taskPeriod2 = new UserAppointmentTaskPeriod();
191:                taskPeriod2.setBudgetPeriodSequenceNumber(period1
192:                        .getBudgetPeriodSequenceNumber());
193:                taskPeriod2
194:                        .setAgencyRequestTotalAmount(new KualiInteger(43000));
195:                taskPeriod2.setAgencyFringeBenefitTotalAmount(new KualiInteger(
196:                        8500));
197:                userAppointmentTaskPeriods.add(taskPeriod2);
198:
199:                BudgetPeriod period2 = (BudgetPeriod) budget.getPeriods()
200:                        .get(1);
201:
202:                UserAppointmentTaskPeriod taskPeriod3 = new UserAppointmentTaskPeriod();
203:                taskPeriod3.setBudgetPeriodSequenceNumber(period2
204:                        .getBudgetPeriodSequenceNumber());
205:                taskPeriod3
206:                        .setAgencyRequestTotalAmount(new KualiInteger(74000));
207:                taskPeriod3.setAgencyFringeBenefitTotalAmount(new KualiInteger(
208:                        21500));
209:                userAppointmentTaskPeriods.add(taskPeriod3);
210:
211:                budget
212:                        .setAllUserAppointmentTaskPeriods(userAppointmentTaskPeriods);
213:
214:            }
215:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.