|
|
|
@ -3,6 +3,9 @@ package acceptance.task;
|
|
|
|
|
import static java.lang.String.CASE_INSENSITIVE_ORDER;
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
|
|
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
|
|
|
import static org.mockito.ArgumentMatchers.anyInt;
|
|
|
|
|
import static org.mockito.ArgumentMatchers.eq;
|
|
|
|
|
import static pro.taskana.common.api.BaseQuery.SortDirection.ASCENDING;
|
|
|
|
|
import static pro.taskana.common.api.BaseQuery.SortDirection.DESCENDING;
|
|
|
|
|
import static pro.taskana.task.api.TaskCustomField.CUSTOM_7;
|
|
|
|
@ -24,30 +27,32 @@ import java.util.stream.Stream;
|
|
|
|
|
import org.apache.ibatis.session.Configuration;
|
|
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
|
|
import org.assertj.core.api.SoftAssertions;
|
|
|
|
|
import org.junit.jupiter.api.BeforeAll;
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
|
import org.junit.jupiter.api.DynamicTest;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
import org.junit.jupiter.api.TestFactory;
|
|
|
|
|
import org.junit.jupiter.api.extension.ExtendWith;
|
|
|
|
|
import org.mockito.MockedStatic;
|
|
|
|
|
import org.mockito.Mockito;
|
|
|
|
|
|
|
|
|
|
import pro.taskana.classification.api.models.ClassificationSummary;
|
|
|
|
|
import pro.taskana.common.api.BaseQuery.SortDirection;
|
|
|
|
|
import pro.taskana.common.api.TimeInterval;
|
|
|
|
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
|
|
|
|
import pro.taskana.common.internal.TaskanaEngineProxy;
|
|
|
|
|
import pro.taskana.common.internal.util.ListUtil;
|
|
|
|
|
import pro.taskana.common.internal.util.Triplet;
|
|
|
|
|
import pro.taskana.common.test.security.JaasExtension;
|
|
|
|
|
import pro.taskana.common.test.security.WithAccessId;
|
|
|
|
|
import pro.taskana.task.api.TaskCustomField;
|
|
|
|
|
import pro.taskana.task.api.TaskQuery;
|
|
|
|
|
import pro.taskana.task.api.TaskQueryColumnName;
|
|
|
|
|
import pro.taskana.task.api.TaskService;
|
|
|
|
|
import pro.taskana.task.api.models.Attachment;
|
|
|
|
|
import pro.taskana.task.api.models.AttachmentSummary;
|
|
|
|
|
import pro.taskana.task.api.models.ObjectReference;
|
|
|
|
|
import pro.taskana.task.api.models.Task;
|
|
|
|
|
import pro.taskana.task.api.models.TaskSummary;
|
|
|
|
|
import pro.taskana.task.internal.TaskServiceImpl;
|
|
|
|
|
import pro.taskana.task.internal.TaskTestMapper;
|
|
|
|
|
import pro.taskana.task.internal.models.TaskImpl;
|
|
|
|
|
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
|
|
|
@ -56,12 +61,8 @@ import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
|
|
|
|
@ExtendWith(JaasExtension.class)
|
|
|
|
|
class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
|
|
|
|
|
private static TaskService taskService;
|
|
|
|
|
|
|
|
|
|
@BeforeAll
|
|
|
|
|
static void setup() {
|
|
|
|
|
taskService = taskanaEngine.getTaskService();
|
|
|
|
|
}
|
|
|
|
|
private static final TaskServiceImpl TASK_SERVICE =
|
|
|
|
|
(TaskServiceImpl) taskanaEngine.getTaskService();
|
|
|
|
|
|
|
|
|
|
@BeforeEach
|
|
|
|
|
void before() throws Exception {
|
|
|
|
@ -79,7 +80,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
columnName ->
|
|
|
|
|
softly
|
|
|
|
|
.assertThatCode(
|
|
|
|
|
() -> taskService.createTaskQuery().listValues(columnName, ASCENDING))
|
|
|
|
|
() -> TASK_SERVICE.createTaskQuery().listValues(columnName, ASCENDING))
|
|
|
|
|
.describedAs("Column is not working " + columnName)
|
|
|
|
|
.doesNotThrowAnyException());
|
|
|
|
|
softly.assertAll();
|
|
|
|
@ -89,14 +90,14 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryTaskValuesForColumnName() {
|
|
|
|
|
List<String> columnValueList =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.ownerLike("%user%")
|
|
|
|
|
.orderByOwner(DESCENDING)
|
|
|
|
|
.listValues(OWNER, null);
|
|
|
|
|
assertThat(columnValueList).hasSize(3);
|
|
|
|
|
|
|
|
|
|
columnValueList = taskService.createTaskQuery().listValues(STATE, null);
|
|
|
|
|
columnValueList = TASK_SERVICE.createTaskQuery().listValues(STATE, null);
|
|
|
|
|
assertThat(columnValueList).hasSize(5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -104,40 +105,51 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryTaskValuesForColumnNameOnAttachments() {
|
|
|
|
|
List<String> columnValueList =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.attachmentReferenceValueIn("val4")
|
|
|
|
|
.listValues(A_CHANNEL, null);
|
|
|
|
|
assertThat(columnValueList).hasSize(2);
|
|
|
|
|
|
|
|
|
|
columnValueList =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.attachmentReferenceValueLike("%")
|
|
|
|
|
.listValues(A_REF_VALUE, null);
|
|
|
|
|
assertThat(columnValueList).hasSize(6);
|
|
|
|
|
|
|
|
|
|
columnValueList =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.orderByAttachmentClassificationId(DESCENDING)
|
|
|
|
|
.listValues(A_CLASSIFICATION_ID, null);
|
|
|
|
|
assertThat(columnValueList).hasSize(12);
|
|
|
|
|
|
|
|
|
|
columnValueList =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.orderByClassificationKey(DESCENDING)
|
|
|
|
|
.listValues(CLASSIFICATION_KEY, null);
|
|
|
|
|
assertThat(columnValueList).hasSize(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void should_SplitTaskListIntoChunksOf32000_When_AugmentingTasksAfterTaskQuery() {
|
|
|
|
|
MockedStatic<ListUtil> listUtilMock = Mockito.mockStatic(ListUtil.class);
|
|
|
|
|
listUtilMock.when(() -> ListUtil.partitionBasedOnSize(any(), anyInt())).thenCallRealMethod();
|
|
|
|
|
|
|
|
|
|
TASK_SERVICE.createTaskQuery().list();
|
|
|
|
|
|
|
|
|
|
listUtilMock.verify(() -> ListUtil.partitionBasedOnSize(any(), eq(32000)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOwnerLike() {
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().ownerLike("%a%", "%u%").orderByCreated(ASCENDING).list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().ownerLike("%a%", "%u%").orderByCreated(ASCENDING).list();
|
|
|
|
|
|
|
|
|
|
assertThat(results).hasSize(39);
|
|
|
|
|
TaskSummary previousSummary = null;
|
|
|
|
@ -154,7 +166,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
void testQueryForParentBusinessProcessId() {
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().parentBusinessProcessIdLike("%PBPI%", "doc%3%").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().parentBusinessProcessIdLike("%PBPI%", "doc%3%").list();
|
|
|
|
|
assertThat(results).hasSize(33);
|
|
|
|
|
for (TaskSummary taskSummary : results) {
|
|
|
|
|
assertThat(taskSummary.getExternalId()).isNotNull();
|
|
|
|
@ -164,7 +176,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
results.stream().map(TaskSummary::getParentBusinessProcessId).toArray(String[]::new);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> result2 =
|
|
|
|
|
taskService.createTaskQuery().parentBusinessProcessIdIn(parentIds).list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().parentBusinessProcessIdIn(parentIds).list();
|
|
|
|
|
assertThat(result2).hasSize(33);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -172,12 +184,12 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForName() {
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> results = taskService.createTaskQuery().nameLike("task%").list();
|
|
|
|
|
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().nameLike("task%").list();
|
|
|
|
|
assertThat(results).hasSize(7);
|
|
|
|
|
|
|
|
|
|
String[] ids = results.stream().map(TaskSummary::getName).toArray(String[]::new);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> result2 = taskService.createTaskQuery().nameIn(ids).list();
|
|
|
|
|
List<TaskSummary> result2 = TASK_SERVICE.createTaskQuery().nameIn(ids).list();
|
|
|
|
|
assertThat(result2).hasSize(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -185,21 +197,21 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForClassificationKey() {
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> results = taskService.createTaskQuery().classificationKeyLike("L10%").list();
|
|
|
|
|
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().classificationKeyLike("L10%").list();
|
|
|
|
|
assertThat(results).hasSize(77);
|
|
|
|
|
|
|
|
|
|
String[] ids =
|
|
|
|
|
results.stream().map(t -> t.getClassificationSummary().getKey()).toArray(String[]::new);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> result2 = taskService.createTaskQuery().classificationKeyIn(ids).list();
|
|
|
|
|
List<TaskSummary> result2 = TASK_SERVICE.createTaskQuery().classificationKeyIn(ids).list();
|
|
|
|
|
assertThat(result2).hasSize(77);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> result3 =
|
|
|
|
|
taskService.createTaskQuery().classificationKeyNotIn("T2100", "T2000").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().classificationKeyNotIn("T2100", "T2000").list();
|
|
|
|
|
assertThat(result3).hasSize(82);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> result4 =
|
|
|
|
|
taskService.createTaskQuery().classificationKeyNotIn("L1050", "L1060", "T2100").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().classificationKeyNotIn("L1050", "L1060", "T2100").list();
|
|
|
|
|
assertThat(result4).hasSize(10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -220,12 +232,12 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
"2018-01-15",
|
|
|
|
|
createSimpleCustomPropertyMap(3));
|
|
|
|
|
|
|
|
|
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
|
|
|
|
Task task = TASK_SERVICE.getTask("TKI:000000000000000000000000000000000000");
|
|
|
|
|
task.addAttachment(attachment);
|
|
|
|
|
taskService.updateTask(task);
|
|
|
|
|
TASK_SERVICE.updateTask(task);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().idIn("TKI:000000000000000000000000000000000000").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().idIn("TKI:000000000000000000000000000000000000").list();
|
|
|
|
|
assertThat(results).hasSize(1);
|
|
|
|
|
assertThat(results.get(0).getAttachmentSummaries()).hasSize(3);
|
|
|
|
|
|
|
|
|
@ -237,7 +249,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
void testQueryForExternalId() {
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.externalIdIn(
|
|
|
|
|
"ETI:000000000000000000000000000000000000",
|
|
|
|
@ -246,14 +258,14 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
assertThat(results).hasSize(2);
|
|
|
|
|
|
|
|
|
|
List<String> resultValues =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.externalIdLike("ETI:000000000000000000000000000000%")
|
|
|
|
|
.listValues(TaskQueryColumnName.EXTERNAL_ID, DESCENDING);
|
|
|
|
|
assertThat(resultValues).hasSize(74);
|
|
|
|
|
|
|
|
|
|
long countAllExternalIds = taskService.createTaskQuery().externalIdLike("ETI:%").count();
|
|
|
|
|
long countAllIds = taskService.createTaskQuery().count();
|
|
|
|
|
long countAllExternalIds = TASK_SERVICE.createTaskQuery().externalIdLike("ETI:%").count();
|
|
|
|
|
long countAllIds = TASK_SERVICE.createTaskQuery().count();
|
|
|
|
|
assertThat(countAllExternalIds).isEqualTo(countAllIds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -290,21 +302,21 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
void testQueryForCustomX(
|
|
|
|
|
TaskCustomField customField, String[] searchArguments, int expectedResult) throws Exception {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().customAttributeLike(customField, searchArguments).list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().customAttributeLike(customField, searchArguments).list();
|
|
|
|
|
assertThat(results).hasSize(expectedResult);
|
|
|
|
|
|
|
|
|
|
String[] ids =
|
|
|
|
|
results.stream().map(t -> t.getCustomAttribute(customField)).toArray(String[]::new);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> result2 =
|
|
|
|
|
taskService.createTaskQuery().customAttributeIn(customField, ids).list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().customAttributeIn(customField, ids).list();
|
|
|
|
|
assertThat(result2).hasSize(expectedResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForCustom7WithExceptionInLike() {
|
|
|
|
|
assertThatThrownBy(() -> taskService.createTaskQuery().customAttributeLike(CUSTOM_7).list())
|
|
|
|
|
assertThatThrownBy(() -> TASK_SERVICE.createTaskQuery().customAttributeLike(CUSTOM_7).list())
|
|
|
|
|
.isInstanceOf(InvalidArgumentException.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -312,10 +324,10 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForCustom7WithExceptionInIn() throws Exception {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().customAttributeLike(CUSTOM_7, "fsdhfshk%").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().customAttributeLike(CUSTOM_7, "fsdhfshk%").list();
|
|
|
|
|
assertThat(results).isEmpty();
|
|
|
|
|
|
|
|
|
|
assertThatThrownBy(() -> taskService.createTaskQuery().customAttributeIn(CUSTOM_7).list())
|
|
|
|
|
assertThatThrownBy(() -> TASK_SERVICE.createTaskQuery().customAttributeIn(CUSTOM_7).list())
|
|
|
|
|
.isInstanceOf(InvalidArgumentException.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -323,27 +335,27 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForCustom7WithException() throws Exception {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().customAttributeLike(CUSTOM_7, "%").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().customAttributeLike(CUSTOM_7, "%").list();
|
|
|
|
|
assertThat(results).hasSize(2);
|
|
|
|
|
|
|
|
|
|
String[] ids = results.stream().map(t -> t.getCustomAttribute(CUSTOM_7)).toArray(String[]::new);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> result2 =
|
|
|
|
|
taskService.createTaskQuery().customAttributeIn(CUSTOM_7, ids).list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().customAttributeIn(CUSTOM_7, ids).list();
|
|
|
|
|
assertThat(result2).hasSize(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryTaskByCustomAttributes() throws Exception {
|
|
|
|
|
Task newTask = taskService.newTask("USER-1-1", "DOMAIN_A");
|
|
|
|
|
Task newTask = TASK_SERVICE.newTask("USER-1-1", "DOMAIN_A");
|
|
|
|
|
newTask.setPrimaryObjRef(
|
|
|
|
|
createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
|
|
|
|
newTask.setClassificationKey("T2100");
|
|
|
|
|
Map<String, String> customAttributesForCreate =
|
|
|
|
|
createSimpleCustomPropertyMap(20000); // about 1 Meg
|
|
|
|
|
newTask.setCustomAttributeMap(customAttributesForCreate);
|
|
|
|
|
Task createdTask = taskService.createTask(newTask);
|
|
|
|
|
Task createdTask = TASK_SERVICE.createTask(newTask);
|
|
|
|
|
|
|
|
|
|
assertThat(createdTask).isNotNull();
|
|
|
|
|
// query the task by custom attributes
|
|
|
|
@ -377,7 +389,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryAndCountMatch() {
|
|
|
|
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
|
|
|
|
TaskQuery taskQuery = TASK_SERVICE.createTaskQuery();
|
|
|
|
|
List<TaskSummary> tasks = taskQuery.nameIn("Task99", "Task01", "Widerruf").list();
|
|
|
|
|
long numberOfTasks = taskQuery.nameIn("Task99", "Task01", "Widerruf").count();
|
|
|
|
|
assertThat(tasks).hasSize((int) numberOfTasks);
|
|
|
|
@ -386,7 +398,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryAllPaged() {
|
|
|
|
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
|
|
|
|
TaskQuery taskQuery = TASK_SERVICE.createTaskQuery();
|
|
|
|
|
long numberOfTasks = taskQuery.count();
|
|
|
|
|
assertThat(numberOfTasks).isEqualTo(87);
|
|
|
|
|
List<TaskSummary> tasks = taskQuery.orderByDue(DESCENDING).list();
|
|
|
|
@ -401,21 +413,21 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForCreatorIn() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().creatorIn("creator_user_id2", "creator_user_id3").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().creatorIn("creator_user_id2", "creator_user_id3").list();
|
|
|
|
|
assertThat(results).hasSize(4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForCreatorLike() {
|
|
|
|
|
List<TaskSummary> results = taskService.createTaskQuery().creatorLike("ersTeLlEr%").list();
|
|
|
|
|
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().creatorLike("ersTeLlEr%").list();
|
|
|
|
|
assertThat(results).hasSize(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForNoteLike() {
|
|
|
|
|
List<TaskSummary> results = taskService.createTaskQuery().noteLike("Some%").list();
|
|
|
|
|
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().noteLike("Some%").list();
|
|
|
|
|
assertThat(results).hasSize(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -423,7 +435,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForClassificationCategoryIn() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().classificationCategoryIn("MANUAL", "AUTOMATIC").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().classificationCategoryIn("MANUAL", "AUTOMATIC").list();
|
|
|
|
|
assertThat(results).hasSize(4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -431,7 +443,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForClassificationCategoryLike() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().classificationCategoryLike("AUTO%").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().classificationCategoryLike("AUTO%").list();
|
|
|
|
|
assertThat(results).hasSize(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -439,7 +451,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForPrimaryObjectReferenceCompanyLike() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().primaryObjectReferenceCompanyLike("My%").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().primaryObjectReferenceCompanyLike("My%").list();
|
|
|
|
|
assertThat(results).hasSize(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -447,7 +459,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForPrimaryObjectReferenceSystemLike() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().primaryObjectReferenceSystemLike("My%").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().primaryObjectReferenceSystemLike("My%").list();
|
|
|
|
|
assertThat(results).hasSize(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -455,7 +467,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForPrimaryObjectReferenceSystemInstanceLike() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().primaryObjectReferenceSystemInstanceLike("My%").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().primaryObjectReferenceSystemInstanceLike("My%").list();
|
|
|
|
|
assertThat(results).hasSize(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -463,21 +475,21 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForPrimaryObjectReferenceTypeLike() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().primaryObjectReferenceTypeLike("My%").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().primaryObjectReferenceTypeLike("My%").list();
|
|
|
|
|
assertThat(results).hasSize(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForReadEquals() {
|
|
|
|
|
List<TaskSummary> results = taskService.createTaskQuery().readEquals(true).list();
|
|
|
|
|
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().readEquals(true).list();
|
|
|
|
|
assertThat(results).hasSize(39);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForTransferredEquals() {
|
|
|
|
|
List<TaskSummary> results = taskService.createTaskQuery().transferredEquals(true).list();
|
|
|
|
|
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().transferredEquals(true).list();
|
|
|
|
|
assertThat(results).hasSize(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -485,14 +497,14 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForBusinessProcessIdIn() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().businessProcessIdIn("PI_0000000000003", "BPI21").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().businessProcessIdIn("PI_0000000000003", "BPI21").list();
|
|
|
|
|
assertThat(results).hasSize(9);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForBusinessProcessIdLike() {
|
|
|
|
|
List<TaskSummary> results = taskService.createTaskQuery().businessProcessIdLike("pI_%").list();
|
|
|
|
|
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().businessProcessIdLike("pI_%").list();
|
|
|
|
|
assertThat(results).hasSize(80);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -500,7 +512,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForAttachmentClassificationKeyIn() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().attachmentClassificationKeyIn("L110102").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().attachmentClassificationKeyIn("L110102").list();
|
|
|
|
|
assertThat(results).hasSize(1);
|
|
|
|
|
assertThat(results.get(0).getId()).isEqualTo("TKI:000000000000000000000000000000000002");
|
|
|
|
|
}
|
|
|
|
@ -509,7 +521,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForAttachmentClassificationKeyLike() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().attachmentClassificationKeyLike("%10102").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().attachmentClassificationKeyLike("%10102").list();
|
|
|
|
|
assertThat(results).hasSize(1);
|
|
|
|
|
assertThat(results.get(0).getId()).isEqualTo("TKI:000000000000000000000000000000000002");
|
|
|
|
|
}
|
|
|
|
@ -518,7 +530,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForAttachmentclassificationIdIn() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.attachmentClassificationIdIn("CLI:000000000000000000000000000000000002")
|
|
|
|
|
.list();
|
|
|
|
@ -529,7 +541,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForAttachmentChannelLike() {
|
|
|
|
|
List<TaskSummary> results = taskService.createTaskQuery().attachmentChannelLike("%6").list();
|
|
|
|
|
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().attachmentChannelLike("%6").list();
|
|
|
|
|
assertThat(results).hasSize(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -537,7 +549,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForAttachmentReferenceIn() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().attachmentReferenceValueIn("val4").list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().attachmentReferenceValueIn("val4").list();
|
|
|
|
|
assertThat(results).hasSize(6);
|
|
|
|
|
assertThat(results.get(5).getAttachmentSummaries()).hasSize(1);
|
|
|
|
|
}
|
|
|
|
@ -548,7 +560,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
TimeInterval interval =
|
|
|
|
|
new TimeInterval(getInstant("2018-01-30T12:00:00"), getInstant("2018-01-31T12:00:00"));
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.attachmentReceivedWithin(interval)
|
|
|
|
|
.orderByWorkbasketId(DESCENDING)
|
|
|
|
@ -561,7 +573,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@WithAccessId(user = "admin")
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOrderByCreatorDesc() {
|
|
|
|
|
List<TaskSummary> results = taskService.createTaskQuery().orderByCreator(DESCENDING).list();
|
|
|
|
|
List<TaskSummary> results = TASK_SERVICE.createTaskQuery().orderByCreator(DESCENDING).list();
|
|
|
|
|
|
|
|
|
|
assertThat(results)
|
|
|
|
|
.hasSizeGreaterThan(2)
|
|
|
|
@ -573,7 +585,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOrderByWorkbasketIdDesc() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().orderByWorkbasketId(DESCENDING).list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().orderByWorkbasketId(DESCENDING).list();
|
|
|
|
|
|
|
|
|
|
assertThat(results)
|
|
|
|
|
.hasSizeGreaterThan(2)
|
|
|
|
@ -605,7 +617,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
|
|
|
|
|
void testQueryForOrderByCustomX(TaskCustomField customField, SortDirection sortDirection) {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().orderByCustomAttribute(customField, sortDirection).list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().orderByCustomAttribute(customField, sortDirection).list();
|
|
|
|
|
|
|
|
|
|
Comparator<String> comparator =
|
|
|
|
|
sortDirection == ASCENDING ? CASE_INSENSITIVE_ORDER : CASE_INSENSITIVE_ORDER.reversed();
|
|
|
|
@ -621,7 +633,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOrderWithDirectionNull() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService.createTaskQuery().orderByPrimaryObjectReferenceSystemInstance(null).list();
|
|
|
|
|
TASK_SERVICE.createTaskQuery().orderByPrimaryObjectReferenceSystemInstance(null).list();
|
|
|
|
|
|
|
|
|
|
assertThat(results)
|
|
|
|
|
.hasSizeGreaterThan(2)
|
|
|
|
@ -634,7 +646,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOrderByAttachmentClassificationIdAsc() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.idIn(
|
|
|
|
|
"TKI:000000000000000000000000000000000009",
|
|
|
|
@ -656,7 +668,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOrderByAttachmentClassificationIdDesc() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.idIn(
|
|
|
|
|
"TKI:000000000000000000000000000000000009",
|
|
|
|
@ -678,7 +690,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOrderByAttachmentClassificationKeyAsc() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.idIn(
|
|
|
|
|
"TKI:000000000000000000000000000000000009",
|
|
|
|
@ -700,7 +712,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOrderByAttachmentClassificationKeyDesc() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.idIn(
|
|
|
|
|
"TKI:000000000000000000000000000000000009",
|
|
|
|
@ -722,7 +734,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOrderByAttachmentRefValueDesc() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.idIn(
|
|
|
|
|
"TKI:000000000000000000000000000000000010",
|
|
|
|
@ -743,7 +755,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForOrderByAttachmentChannelAscAndReferenceDesc() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.idIn(
|
|
|
|
|
"TKI:000000000000000000000000000000000009",
|
|
|
|
@ -767,7 +779,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
@Test
|
|
|
|
|
void testQueryForAttachmentChannelLikeAndOrdering() {
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.attachmentChannelLike("CH%")
|
|
|
|
|
.orderByClassificationKey(DESCENDING)
|
|
|
|
@ -779,7 +791,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
|
|
|
|
|
|
|
|
|
|
results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.attachmentChannelLike("CH%")
|
|
|
|
|
.orderByClassificationKey(ASCENDING)
|
|
|
|
@ -796,7 +808,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
void testQueryForExternalIdIn() {
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.externalIdIn(
|
|
|
|
|
"ETI:000000000000000000000000000000000010",
|
|
|
|
@ -814,7 +826,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
|
|
|
|
|
String[] ids = results.stream().map(TaskSummary::getId).toArray(String[]::new);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> result2 = taskService.createTaskQuery().idIn(ids).list();
|
|
|
|
|
List<TaskSummary> result2 = TASK_SERVICE.createTaskQuery().idIn(ids).list();
|
|
|
|
|
assertThat(result2).hasSize(10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -823,7 +835,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
void testQueryForExternalIdLike() {
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> results =
|
|
|
|
|
taskService
|
|
|
|
|
TASK_SERVICE
|
|
|
|
|
.createTaskQuery()
|
|
|
|
|
.externalIdLike("ETI:00000000000000000000000000000000001%")
|
|
|
|
|
.list();
|
|
|
|
@ -831,7 +843,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|
|
|
|
|
|
|
|
|
String[] ids = results.stream().map(TaskSummary::getId).toArray(String[]::new);
|
|
|
|
|
|
|
|
|
|
List<TaskSummary> result2 = taskService.createTaskQuery().idIn(ids).list();
|
|
|
|
|
List<TaskSummary> result2 = TASK_SERVICE.createTaskQuery().idIn(ids).list();
|
|
|
|
|
assertThat(result2).hasSize(10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|