TSK-1337: removed some code smells
This commit is contained in:
parent
f79f7587a9
commit
41973183bc
|
|
@ -1,5 +1,5 @@
|
||||||
taskana.roles.user=group1 | group2|teamlead_1 | teamlead_2 |user_1_1| user_1_1| user_1_2| user_2_1| user_2_2| max|elena|simone
|
taskana.roles.user=group1 | group2|teamlead_1 | teamlead_2 |user_1_1| user_1_1| user_1_2| user_2_1| user_2_2| max|elena|simone
|
||||||
taskana.roles.Admin=name=konrad,Organisation=novatec|admin
|
taskana.roles.admin=name=konrad,Organisation=novatec|admin
|
||||||
taskana.roles.businessadmin=max|Moritz|businessadmin
|
taskana.roles.businessadmin=max|Moritz|businessadmin
|
||||||
taskana.roles.monitor=john|teamlead_2 | monitor
|
taskana.roles.monitor=john|teamlead_2 | monitor
|
||||||
taskana.roles.taskadmin=peter | taskadmin
|
taskana.roles.taskadmin=peter | taskadmin
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,5 @@ package pro.taskana;
|
||||||
import javax.ws.rs.ApplicationPath;
|
import javax.ws.rs.ApplicationPath;
|
||||||
import javax.ws.rs.core.Application;
|
import javax.ws.rs.core.Application;
|
||||||
|
|
||||||
/** TODO Why does this test exist?. */
|
|
||||||
@ApplicationPath("/rest")
|
@ApplicationPath("/rest")
|
||||||
public class RestApplication extends Application {}
|
public class RestApplication extends Application {}
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,10 @@ import pro.taskana.task.api.models.Task;
|
||||||
import pro.taskana.workbasket.api.WorkbasketType;
|
import pro.taskana.workbasket.api.WorkbasketType;
|
||||||
import pro.taskana.workbasket.api.models.Workbasket;
|
import pro.taskana.workbasket.api.models.Workbasket;
|
||||||
|
|
||||||
/** TODO. */
|
|
||||||
@Path("/test")
|
@Path("/test")
|
||||||
public class TaskanaRestTest {
|
public class TaskanaCdiTestRestController {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaRestTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaCdiTestRestController.class);
|
||||||
|
|
||||||
@EJB private TaskanaEjb taskanaEjb;
|
@EJB private TaskanaEjb taskanaEjb;
|
||||||
|
|
||||||
|
|
@ -14,7 +14,6 @@ import pro.taskana.task.api.models.Task;
|
||||||
import pro.taskana.workbasket.api.WorkbasketService;
|
import pro.taskana.workbasket.api.WorkbasketService;
|
||||||
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
|
||||||
|
|
||||||
/** TODO. */
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class TaskanaEjb {
|
public class TaskanaEjb {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.wildfly.swarm.undertow.WARArchive;
|
import org.wildfly.swarm.undertow.WARArchive;
|
||||||
|
|
||||||
/** TODO. */
|
|
||||||
@RunWith(Arquillian.class)
|
@RunWith(Arquillian.class)
|
||||||
public class TaskanaProducersTest {
|
public class TaskanaProducersTest {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,13 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringTokenizer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.UnaryOperator;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
@ -37,6 +41,8 @@ import pro.taskana.common.internal.TaskanaEngineImpl;
|
||||||
import pro.taskana.common.internal.configuration.DB;
|
import pro.taskana.common.internal.configuration.DB;
|
||||||
import pro.taskana.common.internal.configuration.DbSchemaCreator;
|
import pro.taskana.common.internal.configuration.DbSchemaCreator;
|
||||||
import pro.taskana.common.internal.configuration.SecurityVerifier;
|
import pro.taskana.common.internal.configuration.SecurityVerifier;
|
||||||
|
import pro.taskana.common.internal.util.CheckedFunction;
|
||||||
|
import pro.taskana.common.internal.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This central class creates the TaskanaEngine and holds all the information about DB and Security.
|
* This central class creates the TaskanaEngine and holds all the information about DB and Security.
|
||||||
|
|
@ -82,7 +88,7 @@ public class TaskanaEngineConfiguration {
|
||||||
protected String schemaName;
|
protected String schemaName;
|
||||||
// Taskana role configuration
|
// Taskana role configuration
|
||||||
protected String propertiesSeparator = TASKANA_PROPERTY_SEPARATOR;
|
protected String propertiesSeparator = TASKANA_PROPERTY_SEPARATOR;
|
||||||
protected Map<TaskanaRole, Set<String>> roleMap = new HashMap<>();
|
protected Map<TaskanaRole, Set<String>> roleMap;
|
||||||
// global switch to enable JAAS based authentication and Taskana
|
// global switch to enable JAAS based authentication and Taskana
|
||||||
// authorizations
|
// authorizations
|
||||||
protected boolean securityEnabled;
|
protected boolean securityEnabled;
|
||||||
|
|
@ -163,21 +169,24 @@ public class TaskanaEngineConfiguration {
|
||||||
securityVerifier.checkSecureAccess(securityEnabled);
|
securityVerifier.checkSecureAccess(securityEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initTaskanaProperties(String propertiesFile, String rolesSeparator) {
|
public void initTaskanaProperties(String propertiesFile, String separator) {
|
||||||
LOGGER.debug(
|
LOGGER.debug(
|
||||||
"Reading taskana configuration from {} with role separator {}",
|
"Reading taskana configuration from {} with separator {}", propertiesFile, separator);
|
||||||
propertiesFile,
|
|
||||||
rolesSeparator);
|
|
||||||
Properties props = readPropertiesFromFile(propertiesFile);
|
Properties props = readPropertiesFromFile(propertiesFile);
|
||||||
initTaskanaRoles(props, rolesSeparator);
|
initTaskanaRoles(props, separator);
|
||||||
initJobParameters(props);
|
initJobParameters(props);
|
||||||
initDomains(props);
|
initDomains(props);
|
||||||
initClassificationTypes(props);
|
initClassificationTypes(props);
|
||||||
initClassificationCategories(props);
|
initClassificationCategories(props);
|
||||||
initBooleanFlag(props, TASKANA_GERMAN_HOLIDAYS_ENABLED);
|
initBooleanProperty(
|
||||||
initBooleanFlag(props, TASKANA_GERMAN_HOLIDAYS_CORPUS_CHRISTI_ENABLED);
|
props, TASKANA_GERMAN_HOLIDAYS_ENABLED, this::setGermanPublicHolidaysEnabled);
|
||||||
initBooleanFlag(props, TASKANA_HISTORY_DELETION_ON_TASK_DELETION_ENABLED);
|
initBooleanProperty(
|
||||||
initCustomHolidays(props);
|
props, TASKANA_GERMAN_HOLIDAYS_CORPUS_CHRISTI_ENABLED, this::setCorpusChristiEnabled);
|
||||||
|
initBooleanProperty(
|
||||||
|
props,
|
||||||
|
TASKANA_HISTORY_DELETION_ON_TASK_DELETION_ENABLED,
|
||||||
|
this::setDeleteHistoryOnTaskDeletionEnabled);
|
||||||
|
initCustomHolidays(props, separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataSource createDefaultDataSource() {
|
public static DataSource createDefaultDataSource() {
|
||||||
|
|
@ -232,28 +241,20 @@ public class TaskanaEngineConfiguration {
|
||||||
return this.useManagedTransactions;
|
return this.useManagedTransactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPropertiesFileName() {
|
|
||||||
return this.propertiesFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPropertiesFileName(String propertiesFileName) {
|
|
||||||
this.propertiesFileName = propertiesFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMaxNumberOfUpdatesPerTransaction() {
|
public int getMaxNumberOfUpdatesPerTransaction() {
|
||||||
return jobBatchSize;
|
return jobBatchSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMaxNumberOfUpdatesPerTransaction(int jobBatchSize) {
|
||||||
|
this.jobBatchSize = jobBatchSize;
|
||||||
|
}
|
||||||
|
|
||||||
public int getMaxNumberOfJobRetries() {
|
public int getMaxNumberOfJobRetries() {
|
||||||
return maxNumberOfJobRetries;
|
return maxNumberOfJobRetries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPropertiesSeparator() {
|
public void setMaxNumberOfJobRetries(int maxNumberOfJobRetries) {
|
||||||
return this.propertiesSeparator;
|
this.maxNumberOfJobRetries = maxNumberOfJobRetries;
|
||||||
}
|
|
||||||
|
|
||||||
public void setPropertiesSeparator(String propertiesSeparator) {
|
|
||||||
this.propertiesSeparator = propertiesSeparator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCorpusChristiEnabled() {
|
public boolean isCorpusChristiEnabled() {
|
||||||
|
|
@ -292,6 +293,7 @@ public class TaskanaEngineConfiguration {
|
||||||
return roleMap;
|
return roleMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public void setRoleMap(Map<TaskanaRole, Set<String>> roleMap) {
|
public void setRoleMap(Map<TaskanaRole, Set<String>> roleMap) {
|
||||||
this.roleMap = roleMap;
|
this.roleMap = roleMap;
|
||||||
}
|
}
|
||||||
|
|
@ -338,14 +340,26 @@ public class TaskanaEngineConfiguration {
|
||||||
return cleanupJobFirstRun;
|
return cleanupJobFirstRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCleanupJobFirstRun(Instant cleanupJobFirstRun) {
|
||||||
|
this.cleanupJobFirstRun = cleanupJobFirstRun;
|
||||||
|
}
|
||||||
|
|
||||||
public Duration getCleanupJobRunEvery() {
|
public Duration getCleanupJobRunEvery() {
|
||||||
return cleanupJobRunEvery;
|
return cleanupJobRunEvery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCleanupJobRunEvery(Duration cleanupJobRunEvery) {
|
||||||
|
this.cleanupJobRunEvery = cleanupJobRunEvery;
|
||||||
|
}
|
||||||
|
|
||||||
public Duration getCleanupJobMinimumAge() {
|
public Duration getCleanupJobMinimumAge() {
|
||||||
return cleanupJobMinimumAge;
|
return cleanupJobMinimumAge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCleanupJobMinimumAge(Duration cleanupJobMinimumAge) {
|
||||||
|
this.cleanupJobMinimumAge = cleanupJobMinimumAge;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isTaskCleanupJobAllCompletedSameParentBusiness() {
|
public boolean isTaskCleanupJobAllCompletedSameParentBusiness() {
|
||||||
return taskCleanupJobAllCompletedSameParentBusiness;
|
return taskCleanupJobAllCompletedSameParentBusiness;
|
||||||
}
|
}
|
||||||
|
|
@ -374,99 +388,45 @@ public class TaskanaEngineConfiguration {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initBooleanFlag(Properties props, String propName) {
|
private <T> Optional<T> parseProperty(
|
||||||
String enabled = props.getProperty(propName);
|
Properties props, String key, CheckedFunction<String, T> function) {
|
||||||
if (enabled != null && !enabled.isEmpty()) {
|
String property = props.getProperty(key, "");
|
||||||
boolean isEnabled = Boolean.parseBoolean(enabled);
|
if (!property.isEmpty()) {
|
||||||
if (propName.equals(TASKANA_GERMAN_HOLIDAYS_ENABLED)) {
|
try {
|
||||||
germanPublicHolidaysEnabled = isEnabled;
|
return Optional.ofNullable(function.apply(property));
|
||||||
} else if (propName.equals(TASKANA_GERMAN_HOLIDAYS_CORPUS_CHRISTI_ENABLED)) {
|
} catch (Throwable t) {
|
||||||
corpusChristiEnabled = isEnabled;
|
LOGGER.warn(
|
||||||
} else if (propName.equals(TASKANA_HISTORY_DELETION_ON_TASK_DELETION_ENABLED)) {
|
"Could not parse property {} ({}). Using default. Exception: {}",
|
||||||
deleteHistoryOnTaskDeletionEnabled = isEnabled;
|
key,
|
||||||
|
property,
|
||||||
|
t.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (LOGGER.isDebugEnabled()) {
|
return Optional.empty();
|
||||||
LOGGER.debug(String.format("%s = %b", propName, Boolean.parseBoolean(enabled)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initJobParameters(Properties props) {
|
private void initJobParameters(Properties props) {
|
||||||
String jobBatchSizeProperty = props.getProperty(TASKANA_JOB_BATCH_SIZE);
|
|
||||||
if (jobBatchSizeProperty != null && !jobBatchSizeProperty.isEmpty()) {
|
|
||||||
try {
|
|
||||||
jobBatchSize = Integer.parseInt(jobBatchSizeProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn(
|
|
||||||
"Could not parse jobBatchSizeProperty ({}). Using default. Exception: {} ",
|
|
||||||
jobBatchSizeProperty,
|
|
||||||
e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String maxNumberOfJobRetriesProperty = props.getProperty(TASKANA_JOB_RETRIES);
|
parseProperty(props, TASKANA_JOB_BATCH_SIZE, Integer::parseInt)
|
||||||
if (maxNumberOfJobRetriesProperty != null && !maxNumberOfJobRetriesProperty.isEmpty()) {
|
.ifPresent(this::setMaxNumberOfUpdatesPerTransaction);
|
||||||
try {
|
|
||||||
maxNumberOfJobRetries = Integer.parseInt(maxNumberOfJobRetriesProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn(
|
|
||||||
"Could not parse maxNumberOfJobRetriesProperty ({}). Using default. Exception: {} ",
|
|
||||||
maxNumberOfJobRetriesProperty,
|
|
||||||
e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String taskCleanupJobFirstRunProperty = props.getProperty(TASKANA_JOB_CLEANUP_FIRST_RUN);
|
parseProperty(props, TASKANA_JOB_RETRIES, Integer::parseInt)
|
||||||
if (taskCleanupJobFirstRunProperty != null && !taskCleanupJobFirstRunProperty.isEmpty()) {
|
.ifPresent(this::setMaxNumberOfJobRetries);
|
||||||
try {
|
|
||||||
cleanupJobFirstRun = Instant.parse(taskCleanupJobFirstRunProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn(
|
|
||||||
"Could not parse taskCleanupJobFirstRunProperty ({}). Using default. Exception: {} ",
|
|
||||||
taskCleanupJobFirstRunProperty,
|
|
||||||
e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String taskCleanupJobRunEveryProperty = props.getProperty(TASKANA_JOB_CLEANUP_RUN_EVERY);
|
parseProperty(props, TASKANA_JOB_CLEANUP_FIRST_RUN, Instant::parse)
|
||||||
if (taskCleanupJobRunEveryProperty != null && !taskCleanupJobRunEveryProperty.isEmpty()) {
|
.ifPresent(this::setCleanupJobFirstRun);
|
||||||
try {
|
|
||||||
cleanupJobRunEvery = Duration.parse(taskCleanupJobRunEveryProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn(
|
|
||||||
"Could not parse taskCleanupJobRunEveryProperty ({}). Using default. Exception: {} ",
|
|
||||||
taskCleanupJobRunEveryProperty,
|
|
||||||
e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String taskCleanupJobMinimumAgeProperty = props.getProperty(TASKANA_JOB_CLEANUP_MINIMUM_AGE);
|
parseProperty(props, TASKANA_JOB_CLEANUP_RUN_EVERY, Duration::parse)
|
||||||
if (taskCleanupJobMinimumAgeProperty != null && !taskCleanupJobMinimumAgeProperty.isEmpty()) {
|
.ifPresent(this::setCleanupJobRunEvery);
|
||||||
try {
|
|
||||||
cleanupJobMinimumAge = Duration.parse(taskCleanupJobMinimumAgeProperty);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn(
|
|
||||||
"Could not parse taskCleanupJobMinimumAgeProperty ({}). Using default. Exception: {} ",
|
|
||||||
taskCleanupJobMinimumAgeProperty,
|
|
||||||
e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String taskCleanupJobAllCompletedSameParentBusinessProperty =
|
parseProperty(props, TASKANA_JOB_CLEANUP_MINIMUM_AGE, Duration::parse)
|
||||||
props.getProperty(TASKANA_JOB_TASK_CLEANUP_ALL_COMPLETED_SAME_PARENT_BUSINESS);
|
.ifPresent(this::setCleanupJobMinimumAge);
|
||||||
if (taskCleanupJobAllCompletedSameParentBusinessProperty != null
|
|
||||||
&& !taskCleanupJobAllCompletedSameParentBusinessProperty.isEmpty()) {
|
parseProperty(
|
||||||
try {
|
props,
|
||||||
taskCleanupJobAllCompletedSameParentBusiness =
|
TASKANA_JOB_TASK_CLEANUP_ALL_COMPLETED_SAME_PARENT_BUSINESS,
|
||||||
Boolean.parseBoolean(taskCleanupJobAllCompletedSameParentBusinessProperty);
|
Boolean::parseBoolean)
|
||||||
} catch (Exception e) {
|
.ifPresent(this::setTaskCleanupJobAllCompletedSameParentBusiness);
|
||||||
LOGGER.warn(
|
|
||||||
"Could not parse taskCleanupJobAllCompletedSameParentBusinessProperty "
|
|
||||||
+ "({}). Using default. Exception: {} ",
|
|
||||||
taskCleanupJobAllCompletedSameParentBusinessProperty,
|
|
||||||
e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.debug(
|
LOGGER.debug(
|
||||||
"Configured number of task and workbasket updates per transaction: {}", jobBatchSize);
|
"Configured number of task and workbasket updates per transaction: {}", jobBatchSize);
|
||||||
|
|
@ -483,51 +443,45 @@ public class TaskanaEngineConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDomains(Properties props) {
|
private void initDomains(Properties props) {
|
||||||
String domainNames = props.getProperty(TASKANA_DOMAINS_PROPERTY);
|
CheckedFunction<String, List<String>> parseFunction =
|
||||||
if (domainNames != null && !domainNames.isEmpty()) {
|
p -> splitStringAndTrimElements(p, ",", String::toUpperCase);
|
||||||
StringTokenizer st = new StringTokenizer(domainNames, ",");
|
parseProperty(props, TASKANA_DOMAINS_PROPERTY, parseFunction).ifPresent(this::setDomains);
|
||||||
while (st.hasMoreTokens()) {
|
|
||||||
domains.add(st.nextToken().trim().toUpperCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOGGER.debug("Configured domains: {}", domains);
|
LOGGER.debug("Configured domains: {}", domains);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initClassificationTypes(Properties props) {
|
private void initClassificationTypes(Properties props) {
|
||||||
String classificationTypesNames = props.getProperty(TASKANA_CLASSIFICATION_TYPES_PROPERTY);
|
CheckedFunction<String, List<String>> parseFunction =
|
||||||
if (classificationTypesNames != null && !classificationTypesNames.isEmpty()) {
|
p -> splitStringAndTrimElements(p, ",", String::toUpperCase);
|
||||||
StringTokenizer st = new StringTokenizer(classificationTypesNames, ",");
|
parseProperty(props, TASKANA_CLASSIFICATION_TYPES_PROPERTY, parseFunction)
|
||||||
while (st.hasMoreTokens()) {
|
.ifPresent(this::setClassificationTypes);
|
||||||
classificationTypes.add(st.nextToken().trim().toUpperCase());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOGGER.warn("Configuration issue. Classification type is missing");
|
|
||||||
}
|
|
||||||
LOGGER.debug("Configured classificationTypes: {}", classificationTypes);
|
LOGGER.debug("Configured classificationTypes: {}", classificationTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initClassificationCategories(Properties props) {
|
private void initClassificationCategories(Properties props) {
|
||||||
if (classificationTypes != null && !classificationTypes.isEmpty()) {
|
Function<String, List<String>> getClassificationCategoriesForType =
|
||||||
String classificationCategoryNames;
|
type -> {
|
||||||
StringTokenizer st;
|
CheckedFunction<String, List<String>> parseFunction =
|
||||||
List<String> classificationCategoriesAux;
|
s -> splitStringAndTrimElements(s, ",", String::toUpperCase);
|
||||||
for (String type : classificationTypes) {
|
return parseProperty(
|
||||||
classificationCategoriesAux = new ArrayList<>();
|
props,
|
||||||
classificationCategoryNames =
|
TASKANA_CLASSIFICATION_CATEGORIES_PROPERTY + "." + type.toLowerCase(),
|
||||||
props.getProperty(
|
parseFunction)
|
||||||
TASKANA_CLASSIFICATION_CATEGORIES_PROPERTY + "." + type.toLowerCase());
|
.orElseGet(ArrayList::new);
|
||||||
if (classificationCategoryNames != null && !classificationCategoryNames.isEmpty()) {
|
};
|
||||||
st = new StringTokenizer(classificationCategoryNames, ",");
|
|
||||||
while (st.hasMoreTokens()) {
|
classificationCategoriesByTypeMap =
|
||||||
classificationCategoriesAux.add(st.nextToken().trim().toUpperCase());
|
classificationTypes.stream()
|
||||||
}
|
.map(type -> Pair.of(type, getClassificationCategoriesForType.apply(type)))
|
||||||
classificationCategoriesByTypeMap.put(type, classificationCategoriesAux);
|
.collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
|
||||||
} else {
|
|
||||||
LOGGER.warn("Configuration issue. Classification categories by type is missing");
|
LOGGER.debug("Configured classification categories : {}", classificationCategoriesByTypeMap);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
private void initBooleanProperty(
|
||||||
LOGGER.debug("Configured classification categories : {}", domains);
|
Properties props, String propertyName, Consumer<Boolean> consumer) {
|
||||||
|
parseProperty(props, propertyName, Boolean::parseBoolean).ifPresent(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initSchemaName(String schemaName) {
|
private void initSchemaName(String schemaName) {
|
||||||
|
|
@ -552,45 +506,54 @@ public class TaskanaEngineConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initTaskanaRoles(Properties props, String rolesSeparator) {
|
private void initTaskanaRoles(Properties props, String rolesSeparator) {
|
||||||
List<String> validPropertyNames = TaskanaRole.getValidPropertyNames();
|
Function<TaskanaRole, Set<String>> getAccessIdsForRole =
|
||||||
|
role -> {
|
||||||
|
List<String> accessIds =
|
||||||
|
splitStringAndTrimElements(
|
||||||
|
props.getProperty(role.getPropertyName().toLowerCase(), ""),
|
||||||
|
rolesSeparator,
|
||||||
|
shouldUseLowerCaseForAccessIds()
|
||||||
|
? String::toLowerCase
|
||||||
|
: UnaryOperator.identity());
|
||||||
|
return new HashSet<>(accessIds);
|
||||||
|
};
|
||||||
|
|
||||||
props.keySet().stream()
|
roleMap =
|
||||||
.map(String::valueOf)
|
Arrays.stream(TaskanaRole.values())
|
||||||
.filter(propertyName -> validPropertyNames.contains(propertyName.toLowerCase().trim()))
|
.map(role -> Pair.of(role, getAccessIdsForRole.apply(role)))
|
||||||
.forEach(
|
.collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
|
||||||
validPropertyName ->
|
|
||||||
roleMap.put(
|
|
||||||
TaskanaRole.fromPropertyName(validPropertyName),
|
|
||||||
getTokensWithCollection(props.getProperty(validPropertyName), rolesSeparator)));
|
|
||||||
|
|
||||||
ensureRoleMapIsFullyInitialized();
|
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
roleMap.forEach((k, v) -> LOGGER.debug("Found Taskana RoleConfig {} : {} ", k, v));
|
roleMap.forEach((k, v) -> LOGGER.debug("Found Taskana RoleConfig {} : {} ", k, v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCustomHolidays(Properties props) {
|
private void initCustomHolidays(Properties props, String separator) {
|
||||||
if (props.getProperty(TASKANA_CUSTOM_HOLIDAY) != null) {
|
CheckedFunction<String, List<CustomHoliday>> parseFunction =
|
||||||
Arrays.asList(
|
s ->
|
||||||
props.getProperty(TASKANA_CUSTOM_HOLIDAY).split(Pattern.quote(propertiesSeparator)))
|
splitStringAndTrimElements(s, separator).stream()
|
||||||
.forEach(
|
.map(
|
||||||
entry -> {
|
str -> {
|
||||||
try {
|
try {
|
||||||
customHolidays.add(createCustomHolidayFromPropsEntry(entry));
|
return createCustomHolidayFromPropsEntry(str);
|
||||||
} catch (WrongCustomHolidayFormatException e) {
|
} catch (WrongCustomHolidayFormatException e) {
|
||||||
LOGGER.warn(e.getMessage());
|
LOGGER.warn(e.getMessage());
|
||||||
}
|
return null;
|
||||||
});
|
}
|
||||||
}
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
parseProperty(props, TASKANA_CUSTOM_HOLIDAY, parseFunction).ifPresent(this::addCustomHolidays);
|
||||||
|
|
||||||
|
LOGGER.debug("Configured custom Holidays : {}", customHolidays);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustomHoliday createCustomHolidayFromPropsEntry(String customHolidayEntry)
|
private CustomHoliday createCustomHolidayFromPropsEntry(String customHolidayEntry)
|
||||||
throws WrongCustomHolidayFormatException {
|
throws WrongCustomHolidayFormatException {
|
||||||
String[] parts =
|
List<String> parts =
|
||||||
customHolidayEntry.split(Pattern.quote(TASKANA_CUSTOM_HOLIDAY_DAY_MONTH_SEPARATOR));
|
splitStringAndTrimElements(customHolidayEntry, TASKANA_CUSTOM_HOLIDAY_DAY_MONTH_SEPARATOR);
|
||||||
if (parts.length == 2) {
|
if (parts.size() == 2) {
|
||||||
return CustomHoliday.of(Integer.valueOf(parts[0]), Integer.valueOf(parts[1]));
|
return CustomHoliday.of(Integer.valueOf(parts.get(0)), Integer.valueOf(parts.get(1)));
|
||||||
}
|
}
|
||||||
throw new WrongCustomHolidayFormatException(
|
throw new WrongCustomHolidayFormatException(
|
||||||
String.format(
|
String.format(
|
||||||
|
|
@ -599,10 +562,17 @@ public class TaskanaEngineConfiguration {
|
||||||
customHolidayEntry));
|
customHolidayEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashSet<String> getTokensWithCollection(String str, String rolesSeparator) {
|
private List<String> splitStringAndTrimElements(String str, String separator) {
|
||||||
return Collections.list(new StringTokenizer(str, rolesSeparator)).stream()
|
return splitStringAndTrimElements(str, separator, UnaryOperator.identity());
|
||||||
.map(token -> String.valueOf(token).toLowerCase().trim())
|
}
|
||||||
.collect(Collectors.toCollection(HashSet::new));
|
|
||||||
|
private List<String> splitStringAndTrimElements(
|
||||||
|
String str, String separator, UnaryOperator<String> modifier) {
|
||||||
|
return Arrays.stream(str.split(Pattern.quote(separator)))
|
||||||
|
.filter(s -> !s.isEmpty())
|
||||||
|
.map(String::trim)
|
||||||
|
.map(modifier)
|
||||||
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Properties readPropertiesFromFile(String propertiesFile) {
|
private Properties readPropertiesFromFile(String propertiesFile) {
|
||||||
|
|
@ -638,9 +608,4 @@ public class TaskanaEngineConfiguration {
|
||||||
}
|
}
|
||||||
return loadFromClasspath;
|
return loadFromClasspath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureRoleMapIsFullyInitialized() {
|
|
||||||
// make sure that roleMap does not return null for any role
|
|
||||||
Arrays.stream(TaskanaRole.values()).forEach(role -> roleMap.putIfAbsent(role, new HashSet<>()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public interface BaseQuery<T, U extends Enum<U> & QueryColumnName> {
|
||||||
*/
|
*/
|
||||||
default List<T> listPage(int pageNumber, int pageSize) {
|
default List<T> listPage(int pageNumber, int pageSize) {
|
||||||
int offset = (pageNumber < 1) ? 0 : ((pageNumber - 1) * pageSize);
|
int offset = (pageNumber < 1) ? 0 : ((pageNumber - 1) * pageSize);
|
||||||
int limit = (pageSize < 0) ? 0 : pageSize;
|
int limit = Math.max(pageSize, 0);
|
||||||
return list(offset, limit);
|
return list(offset, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,124 +57,56 @@ public class TaskEvent extends TaskanaHistoryEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBusinessProcessId() {
|
|
||||||
return businessProcessId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBusinessProcessId(String businessProcessId) {
|
|
||||||
this.businessProcessId = businessProcessId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParentBusinessProcessId() {
|
|
||||||
return parentBusinessProcessId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setParentBusinessProcessId(String parentBusinessProcessId) {
|
|
||||||
this.parentBusinessProcessId = parentBusinessProcessId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTaskId() {
|
|
||||||
return taskId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaskId(String taskId) {
|
|
||||||
this.taskId = taskId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDomain() {
|
|
||||||
return domain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDomain(String domain) {
|
|
||||||
this.domain = domain;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWorkbasketKey() {
|
|
||||||
return workbasketKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWorkbasketKey(String workbasketKey) {
|
|
||||||
this.workbasketKey = workbasketKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 getPorInstance() {
|
|
||||||
return porInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPorInstance(String porInstance) {
|
|
||||||
this.porInstance = porInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTaskClassificationKey() {
|
|
||||||
return taskClassificationKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaskClassificationKey(String taskClassificationKey) {
|
|
||||||
this.taskClassificationKey = taskClassificationKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTaskClassificationCategory() {
|
|
||||||
return taskClassificationCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaskClassificationCategory(String taskClassificationCategory) {
|
|
||||||
this.taskClassificationCategory = taskClassificationCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAttachmentClassificationKey() {
|
|
||||||
return attachmentClassificationKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAttachmentClassificationKey(String attachmentClassificationKey) {
|
|
||||||
this.attachmentClassificationKey = attachmentClassificationKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TaskEvent [taskId= "
|
return "TaskEvent [id="
|
||||||
+ this.taskId
|
+ id
|
||||||
+ ", businessProcessId= "
|
+ ", businessProcessId="
|
||||||
+ this.businessProcessId
|
+ businessProcessId
|
||||||
+ ", parentBusinessProcessId= "
|
+ ", parentBusinessProcessId="
|
||||||
+ this.parentBusinessProcessId
|
+ parentBusinessProcessId
|
||||||
+ ", domain= "
|
+ ", taskId="
|
||||||
+ this.domain
|
+ taskId
|
||||||
+ ", workbasketKey= "
|
+ ", eventType="
|
||||||
+ this.workbasketKey
|
+ eventType
|
||||||
+ ", details= "
|
+ ", created="
|
||||||
+ this.details
|
+ created
|
||||||
|
+ ", userId="
|
||||||
|
+ userId
|
||||||
|
+ ", domain="
|
||||||
|
+ domain
|
||||||
|
+ ", workbasketKey="
|
||||||
|
+ workbasketKey
|
||||||
|
+ ", porCompany="
|
||||||
|
+ porCompany
|
||||||
|
+ ", porSystem="
|
||||||
|
+ porSystem
|
||||||
|
+ ", porInstance="
|
||||||
|
+ porInstance
|
||||||
|
+ ", porType="
|
||||||
|
+ porType
|
||||||
|
+ ", porValue="
|
||||||
|
+ porValue
|
||||||
|
+ ", taskClassificationKey="
|
||||||
|
+ taskClassificationKey
|
||||||
|
+ ", taskClassificationCategory="
|
||||||
|
+ taskClassificationCategory
|
||||||
|
+ ", attachmentClassificationKey="
|
||||||
|
+ attachmentClassificationKey
|
||||||
|
+ ", oldValue="
|
||||||
|
+ oldValue
|
||||||
|
+ ", newValue="
|
||||||
|
+ newValue
|
||||||
|
+ ", custom1="
|
||||||
|
+ custom1
|
||||||
|
+ ", custom2="
|
||||||
|
+ custom2
|
||||||
|
+ ", custom3="
|
||||||
|
+ custom3
|
||||||
|
+ ", custom4="
|
||||||
|
+ custom4
|
||||||
|
+ ", details="
|
||||||
|
+ details
|
||||||
+ "]";
|
+ "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
package pro.taskana.spi.history.api.events.task;
|
package pro.taskana.spi.history.api.events.task;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import pro.taskana.task.api.models.Task;
|
import pro.taskana.task.api.models.Task;
|
||||||
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
import pro.taskana.workbasket.api.models.WorkbasketSummary;
|
||||||
|
|
||||||
/** Event fired if a task is transferred. */
|
/** Event fired if a task is transferred. */
|
||||||
public class TransferredEvent extends TaskEvent {
|
public class TransferredEvent extends TaskEvent {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(TransferredEvent.class);
|
|
||||||
|
|
||||||
public TransferredEvent(
|
public TransferredEvent(
|
||||||
String id,
|
String id,
|
||||||
Task task,
|
Task task,
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,14 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
||||||
private static final String LINK_TO_VALUEMAPPER =
|
private static final String LINK_TO_VALUEMAPPER =
|
||||||
"pro.taskana.task.internal.TaskQueryMapper.queryObjectReferenceColumnValues";
|
"pro.taskana.task.internal.TaskQueryMapper.queryObjectReferenceColumnValues";
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ObjectReferenceQueryImpl.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ObjectReferenceQueryImpl.class);
|
||||||
private InternalTaskanaEngine taskanaEngine;
|
private final InternalTaskanaEngine taskanaEngine;
|
||||||
|
private final List<String> orderBy;
|
||||||
private ObjectReferenceQueryColumnName columnName;
|
private ObjectReferenceQueryColumnName columnName;
|
||||||
private String[] company;
|
private String[] company;
|
||||||
private String[] system;
|
private String[] system;
|
||||||
private String[] systemInstance;
|
private String[] systemInstance;
|
||||||
private String[] type;
|
private String[] type;
|
||||||
private String[] value;
|
private String[] value;
|
||||||
private List<String> orderBy;
|
|
||||||
|
|
||||||
ObjectReferenceQueryImpl(InternalTaskanaEngine taskanaEngine) {
|
ObjectReferenceQueryImpl(InternalTaskanaEngine taskanaEngine) {
|
||||||
this.taskanaEngine = taskanaEngine;
|
this.taskanaEngine = taskanaEngine;
|
||||||
|
|
@ -98,15 +98,13 @@ public class ObjectReferenceQueryImpl implements ObjectReferenceQuery {
|
||||||
RowBounds rowBounds = new RowBounds(offset, limit);
|
RowBounds rowBounds = new RowBounds(offset, limit);
|
||||||
result = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
|
result = taskanaEngine.getSqlSession().selectList(LINK_TO_MAPPER, this, rowBounds);
|
||||||
return result;
|
return result;
|
||||||
} catch (Exception e) {
|
} catch (PersistenceException e) {
|
||||||
if (e instanceof PersistenceException) {
|
if (e.getMessage().contains("ERRORCODE=-4470")) {
|
||||||
if (e.getMessage().contains("ERRORCODE=-4470")) {
|
TaskanaRuntimeException ex =
|
||||||
TaskanaRuntimeException ex =
|
new TaskanaRuntimeException(
|
||||||
new TaskanaRuntimeException(
|
"The offset beginning was set over the amount of result-rows.", e.getCause());
|
||||||
"The offset beginning was set over the amount of result-rows.", e.getCause());
|
ex.setStackTrace(e.getStackTrace());
|
||||||
ex.setStackTrace(e.getStackTrace());
|
throw ex;
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ class ServiceLevelHandler {
|
||||||
boolean onlyPriority = false;
|
boolean onlyPriority = false;
|
||||||
if (newTaskImpl.getClassificationSummary() == null
|
if (newTaskImpl.getClassificationSummary() == null
|
||||||
|| newTaskImpl.getClassificationSummary().getServiceLevel() == null) {
|
|| newTaskImpl.getClassificationSummary().getServiceLevel() == null) {
|
||||||
newTaskImpl = setPlannedDueOnMissingServiceLevel(newTaskImpl);
|
setPlannedDueOnMissingServiceLevel(newTaskImpl);
|
||||||
onlyPriority = true;
|
onlyPriority = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,7 +154,7 @@ class ServiceLevelHandler {
|
||||||
return getFinalPrioDurationOfTask(resolvedClassifications, onlyPriority);
|
return getFinalPrioDurationOfTask(resolvedClassifications, onlyPriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
private TaskImpl setPlannedDueOnMissingServiceLevel(TaskImpl task) {
|
private void setPlannedDueOnMissingServiceLevel(TaskImpl task) {
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
if (task.getDue() == null && task.getPlanned() == null) {
|
if (task.getDue() == null && task.getPlanned() == null) {
|
||||||
task.setDue(now);
|
task.setDue(now);
|
||||||
|
|
@ -164,7 +164,6 @@ class ServiceLevelHandler {
|
||||||
} else {
|
} else {
|
||||||
task.setPlanned(task.getDue());
|
task.setPlanned(task.getDue());
|
||||||
}
|
}
|
||||||
return task;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTaskPriorityOnClassificationUpdate(
|
private void updateTaskPriorityOnClassificationUpdate(
|
||||||
|
|
|
||||||
|
|
@ -1585,7 +1585,7 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
joinWithAttachments = true;
|
joinWithAttachments = true;
|
||||||
joinWithAttachmentClassifications = true;
|
joinWithAttachmentClassifications = true;
|
||||||
}
|
}
|
||||||
if (joinWithAttachments || joinWithClassifications || joinWithAttachmentClassifications) {
|
if (joinWithAttachments || joinWithClassifications) {
|
||||||
useDistinctKeyword = true;
|
useDistinctKeyword = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1597,7 +1597,7 @@ public class TaskQueryImpl implements TaskQuery {
|
||||||
} else if (this.accessIdIn == null) {
|
} else if (this.accessIdIn == null) {
|
||||||
String[] accessIds = new String[0];
|
String[] accessIds = new String[0];
|
||||||
List<String> ucAccessIds = CurrentUserContext.getAccessIds();
|
List<String> ucAccessIds = CurrentUserContext.getAccessIds();
|
||||||
if (ucAccessIds != null && !ucAccessIds.isEmpty()) {
|
if (!ucAccessIds.isEmpty()) {
|
||||||
accessIds = new String[ucAccessIds.size()];
|
accessIds = new String[ucAccessIds.size()];
|
||||||
accessIds = ucAccessIds.toArray(accessIds);
|
accessIds = ucAccessIds.toArray(accessIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ public class AttachmentImpl extends AttachmentSummaryImpl implements Attachment
|
||||||
return new AttachmentImpl(this);
|
return new AttachmentImpl(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean canEqual(Object other) {
|
protected boolean canEqual(Object other) {
|
||||||
return (!(other instanceof AttachmentImpl));
|
return (!(other instanceof AttachmentImpl));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,7 @@ public class TaskImpl extends TaskSummaryImpl implements Task {
|
||||||
((ClassificationSummaryImpl) this.classificationSummary).setCategory(classificationCategory);
|
((ClassificationSummaryImpl) this.classificationSummary).setCategory(classificationCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean canEqual(Object other) {
|
protected boolean canEqual(Object other) {
|
||||||
return (other instanceof TaskImpl);
|
return (other instanceof TaskImpl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -436,7 +436,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
||||||
throws InvalidArgumentException, NotAuthorizedException,
|
throws InvalidArgumentException, NotAuthorizedException,
|
||||||
WorkbasketAccessItemAlreadyExistException {
|
WorkbasketAccessItemAlreadyExistException {
|
||||||
LOGGER.debug(
|
LOGGER.debug(
|
||||||
"entry to setWorkbasketAccessItems(workbasketAccessItems = {})", wbAccessItems.toString());
|
"entry to setWorkbasketAccessItems(workbasketAccessItems = {})", wbAccessItems);
|
||||||
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
|
taskanaEngine.getEngine().checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
|
||||||
|
|
||||||
Set<String> ids = new HashSet<>();
|
Set<String> ids = new HashSet<>();
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class TaskanaConfigAccTest extends TaskanaEngineImpl {
|
||||||
Path file = Files.createFile(Paths.get(System.getProperty("user.home") + filename));
|
Path file = Files.createFile(Paths.get(System.getProperty("user.home") + filename));
|
||||||
List<String> lines =
|
List<String> lines =
|
||||||
Stream.of(
|
Stream.of(
|
||||||
"taskana.roles.Admin =Holger|Stefan",
|
"taskana.roles.admin =Holger|Stefan",
|
||||||
"taskana.roles.businessadmin = ebe | konstantin ",
|
"taskana.roles.businessadmin = ebe | konstantin ",
|
||||||
"taskana.roles.user = nobody")
|
"taskana.roles.user = nobody")
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
|
||||||
|
|
@ -125,9 +125,10 @@ class TaskanaRoleConfigAccTest extends TaskanaEngineImpl {
|
||||||
Path file = Files.createFile(Paths.get(System.getProperty("user.home") + filename));
|
Path file = Files.createFile(Paths.get(System.getProperty("user.home") + filename));
|
||||||
List<String> lines =
|
List<String> lines =
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
"taskana.roles.Admin =uSeR " + delimiter + "name=Username,Organisation=novatec",
|
"taskana.roles.admin =uSeR " + delimiter + "name=Username,Organisation=novatec",
|
||||||
" taskana.roles.businessadmin = name=user2, ou = bpm " + delimiter + " user3 ",
|
" taskana.roles.businessadmin = name=user2, ou = bpm " + delimiter + " user3 ",
|
||||||
" taskana.roles.user = ");
|
" taskana.roles.user = ",
|
||||||
|
"taskana.roles.taskadmin= taskadmin");
|
||||||
Files.write(file, lines, StandardCharsets.UTF_8);
|
Files.write(file, lines, StandardCharsets.UTF_8);
|
||||||
return file.toString();
|
return file.toString();
|
||||||
}
|
}
|
||||||
|
|
@ -143,9 +144,10 @@ class TaskanaRoleConfigAccTest extends TaskanaEngineImpl {
|
||||||
Path file = Files.createFile(Paths.get(System.getProperty("user.home") + filename));
|
Path file = Files.createFile(Paths.get(System.getProperty("user.home") + filename));
|
||||||
List<String> lines =
|
List<String> lines =
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
"taskana.roles.Admin =uSeR|Username",
|
"taskana.roles.admin =uSeR|Username",
|
||||||
" taskana.roles.businessadmin = user2 | user3 ",
|
" taskana.roles.businessadmin = user2 | user3 ",
|
||||||
" taskana.roles.user = nobody");
|
" taskana.roles.user = nobody",
|
||||||
|
"taskana.roles.taskadmin= taskadmin");
|
||||||
|
|
||||||
Files.write(file, lines, StandardCharsets.UTF_8);
|
Files.write(file, lines, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import pro.taskana.common.api.TaskanaRole;
|
import pro.taskana.common.api.TaskanaRole;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.common.internal.TaskanaEngineProxyForTest;
|
import pro.taskana.common.internal.TaskanaEngineProxy;
|
||||||
import pro.taskana.common.internal.security.JaasExtension;
|
import pro.taskana.common.internal.security.JaasExtension;
|
||||||
import pro.taskana.common.internal.security.WithAccessId;
|
import pro.taskana.common.internal.security.WithAccessId;
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ class TaskEngineAccTest extends AbstractAccTest {
|
||||||
assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isTrue();
|
assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isTrue();
|
||||||
assertThat(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)).isFalse();
|
assertThat(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)).isFalse();
|
||||||
|
|
||||||
new TaskanaEngineProxyForTest(taskanaEngine)
|
new TaskanaEngineProxy(taskanaEngine)
|
||||||
.getEngine()
|
.getEngine()
|
||||||
.runAsAdmin(() -> assertThat(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)).isTrue());
|
.runAsAdmin(() -> assertThat(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)).isTrue());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
|
||||||
Task createdTask = TASK_SERVICE.createTask(newTask);
|
Task createdTask = TASK_SERVICE.createTask(newTask);
|
||||||
|
|
||||||
assertThat(createdTask).isNotNull();
|
assertThat(createdTask).isNotNull();
|
||||||
assertThat("other_user").isEqualTo(createdTask.getOwner());
|
assertThat(createdTask.getOwner()).isEqualTo("other_user");
|
||||||
|
|
||||||
Instant beforeForceClaim = Instant.now();
|
Instant beforeForceClaim = Instant.now();
|
||||||
Task taskAfterClaim = TASK_SERVICE.forceClaim(createdTask.getId());
|
Task taskAfterClaim = TASK_SERVICE.forceClaim(createdTask.getId());
|
||||||
|
|
@ -233,12 +233,12 @@ class CompleteTaskAccTest extends AbstractAccTest {
|
||||||
Task createdTask = TASK_SERVICE.createTask(newTask);
|
Task createdTask = TASK_SERVICE.createTask(newTask);
|
||||||
|
|
||||||
assertThat(createdTask).isNotNull();
|
assertThat(createdTask).isNotNull();
|
||||||
assertThat(TaskState.READY).isEqualTo(createdTask.getState());
|
assertThat(createdTask.getState()).isSameAs(TaskState.READY);
|
||||||
|
|
||||||
createdTask = TASK_SERVICE.cancelClaim(createdTask.getId());
|
createdTask = TASK_SERVICE.cancelClaim(createdTask.getId());
|
||||||
|
|
||||||
assertThat(createdTask).isNotNull();
|
assertThat(createdTask).isNotNull();
|
||||||
assertThat(TaskState.READY).isEqualTo(createdTask.getState());
|
assertThat(createdTask.getState()).isSameAs(TaskState.READY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(user = "admin")
|
@WithAccessId(user = "admin")
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.common.internal.TaskanaEngineProxyForTest;
|
import pro.taskana.common.internal.TaskanaEngineProxy;
|
||||||
import pro.taskana.common.internal.security.CurrentUserContext;
|
import pro.taskana.common.internal.security.CurrentUserContext;
|
||||||
import pro.taskana.common.internal.security.JaasExtension;
|
import pro.taskana.common.internal.security.JaasExtension;
|
||||||
import pro.taskana.common.internal.security.WithAccessId;
|
import pro.taskana.common.internal.security.WithAccessId;
|
||||||
|
|
@ -196,7 +196,7 @@ class CreateTaskAccTest extends AbstractAccTest {
|
||||||
assertThat(createdTask.isRead()).isFalse();
|
assertThat(createdTask.isRead()).isFalse();
|
||||||
assertThat(createdTask.isTransferred()).isFalse();
|
assertThat(createdTask.isTransferred()).isFalse();
|
||||||
// verify that the database content is as expected
|
// verify that the database content is as expected
|
||||||
TaskanaEngineProxyForTest engineProxy = new TaskanaEngineProxyForTest(taskanaEngine);
|
TaskanaEngineProxy engineProxy = new TaskanaEngineProxy(taskanaEngine);
|
||||||
try {
|
try {
|
||||||
SqlSession session = engineProxy.getSqlSession();
|
SqlSession session = engineProxy.getSqlSession();
|
||||||
Configuration config = session.getConfiguration();
|
Configuration config = session.getConfiguration();
|
||||||
|
|
@ -258,7 +258,7 @@ class CreateTaskAccTest extends AbstractAccTest {
|
||||||
assertThat(createdTask.getCreator()).isEqualTo(CurrentUserContext.getUserid());
|
assertThat(createdTask.getCreator()).isEqualTo(CurrentUserContext.getUserid());
|
||||||
|
|
||||||
// verify that the database content is as expected
|
// verify that the database content is as expected
|
||||||
TaskanaEngineProxyForTest engineProxy = new TaskanaEngineProxyForTest(taskanaEngine);
|
TaskanaEngineProxy engineProxy = new TaskanaEngineProxy(taskanaEngine);
|
||||||
try {
|
try {
|
||||||
SqlSession session = engineProxy.getSqlSession();
|
SqlSession session = engineProxy.getSqlSession();
|
||||||
AttachmentMapper mapper = session.getMapper(AttachmentMapper.class);
|
AttachmentMapper mapper = session.getMapper(AttachmentMapper.class);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import pro.taskana.common.api.BulkOperationResults;
|
import pro.taskana.common.api.BulkOperationResults;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.common.api.exceptions.TaskanaException;
|
import pro.taskana.common.api.exceptions.TaskanaException;
|
||||||
import pro.taskana.common.internal.TaskanaEngineProxyForTest;
|
import pro.taskana.common.internal.TaskanaEngineProxy;
|
||||||
import pro.taskana.common.internal.security.JaasExtension;
|
import pro.taskana.common.internal.security.JaasExtension;
|
||||||
import pro.taskana.common.internal.security.WithAccessId;
|
import pro.taskana.common.internal.security.WithAccessId;
|
||||||
import pro.taskana.task.api.TaskService;
|
import pro.taskana.task.api.TaskService;
|
||||||
|
|
@ -50,7 +50,7 @@ class DeleteTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
TaskanaEngineProxyForTest engineProxy = new TaskanaEngineProxyForTest(taskanaEngine);
|
TaskanaEngineProxy engineProxy = new TaskanaEngineProxy(taskanaEngine);
|
||||||
AttachmentMapper attachmentMapper =
|
AttachmentMapper attachmentMapper =
|
||||||
engineProxy.getEngine().getSqlSession().getMapper(AttachmentMapper.class);
|
engineProxy.getEngine().getSqlSession().getMapper(AttachmentMapper.class);
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ class DeleteTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
TaskanaEngineProxyForTest engineProxy = new TaskanaEngineProxyForTest(taskanaEngine);
|
TaskanaEngineProxy engineProxy = new TaskanaEngineProxy(taskanaEngine);
|
||||||
AttachmentMapper attachmentMapper =
|
AttachmentMapper attachmentMapper =
|
||||||
engineProxy.getSqlSession().getMapper(AttachmentMapper.class);
|
engineProxy.getSqlSession().getMapper(AttachmentMapper.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import pro.taskana.classification.api.models.ClassificationSummary;
|
||||||
import pro.taskana.common.api.BaseQuery.SortDirection;
|
import pro.taskana.common.api.BaseQuery.SortDirection;
|
||||||
import pro.taskana.common.api.TimeInterval;
|
import pro.taskana.common.api.TimeInterval;
|
||||||
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
import pro.taskana.common.api.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.common.internal.TaskanaEngineProxyForTest;
|
import pro.taskana.common.internal.TaskanaEngineProxy;
|
||||||
import pro.taskana.common.internal.security.JaasExtension;
|
import pro.taskana.common.internal.security.JaasExtension;
|
||||||
import pro.taskana.common.internal.security.WithAccessId;
|
import pro.taskana.common.internal.security.WithAccessId;
|
||||||
import pro.taskana.common.internal.util.Triplet;
|
import pro.taskana.common.internal.util.Triplet;
|
||||||
|
|
@ -353,7 +353,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
assertThat(createdTask).isNotNull();
|
assertThat(createdTask).isNotNull();
|
||||||
// query the task by custom attributes
|
// query the task by custom attributes
|
||||||
TaskanaEngineProxyForTest engineProxy = new TaskanaEngineProxyForTest(taskanaEngine);
|
TaskanaEngineProxy engineProxy = new TaskanaEngineProxy(taskanaEngine);
|
||||||
try {
|
try {
|
||||||
SqlSession session = engineProxy.getSqlSession();
|
SqlSession session = engineProxy.getSqlSession();
|
||||||
Configuration config = session.getConfiguration();
|
Configuration config = session.getConfiguration();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import pro.taskana.common.api.BulkOperationResults;
|
import pro.taskana.common.api.BulkOperationResults;
|
||||||
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
import pro.taskana.common.api.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.common.api.exceptions.TaskanaException;
|
import pro.taskana.common.api.exceptions.TaskanaException;
|
||||||
import pro.taskana.common.internal.TaskanaEngineProxyForTest;
|
import pro.taskana.common.internal.TaskanaEngineProxy;
|
||||||
import pro.taskana.common.internal.security.JaasExtension;
|
import pro.taskana.common.internal.security.JaasExtension;
|
||||||
import pro.taskana.common.internal.security.WithAccessId;
|
import pro.taskana.common.internal.security.WithAccessId;
|
||||||
import pro.taskana.task.api.TaskService;
|
import pro.taskana.task.api.TaskService;
|
||||||
|
|
@ -157,7 +157,7 @@ class SetOwnerAccTest extends AbstractAccTest {
|
||||||
void testSetOwnerWithAllTasksAndVariousExceptions() throws Exception {
|
void testSetOwnerWithAllTasksAndVariousExceptions() throws Exception {
|
||||||
resetDb(false);
|
resetDb(false);
|
||||||
List<TaskSummary> allTaskSummaries =
|
List<TaskSummary> allTaskSummaries =
|
||||||
new TaskanaEngineProxyForTest(taskanaEngine)
|
new TaskanaEngineProxy(taskanaEngine)
|
||||||
.getEngine()
|
.getEngine()
|
||||||
.runAsAdmin(() -> taskanaEngine.getTaskService().createTaskQuery().list());
|
.runAsAdmin(() -> taskanaEngine.getTaskService().createTaskQuery().list());
|
||||||
List<String> allTaskIds =
|
List<String> allTaskIds =
|
||||||
|
|
|
||||||
|
|
@ -36,19 +36,19 @@ class TaskRoutingAccTest extends AbstractAccTest {
|
||||||
.isInstanceOf(InvalidArgumentException.class);
|
.isInstanceOf(InvalidArgumentException.class);
|
||||||
((TaskImpl) taskToCreate).setDomain("DOMAIN_B");
|
((TaskImpl) taskToCreate).setDomain("DOMAIN_B");
|
||||||
Task createdTask = taskService.createTask(taskToCreate);
|
Task createdTask = taskService.createTask(taskToCreate);
|
||||||
assertThat("WBI:100000000000000000000000000000000011")
|
assertThat(createdTask.getWorkbasketSummary().getId())
|
||||||
.isEqualTo(createdTask.getWorkbasketSummary().getId());
|
.isEqualTo("WBI:100000000000000000000000000000000011");
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(user = "admin")
|
@WithAccessId(user = "admin")
|
||||||
@Test
|
@Test
|
||||||
void testCreateTaskWithNullWorkbasket() throws Exception {
|
void testCreateTaskWithNullWorkbasket() throws Exception {
|
||||||
TaskImpl createdTaskA = createTask("DOMAIN_A", "L12010");
|
TaskImpl createdTaskA = createTask("DOMAIN_A", "L12010");
|
||||||
assertThat("WBI:100000000000000000000000000000000001")
|
assertThat(createdTaskA.getWorkbasketSummary().getId())
|
||||||
.isEqualTo(createdTaskA.getWorkbasketSummary().getId());
|
.isEqualTo("WBI:100000000000000000000000000000000001");
|
||||||
TaskImpl createdTaskB = createTask("DOMAIN_B", "T21001");
|
TaskImpl createdTaskB = createTask("DOMAIN_B", "T21001");
|
||||||
assertThat("WBI:100000000000000000000000000000000011")
|
assertThat(createdTaskB.getWorkbasketSummary().getId())
|
||||||
.isEqualTo(createdTaskB.getWorkbasketSummary().getId());
|
.isEqualTo("WBI:100000000000000000000000000000000011");
|
||||||
assertThatThrownBy(() -> createTask(null, "L12010"))
|
assertThatThrownBy(() -> createTask(null, "L12010"))
|
||||||
.isInstanceOf(InvalidArgumentException.class);
|
.isInstanceOf(InvalidArgumentException.class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import pro.taskana.common.api.CustomHoliday;
|
||||||
import pro.taskana.common.api.TaskanaEngine;
|
import pro.taskana.common.api.TaskanaEngine;
|
||||||
|
|
||||||
/** Test of configuration. */
|
/** Test of configuration. */
|
||||||
class TaskanaEngineTestConfigurationTest {
|
class TaskanaEngineConfigurationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCreateTaskanaEngine() throws Exception {
|
void testCreateTaskanaEngine() throws Exception {
|
||||||
|
|
@ -10,11 +10,11 @@ import pro.taskana.common.api.TaskanaEngine;
|
||||||
*
|
*
|
||||||
* @author bbr
|
* @author bbr
|
||||||
*/
|
*/
|
||||||
public class TaskanaEngineProxyForTest {
|
public class TaskanaEngineProxy {
|
||||||
|
|
||||||
private final InternalTaskanaEngine engine;
|
private final InternalTaskanaEngine engine;
|
||||||
|
|
||||||
public TaskanaEngineProxyForTest(TaskanaEngine taskanaEngine) throws Exception {
|
public TaskanaEngineProxy(TaskanaEngine taskanaEngine) throws Exception {
|
||||||
Field internal = TaskanaEngineImpl.class.getDeclaredField("internalTaskanaEngineImpl");
|
Field internal = TaskanaEngineImpl.class.getDeclaredField("internalTaskanaEngineImpl");
|
||||||
internal.setAccessible(true);
|
internal.setAccessible(true);
|
||||||
engine = (InternalTaskanaEngine) internal.get(taskanaEngine);
|
engine = (InternalTaskanaEngine) internal.get(taskanaEngine);
|
||||||
|
|
@ -36,11 +36,7 @@ public class TaskanaConfig {
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
public DataSource dataSource(DataSourceProperties properties) {
|
public DataSource dataSource(DataSourceProperties properties) {
|
||||||
DataSource dataSource = properties.initializeDataSourceBuilder().build();
|
return properties.initializeDataSourceBuilder().build();
|
||||||
// if TaskanaEngineImpl runs with SpringManagedTransactionFactory, then
|
|
||||||
// there is no need to wrap the dataSource into TransactionAwareDataSourceProxy ...
|
|
||||||
// return new TransactionAwareDataSourceProxy(dataSource);
|
|
||||||
return dataSource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
@ -53,16 +49,12 @@ public class TaskanaConfig {
|
||||||
@Bean
|
@Bean
|
||||||
public SpringTaskanaEngineConfiguration taskanaEngineConfiguration(DataSource dataSource)
|
public SpringTaskanaEngineConfiguration taskanaEngineConfiguration(DataSource dataSource)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
SpringTaskanaEngineConfiguration taskanaEngineConfiguration =
|
return new SpringTaskanaEngineConfiguration(dataSource, true, false, schemaName);
|
||||||
new SpringTaskanaEngineConfiguration(dataSource, true, false, schemaName);
|
|
||||||
return taskanaEngineConfiguration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public TaskanaEngine taskanaEngine(SpringTaskanaEngineConfiguration taskanaEngineConfiguration) {
|
public TaskanaEngine taskanaEngine(SpringTaskanaEngineConfiguration taskanaEngineConfiguration) {
|
||||||
TaskanaEngine taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
|
return taskanaEngineConfiguration.buildTaskanaEngine();
|
||||||
// taskanaEngine.setConnectionManagementMode(TaskanaEngine.ConnectionManagementMode.EXPLICIT);
|
|
||||||
return taskanaEngine;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
@ -85,7 +77,6 @@ public class TaskanaConfig {
|
||||||
return new ExampleBootstrap();
|
return new ExampleBootstrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO. */
|
|
||||||
@Profile("inmemorydb")
|
@Profile("inmemorydb")
|
||||||
@Configuration
|
@Configuration
|
||||||
@PropertySource("classpath:customdb.properties")
|
@PropertySource("classpath:customdb.properties")
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ class ClassificationControllerIntTest {
|
||||||
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
||||||
|
|
||||||
assertThat(responseEntity).isNotNull();
|
assertThat(responseEntity).isNotNull();
|
||||||
assertThat(HttpStatus.CREATED).isEqualTo(responseEntity.getStatusCode());
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
|
|
||||||
newClassification =
|
newClassification =
|
||||||
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
|
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
|
||||||
|
|
@ -150,7 +150,7 @@ class ClassificationControllerIntTest {
|
||||||
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
|
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
|
||||||
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
||||||
|
|
||||||
assertThat(HttpStatus.CREATED).isEqualTo(responseEntity.getStatusCode());
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -192,7 +192,7 @@ class ClassificationControllerIntTest {
|
||||||
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
||||||
|
|
||||||
assertThat(responseEntity).isNotNull();
|
assertThat(responseEntity).isNotNull();
|
||||||
assertThat(HttpStatus.CREATED).isEqualTo(responseEntity.getStatusCode());
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -212,7 +212,7 @@ class ClassificationControllerIntTest {
|
||||||
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
||||||
|
|
||||||
assertThat(responseEntity).isNotNull();
|
assertThat(responseEntity).isNotNull();
|
||||||
assertThat(HttpStatus.CREATED).isEqualTo(responseEntity.getStatusCode());
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -231,7 +231,7 @@ class ClassificationControllerIntTest {
|
||||||
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
ParameterizedTypeReference.forType(ClassificationRepresentationModel.class));
|
||||||
|
|
||||||
assertThat(responseEntity).isNotNull();
|
assertThat(responseEntity).isNotNull();
|
||||||
assertThat(HttpStatus.CREATED).isEqualTo(responseEntity.getStatusCode());
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
|
|
||||||
ResponseEntity<TaskanaPagedModel<ClassificationSummaryRepresentationModel>> response =
|
ResponseEntity<TaskanaPagedModel<ClassificationSummaryRepresentationModel>> response =
|
||||||
template.exchange(
|
template.exchange(
|
||||||
|
|
@ -328,7 +328,6 @@ class ClassificationControllerIntTest {
|
||||||
HttpMethod.DELETE,
|
HttpMethod.DELETE,
|
||||||
request,
|
request,
|
||||||
ParameterizedTypeReference.forType(ClassificationSummaryRepresentationModel.class));
|
ParameterizedTypeReference.forType(ClassificationSummaryRepresentationModel.class));
|
||||||
assertThat(HttpStatus.NO_CONTENT).isEqualTo(response.getStatusCode());
|
|
||||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
|
|
|
||||||
|
|
@ -456,8 +456,8 @@ class TaskControllerIntTest {
|
||||||
assertThat((response.getBody()).getContent()).hasSize(1);
|
assertThat((response.getBody()).getContent()).hasSize(1);
|
||||||
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.LAST).getHref())
|
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.LAST).getHref())
|
||||||
.contains("page=14");
|
.contains("page=14");
|
||||||
assertThat("TKI:100000000000000000000000000000000000")
|
assertThat(response.getBody().getContent().iterator().next().getTaskId())
|
||||||
.isEqualTo(response.getBody().getContent().iterator().next().getTaskId());
|
.isEqualTo("TKI:100000000000000000000000000000000000");
|
||||||
|
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.SELF).getHref())
|
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.SELF).getHref())
|
||||||
|
|
@ -497,8 +497,8 @@ class TaskControllerIntTest {
|
||||||
assertThat((response.getBody()).getContent()).hasSize(5);
|
assertThat((response.getBody()).getContent()).hasSize(5);
|
||||||
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.LAST).getHref())
|
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.LAST).getHref())
|
||||||
.contains("page=10");
|
.contains("page=10");
|
||||||
assertThat("TKI:000000000000000000000000000000000005")
|
assertThat(response.getBody().getContent().iterator().next().getTaskId())
|
||||||
.isEqualTo(response.getBody().getContent().iterator().next().getTaskId());
|
.isEqualTo("TKI:000000000000000000000000000000000005");
|
||||||
|
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.SELF).getHref())
|
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.SELF).getHref())
|
||||||
|
|
@ -591,7 +591,7 @@ class TaskControllerIntTest {
|
||||||
HttpMethod.POST,
|
HttpMethod.POST,
|
||||||
new HttpEntity<>(taskRepresentationModel, restHelper.getHeadersTeamlead_1()),
|
new HttpEntity<>(taskRepresentationModel, restHelper.getHeadersTeamlead_1()),
|
||||||
TASK_MODEL_TYPE);
|
TASK_MODEL_TYPE);
|
||||||
assertThat(HttpStatus.CREATED).isEqualTo(responseCreate.getStatusCode());
|
assertThat(responseCreate.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
assertThat(responseCreate.getBody()).isNotNull();
|
assertThat(responseCreate.getBody()).isNotNull();
|
||||||
|
|
||||||
String taskIdOfCreatedTask = responseCreate.getBody().getTaskId();
|
String taskIdOfCreatedTask = responseCreate.getBody().getTaskId();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue