use of org.kie.api.executor.STATUS in project jbpm by kiegroup.
the class BasicExecutorBaseTest method testJobsQueryWithStatus.
@Test(timeout = 10000)
public void testJobsQueryWithStatus() throws InterruptedException {
CommandContext ctxCMD = new CommandContext();
ctxCMD.setData("businessKey", "low priority");
ctxCMD.setData("deploymentId", "not-deployed-here");
ctxCMD.setData("processInstanceId", 2L);
Long requestId = executorService.scheduleRequest("org.jbpm.executor.commands.PrintOutCommand", ctxCMD);
List<STATUS> statuses = Arrays.asList(STATUS.QUEUED);
List<RequestInfo> byDeploymentRequests = executorService.getRequestsByDeployment("not-deployed-here", statuses, new QueryContext());
assertEquals(1, byDeploymentRequests.size());
List<RequestInfo> byProcessInstanceRequests = executorService.getRequestsByProcessInstance(2L, statuses, new QueryContext());
assertEquals(1, byProcessInstanceRequests.size());
List<RequestInfo> byKeyRequests = executorService.getRequestsByBusinessKey("low priority", statuses, new QueryContext());
assertEquals(1, byKeyRequests.size());
List<RequestInfo> byCommandRequests = executorService.getRequestsByCommand("org.jbpm.executor.commands.PrintOutCommand", statuses, new QueryContext());
assertEquals(1, byCommandRequests.size());
statuses = Arrays.asList(STATUS.DONE);
byDeploymentRequests = executorService.getRequestsByDeployment("not-deployed-here", statuses, new QueryContext());
assertEquals(0, byDeploymentRequests.size());
byProcessInstanceRequests = executorService.getRequestsByProcessInstance(2L, statuses, new QueryContext());
assertEquals(0, byProcessInstanceRequests.size());
byKeyRequests = executorService.getRequestsByBusinessKey("low priority", statuses, new QueryContext());
assertEquals(0, byKeyRequests.size());
byCommandRequests = executorService.getRequestsByCommand("org.jbpm.executor.commands.PrintOutCommand", statuses, new QueryContext());
assertEquals(0, byCommandRequests.size());
executorService.cancelRequest(requestId);
}
use of org.kie.api.executor.STATUS in project jbpm by kiegroup.
the class BasicExecutorBaseTest method testProcessContextJobsExecution.
@Test(timeout = 10000)
public void testProcessContextJobsExecution() throws InterruptedException {
CountDownAsyncJobListener countDownListener = configureListener(1);
CommandContext ctxCMD = new CommandContext();
ctxCMD.setData("businessKey", "low priority");
ctxCMD.setData("deploymentId", "not-deployed-here");
ctxCMD.setData("processInstanceId", 2L);
Long requestId = executorService.scheduleRequest("org.jbpm.executor.commands.PrintOutCommand", ctxCMD);
List<STATUS> statuses = Arrays.asList(STATUS.QUEUED);
List<RequestInfo> byDeploymentRequests = executorService.getRequestsByDeployment("not-deployed-here", statuses, new QueryContext());
assertEquals(1, byDeploymentRequests.size());
List<RequestInfo> byProcessInstanceRequests = executorService.getRequestsByProcessInstance(2L, statuses, new QueryContext());
assertEquals(1, byProcessInstanceRequests.size());
List<RequestInfo> inErrorRequests = executorService.getInErrorRequests(new QueryContext());
assertEquals(0, inErrorRequests.size());
List<RequestInfo> queuedRequests = executorService.getQueuedRequests(new QueryContext());
assertEquals(1, queuedRequests.size());
List<RequestInfo> executedRequests = executorService.getCompletedRequests(new QueryContext());
assertEquals(0, executedRequests.size());
countDownListener.waitTillCompleted(5000);
inErrorRequests = executorService.getInErrorRequests(new QueryContext());
assertEquals(0, inErrorRequests.size());
queuedRequests = executorService.getQueuedRequests(new QueryContext());
assertEquals(1, queuedRequests.size());
executedRequests = executorService.getCompletedRequests(new QueryContext());
assertEquals(0, executedRequests.size());
executorService.cancelRequest(requestId);
}
Aggregations