001: package edu.iu.uis.eden.hrmsreviewhierarchy;
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.hrmsreviewhierarchy.HRMSReviewHierarchy;
011: //import edu.iu.uis.eden.routemodules.hrmsreviewhierarchy.HRMSReviewHierarchyService;
012:
013: public class TestHRMSReviewHierarchyServicePENDING extends TestCase {
014:
015: /* private String userName = "rkirkend";
016:
017: private HRMSReviewHierarchy hrmsReviewHier;
018: private HRMSReviewHierarchy hrmsReviewHier2;
019: private HRMSReviewHierarchy hrmsReviewHier3;
020:
021: protected void setUp() {
022: SpringServiceLocator.setToTestMode(null);
023: hrmsReviewHier = new HRMSReviewHierarchy();
024: hrmsReviewHier.setActionRequest("C");
025: hrmsReviewHier.setActiveInd("Y");
026: hrmsReviewHier.setDocTypeName("AddHRRv");
027: hrmsReviewHier.setFinCoaCd("BL");
028: hrmsReviewHier.setFromDate(new Timestamp(new Date().getTime() - 10000));
029: hrmsReviewHier.setToDate(new Timestamp(new Date().getTime() + 10000));
030: hrmsReviewHier.setOrgCd("BL");
031: hrmsReviewHier.setUserType("U");
032: hrmsReviewHier.setPriority(new Integer(1));
033: hrmsReviewHier.setResponsibilityId(new Long(1));
034: hrmsReviewHier.setRuleId(new Long(1));
035: hrmsReviewHier.setReviewDesc("Test HRMS Review Hierarchy 1");
036: hrmsReviewHier.setWorkflowId(this.userName);
037: hrmsReviewHier.setSalaryPlan("CL");
038: hrmsReviewHier.setPositionType("SB");
039: hrmsReviewHier.setWorkgroupId(new Long(0));
040:
041: this.getHRMSReviewHierarchyService().save(hrmsReviewHier);
042:
043: hrmsReviewHier2 = new HRMSReviewHierarchy();
044: hrmsReviewHier2.setActionRequest("A");
045: hrmsReviewHier2.setActiveInd("Y");
046: hrmsReviewHier2.setDocTypeName("AddHRRv");
047: hrmsReviewHier2.setFinCoaCd("BL");
048: hrmsReviewHier2.setFromDate(new Timestamp(new Date().getTime() - 10000));
049: hrmsReviewHier2.setToDate(new Timestamp(new Date().getTime() + 10000));
050: hrmsReviewHier2.setOrgCd("CHEM");
051: hrmsReviewHier2.setUserType("W");
052: hrmsReviewHier2.setPriority(new Integer(1));
053: hrmsReviewHier2.setResponsibilityId(new Long(2));
054: hrmsReviewHier2.setRuleId(new Long(2));
055: hrmsReviewHier2.setReviewDesc("Test HRMS Review Hierarchy 2");
056: hrmsReviewHier2.setWorkgroupId(new Long(1));
057: hrmsReviewHier2.setSalaryPlan("PA");
058: hrmsReviewHier2.setPositionType("SM");
059: hrmsReviewHier2.setWorkflowId(null);
060:
061: this.getHRMSReviewHierarchyService().save(hrmsReviewHier2);
062:
063: hrmsReviewHier3 = new HRMSReviewHierarchy();
064: hrmsReviewHier3.setActionRequest("A");
065: hrmsReviewHier3.setActiveInd("N");
066: hrmsReviewHier3.setDocTypeName("AddHRRv");
067: hrmsReviewHier3.setFinCoaCd("BL");
068: hrmsReviewHier3.setFromDate(new Timestamp(new Date().getTime() - 10000));
069: hrmsReviewHier3.setToDate(new Timestamp(new Date().getTime() + 10000));
070: hrmsReviewHier3.setOrgCd("ARSC");
071: hrmsReviewHier3.setUserType("U");
072: hrmsReviewHier3.setPriority(new Integer(1));
073: hrmsReviewHier3.setResponsibilityId(new Long(3));
074: hrmsReviewHier3.setRuleId(new Long(3));
075: hrmsReviewHier3.setReviewDesc("Test HRMS Review Hierarchy 3");
076: hrmsReviewHier3.setWorkflowId(this.userName);
077: hrmsReviewHier3.setSalaryPlan("HR");
078: hrmsReviewHier3.setPositionType("HR");
079: hrmsReviewHier3.setWorkgroupId(new Long(0));
080:
081: this.getHRMSReviewHierarchyService().save(hrmsReviewHier3);
082: }
083:
084: protected void tearDown() throws Exception {
085: this.getHRMSReviewHierarchyService().delete(hrmsReviewHier);
086: this.getHRMSReviewHierarchyService().delete(hrmsReviewHier2);
087: this.getHRMSReviewHierarchyService().delete(hrmsReviewHier3);
088:
089: hrmsReviewHier = this.getHRMSReviewHierarchyService().findByRuleId(hrmsReviewHier.getRuleId());
090: hrmsReviewHier2 = this.getHRMSReviewHierarchyService().findByRuleId(hrmsReviewHier2.getRuleId());
091: hrmsReviewHier3 = this.getHRMSReviewHierarchyService().findByRuleId(hrmsReviewHier3.getRuleId());
092:
093: if (hrmsReviewHier != null || hrmsReviewHier2 != null || hrmsReviewHier3 != null) {
094: throw new Exception("The hrms review hierarchy data has not been deleted from the database");
095: }
096: }
097:
098: public void testFindByResponsibilityId() throws Exception {
099: Collection hrmsReviewHierarchies = this.getHRMSReviewHierarchyService().findByResponsibilityId(hrmsReviewHier.getResponsibilityId());
100: assertFalse("Database rows were not retrieved for responsibility id", hrmsReviewHierarchies.isEmpty());
101: assertFalse("Too many database rows returned for responsibility id", hrmsReviewHierarchies.size() > 1);
102: assertEquals("Wrong database row retrieved for responsibility id", hrmsReviewHier.getReviewDesc(), ((HRMSReviewHierarchy) hrmsReviewHierarchies.iterator().next()).getReviewDesc());
103: }
104:
105: public void testFindByRuleId() throws Exception {
106: HRMSReviewHierarchy hrmsReviewHier4 = this.getHRMSReviewHierarchyService().findByRuleId(hrmsReviewHier2.getRuleId());
107: assertNotNull("A hrms review hierarchy database row was not retrieved for rule id", hrmsReviewHier4);
108: assertEquals("Wrong database row retrieved for rule id", hrmsReviewHier2.getReviewDesc(), hrmsReviewHier4.getReviewDesc());
109: }
110:
111: public void testNarrowingFind() throws Exception {
112: Collection hrmsReviewHierarchies = this.getHRMSReviewHierarchyService().narrowingFind(hrmsReviewHier3);
113: assertFalse("Database rows were not retrieved for narrowing find", hrmsReviewHierarchies.isEmpty());
114: assertFalse("Too many database rows returned for narrowing find", hrmsReviewHierarchies.size() > 1);
115: assertEquals("Wrong database row retrieved for narrowing find", hrmsReviewHier3.getReviewDesc(), ((HRMSReviewHierarchy) hrmsReviewHierarchies.iterator().next()).getReviewDesc());
116: }
117:
118: public void testFindRules() throws Exception {
119: Collection rules = this.getHRMSReviewHierarchyService().findRules(hrmsReviewHier);
120: assertFalse("Database rows were not retrieved when finding rules", rules.isEmpty());
121: assertFalse("Too many database rows returned when finding rules", rules.size() > 1);
122: assertEquals("Wrong database row retrieved when finding rules", hrmsReviewHier.getReviewDesc(), ((HRMSReviewHierarchy) rules.iterator().next()).getReviewDesc());
123: }
124:
125: private HRMSReviewHierarchyService getHRMSReviewHierarchyService() {
126: return (HRMSReviewHierarchyService) SpringServiceLocator.getService(SpringServiceLocator.HRMS_REVIEW_HIERARCHY_SRV);
127: }
128: */
129: }
130:
131: /*
132: * 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.
133: */
|