1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.job;
17
18 import java.util.List;
19
20 import org.joda.time.DateTime;
21 import org.junit.Assert;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.kuali.kpme.core.CoreUnitTestCase;
25 import org.kuali.kpme.core.IntegrationTest;
26 import org.kuali.kpme.core.job.service.JobService;
27 import org.kuali.kpme.core.service.HrServiceLocator;
28 import org.kuali.kpme.core.util.TKUtils;
29
30 @IntegrationTest
31 public class JobServiceImplTest extends CoreUnitTestCase {
32
33 public static final String TEST_USER = "admin";
34
35 JobService jobService = null;
36
37
38 @Before
39 public void setUp() throws Exception {
40 super.setUp();
41 jobService=HrServiceLocator.getJobService();
42 }
43
44 @Test
45 public void testGetJobs() {
46 DateTime payPeriodEndDate = new DateTime(2010,7,30,1,0,0,0, TKUtils.getSystemDateTimeZone());
47 List<Job> jobs = jobService.getJobs(TEST_USER, payPeriodEndDate.toLocalDate());
48 Assert.assertNotNull("Jobs was null", jobs);
49 Assert.assertEquals("Incorrect number of jobs", 2, jobs.size());
50 }
51
52 @Test
53 public void testGetMaxJob() {
54 Job aJob = jobService.getMaxJob("admin");
55 Assert.assertNotNull("Max Job should not be null", aJob);
56 Assert.assertEquals("Max job number of admin should be 30", new Long("30"), aJob.getJobNumber());
57 }
58
59 @Test
60 public void testSearchJobs() throws Exception {
61 List<Job> allResults = HrServiceLocator.getJobService().getJobs("admin", null, null, null, null, null, null, null, null, null, "Y", "N");
62 Assert.assertEquals("Search returned the wrong number of results.", 9, allResults.size());
63
64 List<Job> restrictedResults = HrServiceLocator.getJobService().getJobs("testuser6", null, null, null, null, null, null, null, null, null, "Y", "N");
65 Assert.assertEquals("Search returned the wrong number of results.", 5, restrictedResults.size());
66 }
67
68 }