use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class EDeploymentTest method testDeploy.
@Test
public void testDeploy() throws Exception {
DeploymentUnit basicKieJar = archive.deployBasicKieJar();
DeployedUnit deployed = deploymentService.getDeployedUnit(basicKieJar.getIdentifier());
Assertions.assertThat(deployed).isNotNull();
Assertions.assertThat(deployed.getDeploymentUnit()).isNotNull();
Assertions.assertThat(deployed.getDeploymentUnit()).isEqualTo(basicKieJar);
Assertions.assertThat(deployed.getRuntimeManager()).isNotNull();
Collection<ProcessDefinition> processes = runtimeDataService.getProcesses(new QueryContext());
Assertions.assertThat(processes).isNotNull().isNotEmpty();
}
use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class ERestServiceTaskTest method testRestWorkItem.
@Test
public void testRestWorkItem() throws Exception {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("url", RestService.PING_URL);
parameters.put("method", "GET");
Long pid = processService.startProcess(kieJar, REST_WORK_ITEM_PROCESS_ID, parameters);
Assertions.assertThat(pid).isNotNull();
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");
}
use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class ETransactionTest method testAbortProcessCommit.
@Test
public void testAbortProcessCommit() throws Exception {
Long processInstanceId = startProcessInstance(PROCESS_ID);
checkProcessInstanceIsActive(processInstanceId);
UserTransaction ut = InitialContext.doLookup(USER_TRANSACTION_NAME);
ut.begin();
try {
processService.abortProcessInstance(processInstanceId);
} catch (Exception e) {
ut.rollback();
throw e;
}
ut.commit();
List<Integer> states = new ArrayList<Integer>();
states.add(ProcessInstance.STATE_ABORTED);
Collection<ProcessInstanceDesc> processInstances = runtimeDataService.getProcessInstances(states, null, new QueryContext());
Assertions.assertThat(processInstances).isNotNull().hasSize(1);
Assertions.assertThat(processInstances.iterator().next().getId()).isEqualTo(processInstanceId);
}
use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class RemoteEjbTest method abortAllProcesses.
protected static void abortAllProcesses() {
List<Integer> stateList = new ArrayList<>();
stateList.add(ProcessInstance.STATE_ACTIVE);
QueryContext context = new QueryContext(0, Integer.MAX_VALUE, "log.status", true);
List<ProcessInstanceDesc> instanceDescList = ejb.getProcessInstances(stateList, null, context);
logger.info("Cleaning up ...");
logger.info("\tFound '" + instanceDescList.size() + "' active instances.");
for (ProcessInstanceDesc instanceDesc : instanceDescList) {
logger.info("\tAborting process instance with id '" + instanceDesc.getId() + "' of type '" + instanceDesc.getProcessId() + "'");
ejb.abortProcessInstance(instanceDesc.getId());
}
}
use of org.kie.internal.query.QueryContext in project jbpm by kiegroup.
the class EGetProcessInstanceTest method getProcessInstancesByProcessName.
@Test()
public void getProcessInstancesByProcessName() {
startProcess("org.jboss.qa.bpms.HumanTask", new HashMap<>(), 3);
startProcess("org.jboss.qa.bpms.HumanTaskWithOwnType", new HashMap<>(), 5);
List<Integer> states = new ArrayList<>();
states.add(ProcessInstance.STATE_ACTIVE);
List<ProcessInstanceDesc> foundList = ejb.getProcessInstancesByProcessName(states, "HumanTask", null, new QueryContext());
Assertions.assertThat(foundList).hasSize(3);
for (ProcessInstanceDesc pid : foundList) {
Assertions.assertThat(pid.getProcessName()).isEqualTo("HumanTask");
Assertions.assertThat(pid.getProcessId()).isEqualTo("org.jboss.qa.bpms.HumanTask");
}
}
Aggregations