TSK-130 Update Task
This commit is contained in:
parent
4044b8f8b3
commit
252d36a13d
|
@ -29,7 +29,7 @@ public class ExampleBootstrap {
|
|||
ClassificationNotFoundException, InvalidStateException, InvalidOwnerException, InvalidWorkbasketException,
|
||||
TaskAlreadyExistException, InvalidArgumentException {
|
||||
System.out.println("---------------------------> Start App");
|
||||
Task task = taskanaEjb.getTaskService().newTask();
|
||||
Task task = taskanaEjb.getTaskService().newTask(null);
|
||||
ObjectReference objRef = new ObjectReference();
|
||||
objRef.setCompany("aCompany");
|
||||
objRef.setSystem("aSystem");
|
||||
|
|
|
@ -38,7 +38,7 @@ public class TaskanaEjb {
|
|||
public void triggerRollback() throws NotAuthorizedException, WorkbasketNotFoundException,
|
||||
ClassificationNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException,
|
||||
InvalidArgumentException {
|
||||
Task task = taskService.newTask();
|
||||
Task task = taskService.newTask(null);
|
||||
ObjectReference objRef = new ObjectReference();
|
||||
objRef.setCompany("aCompany");
|
||||
objRef.setSystem("aSystem");
|
||||
|
|
|
@ -22,7 +22,6 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
|||
import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||
import pro.taskana.exceptions.TaskNotFoundException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.impl.ClassificationImpl;
|
||||
import pro.taskana.model.ObjectReference;
|
||||
import pro.taskana.model.WorkbasketType;
|
||||
|
||||
|
@ -50,9 +49,8 @@ public class TaskanaRestTest {
|
|||
Classification classification = classificationService.newClassification("cdiDomain", "TEST", "t1");
|
||||
taskanaEjb.getClassificationService().createClassification(classification);
|
||||
|
||||
Task task = taskanaEjb.getTaskService().newTask();
|
||||
Task task = taskanaEjb.getTaskService().newTask(workbasket.getKey());
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setWorkbasketKey(workbasket.getKey());
|
||||
ObjectReference objRef = new ObjectReference();
|
||||
objRef.setCompany("aCompany");
|
||||
objRef.setSystem("aSystem");
|
||||
|
|
|
@ -136,14 +136,6 @@ public interface Task {
|
|||
*/
|
||||
String getWorkbasketKey();
|
||||
|
||||
/**
|
||||
* Sets the key of the Workbasket where the task should be stored in.
|
||||
*
|
||||
* @param workbasketKey
|
||||
* the key of the workbasket
|
||||
*/
|
||||
void setWorkbasketKey(String workbasketKey);
|
||||
|
||||
/**
|
||||
* Returns the the Summary of the workbasket where the task is stored in.
|
||||
*
|
||||
|
@ -151,14 +143,6 @@ public interface Task {
|
|||
*/
|
||||
WorkbasketSummary getWorkbasketSummary();
|
||||
|
||||
/**
|
||||
* Sets the Summary of the Workbasket where the task should be stored in.
|
||||
*
|
||||
* @param workbasket
|
||||
* the WorkbasketSummary
|
||||
*/
|
||||
void setWorkbasketSummary(WorkbasketSummary workbasket);
|
||||
|
||||
/**
|
||||
* Returns the Domain, to which the Task belongs at this moment.
|
||||
*
|
||||
|
|
|
@ -199,9 +199,11 @@ public interface TaskService {
|
|||
/**
|
||||
* Returns a not persisted instance of {@link Task}.
|
||||
*
|
||||
* @param workbasketKey
|
||||
* the key of the workbasket to which the task belongs
|
||||
* @return an empty new Task
|
||||
*/
|
||||
Task newTask();
|
||||
Task newTask(String workbasketKey);
|
||||
|
||||
/**
|
||||
* Returns a not persisted instance of {@link Attachment}.
|
||||
|
|
|
@ -188,7 +188,6 @@ public class TaskImpl implements Task {
|
|||
return workbasketKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWorkbasketKey(String workbasketKey) {
|
||||
this.workbasketKey = workbasketKey;
|
||||
}
|
||||
|
@ -198,7 +197,6 @@ public class TaskImpl implements Task {
|
|||
return workbasketSummary;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWorkbasketSummary(WorkbasketSummary workbasket) {
|
||||
this.workbasketSummary = workbasket;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
private static final String ID_PREFIX_ATTACHMENT = "TAI";
|
||||
private static final String ID_PREFIX_TASK = "TKI";
|
||||
private static final String ID_PREFIX_BUSINESS_PROCESS = "BPI";
|
||||
private static final String MUST_NOT_BE_EMPTY = " must not be empty";
|
||||
private TaskanaEngine taskanaEngine;
|
||||
private TaskanaEngineImpl taskanaEngineImpl;
|
||||
private WorkbasketService workbasketService;
|
||||
|
@ -201,7 +202,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Task getTask(String id) throws TaskNotFoundException, SystemException {
|
||||
public Task getTask(String id) throws TaskNotFoundException {
|
||||
LOGGER.debug("entry to getTaskById(id = {})", id);
|
||||
TaskImpl resultTask = null;
|
||||
try {
|
||||
|
@ -402,16 +403,6 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
}
|
||||
|
||||
// insert ObjectReference if needed. Comment this out for the scope of tsk-123
|
||||
// if (task.getPrimaryObjRef() != null) {
|
||||
// ObjectReference objectReference = this.objectReferenceMapper.findByObjectReference(task.getPrimaryObjRef());
|
||||
// if (objectReference == null) {
|
||||
// objectReference = task.getPrimaryObjRef();
|
||||
// objectReference.setId(IdGenerator.generateWithPrefix(ID_PREFIX_OBJECT_REFERENCE));
|
||||
// this.objectReferenceMapper.insert(objectReference);
|
||||
// }
|
||||
// // task.setPrimaryObjRef(objectReference);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -427,9 +418,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
// list<attachmentsummary>
|
||||
results = augmentTaskSummariesByContainedSummaries(taskSummaries);
|
||||
|
||||
} catch (WorkbasketNotFoundException ex) {
|
||||
throw ex;
|
||||
} catch (NotAuthorizedException ex) {
|
||||
} catch (WorkbasketNotFoundException | NotAuthorizedException ex) {
|
||||
throw ex;
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error("Getting TASKSUMMARY failed internally.", ex);
|
||||
|
@ -538,7 +527,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
return;
|
||||
}
|
||||
|
||||
Set<String> taskIdSet = taskSummaries.stream().map(t -> t.getTaskId()).collect(Collectors.toSet());
|
||||
Set<String> taskIdSet = taskSummaries.stream().map(TaskSummaryImpl::getTaskId).collect(Collectors.toSet());
|
||||
String[] taskIdArray = taskIdSet.toArray(new String[0]);
|
||||
|
||||
List<AttachmentSummaryImpl> attachmentSummaries = attachmentMapper
|
||||
|
@ -566,7 +555,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
|| taskSummaries.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Set<String> classificationDomainSet = taskSummaries.stream().map(t -> t.getDomain()).collect(
|
||||
Set<String> classificationDomainSet = taskSummaries.stream().map(TaskSummaryImpl::getDomain).collect(
|
||||
Collectors.toSet());
|
||||
Set<String> classificationKeySet = attachmentSummaries.stream()
|
||||
.map(t -> t.getClassificationSummary().getKey())
|
||||
|
@ -650,8 +639,10 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Task newTask() {
|
||||
return new TaskImpl();
|
||||
public Task newTask(String workbasketKey) {
|
||||
TaskImpl task = new TaskImpl();
|
||||
task.setWorkbasketKey(workbasketKey);
|
||||
return task;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -666,17 +657,17 @@ public class TaskServiceImpl implements TaskService {
|
|||
throw new InvalidArgumentException(objRefType + " of " + objName + " must not be null");
|
||||
} else if (objRef.getCompany() == null || objRef.getCompany().length() == 0) {
|
||||
throw new InvalidArgumentException(
|
||||
"Company of " + objRefType + " of " + objName + " must not be empty");
|
||||
"Company of " + objRefType + " of " + objName + MUST_NOT_BE_EMPTY);
|
||||
} else if (objRef.getSystem() == null || objRef.getSystem().length() == 0) {
|
||||
throw new InvalidArgumentException(
|
||||
"System of " + objRefType + " of " + objName + " must not be empty");
|
||||
"System of " + objRefType + " of " + objName + MUST_NOT_BE_EMPTY);
|
||||
} else if (objRef.getSystemInstance() == null || objRef.getSystemInstance().length() == 0) {
|
||||
throw new InvalidArgumentException(
|
||||
"SystemInstance of " + objRefType + " of " + objName + " must not be empty");
|
||||
"SystemInstance of " + objRefType + " of " + objName + MUST_NOT_BE_EMPTY);
|
||||
} else if (objRef.getType() == null || objRef.getType().length() == 0) {
|
||||
throw new InvalidArgumentException("Type of " + objRefType + " of " + objName + " must not be empty");
|
||||
throw new InvalidArgumentException("Type of " + objRefType + " of " + objName + MUST_NOT_BE_EMPTY);
|
||||
} else if (objRef.getValue() == null || objRef.getValue().length() == 0) {
|
||||
throw new InvalidArgumentException("Value of" + objRefType + " of " + objName + " must not be empty");
|
||||
throw new InvalidArgumentException("Value of" + objRefType + " of " + objName + MUST_NOT_BE_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -702,7 +693,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
|
||||
private void standardUpdateActions(TaskImpl oldTaskImpl, TaskImpl newTaskImpl)
|
||||
throws InvalidArgumentException, ConcurrencyException, WorkbasketNotFoundException, InvalidWorkbasketException,
|
||||
throws InvalidArgumentException, ConcurrencyException, WorkbasketNotFoundException,
|
||||
ClassificationNotFoundException, NotAuthorizedException {
|
||||
validateObjectReference(newTaskImpl.getPrimaryObjRef(), "primary ObjectReference", "Task");
|
||||
if (oldTaskImpl.getModified() != null && !oldTaskImpl.getModified().equals(newTaskImpl.getModified())
|
||||
|
@ -773,20 +764,18 @@ public class TaskServiceImpl implements TaskService {
|
|||
boolean wasAlreadyRepresented = false;
|
||||
if (attachment.getId() != null) {
|
||||
for (Attachment oldAttachment : oldTaskImpl.getAttachments()) {
|
||||
if (oldAttachment != null) {
|
||||
// UPDATE when id is represented but objects are not equal
|
||||
if (attachment.getId().equals(oldAttachment.getId())) {
|
||||
wasAlreadyRepresented = true;
|
||||
if (!attachment.equals(oldAttachment)) {
|
||||
AttachmentImpl temp = (AttachmentImpl) attachment;
|
||||
temp.setModified(Instant.now());
|
||||
attachmentMapper.update(temp);
|
||||
LOGGER.debug("TaskService.updateTask() for TaskId={} UPDATED an Attachment={}.",
|
||||
newTaskImpl.getId(),
|
||||
attachment);
|
||||
break;
|
||||
}
|
||||
if (oldAttachment != null && attachment.getId().equals(oldAttachment.getId())) {
|
||||
wasAlreadyRepresented = true;
|
||||
if (!attachment.equals(oldAttachment)) {
|
||||
AttachmentImpl temp = (AttachmentImpl) attachment;
|
||||
temp.setModified(Instant.now());
|
||||
attachmentMapper.update(temp);
|
||||
LOGGER.debug("TaskService.updateTask() for TaskId={} UPDATED an Attachment={}.",
|
||||
newTaskImpl.getId(),
|
||||
attachment);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -818,11 +807,9 @@ public class TaskServiceImpl implements TaskService {
|
|||
if (oldAttachment != null) {
|
||||
boolean isRepresented = false;
|
||||
for (Attachment newAttachment : newTaskImpl.getAttachments()) {
|
||||
if (newAttachment != null) {
|
||||
if (oldAttachment.getId().equals(newAttachment.getId())) {
|
||||
isRepresented = true;
|
||||
break;
|
||||
}
|
||||
if (newAttachment != null && oldAttachment.getId().equals(newAttachment.getId())) {
|
||||
isRepresented = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isRepresented) {
|
||||
|
|
|
@ -38,19 +38,15 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
|
|||
Classification classification = classificationService.getClassification("L140101", "DOMAIN_A");
|
||||
assertNotNull(classification);
|
||||
assertEquals("", classification.getDomain());
|
||||
|
||||
classification = classificationService.getClassification("L140101", "DOMAIN_A");
|
||||
assertTrue(classification.getDomain() == "");
|
||||
assertTrue("DOMAIN_A" != classification.getDomain());
|
||||
}
|
||||
|
||||
@Test (expected = ClassificationInUseException.class)
|
||||
@Test(expected = ClassificationInUseException.class)
|
||||
public void testThrowExeptionIfDeleteClassificationWithExistingTasks()
|
||||
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
|
||||
classificationService.deleteClassification("L1050", "DOMAIN_A");
|
||||
}
|
||||
|
||||
@Test (expected = ClassificationInUseException.class)
|
||||
@Test(expected = ClassificationInUseException.class)
|
||||
public void testThrowExeptionIfDeleteMasterClassificationWithExistingTasks()
|
||||
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
|
||||
classificationService.deleteClassification("L1050", "");
|
||||
|
@ -85,7 +81,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
|
|||
|
||||
classificationInUse = false;
|
||||
try {
|
||||
classificationService.deleteClassification("L11010", "");
|
||||
classificationService.deleteClassification("L11010", "");
|
||||
} catch (ClassificationInUseException e) {
|
||||
classificationInUse = true;
|
||||
}
|
||||
|
@ -97,12 +93,14 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
|
|||
}
|
||||
|
||||
@Test(expected = ClassificationNotFoundException.class)
|
||||
public void testThrowClassificationNotFoundIfClassificationNotExists() throws ClassificationNotFoundException, ClassificationInUseException {
|
||||
public void testThrowClassificationNotFoundIfClassificationNotExists()
|
||||
throws ClassificationNotFoundException, ClassificationInUseException {
|
||||
classificationService.deleteClassification("not existing classification key", "");
|
||||
}
|
||||
|
||||
@Test(expected = ClassificationNotFoundException.class)
|
||||
public void testThrowClassificationNotFoundIfClassificationNotExistsInDomain() throws ClassificationNotFoundException, ClassificationInUseException {
|
||||
public void testThrowClassificationNotFoundIfClassificationNotExistsInDomain()
|
||||
throws ClassificationNotFoundException, ClassificationInUseException {
|
||||
classificationService.deleteClassification("L10000", "DOMAIN_B");
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package acceptance.task;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
@ -39,17 +40,16 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testCreateSimpleManualTask()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
Task createdTask = taskService.createTask(newTask);
|
||||
|
||||
assertNotNull(createdTask);
|
||||
|
@ -71,7 +71,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testCreateExternalTaskWithAttachment()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
|
@ -79,14 +79,13 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
ConcurrencyException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("L12010");
|
||||
newTask.addAttachment(createAttachment("DOCTYPE_DEFAULT",
|
||||
createObjectReference("COMPANY_A", "SYSTEM_B", "INSTANCE_B", "ArchiveId",
|
||||
"12345678901234567890123456789012345678901234567890"),
|
||||
"E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
Task createdTask = taskService.createTask(newTask);
|
||||
assertNotNull(createdTask.getId());
|
||||
|
||||
|
@ -103,17 +102,16 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testCreateExternalTaskWithMultipleAttachments()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("L12010");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
newTask.addAttachment(createAttachment("DOCTYPE_DEFAULT",
|
||||
createObjectReference("COMPANY_A", "SYSTEM_B", "INSTANCE_B", "ArchiveId",
|
||||
"12345678901234567890123456789012345678901234567890"),
|
||||
|
@ -140,7 +138,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testThrowsExceptionIfAttachmentIsInvalid()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
|
@ -154,6 +152,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
"E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
|
||||
try {
|
||||
createdTask = taskService.createTask(newTask);
|
||||
fail("taskService should have thrown InvalidArgumentException.");
|
||||
} catch (InvalidArgumentException ex) {
|
||||
// nothing to do
|
||||
}
|
||||
|
@ -164,6 +163,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
"E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
|
||||
try {
|
||||
createdTask = taskService.createTask(newTask);
|
||||
fail("taskService should have thrown InvalidArgumentException.");
|
||||
} catch (InvalidArgumentException ex) {
|
||||
// nothing to do
|
||||
}
|
||||
|
@ -175,6 +175,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
"E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
|
||||
try {
|
||||
createdTask = taskService.createTask(newTask);
|
||||
fail("taskService should have thrown InvalidArgumentException.");
|
||||
} catch (InvalidArgumentException ex) {
|
||||
// nothing to do
|
||||
}
|
||||
|
@ -185,6 +186,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
"E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
|
||||
try {
|
||||
createdTask = taskService.createTask(newTask);
|
||||
fail("taskService should have thrown InvalidArgumentException.");
|
||||
} catch (InvalidArgumentException ex) {
|
||||
// nothing to do
|
||||
}
|
||||
|
@ -195,6 +197,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
"E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
|
||||
try {
|
||||
createdTask = taskService.createTask(newTask);
|
||||
fail("taskService should have thrown InvalidArgumentException.");
|
||||
} catch (InvalidArgumentException ex) {
|
||||
// nothing to do
|
||||
}
|
||||
|
@ -205,6 +208,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
"E-MAIL", "2018-01-15", createSimpleCustomProperties(3)));
|
||||
try {
|
||||
createdTask = taskService.createTask(newTask);
|
||||
fail("taskService should have thrown InvalidArgumentException.");
|
||||
} catch (InvalidArgumentException ex) {
|
||||
// nothing to do
|
||||
}
|
||||
|
@ -212,27 +216,25 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
}
|
||||
|
||||
private Task makeNewTask(TaskService taskService) throws ClassificationNotFoundException {
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("L12010");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
newTask.setClassificationKey("L12010");
|
||||
return newTask;
|
||||
}
|
||||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testUseCustomNameIfSetForNewTask()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
newTask.setName("Test Name");
|
||||
Task createdTask = taskService.createTask(newTask);
|
||||
|
||||
|
@ -242,17 +244,16 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testUseClassificationMetadataFromCorrectDomainForNewTask()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
newTask.setName("Test Name");
|
||||
Task createdTask = taskService.createTask(newTask);
|
||||
|
||||
|
@ -262,48 +263,45 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test(expected = WorkbasketNotFoundException.class)
|
||||
public void testGetExceptionIfWorkbasketDoesNotExist()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("UNKNOWN");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
newTask.setWorkbasketKey("UNKNOWN");
|
||||
taskService.createTask(newTask);
|
||||
}
|
||||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test(expected = NotAuthorizedException.class)
|
||||
public void testGetExceptionIfAppendIsNotPermitted()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("GPK_KSC");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
newTask.setWorkbasketKey("GPK_KSC");
|
||||
taskService.createTask(newTask);
|
||||
}
|
||||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
||||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
Task createdTask;
|
||||
try {
|
||||
createdTask = taskService.createTask(newTask);
|
||||
|
@ -313,9 +311,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
// Exception
|
||||
|
||||
newTask = taskService.newTask();
|
||||
newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", null));
|
||||
try {
|
||||
createdTask = taskService.createTask(newTask);
|
||||
|
@ -325,9 +322,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
// Exception
|
||||
|
||||
newTask = taskService.newTask();
|
||||
newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", null, "1234567"));
|
||||
|
||||
try {
|
||||
|
@ -338,9 +334,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
// Exception
|
||||
|
||||
newTask = taskService.newTask();
|
||||
newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", null, "VNR", "1234567"));
|
||||
|
||||
try {
|
||||
|
@ -351,9 +346,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
// Exception
|
||||
|
||||
newTask = taskService.newTask();
|
||||
newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", null, "INSTANCE_A", "VNR", "1234567"));
|
||||
|
||||
try {
|
||||
|
@ -364,9 +358,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
// Exception
|
||||
|
||||
newTask = taskService.newTask();
|
||||
newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
newTask.setPrimaryObjRef(createObjectReference(null, "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
|
||||
try {
|
||||
|
@ -381,7 +374,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testSetDomainFromWorkbasket()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
|
@ -392,10 +385,9 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
Workbasket workbasket = workbasketService.getWorkbasketByKey("USER_1_1");
|
||||
|
||||
Task newTask = taskService.newTask();
|
||||
Task newTask = taskService.newTask("USER_1_1");
|
||||
newTask.setClassificationKey("T2100");
|
||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||
newTask.setWorkbasketKey("USER_1_1");
|
||||
Task createdTask = taskService.createTask(newTask);
|
||||
|
||||
assertNotNull(createdTask);
|
||||
|
|
|
@ -9,6 +9,7 @@ import static org.junit.Assert.assertThat;
|
|||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.time.Instant;
|
||||
|
||||
import org.h2.store.fs.FileUtils;
|
||||
import org.junit.AfterClass;
|
||||
|
@ -29,6 +30,7 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
|||
import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||
import pro.taskana.exceptions.TaskNotFoundException;
|
||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.impl.TaskImpl;
|
||||
import pro.taskana.security.JAASRunner;
|
||||
import pro.taskana.security.WithAccessId;
|
||||
|
||||
|
@ -44,7 +46,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testUpdatePrimaryObjectReferenceOfTask()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
|
@ -53,6 +55,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||
Instant modifiedOriginal = task.getModified();
|
||||
task.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "7654321"));
|
||||
Task updatedTask = taskService.updateTask(task);
|
||||
updatedTask = taskService.getTask(updatedTask.getId());
|
||||
|
@ -61,6 +64,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
|||
Assert.assertEquals("7654321", updatedTask.getPrimaryObjRef().getValue());
|
||||
Assert.assertNotNull(updatedTask.getCreated());
|
||||
Assert.assertNotNull(updatedTask.getModified());
|
||||
Assert.assertTrue(modifiedOriginal.isBefore(updatedTask.getModified()));
|
||||
Assert.assertNotEquals(updatedTask.getCreated(), updatedTask.getModified());
|
||||
Assert.assertEquals(task.getCreated(), updatedTask.getCreated());
|
||||
Assert.assertEquals(task.isRead(), updatedTask.isRead());
|
||||
|
@ -68,7 +72,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
|
@ -126,7 +130,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testThrowsExceptionIfTaskHasAlreadyBeenUpdated()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
|
@ -153,7 +157,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testUpdateClassificationOfTask()
|
||||
throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException,
|
||||
|
@ -178,7 +182,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test
|
||||
public void testCustomPropertiesOfTask()
|
||||
throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException,
|
||||
|
@ -195,7 +199,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
@WithAccessId(
|
||||
userName = "user_1_1",
|
||||
groupNames = { "group_1" })
|
||||
groupNames = {"group_1"})
|
||||
@Test(expected = InvalidArgumentException.class)
|
||||
public void testUpdateOfWorkbasketKeyWhatIsNotAllowed()
|
||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||
|
@ -204,7 +208,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
|||
|
||||
TaskService taskService = taskanaEngine.getTaskService();
|
||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||
task.setWorkbasketKey("USER_2_2");
|
||||
((TaskImpl) task).setWorkbasketKey("USER_2_2");
|
||||
Task updatedTask = taskService.updateTask(task);
|
||||
}
|
||||
|
||||
|
|
|
@ -111,9 +111,8 @@ public class TaskServiceImplIntAutocommitTest {
|
|||
Classification classification = classificationService.newClassification("novatec", "TEST", "t1");
|
||||
taskanaEngine.getClassificationService().createClassification(classification);
|
||||
|
||||
Task task = taskServiceImpl.newTask();
|
||||
Task task = taskServiceImpl.newTask(wb.getKey());
|
||||
task.setName("Unit Test Task");
|
||||
task.setWorkbasketKey(wb.getKey());
|
||||
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
|
@ -145,9 +144,8 @@ public class TaskServiceImplIntAutocommitTest {
|
|||
classification.getKey(),
|
||||
classification.getDomain());
|
||||
|
||||
TaskImpl task = (TaskImpl) taskServiceImpl.newTask();
|
||||
TaskImpl task = (TaskImpl) taskServiceImpl.newTask(wb.getKey());
|
||||
task.setName("Unit Test Task");
|
||||
task.setWorkbasketKey(wb.getKey());
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
taskServiceImpl.createTask(task);
|
||||
|
@ -179,9 +177,8 @@ public class TaskServiceImplIntAutocommitTest {
|
|||
Classification classification = te.getClassificationService().newClassification("novatec", "TEST", "t1");
|
||||
te.getClassificationService().createClassification(classification);
|
||||
|
||||
Task task = taskServiceImpl.newTask();
|
||||
Task task = taskServiceImpl.newTask(wb.getKey());
|
||||
task.setName("Unit Test Task");
|
||||
task.setWorkbasketKey(wb.getKey());
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
task = taskServiceImpl.createTask(task);
|
||||
|
@ -203,9 +200,8 @@ public class TaskServiceImplIntAutocommitTest {
|
|||
Classification classification = classificationService.newClassification("novatec", "TEST", "t1");
|
||||
taskanaEngine.getClassificationService().createClassification(classification);
|
||||
|
||||
Task task = taskServiceImpl.newTask();
|
||||
Task task = taskServiceImpl.newTask(wb.getKey());
|
||||
task.setName("Unit Test Task");
|
||||
task.setWorkbasketKey(wb.getKey());
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
taskServiceImpl.createTask(task);
|
||||
|
@ -242,11 +238,10 @@ public class TaskServiceImplIntAutocommitTest {
|
|||
dummyClassification.setName("Dummy-Classification");
|
||||
classificationService.createClassification(dummyClassification);
|
||||
|
||||
TaskImpl dummyTask = (TaskImpl) taskServiceImpl.newTask();
|
||||
TaskImpl dummyTask = (TaskImpl) taskServiceImpl.newTask(dummyWorkbasket.getKey());
|
||||
dummyTask.setId(null);
|
||||
dummyTask.setName("Dummy-Task");
|
||||
dummyTask.setClassificationKey(dummyClassification.getKey());
|
||||
dummyTask.setWorkbasketKey(dummyWorkbasket.getKey());
|
||||
dummyTask.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
dummyTask = (TaskImpl) taskServiceImpl.createTask(dummyTask);
|
||||
|
||||
|
@ -323,10 +318,9 @@ public class TaskServiceImplIntAutocommitTest {
|
|||
classificationService.createClassification(classification);
|
||||
|
||||
// Task which should be transfered
|
||||
task = (TaskImpl) taskServiceImpl.newTask();
|
||||
task = (TaskImpl) taskServiceImpl.newTask(sourceWB.getKey());
|
||||
task.setName("Task Name");
|
||||
task.setDescription("Task used for transfer Test");
|
||||
task.setWorkbasketKey(sourceWB.getKey());
|
||||
task.setRead(true);
|
||||
task.setTransferred(false);
|
||||
task.setModified(null);
|
||||
|
@ -405,10 +399,9 @@ public class TaskServiceImplIntAutocommitTest {
|
|||
wbNoTransfer = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoTransfer);
|
||||
createWorkbasketWithSecurity(wbNoTransfer, wbNoTransfer.getOwner(), true, true, true, false);
|
||||
|
||||
TaskImpl task = (TaskImpl) taskServiceImpl.newTask();
|
||||
TaskImpl task = (TaskImpl) taskServiceImpl.newTask(wb.getKey());
|
||||
task.setName("Task Name");
|
||||
task.setDescription("Task used for transfer Test");
|
||||
task.setWorkbasketKey(wb.getKey());
|
||||
task.setOwner(user);
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
|
@ -457,9 +450,8 @@ public class TaskServiceImplIntAutocommitTest {
|
|||
Classification classification = classificationService.newClassification("novatec", "TEST", "t1");
|
||||
taskanaEngine.getClassificationService().createClassification(classification);
|
||||
|
||||
Task task = taskServiceImpl.newTask();
|
||||
Task task = taskServiceImpl.newTask(wb.getKey());
|
||||
task.setName("Unit Test Task");
|
||||
task.setWorkbasketKey(wb.getKey());
|
||||
|
||||
task.setClassificationKey(classification.getKey());
|
||||
|
||||
|
|
|
@ -121,9 +121,8 @@ public class TaskServiceImplIntExplicitTest {
|
|||
taskanaEngineImpl.getWorkbasketService().createWorkbasket(workbasket);
|
||||
taskanaEngineImpl.getClassificationService().createClassification(classification);
|
||||
connection.commit();
|
||||
Task task = taskServiceImpl.newTask();
|
||||
Task task = taskServiceImpl.newTask(workbasket.getKey());
|
||||
task.setName("Unit Test Task");
|
||||
task.setWorkbasketKey(workbasket.getKey());
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
task = taskServiceImpl.createTask(task);
|
||||
|
@ -196,9 +195,8 @@ public class TaskServiceImplIntExplicitTest {
|
|||
Classification classification = classificationService.newClassification("novatec", "TEST", "t1");
|
||||
classification = classificationServiceImpl.createClassification(classification);
|
||||
|
||||
Task task = taskServiceImpl.newTask();
|
||||
Task task = taskServiceImpl.newTask(workbasket.getKey());
|
||||
task.setName("Unit Test Task");
|
||||
task.setWorkbasketKey(workbasket.getKey());
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
task.addAttachment(null);
|
||||
|
@ -251,8 +249,7 @@ public class TaskServiceImplIntExplicitTest {
|
|||
wb.setKey("k1");
|
||||
workbasketService.createWorkbasket(wb);
|
||||
|
||||
Task test = taskServiceImpl.newTask();
|
||||
test.setWorkbasketKey("k1");
|
||||
Task test = taskServiceImpl.newTask("k1");
|
||||
test.setPrimaryObjRef(objectReference);
|
||||
test.setPlanned(tomorrow);
|
||||
test.setClassificationKey(classification.getKey());
|
||||
|
@ -267,8 +264,7 @@ public class TaskServiceImplIntExplicitTest {
|
|||
Assert.assertNotEquals(resultTask.getPlanned(), resultTask.getCreated());
|
||||
Assert.assertNotNull(resultTask.getDue());
|
||||
|
||||
Task task2 = taskServiceImpl.newTask();
|
||||
task2.setWorkbasketKey(task.getWorkbasketKey());
|
||||
Task task2 = taskServiceImpl.newTask(task.getWorkbasketKey());
|
||||
task2.setClassificationKey(classification.getKey());
|
||||
task2.setPrimaryObjRef(objectReference);
|
||||
task2.setDescription("desc");
|
||||
|
@ -295,7 +291,7 @@ public class TaskServiceImplIntExplicitTest {
|
|||
generateSampleAccessItems();
|
||||
|
||||
Task test = this.generateDummyTask();
|
||||
test.setWorkbasketKey("2");
|
||||
((TaskImpl) test).setWorkbasketKey("2");
|
||||
taskServiceImpl.createTask(test);
|
||||
}
|
||||
|
||||
|
@ -324,7 +320,7 @@ public class TaskServiceImplIntExplicitTest {
|
|||
classification.setName("not persisted - so not found.");
|
||||
|
||||
Task task = this.generateDummyTask();
|
||||
task.setWorkbasketKey(wb.getKey());
|
||||
((TaskImpl) task).setWorkbasketKey(wb.getKey());
|
||||
task.setClassificationKey(classification.getKey());
|
||||
taskServiceImpl.createTask(task);
|
||||
}
|
||||
|
@ -349,9 +345,8 @@ public class TaskServiceImplIntExplicitTest {
|
|||
workbasket.setDomain("novatec");
|
||||
workbasket = (WorkbasketImpl) workbasketService.createWorkbasket(workbasket);
|
||||
|
||||
Task task = taskServiceImpl.newTask();
|
||||
Task task = taskServiceImpl.newTask("k1");
|
||||
task.setName("Unit Test Task");
|
||||
task.setWorkbasketKey("k1");
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
task = taskServiceImpl.createTask(task);
|
||||
|
@ -424,10 +419,9 @@ public class TaskServiceImplIntExplicitTest {
|
|||
classificationService.createClassification(classification);
|
||||
|
||||
// Task which should be transfered
|
||||
task = (TaskImpl) taskServiceImpl.newTask();
|
||||
task = (TaskImpl) taskServiceImpl.newTask(sourceWB.getKey());
|
||||
task.setName("Task Name");
|
||||
task.setDescription("Task used for transfer Test");
|
||||
task.setWorkbasketKey(sourceWB.getKey());
|
||||
task.setRead(true);
|
||||
task.setTransferred(false);
|
||||
task.setModified(null);
|
||||
|
@ -512,10 +506,9 @@ public class TaskServiceImplIntExplicitTest {
|
|||
wbNoTransfer = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoTransfer);
|
||||
createWorkbasketWithSecurity(wbNoTransfer, wbNoTransfer.getOwner(), true, true, true, false);
|
||||
|
||||
TaskImpl task = (TaskImpl) taskServiceImpl.newTask();
|
||||
TaskImpl task = (TaskImpl) taskServiceImpl.newTask(wb.getKey());
|
||||
task.setName("Task Name");
|
||||
task.setDescription("Task used for transfer Test");
|
||||
task.setWorkbasketKey(wb.getKey());
|
||||
task.setOwner(user);
|
||||
task.setClassificationKey(classification.getKey());
|
||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||
|
@ -563,8 +556,7 @@ public class TaskServiceImplIntExplicitTest {
|
|||
Classification classification = classificationService.newClassification("novatec", "TEST", "t1");
|
||||
taskanaEngine.getClassificationService().createClassification(classification);
|
||||
|
||||
Task task = taskServiceImpl.newTask();
|
||||
task.setWorkbasketKey(workbasket.getKey());
|
||||
Task task = taskServiceImpl.newTask(workbasket.getKey());
|
||||
task.setClassificationKey(classification.getKey());
|
||||
return task;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,8 @@ public class ExampleBootstrap {
|
|||
ClassificationNotFoundException, InvalidStateException, InvalidOwnerException, InvalidWorkbasketException,
|
||||
TaskAlreadyExistException, InvalidArgumentException {
|
||||
System.out.println("---------------------------> Start App");
|
||||
Task task = taskService.newTask();
|
||||
Task task = taskService.newTask("1");
|
||||
task.setName("Spring example task");
|
||||
task.setWorkbasketKey("1");
|
||||
ObjectReference objRef = new ObjectReference();
|
||||
objRef.setCompany("aCompany");
|
||||
objRef.setSystem("aSystem");
|
||||
|
|
|
@ -26,9 +26,8 @@ public class TaskanaComponent {
|
|||
public void triggerRollback() throws NotAuthorizedException, WorkbasketNotFoundException,
|
||||
ClassificationNotFoundException, InvalidWorkbasketException, TaskAlreadyExistException,
|
||||
InvalidArgumentException {
|
||||
Task task = taskService.newTask();
|
||||
Task task = taskService.newTask("1");
|
||||
task.setName("Unit Test Task");
|
||||
task.setWorkbasketKey("1");
|
||||
ObjectReference objRef = new ObjectReference();
|
||||
objRef.setCompany("aCompany");
|
||||
objRef.setSystem("aSystem");
|
||||
|
|
Loading…
Reference in New Issue