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)

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

* Add test for coverage

---------

Co-authored-by: gmunozfe <gmunozfe@redhat.com>
  • Loading branch information
nmirasch and gmunozfe authored Aug 5, 2024
1 parent 6c49a4f commit 775cf38
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 775cf38

Please sign in to comment.