1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.leave.accrual;
17
18 import org.joda.time.DateTime;
19 import org.joda.time.LocalDate;
20 import org.joda.time.format.DateTimeFormat;
21 import org.joda.time.format.DateTimeFormatter;
22 import org.junit.Assert;
23 import org.junit.Ignore;
24 import org.junit.Test;
25 import org.kuali.kpme.core.IntegrationTest;
26 import org.kuali.kpme.core.util.TKUtils;
27 import org.kuali.kpme.tklm.TKLMIntegrationTestCase;
28 import org.kuali.kpme.tklm.leave.service.LmServiceLocator;
29
30 @Ignore
31 @IntegrationTest
32 public class PrincipalAccrualRanServiceTest extends TKLMIntegrationTestCase {
33
34
35
36
37
38
39
40
41 @Test
42 public void testUpdateInfo() {
43
44
45
46 PrincipalAccrualRan par = LmServiceLocator.getPrincipalAccrualRanService().getLastPrincipalAccrualRan("testUser");
47 Assert.assertNotNull("There should be one entry in PrincipalAccrualRan table for 'testUser'", par);
48 DateTimeFormatter formatter = DateTimeFormat.forPattern("MM/dd/yyyy");
49 Assert.assertTrue("Date of the original entry in PrincipalAccrualRan for 'testUser' should be 05/01/2012"
50 , formatter.print(par.getLastRanDateTime()).equals("05/01/2012"));
51
52 DateTime startDate = new DateTime(2012, 2, 20, 0, 0, 0, 0, TKUtils.getSystemDateTimeZone());
53 DateTime endDate = new DateTime(2012, 5, 3, 0, 0, 0, 0, TKUtils.getSystemDateTimeZone());
54
55 boolean rerunFlag = LmServiceLocator.getLeaveAccrualService().statusChangedSinceLastRun("testUser");
56 Assert.assertTrue("Status should be changed for 'testUser'", rerunFlag);
57
58 LmServiceLocator.getLeaveAccrualService().runAccrual("testUser", startDate, endDate, true);
59 par = LmServiceLocator.getPrincipalAccrualRanService().getLastPrincipalAccrualRan("testUser");
60 Assert.assertTrue("Date of the original entry in PrincipalAccrualRan for 'testUser' should be current date"
61 , formatter.print(par.getLastRanDateTime()).equals(formatter.print(LocalDate.now())));
62
63 }
64
65 }