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.chart.rules;
017:
018: import static org.kuali.test.util.KualiTestAssertionUtils.assertGlobalErrorMapEmpty;
019:
020: import org.kuali.core.document.MaintenanceDocument;
021: import org.kuali.module.chart.bo.AccountGlobal;
022: import org.kuali.test.ConfigureContext;
023:
024: @ConfigureContext
025: public class AccountGlobalRuleTest extends ChartRuleTestBase {
026:
027: private class Accounts {
028: private class ChartCode {
029: private static final String GOOD1 = "BL";
030: private static final String CLOSED1 = "BL";
031: private static final String EXPIRED1 = "BL";
032: private static final String GOOD2 = "UA";
033: private static final String BAD1 = "ZZ";
034: }
035:
036: private class AccountNumber {
037: private static final String GOOD1 = "1031400";
038: private static final String CLOSED1 = "2231414";
039: private static final String EXPIRED1 = "2231404";
040: private static final String BAD1 = "9999999";
041: }
042:
043: private class Org {
044: private static final String GOOD1 = "ACAD";
045: private static final String BAD1 = "1234";
046: }
047:
048: private class State {
049: private static final String GOOD1 = "IN";
050: private static final String BAD1 = "ZZ";
051: }
052:
053: private class Zip {
054: private static final String GOOD1 = "47405-3085";
055: private static final String BAD1 = "12345-6789";
056: }
057:
058: private class SubFund {
059: private class Code {
060: private static final String CG1 = "HIEDUA";
061: private static final String GF1 = "GENFND";
062: private static final String GF_MPRACT = "MPRACT";
063: private static final String EN1 = "ENDOW";
064: }
065:
066: private class FundGroupCode {
067: private static final String CG1 = "CG";
068: private static final String GF1 = "GF";
069: private static final String EN1 = "EN";
070: }
071:
072: private static final String GOOD1 = "GENFND";
073: }
074:
075: private class HigherEdFunction {
076: private static final String GOOD1 = "AC";
077: }
078:
079: private class User {
080: private class McafeeAlan {
081: private static final String UNIVERSAL_ID = "1509103107";
082: private static final String USER_ID = "AEMCAFEE";
083: private static final String EMP_ID = "0000000013";
084: private static final String NAME = "Mcafee, Alan";
085: private static final String EMP_STATUS = "A";
086: private static final String EMP_TYPE = "P";
087: }
088:
089: private class PhamAnibal {
090: private static final String UNIVERSAL_ID = "1195901455";
091: private static final String USER_ID = "AAPHAM";
092: private static final String EMP_ID = "0000004686";
093: private static final String NAME = "Pham, Anibal";
094: private static final String EMP_STATUS = "A";
095: private static final String EMP_TYPE = "P";
096: }
097:
098: private class AhlersEsteban {
099: private static final String UNIVERSAL_ID = "1959008511";
100: private static final String USER_ID = "AHLERS";
101: private static final String EMP_ID = "0000002820";
102: private static final String NAME = "Ahlers, Esteban";
103: private static final String EMP_STATUS = "A";
104: private static final String EMP_TYPE = "P";
105: }
106: }
107:
108: private class FiscalOfficer {
109: private static final String GOOD1 = "4318506633";
110: }
111:
112: private class Supervisor {
113: private static final String GOOD1 = "4052406505";
114: }
115:
116: private class Manager {
117: private static final String GOOD1 = "4318506633";
118: }
119:
120: private class UserIds {
121: private static final String SUPER1 = "HEAGLE";
122: private static final String GOOD1 = "KCOPLEY";
123: private static final String GOOD2 = "KHUNTLEY";
124: }
125: }
126:
127: AccountGlobal newAccountGlobals;
128: MaintenanceDocument maintDoc;
129: AccountGlobalRule rule;
130:
131: public void testDefaultExistenceChecks_Org_KnownGood() {
132:
133: // create new account to test
134: newAccountGlobals = new AccountGlobal();
135: newAccountGlobals
136: .setChartOfAccountsCode(Accounts.ChartCode.GOOD1);
137: newAccountGlobals.setOrganizationCode(Accounts.Org.GOOD1);
138: setUsersThatExist();
139:
140: // run the test
141: testDefaultExistenceCheck(newAccountGlobals,
142: "organizationCode", false);
143: assertGlobalErrorMapEmpty();
144: }
145:
146: private void setUsersThatExist() {
147: newAccountGlobals
148: .setAccountManagerSystemIdentifier(Accounts.Manager.GOOD1);
149: newAccountGlobals
150: .setAccountFiscalOfficerSystemIdentifier(Accounts.FiscalOfficer.GOOD1);
151: newAccountGlobals
152: .setAccountsSupervisorySystemsIdentifier(Accounts.Supervisor.GOOD1);
153: }
154:
155: public void testDefaultExistenceChecks_AccountState_KnownGood() {
156:
157: // create new account to test
158: newAccountGlobals = new AccountGlobal();
159: newAccountGlobals.setAccountStateCode(Accounts.State.GOOD1);
160: setUsersThatExist();
161:
162: // run the test
163: testDefaultExistenceCheck(newAccountGlobals,
164: "accountStateCode", false);
165: assertGlobalErrorMapEmpty();
166: }
167: }
|