Skip to content

Commit

Permalink
RHPAM-4779: SLA due date value in ProcessInstanceLog table is not upd… (
Browse files Browse the repository at this point in the history
#2396) (#2436)

* RHPAM-4779: SLA due date value in ProcessInstanceLog table is not updated after updating process SLA

* Add test for coverage

---------

Co-authored-by: nmirasch <[email protected]>
Co-authored-by: gmunozfe <[email protected]>
  • Loading branch information
3 people authored Sep 30, 2024
1 parent 06c8501 commit 2d8b32b
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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);

Expand All @@ -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
Expand Down

0 comments on commit 2d8b32b

Please sign in to comment.