Search in sources :

Example 1 with RuleFlowNodeLogEvent

use of org.drools.core.audit.event.RuleFlowNodeLogEvent in project jbpm by kiegroup.

the class JbpmJUnitBaseTestCase method assertNodeTriggered.

public void assertNodeTriggered(long processInstanceId, String... nodeNames) {
    List<String> names = new ArrayList<String>();
    for (String nodeName : nodeNames) {
        names.add(nodeName);
    }
    if (sessionPersistence) {
        List<? extends NodeInstanceLog> logs = logService.findNodeInstances(processInstanceId);
        if (logs != null) {
            for (NodeInstanceLog l : logs) {
                String nodeName = l.getNodeName();
                if ((l.getType() == NodeInstanceLog.TYPE_ENTER || l.getType() == NodeInstanceLog.TYPE_EXIT) && names.contains(nodeName)) {
                    names.remove(nodeName);
                }
            }
        }
    } else {
        for (LogEvent event : inMemoryLogger.getLogEvents()) {
            if (event instanceof RuleFlowNodeLogEvent) {
                String nodeName = ((RuleFlowNodeLogEvent) event).getNodeName();
                if (names.contains(nodeName)) {
                    names.remove(nodeName);
                }
            }
        }
    }
    if (!names.isEmpty()) {
        String s = names.get(0);
        for (int i = 1; i < names.size(); i++) {
            s += ", " + names.get(i);
        }
        fail("Node(s) not executed: " + s);
    }
}
Also used : NodeInstanceLog(org.kie.api.runtime.manager.audit.NodeInstanceLog) RuleFlowNodeLogEvent(org.drools.core.audit.event.RuleFlowNodeLogEvent) LogEvent(org.drools.core.audit.event.LogEvent) ArrayList(java.util.ArrayList) RuleFlowNodeLogEvent(org.drools.core.audit.event.RuleFlowNodeLogEvent)

Example 2 with RuleFlowNodeLogEvent

use of org.drools.core.audit.event.RuleFlowNodeLogEvent in project jbpm by kiegroup.

the class JbpmBpmn2TestCase method getCompletedNodes.

protected List<String> getCompletedNodes(long processInstanceId) {
    List<String> names = new ArrayList<String>();
    if (sessionPersistence) {
        AuditLogService auditLogService = new JPAAuditLogService(emf);
        List<NodeInstanceLog> logs = auditLogService.findNodeInstances(processInstanceId);
        if (logs != null) {
            for (NodeInstanceLog l : logs) {
                names.add(l.getNodeId());
            }
        }
    } else {
        for (LogEvent event : logger.getLogEvents()) {
            if (event instanceof RuleFlowNodeLogEvent) {
                if (event.getType() == 27) {
                    names.add(((RuleFlowNodeLogEvent) event).getNodeId());
                }
            }
        }
    }
    return names;
}
Also used : JPAAuditLogService(org.jbpm.process.audit.JPAAuditLogService) AuditLogService(org.jbpm.process.audit.AuditLogService) NodeInstanceLog(org.jbpm.process.audit.NodeInstanceLog) RuleFlowLogEvent(org.drools.core.audit.event.RuleFlowLogEvent) RuleFlowNodeLogEvent(org.drools.core.audit.event.RuleFlowNodeLogEvent) LogEvent(org.drools.core.audit.event.LogEvent) ArrayList(java.util.ArrayList) JPAAuditLogService(org.jbpm.process.audit.JPAAuditLogService) RuleFlowNodeLogEvent(org.drools.core.audit.event.RuleFlowNodeLogEvent)

Example 3 with RuleFlowNodeLogEvent

use of org.drools.core.audit.event.RuleFlowNodeLogEvent in project jbpm by kiegroup.

the class JbpmJUnitTestCase method assertNodeTriggered.

public void assertNodeTriggered(long processInstanceId, String... nodeNames) {
    List<String> names = new ArrayList<String>();
    for (String nodeName : nodeNames) {
        names.add(nodeName);
    }
    if (sessionPersistence) {
        List<NodeInstanceLog> logs = logService.findNodeInstances(processInstanceId);
        if (logs != null) {
            for (NodeInstanceLog l : logs) {
                String nodeName = l.getNodeName();
                if ((l.getType() == NodeInstanceLog.TYPE_ENTER || l.getType() == NodeInstanceLog.TYPE_EXIT) && names.contains(nodeName)) {
                    names.remove(nodeName);
                }
            }
        }
    } else {
        for (LogEvent event : logger.getLogEvents()) {
            if (event instanceof RuleFlowNodeLogEvent) {
                String nodeName = ((RuleFlowNodeLogEvent) event).getNodeName();
                if (names.contains(nodeName)) {
                    names.remove(nodeName);
                }
            }
        }
    }
    if (!names.isEmpty()) {
        String s = names.get(0);
        for (int i = 1; i < names.size(); i++) {
            s += ", " + names.get(i);
        }
        fail("Node(s) not executed: " + s);
    }
}
Also used : NodeInstanceLog(org.jbpm.process.audit.NodeInstanceLog) RuleFlowNodeLogEvent(org.drools.core.audit.event.RuleFlowNodeLogEvent) LogEvent(org.drools.core.audit.event.LogEvent) ArrayList(java.util.ArrayList) RuleFlowNodeLogEvent(org.drools.core.audit.event.RuleFlowNodeLogEvent)

Aggregations

ArrayList (java.util.ArrayList)3 LogEvent (org.drools.core.audit.event.LogEvent)3 RuleFlowNodeLogEvent (org.drools.core.audit.event.RuleFlowNodeLogEvent)3 NodeInstanceLog (org.jbpm.process.audit.NodeInstanceLog)2 RuleFlowLogEvent (org.drools.core.audit.event.RuleFlowLogEvent)1 AuditLogService (org.jbpm.process.audit.AuditLogService)1 JPAAuditLogService (org.jbpm.process.audit.JPAAuditLogService)1 NodeInstanceLog (org.kie.api.runtime.manager.audit.NodeInstanceLog)1