use of org.kie.api.runtime.manager.audit.NodeInstanceLog in project jbpm by kiegroup.
the class NodeInstanceLogCleanTest method deleteLogsByNodeId.
@Test
public void deleteLogsByNodeId() {
KieSession kieSession = createKSession(HELLO_WORLD_PROCESS);
startProcess(kieSession, HELLO_WORLD_PROCESS_ID, 2);
// Delete one node named "Hello world"
int resultCount = auditService.nodeInstanceLogDelete().nodeId("_3").build().execute();
Assertions.assertThat(resultCount).isEqualTo(4);
// Now check that all other node records are still present
List<NodeInstanceLog> nodeList = auditService.nodeInstanceLogQuery().nodeId("_1", "_2", "_3").build().getResultList();
Assertions.assertThat(nodeList).hasSize(8).extracting("nodeName").containsOnly("Start", "Hello world");
}
use of org.kie.api.runtime.manager.audit.NodeInstanceLog in project jbpm by kiegroup.
the class JbpmJUnitBaseTestCase method assertNodeActive.
public void assertNodeActive(long processInstanceId, KieSession ksession, String... name) {
List<String> names = new ArrayList<String>();
for (String n : name) {
names.add(n);
}
ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId);
if (processInstance instanceof WorkflowProcessInstance) {
if (sessionPersistence) {
// ENTER -> EXIT is correctly ordered
List<? extends NodeInstanceLog> logs = logService.findNodeInstances(processInstanceId);
if (logs != null) {
List<String> activeNodes = new ArrayList<String>();
for (NodeInstanceLog l : logs) {
String nodeName = l.getNodeName();
if (l.getType() == NodeInstanceLog.TYPE_ENTER && names.contains(nodeName)) {
activeNodes.add(nodeName);
}
if (l.getType() == NodeInstanceLog.TYPE_EXIT && names.contains(nodeName)) {
activeNodes.remove(nodeName);
}
}
names.removeAll(activeNodes);
}
} else {
assertNodeActive((WorkflowProcessInstance) processInstance, names);
}
}
if (!names.isEmpty()) {
String s = names.get(0);
for (int i = 1; i < names.size(); i++) {
s += ", " + names.get(i);
}
fail("Node(s) not active: " + s);
}
}
Aggregations