1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.batch;
17
18 import org.junit.Assert;
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.kuali.hr.test.KPMETestCase;
22 import org.kuali.hr.time.batch.service.BatchJobService;
23 import org.kuali.hr.time.service.base.TkServiceLocator;
24 import org.kuali.hr.time.util.TkConstants;
25
26 public class BatchJobTest extends KPMETestCase {
27
28 private static final String BATCH_JOB_NAME = "testJob";
29 private Long ibjId;
30 private BatchJobService bjService;
31
32 @Before
33 public void setUp() throws Exception {
34 super.setUp();
35 bjService = TkServiceLocator.getBatchJobService();
36 }
37 private void creatAndSaveBatchJob(){
38 InitiateBatchJob ibj = new InitiateBatchJob("5");
39 ibj.setBatchJobName(BATCH_JOB_NAME);
40 ibj.setBatchJobStatus(TkConstants.BATCH_JOB_ENTRY_STATUS.SCHEDULED);
41 ibj.setTimeElapsed(new Long(123));
42 ibj.setHrPyCalendarEntryId("1234");
43
44 bjService.saveBatchJob(ibj);
45
46 ibjId = ibj.getTkBatchJobId();
47 }
48
49 @Test
50 public void testSavingAndRetrievingBatchJob() throws Exception {
51 creatAndSaveBatchJob();
52 BatchJob bj = (BatchJob) bjService.getBatchJob(ibjId);
53 Assert.assertTrue("Batch Job Name not right", bj.getBatchJobName().equals(BATCH_JOB_NAME));
54 }
55 }