001: package edu.iu.uis.eden.fiscalupaadelegation;
002:
003: import java.sql.Timestamp;
004: import java.util.Collection;
005: import java.util.Date;
006:
007: import junit.framework.TestCase;
008: import edu.iu.uis.eden.SpringServiceLocator;
009:
010: //import edu.iu.uis.eden.routemodules.fiscaluppadelegation.FiscalUpaaDelegation;
011: //import edu.iu.uis.eden.routemodules.fiscaluppadelegation.FiscalUpaaDelegationService;
012:
013: public class TestFiscalUpaaDelegationServicePENDING extends TestCase {
014:
015: /*private String userName = "rkirkend";
016:
017: private FiscalUpaaDelegation fiscUpaaDel;
018: private FiscalUpaaDelegation fiscUpaaDel2;
019: private FiscalUpaaDelegation fiscUpaaDel3;
020:
021: protected void setUp() {
022: SpringServiceLocator.setToTestMode(null);
023: fiscUpaaDel = new FiscalUpaaDelegation();
024: fiscUpaaDel.setFiscalUpaaCd("U");
025: fiscUpaaDel.setActiveInd("Y");
026: fiscUpaaDel.setFinCoaCd("UA");
027: fiscUpaaDel.setFromDate(new Timestamp(new Date().getTime() - 10000));
028: fiscUpaaDel.setToDate(new Timestamp(new Date().getTime() + 10000));
029: fiscUpaaDel.setOrgCd("BUDU");
030: fiscUpaaDel.setDelegateTypeCd("U");
031: fiscUpaaDel.setResponsibilityId(new Long(1));
032: fiscUpaaDel.setRuleId(new Long(1));
033: fiscUpaaDel.setWorkflowId(this.userName);
034: fiscUpaaDel.setPositionType("SB");
035: fiscUpaaDel.setDelegateWorkgroupId(null);
036:
037: this.getFiscalUpaaDelegationService().save(fiscUpaaDel);
038:
039: fiscUpaaDel2 = new FiscalUpaaDelegation();
040: fiscUpaaDel2.setFiscalUpaaCd("A");
041: fiscUpaaDel2.setActiveInd("Y");
042: fiscUpaaDel2.setFinCoaCd("UA");
043: fiscUpaaDel2.setFromDate(new Timestamp(new Date().getTime() - 10000));
044: fiscUpaaDel2.setToDate(new Timestamp(new Date().getTime() + 10000));
045: fiscUpaaDel2.setOrgCd("BDOT");
046: fiscUpaaDel2.setDelegateTypeCd("W");
047: fiscUpaaDel2.setResponsibilityId(new Long(2));
048: fiscUpaaDel2.setRuleId(new Long(2));
049: fiscUpaaDel2.setDelegateWorkgroupId(new Long(1));
050: fiscUpaaDel2.setPositionType("SM");
051: fiscUpaaDel2.setWorkflowId(null);
052:
053: this.getFiscalUpaaDelegationService().save(fiscUpaaDel2);
054:
055: fiscUpaaDel3 = new FiscalUpaaDelegation();
056: fiscUpaaDel3.setFiscalUpaaCd("A");
057: fiscUpaaDel3.setActiveInd("N");
058: fiscUpaaDel3.setFinCoaCd("BL");
059: fiscUpaaDel3.setFromDate(new Timestamp(new Date().getTime() - 10000));
060: fiscUpaaDel3.setToDate(new Timestamp(new Date().getTime() + 10000));
061: fiscUpaaDel3.setOrgCd("BL");
062: fiscUpaaDel3.setDelegateTypeCd("U");
063: fiscUpaaDel3.setResponsibilityId(new Long(3));
064: fiscUpaaDel3.setRuleId(new Long(3));
065: fiscUpaaDel3.setWorkflowId(this.userName);
066: fiscUpaaDel3.setPositionType("HR");
067: fiscUpaaDel3.setDelegateWorkgroupId(null);
068:
069: this.getFiscalUpaaDelegationService().save(fiscUpaaDel3);
070: }
071:
072: protected void tearDown() throws Exception {
073: this.getFiscalUpaaDelegationService().delete(fiscUpaaDel);
074: this.getFiscalUpaaDelegationService().delete(fiscUpaaDel2);
075: this.getFiscalUpaaDelegationService().delete(fiscUpaaDel3);
076:
077: fiscUpaaDel = this.getFiscalUpaaDelegationService().findByRuleId(fiscUpaaDel.getRuleId());
078: fiscUpaaDel2 = this.getFiscalUpaaDelegationService().findByRuleId(fiscUpaaDel2.getRuleId());
079: fiscUpaaDel3 = this.getFiscalUpaaDelegationService().findByRuleId(fiscUpaaDel3.getRuleId());
080:
081: if (fiscUpaaDel != null || fiscUpaaDel2 != null || fiscUpaaDel3 != null) {
082: throw new Exception("The fiscal upaa delegation data has not been deleted from the database");
083: }
084: }
085:
086: public void testFindByResponsibilityIdPosType() throws Exception {
087: Collection fiscalUpaaDelegations = this.getFiscalUpaaDelegationService().findByResponsibilityIdPosType(fiscUpaaDel.getResponsibilityId(), fiscUpaaDel.getPositionType());
088: assertFalse("Database rows were not retrieved for responsibility id and position type", fiscalUpaaDelegations.isEmpty());
089: assertFalse("Too many database rows returned for responsibility id and position type", fiscalUpaaDelegations.size() > 1);
090: assertEquals("Wrong database row retrieved for responsibility id and position type", fiscUpaaDel.getOrgCd(), ((FiscalUpaaDelegation) fiscalUpaaDelegations.iterator().next()).getOrgCd());
091: }
092:
093: public void testFindByRuleId() throws Exception {
094: FiscalUpaaDelegation fiscUpaaDel4 = this.getFiscalUpaaDelegationService().findByRuleId(fiscUpaaDel2.getRuleId());
095: assertNotNull("A fiscal upaa delegation database row was not retrieved for rule id", fiscUpaaDel4);
096: assertEquals("Wrong database row retrieved for rule id", fiscUpaaDel2.getOrgCd(), fiscUpaaDel4.getOrgCd());
097: }
098:
099: public void testNarrowingFind() throws Exception {
100: Collection fiscalUpaaDelegations = this.getFiscalUpaaDelegationService().narrowingFind(fiscUpaaDel3);
101: assertFalse("Database rows were not retrieved for narrowing find", fiscalUpaaDelegations.isEmpty());
102: assertFalse("Too many database rows returned for narrowing find", fiscalUpaaDelegations.size() > 1);
103: assertEquals("Wrong database row retrieved for narrowing find", fiscUpaaDel3.getOrgCd(), ((FiscalUpaaDelegation) fiscalUpaaDelegations.iterator().next()).getOrgCd());
104: }
105:
106: private FiscalUpaaDelegationService getFiscalUpaaDelegationService() {
107: return (FiscalUpaaDelegationService) SpringServiceLocator.getService(SpringServiceLocator.FISCAL_UPAA_DELEGATION_SRV);
108: }*/
109:
110: }
111:
112: /*
113: * Copyright 2003 The Trustees of Indiana University. All rights reserved. This file is part of the EDEN software package. For license information, see the LICENSE file in the top level directory of the EDEN source distribution.
114: */
|