From 5f642427143ef973db02fae36b03cd56b11a51ee Mon Sep 17 00:00:00 2001 From: Marcel Lengl <52546181+LenglBoy@users.noreply.github.com> Date: Thu, 21 Dec 2017 09:58:34 +0100 Subject: [PATCH] TSK-81: correced some ClassificationService Methods, Tests and need unique ID for task-join. +Structure fix for CreateClassification (root domain) --- .../pro/taskana/ClassificationService.java | 48 ++++-- .../ClassificationAlreadyExistException.java | 12 +- .../{model => impl}/ClassificationImpl.java | 26 +--- .../impl/ClassificationServiceImpl.java | 120 ++++++++++----- .../pro/taskana/impl/TaskServiceImpl.java | 8 +- .../model/mappings/ClassificationMapper.java | 32 +--- .../taskana/model/mappings/QueryMapper.java | 16 +- .../taskana/model/mappings/TaskMapper.java | 26 ++-- .../impl/ClassificationQueryImplTest.java | 1 - .../impl/ClassificationServiceImplTest.java | 142 ++++++++++++------ .../pro/taskana/impl/TaskServiceImplTest.java | 10 +- .../taskana/impl/TestClassificationQuery.java | 1 - ...ificationServiceImplIntAutoCommitTest.java | 118 ++++++++++++--- ...ssificationServiceImplIntExplicitTest.java | 103 +++++++++++-- .../TaskServiceImplIntAutocommitTest.java | 6 +- .../TaskServiceImplIntExplicitTest.java | 39 ++--- qa/eclipseFormatter/taskana_formatter.xml | 13 +- 17 files changed, 460 insertions(+), 261 deletions(-) rename lib/taskana-core/src/main/java/pro/taskana/{model => impl}/ClassificationImpl.java (99%) diff --git a/lib/taskana-core/src/main/java/pro/taskana/ClassificationService.java b/lib/taskana-core/src/main/java/pro/taskana/ClassificationService.java index b0e9561347..5931432879 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/ClassificationService.java +++ b/lib/taskana-core/src/main/java/pro/taskana/ClassificationService.java @@ -13,57 +13,73 @@ public interface ClassificationService { /** * Get all available Classifications as a tree. + * * @return The List of all Classifications - * @throws NotAuthorizedException TODO + * @throws NotAuthorizedException + * TODO */ List getClassificationTree() throws NotAuthorizedException; /** - * Get all Classifications with the given key. - * Returns also older and domain-specific versions of the classification. + * Get all Classifications with the given key. Returns also older and domain-specific versions of the + * classification. * - * @param key TODO - * @param domain TODO + * @param key + * TODO + * @param domain + * TODO * @return List with all versions of the Classification */ List getAllClassificationsWithKey(String key, String domain); /** - * Get the Classification for key and domain. If there's no specification for the given domain, it returns the root domain. - * @param key TODO - * @param domain TODO + * Get the Classification for key and domain. If there's no specification for the given domain, it returns the root + * domain. + * + * @param key + * TODO + * @param domain + * TODO * @return If exist: domain-specific classification, else root classification - * @throws ClassificationNotFoundException TODO + * @throws ClassificationNotFoundException + * TODO */ Classification getClassification(String key, String domain) throws ClassificationNotFoundException; /** - * Persist a new classification. If the classification does - * already exist in a domain, it will just be updated. + * Persists a new classification after adding default values.
+ * The classification will be added to root-domain, too - if not already existing. + * * @param classification * the classification to insert + * @return classification which is persisted with unique ID. * @throws ClassificationAlreadyExistException - * when the classification does already exists with same ID+domain. + * when the classification does already exists at the given domain. */ - void createClassification(Classification classification) throws ClassificationAlreadyExistException; + Classification createClassification(Classification classification) + throws ClassificationAlreadyExistException; /** * Update a Classification. + * * @param classification * the Classification to update - * @throws ClassificationNotFoundException when the classification does not exist already. + * @throws ClassificationNotFoundException + * when the classification does not exist already. */ void updateClassification(Classification classification) throws ClassificationNotFoundException; /** * This method provides a query builder for quering the database. + * * @return a {@link ClassificationQuery} */ ClassificationQuery createClassificationQuery(); /** - * Creating a new {@link Classification} with unchangeable default values. - * It will be only generated and is not persisted until CREATE-call. + * Creating a new {@link Classification} with unchangeable default values. It will be only generated and is not + * persisted until CREATE-call. + * * @return classification to specify */ Classification newClassification(); diff --git a/lib/taskana-core/src/main/java/pro/taskana/exceptions/ClassificationAlreadyExistException.java b/lib/taskana-core/src/main/java/pro/taskana/exceptions/ClassificationAlreadyExistException.java index b484eafde9..df1f3ee80e 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/exceptions/ClassificationAlreadyExistException.java +++ b/lib/taskana-core/src/main/java/pro/taskana/exceptions/ClassificationAlreadyExistException.java @@ -1,14 +1,16 @@ package pro.taskana.exceptions; +import pro.taskana.Classification; + /** - * Thrown, when a classification does already exits, - * but wanted to create with same ID+domain. + * Thrown, when a classification does already exits, but wanted to create with same ID+domain. */ -public class ClassificationAlreadyExistException extends NotFoundException { +public class ClassificationAlreadyExistException extends TaskanaException { private static final long serialVersionUID = 4716611657569005013L; - public ClassificationAlreadyExistException(String classificationId) { - super(classificationId); + public ClassificationAlreadyExistException(Classification classification) { + super("ID='" + classification.getId() + "', KEY=' " + classification.getKey() + "', DOMAIN='" + + classification.getDomain() + "';"); } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/model/ClassificationImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationImpl.java similarity index 99% rename from lib/taskana-core/src/main/java/pro/taskana/model/ClassificationImpl.java rename to lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationImpl.java index 6902f5e896..b1b4c75e99 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/model/ClassificationImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationImpl.java @@ -1,4 +1,4 @@ -package pro.taskana.model; +package pro.taskana.impl; import java.sql.Date; @@ -10,51 +10,31 @@ public class ClassificationImpl implements Classification { private String id; - private String key; - private String parentClassificationKey; - private String category; - private String type; - private String domain; - private Boolean isValidInDomain; - private Date created; - private String name; - private String description; - private int priority; - private String serviceLevel; // PddDThhHmmM - private String applicationEntryPoint; - private String custom1; - private String custom2; - private String custom3; - private String custom4; - private String custom5; - private String custom6; - private String custom7; - private String custom8; - private Date validFrom; - private Date validUntil; + ClassificationImpl() { } + @Override public String getId() { return id; diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationServiceImpl.java index 4dacca611d..a38c98bfeb 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/ClassificationServiceImpl.java @@ -5,7 +5,6 @@ import java.time.LocalDate; import java.util.ArrayList; import java.util.List; -import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,7 +18,6 @@ import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.impl.util.IdGenerator; import pro.taskana.impl.util.LoggerUtils; -import pro.taskana.model.ClassificationImpl; import pro.taskana.model.mappings.ClassificationMapper; /** @@ -27,14 +25,10 @@ */ public class ClassificationServiceImpl implements ClassificationService { - private static final String ID_PREFIX_CLASSIFICATION = "CLI"; - public static final Date CURRENT_CLASSIFICATIONS_VALID_UNTIL = Date.valueOf("9999-12-31"); - + private static final String ID_PREFIX_CLASSIFICATION = "CLI"; private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationServiceImpl.class); - private ClassificationMapper classificationMapper; - private TaskanaEngineImpl taskanaEngineImpl; public ClassificationServiceImpl(TaskanaEngine taskanaEngine, ClassificationMapper classificationMapper) { @@ -86,36 +80,61 @@ private List populateChildClassifications(List c } @Override - public void createClassification(Classification classification) throws ClassificationAlreadyExistException { + public Classification createClassification(Classification classification) + throws ClassificationAlreadyExistException { LOGGER.debug("entry to createClassification(classification = {})", classification); - Date date = Date.valueOf(LocalDate.now()); + ClassificationImpl classificationImpl; + final boolean isClassificationExisting; try { taskanaEngineImpl.openConnection(); - ClassificationImpl classificationImpl = (ClassificationImpl) classification; - classificationImpl.setCreated(date); - this.validateClassification(classificationImpl); - Classification oldClassification; + isClassificationExisting = doesClassificationExist(classification.getKey(), classification.getDomain()); + + if (isClassificationExisting) { + throw new ClassificationAlreadyExistException(classification); + } + classificationImpl = (ClassificationImpl) classification; + this.initDefaultClassificationValues(classificationImpl); + + classificationMapper.insert(classificationImpl); + LOGGER.debug("Method createClassification created classification {}.", classification); + + addClassificationToRootDomain(classificationImpl); + } finally { + taskanaEngineImpl.returnConnection(); + LOGGER.debug("exit from createClassification()"); + } + return classificationImpl; + } + + private void addClassificationToRootDomain(ClassificationImpl classificationImpl) { + if (classificationImpl.getDomain() != "") { + boolean doesExist = true; + String idBackup = classificationImpl.getId(); + String domainBackup = classificationImpl.getDomain(); + classificationImpl.setId(IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION)); + classificationImpl.setDomain(""); try { - oldClassification = this.getClassification(classificationImpl.getKey(), classificationImpl.getDomain()); + this.getClassification(classificationImpl.getKey(), classificationImpl.getDomain()); + throw new ClassificationAlreadyExistException(classificationImpl); } catch (ClassificationNotFoundException e) { - oldClassification = null; - } - if (oldClassification == null) { - classificationImpl.setCreated(classificationImpl.getValidFrom()); - classificationMapper.insert(classificationImpl); - LOGGER.debug("Method createClassification created classification {}.", classification); - if (classificationImpl.getDomain() != "") { - classificationImpl.setId(UUID.randomUUID().toString()); - classificationImpl.setDomain(""); + doesExist = false; + LOGGER.debug( + "Method createClassification: Classification does not exist in root domain. Classification {}.", + classificationImpl); + } catch (ClassificationAlreadyExistException ex) { + LOGGER.warn( + "Method createClassification: Classification does already exist in root domain. Classification {}.", + classificationImpl); + } finally { + if (!doesExist) { classificationMapper.insert(classificationImpl); - LOGGER.debug("Method createClassification created classification {}.", classification); + LOGGER.debug( + "Method createClassification: Classification created in root-domain, too. Classification {}.", + classificationImpl); } - } else { - throw new ClassificationAlreadyExistException(classificationImpl.getKey()); + classificationImpl.setId(idBackup); + classificationImpl.setDomain(domainBackup); } - } finally { - taskanaEngineImpl.returnConnection(); - LOGGER.debug("exit from addClassification()"); } } @@ -125,11 +144,12 @@ public void updateClassification(Classification classification) { try { taskanaEngineImpl.openConnection(); ClassificationImpl classificationImpl = (ClassificationImpl) classification; - this.validateClassification(classificationImpl); + this.initDefaultClassificationValues(classificationImpl); ClassificationImpl oldClassification = null; try { - oldClassification = (ClassificationImpl) this.getClassification(classificationImpl.getKey(), classificationImpl.getDomain()); + oldClassification = (ClassificationImpl) this.getClassification(classificationImpl.getKey(), + classificationImpl.getDomain()); LOGGER.debug("Method updateClassification() inserted classification {}.", classificationImpl); // ! If you update an classification twice the same day, // the older version is valid from today until yesterday. @@ -139,7 +159,7 @@ public void updateClassification(Classification classification) { updateExistingClassification(oldClassification, classificationImpl); } } catch (ClassificationNotFoundException e) { - classificationImpl.setId(IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION)); //TODO + classificationImpl.setId(IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION)); // TODO classificationImpl.setCreated(Date.valueOf(LocalDate.now())); classificationMapper.insert(classificationImpl); LOGGER.debug("Method updateClassification() inserted classification {}.", classificationImpl); @@ -152,14 +172,19 @@ public void updateClassification(Classification classification) { /** * Fill missing values and validate classification before saving the classification. + * * @param classification */ - private void validateClassification(ClassificationImpl classification) throws IllegalStateException { - classification.setId(UUID.randomUUID().toString()); + private void initDefaultClassificationValues(ClassificationImpl classification) throws IllegalStateException { + classification.setId(IdGenerator.generateWithPrefix(ID_PREFIX_CLASSIFICATION)); classification.setValidFrom(Date.valueOf(LocalDate.now())); classification.setValidUntil(CURRENT_CLASSIFICATIONS_VALID_UNTIL); + if (classification.getCreated() == null) { + classification.setCreated(Date.valueOf(LocalDate.now())); + } + if (classification.getIsValidInDomain() == null) { classification.setIsValidInDomain(true); } @@ -187,6 +212,7 @@ private void validateClassification(ClassificationImpl classification) throws Il /** * Add a new Classification if this Classification Key is not yet specified for this domain. + * * @param classification */ private void addClassificationToDomain(ClassificationImpl classification) { @@ -197,15 +223,17 @@ private void addClassificationToDomain(ClassificationImpl classification) { /** * Set the validUntil-Date of the oldClassification to yesterday and inserts the new Classification. + * * @param oldClassification * @param newClassification */ - private void updateExistingClassification(ClassificationImpl oldClassification, ClassificationImpl newClassification) { + private void updateExistingClassification(ClassificationImpl oldClassification, + ClassificationImpl newClassification) { oldClassification.setValidUntil(Date.valueOf(LocalDate.now().minusDays(1))); classificationMapper.update(oldClassification); classificationMapper.insert(newClassification); LOGGER.debug("Method updateClassification() updated old classification {} and inserted new {}.", - oldClassification, newClassification); + oldClassification, newClassification); } @Override @@ -216,7 +244,7 @@ public List getAllClassificationsWithKey(String key, String doma taskanaEngineImpl.openConnection(); List classifications = classificationMapper.getAllClassificationsWithKey(key, domain); List results = new ArrayList<>(); - classifications.stream().forEach(c -> results.add((Classification) c)); + classifications.stream().forEach(c -> results.add(c)); return results; } finally { taskanaEngineImpl.returnConnection(); @@ -238,14 +266,10 @@ public Classification getClassification(String key, String domain) throws Classi try { taskanaEngineImpl.openConnection(); result = classificationMapper.findByKeyAndDomain(key, domain, CURRENT_CLASSIFICATIONS_VALID_UNTIL); - if (result == null) { - result = classificationMapper.findByKeyAndDomain(key, "", CURRENT_CLASSIFICATIONS_VALID_UNTIL); - } if (result == null) { throw new ClassificationNotFoundException(key); } return result; - } finally { taskanaEngineImpl.returnConnection(); LOGGER.debug("exit from getClassification(). Returning result {} ", result); @@ -262,4 +286,18 @@ public Classification newClassification() { ClassificationImpl classification = new ClassificationImpl(); return classification; } + + private boolean doesClassificationExist(String key, String domain) { + boolean isExisting = false; + try { + if (classificationMapper.findByKeyAndDomain(key, domain, CURRENT_CLASSIFICATIONS_VALID_UNTIL) != null) { + isExisting = true; + } + } catch (Exception ex) { + LOGGER.warn( + "Classification-Service throwed Exception while calling mapper and searching for classification. EX={}", + ex); + } + return isExisting; + } } diff --git a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskServiceImpl.java b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskServiceImpl.java index 32d5c9adc3..a1559386c0 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/impl/TaskServiceImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/impl/TaskServiceImpl.java @@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory; import pro.taskana.Classification; +import pro.taskana.ClassificationService; import pro.taskana.Task; import pro.taskana.TaskQuery; import pro.taskana.TaskService; @@ -43,10 +44,10 @@ public class TaskServiceImpl implements TaskService { private static final String ID_PREFIX_OBJECT_REFERENCE = "ORI"; private static final String ID_PREFIX_TASK = "TKI"; private static final String ID_PREFIX_BUSINESS_PROCESS = "BPI"; - private TaskanaEngine taskanaEngine; private TaskanaEngineImpl taskanaEngineImpl; private WorkbasketService workbasketService; + private ClassificationService classificationService; private TaskMapper taskMapper; private ObjectReferenceMapper objectReferenceMapper; @@ -58,6 +59,7 @@ public TaskServiceImpl(TaskanaEngine taskanaEngine, TaskMapper taskMapper, this.taskMapper = taskMapper; this.objectReferenceMapper = objectReferenceMapper; this.workbasketService = taskanaEngineImpl.getWorkbasketService(); + this.classificationService = taskanaEngineImpl.getClassificationService(); } @Override @@ -165,8 +167,8 @@ public Task createTask(Task taskToCreate) if (classification == null) { throw new ClassificationNotFoundException(null); } - taskanaEngine.getClassificationService().getClassification(classification.getKey(), - workbasket.getDomain()); + this.classificationService.getClassification(classification.getKey(), + classification.getDomain()); standardSettings(task); this.taskMapper.insert(task); diff --git a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/ClassificationMapper.java b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/ClassificationMapper.java index 21f99cdc72..58d2206b58 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/ClassificationMapper.java +++ b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/ClassificationMapper.java @@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; -import pro.taskana.model.ClassificationImpl; +import pro.taskana.impl.ClassificationImpl; /** * This class is the mybatis mapping of classifications. @@ -19,36 +19,6 @@ public interface ClassificationMapper { String VALID_UNTIL = "9999-12-31"; - @Select("SELECT ID, KEY, PARENT_CLASSIFICATION_KEY, CATEGORY, TYPE, DOMAIN, VALID_IN_DOMAIN, CREATED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL, APPLICATION_ENTRY_POINT, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, VALID_FROM, VALID_UNTIL " - + "FROM CLASSIFICATION " - + "WHERE KEY = #{key}" - + "AND DOMAIN = ''" - + "AND VALID_UNTIL = VALID_UNTIL") - @Results({ @Result(property = "id", column = "ID"), - @Result(property = "key", column = "KEY"), - @Result(property = "parentClassificationKey", column = "PARENT_CLASSIFICATION_KEY"), - @Result(property = "category", column = "CATEGORY"), - @Result(property = "type", column = "TYPE"), - @Result(property = "domain", column = "DOMAIN"), - @Result(property = "isValidInDomain", column = "VALID_IN_DOMAIN"), - @Result(property = "created", column = "CREATED"), - @Result(property = "name", column = "NAME"), - @Result(property = "description", column = "DESCRIPTION"), - @Result(property = "priority", column = "PRIORITY"), - @Result(property = "serviceLevel", column = "SERVICE_LEVEL"), - @Result(property = "applicationEntryPoint", column = "APPLICATION_ENTRY_POINT"), - @Result(property = "custom1", column = "CUSTOM_1"), - @Result(property = "custom2", column = "CUSTOM_2"), - @Result(property = "custom3", column = "CUSTOM_3"), - @Result(property = "custom4", column = "CUSTOM_4"), - @Result(property = "custom5", column = "CUSTOM_5"), - @Result(property = "custom6", column = "CUSTOM_6"), - @Result(property = "custom7", column = "CUSTOM_7"), - @Result(property = "custom8", column = "CUSTOM_8"), - @Result(property = "validFrom", column = "VALID_FROM"), - @Result(property = "validUntil", column = "VALID_UNTIL") }) - ClassificationImpl findByKeyRootDomain(@Param("key") String key); - @Select("SELECT ID, KEY, PARENT_CLASSIFICATION_KEY, CATEGORY, TYPE, DOMAIN, VALID_IN_DOMAIN, CREATED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL, APPLICATION_ENTRY_POINT, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, VALID_FROM, VALID_UNTIL " + "FROM CLASSIFICATION " + "WHERE KEY = #{key}" diff --git a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java index 5cde82e8d9..c4bb542085 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java +++ b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/QueryMapper.java @@ -8,13 +8,13 @@ import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; +import pro.taskana.impl.ClassificationImpl; import pro.taskana.impl.ClassificationQueryImpl; import pro.taskana.impl.ObjectReferenceQueryImpl; import pro.taskana.impl.TaskImpl; import pro.taskana.impl.TaskQueryImpl; import pro.taskana.impl.WorkbasketImpl; import pro.taskana.impl.WorkbasketQueryImpl; -import pro.taskana.model.ClassificationImpl; import pro.taskana.model.ObjectReference; /** @@ -69,7 +69,7 @@ public interface QueryMapper { + "" + "" + "") - @Results(value = {@Result(property = "id", column = "ID"), + @Results(value = { @Result(property = "id", column = "ID"), @Result(property = "created", column = "CREATED"), @Result(property = "claimed", column = "CLAIMED"), @Result(property = "completed", column = "COMPLETED"), @@ -96,7 +96,7 @@ public interface QueryMapper { @Result(property = "custom7", column = "CUSTOM_7"), @Result(property = "custom8", column = "CUSTOM_8"), @Result(property = "custom9", column = "CUSTOM_9"), - @Result(property = "custom10", column = "CUSTOM_10")}) + @Result(property = "custom10", column = "CUSTOM_10") }) List queryTasks(TaskQueryImpl taskQuery); @Select("") - @Results({@Result(property = "id", column = "ID"), + @Results({ @Result(property = "id", column = "ID"), @Result(property = "parentClassificationId", column = "PARENT_CLASSIFICATION_ID"), @Result(property = "category", column = "CATEGORY"), @Result(property = "type", column = "TYPE"), @@ -139,7 +139,7 @@ public interface QueryMapper { @Result(property = "custom7", column = "CUSTOM_7"), @Result(property = "custom8", column = "CUSTOM_8"), @Result(property = "validFrom", column = "VALID_FROM"), - @Result(property = "validUntil", column = "VALID_UNTIL")}) + @Result(property = "validUntil", column = "VALID_UNTIL") }) List queryClassification(ClassificationQueryImpl classificationQuery); @Select("") @Results(value = { - @Result(property = "distributionTarget", column = "TARGET_ID")}) + @Result(property = "distributionTarget", column = "TARGET_ID") }) List findDistributionTargets(String sourceId); } diff --git a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/TaskMapper.java b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/TaskMapper.java index 0e9fcffe2e..9dad3888c9 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/model/mappings/TaskMapper.java +++ b/lib/taskana-core/src/main/java/pro/taskana/model/mappings/TaskMapper.java @@ -16,9 +16,9 @@ import org.apache.ibatis.type.JdbcType; import pro.taskana.Classification; +import pro.taskana.impl.ClassificationImpl; import pro.taskana.impl.TaskImpl; import pro.taskana.impl.persistence.MapTypeHandler; -import pro.taskana.model.ClassificationImpl; import pro.taskana.model.DueWorkbasketCounter; import pro.taskana.model.ObjectReference; import pro.taskana.model.TaskState; @@ -30,8 +30,8 @@ public interface TaskMapper { String OBJECTREFERENCEMAPPER_FINDBYID = "pro.taskana.model.mappings.ObjectReferenceMapper.findById"; - - String CLASSIFICATION_FINDBYKEYROOTDOMAIN = "pro.taskana.model.mappings.ClassificationMapper.findByKeyRootDomain"; + String CLASSIFICATION_FINDBYKEYANDDOMAIN = "pro.taskana.model.mappings.ClassificationMapper.findByKeyAndDomain"; + String CLASSIFICATION_FINDBYID = "pro.taskana.model.mappings.ClassificationMapper.findById"; @Select("SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, DESCRIPTION, PRIORITY, STATE, CLASSIFICATION_KEY, WORKBASKET_KEY, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, PRIMARY_OBJ_REF_ID, IS_READ, IS_TRANSFERRED, CUSTOM_ATTRIBUTES, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10 " + "FROM TASK " @@ -48,9 +48,9 @@ public interface TaskMapper { @Result(property = "description", column = "DESCRIPTION"), @Result(property = "priority", column = "PRIORITY"), @Result(property = "state", column = "STATE"), - @Result(property = "classification", column = "CLASSIFICATION_KEY", javaType = ClassificationImpl.class, - one = @One(select = CLASSIFICATION_FINDBYKEYROOTDOMAIN)), @Result(property = "workbasketKey", column = "WORKBASKET_KEY"), + @Result(property = "classification", column = "CLASSIFICATION_KEY", javaType = ClassificationImpl.class, + one = @One(select = CLASSIFICATION_FINDBYID)), @Result(property = "businessProcessId", column = "BUSINESS_PROCESS_ID"), @Result(property = "parentBusinessProcessId", column = "PARENT_BUSINESS_PROCESS_ID"), @Result(property = "owner", column = "OWNER"), @@ -69,13 +69,13 @@ public interface TaskMapper { @Result(property = "custom7", column = "CUSTOM_7"), @Result(property = "custom8", column = "CUSTOM_8"), @Result(property = "custom9", column = "CUSTOM_9"), - @Result(property = "custom10", column = "CUSTOM_10") - }) + @Result(property = "custom10", column = "CUSTOM_10") }) + TaskImpl findById(@Param("id") String id); - @Results({@Result(column = "DUE_DATE", property = "due"), + @Results({ @Result(column = "DUE_DATE", property = "due"), @Result(column = "WORKBASKET_KEY", property = "workbasketKey"), - @Result(column = "counter", property = "taskCounter")}) + @Result(column = "counter", property = "taskCounter") }) List getTaskCountByWorkbasketIdAndDaysInPastAndState(@Param("fromDate") Date fromDate, @Param("status") List states); @@ -107,9 +107,9 @@ List getTaskCountByWorkbasketIdAndDaysInPastAndState(@Para @Result(property = "description", column = "DESCRIPTION"), @Result(property = "priority", column = "PRIORITY"), @Result(property = "state", column = "STATE"), - @Result(property = "classification", column = "CLASSIFICATION_KEY", javaType = Classification.class, - one = @One(select = CLASSIFICATION_FINDBYKEYROOTDOMAIN)), @Result(property = "workbasketKey", column = "WORKBASKET_KEY"), + @Result(property = "classification", column = "CLASSIFICATION_KEY", javaType = Classification.class, + one = @One(select = CLASSIFICATION_FINDBYKEYANDDOMAIN)), @Result(property = "owner", column = "OWNER"), @Result(property = "primaryObjRef", column = "PRIMARY_OBJ_REF_ID", javaType = ObjectReference.class, one = @One(select = OBJECTREFERENCEMAPPER_FINDBYID)), @@ -126,8 +126,8 @@ List getTaskCountByWorkbasketIdAndDaysInPastAndState(@Para @Result(property = "custom7", column = "CUSTOM_7"), @Result(property = "custom8", column = "CUSTOM_8"), @Result(property = "custom9", column = "CUSTOM_9"), - @Result(property = "custom10", column = "CUSTOM_10") - }) + @Result(property = "custom10", column = "CUSTOM_10") }) + List findTasksByWorkbasketIdAndState(@Param("workbasketKey") String workbasketKey, @Param("taskState") TaskState taskState); diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationQueryImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationQueryImplTest.java index 0be9854dc6..6c127b023c 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationQueryImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationQueryImplTest.java @@ -16,7 +16,6 @@ import pro.taskana.Classification; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.model.ClassificationImpl; /** * Test for ClassificationQueryImpl. diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationServiceImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationServiceImplTest.java index dcaa5375c9..814c49e43a 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationServiceImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/ClassificationServiceImplTest.java @@ -1,6 +1,6 @@ package pro.taskana.impl; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; @@ -27,7 +27,6 @@ import pro.taskana.exceptions.ClassificationAlreadyExistException; import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.model.ClassificationImpl; import pro.taskana.model.mappings.ClassificationMapper; /** @@ -84,14 +83,16 @@ public void testGetClassificationTree() throws NotAuthorizedException { @Test(expected = ClassificationAlreadyExistException.class) public void testCreateClassificationAlreadyExisting() throws ClassificationAlreadyExistException, ClassificationNotFoundException { - Classification classification = createDummyCLassification(); - doReturn(classification).when(cutSpy).getClassification(classification.getKey(), classification.getDomain()); + Classification classification = createDummyClassification(); + doReturn(classification).when(classificationMapperMock).findByKeyAndDomain(classification.getKey(), + classification.getDomain(), ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); try { cutSpy.createClassification(classification); } catch (ClassificationAlreadyExistException e) { verify(taskanaEngineImplMock, times(1)).openConnection(); - verify(cutSpy, times(1)).getClassification(classification.getKey(), classification.getDomain()); + verify(classificationMapperMock, times(1)).findByKeyAndDomain(classification.getKey(), + classification.getDomain(), ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); verify(taskanaEngineImplMock, times(1)).returnConnection(); verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock); throw e; @@ -99,42 +100,78 @@ public void testCreateClassificationAlreadyExisting() } @Test - public void testCreateClassificationInOwnDomain() + public void testCreateClassificationInOwnDomainButExistingInRoot() throws ClassificationAlreadyExistException, ClassificationNotFoundException { - Classification classification = createDummyCLassification(); + Classification classification = createDummyClassification(); String domain = classification.getDomain(); - doReturn(null).when(cutSpy).getClassification(classification.getKey(), classification.getDomain()); + String key = classification.getKey(); + Date validUntil = ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL; + doReturn(null).when(classificationMapperMock).findByKeyAndDomain(classification.getKey(), + classification.getDomain(), ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); + doReturn(classification).when(classificationMapperMock).findByKeyAndDomain(classification.getKey(), + "", ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); cutSpy.createClassification(classification); - verify(taskanaEngineImplMock, times(1)).openConnection(); - verify(cutSpy, times(1)).getClassification(classification.getKey(), domain); + verify(taskanaEngineImplMock, times(2)).openConnection(); + verify(classificationMapperMock, times(1)).findByKeyAndDomain(key, domain, validUntil); + verify(classificationMapperMock, times(1)).findByKeyAndDomain(key, "", validUntil); + verify(classificationMapperMock, times(1)).insert(any()); + verify(taskanaEngineImplMock, times(2)).returnConnection(); + verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock); + assertThat(classification.getCreated(), equalTo(today)); + assertThat(classification.getDomain(), equalTo(domain)); + assertThat(classification.getKey(), equalTo(key)); + assertThat(classification.getValidFrom(), equalTo(today)); + assertThat(classification.getValidUntil(), + equalTo(ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL)); + } + + @Test + public void testCreateClassificationInOwnDomainAndInRoot() + throws ClassificationAlreadyExistException { + Classification classification = createDummyClassification(); + String domain = classification.getDomain(); + String key = classification.getKey(); + Date validUntil = ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL; + doReturn(null).when(classificationMapperMock).findByKeyAndDomain(classification.getKey(), + classification.getDomain(), ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); + doReturn(null).when(classificationMapperMock).findByKeyAndDomain(classification.getKey(), + "", ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); + + cutSpy.createClassification(classification); + + verify(taskanaEngineImplMock, times(2)).openConnection(); + verify(classificationMapperMock, times(1)).findByKeyAndDomain(key, domain, validUntil); + verify(classificationMapperMock, times(1)).findByKeyAndDomain(key, "", validUntil); verify(classificationMapperMock, times(2)).insert(any()); - verify(taskanaEngineImplMock, times(1)).returnConnection(); + verify(taskanaEngineImplMock, times(2)).returnConnection(); verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock); assertThat(classification.getCreated(), equalTo(today)); - assertThat(classification.getDomain(), equalTo("")); + assertThat(classification.getDomain(), equalTo(domain)); + assertThat(classification.getKey(), equalTo(key)); assertThat(classification.getValidFrom(), equalTo(today)); assertThat(classification.getValidUntil(), equalTo(ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL)); } @Test - public void testCreateClassificationAsRoot() - throws ClassificationAlreadyExistException, ClassificationNotFoundException { - Classification classification = createDummyCLassification(); + public void testCreateClassificationIntoRootDomain() + throws ClassificationAlreadyExistException { + Classification classification = createDummyClassification(); classification.setDomain(""); - doReturn(null).when(cutSpy).getClassification(classification.getKey(), classification.getDomain()); + doReturn(null).when(classificationMapperMock).findByKeyAndDomain(classification.getKey(), + classification.getDomain(), ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); cutSpy.createClassification(classification); verify(taskanaEngineImplMock, times(1)).openConnection(); - verify(cutSpy, times(1)).getClassification(classification.getKey(), classification.getDomain()); + verify(classificationMapperMock, times(1)).findByKeyAndDomain(classification.getKey(), + classification.getDomain(), ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); verify(classificationMapperMock, times(1)).insert((ClassificationImpl) classification); verify(taskanaEngineImplMock, times(1)).returnConnection(); verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock); assertThat(classification.getCreated(), equalTo(today)); - assertThat(classification.getDomain(), equalTo("")); assertThat(classification.getValidFrom(), equalTo(today)); assertThat(classification.getValidUntil(), equalTo(ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL)); @@ -142,8 +179,8 @@ public void testCreateClassificationAsRoot() @Test public void testUpdateClassificationAtNewDomain() throws ClassificationNotFoundException { - Classification classification = createDummyCLassification(); - Classification oldClassification = createDummyCLassification(); + Classification classification = createDummyClassification(); + Classification oldClassification = createDummyClassification(); oldClassification.setDomain(""); doReturn(oldClassification).when(cutSpy).getClassification(classification.getKey(), classification.getDomain()); @@ -162,13 +199,13 @@ public void testUpdateClassificationAtNewDomain() throws ClassificationNotFoundE @Test public void testUpdateClassificationAtSameDomain() throws ClassificationNotFoundException { - Classification classification = createDummyCLassification(); - ClassificationImpl oldClassification = (ClassificationImpl) createDummyCLassification(); + Classification classification = createDummyClassification(); + ClassificationImpl oldClassification = (ClassificationImpl) createDummyClassification(); oldClassification.setValidUntil(Date.valueOf(LocalDate.now())); Date yesterday = Date.valueOf(LocalDate.now().minusDays(1)); doReturn(oldClassification).when(cutSpy).getClassification(classification.getKey(), classification.getDomain()); - cutSpy.updateClassification((ClassificationImpl) classification); + cutSpy.updateClassification(classification); verify(taskanaEngineImplMock, times(1)).openConnection(); verify(cutSpy, times(1)).getClassification(classification.getKey(), classification.getDomain()); @@ -181,7 +218,7 @@ public void testUpdateClassificationAtSameDomain() throws ClassificationNotFound @Test public void testGetAllClassificationWithId() { - Classification dummyClassification = createDummyCLassification(); + Classification dummyClassification = createDummyClassification(); List classificationImpls = Arrays.asList(createDummyCLassificationImpl(), createDummyCLassificationImpl()); doReturn(classificationImpls).when(classificationMapperMock) @@ -199,8 +236,8 @@ public void testGetAllClassificationWithId() { } @Test - public void testGetClassificationFromChildDomain() throws ClassificationNotFoundException { - Classification expectedClassification = createDummyCLassification(); + public void testGetClassificationFromDomain() throws ClassificationNotFoundException { + Classification expectedClassification = createDummyClassification(); doReturn(expectedClassification).when(classificationMapperMock) .findByKeyAndDomain(expectedClassification.getKey(), expectedClassification.getDomain(), ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); @@ -216,29 +253,34 @@ public void testGetClassificationFromChildDomain() throws ClassificationNotFound assertThat(actualClassification, equalTo(expectedClassification)); } - @Test - public void testGetClassificationFromRootDomain() throws ClassificationNotFoundException { - Classification classification = createDummyCLassification(); - Classification expectedClassification = createDummyCLassification(); - expectedClassification.setDomain(""); - doReturn(null).when(classificationMapperMock) - .findByKeyAndDomain(classification.getKey(), classification.getDomain(), - ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); - doReturn(expectedClassification).when(classificationMapperMock) - .findByKeyAndDomain(expectedClassification.getKey(), expectedClassification.getDomain(), - ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); + @Test(expected = ClassificationNotFoundException.class) + public void testGetClassificationThrowingNotFoundException() throws ClassificationNotFoundException { + Classification classification = createDummyClassification(); + doReturn(null).when(classificationMapperMock).findByKeyAndDomain(classification.getKey(), + classification.getDomain(), + ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); - Classification actualClassification = cutSpy.getClassification(classification.getKey(), - classification.getDomain()); + try { + cutSpy.getClassification(classification.getKey(), classification.getDomain()); + } catch (ClassificationNotFoundException e) { + verify(taskanaEngineImplMock, times(1)).openConnection(); + verify(classificationMapperMock, times(1)).findByKeyAndDomain(classification.getKey(), + classification.getDomain(), + ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); + verify(taskanaEngineImplMock, times(1)).returnConnection(); + verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock); + throw e; + } + } - verify(taskanaEngineImplMock, times(1)).openConnection(); - verify(classificationMapperMock, times(1)).findByKeyAndDomain(classification.getKey(), classification.getDomain(), - ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); - verify(classificationMapperMock, times(1)).findByKeyAndDomain(expectedClassification.getKey(), "", - ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL); - verify(taskanaEngineImplMock, times(1)).returnConnection(); - verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock); - assertThat(actualClassification, equalTo(expectedClassification)); + @Test(expected = ClassificationNotFoundException.class) + public void testGetClassificationWithInvalidNullKey() throws ClassificationNotFoundException { + try { + cutSpy.getClassification(null, "domain"); + } catch (ClassificationNotFoundException e) { + verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock); + throw e; + } } @Test @@ -247,7 +289,7 @@ public void testCreateClassificationQuery() { verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock); } - private Classification createDummyCLassification() { + private Classification createDummyClassification() { ClassificationImpl classificationImpl = new ClassificationImpl(); classificationImpl.setDescription("A DUMMY FOR TESTING A SERVICE"); classificationImpl.setName("SERVICE-DUMMY"); @@ -256,10 +298,10 @@ private Classification createDummyCLassification() { classificationImpl.setId("ID: 1"); classificationImpl.setKey("ABC111"); classificationImpl.setParentClassificationKey(""); - return (Classification) classificationImpl; + return classificationImpl; } private ClassificationImpl createDummyCLassificationImpl() { - return (ClassificationImpl) createDummyCLassification(); + return (ClassificationImpl) createDummyClassification(); } } diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/TaskServiceImplTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/TaskServiceImplTest.java index 2ff78aea3f..d08ffb770d 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/TaskServiceImplTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/TaskServiceImplTest.java @@ -46,7 +46,6 @@ import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException; -import pro.taskana.model.ClassificationImpl; import pro.taskana.model.ObjectReference; import pro.taskana.model.TaskState; import pro.taskana.model.TaskSummary; @@ -125,8 +124,6 @@ public void testCreateSimpleTask() throws NotAuthorizedException, WorkbasketNotF verify(taskanaEngineImpl, times(1)).openConnection(); verify(workbasketServiceMock, times(1)).checkAuthorization(any(), any()); verify(workbasketServiceMock, times(1)).getWorkbasketByKey(any()); - verify(taskanaEngineMock, times(1)).getClassificationService(); - verify(classificationServiceMock, times(1)).getClassification(any(), any()); verify(taskMapperMock, times(1)).insert(expectedTask); verify(taskanaEngineImpl, times(1)).returnConnection(); @@ -171,9 +168,8 @@ public void testCreateSimpleTaskWithObjectReference() throws NotAuthorizedExcept verify(taskanaEngineImpl, times(1)).openConnection(); verify(workbasketServiceMock, times(1)).getWorkbasketByKey(wb.getKey()); verify(workbasketServiceMock, times(1)).checkAuthorization(wb.getKey(), WorkbasketAuthorization.APPEND); - verify(taskanaEngineMock, times(1)).getClassificationService(); verify(classificationServiceMock, times(1)).getClassification(classification.getKey(), - wb.getDomain()); + classification.getDomain()); verify(objectReferenceMapperMock, times(1)).findByObjectReference(expectedObjectReference); verify(taskMapperMock, times(1)).insert(expectedTask); verify(taskanaEngineImpl, times(1)).returnConnection(); @@ -221,9 +217,8 @@ public void testCreateSimpleTaskWithObjectReferenceIsNull() throws NotAuthorized verify(workbasketServiceMock, times(1)).getWorkbasketByKey(expectedTask.getWorkbasketKey()); verify(workbasketServiceMock, times(1)).checkAuthorization(expectedTask.getWorkbasketKey(), WorkbasketAuthorization.APPEND); - verify(taskanaEngineMock, times(1)).getClassificationService(); verify(classificationServiceMock, times(1)).getClassification(classification.getKey(), - wb.getDomain()); + classification.getDomain()); verify(objectReferenceMapperMock, times(1)).findByObjectReference(expectedObjectReference); verify(objectReferenceMapperMock, times(1)).insert(expectedObjectReference); verify(taskMapperMock, times(1)).insert(expectedTask); @@ -284,7 +279,6 @@ public void testCreateTaskWithPlanned() verify(taskanaEngineImpl, times(2)).openConnection(); verify(workbasketServiceMock, times(2)).checkAuthorization(any(), any()); verify(workbasketServiceMock, times(2)).getWorkbasketByKey(any()); - verify(taskanaEngineMock, times(2)).getClassificationService(); verify(classificationServiceMock, times(2)).getClassification(any(), any()); verify(objectReferenceMapperMock, times(2)).findByObjectReference(expectedObjectReference); verify(taskMapperMock, times(1)).insert(task); diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/TestClassificationQuery.java b/lib/taskana-core/src/test/java/pro/taskana/impl/TestClassificationQuery.java index 4726cf3418..1b847e8078 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/TestClassificationQuery.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/TestClassificationQuery.java @@ -7,7 +7,6 @@ import pro.taskana.Classification; import pro.taskana.ClassificationQuery; import pro.taskana.exceptions.NotAuthorizedException; -import pro.taskana.model.ClassificationImpl; /** * Created by BV on 26.10.2017. diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/integration/ClassificationServiceImplIntAutoCommitTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/integration/ClassificationServiceImplIntAutoCommitTest.java index 04e6060529..abe7541ec0 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/integration/ClassificationServiceImplIntAutoCommitTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/integration/ClassificationServiceImplIntAutoCommitTest.java @@ -1,5 +1,11 @@ package pro.taskana.impl.integration; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.core.IsNot.not; +import static org.hamcrest.core.StringStartsWith.startsWith; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + import java.io.FileNotFoundException; import java.sql.Date; import java.sql.SQLException; @@ -25,10 +31,10 @@ import pro.taskana.exceptions.ClassificationAlreadyExistException; import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.NotAuthorizedException; +import pro.taskana.impl.ClassificationImpl; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.model.ClassificationImpl; /** * Integration Test for ClassificationServiceImpl with connection management mode AUTOCOMMIT. @@ -40,14 +46,11 @@ public class ClassificationServiceImplIntAutoCommitTest { static int counter = 0; private DataSource dataSource; - private ClassificationService classificationService; - private TaskanaEngineConfiguration taskanaEngineConfiguration; - private TaskanaEngine taskanaEngine; - private TaskanaEngineImpl taskanaEngineImpl; + private static final String ID_PREFIX_CLASSIFICATION = "CLI"; @BeforeClass public static void resetDb() throws SQLException { @@ -69,15 +72,87 @@ public void setup() throws FileNotFoundException, SQLException, LoginException { } @Test - public void testInsertClassification() throws ClassificationAlreadyExistException, ClassificationNotFoundException { - Classification classification = this.createDummyClassificationWithUniqueKey(); - classificationService.createClassification(classification); - - Assert.assertNotNull(classificationService.getClassification(classification.getKey(), "")); + public void testInsertClassifications() throws Exception { + final String domain = "test-domain"; + final String key = "dummy-key"; + ClassificationImpl expectedClassification; + Classification actualClassification; + Classification actualClassification2; + + // empty classification (root) + expectedClassification = (ClassificationImpl) this.createDummyClassificationWithUniqueKey(); + expectedClassification = (ClassificationImpl) classificationService + .createClassification(expectedClassification); + actualClassification = classificationService.getClassification(expectedClassification.getKey(), + expectedClassification.getDomain()); + assertThat(actualClassification, not(equalTo(null))); + assertThat(actualClassification.getCreated(), not(equalTo(null))); + assertThat(actualClassification.getId(), not(equalTo(null))); + assertThat(actualClassification.getId(), startsWith(ID_PREFIX_CLASSIFICATION)); + + // specific to domain + root + expectedClassification = (ClassificationImpl) this.createDummyClassificationWithUniqueKey(); + expectedClassification.setDomain(domain); + expectedClassification.setKey(key); + expectedClassification = (ClassificationImpl) classificationService + .createClassification(expectedClassification); + actualClassification = classificationService.getClassification(expectedClassification.getKey(), + expectedClassification.getDomain()); + actualClassification2 = classificationService.getClassification(expectedClassification.getKey(), ""); + assertThat(actualClassification, not(equalTo(null))); + assertThat(actualClassification.getCreated(), not(equalTo(null))); + assertThat(actualClassification.getId(), not(equalTo(null))); + assertThat(actualClassification.getKey(), equalTo(key)); + assertThat(actualClassification.getDomain(), equalTo(domain)); + assertThat(actualClassification.getId(), startsWith(ID_PREFIX_CLASSIFICATION)); + assertThat(actualClassification2, not(equalTo(null))); + assertThat(actualClassification2.getCreated(), not(equalTo(null))); + assertThat(actualClassification2.getId(), not(equalTo(null))); + assertThat(actualClassification2.getId(), not(equalTo(actualClassification.getId()))); + assertThat(actualClassification2.getKey(), equalTo(key)); + assertThat(actualClassification2.getDomain(), equalTo("")); + assertThat(actualClassification2.getId(), startsWith(ID_PREFIX_CLASSIFICATION)); + + // does exist already + try { + expectedClassification = (ClassificationImpl) this.createDummyClassificationWithUniqueKey(); + expectedClassification.setKey(key); + expectedClassification.setDomain(domain); + classificationService.createClassification(expectedClassification); + fail("Should have thrown 'ClassificationAlreadyExistException' here."); + } catch (ClassificationAlreadyExistException e) { + } + + // new classification but root existing + expectedClassification = (ClassificationImpl) this.createDummyClassificationWithUniqueKey(); + expectedClassification.setKey(key); + expectedClassification.setDomain(domain + "_2"); + classificationService.createClassification(expectedClassification); + actualClassification = classificationService.getClassification(key, domain + "_2"); + assertThat(actualClassification, not(equalTo(null))); + assertThat(actualClassification.getCreated(), not(equalTo(null))); + assertThat(actualClassification.getId(), not(equalTo(null))); + assertThat(actualClassification.getKey(), equalTo(key)); + assertThat(actualClassification.getDomain(), equalTo(domain + "_2")); + assertThat(actualClassification.getId(), startsWith(ID_PREFIX_CLASSIFICATION)); + List rootResults = classificationService.getAllClassificationsWithKey(key, ""); + assertThat(rootResults.size(), equalTo(1)); + + // invalid serviceLevel + try { + expectedClassification = (ClassificationImpl) this.createDummyClassificationWithUniqueKey(); + expectedClassification.setDomain(domain + "_3"); + expectedClassification.setKey(""); + expectedClassification.setServiceLevel("ASAP"); + classificationService.createClassification(expectedClassification); + fail("Should have thrown IllegalArgumentException, because ServiceLevel is invalid."); + } catch (IllegalArgumentException e) { + } } @Test - public void testFindAllClassifications() throws NotAuthorizedException, ClassificationAlreadyExistException { + public void testFindAllClassifications() + throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException { Classification classification0 = this.createDummyClassificationWithUniqueKey(); classificationService.createClassification(classification0); Classification classification1 = this.createDummyClassificationWithUniqueKey(); @@ -102,9 +177,10 @@ public void testModifiedClassification() } @Test - public void testInsertAndClassificationMapper() throws NotAuthorizedException, ClassificationAlreadyExistException { + public void testInsertAndClassificationMapper() + throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException { Classification classification = this.createDummyClassificationWithUniqueKey(); - classificationService.createClassification(classification); + Classification actualClassification = classificationService.createClassification(classification); Date today = Date.valueOf(LocalDate.now()); List list = classificationService.createClassificationQuery() .validInDomain(Boolean.TRUE) @@ -113,6 +189,7 @@ public void testInsertAndClassificationMapper() throws NotAuthorizedException, C .validUntil(Date.valueOf("9999-12-31")) .list(); Assert.assertEquals(1, list.size()); + assertThat(actualClassification, equalTo(classification)); } @Test @@ -147,7 +224,7 @@ public void testUpdateAndClassificationMapper() @Test public void testFindWithClassificationMapperDomainAndCategory() - throws NotAuthorizedException, ClassificationAlreadyExistException { + throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException { Classification classification1 = this.createDummyClassificationWithUniqueKey(); classification1.setDomain("domain1"); classification1.setCategory("category1"); @@ -172,7 +249,7 @@ public void testFindWithClassificationMapperDomainAndCategory() @Test public void testFindWithClassificationMapperCustomAndCategory() - throws NotAuthorizedException, ClassificationAlreadyExistException { + throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException { Classification classification1 = this.createDummyClassificationWithUniqueKey(); classification1.setDescription("DESC1"); classification1.setCategory("category1"); @@ -206,7 +283,7 @@ public void testFindWithClassificationMapperCustomAndCategory() @Test public void testFindWithClassificationMapperPriorityTypeAndParent() - throws NotAuthorizedException, ClassificationAlreadyExistException { + throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException { Classification classification = this.createDummyClassificationWithUniqueKey(); classification.setPriority(Integer.decode("5")); classification.setType("type1"); @@ -243,7 +320,7 @@ public void testFindWithClassificationMapperPriorityTypeAndParent() @Test public void testFindWithClassificationMapperServiceLevelNameAndDescription() - throws NotAuthorizedException, ClassificationAlreadyExistException { + throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException { int all = 0; Classification classification = this.createDummyClassificationWithUniqueKey(); classification.setServiceLevel("P1D"); @@ -289,7 +366,9 @@ public void testDefaultSettingsWithClassificationMapper() classification1.setParentClassificationKey(classification.getKey()); classificationService.updateClassification(classification1); - List list = classificationService.createClassificationQuery().parentClassificationKey("").list(); + List list = classificationService.createClassificationQuery() + .parentClassificationKey("") + .list(); Assert.assertEquals(2, list.size()); list = classificationService.createClassificationQuery().validUntil(Date.valueOf("9999-12-31")).list(); Assert.assertEquals(2, list.size()); @@ -317,10 +396,9 @@ public static void cleanUpClass() { } private Classification createDummyClassificationWithUniqueKey() { - Classification classification = new ClassificationImpl(); + Classification classification = classificationService.newClassification(); classification.setKey("TEST" + counter); counter++; return classification; } - } diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/integration/ClassificationServiceImplIntExplicitTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/integration/ClassificationServiceImplIntExplicitTest.java index fdbb5ec9b2..ad6bca8f81 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/integration/ClassificationServiceImplIntExplicitTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/integration/ClassificationServiceImplIntExplicitTest.java @@ -1,5 +1,11 @@ package pro.taskana.impl.integration; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.core.IsNot.not; +import static org.hamcrest.core.StringStartsWith.startsWith; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + import java.io.FileNotFoundException; import java.sql.Connection; import java.sql.Date; @@ -26,10 +32,10 @@ import pro.taskana.exceptions.ClassificationAlreadyExistException; import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.NotAuthorizedException; +import pro.taskana.impl.ClassificationImpl; import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; -import pro.taskana.model.ClassificationImpl; /** * Integration Test for ClassificationServiceImpl with connection management mode EXPLICIT. @@ -40,16 +46,12 @@ public class ClassificationServiceImplIntExplicitTest { static int counter = 0; - private DataSource dataSource; - private ClassificationService classificationService; - private TaskanaEngineConfiguration taskanaEngineConfiguration; - private TaskanaEngine taskanaEngine; - private TaskanaEngineImpl taskanaEngineImpl; + private static final String ID_PREFIX_CLASSIFICATION = "CLI"; @BeforeClass public static void resetDb() throws SQLException { @@ -76,16 +78,85 @@ public void testInsertClassification() Connection connection = dataSource.getConnection(); taskanaEngineImpl.setConnection(connection); - Classification classification = this.createNewClassificationWithUniqueKey(); - classificationService.createClassification(classification); + final String domain = "test-domain"; + final String key = "dummy-key"; + ClassificationImpl expectedClassification; + Classification actualClassification; + Classification actualClassification2; - Assert.assertNotNull(classificationService.getClassification(classification.getKey(), "")); + // empty classification (root) + expectedClassification = (ClassificationImpl) this.createNewClassificationWithUniqueKey(); + expectedClassification = (ClassificationImpl) classificationService.createClassification(expectedClassification); + connection.commit(); + actualClassification = classificationService.getClassification(expectedClassification.getKey(), expectedClassification.getDomain()); + assertThat(actualClassification, not(equalTo(null))); + assertThat(actualClassification.getCreated(), not(equalTo(null))); + assertThat(actualClassification.getId(), not(equalTo(null))); + assertThat(actualClassification.getId(), startsWith(ID_PREFIX_CLASSIFICATION)); + + // specific to domain + root + expectedClassification = (ClassificationImpl) this.createNewClassificationWithUniqueKey(); + expectedClassification.setDomain(domain); + expectedClassification.setKey(key); + expectedClassification = (ClassificationImpl) classificationService.createClassification(expectedClassification); + connection.commit(); + actualClassification = classificationService.getClassification(expectedClassification.getKey(), expectedClassification.getDomain()); + actualClassification2 = classificationService.getClassification(expectedClassification.getKey(), ""); + assertThat(actualClassification, not(equalTo(null))); + assertThat(actualClassification.getCreated(), not(equalTo(null))); + assertThat(actualClassification.getId(), not(equalTo(null))); + assertThat(actualClassification.getKey(), equalTo(key)); + assertThat(actualClassification.getDomain(), equalTo(domain)); + assertThat(actualClassification.getId(), startsWith(ID_PREFIX_CLASSIFICATION)); + assertThat(actualClassification2, not(equalTo(null))); + assertThat(actualClassification2.getCreated(), not(equalTo(null))); + assertThat(actualClassification2.getId(), not(equalTo(null))); + assertThat(actualClassification2.getId(), not(equalTo(actualClassification.getId()))); + assertThat(actualClassification2.getKey(), equalTo(key)); + assertThat(actualClassification2.getDomain(), equalTo("")); + assertThat(actualClassification2.getId(), startsWith(ID_PREFIX_CLASSIFICATION)); + + // does exist already + try { + expectedClassification = (ClassificationImpl) this.createNewClassificationWithUniqueKey(); + expectedClassification.setKey(key); + expectedClassification.setDomain(domain); + classificationService.createClassification(expectedClassification); + connection.commit(); + fail("Should have thrown 'ClassificationAlreadyExistException' here."); + } catch (ClassificationAlreadyExistException e) { } + + // new classification but root existing + expectedClassification = (ClassificationImpl) this.createNewClassificationWithUniqueKey(); + expectedClassification.setKey(key); + expectedClassification.setDomain(domain + "_2"); + classificationService.createClassification(expectedClassification); connection.commit(); + actualClassification = classificationService.getClassification(key, domain + "_2"); + assertThat(actualClassification, not(equalTo(null))); + assertThat(actualClassification.getCreated(), not(equalTo(null))); + assertThat(actualClassification.getId(), not(equalTo(null))); + assertThat(actualClassification.getKey(), equalTo(key)); + assertThat(actualClassification.getDomain(), equalTo(domain + "_2")); + assertThat(actualClassification.getId(), startsWith(ID_PREFIX_CLASSIFICATION)); + List rootResults = classificationService.getAllClassificationsWithKey(key, ""); + assertThat(rootResults.size(), equalTo(1)); + + // invalid serviceLevel + try { + expectedClassification = (ClassificationImpl) this.createNewClassificationWithUniqueKey(); + expectedClassification.setDomain(domain + "_3"); + expectedClassification.setKey(""); + expectedClassification.setServiceLevel("ASAP"); + classificationService.createClassification(expectedClassification); + connection.commit(); + fail("Should have thrown IllegalArgumentException, because ServiceLevel is invalid."); + } catch (IllegalArgumentException e) { } } @Test public void testFindAllClassifications() - throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException { + throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException, ClassificationNotFoundException { Connection connection = dataSource.getConnection(); taskanaEngineImpl.setConnection(connection); Classification classification0 = this.createNewClassificationWithUniqueKey(); @@ -117,7 +188,7 @@ public void testModifiedClassification() @Test public void testInsertAndClassificationMapper() - throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException { + throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException, ClassificationNotFoundException { Connection connection = dataSource.getConnection(); taskanaEngineImpl.setConnection(connection); Classification classification = this.createNewClassificationWithUniqueKey(); @@ -165,7 +236,7 @@ public void testUpdateAndClassificationMapper() throws NotAuthorizedException, S @Test public void testFindWithClassificationMapperDomainAndCategory() - throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException { + throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException, ClassificationNotFoundException { Connection connection = dataSource.getConnection(); taskanaEngineImpl.setConnection(connection); Classification classification1 = this.createNewClassificationWithUniqueKey(); @@ -193,7 +264,7 @@ public void testFindWithClassificationMapperDomainAndCategory() @Test public void testFindWithClassificationMapperCustomAndCategory() - throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException { + throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException, ClassificationNotFoundException { Connection connection = dataSource.getConnection(); taskanaEngineImpl.setConnection(connection); Classification classification1 = this.createNewClassificationWithUniqueKey(); @@ -230,7 +301,7 @@ public void testFindWithClassificationMapperCustomAndCategory() @Test public void testFindWithClassificationMapperPriorityTypeAndParent() - throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException { + throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException, ClassificationNotFoundException { Connection connection = dataSource.getConnection(); taskanaEngineImpl.setConnection(connection); Classification classification = this.createNewClassificationWithUniqueKey(); @@ -270,7 +341,7 @@ public void testFindWithClassificationMapperPriorityTypeAndParent() @Test public void testFindWithClassificationMapperServiceLevelNameAndDescription() - throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException { + throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException, ClassificationNotFoundException { Connection connection = dataSource.getConnection(); taskanaEngineImpl.setConnection(connection); int all = 0; @@ -356,7 +427,7 @@ public static void cleanUpClass() { } private Classification createNewClassificationWithUniqueKey() { - Classification classification = new ClassificationImpl(); + Classification classification = classificationService.newClassification(); classification.setKey("TEST" + counter); counter++; return classification; diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/integration/TaskServiceImplIntAutocommitTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/integration/TaskServiceImplIntAutocommitTest.java index 0866082e93..ddfb1939bc 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/integration/TaskServiceImplIntAutocommitTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/integration/TaskServiceImplIntAutocommitTest.java @@ -39,6 +39,7 @@ import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException; +import pro.taskana.impl.ClassificationImpl; import pro.taskana.impl.ClassificationQueryImpl; import pro.taskana.impl.ObjectReferenceQueryImpl; import pro.taskana.impl.TaskImpl; @@ -48,7 +49,6 @@ import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.util.IdGenerator; -import pro.taskana.model.ClassificationImpl; import pro.taskana.model.TaskState; import pro.taskana.model.TaskSummary; import pro.taskana.model.WorkbasketAccessItem; @@ -137,7 +137,9 @@ public void testStartTransactionFail() taskanaEngine.getWorkbasketService().createWorkbasket(wb); Classification classification = classificationService.newClassification(); classification.setKey("TEST"); - taskanaEngine.getClassificationService().createClassification(classification); + classification = taskanaEngine.getClassificationService().createClassification(classification); + classification = taskanaEngine.getClassificationService().getClassification(classification.getKey(), + classification.getDomain()); TaskImpl task = (TaskImpl) taskServiceImpl.newTask(); task.setName("Unit Test Task"); diff --git a/lib/taskana-core/src/test/java/pro/taskana/impl/integration/TaskServiceImplIntExplicitTest.java b/lib/taskana-core/src/test/java/pro/taskana/impl/integration/TaskServiceImplIntExplicitTest.java index b9ed8da5dd..ad5295db00 100644 --- a/lib/taskana-core/src/test/java/pro/taskana/impl/integration/TaskServiceImplIntExplicitTest.java +++ b/lib/taskana-core/src/test/java/pro/taskana/impl/integration/TaskServiceImplIntExplicitTest.java @@ -42,6 +42,7 @@ import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException; +import pro.taskana.impl.ClassificationImpl; import pro.taskana.impl.ClassificationQueryImpl; import pro.taskana.impl.ClassificationServiceImpl; import pro.taskana.impl.ObjectReferenceQueryImpl; @@ -53,7 +54,6 @@ import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.util.IdGenerator; -import pro.taskana.model.ClassificationImpl; import pro.taskana.model.ObjectReference; import pro.taskana.model.TaskState; import pro.taskana.model.WorkbasketAccessItem; @@ -124,8 +124,8 @@ public void testStartTransactionFail() workbasket.setDomain("novatec"); Classification classification = classificationService.newClassification(); classification.setKey("TEST"); - taskanaEngine.getWorkbasketService().createWorkbasket(workbasket); - taskanaEngine.getClassificationService().createClassification(classification); + taskanaEngineImpl.getWorkbasketService().createWorkbasket(workbasket); + taskanaEngineImpl.getClassificationService().createClassification(classification); connection.commit(); Task task = taskServiceImpl.newTask(); task.setName("Unit Test Task"); @@ -308,21 +308,26 @@ public void createManualTaskShouldThrowClassificationNotFoundException() generateSampleAccessItems(); - Task test = this.generateDummyTask(); - test.setClassification(new ClassificationImpl()); - - WorkbasketAccessItem accessItem = new WorkbasketAccessItem(); - accessItem.setId(IdGenerator.generateWithPrefix("WAI")); - accessItem.setWorkbasketKey("wb"); - accessItem.setAccessId("Elena"); - accessItem.setPermAppend(true); - accessItem.setPermOpen(true); - workbasketService.createWorkbasketAuthorization(accessItem); + Workbasket wb = workbasketService.newWorkbasket(); + wb.setName("dummy-WB"); + wb.setKey("WB NR.1"); + wb.setDomain("nova"); + wb.setType(WorkbasketType.PERSONAL); + wb = workbasketService.createWorkbasket(wb); + this.createWorkbasketWithSecurity(wb, CurrentUserContext.getUserid(), true, true, + true, false); + Classification classification = classificationService.newClassification(); // not persisted, not found. + classification.setDomain(wb.getDomain()); + classification.setName("not persisted - so not found."); + classification.setKey(UUID.randomUUID().toString()); - taskServiceImpl.createTask(test); + Task task = this.generateDummyTask(); + task.setWorkbasketKey(wb.getKey()); + task.setClassification(classification); + taskServiceImpl.createTask(task); } - @WithAccessId(userName = "Elena", groupNames = {"DummyGroup"}) + @WithAccessId(userName = "Elena", groupNames = { "DummyGroup" }) @Test public void should_ReturnList_when_BuilderIsUsed() throws SQLException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, @@ -556,8 +561,8 @@ public void shouldNotTransferByFailingSecurity() throws WorkbasketNotFoundExcept } } - private Task generateDummyTask() - throws ClassificationAlreadyExistException, InvalidWorkbasketException, WorkbasketNotFoundException { + private Task generateDummyTask() throws ClassificationAlreadyExistException, ClassificationNotFoundException, + WorkbasketNotFoundException, InvalidWorkbasketException { WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket(); workbasket.setKey("wb"); workbasket.setName("wb"); diff --git a/qa/eclipseFormatter/taskana_formatter.xml b/qa/eclipseFormatter/taskana_formatter.xml index b837afc737..e0850eb86e 100644 --- a/qa/eclipseFormatter/taskana_formatter.xml +++ b/qa/eclipseFormatter/taskana_formatter.xml @@ -7,7 +7,7 @@ - + @@ -139,6 +139,7 @@ + @@ -177,7 +178,7 @@ - + @@ -189,7 +190,7 @@ - + @@ -199,7 +200,7 @@ - + @@ -269,7 +270,7 @@ - + @@ -311,4 +312,4 @@ - \ No newline at end of file +