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;
017:
018: import java.util.Iterator;
019: import java.util.List;
020: import java.util.Map;
021: import java.util.Vector;
022:
023: import junit.framework.Test;
024: import junit.framework.TestSuite;
025:
026: import org.kuali.core.dbplatform.RawSQL;
027: import org.kuali.core.service.DateTimeService;
028: import org.kuali.core.util.UnitTestSqlDao;
029: import org.kuali.kfs.context.SpringContext;
030: import org.kuali.module.gl.bo.OriginEntrySource;
031: import org.kuali.module.gl.dao.UniversityDateDao;
032:
033: /**
034: * With the FullStackSuite we want to:
035: * <ul>
036: * <li>load up all EntryGroups that are pending processing</li>
037: * <li>invoke the main general ledger batch job to fully process the entries pending processing</li>
038: * <li>for each entry that was pending processing:
039: * <ul>
040: * <li>execute all business rules against it to see what should have been created either as origin entries with a particular error
041: * source code or as entries created in GL_ENTRY_T</li>
042: * <li>check to verify that all origin entries with an error source code were created properly and were not processed past where
043: * they should have been</li>
044: * <li>check to verify that all records that should have been created in GL_ENTRY_T were created correctly </li>
045: * </ul>
046: * </li>
047: * </ul>
048: */
049: @RawSQL
050: public class FullStackSuite {
051: static private UnitTestSqlDao sqlDao = SpringContext
052: .getBean(UnitTestSqlDao.class);
053: static private DateTimeService dateTimeService = SpringContext
054: .getBean(DateTimeService.class);
055: static private UniversityDateDao universityDateDao = SpringContext
056: .getBean(UniversityDateDao.class);
057:
058: static public Vector groupIdsProcessedByScrubber = new Vector();
059: static public Vector groupIdsProcessedByEntryPoster = new Vector();
060: static public Vector groupIdsProcessedByIcrPoster = new Vector();
061: static public Vector transactionIdsProcessedByReversalPoster = new Vector();
062:
063: static public Vector getGroupIdsProcessedByScrubber() {
064: if (0 == groupIdsProcessedByScrubber.size()) {
065: setGroupIdsProcessedByScrubber();
066: }
067: return groupIdsProcessedByScrubber;
068: }
069:
070: static public Vector getGroupIdsProcessedByEntryPoster() {
071: if (0 == groupIdsProcessedByEntryPoster.size()) {
072: setGroupIdsProcessedByScrubber();
073: }
074: return groupIdsProcessedByEntryPoster;
075: }
076:
077: static public Vector getGroupIdsProcessedByIcrPoster() {
078: if (0 == groupIdsProcessedByIcrPoster.size()) {
079: setGroupIdsProcessedByrIcrPoster();
080: }
081: return groupIdsProcessedByIcrPoster;
082: }
083:
084: /**
085: * Retrieves the group ids of origin entry groups that were processed by the scrubber,
086: * and sets the groupIdsProcessedbyScrubber to that list
087: */
088: static public void setGroupIdsProcessedByScrubber() {
089: // get the ids of all of the entry groups that will be scrubbed and processed in this run.
090: List idsToScrub = sqlDao
091: .sqlSelect("select distinct origin_entry_grp_id "
092: + "from gl_origin_entry_grp_t where origin_entry_scrub_ind = 'Y'"
093: + "and origin_entry_prcs_ind = 'Y' and origin_entry_grp_vld_ind = 'Y'");
094: for (Iterator i = idsToScrub.iterator(); i.hasNext();) {
095: Map m = (Map) i.next();
096: groupIdsProcessedByScrubber.add(m.values().iterator()
097: .next());
098: }
099: }
100:
101: /**
102: * Retrieves the group ids of origin entry groups that were processed by the entry poster,
103: * and sets the groupIdsProcessedByEntryPoster to that list.
104: */
105: static public void setGroupIdsProcessedByEntryPoster() {
106: List idsToPost = sqlDao
107: .sqlSelect("select distinct origin_entry_grp_id "
108: + "from gl_origin_entry_grp_t where and origin_entry_prcs_ind = 'Y' "
109: + "and origin_entry_grp_vld_ind = 'Y' and origin_entry_grp_src_cd = '"
110: + OriginEntrySource.SCRUBBER_VALID + "'");
111: for (Iterator i = idsToPost.iterator(); i.hasNext();) {
112: Map m = (Map) i.next();
113: groupIdsProcessedByEntryPoster.add(m.values().iterator()
114: .next());
115: }
116: }
117:
118: /**
119: * Retrieves the group ids of origin entry groups that were processed by the ICR poster,
120: * and sets the groupIdsProcessedByIcrPoster to that list.
121: */
122: static public void setGroupIdsProcessedByrIcrPoster() {
123: List idsToPost = sqlDao
124: .sqlSelect("select distinct origin_entry_grp_id "
125: + "from gl_origin_entry_grp_t where and origin_entry_prcs_ind = 'Y' "
126: + "and origin_entry_grp_vld_ind = 'Y' and origin_entry_grp_src_cd = '"
127: + OriginEntrySource.ICR_POSTER_VALID + "'");
128: for (Iterator i = idsToPost.iterator(); i.hasNext();) {
129: Map m = (Map) i.next();
130: groupIdsProcessedByIcrPoster.add(m.values().iterator()
131: .next());
132: }
133: }
134:
135: /**
136: * Generates a new, empty test suite...and then returns it
137: *
138: * @return a pretty useless test suite
139: */
140: public static Test suite() {
141: TestSuite suite = new TestSuite("Test for org.kuali.module.gl");
142:
143: return suite;
144: }
145:
146: }
|