use of org.activiti.engine.runtime.TimerJobQuery in project Activiti by Activiti.
the class JobQueryTest method testQueryByNoCriteria.
public void testQueryByNoCriteria() {
JobQuery query = managementService.createJobQuery();
verifyQueryResults(query, 1);
TimerJobQuery timerQuery = managementService.createTimerJobQuery();
verifyQueryResults(timerQuery, 3);
}
use of org.activiti.engine.runtime.TimerJobQuery in project Activiti by Activiti.
the class JobQueryTest method testQueryByOnlyTimers.
public void testQueryByOnlyTimers() {
JobQuery query = managementService.createJobQuery().timers();
verifyQueryResults(query, 0);
TimerJobQuery timerQuery = managementService.createTimerJobQuery().timers();
verifyQueryResults(timerQuery, 3);
}
use of org.activiti.engine.runtime.TimerJobQuery in project Activiti by Activiti.
the class JobQueryTest method testQueryByExecutionId.
public void testQueryByExecutionId() {
Job job = managementService.createTimerJobQuery().processInstanceId(processInstanceIdOne).singleResult();
TimerJobQuery query = managementService.createTimerJobQuery().executionId(job.getExecutionId());
assertThat(job.getId()).isEqualTo(query.singleResult().getId());
verifyQueryResults(query, 1);
}
use of org.activiti.engine.runtime.TimerJobQuery in project Activiti by Activiti.
the class JobQueryTest method testQueryByInvalidExecutionId.
public void testQueryByInvalidExecutionId() {
JobQuery query = managementService.createJobQuery().executionId("invalid");
verifyQueryResults(query, 0);
TimerJobQuery timerQuery = managementService.createTimerJobQuery().executionId("invalid");
verifyQueryResults(timerQuery, 0);
assertThatExceptionOfType(ActivitiIllegalArgumentException.class).isThrownBy(() -> managementService.createJobQuery().executionId(null).list());
assertThatExceptionOfType(ActivitiIllegalArgumentException.class).isThrownBy(() -> managementService.createTimerJobQuery().executionId(null).list());
}
use of org.activiti.engine.runtime.TimerJobQuery in project Activiti by Activiti.
the class ProcessInstanceQueryAndWithExceptionTest method testQueryWithException.
public void testQueryWithException() throws InterruptedException {
ProcessInstance processNoException = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY_NO_EXCEPTION);
ProcessInstanceQuery queryNoException = runtimeService.createProcessInstanceQuery();
assertThat(queryNoException.count()).isEqualTo(1);
assertThat(queryNoException.list()).hasSize(1);
assertThat(queryNoException.list().get(0).getId()).isEqualTo(processNoException.getId());
ProcessInstanceQuery queryWithException = runtimeService.createProcessInstanceQuery();
assertThat(queryWithException.withJobException().count()).isEqualTo(0);
assertThat(queryWithException.withJobException().list()).hasSize(0);
ProcessInstance processWithException1 = startProcessInstanceWithFailingJob(PROCESS_DEFINITION_KEY_WITH_EXCEPTION_1);
TimerJobQuery jobQuery1 = managementService.createTimerJobQuery().processInstanceId(processWithException1.getId());
assertThat(jobQuery1.withException().count()).isEqualTo(1);
assertThat(jobQuery1.withException().list()).hasSize(1);
assertThat(queryWithException.withJobException().count()).isEqualTo(1);
assertThat(queryWithException.withJobException().list()).hasSize(1);
assertThat(queryWithException.withJobException().list().get(0).getId()).isEqualTo(processWithException1.getId());
ProcessInstance processWithException2 = startProcessInstanceWithFailingJob(PROCESS_DEFINITION_KEY_WITH_EXCEPTION_2);
TimerJobQuery jobQuery2 = managementService.createTimerJobQuery().processInstanceId(processWithException2.getId());
assertThat(jobQuery2.withException().count()).isEqualTo(2);
assertThat(jobQuery2.withException().list()).hasSize(2);
assertThat(queryWithException.withJobException().count()).isEqualTo(2);
assertThat(queryWithException.withJobException().list()).hasSize(2);
assertThat(queryWithException.withJobException().processDefinitionKey(PROCESS_DEFINITION_KEY_WITH_EXCEPTION_1).list().get(0).getId()).isEqualTo(processWithException1.getId());
assertThat(queryWithException.withJobException().processDefinitionKey(PROCESS_DEFINITION_KEY_WITH_EXCEPTION_2).list().get(0).getId()).isEqualTo(processWithException2.getId());
}
Aggregations