TSK-1911: Fix details of TaskHistoryEvents

This commit is contained in:
ryzheboka 2022-07-05 17:40:03 +02:00 committed by Elena Mokeeva
parent d83678ac54
commit ba5e582beb
7 changed files with 219 additions and 137 deletions

View File

@ -1,4 +1,5 @@
INSERT INTO OBJECT_REFERENCE VALUES ('ID1', 'TKI:000000000000000000000000000000000000', 'Company1', 'System1', 'Instance1', 'Type1', 'Value1'); INSERT INTO OBJECT_REFERENCE VALUES ('ID1', 'TKI:000000000000000000000000000000000000', 'Company1', 'System1', 'Instance1', 'Type1', 'Value1');
INSERT INTO OBJECT_REFERENCE VALUES ('ID2', 'TKI:000000000000000000000000000000000000', 'Company2', 'System2', 'Instance2', 'Type2', 'Value2'); INSERT INTO OBJECT_REFERENCE VALUES ('ID2', 'TKI:000000000000000000000000000000000000', 'Company2', 'System2', 'Instance2', 'Type2', 'Value2');
INSERT INTO OBJECT_REFERENCE VALUES ('ID3', 'TKI:000000000000000000000000000000000001', 'Company3', 'System3', 'Instance3', 'Type3', 'Value2'); INSERT INTO OBJECT_REFERENCE VALUES ('ID3', 'TKI:000000000000000000000000000000000001', 'Company3', 'System3', 'Instance3', 'Type3', 'Value2');
INSERT INTO OBJECT_REFERENCE VALUES ('ID4', 'TKI:000000000000000000000000000000000002', 'Company1', 'System4', 'Instance4', 'Type2', 'Value2'); INSERT INTO OBJECT_REFERENCE VALUES ('ID4', 'TKI:000000000000000000000000000000000002', 'Company1', 'System4', 'Instance4', 'Type2', 'Value2');
INSERT INTO OBJECT_REFERENCE VALUES ('ID5', 'TKI:000000000000000000000000000000000053', 'SomeCompany', 'SomeSystem', 'SomeInstance', 'SomeType', 'SomeValue');

View File

@ -1,3 +1,4 @@
INSERT INTO OBJECT_REFERENCE VALUES ('1', 'TaskId1', 'Company1', 'System1', 'Instance1', 'Type1', 'Value1'); INSERT INTO OBJECT_REFERENCE VALUES ('1', 'TaskId1', 'Company1', 'System1', 'Instance1', 'Type1', 'Value1');
INSERT INTO OBJECT_REFERENCE VALUES ('2', 'TaskId2', 'Company2', 'System2', 'Instance2', 'Type2', 'Value2'); INSERT INTO OBJECT_REFERENCE VALUES ('2', 'TaskId2', 'Company2', 'System2', 'Instance2', 'Type2', 'Value2');
INSERT INTO OBJECT_REFERENCE VALUES ('3', 'TaskId3', 'Company3', 'System3', 'Instance3', 'Type3', 'Value3'); INSERT INTO OBJECT_REFERENCE VALUES ('3', 'TaskId3', 'Company3', 'System3', 'Instance3', 'Type3', 'Value3');
INSERT INTO OBJECT_REFERENCE VALUES ('ID5', 'TKI:000000000000000000000000000000000053', 'SomeCompany', 'SomeSystem', 'SomeInstance', 'SomeType', 'SomeValue');

View File

@ -5,11 +5,15 @@ import static org.assertj.core.api.Assertions.assertThat;
import acceptance.AbstractAccTest; import acceptance.AbstractAccTest;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.stream.Stream;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.internal.util.Triplet;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl; import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
@ -28,66 +32,84 @@ class CreateHistoryEventOnTaskCancelClaimAccTest extends AbstractAccTest {
private final SimpleHistoryServiceImpl historyService = getHistoryService(); private final SimpleHistoryServiceImpl historyService = getHistoryService();
@WithAccessId(user = "admin") @WithAccessId(user = "admin")
@Test @TestFactory
void should_CreateCancelClaimedHistoryEvent_When_TaskIsCancelClaimed() throws Exception { Stream<DynamicTest> should_CreateCancelClaimedHistoryEvent_When_TaskIsCancelClaimed() {
final String taskId = "TKI:000000000000000000000000000000000043"; List<Triplet<String, String, String>> list =
Task task = taskService.getTask(taskId); List.of(
final Instant oldModified = task.getModified(); Triplet.of(
final Instant oldClaimed = task.getClaimed(); "With Attachment and secondary Object Reference",
"TKI:000000000000000000000000000000000002",
"user-1-1"),
Triplet.of(
"Without Attachment and secondary Object References",
"TKI:000000000000000000000000000000000043",
"user-b-1"));
ThrowingConsumer<Triplet<String, String, String>> test =
t -> {
String taskId = t.getMiddle();
Task task = taskService.getTask(taskId);
final Instant oldModified = task.getModified();
final Instant oldClaimed = task.getClaimed();
TaskHistoryQueryMapper taskHistoryQueryMapper = getHistoryQueryMapper(); TaskHistoryQueryMapper taskHistoryQueryMapper = getHistoryQueryMapper();
List<TaskHistoryEvent> events = List<TaskHistoryEvent> events =
taskHistoryQueryMapper.queryHistoryEvents( taskHistoryQueryMapper.queryHistoryEvents(
(TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId)); (TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId));
assertThat(events).isEmpty(); assertThat(events).isEmpty();
assertThat(task.getState()).isEqualTo(TaskState.CLAIMED); assertThat(task.getState()).isEqualTo(TaskState.CLAIMED);
task = taskService.forceCancelClaim(taskId); task = taskService.forceCancelClaim(taskId);
assertThat(task.getState()).isEqualTo(TaskState.READY); assertThat(task.getState()).isEqualTo(TaskState.READY);
events = events =
taskHistoryQueryMapper.queryHistoryEvents( taskHistoryQueryMapper.queryHistoryEvents(
(TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId)); (TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId));
assertThat(events).hasSize(1); assertThat(events).hasSize(1);
TaskHistoryEvent event = events.get(0); TaskHistoryEvent event = events.get(0);
assertThat(event.getEventType()).isEqualTo(TaskHistoryEventType.CLAIM_CANCELLED.getName()); assertThat(event.getEventType())
.isEqualTo(TaskHistoryEventType.CLAIM_CANCELLED.getName());
event = historyService.getTaskHistoryEvent(event.getId()); event = historyService.getTaskHistoryEvent(event.getId());
assertThat(event.getDetails()).isNotNull(); assertThat(event.getDetails()).isNotNull();
JSONArray changes = new JSONObject(event.getDetails()).getJSONArray("changes"); JSONArray changes = new JSONObject(event.getDetails()).getJSONArray("changes");
String oldOwner = t.getRight();
JSONObject expectedClaimed =
new JSONObject()
.put("newValue", "")
.put("fieldName", "claimed")
.put("oldValue", oldClaimed.toString());
JSONObject expectedModified =
new JSONObject()
.put("newValue", task.getModified().toString())
.put("fieldName", "modified")
.put("oldValue", oldModified.toString());
JSONObject expectedState =
new JSONObject()
.put("newValue", "READY")
.put("fieldName", "state")
.put("oldValue", "CLAIMED");
JSONObject expectedOwner =
new JSONObject()
.put("newValue", "")
.put("fieldName", "owner")
.put("oldValue", oldOwner);
JSONObject expectedClaimed = JSONArray expectedChanges =
new JSONObject() new JSONArray()
.put("newValue", "") .put(expectedClaimed)
.put("fieldName", "claimed") .put(expectedModified)
.put("oldValue", oldClaimed.toString()); .put(expectedState)
JSONObject expectedModified = .put(expectedOwner);
new JSONObject()
.put("newValue", task.getModified().toString())
.put("fieldName", "modified")
.put("oldValue", oldModified.toString());
JSONObject expectedState =
new JSONObject()
.put("newValue", "READY")
.put("fieldName", "state")
.put("oldValue", "CLAIMED");
JSONObject expectedOwner =
new JSONObject().put("newValue", "").put("fieldName", "owner").put("oldValue", "user-b-1");
JSONArray expectedChanges = assertThat(changes.similar(expectedChanges)).isTrue();
new JSONArray() };
.put(expectedClaimed) return DynamicTest.stream(list.iterator(), Triplet::getLeft, test);
.put(expectedModified)
.put(expectedState)
.put(expectedOwner);
assertThat(changes.similar(expectedChanges)).isTrue();
} }
} }

View File

@ -5,11 +5,15 @@ import static org.assertj.core.api.Assertions.assertThat;
import acceptance.AbstractAccTest; import acceptance.AbstractAccTest;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.stream.Stream;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.internal.util.Pair;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl; import pro.taskana.simplehistory.impl.SimpleHistoryServiceImpl;
@ -28,66 +32,86 @@ class CreateHistoryEventOnTaskClaimAccTest extends AbstractAccTest {
private final SimpleHistoryServiceImpl historyService = getHistoryService(); private final SimpleHistoryServiceImpl historyService = getHistoryService();
@WithAccessId(user = "admin") @WithAccessId(user = "admin")
@Test @TestFactory
void should_CreateClaimedHistoryEvent_When_TaskIsClaimed() throws Exception { Stream<DynamicTest> should_CreateClaimedHistoryEvent_When_TaskIsClaimed() {
final String taskId = "TKI:000000000000000000000000000000000047"; List<Pair<String, String>> list =
final Instant oldModified = taskService.getTask(taskId).getModified(); List.of(
Pair.of(
"With Attachment and secondary Object Reference",
"TKI:000000000000000000000000000000000053"),
Pair.of(
"Without Attachment and secondary Object References",
"TKI:000000000000000000000000000000000047"));
TaskHistoryQueryMapper taskHistoryQueryMapper = getHistoryQueryMapper(); ThrowingConsumer<Pair<String, String>> test =
pair -> {
final Instant oldModified = taskService.getTask(pair.getRight()).getModified();
List<TaskHistoryEvent> events = TaskHistoryQueryMapper taskHistoryQueryMapper = getHistoryQueryMapper();
taskHistoryQueryMapper.queryHistoryEvents(
(TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId));
assertThat(events).isEmpty(); List<TaskHistoryEvent> events =
taskHistoryQueryMapper.queryHistoryEvents(
(TaskHistoryQueryImpl)
historyService.createTaskHistoryQuery().taskIdIn(pair.getRight()));
assertThat(taskService.getTask(taskId).getState()).isEqualTo(TaskState.READY); assertThat(events).isEmpty();
Task task = taskService.claim(taskId);
assertThat(task.getState()).isEqualTo(TaskState.CLAIMED); assertThat(taskService.getTask(pair.getRight()).getState()).isEqualTo(TaskState.READY);
Task task = taskService.claim(pair.getRight());
events = assertThat(task.getState()).isEqualTo(TaskState.CLAIMED);
taskHistoryQueryMapper.queryHistoryEvents(
(TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId));
TaskHistoryEvent event = events.get(0); events =
taskHistoryQueryMapper.queryHistoryEvents(
(TaskHistoryQueryImpl)
historyService.createTaskHistoryQuery().taskIdIn(pair.getRight()));
assertThat(event.getEventType()).isEqualTo(TaskHistoryEventType.CLAIMED.getName()); TaskHistoryEvent event = events.get(0);
event = historyService.getTaskHistoryEvent(event.getId()); assertThat(event.getEventType()).isEqualTo(TaskHistoryEventType.CLAIMED.getName());
assertThat(event.getDetails()).isNotNull(); event = historyService.getTaskHistoryEvent(event.getId());
JSONArray changes = new JSONObject(event.getDetails()).getJSONArray("changes"); assertThat(event.getDetails()).isNotNull();
JSONObject expectedClaimed = JSONArray changes = new JSONObject(event.getDetails()).getJSONArray("changes");
new JSONObject()
.put("newValue", task.getModified().toString())
.put("fieldName", "claimed")
.put("oldValue", "");
JSONObject expectedModified =
new JSONObject()
.put("newValue", task.getModified().toString())
.put("fieldName", "modified")
.put("oldValue", oldModified.toString());
JSONObject expectedState =
new JSONObject()
.put("newValue", "CLAIMED")
.put("fieldName", "state")
.put("oldValue", "READY");
JSONObject expectedOwner =
new JSONObject().put("newValue", "admin").put("fieldName", "owner").put("oldValue", "");
JSONObject expectedIsRead =
new JSONObject().put("newValue", true).put("fieldName", "isRead").put("oldValue", false);
JSONArray expectedChanges = JSONObject expectedClaimed =
new JSONArray() new JSONObject()
.put(expectedClaimed) .put("newValue", task.getModified().toString())
.put(expectedModified) .put("fieldName", "claimed")
.put(expectedState) .put("oldValue", "");
.put(expectedOwner) JSONObject expectedModified =
.put(expectedIsRead); new JSONObject()
.put("newValue", task.getModified().toString())
.put("fieldName", "modified")
.put("oldValue", oldModified.toString());
JSONObject expectedState =
new JSONObject()
.put("newValue", "CLAIMED")
.put("fieldName", "state")
.put("oldValue", "READY");
JSONObject expectedOwner =
new JSONObject()
.put("newValue", "admin")
.put("fieldName", "owner")
.put("oldValue", "");
JSONObject expectedIsRead =
new JSONObject()
.put("newValue", true)
.put("fieldName", "isRead")
.put("oldValue", false);
assertThat(changes.similar(expectedChanges)).isTrue(); JSONArray expectedChanges =
new JSONArray()
.put(expectedClaimed)
.put(expectedModified)
.put(expectedState)
.put(expectedOwner)
.put(expectedIsRead);
assertThat(changes.similar(expectedChanges)).isTrue();
};
return DynamicTest.stream(list.iterator(), Pair::getLeft, test);
} }
} }

View File

@ -4,7 +4,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import static pro.taskana.common.internal.util.CheckedConsumer.wrap; import static pro.taskana.common.internal.util.CheckedConsumer.wrap;
import acceptance.AbstractAccTest; import acceptance.AbstractAccTest;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.json.JSONArray; import org.json.JSONArray;
@ -14,6 +16,7 @@ import org.junit.jupiter.api.TestFactory;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.function.ThrowingConsumer;
import pro.taskana.common.internal.util.Quadruple;
import pro.taskana.common.internal.util.Triplet; import pro.taskana.common.internal.util.Triplet;
import pro.taskana.common.test.security.JaasExtension; import pro.taskana.common.test.security.JaasExtension;
import pro.taskana.common.test.security.WithAccessId; import pro.taskana.common.test.security.WithAccessId;
@ -35,23 +38,39 @@ class CreateHistoryEventOnTaskTransferAccTest extends AbstractAccTest {
@WithAccessId(user = "admin") @WithAccessId(user = "admin")
@TestFactory @TestFactory
Stream<DynamicTest> should_CreateTransferredHistoryEvent_When_TaskIsTransferred() { Stream<DynamicTest> should_CreateTransferredHistoryEvent_When_TaskIsTransferred() {
List<Triplet<String, String, Consumer<String>>> testCases = List<Quadruple<String, String, String, Consumer<String>>> testCases =
List.of( List.of(
Triplet.of( /*
"Using WorkbasketId", The workbasketId of the source Workbasket is parametrized. Putting the tested Tasks
into the same Workbasket would result in changes to the test data. This would require
changing tests that already use the tested Tasks. That's why workbasketId is
parametrized.
*/
Quadruple.of(
"Using WorkbasketId; Task doesn't have an Attachment"
+ " or any secondary Object References",
"TKI:000000000000000000000000000000000003", "TKI:000000000000000000000000000000000003",
"WBI:100000000000000000000000000000000001",
wrap( wrap(
(String taskId) -> (String taskId) ->
taskService.transfer(taskId, "WBI:100000000000000000000000000000000006"))), taskService.transfer(taskId, "WBI:100000000000000000000000000000000006"))),
Triplet.of( Quadruple.of(
"Using WorkbasketId; Task has Attachment and secondary Object Reference",
"TKI:000000000000000000000000000000000053",
"WBI:100000000000000000000000000000000015",
wrap(
(String taskId) ->
taskService.transfer(taskId, "WBI:100000000000000000000000000000000006"))),
Quadruple.of(
"Using WorkbasketKey and Domain", "Using WorkbasketKey and Domain",
"TKI:000000000000000000000000000000000004", "TKI:000000000000000000000000000000000004",
"WBI:100000000000000000000000000000000001",
wrap((String taskId) -> taskService.transfer(taskId, "USER-1-1", "DOMAIN_A")))); wrap((String taskId) -> taskService.transfer(taskId, "USER-1-1", "DOMAIN_A"))));
ThrowingConsumer<Triplet<String, String, Consumer<String>>> test = ThrowingConsumer<Quadruple<String, String, String, Consumer<String>>> test =
t -> { q -> {
String taskId = t.getMiddle(); String taskId = q.getSecond();
Consumer<String> transferMethod = t.getRight(); Consumer<String> transferMethod = q.getFourth();
TaskHistoryQueryMapper taskHistoryQueryMapper = getHistoryQueryMapper(); TaskHistoryQueryMapper taskHistoryQueryMapper = getHistoryQueryMapper();
@ -68,42 +87,63 @@ class CreateHistoryEventOnTaskTransferAccTest extends AbstractAccTest {
(TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId)); (TaskHistoryQueryImpl) historyService.createTaskHistoryQuery().taskIdIn(taskId));
assertThat(events).hasSize(1); assertThat(events).hasSize(1);
String sourceWorkbasketId = q.getThird();
assertTransferHistoryEvent( assertTransferHistoryEvent(
events.get(0).getId(), events.get(0).getId(),
"WBI:100000000000000000000000000000000001", sourceWorkbasketId,
"WBI:100000000000000000000000000000000006", "WBI:100000000000000000000000000000000006",
"admin"); "admin");
}; };
return DynamicTest.stream(testCases.iterator(), Triplet::getLeft, test); return DynamicTest.stream(testCases.iterator(), Quadruple::getFirst, test);
} }
@WithAccessId(user = "admin") @WithAccessId(user = "admin")
@TestFactory @TestFactory
Stream<DynamicTest> should_CreateTransferredHistoryEvents_When_TaskBulkTransfer() { Stream<DynamicTest> should_CreateTransferredHistoryEvents_When_TaskBulkTransfer() {
List<Triplet<String, List<String>, Consumer<List<String>>>> testCases = List<Triplet<String, Map<String, String>, Consumer<List<String>>>> testCases =
List.of( List.of(
/*
The workbasketId of the source Workbasket is parametrized. Putting the tested Tasks
into the same Workbasket would result in changes to the test data. This would require
changing tests that already use the tested Tasks. That's why workbasketId is
parametrized.
*/
Triplet.of( Triplet.of(
"Using WorkbasketId", "Using WorkbasketId",
List.of( Map.ofEntries(
"TKI:000000000000000000000000000000000021", Map.entry(
"TKI:000000000000000000000000000000000022"), "TKI:000000000000000000000000000000000021",
"WBI:100000000000000000000000000000000001"),
Map.entry(
"TKI:000000000000000000000000000000000022",
"WBI:100000000000000000000000000000000001"),
Map.entry(
"TKI:000000000000000000000000000000000002",
"WBI:100000000000000000000000000000000006")),
wrap( wrap(
(List<String> taskIds) -> (List<String> taskIds) ->
taskService.transferTasks( taskService.transferTasks(
"WBI:100000000000000000000000000000000007", taskIds))), "WBI:100000000000000000000000000000000007", taskIds))),
Triplet.of( Triplet.of(
"Using WorkbasketKey and Domain", "Using WorkbasketKey and Domain",
List.of( Map.ofEntries(
"TKI:000000000000000000000000000000000023", Map.entry(
"TKI:000000000000000000000000000000000024"), "TKI:000000000000000000000000000000000023",
"WBI:100000000000000000000000000000000001"),
Map.entry(
"TKI:000000000000000000000000000000000024",
"WBI:100000000000000000000000000000000001"),
Map.entry(
"TKI:000000000000000000000000000000000055",
"WBI:100000000000000000000000000000000015")),
wrap( wrap(
(List<String> taskIds) -> (List<String> taskIds) ->
taskService.transferTasks("USER-1-2", "DOMAIN_A", taskIds)))); taskService.transferTasks("USER-1-2", "DOMAIN_A", taskIds))));
ThrowingConsumer<Triplet<String, List<String>, Consumer<List<String>>>> test = ThrowingConsumer<Triplet<String, Map<String, String>, Consumer<List<String>>>> test =
t -> { t -> {
List<String> taskIds = t.getMiddle(); Map<String, String> taskIds = t.getMiddle();
Consumer<List<String>> transferMethod = t.getRight(); Consumer<List<String>> transferMethod = t.getRight();
TaskHistoryQueryMapper taskHistoryQueryMapper = getHistoryQueryMapper(); TaskHistoryQueryMapper taskHistoryQueryMapper = getHistoryQueryMapper();
@ -113,27 +153,27 @@ class CreateHistoryEventOnTaskTransferAccTest extends AbstractAccTest {
(TaskHistoryQueryImpl) (TaskHistoryQueryImpl)
historyService historyService
.createTaskHistoryQuery() .createTaskHistoryQuery()
.taskIdIn(taskIds.toArray(new String[0]))); .taskIdIn(taskIds.keySet().toArray(new String[0])));
assertThat(events).isEmpty(); assertThat(events).isEmpty();
transferMethod.accept(taskIds); transferMethod.accept(new ArrayList<>(taskIds.keySet()));
events = events =
taskHistoryQueryMapper.queryHistoryEvents( taskHistoryQueryMapper.queryHistoryEvents(
(TaskHistoryQueryImpl) (TaskHistoryQueryImpl)
historyService historyService
.createTaskHistoryQuery() .createTaskHistoryQuery()
.taskIdIn(taskIds.toArray(new String[0]))); .taskIdIn(taskIds.keySet().toArray(new String[0])));
assertThat(events) assertThat(events)
.extracting(TaskHistoryEvent::getTaskId) .extracting(TaskHistoryEvent::getTaskId)
.containsExactlyInAnyOrderElementsOf(taskIds); .containsExactlyInAnyOrderElementsOf(taskIds.keySet());
for (TaskHistoryEvent event : events) { for (TaskHistoryEvent event : events) {
assertTransferHistoryEvent( assertTransferHistoryEvent(
event.getId(), event.getId(),
"WBI:100000000000000000000000000000000001", taskIds.get(event.getTaskId()),
"WBI:100000000000000000000000000000000007", "WBI:100000000000000000000000000000000007",
"admin"); "admin");
} }

View File

@ -18,10 +18,10 @@ class QueryObjectReferenceAccTest extends AbstractAccTest {
void testQueryObjectReferenceValuesForColumnName() { void testQueryObjectReferenceValuesForColumnName() {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<String> columnValues = taskQuery.createObjectReferenceQuery().listValues(COMPANY, null); List<String> columnValues = taskQuery.createObjectReferenceQuery().listValues(COMPANY, null);
assertThat(columnValues).hasSize(3); assertThat(columnValues).hasSize(4);
columnValues = taskQuery.createObjectReferenceQuery().listValues(SYSTEM, null); columnValues = taskQuery.createObjectReferenceQuery().listValues(SYSTEM, null);
assertThat(columnValues).hasSize(3); assertThat(columnValues).hasSize(4);
columnValues = columnValues =
taskQuery.createObjectReferenceQuery().systemIn("System1").listValues(SYSTEM, null); taskQuery.createObjectReferenceQuery().systemIn("System1").listValues(SYSTEM, null);

View File

@ -29,13 +29,13 @@ class QueryObjectReferencesWithPaginationAccTest extends AbstractAccTest {
void testGetFirstPageOfObjectRefQueryWithOffset() { void testGetFirstPageOfObjectRefQueryWithOffset() {
List<ObjectReference> results = objRefQuery.list(0, 5); List<ObjectReference> results = objRefQuery.list(0, 5);
assertThat(results).hasSize(3); assertThat(results).hasSize(4);
} }
@Test @Test
void testGetSecondPageOfObjectRefQueryWithOffset() { void testGetSecondPageOfObjectRefQueryWithOffset() {
List<ObjectReference> results = objRefQuery.list(2, 5); List<ObjectReference> results = objRefQuery.list(2, 5);
assertThat(results).hasSize(1); assertThat(results).hasSize(2);
} }
@Test @Test
@ -59,25 +59,19 @@ class QueryObjectReferencesWithPaginationAccTest extends AbstractAccTest {
int pageNumber = 1; int pageNumber = 1;
int pageSize = 10; int pageSize = 10;
List<ObjectReference> results = objRefQuery.listPage(pageNumber, pageSize); List<ObjectReference> results = objRefQuery.listPage(pageNumber, pageSize);
assertThat(results).hasSize(3); assertThat(results).hasSize(4);
// Getting full page // Getting full page
pageNumber = 2; pageNumber = 2;
pageSize = 2; pageSize = 2;
results = objRefQuery.listPage(pageNumber, pageSize); results = objRefQuery.listPage(pageNumber, pageSize);
assertThat(results).hasSize(1); assertThat(results).hasSize(2);
// Getting last results on 1 big page // Getting last results on 1 big page
pageNumber = 1; pageNumber = 1;
pageSize = 100; pageSize = 100;
results = objRefQuery.listPage(pageNumber, pageSize); results = objRefQuery.listPage(pageNumber, pageSize);
assertThat(results).hasSize(3); assertThat(results).hasSize(4);
// Getting last results on multiple pages
pageNumber = 2;
pageSize = 2;
results = objRefQuery.listPage(pageNumber, pageSize);
assertThat(results).hasSize(1);
} }
@Test @Test
@ -98,12 +92,12 @@ class QueryObjectReferencesWithPaginationAccTest extends AbstractAccTest {
pageNumber = -1; pageNumber = -1;
pageSize = 10; pageSize = 10;
results = objRefQuery.listPage(pageNumber, pageSize); results = objRefQuery.listPage(pageNumber, pageSize);
assertThat(results).hasSize(3); assertThat(results).hasSize(4);
} }
@Test @Test
void testCountOfClassificationsQuery() { void testCountOfClassificationsQuery() {
long count = objRefQuery.count(); long count = objRefQuery.count();
assertThat(count).isEqualTo(3L); assertThat(count).isEqualTo(4L);
} }
} }