From 2d8b32ba181a7570c9b6bc80c92bc58f63bd1fa0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 19:56:41 +0200 Subject: [PATCH] =?UTF-8?q?RHPAM-4779:=20SLA=20due=20date=20value=20in=20P?= =?UTF-8?q?rocessInstanceLog=20table=20is=20not=20upd=E2=80=A6=20(#2396)?= =?UTF-8?q?=20(#2436)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * RHPAM-4779: SLA due date value in ProcessInstanceLog table is not updated after updating process SLA * Add test for coverage --------- Co-authored-by: nmirasch Co-authored-by: gmunozfe --- .../ServicesAwareAuditEventBuilderTest.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/impl/audit/ServicesAwareAuditEventBuilderTest.java b/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/impl/audit/ServicesAwareAuditEventBuilderTest.java index 81e1a34193..8ddfe16baf 100644 --- a/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/impl/audit/ServicesAwareAuditEventBuilderTest.java +++ b/jbpm-services/jbpm-kie-services/src/test/java/org/jbpm/kie/services/impl/audit/ServicesAwareAuditEventBuilderTest.java @@ -22,7 +22,6 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.util.Collection; import java.time.LocalDate; import java.time.ZoneId; import java.util.Date; @@ -58,6 +57,10 @@ public class ServicesAwareAuditEventBuilderTest extends AbstractKieServicesBaseTest { private static final Logger logger = LoggerFactory.getLogger(ProcessServiceImplTest.class); + + private static final Date TEST_DATE = Date.from(LocalDate.of(2024, 3, 14).atStartOfDay(ZoneId.systemDefault()).toInstant()); + + private static final String TEST_DEPLOYMENT_UNIT = "unit1"; private static final Date TEST_DATE = Date.from(LocalDate.of(2024, 3, 14).atStartOfDay(ZoneId.systemDefault()).toInstant()); @@ -100,7 +103,7 @@ private void setUpMocks() { when(processInstance.getId()).thenReturn(1L); when(processInstance.getDescription()).thenReturn("Some test Process"); when(processInstance.getSlaCompliance()).thenReturn(0); - + when(processInstance.getSlaDueDate()).thenReturn(TEST_DATE); when(processInstance.getMetaData()).thenReturn(processMetadata); @@ -127,6 +130,22 @@ public void testBuildProcessStartedEvent() { assertEquals("testUser", log.getIdentity()); } + + /** + * Test build the ProcessInstanceLog for data change + */ + @Test + public void testBuildProcessDataChangedEventImpl() { + + ProcessDataChangedEvent pdce = new ProcessDataChangedEventImpl(processInstance, kieRuntime); + + ProcessInstanceLog log = (ProcessInstanceLog) builder.buildEvent(pdce); + + assertEquals(TEST_DATE, log.getSlaDueDate()); + + assertEquals(TEST_DEPLOYMENT_UNIT, log.getExternalId()); + + } /** * Test build the ProcessInstanceLog for data change