Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.67.x-blue] RHPAM-4779: SLA due date value in ProcessInstanceLog table is not updated after updating process SLA #3050

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void testSLAonUserTaskViolated() throws Exception {
activeNodes = processClient.findActiveNodeInstances(CONTAINER_ID, pid, 0, 10);
assertThat(activeNodes).hasSize(1);
taskNode = activeNodes.get(0);
assertNodeInstance(taskNode, "Hello", SLA_VIOLATED);
assertNodeInstance(taskNode, "Hello", SLA_VIOLATED, -1);

taskClient.completeAutoProgress(CONTAINER_ID, task.getId(), USER_YODA, null);
tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10);
Expand Down Expand Up @@ -240,11 +240,15 @@ private void assertProcessInstance(Long pid, int processState, int slaStatus, lo
}
}

private void assertNodeInstance(NodeInstance ni, String nodeName, int slaStatus) {
private void assertNodeInstance(NodeInstance ni, String nodeName, int slaStatus) {
assertNodeInstance(ni, nodeName, slaStatus, 30000);
}

private void assertNodeInstance(NodeInstance ni, String nodeName, int slaStatus, long deltaTime) {
assertThat(ni.getName()).isEqualTo(nodeName);
assertThat(ni.getSlaCompliance()).isEqualTo(slaStatus);
if (slaStatus != SLA_NA) {
assertThat(ni.getSlaDueDate()).isCloseTo(new Date(), 30000);
if (slaStatus != SLA_NA && deltaTime > 0) {
assertThat(ni.getSlaDueDate()).isCloseTo(new Date(), deltaTime);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.kie.api.event.process.ProcessNodeTriggeredEvent;
import org.kie.api.event.process.ProcessStartedEvent;
import org.kie.api.event.process.ProcessVariableChangedEvent;
import org.kie.api.event.process.ProcessDataChangedEvent;
import org.kie.api.event.process.SLAViolatedEvent;
import org.kie.api.runtime.manager.audit.VariableInstanceLog;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -39,7 +40,7 @@
import static org.kie.server.spring.boot.autoconfiguration.audit.replication.MessageType.PROCESS_SLA_VIOLATED;
import static org.kie.server.spring.boot.autoconfiguration.audit.replication.MessageType.PROCESS_START_EVENT_TYPE;
import static org.kie.server.spring.boot.autoconfiguration.audit.replication.MessageType.VAR_CHANGE_EVENT_TYPE;

import static org.kie.server.spring.boot.autoconfiguration.audit.replication.MessageType.PROCESS_DATA_CHANGED_EVENT_TYPE;

/**
* AuditListener
Expand Down Expand Up @@ -124,4 +125,11 @@ protected void nodeScheduled(ProcessAsyncNodeScheduledEvent event) {
}
}

@Override
public void processDataChanged(ProcessDataChangedEvent event) {
ProcessInstanceLog log = (ProcessInstanceLog) getProcessInstanceMetadata(event.getProcessInstance(), METADATA_PROCESSINTANCE_LOG);
if (log != null) {
jmsSender.sendMessage(log, PROCESS_DATA_CHANGED_EVENT_TYPE);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private MessageType() {
public static final int VAR_CHANGE_EVENT_TYPE = 104;
public static final int NODE_SLA_VIOLATED = 105;
public static final int PROCESS_SLA_VIOLATED = 106;
public static final int PROCESS_DATA_CHANGED_EVENT_TYPE = 108;

public static final int TASK_STARTED = 201;
public static final int TASK_ACTIVATED = 202;
Expand Down
Loading