TSK-272: acceptance test for bulk completion of tasks.

This commit is contained in:
Holger Hagen 2018-02-06 17:35:33 +01:00 committed by Marcel Lengl
parent 12e59f939e
commit 1476e89642
3 changed files with 63 additions and 1 deletions

View File

@ -60,7 +60,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
List<TaskSummary> results = taskService.createTaskQuery()
.domainIn("DOMAIN_B", "", "DOMAIN_A")
.list();
assertThat(results.size(), equalTo(41));
assertThat(results.size(), equalTo(45));
results = taskService.createTaskQuery()
.domainIn("DOMAIN_A")

View File

@ -7,6 +7,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.sql.SQLException;
import java.util.ArrayList;
import org.h2.store.fs.FileUtils;
import org.junit.AfterClass;
@ -17,7 +18,9 @@ import org.junit.runner.RunWith;
import acceptance.AbstractAccTest;
import pro.taskana.Task;
import pro.taskana.TaskService;
import pro.taskana.exceptions.AttachmentPersistenceException;
import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.ConcurrencyException;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidOwnerException;
import pro.taskana.exceptions.InvalidStateException;
@ -240,6 +243,61 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
assertEquals("user_1_2", completedTask.getOwner());
}
@Ignore
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@Test(expected = TaskNotFoundException.class)
public void testBulkCompleteTasks()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService();
ArrayList<String> taskIdList = new ArrayList();
taskIdList.add("TKI:000000000000000000000000000000000100");
taskIdList.add("TKI:000000000000000000000000000000000101");
// BulkOperationResults results = taskService.completeTasks(taskIdList);
// assertFalse(results.containsError());
Task completedTask1 = taskService.getTask("TKI:000000000000000000000000000000000100");
assertEquals(TaskState.COMPLETED, completedTask1.getState());
assertNotNull(completedTask1.getCompleted());
Task completedTask2 = taskService.getTask("TKI:000000000000000000000000000000000101");
assertEquals(TaskState.COMPLETED, completedTask2.getState());
assertNotNull(completedTask2.getCompleted());
}
@Ignore
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@Test(expected = TaskNotFoundException.class)
public void testBulkDeleteTasksWithException()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService();
ArrayList<String> taskIdList = new ArrayList();
taskIdList.add("TKI:000000000000000000000000000000000102");
taskIdList.add("TKI:000000000000000000000000000000000103");
taskIdList.add("TKI:000000000000000000000000000000000033");
// BulkOperationResults results = taskService.deleteTasks(taskIdList);
// assertTrue(results.containsError());
// more assertions ...
// assert exception is invalidstateexception
Task completedTask1 = taskService.getTask("TKI:000000000000000000000000000000000102");
assertEquals(TaskState.COMPLETED, completedTask1.getState());
assertNotNull(completedTask1.getCompleted());
Task completedTask2 = taskService.getTask("TKI:000000000000000000000000000000000103");
assertEquals(TaskState.COMPLETED, completedTask2.getState());
assertNotNull(completedTask2.getCompleted());
}
@AfterClass
public static void cleanUpClass() {
FileUtils.deleteRecursive("~/data", true);

View File

@ -36,6 +36,10 @@ INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000032', '2018-01-29
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000033', '2018-01-29 15:55:24', null , null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'READY' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000033' , 'DOC_0000000000000000033' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000034', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000034' , 'DOC_0000000000000000034' , 'user_1_1' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000035', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000035' , 'DOC_0000000000000000035' , 'user_1_1' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000100', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000100' , 'DOC_0000000000000000100' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000101', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000101' , 'DOC_0000000000000000101' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000102', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000102' , 'DOC_0000000000000000102' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000103', '2018-01-29 15:55:24', '2018-01-30 15:55:24', null , '2018-01-30 15:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'CLAIMED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000103' , 'DOC_0000000000000000103' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '98765432' , true , false , null , null , null , null , null , null , null , null , null , null , null );
-- Tasks for DeleteTaskAccTest
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000036', '2018-01-29 15:55:24', '2018-01-30 15:55:24', '2018-01-30 16:55:24', '2018-01-30 16:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'COMPLETED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000036' , 'DOC_0000000000000000036' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '00011122' , true , false , null , null , null , null , null , null , null , null , null , null , null );
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000037', '2018-01-29 15:55:24', '2018-01-30 15:55:24', '2018-01-30 16:55:24', '2018-01-30 16:55:24', '2018-01-29 15:55:00', '2018-01-30 15:55:00', 'Widerruf' , 'Widerruf' , null , 2 , 'COMPLETED' , 'L1050' , 'USER_1_2' , 'DOMAIN_A', 'PI_0000000000037' , 'DOC_0000000000000000037' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '00011122' , true , false , null , null , null , null , null , null , null , null , null , null , null );