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

RHPAM-4779: SLA due date value in ProcessInstanceLog table is not upd… #3048

Merged
merged 2 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -21,24 +21,11 @@
import org.jbpm.process.audit.AbstractAuditLoggerAdapter;
import org.jbpm.process.audit.NodeInstanceLog;
import org.jbpm.process.audit.ProcessInstanceLog;
import org.kie.api.event.process.ProcessAsyncNodeScheduledEvent;
import org.kie.api.event.process.ProcessCompletedEvent;
import org.kie.api.event.process.ProcessNodeLeftEvent;
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.SLAViolatedEvent;
import org.kie.api.event.process.*;
nmirasch marked this conversation as resolved.
Show resolved Hide resolved
import org.kie.api.runtime.manager.audit.VariableInstanceLog;
import org.springframework.beans.factory.annotation.Autowired;

import static org.kie.server.spring.boot.autoconfiguration.audit.replication.MessageType.NODE_ENTER_EVENT_TYPE;
import static org.kie.server.spring.boot.autoconfiguration.audit.replication.MessageType.NODE_LEFT_EVENT_TYPE;
import static org.kie.server.spring.boot.autoconfiguration.audit.replication.MessageType.NODE_SCHEDULED_EVENT_TYPE;
import static org.kie.server.spring.boot.autoconfiguration.audit.replication.MessageType.NODE_SLA_VIOLATED;
import static org.kie.server.spring.boot.autoconfiguration.audit.replication.MessageType.PROCESS_COMPLETED_EVENT_TYPE;
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.*;
nmirasch marked this conversation as resolved.
Show resolved Hide resolved


/**
Expand Down Expand Up @@ -124,4 +111,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