Source Code Cross Referenced for RequisitionDocumentTest.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » purap » 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.purap.document 
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.purap.document;
017:
018:        import static org.kuali.module.financial.document.AccountingDocumentTestUtils.testGetNewDocument_byDocumentClass;
019:        import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
020:        import static org.kuali.test.fixtures.UserNameFixture.RJWEISS;
021:        import static org.kuali.test.fixtures.UserNameFixture.RORENFRO;
022:
023:        import java.util.ArrayList;
024:        import java.util.List;
025:
026:        import org.kuali.core.service.DataDictionaryService;
027:        import org.kuali.core.service.DocumentService;
028:        import org.kuali.core.service.TransactionalDocumentDictionaryService;
029:        import org.kuali.kfs.context.KualiTestBase;
030:        import org.kuali.kfs.context.SpringContext;
031:        import org.kuali.module.financial.document.AccountingDocumentTestUtils;
032:        import org.kuali.module.purap.bo.PurchaseOrderView;
033:        import org.kuali.module.purap.bo.PurchasingItem;
034:        import org.kuali.module.purap.fixtures.RequisitionDocumentFixture;
035:        import org.kuali.module.purap.fixtures.RequisitionItemFixture;
036:        import org.kuali.module.purap.service.PurapService;
037:        import org.kuali.test.ConfigureContext;
038:        import org.kuali.test.DocumentTestUtils;
039:        import org.kuali.test.fixtures.UserNameFixture;
040:        import org.kuali.workflow.WorkflowTestUtils;
041:
042:        import edu.iu.uis.eden.EdenConstants;
043:
044:        /**
045:         * Used to create and test populated Requisition Documents of various kinds.
046:         */
047:        @ConfigureContext(session=KHUNTLEY)
048:        public class RequisitionDocumentTest extends KualiTestBase {
049:            public static final Class<RequisitionDocument> DOCUMENT_CLASS = RequisitionDocument.class;
050:            private static final String ACCOUNT_REVIEW = "Account Review";
051:
052:            private RequisitionDocument requisitionDocument = null;
053:
054:            protected void setUp() throws Exception {
055:                super .setUp();
056:            }
057:
058:            protected void tearDown() throws Exception {
059:                requisitionDocument = null;
060:                super .tearDown();
061:            }
062:
063:            private List<RequisitionItemFixture> getItemParametersFromFixtures() {
064:                List<RequisitionItemFixture> list = new ArrayList<RequisitionItemFixture>();
065:                list.add(RequisitionItemFixture.REQ_ITEM_NO_APO);
066:                return list;
067:            }
068:
069:            private int getExpectedPrePeCount() {
070:                return 0;
071:            }
072:
073:            public final void testAddItem() throws Exception {
074:                List<PurchasingItem> items = new ArrayList<PurchasingItem>();
075:                items.add(RequisitionItemFixture.REQ_ITEM_NO_APO
076:                        .createRequisitionItem());
077:
078:                int expectedItemTotal = items.size();
079:                PurchasingDocumentTestUtils.testAddItem(
080:                        (PurchasingDocument) DocumentTestUtils.createDocument(
081:                                SpringContext.getBean(DocumentService.class),
082:                                DOCUMENT_CLASS), items, expectedItemTotal);
083:            }
084:
085:            public final void testGetNewDocument() throws Exception {
086:                testGetNewDocument_byDocumentClass(DOCUMENT_CLASS,
087:                        SpringContext.getBean(DocumentService.class));
088:            }
089:
090:            public final void testConvertIntoCopy_copyDisallowed()
091:                    throws Exception {
092:                AccountingDocumentTestUtils.testConvertIntoCopy_copyDisallowed(
093:                        buildSimpleDocument(), SpringContext
094:                                .getBean(DataDictionaryService.class));
095:
096:            }
097:
098:            public final void testConvertIntoErrorCorrection_documentAlreadyCorrected()
099:                    throws Exception {
100:                AccountingDocumentTestUtils
101:                        .testConvertIntoErrorCorrection_documentAlreadyCorrected(
102:                                buildSimpleDocument(),
103:                                SpringContext
104:                                        .getBean(TransactionalDocumentDictionaryService.class));
105:            }
106:
107:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
108:            public final void testConvertIntoErrorCorrection() throws Exception {
109:                requisitionDocument = buildSimpleDocument();
110:                AccountingDocumentTestUtils
111:                        .testConvertIntoErrorCorrection(
112:                                requisitionDocument,
113:                                getExpectedPrePeCount(),
114:                                SpringContext.getBean(DocumentService.class),
115:                                SpringContext
116:                                        .getBean(TransactionalDocumentDictionaryService.class));
117:            }
118:
119:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
120:            public final void testRouteDocument() throws Exception {
121:                requisitionDocument = buildSimpleDocument();
122:                AccountingDocumentTestUtils.testRouteDocument(
123:                        requisitionDocument, SpringContext
124:                                .getBean(DocumentService.class));
125:            }
126:
127:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
128:            public final void testSaveDocument() throws Exception {
129:                requisitionDocument = buildSimpleDocument();
130:                AccountingDocumentTestUtils.testSaveDocument(
131:                        requisitionDocument, SpringContext
132:                                .getBean(DocumentService.class));
133:            }
134:
135:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
136:            public final void testConvertIntoCopy() throws Exception {
137:                requisitionDocument = buildSimpleDocument();
138:                AccountingDocumentTestUtils.testConvertIntoCopy(
139:                        requisitionDocument, SpringContext
140:                                .getBean(DocumentService.class),
141:                        getExpectedPrePeCount());
142:            }
143:
144:            @ConfigureContext(session=KHUNTLEY,shouldCommitTransactions=true)
145:            public final void testRouteDocumentToFinal() throws Exception {
146:                requisitionDocument = RequisitionDocumentFixture.REQ_NO_APO_VALID
147:                        .createRequisitionDocument();
148:                final String docId = requisitionDocument.getDocumentNumber();
149:                AccountingDocumentTestUtils.routeDocument(requisitionDocument,
150:                        SpringContext.getBean(DocumentService.class));
151:                WorkflowTestUtils.waitForNodeChange(requisitionDocument
152:                        .getDocumentHeader().getWorkflowDocument(),
153:                        ACCOUNT_REVIEW);
154:
155:                // the document should now be routed to VPUTMAN as Fiscal Officer
156:                changeCurrentUser(RORENFRO);
157:                requisitionDocument = (RequisitionDocument) SpringContext
158:                        .getBean(DocumentService.class).getByDocumentHeaderId(
159:                                docId);
160:                assertTrue("At incorrect node.", WorkflowTestUtils.isAtNode(
161:                        requisitionDocument, ACCOUNT_REVIEW));
162:                assertTrue("Document should be enroute.", requisitionDocument
163:                        .getDocumentHeader().getWorkflowDocument()
164:                        .stateIsEnroute());
165:                assertTrue("RORENFRO should have an approve request.",
166:                        requisitionDocument.getDocumentHeader()
167:                                .getWorkflowDocument().isApprovalRequested());
168:                SpringContext.getBean(DocumentService.class)
169:                        .approveDocument(requisitionDocument,
170:                                "Test approving as RORENFRO", null);
171:
172:                WorkflowTestUtils.waitForStatusChange(requisitionDocument
173:                        .getDocumentHeader().getWorkflowDocument(),
174:                        EdenConstants.ROUTE_HEADER_FINAL_CD);
175:
176:                changeCurrentUser(KHUNTLEY);
177:                requisitionDocument = (RequisitionDocument) SpringContext
178:                        .getBean(DocumentService.class).getByDocumentHeaderId(
179:                                docId);
180:                assertTrue("Document should now be final.", requisitionDocument
181:                        .getDocumentHeader().getWorkflowDocument()
182:                        .stateIsFinal());
183:            }
184:
185:            @ConfigureContext(session=RORENFRO,shouldCommitTransactions=true)
186:            public final void testCreateAPOAlternateRequisition()
187:                    throws Exception {
188:                RequisitionDocument altAPORequisition = RequisitionDocumentFixture.REQ_ALTERNATE_APO
189:                        .createRequisitionDocument();
190:                AccountingDocumentTestUtils.testSaveDocument(altAPORequisition,
191:                        SpringContext.getBean(DocumentService.class));
192:            }
193:
194:            private RequisitionDocument buildSimpleDocument() throws Exception {
195:                return RequisitionDocumentFixture.REQ_ONLY_REQUIRED_FIELDS
196:                        .createRequisitionDocument();
197:            }
198:
199:            private UserNameFixture getInitialUserName() {
200:                return RJWEISS;
201:            }
202:
203:            protected UserNameFixture getTestUserName() {
204:                return RORENFRO;
205:            }
206:
207:            // create document fixture
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.