TSK-137: Get all attachments of a Task.
This commit is contained in:
parent
98658ac8e8
commit
ad8aabb5de
|
|
@ -42,7 +42,7 @@ public class ExampleBootstrap {
|
||||||
taskanaEjb.getTaskService().claim(task.getId());
|
taskanaEjb.getTaskService().claim(task.getId());
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"---------------------------> Task claimed: "
|
"---------------------------> Task claimed: "
|
||||||
+ taskanaEjb.getTaskService().getTaskById(task.getId()).getOwner());
|
+ taskanaEjb.getTaskService().getTask(task.getId()).getOwner());
|
||||||
taskanaEjb.getTaskService().completeTask(task.getId());
|
taskanaEjb.getTaskService().completeTask(task.getId());
|
||||||
System.out.println("---------------------------> Task completed");
|
System.out.println("---------------------------> Task completed");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ public interface TaskService {
|
||||||
* @throws TaskNotFoundException
|
* @throws TaskNotFoundException
|
||||||
* thrown of the {@link Task} with taskId is not found
|
* thrown of the {@link Task} with taskId is not found
|
||||||
*/
|
*/
|
||||||
Task getTaskById(String taskId) throws TaskNotFoundException;
|
Task getTask(String taskId) throws TaskNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer a task to another work basket. The transfer sets the transferred flag and resets the read flag.
|
* Transfer a task to another work basket. The transfer sets the transferred flag and resets the read flag.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package pro.taskana.impl;
|
package pro.taskana.impl;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import pro.taskana.Attachment;
|
import pro.taskana.Attachment;
|
||||||
|
|
@ -20,12 +21,16 @@ public class AttachmentImpl implements Attachment {
|
||||||
private Timestamp modified;
|
private Timestamp modified;
|
||||||
private Classification classification;
|
private Classification classification;
|
||||||
private ObjectReference objectReference;
|
private ObjectReference objectReference;
|
||||||
|
private String porCompany;
|
||||||
|
private String porSystem;
|
||||||
|
private String porSystemInstance;
|
||||||
|
private String porType;
|
||||||
|
private String porValue;
|
||||||
private String channel;
|
private String channel;
|
||||||
private Timestamp received;
|
private Timestamp received;
|
||||||
private Map<String, Object> customAttributes;
|
private Map<String, Object> customAttributes = Collections.emptyMap();;
|
||||||
|
|
||||||
AttachmentImpl() {
|
AttachmentImpl() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -114,6 +119,46 @@ public class AttachmentImpl implements Attachment {
|
||||||
this.customAttributes = customAttributes;
|
this.customAttributes = customAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPorCompany() {
|
||||||
|
return porCompany;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPorCompany(String porCompany) {
|
||||||
|
this.porCompany = porCompany;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPorSystem() {
|
||||||
|
return porSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPorSystem(String porSystem) {
|
||||||
|
this.porSystem = porSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPorSystemInstance() {
|
||||||
|
return porSystemInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPorSystemInstance(String porSystemInstance) {
|
||||||
|
this.porSystemInstance = porSystemInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPorType() {
|
||||||
|
return porType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPorType(String porType) {
|
||||||
|
this.porType = porType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPorValue() {
|
||||||
|
return porValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPorValue(String porValue) {
|
||||||
|
this.porValue = porValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
@ -127,6 +172,16 @@ public class AttachmentImpl implements Attachment {
|
||||||
builder.append(modified);
|
builder.append(modified);
|
||||||
builder.append(", classification=");
|
builder.append(", classification=");
|
||||||
builder.append(classification);
|
builder.append(classification);
|
||||||
|
builder.append(", porCompany=");
|
||||||
|
builder.append(porCompany);
|
||||||
|
builder.append(", porSystem=");
|
||||||
|
builder.append(porSystem);
|
||||||
|
builder.append(", porSystemInstance=");
|
||||||
|
builder.append(porSystemInstance);
|
||||||
|
builder.append(", porType=");
|
||||||
|
builder.append(porType);
|
||||||
|
builder.append(", porValue=");
|
||||||
|
builder.append(porValue);
|
||||||
builder.append(", objectReference=");
|
builder.append(", objectReference=");
|
||||||
builder.append(objectReference);
|
builder.append(objectReference);
|
||||||
builder.append(", channel=");
|
builder.append(", channel=");
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
TaskImpl task = null;
|
TaskImpl task = null;
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
task = (TaskImpl) getTaskById(taskId);
|
task = (TaskImpl) getTask(taskId);
|
||||||
TaskState state = task.getState();
|
TaskState state = task.getState();
|
||||||
if (state == TaskState.COMPLETED) {
|
if (state == TaskState.COMPLETED) {
|
||||||
LOGGER.warn("Method claim() found that task {} is already completed. Throwing InvalidStateException",
|
LOGGER.warn("Method claim() found that task {} is already completed. Throwing InvalidStateException",
|
||||||
|
|
@ -123,7 +123,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
TaskImpl task = null;
|
TaskImpl task = null;
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
task = (TaskImpl) this.getTaskById(taskId);
|
task = (TaskImpl) this.getTask(taskId);
|
||||||
// check pre-conditions for non-forced invocation
|
// check pre-conditions for non-forced invocation
|
||||||
if (!isForced) {
|
if (!isForced) {
|
||||||
if (task.getClaimed() == null || task.getState() != TaskState.CLAIMED) {
|
if (task.getClaimed() == null || task.getState() != TaskState.CLAIMED) {
|
||||||
|
|
@ -191,7 +191,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Task getTaskById(String id) throws TaskNotFoundException {
|
public Task getTask(String id) throws TaskNotFoundException {
|
||||||
LOGGER.debug("entry to getTaskById(id = {})", id);
|
LOGGER.debug("entry to getTaskById(id = {})", id);
|
||||||
Task result = null;
|
Task result = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -199,6 +199,9 @@ public class TaskServiceImpl implements TaskService {
|
||||||
result = taskMapper.findById(id);
|
result = taskMapper.findById(id);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
setPrimaryObjRef((TaskImpl) result);
|
setPrimaryObjRef((TaskImpl) result);
|
||||||
|
List<Attachment> attachments = setAttachmentObjRef(
|
||||||
|
attachmentMapper.findAttachmentsByTaskId(result.getId()));
|
||||||
|
((TaskImpl) result).setAttachments(attachments);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
LOGGER.warn("Method getTaskById() didn't find task with id {}. Throwing TaskNotFoundException", id);
|
LOGGER.warn("Method getTaskById() didn't find task with id {}. Throwing TaskNotFoundException", id);
|
||||||
|
|
@ -217,7 +220,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
Task result = null;
|
Task result = null;
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
TaskImpl task = (TaskImpl) getTaskById(taskId);
|
TaskImpl task = (TaskImpl) getTask(taskId);
|
||||||
|
|
||||||
// transfer requires TRANSFER in source and APPEND on destination workbasket
|
// transfer requires TRANSFER in source and APPEND on destination workbasket
|
||||||
workbasketService.checkAuthorization(destinationWorkbasketKey, WorkbasketAuthorization.APPEND);
|
workbasketService.checkAuthorization(destinationWorkbasketKey, WorkbasketAuthorization.APPEND);
|
||||||
|
|
@ -238,7 +241,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
task.setModified(Timestamp.valueOf(LocalDateTime.now()));
|
task.setModified(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
taskMapper.update(task);
|
taskMapper.update(task);
|
||||||
|
|
||||||
result = getTaskById(taskId);
|
result = getTask(taskId);
|
||||||
LOGGER.debug("Method transfer() transferred Task '{}' to destination workbasket {}", taskId,
|
LOGGER.debug("Method transfer() transferred Task '{}' to destination workbasket {}", taskId,
|
||||||
destinationWorkbasketKey);
|
destinationWorkbasketKey);
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -254,11 +257,11 @@ public class TaskServiceImpl implements TaskService {
|
||||||
Task result = null;
|
Task result = null;
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
TaskImpl task = (TaskImpl) getTaskById(taskId);
|
TaskImpl task = (TaskImpl) getTask(taskId);
|
||||||
task.setRead(true);
|
task.setRead(true);
|
||||||
task.setModified(Timestamp.valueOf(LocalDateTime.now()));
|
task.setModified(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
taskMapper.update(task);
|
taskMapper.update(task);
|
||||||
result = getTaskById(taskId);
|
result = getTask(taskId);
|
||||||
LOGGER.debug("Method setTaskRead() set read property of Task '{}' to {} ", result, isRead);
|
LOGGER.debug("Method setTaskRead() set read property of Task '{}' to {} ", result, isRead);
|
||||||
return result;
|
return result;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -307,7 +310,7 @@ public class TaskServiceImpl implements TaskService {
|
||||||
TaskImpl oldTaskImpl = null;
|
TaskImpl oldTaskImpl = null;
|
||||||
try {
|
try {
|
||||||
taskanaEngineImpl.openConnection();
|
taskanaEngineImpl.openConnection();
|
||||||
oldTaskImpl = (TaskImpl) getTaskById(newTaskImpl.getId());
|
oldTaskImpl = (TaskImpl) getTask(newTaskImpl.getId());
|
||||||
standardUpdateActions(oldTaskImpl, newTaskImpl);
|
standardUpdateActions(oldTaskImpl, newTaskImpl);
|
||||||
|
|
||||||
taskMapper.update(newTaskImpl);
|
taskMapper.update(newTaskImpl);
|
||||||
|
|
@ -431,6 +434,23 @@ public class TaskServiceImpl implements TaskService {
|
||||||
task.setPrimaryObjRef(objRef);
|
task.setPrimaryObjRef(objRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Attachment> setAttachmentObjRef(List<AttachmentImpl> attachments) {
|
||||||
|
List<Attachment> results = new ArrayList<>();
|
||||||
|
if (attachments != null && !attachments.isEmpty()) {
|
||||||
|
for (AttachmentImpl attachment : attachments) {
|
||||||
|
ObjectReference objRef = new ObjectReference();
|
||||||
|
objRef.setCompany(attachment.getPorCompany());
|
||||||
|
objRef.setSystem(attachment.getPorSystem());
|
||||||
|
objRef.setSystemInstance(attachment.getPorSystemInstance());
|
||||||
|
objRef.setType(attachment.getPorType());
|
||||||
|
objRef.setValue(attachment.getPorValue());
|
||||||
|
attachment.setObjectReference(objRef);
|
||||||
|
results.add(attachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
private void validateObjectReference(ObjectReference objRef, String objRefType, String objName)
|
private void validateObjectReference(ObjectReference objRef, String objRefType, String objName)
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
// check that all values in the ObjectReference are set correctly
|
// check that all values in the ObjectReference are set correctly
|
||||||
|
|
@ -465,7 +485,6 @@ public class TaskServiceImpl implements TaskService {
|
||||||
throw new InvalidArgumentException("Classification of attachment " + attachment + " must not be null");
|
throw new InvalidArgumentException("Classification of attachment " + attachment + " must not be null");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void standardUpdateActions(TaskImpl oldTaskImpl, TaskImpl newTaskImpl)
|
private void standardUpdateActions(TaskImpl oldTaskImpl, TaskImpl newTaskImpl)
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,51 @@
|
||||||
package pro.taskana.model.mappings;
|
package pro.taskana.model.mappings;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Insert;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Insert;
|
||||||
|
import org.apache.ibatis.annotations.One;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Result;
|
||||||
|
import org.apache.ibatis.annotations.Results;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import org.apache.ibatis.type.JdbcType;
|
||||||
|
|
||||||
|
import pro.taskana.Classification;
|
||||||
import pro.taskana.impl.AttachmentImpl;
|
import pro.taskana.impl.AttachmentImpl;
|
||||||
|
import pro.taskana.impl.persistence.MapTypeHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is the mybatis mapping of Attachment.
|
* This class is the mybatis mapping of Attachment.
|
||||||
*/
|
*/
|
||||||
public interface AttachmentMapper {
|
public interface AttachmentMapper {
|
||||||
|
|
||||||
|
String CLASSIFICATION_FINDBYID = "pro.taskana.model.mappings.ClassificationMapper.findById";
|
||||||
|
|
||||||
@Insert("INSERT INTO ATTACHMENT (ID, TASK_ID, CREATED, MODIFIED, CLASSIFICATION_KEY, REF_COMPANY, REF_SYSTEM, REF_INSTANCE, REF_TYPE, REF_VALUE, CHANNEL, RECEIVED, CUSTOM_ATTRIBUTES) "
|
@Insert("INSERT INTO ATTACHMENT (ID, TASK_ID, CREATED, MODIFIED, CLASSIFICATION_KEY, REF_COMPANY, REF_SYSTEM, REF_INSTANCE, REF_TYPE, REF_VALUE, CHANNEL, RECEIVED, CUSTOM_ATTRIBUTES) "
|
||||||
+ "VALUES (#{att.id}, #{att.taskId}, #{att.created}, #{att.modified}, #{att.classification.key}, #{att.objectReference.company}, #{att.objectReference.system}, #{att.objectReference.systemInstance}, "
|
+ "VALUES (#{att.id}, #{att.taskId}, #{att.created}, #{att.modified}, #{att.classification.key}, #{att.objectReference.company}, #{att.objectReference.system}, #{att.objectReference.systemInstance}, "
|
||||||
+ " #{att.objectReference.type}, #{att.objectReference.value}, #{att.channel}, #{att.received}, #{att.customAttributes,jdbcType=BLOB,javaType=java.util.Map,typeHandler=pro.taskana.impl.persistence.MapTypeHandler} )")
|
+ " #{att.objectReference.type}, #{att.objectReference.value}, #{att.channel}, #{att.received}, #{att.customAttributes,jdbcType=BLOB,javaType=java.util.Map,typeHandler=pro.taskana.impl.persistence.MapTypeHandler} )")
|
||||||
void insert(@Param("att") AttachmentImpl att);
|
void insert(@Param("att") AttachmentImpl att);
|
||||||
|
|
||||||
|
@Select("SELECT ID, TASK_ID, CREATED, MODIFIED, CLASSIFICATION_KEY, REF_COMPANY, REF_SYSTEM, REF_INSTANCE, REF_TYPE, REF_VALUE, CHANNEL, RECEIVED, CUSTOM_ATTRIBUTES "
|
||||||
|
+ "FROM ATTACHMENT "
|
||||||
|
+ "WHERE TASK_ID = #{taskId}")
|
||||||
|
@Results(value = {
|
||||||
|
@Result(property = "id", column = "ID"),
|
||||||
|
@Result(property = "taskId", column = "TASK_ID"),
|
||||||
|
@Result(property = "created", column = "CREATED"),
|
||||||
|
@Result(property = "modified", column = "MODIFIED"),
|
||||||
|
@Result(property = "classification", column = "CLASSIFICATION_KEY", javaType = Classification.class,
|
||||||
|
one = @One(select = CLASSIFICATION_FINDBYID)),
|
||||||
|
@Result(property = "porCompany", column = "REF_COMPANY"),
|
||||||
|
@Result(property = "porSystem", column = "REF_SYSTEM"),
|
||||||
|
@Result(property = "porSystemInstance", column = "REF_INSTANCE"),
|
||||||
|
@Result(property = "porType", column = "REF_TYPE"),
|
||||||
|
@Result(property = "porValue", column = "REF_VALUE"),
|
||||||
|
@Result(property = "channel", column = "CHANNEL"),
|
||||||
|
@Result(property = "received", column = "RECEIVED"),
|
||||||
|
@Result(property = "customAttributes", column = "CUSTOM_ATTRIBUTES", jdbcType = JdbcType.BLOB,
|
||||||
|
javaType = Map.class, typeHandler = MapTypeHandler.class),
|
||||||
|
})
|
||||||
|
List<AttachmentImpl> findAttachmentsByTaskId(@Param("taskId") String taskId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import pro.taskana.model.ObjectReference;
|
||||||
public interface QueryMapper {
|
public interface QueryMapper {
|
||||||
|
|
||||||
String OBJECTREFERENCEMAPPER_FINDBYID = "pro.taskana.model.mappings.ObjectReferenceMapper.findById";
|
String OBJECTREFERENCEMAPPER_FINDBYID = "pro.taskana.model.mappings.ObjectReferenceMapper.findById";
|
||||||
String CLASSIFICATION_FINDBYIDANDDOMAIN = "pro.taskana.model.mappings.ClassificationMapper.findByKeyAndDomain";
|
String CLASSIFICATION_FINDBYKEYANDDOMAIN = "pro.taskana.model.mappings.ClassificationMapper.findByKeyAndDomain";
|
||||||
String CLASSIFICATION_FINDBYID = "pro.taskana.model.mappings.ClassificationMapper.findById";
|
String CLASSIFICATION_FINDBYID = "pro.taskana.model.mappings.ClassificationMapper.findById";
|
||||||
|
|
||||||
@Select("<script>SELECT t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.DESCRIPTION, t.PRIORITY, t.STATE, t.CLASSIFICATION_KEY, t.WORKBASKET_KEY, t.OWNER, t.POR_COMPANY, t.POR_SYSTEM, t.POR_INSTANCE, t.POR_TYPE, t.POR_VALUE, t.IS_READ, t.IS_TRANSFERRED, t.CUSTOM_1, t.CUSTOM_2, t.CUSTOM_3, t.CUSTOM_4, t.CUSTOM_5, t.CUSTOM_6, t.CUSTOM_7, t.CUSTOM_8, t.CUSTOM_9, t.CUSTOM_10 "
|
@Select("<script>SELECT t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.DESCRIPTION, t.PRIORITY, t.STATE, t.CLASSIFICATION_KEY, t.WORKBASKET_KEY, t.OWNER, t.POR_COMPANY, t.POR_SYSTEM, t.POR_INSTANCE, t.POR_TYPE, t.POR_VALUE, t.IS_READ, t.IS_TRANSFERRED, t.CUSTOM_1, t.CUSTOM_2, t.CUSTOM_3, t.CUSTOM_4, t.CUSTOM_5, t.CUSTOM_6, t.CUSTOM_7, t.CUSTOM_8, t.CUSTOM_9, t.CUSTOM_10 "
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ public interface TaskMapper {
|
||||||
@Result(property = "custom7", column = "CUSTOM_7"),
|
@Result(property = "custom7", column = "CUSTOM_7"),
|
||||||
@Result(property = "custom8", column = "CUSTOM_8"),
|
@Result(property = "custom8", column = "CUSTOM_8"),
|
||||||
@Result(property = "custom9", column = "CUSTOM_9"),
|
@Result(property = "custom9", column = "CUSTOM_9"),
|
||||||
@Result(property = "custom10", column = "CUSTOM_10")})
|
@Result(property = "custom10", column = "CUSTOM_10")
|
||||||
|
})
|
||||||
TaskImpl findById(@Param("id") String id);
|
TaskImpl findById(@Param("id") String id);
|
||||||
|
|
||||||
@Results({ @Result(column = "DUE_DATE", property = "due"),
|
@Results({ @Result(column = "DUE_DATE", property = "due"),
|
||||||
|
|
@ -132,7 +132,6 @@ public interface TaskMapper {
|
||||||
@Result(property = "custom8", column = "CUSTOM_8"),
|
@Result(property = "custom8", column = "CUSTOM_8"),
|
||||||
@Result(property = "custom9", column = "CUSTOM_9"),
|
@Result(property = "custom9", column = "CUSTOM_9"),
|
||||||
@Result(property = "custom10", column = "CUSTOM_10") })
|
@Result(property = "custom10", column = "CUSTOM_10") })
|
||||||
|
|
||||||
List<TaskImpl> findTasksByWorkbasketIdAndState(@Param("workbasketKey") String workbasketKey,
|
List<TaskImpl> findTasksByWorkbasketIdAndState(@Param("workbasketKey") String workbasketKey,
|
||||||
@Param("taskState") TaskState taskState);
|
@Param("taskState") TaskState taskState);
|
||||||
|
|
||||||
|
|
@ -151,5 +150,4 @@ public interface TaskMapper {
|
||||||
@Result(property = "classificationName", column = "classificationName")
|
@Result(property = "classificationName", column = "classificationName")
|
||||||
})
|
})
|
||||||
List<TaskSummary> findTaskSummariesByWorkbasketKey(@Param("workbasketKey") String workbasketKey);
|
List<TaskSummary> findTaskSummariesByWorkbasketKey(@Param("workbasketKey") String workbasketKey);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.InvalidWorkbasketException;
|
import pro.taskana.exceptions.InvalidWorkbasketException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.TaskAlreadyExistException;
|
import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||||
|
import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.model.TaskState;
|
import pro.taskana.model.TaskState;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASRunner;
|
||||||
|
|
@ -72,7 +73,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateExternalTaskWithAttachment()
|
public void testCreateExternalTaskWithAttachment()
|
||||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task newTask = taskService.newTask();
|
Task newTask = taskService.newTask();
|
||||||
|
|
@ -87,15 +88,16 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
assertNotNull(createdTask.getId());
|
assertNotNull(createdTask.getId());
|
||||||
|
|
||||||
// rename getTaskById to getTask
|
Task readTask = taskService.getTask(createdTask.getId());
|
||||||
// Task readTask = taskService.getTask(createdTask.getId());
|
|
||||||
|
|
||||||
// assertNotNull(readTask);
|
assertNotNull(readTask);
|
||||||
// assertNotNull(readTask.getAttachments());
|
assertNotNull(readTask.getAttachments());
|
||||||
// assertEquals(1, readTask.getAttachments().size());
|
assertEquals(1, readTask.getAttachments().size());
|
||||||
// assertNotNull(readTask.getAttachments().get(0).getCreated());
|
assertNotNull(readTask.getAttachments().get(0).getCreated());
|
||||||
// assertNotNull(readTask.getAttachments().get(0).getModified());
|
assertNotNull(readTask.getAttachments().get(0).getModified());
|
||||||
// assertEquals(readTask.getAttachments().get(0).getCreated(), readTask.getAttachments().get(0).getModified());
|
assertEquals(readTask.getAttachments().get(0).getCreated(), readTask.getAttachments().get(0).getModified());
|
||||||
|
// assertNotNull(readTask.getAttachments().get(0).getClassification());
|
||||||
|
assertNotNull(readTask.getAttachments().get(0).getObjectReference());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
@ -104,7 +106,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateExternalTaskWithMultipleAttachments()
|
public void testCreateExternalTaskWithMultipleAttachments()
|
||||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||||
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException {
|
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task newTask = taskService.newTask();
|
Task newTask = taskService.newTask();
|
||||||
|
|
@ -123,15 +125,16 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
assertNotNull(createdTask.getId());
|
assertNotNull(createdTask.getId());
|
||||||
|
|
||||||
// rename getTaskById to getTask
|
Task readTask = taskService.getTask(createdTask.getId());
|
||||||
// Task readTask = taskService.getTask(createdTask.getId());
|
|
||||||
|
|
||||||
// assertNotNull(readTask);
|
assertNotNull(readTask);
|
||||||
// assertNotNull(readTask.getAttachments());
|
assertNotNull(readTask.getAttachments());
|
||||||
// assertEquals(2, readTask.getAttachments().size());
|
assertEquals(2, readTask.getAttachments().size());
|
||||||
// assertNotNull(readTask.getAttachments().get(1).getCreated());
|
assertNotNull(readTask.getAttachments().get(1).getCreated());
|
||||||
// assertNotNull(readTask.getAttachments().get(1).getModified());
|
assertNotNull(readTask.getAttachments().get(1).getModified());
|
||||||
// assertEquals(readTask.getAttachments().get(0).getCreated(), readTask.getAttachments().get(1).getModified());
|
assertEquals(readTask.getAttachments().get(0).getCreated(), readTask.getAttachments().get(1).getModified());
|
||||||
|
// assertNotNull(readTask.getAttachments().get(0).getClassification());
|
||||||
|
assertNotNull(readTask.getAttachments().get(0).getObjectReference());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
||||||
ConcurrencyException {
|
ConcurrencyException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTaskById("TKI:000000000000000000000000000000000000");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
task.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "7654321"));
|
task.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "7654321"));
|
||||||
Task updatedTask = taskService.updateTask(task);
|
Task updatedTask = taskService.updateTask(task);
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
||||||
ConcurrencyException {
|
ConcurrencyException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTaskById("TKI:000000000000000000000000000000000000");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
task.setPrimaryObjRef(null);
|
task.setPrimaryObjRef(null);
|
||||||
Task updatedTask = null;
|
Task updatedTask = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -120,8 +120,8 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
||||||
ConcurrencyException {
|
ConcurrencyException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTaskById("TKI:000000000000000000000000000000000000");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
Task task2 = taskService.getTaskById("TKI:000000000000000000000000000000000000");
|
Task task2 = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
|
|
||||||
task.setCustom1("willi");
|
task.setCustom1("willi");
|
||||||
Task updatedTask = null;
|
Task updatedTask = null;
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ import pro.taskana.model.ObjectReference;
|
||||||
import pro.taskana.model.TaskState;
|
import pro.taskana.model.TaskState;
|
||||||
import pro.taskana.model.TaskSummary;
|
import pro.taskana.model.TaskSummary;
|
||||||
import pro.taskana.model.WorkbasketAuthorization;
|
import pro.taskana.model.WorkbasketAuthorization;
|
||||||
|
import pro.taskana.model.mappings.AttachmentMapper;
|
||||||
import pro.taskana.model.mappings.ObjectReferenceMapper;
|
import pro.taskana.model.mappings.ObjectReferenceMapper;
|
||||||
import pro.taskana.model.mappings.TaskMapper;
|
import pro.taskana.model.mappings.TaskMapper;
|
||||||
import pro.taskana.security.CurrentUserContext;
|
import pro.taskana.security.CurrentUserContext;
|
||||||
|
|
@ -92,6 +93,9 @@ public class TaskServiceImplTest {
|
||||||
@Mock
|
@Mock
|
||||||
private ClassificationService classificationServiceMock;
|
private ClassificationService classificationServiceMock;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private AttachmentMapper attachmentMapperMock;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
|
|
@ -116,7 +120,7 @@ public class TaskServiceImplTest {
|
||||||
wb.setId("1");
|
wb.setId("1");
|
||||||
wb.setKey("k1");
|
wb.setKey("k1");
|
||||||
wb.setName("workbasket");
|
wb.setName("workbasket");
|
||||||
doThrow(TaskNotFoundException.class).when(cutSpy).getTaskById(expectedTask.getId());
|
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(expectedTask.getId());
|
||||||
doReturn(wb).when(workbasketServiceMock).getWorkbasketByKey(wb.getKey());
|
doReturn(wb).when(workbasketServiceMock).getWorkbasketByKey(wb.getKey());
|
||||||
doNothing().when(taskMapperMock).insert(expectedTask);
|
doNothing().when(taskMapperMock).insert(expectedTask);
|
||||||
expectedTask.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
expectedTask.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||||
|
|
@ -129,8 +133,8 @@ public class TaskServiceImplTest {
|
||||||
verify(classificationServiceMock, times(1)).getClassification(any(), any());
|
verify(classificationServiceMock, times(1)).getClassification(any(), any());
|
||||||
verify(taskMapperMock, times(1)).insert(expectedTask);
|
verify(taskMapperMock, times(1)).insert(expectedTask);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
||||||
classificationServiceMock);
|
classificationServiceMock);
|
||||||
|
|
||||||
assertNull(actualTask.getOwner());
|
assertNull(actualTask.getOwner());
|
||||||
|
|
@ -157,7 +161,7 @@ public class TaskServiceImplTest {
|
||||||
TaskImpl expectedTask = createUnitTestTask("", "DUMMYTASK", wb.getKey());
|
TaskImpl expectedTask = createUnitTestTask("", "DUMMYTASK", wb.getKey());
|
||||||
expectedTask.setPrimaryObjRef(expectedObjectReference);
|
expectedTask.setPrimaryObjRef(expectedObjectReference);
|
||||||
Classification classification = expectedTask.getClassification();
|
Classification classification = expectedTask.getClassification();
|
||||||
doThrow(TaskNotFoundException.class).when(cutSpy).getTaskById(expectedTask.getId());
|
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(expectedTask.getId());
|
||||||
doReturn(wb).when(workbasketServiceMock).getWorkbasketByKey(expectedTask.getWorkbasketKey());
|
doReturn(wb).when(workbasketServiceMock).getWorkbasketByKey(expectedTask.getWorkbasketKey());
|
||||||
doReturn(expectedObjectReference).when(objectReferenceMapperMock)
|
doReturn(expectedObjectReference).when(objectReferenceMapperMock)
|
||||||
.findByObjectReference(expectedObjectReference);
|
.findByObjectReference(expectedObjectReference);
|
||||||
|
|
@ -171,8 +175,8 @@ public class TaskServiceImplTest {
|
||||||
classification.getDomain());
|
classification.getDomain());
|
||||||
verify(taskMapperMock, times(1)).insert(expectedTask);
|
verify(taskMapperMock, times(1)).insert(expectedTask);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
||||||
classificationServiceMock);
|
classificationServiceMock);
|
||||||
assertNull(actualTask.getOwner());
|
assertNull(actualTask.getOwner());
|
||||||
assertNotNull(actualTask.getCreated());
|
assertNotNull(actualTask.getCreated());
|
||||||
|
|
@ -199,7 +203,7 @@ public class TaskServiceImplTest {
|
||||||
TaskImpl expectedTask = createUnitTestTask("", "DUMMYTASK", "key1");
|
TaskImpl expectedTask = createUnitTestTask("", "DUMMYTASK", "key1");
|
||||||
expectedTask.setPrimaryObjRef(expectedObjectReference);
|
expectedTask.setPrimaryObjRef(expectedObjectReference);
|
||||||
Classification classification = expectedTask.getClassification();
|
Classification classification = expectedTask.getClassification();
|
||||||
doThrow(TaskNotFoundException.class).when(cutSpy).getTaskById(expectedTask.getId());
|
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(expectedTask.getId());
|
||||||
doReturn(classification).when(classificationServiceMock).getClassification(classification.getKey(),
|
doReturn(classification).when(classificationServiceMock).getClassification(classification.getKey(),
|
||||||
classification.getDomain());
|
classification.getDomain());
|
||||||
doNothing().when(taskMapperMock).insert(expectedTask);
|
doNothing().when(taskMapperMock).insert(expectedTask);
|
||||||
|
|
@ -217,8 +221,8 @@ public class TaskServiceImplTest {
|
||||||
classification.getDomain());
|
classification.getDomain());
|
||||||
verify(taskMapperMock, times(1)).insert(expectedTask);
|
verify(taskMapperMock, times(1)).insert(expectedTask);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
||||||
classificationServiceMock);
|
classificationServiceMock);
|
||||||
assertNull(actualTask.getOwner());
|
assertNull(actualTask.getOwner());
|
||||||
assertNotNull(actualTask.getCreated());
|
assertNotNull(actualTask.getCreated());
|
||||||
|
|
@ -249,7 +253,7 @@ public class TaskServiceImplTest {
|
||||||
task.setClassification(classification);
|
task.setClassification(classification);
|
||||||
task.setPrimaryObjRef(expectedObjectReference);
|
task.setPrimaryObjRef(expectedObjectReference);
|
||||||
task.setDescription("simply awesome task");
|
task.setDescription("simply awesome task");
|
||||||
doThrow(TaskNotFoundException.class).when(cutSpy).getTaskById(task.getId());
|
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(task.getId());
|
||||||
doReturn(wb).when(workbasketServiceMock).getWorkbasketByKey(wb.getKey());
|
doReturn(wb).when(workbasketServiceMock).getWorkbasketByKey(wb.getKey());
|
||||||
doReturn(classification).when(classificationServiceMock).getClassification(classification.getKey(),
|
doReturn(classification).when(classificationServiceMock).getClassification(classification.getKey(),
|
||||||
classification.getDomain());
|
classification.getDomain());
|
||||||
|
|
@ -276,8 +280,8 @@ public class TaskServiceImplTest {
|
||||||
verify(taskMapperMock, times(1)).insert(task);
|
verify(taskMapperMock, times(1)).insert(task);
|
||||||
verify(taskMapperMock, times(1)).insert(task2);
|
verify(taskMapperMock, times(1)).insert(task2);
|
||||||
verify(taskanaEngineImpl, times(2)).returnConnection();
|
verify(taskanaEngineImpl, times(2)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
||||||
classificationServiceMock);
|
classificationServiceMock);
|
||||||
|
|
||||||
assertNull(task.getOwner());
|
assertNull(task.getOwner());
|
||||||
|
|
@ -300,15 +304,15 @@ public class TaskServiceImplTest {
|
||||||
InvalidWorkbasketException, InvalidArgumentException {
|
InvalidWorkbasketException, InvalidArgumentException {
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
TaskImpl task = createUnitTestTask("12", "Task Name", "1");
|
TaskImpl task = createUnitTestTask("12", "Task Name", "1");
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cutSpy.createTask(task);
|
cutSpy.createTask(task);
|
||||||
} catch (TaskAlreadyExistException ex) {
|
} catch (TaskAlreadyExistException ex) {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
||||||
classificationServiceMock);
|
classificationServiceMock);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
@ -320,7 +324,7 @@ public class TaskServiceImplTest {
|
||||||
TaskAlreadyExistException, TaskNotFoundException, InvalidWorkbasketException, InvalidArgumentException {
|
TaskAlreadyExistException, TaskNotFoundException, InvalidWorkbasketException, InvalidArgumentException {
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
TaskImpl task = createUnitTestTask("", "dummyTask", "1");
|
TaskImpl task = createUnitTestTask("", "dummyTask", "1");
|
||||||
doThrow(TaskNotFoundException.class).when(cutSpy).getTaskById(task.getId());
|
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(task.getId());
|
||||||
doThrow(NotAuthorizedException.class).when(workbasketServiceMock).checkAuthorization(task.getWorkbasketKey(),
|
doThrow(NotAuthorizedException.class).when(workbasketServiceMock).checkAuthorization(task.getWorkbasketKey(),
|
||||||
WorkbasketAuthorization.APPEND);
|
WorkbasketAuthorization.APPEND);
|
||||||
try {
|
try {
|
||||||
|
|
@ -331,8 +335,8 @@ public class TaskServiceImplTest {
|
||||||
verify(workbasketServiceMock, times(1)).checkAuthorization(task.getWorkbasketKey(),
|
verify(workbasketServiceMock, times(1)).checkAuthorization(task.getWorkbasketKey(),
|
||||||
WorkbasketAuthorization.APPEND);
|
WorkbasketAuthorization.APPEND);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
||||||
classificationServiceMock);
|
classificationServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
@ -344,7 +348,7 @@ public class TaskServiceImplTest {
|
||||||
InvalidWorkbasketException, TaskAlreadyExistException, TaskNotFoundException, InvalidArgumentException {
|
InvalidWorkbasketException, TaskAlreadyExistException, TaskNotFoundException, InvalidArgumentException {
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
TaskImpl task = createUnitTestTask("", "dumma-task", "1");
|
TaskImpl task = createUnitTestTask("", "dumma-task", "1");
|
||||||
doThrow(TaskNotFoundException.class).when(cutSpy).getTaskById(task.getId());
|
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(task.getId());
|
||||||
doThrow(WorkbasketNotFoundException.class).when(workbasketServiceMock).getWorkbasketByKey(any());
|
doThrow(WorkbasketNotFoundException.class).when(workbasketServiceMock).getWorkbasketByKey(any());
|
||||||
try {
|
try {
|
||||||
cutSpy.createTask(task);
|
cutSpy.createTask(task);
|
||||||
|
|
@ -352,8 +356,8 @@ public class TaskServiceImplTest {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(workbasketServiceMock, times(1)).getWorkbasketByKey(task.getWorkbasketKey());
|
verify(workbasketServiceMock, times(1)).getWorkbasketByKey(task.getWorkbasketKey());
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock,
|
||||||
classificationServiceMock);
|
classificationServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
@ -362,6 +366,7 @@ public class TaskServiceImplTest {
|
||||||
@Test
|
@Test
|
||||||
public void testClaimSuccessfulToOwner() throws Exception {
|
public void testClaimSuccessfulToOwner() throws Exception {
|
||||||
TaskImpl expectedTask = createUnitTestTask("1", "Unit Test Task 1", "1");
|
TaskImpl expectedTask = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||||
|
doReturn(null).when(attachmentMapperMock).findAttachmentsByTaskId(expectedTask.getId());
|
||||||
Mockito.doReturn(expectedTask).when(taskMapperMock).findById(expectedTask.getId());
|
Mockito.doReturn(expectedTask).when(taskMapperMock).findById(expectedTask.getId());
|
||||||
|
|
||||||
Thread.sleep(SLEEP_TIME); // to have different timestamps
|
Thread.sleep(SLEEP_TIME); // to have different timestamps
|
||||||
|
|
@ -375,10 +380,11 @@ public class TaskServiceImplTest {
|
||||||
|
|
||||||
verify(taskanaEngineImpl, times(2)).openConnection();
|
verify(taskanaEngineImpl, times(2)).openConnection();
|
||||||
verify(taskMapperMock, times(1)).findById(expectedTask.getId());
|
verify(taskMapperMock, times(1)).findById(expectedTask.getId());
|
||||||
|
verify(attachmentMapperMock, times(1)).findAttachmentsByTaskId(expectedTask.getId());
|
||||||
verify(taskMapperMock, times(1)).update(any());
|
verify(taskMapperMock, times(1)).update(any());
|
||||||
verify(taskanaEngineImpl, times(2)).returnConnection();
|
verify(taskanaEngineImpl, times(2)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
|
|
||||||
assertThat(acturalTask.getState(), equalTo(TaskState.CLAIMED));
|
assertThat(acturalTask.getState(), equalTo(TaskState.CLAIMED));
|
||||||
assertThat(acturalTask.getCreated(), not(equalTo(expectedTask.getModified())));
|
assertThat(acturalTask.getCreated(), not(equalTo(expectedTask.getModified())));
|
||||||
|
|
@ -398,8 +404,8 @@ public class TaskServiceImplTest {
|
||||||
verify(taskanaEngineImpl, times(2)).openConnection();
|
verify(taskanaEngineImpl, times(2)).openConnection();
|
||||||
verify(taskMapperMock, times(1)).findById(any());
|
verify(taskMapperMock, times(1)).findById(any());
|
||||||
verify(taskanaEngineImpl, times(2)).returnConnection();
|
verify(taskanaEngineImpl, times(2)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -416,16 +422,18 @@ public class TaskServiceImplTest {
|
||||||
task.setClaimed(new Timestamp(System.currentTimeMillis()));
|
task.setClaimed(new Timestamp(System.currentTimeMillis()));
|
||||||
task.setOwner(CurrentUserContext.getUserid());
|
task.setOwner(CurrentUserContext.getUserid());
|
||||||
doReturn(task).when(taskMapperMock).findById(task.getId());
|
doReturn(task).when(taskMapperMock).findById(task.getId());
|
||||||
|
doReturn(null).when(attachmentMapperMock).findAttachmentsByTaskId(task.getId());
|
||||||
doReturn(task).when(cutSpy).completeTask(task.getId(), isForced);
|
doReturn(task).when(cutSpy).completeTask(task.getId(), isForced);
|
||||||
|
|
||||||
Task actualTask = cut.completeTask(task.getId());
|
Task actualTask = cut.completeTask(task.getId());
|
||||||
|
|
||||||
verify(taskanaEngineImpl, times(2)).openConnection();
|
verify(taskanaEngineImpl, times(2)).openConnection();
|
||||||
verify(taskMapperMock, times(1)).findById(task.getId());
|
verify(taskMapperMock, times(1)).findById(task.getId());
|
||||||
|
verify(attachmentMapperMock, times(1)).findAttachmentsByTaskId(task.getId());
|
||||||
verify(taskMapperMock, times(1)).update(any());
|
verify(taskMapperMock, times(1)).update(any());
|
||||||
verify(taskanaEngineImpl, times(2)).returnConnection();
|
verify(taskanaEngineImpl, times(2)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
|
|
||||||
assertThat(actualTask.getState(), equalTo(TaskState.COMPLETED));
|
assertThat(actualTask.getState(), equalTo(TaskState.COMPLETED));
|
||||||
assertThat(actualTask.getCreated(), not(equalTo(task.getModified())));
|
assertThat(actualTask.getCreated(), not(equalTo(task.getModified())));
|
||||||
|
|
@ -444,17 +452,17 @@ public class TaskServiceImplTest {
|
||||||
task.setState(TaskState.CLAIMED);
|
task.setState(TaskState.CLAIMED);
|
||||||
task.setClaimed(new Timestamp(System.currentTimeMillis()));
|
task.setClaimed(new Timestamp(System.currentTimeMillis()));
|
||||||
task.setOwner(CurrentUserContext.getUserid());
|
task.setOwner(CurrentUserContext.getUserid());
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
doNothing().when(taskMapperMock).update(task);
|
doNothing().when(taskMapperMock).update(task);
|
||||||
|
|
||||||
Task actualTask = cutSpy.completeTask(task.getId(), isForced);
|
Task actualTask = cutSpy.completeTask(task.getId(), isForced);
|
||||||
|
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(cutSpy, times(1)).getTaskById(task.getId());
|
verify(cutSpy, times(1)).getTask(task.getId());
|
||||||
verify(taskMapperMock, times(1)).update(task);
|
verify(taskMapperMock, times(1)).update(task);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
|
|
||||||
assertThat(actualTask.getState(), equalTo(TaskState.COMPLETED));
|
assertThat(actualTask.getState(), equalTo(TaskState.COMPLETED));
|
||||||
assertThat(actualTask.getCreated(), not(equalTo(task.getModified())));
|
assertThat(actualTask.getCreated(), not(equalTo(task.getModified())));
|
||||||
|
|
@ -470,16 +478,16 @@ public class TaskServiceImplTest {
|
||||||
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||||
task.setState(TaskState.READY);
|
task.setState(TaskState.READY);
|
||||||
task.setClaimed(null);
|
task.setClaimed(null);
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cutSpy.completeTask(task.getId(), isForced);
|
cutSpy.completeTask(task.getId(), isForced);
|
||||||
} catch (InvalidStateException e) {
|
} catch (InvalidStateException e) {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(cutSpy, times(1)).getTaskById(task.getId());
|
verify(cutSpy, times(1)).getTask(task.getId());
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -493,16 +501,16 @@ public class TaskServiceImplTest {
|
||||||
task.setOwner("Dummy-Owner-ID: 10");
|
task.setOwner("Dummy-Owner-ID: 10");
|
||||||
task.setState(TaskState.CLAIMED);
|
task.setState(TaskState.CLAIMED);
|
||||||
task.setClaimed(new Timestamp(System.currentTimeMillis()));
|
task.setClaimed(new Timestamp(System.currentTimeMillis()));
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cutSpy.completeTask(task.getId(), isForced);
|
cutSpy.completeTask(task.getId(), isForced);
|
||||||
} catch (InvalidOwnerException e) {
|
} catch (InvalidOwnerException e) {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(cutSpy, times(1)).getTaskById(task.getId());
|
verify(cutSpy, times(1)).getTask(task.getId());
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -513,15 +521,15 @@ public class TaskServiceImplTest {
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
final boolean isForced = false;
|
final boolean isForced = false;
|
||||||
String taskId = "1";
|
String taskId = "1";
|
||||||
doThrow(TaskNotFoundException.class).when(cutSpy).getTaskById(taskId);
|
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(taskId);
|
||||||
try {
|
try {
|
||||||
cutSpy.completeTask(taskId, isForced);
|
cutSpy.completeTask(taskId, isForced);
|
||||||
} catch (InvalidOwnerException e) {
|
} catch (InvalidOwnerException e) {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(cutSpy, times(1)).getTaskById(taskId);
|
verify(cutSpy, times(1)).getTask(taskId);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -537,17 +545,17 @@ public class TaskServiceImplTest {
|
||||||
Thread.sleep(sleepTime);
|
Thread.sleep(sleepTime);
|
||||||
task.setState(TaskState.CLAIMED);
|
task.setState(TaskState.CLAIMED);
|
||||||
task.setClaimed(new Timestamp(System.currentTimeMillis()));
|
task.setClaimed(new Timestamp(System.currentTimeMillis()));
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
doNothing().when(taskMapperMock).update(task);
|
doNothing().when(taskMapperMock).update(task);
|
||||||
|
|
||||||
Task actualTask = cutSpy.completeTask(task.getId(), isForced);
|
Task actualTask = cutSpy.completeTask(task.getId(), isForced);
|
||||||
|
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(cutSpy, times(1)).getTaskById(task.getId());
|
verify(cutSpy, times(1)).getTask(task.getId());
|
||||||
verify(taskMapperMock, times(1)).update(task);
|
verify(taskMapperMock, times(1)).update(task);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
|
|
||||||
assertThat(actualTask.getState(), equalTo(TaskState.COMPLETED));
|
assertThat(actualTask.getState(), equalTo(TaskState.COMPLETED));
|
||||||
assertThat(actualTask.getCreated(), not(equalTo(task.getModified())));
|
assertThat(actualTask.getCreated(), not(equalTo(task.getModified())));
|
||||||
|
|
@ -564,7 +572,7 @@ public class TaskServiceImplTest {
|
||||||
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||||
task.setState(TaskState.READY);
|
task.setState(TaskState.READY);
|
||||||
task.setClaimed(null);
|
task.setClaimed(null);
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
TaskImpl claimedTask = createUnitTestTask("1", "Unit Test Task 1", "1");
|
TaskImpl claimedTask = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||||
// created and modify should be able to be different.
|
// created and modify should be able to be different.
|
||||||
Thread.sleep(sleepTime);
|
Thread.sleep(sleepTime);
|
||||||
|
|
@ -576,12 +584,12 @@ public class TaskServiceImplTest {
|
||||||
Task actualTask = cutSpy.completeTask(task.getId(), isForced);
|
Task actualTask = cutSpy.completeTask(task.getId(), isForced);
|
||||||
|
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(cutSpy, times(1)).getTaskById(task.getId());
|
verify(cutSpy, times(1)).getTask(task.getId());
|
||||||
verify(cutSpy, times(1)).claim(task.getId(), isForced);
|
verify(cutSpy, times(1)).claim(task.getId(), isForced);
|
||||||
verify(taskMapperMock, times(1)).update(claimedTask);
|
verify(taskMapperMock, times(1)).update(claimedTask);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
assertThat(actualTask.getState(), equalTo(TaskState.COMPLETED));
|
assertThat(actualTask.getState(), equalTo(TaskState.COMPLETED));
|
||||||
assertThat(actualTask.getCreated(), not(equalTo(claimedTask.getModified())));
|
assertThat(actualTask.getCreated(), not(equalTo(claimedTask.getModified())));
|
||||||
assertThat(actualTask.getCompleted(), not(equalTo(null)));
|
assertThat(actualTask.getCompleted(), not(equalTo(null)));
|
||||||
|
|
@ -599,7 +607,7 @@ public class TaskServiceImplTest {
|
||||||
doReturn(destinationWorkbasket).when(workbasketServiceMock).getWorkbasketByKey(destinationWorkbasket.getKey());
|
doReturn(destinationWorkbasket).when(workbasketServiceMock).getWorkbasketByKey(destinationWorkbasket.getKey());
|
||||||
doReturn(taskanaEngineConfigurationMock).when(taskanaEngineMock).getConfiguration();
|
doReturn(taskanaEngineConfigurationMock).when(taskanaEngineMock).getConfiguration();
|
||||||
doReturn(false).when(taskanaEngineConfigurationMock).isSecurityEnabled();
|
doReturn(false).when(taskanaEngineConfigurationMock).isSecurityEnabled();
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
doNothing().when(taskMapperMock).update(any());
|
doNothing().when(taskMapperMock).update(any());
|
||||||
doNothing().when(workbasketServiceMock).checkAuthorization(destinationWorkbasket.getKey(),
|
doNothing().when(workbasketServiceMock).checkAuthorization(destinationWorkbasket.getKey(),
|
||||||
WorkbasketAuthorization.APPEND);
|
WorkbasketAuthorization.APPEND);
|
||||||
|
|
@ -618,8 +626,8 @@ public class TaskServiceImplTest {
|
||||||
verify(workbasketServiceMock, times(1)).getWorkbasketByKey(destinationWorkbasket.getKey());
|
verify(workbasketServiceMock, times(1)).getWorkbasketByKey(destinationWorkbasket.getKey());
|
||||||
verify(taskMapperMock, times(1)).update(any());
|
verify(taskMapperMock, times(1)).update(any());
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
|
|
||||||
assertThat(actualTask.isRead(), equalTo(false));
|
assertThat(actualTask.isRead(), equalTo(false));
|
||||||
assertThat(actualTask.isTransferred(), equalTo(true));
|
assertThat(actualTask.isTransferred(), equalTo(true));
|
||||||
|
|
@ -636,7 +644,7 @@ public class TaskServiceImplTest {
|
||||||
task.setRead(true);
|
task.setRead(true);
|
||||||
doReturn(taskanaEngineConfigurationMock).when(taskanaEngineMock).getConfiguration();
|
doReturn(taskanaEngineConfigurationMock).when(taskanaEngineMock).getConfiguration();
|
||||||
doReturn(true).when(taskanaEngineConfigurationMock).isSecurityEnabled();
|
doReturn(true).when(taskanaEngineConfigurationMock).isSecurityEnabled();
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
doNothing().when(taskMapperMock).update(any());
|
doNothing().when(taskMapperMock).update(any());
|
||||||
doNothing().when(workbasketServiceMock).checkAuthorization(destinationWorkbasket.getKey(),
|
doNothing().when(workbasketServiceMock).checkAuthorization(destinationWorkbasket.getKey(),
|
||||||
WorkbasketAuthorization.APPEND);
|
WorkbasketAuthorization.APPEND);
|
||||||
|
|
@ -654,8 +662,8 @@ public class TaskServiceImplTest {
|
||||||
verify(taskanaEngineConfigurationMock, times(1)).isSecurityEnabled();
|
verify(taskanaEngineConfigurationMock, times(1)).isSecurityEnabled();
|
||||||
verify(taskMapperMock, times(1)).update(any());
|
verify(taskMapperMock, times(1)).update(any());
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
|
|
||||||
assertThat(actualTask.isRead(), equalTo(false));
|
assertThat(actualTask.isRead(), equalTo(false));
|
||||||
assertThat(actualTask.isTransferred(), equalTo(true));
|
assertThat(actualTask.isTransferred(), equalTo(true));
|
||||||
|
|
@ -671,7 +679,7 @@ public class TaskServiceImplTest {
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
doThrow(WorkbasketNotFoundException.class).when(workbasketServiceMock)
|
doThrow(WorkbasketNotFoundException.class).when(workbasketServiceMock)
|
||||||
.checkAuthorization(destinationWorkbasketKey, WorkbasketAuthorization.APPEND);
|
.checkAuthorization(destinationWorkbasketKey, WorkbasketAuthorization.APPEND);
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cutSpy.transfer(task.getId(), destinationWorkbasketKey);
|
cutSpy.transfer(task.getId(), destinationWorkbasketKey);
|
||||||
|
|
@ -680,8 +688,8 @@ public class TaskServiceImplTest {
|
||||||
verify(workbasketServiceMock, times(1)).checkAuthorization(destinationWorkbasketKey,
|
verify(workbasketServiceMock, times(1)).checkAuthorization(destinationWorkbasketKey,
|
||||||
WorkbasketAuthorization.APPEND);
|
WorkbasketAuthorization.APPEND);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -692,15 +700,15 @@ public class TaskServiceImplTest {
|
||||||
|
|
||||||
Task task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
Task task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
doThrow(TaskNotFoundException.class).when(cutSpy).getTaskById(task.getId());
|
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(task.getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cutSpy.transfer(task.getId(), "2");
|
cutSpy.transfer(task.getId(), "2");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -711,7 +719,7 @@ public class TaskServiceImplTest {
|
||||||
String destinationWorkbasketKey = "2";
|
String destinationWorkbasketKey = "2";
|
||||||
Task task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
Task task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
doThrow(NotAuthorizedException.class).when(workbasketServiceMock).checkAuthorization(destinationWorkbasketKey,
|
doThrow(NotAuthorizedException.class).when(workbasketServiceMock).checkAuthorization(destinationWorkbasketKey,
|
||||||
WorkbasketAuthorization.APPEND);
|
WorkbasketAuthorization.APPEND);
|
||||||
|
|
||||||
|
|
@ -722,8 +730,8 @@ public class TaskServiceImplTest {
|
||||||
verify(workbasketServiceMock, times(1)).checkAuthorization(destinationWorkbasketKey,
|
verify(workbasketServiceMock, times(1)).checkAuthorization(destinationWorkbasketKey,
|
||||||
WorkbasketAuthorization.APPEND);
|
WorkbasketAuthorization.APPEND);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -734,7 +742,7 @@ public class TaskServiceImplTest {
|
||||||
String destinationWorkbasketKey = "2";
|
String destinationWorkbasketKey = "2";
|
||||||
Task task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
Task task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
doNothing().when(workbasketServiceMock).checkAuthorization(destinationWorkbasketKey,
|
doNothing().when(workbasketServiceMock).checkAuthorization(destinationWorkbasketKey,
|
||||||
WorkbasketAuthorization.APPEND);
|
WorkbasketAuthorization.APPEND);
|
||||||
doThrow(NotAuthorizedException.class).when(workbasketServiceMock).checkAuthorization(task.getWorkbasketKey(),
|
doThrow(NotAuthorizedException.class).when(workbasketServiceMock).checkAuthorization(task.getWorkbasketKey(),
|
||||||
|
|
@ -749,8 +757,8 @@ public class TaskServiceImplTest {
|
||||||
verify(workbasketServiceMock, times(1)).checkAuthorization(task.getWorkbasketKey(),
|
verify(workbasketServiceMock, times(1)).checkAuthorization(task.getWorkbasketKey(),
|
||||||
WorkbasketAuthorization.TRANSFER);
|
WorkbasketAuthorization.TRANSFER);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -760,7 +768,7 @@ public class TaskServiceImplTest {
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||||
task.setModified(null);
|
task.setModified(null);
|
||||||
doReturn(task).when(cutSpy).getTaskById(task.getId());
|
doReturn(task).when(cutSpy).getTask(task.getId());
|
||||||
doNothing().when(taskMapperMock).update(task);
|
doNothing().when(taskMapperMock).update(task);
|
||||||
|
|
||||||
Task actualTask = cutSpy.setTaskRead("1", true);
|
Task actualTask = cutSpy.setTaskRead("1", true);
|
||||||
|
|
@ -768,8 +776,8 @@ public class TaskServiceImplTest {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(taskMapperMock, times(1)).update(task);
|
verify(taskMapperMock, times(1)).update(task);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
assertThat(actualTask.getModified(), not(equalTo(null)));
|
assertThat(actualTask.getModified(), not(equalTo(null)));
|
||||||
assertThat(actualTask.isRead(), equalTo(true));
|
assertThat(actualTask.isRead(), equalTo(true));
|
||||||
}
|
}
|
||||||
|
|
@ -779,14 +787,15 @@ public class TaskServiceImplTest {
|
||||||
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
TaskServiceImpl cutSpy = Mockito.spy(cut);
|
||||||
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1");
|
||||||
task.setModified(null);
|
task.setModified(null);
|
||||||
doThrow(TaskNotFoundException.class).when(cutSpy).getTaskById(task.getId());
|
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(task.getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cutSpy.setTaskRead("1", true);
|
cutSpy.setTaskRead("1", true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
|
taskanaEngineImpl,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
@ -796,14 +805,16 @@ public class TaskServiceImplTest {
|
||||||
public void testGetTaskByIdWithExistingTask() throws TaskNotFoundException, ClassificationAlreadyExistException {
|
public void testGetTaskByIdWithExistingTask() throws TaskNotFoundException, ClassificationAlreadyExistException {
|
||||||
Task expectedTask = createUnitTestTask("1", "DUMMY-TASK", "1");
|
Task expectedTask = createUnitTestTask("1", "DUMMY-TASK", "1");
|
||||||
doReturn(expectedTask).when(taskMapperMock).findById(expectedTask.getId());
|
doReturn(expectedTask).when(taskMapperMock).findById(expectedTask.getId());
|
||||||
|
doReturn(null).when(attachmentMapperMock).findAttachmentsByTaskId(expectedTask.getId());
|
||||||
|
|
||||||
Task actualTask = cut.getTaskById(expectedTask.getId());
|
Task actualTask = cut.getTask(expectedTask.getId());
|
||||||
|
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(taskMapperMock, times(1)).findById(expectedTask.getId());
|
verify(taskMapperMock, times(1)).findById(expectedTask.getId());
|
||||||
|
verify(attachmentMapperMock, times(1)).findAttachmentsByTaskId(expectedTask.getId());
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
assertThat(actualTask, equalTo(expectedTask));
|
assertThat(actualTask, equalTo(expectedTask));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -813,13 +824,13 @@ public class TaskServiceImplTest {
|
||||||
doThrow(TaskNotFoundException.class).when(taskMapperMock).findById(task.getId());
|
doThrow(TaskNotFoundException.class).when(taskMapperMock).findById(task.getId());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cut.getTaskById(task.getId());
|
cut.getTask(task.getId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(taskMapperMock, times(1)).findById(task.getId());
|
verify(taskMapperMock, times(1)).findById(task.getId());
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskanaEngineConfigurationMock, taskanaEngineMock, taskanaEngineImpl,
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -844,8 +855,8 @@ public class TaskServiceImplTest {
|
||||||
verify(taskMapperMock, times(1)).findTaskSummariesByWorkbasketKey(workbasketKey);
|
verify(taskMapperMock, times(1)).findTaskSummariesByWorkbasketKey(workbasketKey);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verify(workbasketServiceMock, times(1)).getWorkbasketByKey(any());
|
verify(workbasketServiceMock, times(1)).getWorkbasketByKey(any());
|
||||||
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
verifyNoMoreInteractions(taskMapperMock, taskanaEngineImpl, workbasketServiceMock);
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
assertThat(actualResultList, equalTo(expectedResultList));
|
assertThat(actualResultList, equalTo(expectedResultList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -865,7 +876,8 @@ public class TaskServiceImplTest {
|
||||||
verify(taskanaEngineImpl, times(1)).openConnection();
|
verify(taskanaEngineImpl, times(1)).openConnection();
|
||||||
verify(taskMapperMock, times(1)).findTaskSummariesByWorkbasketKey(workbasketKey);
|
verify(taskMapperMock, times(1)).findTaskSummariesByWorkbasketKey(workbasketKey);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verifyNoMoreInteractions(taskMapperMock, taskanaEngineImpl, workbasketServiceMock);
|
verifyNoMoreInteractions(attachmentMapperMock, taskanaEngineConfigurationMock, taskanaEngineMock,
|
||||||
|
taskanaEngineImpl, taskMapperMock, objectReferenceMapperMock, workbasketServiceMock);
|
||||||
assertThat(actualResultList, equalTo(expectedResultList));
|
assertThat(actualResultList, equalTo(expectedResultList));
|
||||||
assertThat(actualResultList.size(), equalTo(expectedResultList.size()));
|
assertThat(actualResultList.size(), equalTo(expectedResultList.size()));
|
||||||
}
|
}
|
||||||
|
|
@ -886,7 +898,7 @@ public class TaskServiceImplTest {
|
||||||
verify(taskMapperMock, times(1)).findTaskSummariesByWorkbasketKey(workbasketKey);
|
verify(taskMapperMock, times(1)).findTaskSummariesByWorkbasketKey(workbasketKey);
|
||||||
verify(taskanaEngineImpl, times(1)).returnConnection();
|
verify(taskanaEngineImpl, times(1)).returnConnection();
|
||||||
verify(workbasketServiceMock, times(1)).getWorkbasketByKey(any());
|
verify(workbasketServiceMock, times(1)).getWorkbasketByKey(any());
|
||||||
verifyNoMoreInteractions(taskMapperMock, taskanaEngineImpl, workbasketServiceMock);
|
verifyNoMoreInteractions(attachmentMapperMock, taskMapperMock, taskanaEngineImpl, workbasketServiceMock);
|
||||||
|
|
||||||
assertThat(actualResultList, equalTo(expectedResultList));
|
assertThat(actualResultList, equalTo(expectedResultList));
|
||||||
assertThat(actualResultList.size(), equalTo(expectedResultList.size()));
|
assertThat(actualResultList.size(), equalTo(expectedResultList.size()));
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
|
|
||||||
TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
|
TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
|
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
|
||||||
Task resultTask = taskServiceImpl2.getTaskById(task.getId());
|
Task resultTask = taskServiceImpl2.getTask(task.getId());
|
||||||
Assert.assertNotNull(resultTask);
|
Assert.assertNotNull(resultTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,11 +151,11 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
task.setClassification(classification);
|
task.setClassification(classification);
|
||||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||||
taskServiceImpl.createTask(task);
|
taskServiceImpl.createTask(task);
|
||||||
taskServiceImpl.getTaskById(task.getId());
|
taskServiceImpl.getTask(task.getId());
|
||||||
|
|
||||||
TaskanaEngineImpl te2 = (TaskanaEngineImpl) taskanaEngineConfiguration.buildTaskanaEngine();
|
TaskanaEngineImpl te2 = (TaskanaEngineImpl) taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
|
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
|
||||||
taskServiceImpl2.getTaskById(wb.getId());
|
taskServiceImpl2.getTask(wb.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -498,7 +498,7 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
|
|
||||||
task = taskServiceImpl.createTask(task);
|
task = taskServiceImpl.createTask(task);
|
||||||
|
|
||||||
Task task2 = taskServiceImpl.getTaskById(task.getId());
|
Task task2 = taskServiceImpl.getTask(task.getId());
|
||||||
// skanaEngineImpl.getSqlSession().commit(); // needed so that the change is visible in the other session
|
// skanaEngineImpl.getSqlSession().commit(); // needed so that the change is visible in the other session
|
||||||
|
|
||||||
Assert.assertNotNull(task2);
|
Assert.assertNotNull(task2);
|
||||||
|
|
|
||||||
|
|
@ -136,11 +136,11 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
|
||||||
task = taskServiceImpl.createTask(task);
|
task = taskServiceImpl.createTask(task);
|
||||||
connection.commit();
|
connection.commit();
|
||||||
taskServiceImpl.getTaskById(workbasket.getId());
|
taskServiceImpl.getTask(workbasket.getId());
|
||||||
|
|
||||||
TaskanaEngineImpl te2 = (TaskanaEngineImpl) taskanaEngineConfiguration.buildTaskanaEngine();
|
TaskanaEngineImpl te2 = (TaskanaEngineImpl) taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
|
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
|
||||||
taskServiceImpl2.getTaskById(workbasket.getId());
|
taskServiceImpl2.getTask(workbasket.getId());
|
||||||
connection.commit();
|
connection.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
|
|
||||||
TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
|
TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
|
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
|
||||||
Task resultTask = taskServiceImpl2.getTaskById(task.getId());
|
Task resultTask = taskServiceImpl2.getTask(task.getId());
|
||||||
Assert.assertNotNull(resultTask);
|
Assert.assertNotNull(resultTask);
|
||||||
connection.commit();
|
connection.commit();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class ExampleBootstrap {
|
||||||
System.out.println("---------------------------> Task started: " + task.getId());
|
System.out.println("---------------------------> Task started: " + task.getId());
|
||||||
taskService.claim(task.getId());
|
taskService.claim(task.getId());
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"---------------------------> Task claimed: " + taskService.getTaskById(task.getId()).getOwner());
|
"---------------------------> Task claimed: " + taskService.getTask(task.getId()).getOwner());
|
||||||
taskService.completeTask(task.getId(), true);
|
taskService.completeTask(task.getId(), true);
|
||||||
System.out.println("---------------------------> Task completed");
|
System.out.println("---------------------------> Task completed");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class TaskController {
|
||||||
@RequestMapping(value = "/{taskId}")
|
@RequestMapping(value = "/{taskId}")
|
||||||
public ResponseEntity<Task> getTask(@PathVariable(value = "taskId") String taskId) {
|
public ResponseEntity<Task> getTask(@PathVariable(value = "taskId") String taskId) {
|
||||||
try {
|
try {
|
||||||
Task task = taskService.getTaskById(taskId);
|
Task task = taskService.getTask(taskId);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(task);
|
return ResponseEntity.status(HttpStatus.OK).body(task);
|
||||||
} catch (TaskNotFoundException e) {
|
} catch (TaskNotFoundException e) {
|
||||||
logger.error("The searched Task couldn´t be found or does not exist.", e);
|
logger.error("The searched Task couldn´t be found or does not exist.", e);
|
||||||
|
|
@ -89,7 +89,7 @@ public class TaskController {
|
||||||
// TODO verify user
|
// TODO verify user
|
||||||
try {
|
try {
|
||||||
taskService.claim(taskId);
|
taskService.claim(taskId);
|
||||||
Task updatedTask = taskService.getTaskById(taskId);
|
Task updatedTask = taskService.getTask(taskId);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(updatedTask);
|
return ResponseEntity.status(HttpStatus.OK).body(updatedTask);
|
||||||
} catch (TaskNotFoundException e) {
|
} catch (TaskNotFoundException e) {
|
||||||
logger.error("The given Task coundn´t be found/claimd or does not Exist.", e);
|
logger.error("The given Task coundn´t be found/claimd or does not Exist.", e);
|
||||||
|
|
@ -107,7 +107,7 @@ public class TaskController {
|
||||||
public ResponseEntity<Task> completeTask(@PathVariable String taskId) {
|
public ResponseEntity<Task> completeTask(@PathVariable String taskId) {
|
||||||
try {
|
try {
|
||||||
taskService.completeTask(taskId, true);
|
taskService.completeTask(taskId, true);
|
||||||
Task updatedTask = taskService.getTaskById(taskId);
|
Task updatedTask = taskService.getTask(taskId);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(updatedTask);
|
return ResponseEntity.status(HttpStatus.OK).body(updatedTask);
|
||||||
} catch (TaskNotFoundException e) {
|
} catch (TaskNotFoundException e) {
|
||||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
|
return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue