Skip to content

Commit 8eb6995

Browse files
committed
Merge pull request #31 from Orange-OpenSource/fix-lastdateiswrong
Fix #30 -> should return lastActionDate and not lastEventDate
2 parents a60a47f + a7e1561 commit 8eb6995

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/org/cloudfoundry/autosleep/scheduling/AppStateChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void run() {
3636
rescheduleWithDefaultPeriod();
3737
} else {
3838
//retrieve updated info
39-
LocalDateTime lastEvent = applicationInfo.getLastEvent();
39+
LocalDateTime lastEvent = applicationInfo.getLastActionDate();
4040
//TODO check if LocalDate issue between remote dates and app time
4141
LocalDateTime nextStartTime = lastEvent.plus(period);
4242
log.debug("last event: {}", lastEvent.toString());

src/test/java/org/cloudfoundry/autosleep/scheduling/AppStateCheckerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void testStart() throws Exception {
4444

4545
@Test
4646
public void testRunOnActive() throws Exception {
47-
when(applicationInfo.getLastEvent()).thenReturn(LocalDateTime.now());
47+
when(applicationInfo.getLastActionDate()).thenReturn(LocalDateTime.now());
4848
spyChecker.run();
4949
verify(mockRemote, never()).stopApplication(APP_UID);
5050
verify(clock,times(1)).scheduleTask(any(),anyObject(),any());
@@ -54,7 +54,7 @@ public void testRunOnActive() throws Exception {
5454
@Test
5555
public void testRunOnInactive() throws Exception {
5656
log.debug("Start testWithActiveApp()");
57-
when(applicationInfo.getLastEvent()).thenReturn(LocalDateTime.now().minus(INTERVAL.multipliedBy(2)));
57+
when(applicationInfo.getLastActionDate()).thenReturn(LocalDateTime.now().minus(INTERVAL.multipliedBy(2)));
5858
spyChecker.run();
5959
verify(mockRemote, times(1)).stopApplication(APP_UID);
6060
verify(spyChecker,times(1)).rescheduleWithDefaultPeriod();

0 commit comments

Comments
 (0)