TSK-258: acceptance tests for deleting tasks.
This commit is contained in:
parent
0f2c0891fc
commit
6428235be5
|
@ -0,0 +1,139 @@
|
|||
package acceptance.task;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.h2.store.fs.FileUtils;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
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.InvalidStateException;
|
||||
import pro.taskana.exceptions.InvalidWorkbasketException;
|
||||
import pro.taskana.exceptions.NotAuthorizedException;
|
||||
import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||
import pro.taskana.exceptions.TaskNotFoundException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.security.JAASRunner;
|
||||
import pro.taskana.security.WithAccessId;
|
||||
|
||||
/**
|
||||
* Acceptance test for all "delete task" scenarios.
|
||||
*/
|
||||
@RunWith(JAASRunner.class)
|
||||
public class DeleteTaskAccTest extends AbstractAccTest {
|
||||
|
||||
public DeleteTaskAccTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@WithAccessId(
|
||||
userName = "user_1_2",
|
||||
groupNames = {"group_1"})
|
||||
@Test(expected = TaskNotFoundException.class)
|
||||
public void testDeleteSingleTask()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
|
||||
ConcurrencyException, AttachmentPersistenceException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000036");
|
||||
|
||||
// taskService.deleteTask(task.getId());
|
||||
|
||||
Task deletedTask = taskService.getTask("TKI:000000000000000000000000000000000036");
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@WithAccessId(
|
||||
userName = "user_1_2",
|
||||
groupNames = {"group_1"})
|
||||
@Test(expected = InvalidStateException.class)
|
||||
public void testThrowsExceptionIfTaskIsNotCompleted()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
|
||||
ConcurrencyException, AttachmentPersistenceException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000027");
|
||||
|
||||
// taskService.deleteTask(task.getId());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@WithAccessId(
|
||||
userName = "user_1_2",
|
||||
groupNames = {"group_1"})
|
||||
@Test(expected = TaskNotFoundException.class)
|
||||
public void testForceDeleteTaskIfNotCompleted()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
|
||||
ConcurrencyException, AttachmentPersistenceException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000027");
|
||||
|
||||
// taskService.deleteTask(task.getId(), true);
|
||||
|
||||
Task deletedTask = taskService.getTask("TKI:000000000000000000000000000000000036");
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@WithAccessId(
|
||||
userName = "user_1_2",
|
||||
groupNames = {"group_1"})
|
||||
@Test(expected = TaskNotFoundException.class)
|
||||
public void testBulkDeleteTask()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
|
||||
ConcurrencyException, AttachmentPersistenceException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
ArrayList<String> taskIdList = new ArrayList();
|
||||
taskIdList.add("TKI:000000000000000000000000000000000037");
|
||||
taskIdList.add("TKI:000000000000000000000000000000000038");
|
||||
|
||||
// BulkOperationResults results = taskService.deleteTasks(taskIdList);
|
||||
|
||||
// assertFalse(results.containsError());
|
||||
Task deletedTask = taskService.getTask("TKI:000000000000000000000000000000000038");
|
||||
}
|
||||
|
||||
@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:000000000000000000000000000000000039");
|
||||
taskIdList.add("TKI:000000000000000000000000000000000040");
|
||||
taskIdList.add("TKI:000000000000000000000000000000000028");
|
||||
|
||||
// BulkOperationResults results = taskService.deleteTasks(taskIdList);
|
||||
|
||||
// assertTrue(results.containsError());
|
||||
// more assertions ...
|
||||
Task notDeletedTask = taskService.getTask("TKI:000000000000000000000000000000000028");
|
||||
Task deletedTask = taskService.getTask("TKI:000000000000000000000000000000000040");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void cleanUpClass() {
|
||||
FileUtils.deleteRecursive("~/data", true);
|
||||
}
|
||||
}
|
|
@ -60,7 +60,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
|
|||
List<TaskSummary> results = taskService.createTaskQuery()
|
||||
.domainIn("DOMAIN_B", "", "DOMAIN_A")
|
||||
.list();
|
||||
assertThat(results.size(), equalTo(36));
|
||||
assertThat(results.size(), equalTo(41));
|
||||
|
||||
results = taskService.createTaskQuery()
|
||||
.domainIn("DOMAIN_A")
|
||||
|
|
|
@ -36,3 +36,9 @@ 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 );
|
||||
-- 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 );
|
||||
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000038', '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_0000000000038' , 'DOC_0000000000000000038' , '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:000000000000000000000000000000000039', '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_0000000000039' , 'DOC_0000000000000000039' , '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:000000000000000000000000000000000040', '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_0000000000040' , 'DOC_0000000000000000040' , 'user_1_2' , '00' , 'PASystem' , '00' , 'SDNR' , '00011122' , true , false , null , null , null , null , null , null , null , null , null , null , null );
|
||||
|
|
Loading…
Reference in New Issue