use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByDelegationStateOr.
public void testQueryByDelegationStateOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskDelegationState(null);
assertThat(query.count()).isEqualTo(12);
assertThat(query.list()).hasSize(12);
query = taskService.createTaskQuery().or().taskId("invalid").taskDelegationState(DelegationState.PENDING);
assertThat(query.count()).isEqualTo(0);
assertThat(query.list()).hasSize(0);
query = taskService.createTaskQuery().or().taskId("invalid").taskDelegationState(DelegationState.RESOLVED);
assertThat(query.count()).isEqualTo(0);
assertThat(query.list()).hasSize(0);
String taskId = taskService.createTaskQuery().or().taskId("invalid").taskAssignee(GONZO).singleResult().getId();
taskService.delegateTask(taskId, KERMIT);
query = taskService.createTaskQuery().or().taskId("invalid").taskDelegationState(null);
assertThat(query.count()).isEqualTo(11);
assertThat(query.list()).hasSize(11);
query = taskService.createTaskQuery().or().taskId("invalid").taskDelegationState(DelegationState.PENDING);
assertThat(query.count()).isEqualTo(1);
assertThat(query.list()).hasSize(1);
query = taskService.createTaskQuery().or().taskId("invalid").taskDelegationState(DelegationState.RESOLVED);
assertThat(query.count()).isEqualTo(0);
assertThat(query.list()).hasSize(0);
taskService.resolveTask(taskId);
query = taskService.createTaskQuery().or().taskId("invalid").taskDelegationState(null);
assertThat(query.count()).isEqualTo(11);
assertThat(query.list()).hasSize(11);
query = taskService.createTaskQuery().or().taskId("invalid").taskDelegationState(DelegationState.PENDING);
assertThat(query.count()).isEqualTo(0);
assertThat(query.list()).hasSize(0);
query = taskService.createTaskQuery().or().taskId("invalid").taskDelegationState(DelegationState.RESOLVED);
assertThat(query.count()).isEqualTo(1);
assertThat(query.list()).hasSize(1);
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByCandidateGroupOr.
public void testQueryByCandidateGroupOr() {
TaskQuery query = taskService.createTaskQuery().or().taskId("invalid").taskCandidateGroup("management");
assertThat(query.count()).isEqualTo(3);
assertThat(query.list()).hasSize(3);
assertThatExceptionOfType(ActivitiException.class).isThrownBy(() -> query.singleResult());
TaskQuery querySales = taskService.createTaskQuery().or().taskId("invalid").taskCandidateGroup("sales");
assertThat(querySales.count()).isEqualTo(0);
assertThat(querySales.list()).hasSize(0);
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByInvalidNameIn.
public void testQueryByInvalidNameIn() {
final List<String> taskNameList = new ArrayList<String>(1);
taskNameList.add("invalid");
TaskQuery query = taskService.createTaskQuery().taskNameIn(taskNameList);
assertThat(query.list()).hasSize(0);
assertThat(query.count()).isEqualTo(0);
assertThatExceptionOfType(ActivitiIllegalArgumentException.class).isThrownBy(() -> taskService.createTaskQuery().or().taskId("invalid").taskNameIn(null).singleResult());
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByCandidateGroup.
public void testQueryByCandidateGroup() {
TaskQuery query = taskService.createTaskQuery().taskCandidateGroup("management");
assertThat(query.count()).isEqualTo(3);
assertThat(query.list()).hasSize(3);
assertThatExceptionOfType(ActivitiException.class).isThrownBy(() -> query.singleResult());
TaskQuery querySales = taskService.createTaskQuery().taskCandidateGroup("sales");
assertThat(querySales.count()).isEqualTo(0);
assertThat(querySales.list()).hasSize(0);
}
use of org.activiti.engine.task.TaskQuery in project Activiti by Activiti.
the class TaskQueryTest method testQueryByNameInIgnoreCase.
public void testQueryByNameInIgnoreCase() {
final List<String> taskNameList = new ArrayList<String>(2);
taskNameList.add("testtask");
taskNameList.add("gonzotask");
TaskQuery query = taskService.createTaskQuery().taskNameInIgnoreCase(taskNameList);
assertThat(query.list()).hasSize(7);
assertThat(query.count()).isEqualTo(7);
assertThatExceptionOfType(ActivitiException.class).isThrownBy(() -> query.singleResult());
}
Aggregations