From 844bd859fe796c8a677e2bb869e5a13f4116761b Mon Sep 17 00:00:00 2001 From: Mark Patton Date: Wed, 6 Mar 2024 10:58:02 -0500 Subject: [PATCH] Test that the submission status updater ignores submissions outside the date window --- .../service/SubmissionStatusUpdaterIT.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/service/SubmissionStatusUpdaterIT.java b/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/service/SubmissionStatusUpdaterIT.java index 8cdc633f..25a0432a 100644 --- a/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/service/SubmissionStatusUpdaterIT.java +++ b/pass-deposit-services/deposit-core/src/test/java/org/eclipse/pass/deposit/service/SubmissionStatusUpdaterIT.java @@ -36,6 +36,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.mock.mockito.MockBean; /** @@ -46,6 +47,9 @@ public class SubmissionStatusUpdaterIT extends AbstractSubmissionIT { @Autowired private SubmissionStatusUpdater submissionStatusUpdater; @MockBean private SubmissionStatusService statusService; + @Value("${pass.status.update.window.days}") + private long updateWindowDays; + private Submission submission; @BeforeEach @@ -137,4 +141,20 @@ void testDoUpdate_Success_NoUpdateNotSubmitted() throws IOException { // THEN verify(passClient, times(0)).updateObject(any()); } + + @Test + void testDoUpdate_Success_OutSideDateWindow() throws IOException { + // GIVEN + submission.setSubmissionStatus(SubmissionStatus.SUBMITTED); + submission.setSubmitted(true); + submission.setSubmittedDate(ZonedDateTime.now().minusDays(updateWindowDays + 1)); + passClient.updateObject(submission); + Mockito.clearInvocations(passClient); + + // WHEN + submissionStatusUpdater.doUpdate(); + + // THEN + verify(passClient, times(0)).updateObject(any()); + } }