TSK-122: acceptance tests for primary object reference added.
This commit is contained in:
parent
add8dcc32a
commit
f7fa202608
|
|
@ -160,6 +160,55 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
taskService.createTask(newTask);
|
taskService.createTask(newTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
@WithAccessId(
|
||||||
|
userName = "user_1_1",
|
||||||
|
groupNames = { "group_1" })
|
||||||
|
@Test
|
||||||
|
public void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete()
|
||||||
|
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||||
|
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
||||||
|
|
||||||
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
Task newTask = taskService.newTask();
|
||||||
|
newTask.setClassification(taskanaEngine.getClassificationService().getClassification("T2100", "DOMAIN_A"));
|
||||||
|
newTask.setWorkbasketKey("USER_1_1");
|
||||||
|
Task createdTask = taskService.createTask(newTask);
|
||||||
|
|
||||||
|
// Exception
|
||||||
|
|
||||||
|
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", null));
|
||||||
|
|
||||||
|
createdTask = taskService.createTask(newTask);
|
||||||
|
|
||||||
|
// Exception
|
||||||
|
|
||||||
|
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", null, "1234567"));
|
||||||
|
|
||||||
|
createdTask = taskService.createTask(newTask);
|
||||||
|
|
||||||
|
// Exception
|
||||||
|
|
||||||
|
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", null, "VNR", "1234567"));
|
||||||
|
|
||||||
|
createdTask = taskService.createTask(newTask);
|
||||||
|
|
||||||
|
// Exception
|
||||||
|
|
||||||
|
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", null, "INSTANCE_A", "VNR", "1234567"));
|
||||||
|
|
||||||
|
createdTask = taskService.createTask(newTask);
|
||||||
|
|
||||||
|
// Exception
|
||||||
|
|
||||||
|
newTask.setPrimaryObjRef(createObjectReference(null, "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||||
|
|
||||||
|
createdTask = taskService.createTask(newTask);
|
||||||
|
|
||||||
|
// Exception
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void cleanUpClass() {
|
public static void cleanUpClass() {
|
||||||
FileUtils.deleteRecursive("~/data", true);
|
FileUtils.deleteRecursive("~/data", true);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
|
||||||
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
||||||
// TaskService taskService = taskanaEngine.getTaskService();
|
// TaskService taskService = taskanaEngine.getTaskService();
|
||||||
// List<TaskSummary> results = taskService.createTaskQuery()
|
// List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
// .objectReferenceValueEquals("223344")
|
// .primaryObjectReferenceValueEquals("223344")
|
||||||
// .list();
|
// .list();
|
||||||
// Assert.assertEquals(5L, results.size());
|
// Assert.assertEquals(5L, results.size());
|
||||||
}
|
}
|
||||||
|
|
@ -37,8 +37,8 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
|
||||||
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
||||||
// TaskService taskService = taskanaEngine.getTaskService();
|
// TaskService taskService = taskanaEngine.getTaskService();
|
||||||
// List<TaskSummary> results = taskService.createTaskQuery()
|
// List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
// .objectReferenceTypeEquals("VNR")
|
// .primaryObjectReferenceTypeEquals("VNR")
|
||||||
// .objectReferenceValueEquals("223344")
|
// .primaryObjectReferenceValueEquals("223344")
|
||||||
// .list();
|
// .list();
|
||||||
// Assert.assertEquals(3L, results.size());
|
// Assert.assertEquals(3L, results.size());
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +49,7 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
|
||||||
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
throws SQLException, NotAuthorizedException, InvalidArgumentException {
|
||||||
// TaskService taskService = taskanaEngine.getTaskService();
|
// TaskService taskService = taskanaEngine.getTaskService();
|
||||||
// List<TaskSummary> results = taskService.createTaskQuery()
|
// List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
// .objectReferenceValueLike("223")
|
// .primaryObjectReferenceValueLike("223")
|
||||||
// .list();
|
// .list();
|
||||||
// Assert.assertEquals(15L, results.size());
|
// Assert.assertEquals(15L, results.size());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,106 @@
|
||||||
|
package acceptance.task;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
|
import pro.taskana.exceptions.ClassificationNotFoundException;
|
||||||
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
|
import pro.taskana.exceptions.InvalidWorkbasketException;
|
||||||
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||||
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
|
import pro.taskana.security.JAASRunner;
|
||||||
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acceptance test for all "update task" scenarios.
|
||||||
|
*/
|
||||||
|
@RunWith(JAASRunner.class)
|
||||||
|
public class UpdateTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
|
public UpdateTaskAccTest() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
@WithAccessId(
|
||||||
|
userName = "user_1_1",
|
||||||
|
groupNames = { "group_1" })
|
||||||
|
@Test
|
||||||
|
public void testUpdatePrimaryObjectReferenceOfTask()
|
||||||
|
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||||
|
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
||||||
|
|
||||||
|
// TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
// Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
|
// task.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "7654321"));
|
||||||
|
// Task updatedTask = taskService.updateTask(task);
|
||||||
|
//
|
||||||
|
// assertNotNull(updatedTask);
|
||||||
|
// assertEquals("7654321", updatedTask.getPrimaryObjRef().getValue());
|
||||||
|
// assertNotNull(updatedTask.getCreated());
|
||||||
|
// assertNotNull(updatedTask.getModified());
|
||||||
|
// assertNotEquals(updatedTask.getCreated(), updatedTask.getModified());
|
||||||
|
// assertEquals(task.getCreated(), updatedTask.getCreated());
|
||||||
|
// assertEquals(task.isRead(), updatedTask.isRead());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
@WithAccessId(
|
||||||
|
userName = "user_1_1",
|
||||||
|
groupNames = { "group_1" })
|
||||||
|
@Test
|
||||||
|
public void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete()
|
||||||
|
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||||
|
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
||||||
|
|
||||||
|
// TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
// Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
|
// task.setPrimaryObjRef(null);
|
||||||
|
// Task updatedTask = taskService.updateTask(task);
|
||||||
|
//
|
||||||
|
// // Exception
|
||||||
|
//
|
||||||
|
// newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", null));
|
||||||
|
//
|
||||||
|
// createdTask = taskService.createTask(newTask);
|
||||||
|
//
|
||||||
|
// // Exception
|
||||||
|
//
|
||||||
|
// newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", null, "1234567"));
|
||||||
|
//
|
||||||
|
// createdTask = taskService.createTask(newTask);
|
||||||
|
//
|
||||||
|
// // Exception
|
||||||
|
//
|
||||||
|
// newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", null, "VNR", "1234567"));
|
||||||
|
//
|
||||||
|
// createdTask = taskService.createTask(newTask);
|
||||||
|
//
|
||||||
|
// // Exception
|
||||||
|
//
|
||||||
|
// newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", null, "INSTANCE_A", "VNR", "1234567"));
|
||||||
|
//
|
||||||
|
// createdTask = taskService.createTask(newTask);
|
||||||
|
//
|
||||||
|
// // Exception
|
||||||
|
//
|
||||||
|
// newTask.setPrimaryObjRef(createObjectReference(null, "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||||
|
//
|
||||||
|
// createdTask = taskService.createTask(newTask);
|
||||||
|
//
|
||||||
|
// // Exception
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void cleanUpClass() {
|
||||||
|
FileUtils.deleteRecursive("~/data", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue