use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class EThreadInfoTest method getStackTrace.
// ========== PRIVATE METHODS ==========
private Collection<VariableDesc> getStackTrace(Long pid) {
QueryContext query = new QueryContext();
query.setOrderBy("id");
query.setAscending(false);
return runtimeDataService.getVariableHistory(pid, "stackTrace", query);
}
use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class EThreadInfoTest method getThreadName.
private Collection<VariableDesc> getThreadName(Long pid) {
QueryContext query = new QueryContext();
query.setOrderBy("id");
query.setAscending(false);
return runtimeDataService.getVariableHistory(pid, "threadName", query);
}
use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class EThreadInfoTest method testRESTThreadInfo.
@Test
public void testRESTThreadInfo() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("url", RestService.PING_URL);
parameters.put("method", "GET");
Long pid = startProcessInstance(THREAD_INFO_PROCESS_ID, parameters);
processService.signalProcessInstance(pid, "start", "rest");
listener.waitTillCompleted();
Assertions.assertThat(hasNodeLeft(pid, "rest")).isTrue();
Assertions.assertThat(hasNodeLeft(pid, "REST")).isTrue();
Collection<VariableDesc> result = runtimeDataService.getVariableHistory(pid, "result", new QueryContext());
Assertions.assertThat(result).hasSize(1);
Assertions.assertThat(result.iterator().next().getNewValue()).isEqualTo("pong");
Collection<VariableDesc> status = runtimeDataService.getVariableHistory(pid, "status", new QueryContext());
Assertions.assertThat(status).hasSize(1);
Assertions.assertThat(status.iterator().next().getNewValue()).isEqualTo("200");
Collection<VariableDesc> statusMsg = runtimeDataService.getVariableHistory(pid, "statusMsg", new QueryContext());
Assertions.assertThat(statusMsg).hasSize(1);
Assertions.assertThat(statusMsg.iterator().next().getNewValue()).contains("successfully completed Ok");
Collection<VariableDesc> stackTraceHistory = getStackTrace(pid);
Collection<VariableDesc> threadNameHistory = getThreadName(pid);
System.out.println("====stackTraceHistory====");
System.out.println(stackTraceHistory);
System.out.println("====stackTraceHistoryLast====");
System.out.println(stackTraceHistory.iterator().next().getNewValue());
System.out.println("====stackTraceHistorySize====");
System.out.println(stackTraceHistory.size());
System.out.println("====threadNameHistory====");
System.out.println(threadNameHistory);
System.out.println("====threadNameHistoryLast====");
System.out.println(threadNameHistory.iterator().next().getNewValue());
Assertions.assertThat(threadNameHistory.iterator().next().getNewValue()).startsWith("EE");
}
use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class EGetNodeInstanceTest method getNodeInstanceForWorkItem.
@Test()
public void getNodeInstanceForWorkItem() {
Long pid = ejb.startProcess("org.jboss.qa.bpms.HumanTask");
Long workItemId = null;
List<NodeInstanceDesc> nodeList = ejb.getProcessInstanceHistoryActive(pid, new QueryContext());
for (NodeInstanceDesc node : nodeList) {
if (node.getName().equals("Hello")) {
workItemId = node.getWorkItemId();
}
}
if (workItemId == null) {
throw new RuntimeException("Work item Id not found.");
}
NodeInstanceDesc nodeDesc = ejb.getNodeInstanceForWorkItem(workItemId);
Assertions.assertThat(nodeDesc).isNotNull();
Assertions.assertThat(nodeDesc.getDeploymentId()).isEqualTo(TestKjars.INTEGRATION.getGav());
Assertions.assertThat(nodeDesc.getProcessInstanceId()).isEqualTo(pid);
Assertions.assertThat(nodeDesc.getNodeId()).isEqualTo("_E4906EEE-6F73-4A8A-9E8E-E046EE35C10F");
Assertions.assertThat(nodeDesc.getName()).isEqualTo("Hello");
Assertions.assertThat(nodeDesc.getNodeType()).isEqualTo("HumanTaskNode");
Assertions.assertThat(nodeDesc.isCompleted()).isFalse();
}
use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class EGetProcessInstanceTest method getProcessInstancesByDeploymentId.
@Test()
public void getProcessInstancesByDeploymentId() throws NamingException {
EJBClient ejbClient2 = new EJBClient(TestKjars.BPMN_BUILD_TEST.getGav());
startProcess("org.jboss.qa.bpms.HumanTask", new HashMap<>(), 3);
startProcess("org.jboss.qa.bpms.HumanTaskWithOwnType", new HashMap<>(), 5);
ejbClient2.startProcess("bpmnBuildTest.myProcess");
List<Integer> states = new ArrayList<>();
states.add(ProcessInstance.STATE_ACTIVE);
List<ProcessInstanceDesc> foundList = ejb.getProcessInstancesByDeploymentId(TestKjars.INTEGRATION.getGav(), states, new QueryContext());
Assertions.assertThat(foundList).hasSize(8);
for (ProcessInstanceDesc pid : foundList) {
Assertions.assertThat(pid.getProcessName()).isIn("HumanTask", "HumanTaskWithOwnType");
}
}
Aggregations