Source Code Cross Referenced for LaborNightlyOutServiceTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » labor » 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.labor.service 
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.labor.service;
017:
018:        import java.util.Arrays;
019:        import java.util.Collection;
020:        import java.util.List;
021:        import java.util.Map;
022:        import java.util.Properties;
023:
024:        import org.apache.commons.lang.StringUtils;
025:        import org.kuali.core.bo.DocumentHeader;
026:        import org.kuali.core.service.BusinessObjectService;
027:        import org.kuali.core.service.PersistenceService;
028:        import org.kuali.kfs.context.KualiTestBase;
029:        import org.kuali.kfs.context.SpringContext;
030:        import org.kuali.module.gl.web.TestDataGenerator;
031:        import org.kuali.module.labor.bo.LaborLedgerPendingEntry;
032:        import org.kuali.module.labor.bo.LaborOriginEntry;
033:        import org.kuali.module.labor.util.ObjectUtil;
034:        import org.kuali.module.labor.util.TestDataPreparator;
035:        import org.kuali.module.labor.util.testobject.LaborOriginEntryForTesting;
036:        import org.kuali.module.labor.util.testobject.PendingLedgerEntryForTesting;
037:        import org.kuali.test.ConfigureContext;
038:
039:        @ConfigureContext
040:        public class LaborNightlyOutServiceTest extends KualiTestBase {
041:            private Properties properties;
042:            private String fieldNames, documentFieldNames;
043:            private String deliminator;
044:
045:            private Map fieldValues;
046:
047:            private BusinessObjectService businessObjectService;
048:            private LaborNightlyOutService laborNightlyOutService;
049:            private PersistenceService persistenceService;
050:
051:            @Override
052:            public void setUp() throws Exception {
053:                super .setUp();
054:                String messageFileName = "test/src/org/kuali/module/labor/testdata/message.properties";
055:                String propertiesFileName = "test/src/org/kuali/module/labor/testdata/laborNightlyOutService.properties";
056:
057:                properties = (new TestDataGenerator(propertiesFileName,
058:                        messageFileName)).getProperties();
059:                fieldNames = properties.getProperty("fieldNames");
060:                documentFieldNames = properties
061:                        .getProperty("documentFieldNames");
062:                deliminator = properties.getProperty("deliminator");
063:
064:                businessObjectService = SpringContext
065:                        .getBean(BusinessObjectService.class);
066:                laborNightlyOutService = SpringContext
067:                        .getBean(LaborNightlyOutService.class);
068:                persistenceService = SpringContext
069:                        .getBean(PersistenceService.class);
070:
071:                int numberOfDocuments = Integer.valueOf(properties
072:                        .getProperty("document.numOfData"));
073:                List inputDataList = TestDataPreparator.buildTestDataList(
074:                        DocumentHeader.class, properties, "document.testData",
075:                        documentFieldNames, deliminator, numberOfDocuments);
076:                businessObjectService.save(inputDataList);
077:
078:                LaborOriginEntry cleanup = new LaborOriginEntry();
079:                ObjectUtil.populateBusinessObject(cleanup, properties,
080:                        "dataCleanup", fieldNames, deliminator);
081:                fieldValues = ObjectUtil.buildPropertyMap(cleanup, Arrays
082:                        .asList(StringUtils.split(fieldNames, deliminator)));
083:                businessObjectService.deleteMatching(LaborOriginEntry.class,
084:                        fieldValues);
085:                businessObjectService.deleteMatching(
086:                        LaborLedgerPendingEntry.class, fieldValues);
087:            }
088:
089:            public void testCopyApprovedPendingLedgerEntries() throws Exception {
090:                String testTarget = "copyApprovedPendingLedgerEntries.";
091:                int numberOfTestData = Integer.valueOf(properties
092:                        .getProperty(testTarget + "numOfData"));
093:                int expectedNumOfData = Integer.valueOf(properties
094:                        .getProperty(testTarget + "expectedNumOfData"));
095:
096:                List inputDataList = TestDataPreparator.buildTestDataList(
097:                        LaborLedgerPendingEntry.class, properties, testTarget
098:                                + "testData", numberOfTestData);
099:                businessObjectService.save(inputDataList);
100:
101:                laborNightlyOutService.copyApprovedPendingLedgerEntries();
102:
103:                List expectedDataList = TestDataPreparator
104:                        .buildExpectedValueList(
105:                                LaborOriginEntryForTesting.class, properties,
106:                                testTarget + "expected", expectedNumOfData);
107:                Collection originEntries = businessObjectService.findMatching(
108:                        LaborOriginEntry.class, fieldValues);
109:                for (Object entry : originEntries) {
110:                    LaborOriginEntryForTesting originEntryForTesting = new LaborOriginEntryForTesting();
111:                    ObjectUtil.buildObject(originEntryForTesting, entry);
112:                    assertTrue("Cannot find the expected entry",
113:                            expectedDataList.contains(originEntryForTesting));
114:                }
115:                assertEquals(expectedNumOfData, originEntries.size());
116:            }
117:
118:            public void testCopyPendingLedgerEntries() throws Exception {
119:                String testTarget = "copyPendingLedgerEntries.";
120:                int numberOfTestData = Integer.valueOf(properties
121:                        .getProperty(testTarget + "numOfData"));
122:                int expectedNumOfData = Integer.valueOf(properties
123:                        .getProperty(testTarget + "expectedNumOfData"));
124:
125:                List inputDataList = TestDataPreparator.buildTestDataList(
126:                        LaborLedgerPendingEntry.class, properties, testTarget
127:                                + "testData", numberOfTestData);
128:                businessObjectService.save(inputDataList);
129:
130:                laborNightlyOutService.copyApprovedPendingLedgerEntries();
131:
132:                List expectedDataList = TestDataPreparator
133:                        .buildExpectedValueList(
134:                                LaborOriginEntryForTesting.class, properties,
135:                                testTarget + "expected", expectedNumOfData);
136:                Collection originEntries = businessObjectService.findMatching(
137:                        LaborOriginEntry.class, fieldValues);
138:                for (Object entry : originEntries) {
139:                    LaborOriginEntryForTesting originEntryForTesting = new LaborOriginEntryForTesting();
140:                    ObjectUtil.buildObject(originEntryForTesting, entry);
141:                    assertTrue("Cannot find the expected entry",
142:                            expectedDataList.contains(originEntryForTesting));
143:                }
144:                assertEquals(expectedNumOfData, originEntries.size());
145:            }
146:
147:            public void testDeleteCopiedPendingLedgerEntries() throws Exception {
148:                String testTarget = "deleteCopiedPendingLedgerEntries.";
149:                int numberOfTestData = Integer.valueOf(properties
150:                        .getProperty(testTarget + "numOfData"));
151:                int expectedNumOfData = Integer.valueOf(properties
152:                        .getProperty(testTarget + "expectedNumOfData"));
153:
154:                List inputDataList = TestDataPreparator.buildTestDataList(
155:                        LaborLedgerPendingEntry.class, properties, testTarget
156:                                + "testData", numberOfTestData);
157:                businessObjectService.save(inputDataList);
158:
159:                laborNightlyOutService.deleteCopiedPendingLedgerEntries();
160:
161:                Collection originEntries = businessObjectService.findMatching(
162:                        LaborOriginEntry.class, fieldValues);
163:
164:                assertEquals(expectedNumOfData, originEntries.size());
165:            }
166:
167:            public void testDeletePendingLedgerEntries() throws Exception {
168:                String testTarget = "deletePendingLedgerEntries.";
169:                int numberOfTestData = Integer.valueOf(properties
170:                        .getProperty(testTarget + "numOfData"));
171:                int expectedNumOfData = Integer.valueOf(properties
172:                        .getProperty(testTarget + "expectedNumOfData"));
173:
174:                List inputDataList = TestDataPreparator.buildTestDataList(
175:                        LaborLedgerPendingEntry.class, properties, testTarget
176:                                + "testData", numberOfTestData);
177:                businessObjectService.save(inputDataList);
178:
179:                laborNightlyOutService.deleteCopiedPendingLedgerEntries();
180:
181:                List expectedDataList = TestDataPreparator
182:                        .buildExpectedValueList(
183:                                LaborOriginEntryForTesting.class, properties,
184:                                testTarget + "expected", expectedNumOfData);
185:                Collection originEntries = businessObjectService.findMatching(
186:                        LaborLedgerPendingEntry.class, fieldValues);
187:                for (Object entry : originEntries) {
188:                    PendingLedgerEntryForTesting pendingEntryForTesting = new PendingLedgerEntryForTesting();
189:                    ObjectUtil.buildObject(pendingEntryForTesting, entry);
190:                    assertTrue("Cannot find the expected entry",
191:                            expectedDataList.contains(pendingEntryForTesting));
192:                }
193:                assertEquals(expectedNumOfData, originEntries.size());
194:            }
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.