Source Code Cross Referenced for AbstractGLLookupableHelperServiceTestBase.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » web » lookupable » 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.web.lookupable 
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.gl.web.lookupable;
017:
018:        import java.util.Date;
019:        import java.util.Iterator;
020:        import java.util.List;
021:        import java.util.Map;
022:
023:        import org.apache.commons.beanutils.PropertyUtils;
024:        import org.kuali.core.bo.PersistableBusinessObjectBase;
025:        import org.kuali.core.lookup.LookupableHelperService;
026:        import org.kuali.core.service.DateTimeService;
027:        import org.kuali.kfs.bo.GeneralLedgerPendingEntry;
028:        import org.kuali.kfs.context.KualiTestBase;
029:        import org.kuali.kfs.context.SpringContext;
030:        import org.kuali.kfs.service.GeneralLedgerPendingEntryService;
031:        import org.kuali.module.gl.web.TestDataGenerator;
032:
033:        /**
034:         * This class is a template being used by the test case classes of GL lookupable implementation.
035:         */
036:        public abstract class AbstractGLLookupableHelperServiceTestBase extends
037:                KualiTestBase {
038:
039:            protected Date date;
040:            protected GeneralLedgerPendingEntry pendingEntry;
041:            protected TestDataGenerator testDataGenerator;
042:            protected LookupableHelperService lookupableHelperServiceImpl;
043:            protected GeneralLedgerPendingEntryService pendingEntryService;
044:
045:            /**
046:             * Sets up the test by initializing several properties
047:             * @see junit.framework.TestCase#setUp()
048:             */
049:            @Override
050:            protected void setUp() throws Exception {
051:                super .setUp();
052:
053:                date = SpringContext.getBean(DateTimeService.class)
054:                        .getCurrentDate();
055:                pendingEntry = new GeneralLedgerPendingEntry();
056:                testDataGenerator = new TestDataGenerator();
057:
058:                setPendingEntryService(SpringContext
059:                        .getBean(GeneralLedgerPendingEntryService.class));
060:            }
061:
062:            /**
063:             * test cases for getSearchResults method of LookupableImpl class
064:             */
065:            public abstract void testGetSearchResults() throws Exception;
066:
067:            /**
068:             * This method defines the lookup fields
069:             * 
070:             * @param isExtended flag if the non required fields are included
071:             * @return a list of lookup fields
072:             */
073:            public abstract List getLookupFields(boolean isExtended);
074:
075:            /**
076:             * This method defines the primary key fields
077:             * 
078:             * @return a list of primary key fields
079:             */
080:            public List getPrimaryKeyFields() {
081:                return lookupableHelperServiceImpl.getReturnKeys();
082:            }
083:
084:            /**
085:             * test cases for getInquiryUrl method of LookupableImpl class
086:             */
087:            public void testGetInquiryUrl() throws Exception {
088:            }
089:
090:            /**
091:             * This method tests if the search results have the given entry
092:             * 
093:             * @param searchResults the search results
094:             * @param businessObject the given business object
095:             * @return true if the given business object is in the search results
096:             */
097:            protected boolean contains(List searchResults,
098:                    PersistableBusinessObjectBase businessObject) {
099:                boolean isContains = false;
100:                List priamryKeyFields = getPrimaryKeyFields();
101:                int numberOfPrimaryKeyFields = priamryKeyFields.size();
102:
103:                String propertyName, resultPropertyValue, propertyValue;
104:
105:                Iterator searchResultsIterator = searchResults.iterator();
106:                while (searchResultsIterator.hasNext() && !isContains) {
107:                    Object resultRecord = searchResultsIterator.next();
108:
109:                    isContains = true;
110:                    for (int i = 0; i < numberOfPrimaryKeyFields; i++) {
111:                        try {
112:                            propertyName = (String) (priamryKeyFields.get(i));
113:                            resultPropertyValue = PropertyUtils.getProperty(
114:                                    resultRecord, propertyName).toString();
115:                            propertyValue = PropertyUtils.getProperty(
116:                                    businessObject, propertyName).toString();
117:
118:                            if (!resultPropertyValue.equals(propertyValue)) {
119:                                isContains = false;
120:                                break;
121:                            }
122:                        } catch (Exception e) {
123:                            e.printStackTrace();
124:                        }
125:                    }
126:                }
127:                return isContains;
128:            }
129:
130:            /**
131:             * This method creates the lookup form fields with the given business object and lookup fields
132:             * 
133:             * @param businessObject the given business object
134:             * @param isExtended determine if the extended lookup fields are used
135:             * @return a lookup form fields
136:             * @throws Exception thrown if any exception is encountered for any reason
137:             */
138:            public Map getLookupFieldValues(
139:                    PersistableBusinessObjectBase businessObject,
140:                    boolean isExtended) throws Exception {
141:                List lookupFields = this .getLookupFields(isExtended);
142:                return testDataGenerator.generateLookupFieldValues(
143:                        businessObject, lookupFields);
144:            }
145:
146:            /**
147:             * This method inserts a new pending ledger Entry record into database
148:             * 
149:             * @param pendingEntry the given pending ledger Entry
150:             */
151:            protected void insertNewPendingEntry(
152:                    GeneralLedgerPendingEntry pendingEntry) {
153:                try {
154:                    getPendingEntryService().save(pendingEntry);
155:                } catch (Exception e) {
156:                    e.printStackTrace();
157:                }
158:            }
159:
160:            /**
161:             * Gets the pendingEntryService attribute.
162:             * 
163:             * @return Returns the pendingEntryService.
164:             */
165:            public GeneralLedgerPendingEntryService getPendingEntryService() {
166:                return pendingEntryService;
167:            }
168:
169:            /**
170:             * Sets the pendingEntryService attribute value.
171:             * 
172:             * @param pendingEntryService The pendingEntryService to set.
173:             */
174:            public void setPendingEntryService(
175:                    GeneralLedgerPendingEntryService pendingEntryService) {
176:                this.pendingEntryService = pendingEntryService;
177:            }
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.