TSK-243: acceptance test for state reset during transfer.
This commit is contained in:
parent
a9ebb41a29
commit
9504a225d3
|
@ -1,12 +1,16 @@
|
|||
package acceptance.task;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.h2.store.fs.FileUtils;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
|
@ -15,11 +19,14 @@ import pro.taskana.Task;
|
|||
import pro.taskana.TaskService;
|
||||
import pro.taskana.exceptions.ClassificationNotFoundException;
|
||||
import pro.taskana.exceptions.InvalidArgumentException;
|
||||
import pro.taskana.exceptions.InvalidOwnerException;
|
||||
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.model.TaskState;
|
||||
import pro.taskana.security.JAASRunner;
|
||||
import pro.taskana.security.WithAccessId;
|
||||
|
||||
|
@ -33,13 +40,36 @@ public class TransferTaskAccTest extends AbstractAccTest {
|
|||
super();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
userName = "teamlead_1",
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testTransferTask()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
|
||||
InvalidStateException, InvalidOwnerException {
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000003");
|
||||
taskService.claim(task.getId());
|
||||
taskService.setTaskRead(task.getId(), true);
|
||||
|
||||
taskService.transfer(task.getId(), "USER_1_1");
|
||||
|
||||
Task transferredTask = taskService.getTask("TKI:000000000000000000000000000000000003");
|
||||
assertNotNull(transferredTask);
|
||||
assertTrue(transferredTask.isTransferred());
|
||||
assertFalse(transferredTask.isRead());
|
||||
assertEquals(TaskState.READY, transferredTask.getState());
|
||||
}
|
||||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testDomainChangingWhenTransferTask()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||
String domain1 = task.getDomain();
|
||||
|
@ -51,12 +81,12 @@ public class TransferTaskAccTest extends AbstractAccTest {
|
|||
}
|
||||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
userName = "user_1_1",
|
||||
groupNames = {"group_1"})
|
||||
@Test(expected = NotAuthorizedException.class)
|
||||
public void testThrowsExceptionIfTransferWithNoTransferAuthorization()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000001");
|
||||
|
||||
|
@ -64,12 +94,12 @@ public class TransferTaskAccTest extends AbstractAccTest {
|
|||
}
|
||||
|
||||
@WithAccessId(
|
||||
userName = "USER_1_1",
|
||||
groupNames = { "group_1" })
|
||||
userName = "USER_1_1",
|
||||
groupNames = {"group_1"})
|
||||
@Test(expected = NotAuthorizedException.class)
|
||||
public void testThrowsExceptionIfTransferWithNoAppendAuthorization()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000002");
|
||||
|
||||
|
|
Loading…
Reference in New Issue