TSK-512: Improve general exception handling

- Add root cause to taskana exceptions
- Either throw an exception or log the error
- Remove unnecessary exceptions from method signatures
This commit is contained in:
Konstantin Kläger 2018-06-06 17:00:22 +02:00 committed by Holger Hagen
parent 63c3b7ee53
commit 3230e35c2c
83 changed files with 1684 additions and 1961 deletions

View File

@ -10,7 +10,6 @@ import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidOwnerException; import pro.taskana.exceptions.InvalidOwnerException;
import pro.taskana.exceptions.InvalidStateException; import pro.taskana.exceptions.InvalidStateException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskAlreadyExistException;
import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.exceptions.TaskNotFoundException;
@ -25,8 +24,8 @@ public class ExampleBootstrap {
@PostConstruct @PostConstruct
public void init(@Observes @Initialized(ApplicationScoped.class) Object init) public void init(@Observes @Initialized(ApplicationScoped.class) Object init)
throws TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, throws TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException,
ClassificationNotFoundException, InvalidStateException, InvalidOwnerException, InvalidWorkbasketException, ClassificationNotFoundException, InvalidStateException, InvalidOwnerException, TaskAlreadyExistException,
TaskAlreadyExistException, InvalidArgumentException { InvalidArgumentException {
System.out.println("---------------------------> Start App"); System.out.println("---------------------------> Start App");
Task task = taskanaEjb.getTaskService().newTask(null); Task task = taskanaEjb.getTaskService().newTask(null);
ObjectReference objRef = new ObjectReference(); ObjectReference objRef = new ObjectReference();

View File

@ -1,8 +1,9 @@
package pro.taskana; package pro.taskana;
import org.slf4j.Logger; import java.io.IOException;
import org.slf4j.LoggerFactory; import java.io.InputStream;
import pro.taskana.configuration.TaskanaEngineConfiguration; import java.sql.SQLException;
import java.util.Properties;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.ApplicationScoped;
@ -12,64 +13,65 @@ import javax.naming.Context;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.io.IOException;
import java.io.InputStream; import org.slf4j.Logger;
import java.sql.SQLException; import org.slf4j.LoggerFactory;
import java.util.Properties;
import pro.taskana.configuration.TaskanaEngineConfiguration;
@ApplicationScoped @ApplicationScoped
public class TaskanaProducers { public class TaskanaProducers {
private static final Logger logger = LoggerFactory.getLogger(TaskanaProducers.class); private static final Logger logger = LoggerFactory.getLogger(TaskanaProducers.class);
private static final String TASKANA_PROPERTIES = "taskana.properties"; private static final String TASKANA_PROPERTIES = "taskana.properties";
@Inject @Inject
private TaskanaEngine taskanaEngine; private TaskanaEngine taskanaEngine;
private TaskanaEngineConfiguration taskanaEngineConfiguration; private TaskanaEngineConfiguration taskanaEngineConfiguration;
@PostConstruct @PostConstruct
public void init() { public void init() {
// Load Properties and get Datasource via Context // Load Properties and get Datasource via Context
// Load DataSource via Container // Load DataSource via Container
Context ctx; Context ctx;
DataSource dataSource; DataSource dataSource;
ClassLoader classloader = Thread.currentThread().getContextClassLoader(); ClassLoader classloader = Thread.currentThread().getContextClassLoader();
try (InputStream propertyStream = classloader.getResourceAsStream(TASKANA_PROPERTIES)) { try (InputStream propertyStream = classloader.getResourceAsStream(TASKANA_PROPERTIES)) {
Properties properties = new Properties(); Properties properties = new Properties();
ctx = new InitialContext(); ctx = new InitialContext();
properties.load(propertyStream); properties.load(propertyStream);
dataSource = (DataSource) ctx.lookup(properties.getProperty("datasource.jndi")); dataSource = (DataSource) ctx.lookup(properties.getProperty("datasource.jndi"));
logger.debug("---------------> " + dataSource.getConnection().getMetaData()); logger.debug("---------------> " + dataSource.getConnection().getMetaData());
this.taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, true, false); this.taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, true, false);
} catch (NamingException | SQLException | IOException e) { } catch (NamingException | SQLException | IOException e) {
logger.error("Could not start Taskana: ", e); logger.error("Could not start Taskana: ", e);
} }
} }
@ApplicationScoped @ApplicationScoped
@Produces @Produces
public TaskanaEngine generateTaskEngine() throws SQLException { public TaskanaEngine generateTaskEngine() {
return taskanaEngineConfiguration.buildTaskanaEngine(); return taskanaEngineConfiguration.buildTaskanaEngine();
} }
@ApplicationScoped @ApplicationScoped
@Produces @Produces
public TaskService generateTaskService() { public TaskService generateTaskService() {
return taskanaEngine.getTaskService(); return taskanaEngine.getTaskService();
} }
@ApplicationScoped @ApplicationScoped
@Produces @Produces
public ClassificationService generateClassificationService() { public ClassificationService generateClassificationService() {
return taskanaEngine.getClassificationService(); return taskanaEngine.getClassificationService();
} }
@ApplicationScoped @ApplicationScoped
@Produces @Produces
public WorkbasketService generateWorkbasketService() { public WorkbasketService generateWorkbasketService() {
return taskanaEngine.getWorkbasketService(); return taskanaEngine.getWorkbasketService();
} }
} }

View File

@ -5,7 +5,6 @@ import javax.inject.Inject;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskAlreadyExistException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
@ -35,8 +34,7 @@ public class TaskanaEjb {
} }
public void triggerRollback() throws NotAuthorizedException, WorkbasketNotFoundException, public void triggerRollback() throws NotAuthorizedException, WorkbasketNotFoundException,
ClassificationNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException {
InvalidArgumentException {
Task task = taskService.newTask(null); Task task = taskService.newTask(null);
ObjectReference objRef = new ObjectReference(); ObjectReference objRef = new ObjectReference();
objRef.setCompany("aCompany"); objRef.setCompany("aCompany");

View File

@ -5,7 +5,6 @@ import java.sql.DriverManager;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import javax.naming.NamingException;
import javax.ws.rs.client.Client; import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.ClientBuilder;
@ -14,7 +13,6 @@ import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.wildfly.swarm.Swarm; import org.wildfly.swarm.Swarm;
@ -45,12 +43,8 @@ public class TaskanaProducersTest {
return swarm; return swarm;
} }
@Before
public void init() throws SQLException, ClassNotFoundException {
}
@Test @Test
public void testCommit() throws SQLException, ClassNotFoundException, NamingException { public void testCommit() throws SQLException, ClassNotFoundException {
Client client = ClientBuilder.newClient(); Client client = ClientBuilder.newClient();
client.target("http://127.0.0.1:8090/rest/test").request().get(); client.target("http://127.0.0.1:8090/rest/test").request().get();
@ -70,7 +64,7 @@ public class TaskanaProducersTest {
} }
@Test @Test
public void testRollback() throws SQLException, ClassNotFoundException, NamingException { public void testRollback() throws SQLException, ClassNotFoundException {
Client client = ClientBuilder.newClient(); Client client = ClientBuilder.newClient();
client.target("http://127.0.0.1:8090/rest/test").request().post(null); client.target("http://127.0.0.1:8090/rest/test").request().post(null);

View File

@ -66,7 +66,7 @@ public class TaskanaRestTest {
@POST @POST
public Response rollbackTask() public Response rollbackTask()
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
InvalidWorkbasketException, TaskAlreadyExistException, InvalidArgumentException { TaskAlreadyExistException, InvalidArgumentException {
taskanaEjb.triggerRollback(); taskanaEjb.triggerRollback();
return Response.status(204).build(); return Response.status(204).build();
} }
@ -74,8 +74,7 @@ public class TaskanaRestTest {
@DELETE @DELETE
@Path("{id}") @Path("{id}")
public void completeTask(@PathParam("id") String id) public void completeTask(@PathParam("id") String id)
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, ClassificationNotFoundException, throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, NotAuthorizedException {
NotAuthorizedException {
logger.info(id); logger.info(id);
taskanaEjb.getTaskService().forceCompleteTask(id); taskanaEjb.getTaskService().forceCompleteTask(id);
} }

View File

@ -173,7 +173,6 @@ public class TaskanaEngineConfiguration {
if (key != null) { if (key != null) {
roleMap.put(key, roleMemberSet); roleMap.put(key, roleMemberSet);
} else { } else {
LOGGER.error("Internal System error when processing role property {}.", propertyName);
throw new SystemException( throw new SystemException(
"Internal System error when processing role property " + propertyName); "Internal System error when processing role property " + propertyName);
} }
@ -203,8 +202,8 @@ public class TaskanaEngineConfiguration {
LOGGER.debug("Role properties were loaded from file {}.", propertiesFile); LOGGER.debug("Role properties were loaded from file {}.", propertiesFile);
} }
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("caught IOException when processing properties file {}.", propertiesFile); throw new SystemException("internal System error when processing properties file " + propertiesFile,
throw new SystemException("internal System error when processing properties file " + propertiesFile); e.getCause());
} }
return props; return props;
} }

View File

@ -9,7 +9,7 @@ public class AttachmentPersistenceException extends TaskanaException {
private static final long serialVersionUID = 123L; private static final long serialVersionUID = 123L;
public AttachmentPersistenceException(String attachmentId) { public AttachmentPersistenceException(String msg, Throwable cause) {
super("AttachmentId=" + attachmentId); super(msg, cause);
} }
} }

View File

@ -9,5 +9,9 @@ public class ClassificationInUseException extends TaskanaException {
super(msg); super(msg);
} }
public ClassificationInUseException(String msg, Throwable cause) {
super(msg, cause);
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -11,5 +11,9 @@ public class InvalidArgumentException extends TaskanaException {
super(msg); super(msg);
} }
public InvalidArgumentException(String msg, Throwable cause) {
super(msg, cause);
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -9,6 +9,10 @@ public class NotAuthorizedToQueryWorkbasketException extends TaskanaRuntimeExcep
super(msg); super(msg);
} }
public NotAuthorizedToQueryWorkbasketException(String msg, Throwable cause) {
super(msg, cause);
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -9,5 +9,9 @@ public class SystemException extends TaskanaRuntimeException {
super(msg); super(msg);
} }
public SystemException(String msg, Throwable cause) {
super(msg, cause);
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -237,7 +237,8 @@ public class ClassificationServiceImpl implements ClassificationService {
try { try {
Duration.parse(classification.getServiceLevel()); Duration.parse(classification.getServiceLevel());
} catch (Exception e) { } catch (Exception e) {
throw new InvalidArgumentException("Invalid service level. Please use the format defined by ISO 8601"); throw new InvalidArgumentException("Invalid service level. Please use the format defined by ISO 8601",
e.getCause());
} }
} }
@ -278,7 +279,6 @@ public class ClassificationServiceImpl implements ClassificationService {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
result = classificationMapper.findById(id); result = classificationMapper.findById(id);
if (result == null) { if (result == null) {
LOGGER.error("Classification for id {} was not found. Throwing ClassificationNotFoundException", id);
throw new ClassificationNotFoundException(id, "Classification for id " + id + " was not found"); throw new ClassificationNotFoundException(id, "Classification for id " + id + " was not found");
} }
return result; return result;
@ -303,9 +303,6 @@ public class ClassificationServiceImpl implements ClassificationService {
if (result == null) { if (result == null) {
result = classificationMapper.findByKeyAndDomain(key, ""); result = classificationMapper.findByKeyAndDomain(key, "");
if (result == null) { if (result == null) {
LOGGER.error(
"Classification for key {} and domain {} was not found. Throwing ClassificationNotFoundException",
key, domain);
throw new ClassificationNotFoundException(key, domain, throw new ClassificationNotFoundException(key, domain,
"Classification for key " + key + " was not found"); "Classification for key " + key + " was not found");
} }
@ -400,7 +397,8 @@ public class ClassificationServiceImpl implements ClassificationService {
} catch (PersistenceException e) { } catch (PersistenceException e) {
if (isReferentialIntegrityConstraintViolation(e)) { if (isReferentialIntegrityConstraintViolation(e)) {
throw new ClassificationInUseException("The classification " + classificationId throw new ClassificationInUseException("The classification " + classificationId
+ " is in use and cannot be deleted. There are either tasks or attachments associated with the classification."); + " is in use and cannot be deleted. There are either tasks or attachments associated with the classification.",
e.getCause());
} }
} }
} finally { } finally {

View File

@ -332,7 +332,8 @@ public class TaskImpl implements Task {
num = Integer.parseInt(number); num = Integer.parseInt(number);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16"); "Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16",
e.getCause());
} }
switch (num) { switch (num) {
@ -382,7 +383,8 @@ public class TaskImpl implements Task {
num = Integer.parseInt(number); num = Integer.parseInt(number);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16"); "Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16",
e.getCause());
} }
switch (num) { switch (num) {

View File

@ -400,7 +400,8 @@ public class TaskQueryImpl implements TaskQuery {
num = Integer.parseInt(number); num = Integer.parseInt(number);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16"); "Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16",
e.getCause());
} }
switch (num) { switch (num) {
@ -467,7 +468,8 @@ public class TaskQueryImpl implements TaskQuery {
num = Integer.parseInt(number); num = Integer.parseInt(number);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16"); "Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16",
e.getCause());
} }
switch (num) { switch (num) {
@ -851,7 +853,7 @@ public class TaskQueryImpl implements TaskQuery {
} }
} }
} catch (NotAuthorizedException e) { } catch (NotAuthorizedException e) {
throw new NotAuthorizedToQueryWorkbasketException(e.getMessage()); throw new NotAuthorizedToQueryWorkbasketException(e.getMessage(), e.getCause());
} }
} }

View File

@ -38,7 +38,6 @@ import pro.taskana.exceptions.ConcurrencyException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidOwnerException; import pro.taskana.exceptions.InvalidOwnerException;
import pro.taskana.exceptions.InvalidStateException; import pro.taskana.exceptions.InvalidStateException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.SystemException; import pro.taskana.exceptions.SystemException;
import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskAlreadyExistException;
@ -78,8 +77,7 @@ public class TaskServiceImpl implements TaskService {
this.converter = DaysToWorkingDaysConverter this.converter = DaysToWorkingDaysConverter
.initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now()); .initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
} catch (InvalidArgumentException e) { } catch (InvalidArgumentException e) {
LOGGER.error("could not initialize DaysToWorkingDaysConverter. Caught exception " + e); throw new SystemException("Internal error. Cannot initialize DaysToWorkingDaysConverter", e.getCause());
throw new SystemException("Internal error. Cannot initialize DaysToWorkingDaysConverter");
} }
this.taskanaEngine = (TaskanaEngineImpl) taskanaEngine; this.taskanaEngine = (TaskanaEngineImpl) taskanaEngine;
this.taskMapper = taskMapper; this.taskMapper = taskMapper;
@ -363,8 +361,6 @@ public class TaskServiceImpl implements TaskService {
.list(); .list();
if (workbaskets.isEmpty()) { if (workbaskets.isEmpty()) {
String currentUser = CurrentUserContext.getUserid(); String currentUser = CurrentUserContext.getUserid();
LOGGER.error("The current user {} has no read permission for workbasket {}.", currentUser,
workbasketId);
throw new NotAuthorizedException( throw new NotAuthorizedException(
"The current user " + currentUser + " has no read permission for workbasket " + workbasketId); "The current user " + currentUser + " has no read permission for workbasket " + workbasketId);
} else { } else {
@ -388,7 +384,6 @@ public class TaskServiceImpl implements TaskService {
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (classification == null) { if (classification == null) {
LOGGER.error("Could not find a Classification for task {} ", resultTask);
throw new SystemException( throw new SystemException(
"Could not find a Classification for task " + resultTask.getId()); "Could not find a Classification for task " + resultTask.getId());
} }
@ -396,7 +391,6 @@ public class TaskServiceImpl implements TaskService {
resultTask.setClassificationSummary(classification); resultTask.setClassificationSummary(classification);
return resultTask; return resultTask;
} else { } else {
LOGGER.warn("Method getTaskById() didn't find task with id {}. Throwing TaskNotFoundException", id);
throw new TaskNotFoundException(id, "Task with id " + id + " was not found"); throw new TaskNotFoundException(id, "Task with id " + id + " was not found");
} }
} finally { } finally {
@ -407,8 +401,7 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public Task transfer(String taskId, String destinationWorkbasketId) public Task transfer(String taskId, String destinationWorkbasketId)
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidWorkbasketException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException {
InvalidStateException {
LOGGER.debug("entry to transfer(taskId = {}, destinationWorkbasketId = {})", taskId, destinationWorkbasketId); LOGGER.debug("entry to transfer(taskId = {}, destinationWorkbasketId = {})", taskId, destinationWorkbasketId);
TaskImpl task = null; TaskImpl task = null;
try { try {
@ -447,8 +440,7 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public Task transfer(String taskId, String destinationWorkbasketKey, String domain) public Task transfer(String taskId, String destinationWorkbasketKey, String domain)
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidWorkbasketException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException {
InvalidStateException {
LOGGER.debug("entry to transfer(taskId = {}, destinationWorkbasketKey = {}, domain = {})", taskId, LOGGER.debug("entry to transfer(taskId = {}, destinationWorkbasketKey = {}, domain = {})", taskId,
destinationWorkbasketKey, domain); destinationWorkbasketKey, domain);
TaskImpl task = null; TaskImpl task = null;
@ -652,8 +644,7 @@ public class TaskServiceImpl implements TaskService {
@Override @Override
public Task updateTask(Task task) public Task updateTask(Task task)
throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, WorkbasketNotFoundException, throws InvalidArgumentException, TaskNotFoundException, ConcurrencyException, WorkbasketNotFoundException,
ClassificationNotFoundException, InvalidWorkbasketException, NotAuthorizedException, ClassificationNotFoundException, NotAuthorizedException, AttachmentPersistenceException {
AttachmentPersistenceException {
String userId = CurrentUserContext.getUserid(); String userId = CurrentUserContext.getUserid();
LOGGER.debug("entry to updateTask(task = {}, userId = {})", task, userId); LOGGER.debug("entry to updateTask(task = {}, userId = {})", task, userId);
TaskImpl newTaskImpl = (TaskImpl) task; TaskImpl newTaskImpl = (TaskImpl) task;
@ -778,11 +769,9 @@ public class TaskServiceImpl implements TaskService {
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (aClassification == null) { if (aClassification == null) {
LOGGER.error("Didnt find a Classification for task ");
throw new SystemException( throw new SystemException(
"Did not find a Classification for task (Id=" + task.getTaskId() + ",classification=" "Did not find a Classification for task (Id=" + task.getTaskId() + ",classification="
+ task.getClassificationSummary().getId() + task.getClassificationSummary().getId() + ")");
+ ")");
} }
// set the classification on the task object // set the classification on the task object
task.setClassificationSummary(aClassification); task.setClassificationSummary(aClassification);
@ -908,7 +897,6 @@ public class TaskServiceImpl implements TaskService {
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (aClassification == null) { if (aClassification == null) {
LOGGER.error("Could not find a Classification for attachment {}.", att);
throw new SystemException("Could not find a Classification for attachment " + att); throw new SystemException("Could not find a Classification for attachment " + att);
} }
att.setClassificationSummary(aClassification); att.setClassificationSummary(aClassification);
@ -930,7 +918,6 @@ public class TaskServiceImpl implements TaskService {
.orElse(null); .orElse(null);
if (aClassification == null) { if (aClassification == null) {
LOGGER.error("Could not find a Classification for attachment {}.", att);
throw new SystemException("Could not find a Classification for attachment " + att); throw new SystemException("Could not find a Classification for attachment " + att);
} }
att.setClassificationSummary(aClassification); att.setClassificationSummary(aClassification);
@ -1052,8 +1039,6 @@ public class TaskServiceImpl implements TaskService {
} }
if (customFieldsToUpdate == null || customFieldsToUpdate.isEmpty()) { if (customFieldsToUpdate == null || customFieldsToUpdate.isEmpty()) {
LOGGER.warn(
"The customFieldsToUpdate argument to updateTasks must not be empty. Throwing InvalidArgumentException.");
throw new InvalidArgumentException("The customFieldsToUpdate argument to updateTasks must not be empty."); throw new InvalidArgumentException("The customFieldsToUpdate argument to updateTasks must not be empty.");
} }
validateObjectReference(selectionCriteria, "ObjectReference", "updateTasks call"); validateObjectReference(selectionCriteria, "ObjectReference", "updateTasks call");
@ -1070,7 +1055,6 @@ public class TaskServiceImpl implements TaskService {
for (Map.Entry<String, String> entry : customFieldsToUpdate.entrySet()) { for (Map.Entry<String, String> entry : customFieldsToUpdate.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
if (!allowedKeys.contains(key)) { if (!allowedKeys.contains(key)) {
LOGGER.warn("The customFieldsToUpdate argument to updateTasks contains invalid key {}.", key);
throw new InvalidArgumentException( throw new InvalidArgumentException(
"The customFieldsToUpdate argument to updateTasks contains invalid key " + key); "The customFieldsToUpdate argument to updateTasks contains invalid key " + key);
} else { } else {
@ -1165,8 +1149,7 @@ public class TaskServiceImpl implements TaskService {
private void standardUpdateActions(TaskImpl oldTaskImpl, TaskImpl newTaskImpl, private void standardUpdateActions(TaskImpl oldTaskImpl, TaskImpl newTaskImpl,
PrioDurationHolder prioDurationFromAttachments) PrioDurationHolder prioDurationFromAttachments)
throws InvalidArgumentException, ConcurrencyException, WorkbasketNotFoundException, throws InvalidArgumentException, ConcurrencyException, ClassificationNotFoundException {
ClassificationNotFoundException {
validateObjectReference(newTaskImpl.getPrimaryObjRef(), "primary ObjectReference", "Task"); validateObjectReference(newTaskImpl.getPrimaryObjRef(), "primary ObjectReference", "Task");
if (oldTaskImpl.getModified() != null && !oldTaskImpl.getModified().equals(newTaskImpl.getModified()) if (oldTaskImpl.getModified() != null && !oldTaskImpl.getModified().equals(newTaskImpl.getModified())
|| oldTaskImpl.getClaimed() != null && !oldTaskImpl.getClaimed().equals(newTaskImpl.getClaimed()) || oldTaskImpl.getClaimed() != null && !oldTaskImpl.getClaimed().equals(newTaskImpl.getClaimed())
@ -1312,10 +1295,10 @@ public class TaskServiceImpl implements TaskService {
newTaskImpl.getId(), newTaskImpl.getId(),
attachmentImpl); attachmentImpl);
} catch (PersistenceException e) { } catch (PersistenceException e) {
LOGGER.error( throw new AttachmentPersistenceException(
"TaskService.updateTask() for TaskId={} can NOT INSERT the current Attachment, because it was added fored multiple times and wasn´t persisted before. ID={}", "Cannot insert the Attachement " + attachmentImpl.getId() + " for Task "
newTaskImpl.getId(), attachmentImpl.getId()); + newTaskImpl.getId() + " because it already exists.",
throw new AttachmentPersistenceException(attachmentImpl.getId()); e.getCause());
} }
} }
@ -1412,7 +1395,7 @@ public class TaskServiceImpl implements TaskService {
} }
BulkOperationResults<String, Exception> classificationChanged(String taskId, String classificationId) BulkOperationResults<String, Exception> classificationChanged(String taskId, String classificationId)
throws TaskNotFoundException, ClassificationNotFoundException { throws ClassificationNotFoundException {
LOGGER.debug("entry to classificationChanged(taskId = {} , classificationId = {} )", taskId, classificationId); LOGGER.debug("entry to classificationChanged(taskId = {} , classificationId = {} )", taskId, classificationId);
TaskImpl task = null; TaskImpl task = null;
BulkOperationResults<String, Exception> bulkLog = new BulkOperationResults<>(); BulkOperationResults<String, Exception> bulkLog = new BulkOperationResults<>();

View File

@ -372,7 +372,8 @@ public class TaskSummaryImpl implements TaskSummary {
num = Integer.parseInt(number); num = Integer.parseInt(number);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16"); "Argument '" + number + "' to getCustomAttribute cannot be converted to a number between 1 and 16",
e.getCause());
} }
switch (num) { switch (num) {

View File

@ -254,8 +254,7 @@ public class TaskanaEngineImpl implements TaskanaEngine {
try { try {
this.sessionManager.commit(); this.sessionManager.commit();
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("closeSession(): Tried to Autocommit and caught exception" + e); throw new AutocommitFailedException(e.getCause());
throw new AutocommitFailedException(e);
} }
} }
this.sessionManager.close(); this.sessionManager.close();
@ -344,18 +343,13 @@ public class TaskanaEngineImpl implements TaskanaEngine {
} else if (isPostgreSQL(databaseProductName)) { } else if (isPostgreSQL(databaseProductName)) {
configuration.setDatabaseId("postgres"); configuration.setDatabaseId("postgres");
} else { } else {
LOGGER.error(
"Method createSqlSessionManager() didn't find database with name {}. Throwing UnsupportedDatabaseException",
databaseProductName);
throw new UnsupportedDatabaseException(databaseProductName); throw new UnsupportedDatabaseException(databaseProductName);
} }
} catch (SQLException e) { } catch (SQLException e) {
LOGGER.error(
"Method createSqlSessionManager() could not open a connection to the database. No databaseId has been set.",
e);
throw new SystemException( throw new SystemException(
"Method createSqlSessionManager() could not open a connection to the database. No databaseId has been set."); "Method createSqlSessionManager() could not open a connection to the database. No databaseId has been set.",
e.getCause());
} }
// add mappers // add mappers

View File

@ -67,9 +67,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
result = workbasketMapper.findById(workbasketId); result = workbasketMapper.findById(workbasketId);
if (result == null) { if (result == null) {
LOGGER.error(
"Method getWorkbasket() didn't find workbasket with ID {}. Throwing WorkbasketNotFoundException",
workbasketId);
throw new WorkbasketNotFoundException(workbasketId, throw new WorkbasketNotFoundException(workbasketId,
"Workbasket with id " + workbasketId + " was not found."); "Workbasket with id " + workbasketId + " was not found.");
} }
@ -92,9 +89,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
result = workbasketMapper.findByKeyAndDomain(workbasketKey, domain); result = workbasketMapper.findByKeyAndDomain(workbasketKey, domain);
if (result == null) { if (result == null) {
LOGGER.error(
"Method getWorkbasketByKey() didn't find workbasket with key {}. Throwing WorkbasketNotFoundException",
workbasketKey);
throw new WorkbasketNotFoundException(workbasketKey, domain, throw new WorkbasketNotFoundException(workbasketKey, domain,
"Workbasket with key " + workbasketKey + " and domain " + domain + " was not found."); "Workbasket with key " + workbasketKey + " and domain " + domain + " was not found.");
} }
@ -150,9 +144,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
Workbasket existingWorkbasket = workbasketMapper.findByKeyAndDomain(newWorkbasket.getKey(), Workbasket existingWorkbasket = workbasketMapper.findByKeyAndDomain(newWorkbasket.getKey(),
newWorkbasket.getDomain()); newWorkbasket.getDomain());
if (existingWorkbasket != null) { if (existingWorkbasket != null) {
LOGGER.error(
"createWorkbasket failed because Workbasket with key {} and domain {} already exists. Throwing WorkbasketAlreadyExistsException.",
newWorkbasket.getKey(), newWorkbasket.getDomain());
throw new WorkbasketAlreadyExistException(existingWorkbasket); throw new WorkbasketAlreadyExistException(existingWorkbasket);
} }
@ -172,7 +163,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public Workbasket updateWorkbasket(Workbasket workbasketToUpdate) public Workbasket updateWorkbasket(Workbasket workbasketToUpdate)
throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException { throws NotAuthorizedException {
LOGGER.debug("entry to updateWorkbasket(workbasket)", workbasketToUpdate); LOGGER.debug("entry to updateWorkbasket(workbasket)", workbasketToUpdate);
taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);
@ -208,8 +199,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
accessItem.setId(IdGenerator.generateWithPrefix(ID_PREFIX_WORKBASKET_AUTHORIZATION)); accessItem.setId(IdGenerator.generateWithPrefix(ID_PREFIX_WORKBASKET_AUTHORIZATION));
if (workbasketAccessItem.getId() == null || workbasketAccessItem.getAccessId() == null if (workbasketAccessItem.getId() == null || workbasketAccessItem.getAccessId() == null
|| workbasketAccessItem.getWorkbasketId() == null) { || workbasketAccessItem.getWorkbasketId() == null) {
LOGGER.error(
"createWorkbasketAccessItem failed because id, accessId or workbasketId is null. Throwing InvalidArgumentException.");
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Checking the preconditions of the current WorkbasketAccessItem failed. WorkbasketAccessItem=" "Checking the preconditions of the current WorkbasketAccessItem failed. WorkbasketAccessItem="
+ workbasketAccessItem.toString()); + workbasketAccessItem.toString());
@ -243,16 +232,10 @@ public class WorkbasketServiceImpl implements WorkbasketService {
for (WorkbasketAccessItem workbasketAccessItem : wbAccessItems) { for (WorkbasketAccessItem workbasketAccessItem : wbAccessItems) {
WorkbasketAccessItemImpl wbAccessItemImpl = (WorkbasketAccessItemImpl) workbasketAccessItem; WorkbasketAccessItemImpl wbAccessItemImpl = (WorkbasketAccessItemImpl) workbasketAccessItem;
if (wbAccessItemImpl.getWorkbasketId() == null) { if (wbAccessItemImpl.getWorkbasketId() == null) {
LOGGER.error(
"setWorkbasketAccessItem failed because WorkbasketAccessItem {} has a null workbasketId. Throwing InvalidArgumentException.",
workbasketAccessItem);
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Checking the preconditions of the current WorkbasketAccessItem failed - WBID is NULL. WorkbasketAccessItem=" "Checking the preconditions of the current WorkbasketAccessItem failed - WBID is NULL. WorkbasketAccessItem="
+ workbasketAccessItem.toString()); + workbasketAccessItem.toString());
} else if (!wbAccessItemImpl.getWorkbasketId().equals(workbasketId)) { } else if (!wbAccessItemImpl.getWorkbasketId().equals(workbasketId)) {
LOGGER.error(
"setWorkbasketAccessItem failed because WorkbasketAccessItem {} does not refer to workbasket {}. Throwing InvalidArgumentException.",
workbasketAccessItem, workbasketId);
throw new InvalidArgumentException( throw new InvalidArgumentException(
"Checking the preconditions of the current WorkbasketAccessItem failed - the WBID does not match. Target-WBID='" "Checking the preconditions of the current WorkbasketAccessItem failed - the WBID does not match. Target-WBID='"
+ workbasketId + "' WorkbasketAccessItem=" + workbasketId + "' WorkbasketAccessItem="
@ -311,8 +294,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
if (workbasketMapper.findById(workbasketId) == null) { if (workbasketMapper.findById(workbasketId) == null) {
LOGGER.error("Throwing WorkbasketNotFoundException because workbasket with id {} does not exist",
workbasketId);
throw new WorkbasketNotFoundException(workbasketId, throw new WorkbasketNotFoundException(workbasketId,
"Workbasket with id " + workbasketId + " was not found."); "Workbasket with id " + workbasketId + " was not found.");
} }
@ -326,9 +307,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
WorkbasketAccessItem wbAcc = workbasketAccessMapper.findByWorkbasketAndAccessId(workbasketId, WorkbasketAccessItem wbAcc = workbasketAccessMapper.findByWorkbasketAndAccessId(workbasketId,
accessIds); accessIds);
if (wbAcc == null) { if (wbAcc == null) {
LOGGER.error(
"AccessIds {} do not have permission {} on workbasket with id {}. Throwing NotAuthorizedException.",
LoggerUtils.listToString(accessIds), Arrays.toString(requestedPermissions), workbasketId);
throw new NotAuthorizedException( throw new NotAuthorizedException(
"Not authorized. Permission '" + Arrays.toString(requestedPermissions) + "' on workbasket '" "Not authorized. Permission '" + Arrays.toString(requestedPermissions) + "' on workbasket '"
+ workbasketId + workbasketId
@ -340,9 +318,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
for (WorkbasketPermission perm : requestedPermissions) { for (WorkbasketPermission perm : requestedPermissions) {
if (!grantedPermissions.contains(perm)) { if (!grantedPermissions.contains(perm)) {
isAuthorized = false; isAuthorized = false;
LOGGER.error(
"AccessIds {} do not have permission {} on workbasket with id {}. Throwing NotAuthorizedException.",
LoggerUtils.listToString(accessIds), perm.name(), workbasketId);
throw new NotAuthorizedException( throw new NotAuthorizedException(
"Not authorized. Permission '" + perm.name() + "' on workbasket '" + workbasketId "Not authorized. Permission '" + perm.name() + "' on workbasket '" + workbasketId
+ "' is needed."); + "' is needed.");
@ -363,9 +338,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
taskanaEngine.openConnection(); taskanaEngine.openConnection();
if (workbasketMapper.findByKeyAndDomain(workbasketKey, domain) == null) { if (workbasketMapper.findByKeyAndDomain(workbasketKey, domain) == null) {
LOGGER.error(
"Throwing WorkbasketNotFoundException because workbasket with key {} and domain {} does not exist",
workbasketKey, domain);
throw new WorkbasketNotFoundException(workbasketKey, domain, throw new WorkbasketNotFoundException(workbasketKey, domain,
"Workbasket with key " + workbasketKey + " and domain " + domain + " was not found"); "Workbasket with key " + workbasketKey + " and domain " + domain + " was not found");
} }
@ -377,9 +349,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
WorkbasketAccessItem wbAcc = workbasketAccessMapper.findByWorkbasketKeyDomainAndAccessId( WorkbasketAccessItem wbAcc = workbasketAccessMapper.findByWorkbasketKeyDomainAndAccessId(
workbasketKey, domain, accessIds); workbasketKey, domain, accessIds);
if (wbAcc == null) { if (wbAcc == null) {
LOGGER.error(
"AccessIds {} do not have permission {} on workbasket with key {} and domain {}. Throwing NotAuthorizedException.",
LoggerUtils.listToString(accessIds), Arrays.toString(requestedPermissions), workbasketKey, domain);
throw new NotAuthorizedException( throw new NotAuthorizedException(
"Not authorized. Permission '" + Arrays.toString(requestedPermissions) "Not authorized. Permission '" + Arrays.toString(requestedPermissions)
+ "' on workbasket with key '" + "' on workbasket with key '"
@ -391,9 +360,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
for (WorkbasketPermission perm : requestedPermissions) { for (WorkbasketPermission perm : requestedPermissions) {
if (!grantedPermissions.contains(perm)) { if (!grantedPermissions.contains(perm)) {
isAuthorized = false; isAuthorized = false;
LOGGER.error(
"AccessIds {} do not have permission {} on workbasket with key {} and domain {}. Throwing NotAuthorizedException.",
LoggerUtils.listToString(accessIds), perm.name(), workbasketKey, domain);
throw new NotAuthorizedException( throw new NotAuthorizedException(
"Not authorized. Permission '" + perm.name() + "' on workbasket with key '" + workbasketKey "Not authorized. Permission '" + perm.name() + "' on workbasket with key '" + workbasketKey
+ "' and domain '" + domain + "' is needed."); + "' and domain '" + domain + "' is needed.");
@ -746,7 +712,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
@Override @Override
public void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId) public void removeDistributionTarget(String sourceWorkbasketId, String targetWorkbasketId)
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException {
LOGGER.debug("entry to removeDistributionTarget(sourceWorkbasketId = {}, targetWorkbasketId = {})", LOGGER.debug("entry to removeDistributionTarget(sourceWorkbasketId = {}, targetWorkbasketId = {})",
sourceWorkbasketId, targetWorkbasketId); sourceWorkbasketId, targetWorkbasketId);
taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN); taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN, TaskanaRole.ADMIN);

View File

@ -62,7 +62,7 @@ public class MapTypeHandler extends BaseTypeHandler<Map> {
return null; return null;
} }
private Map convertToMap(String fieldValue) throws SQLException { private Map convertToMap(String fieldValue) {
JSONObject jsonObj = new JSONObject(fieldValue); JSONObject jsonObj = new JSONObject(fieldValue);
return jsonObj.toMap(); return jsonObj.toMap();
} }

View File

@ -23,7 +23,6 @@ import pro.taskana.TimeInterval;
import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.database.TestDataGenerator; import pro.taskana.database.TestDataGenerator;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.configuration.DBCleaner; import pro.taskana.impl.configuration.DBCleaner;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
@ -78,7 +77,7 @@ public abstract class AbstractAccTest {
protected Attachment createAttachment(String classificationKey, ObjectReference objRef, protected Attachment createAttachment(String classificationKey, ObjectReference objRef,
String channel, String receivedDate, Map<String, String> customAttributes) String channel, String receivedDate, Map<String, String> customAttributes)
throws ClassificationNotFoundException, NotAuthorizedException { throws ClassificationNotFoundException {
Attachment attachment = taskanaEngine.getTaskService().newAttachment(); Attachment attachment = taskanaEngine.getTaskService().newAttachment();
attachment.setClassificationSummary( attachment.setClassificationSummary(

View File

@ -102,7 +102,7 @@ public class CreateClassificationAccTest extends AbstractAccTest {
@Test @Test
public void testCreateClassificationWithInvalidValues() public void testCreateClassificationWithInvalidValues()
throws ClassificationAlreadyExistException, NotAuthorizedException, ClassificationNotFoundException, throws ClassificationAlreadyExistException, NotAuthorizedException, ClassificationNotFoundException,
DomainNotFoundException, InvalidArgumentException { DomainNotFoundException {
long amountOfClassificationsBefore = classificationService.createClassificationQuery().count(); long amountOfClassificationsBefore = classificationService.createClassificationQuery().count();
// Check key NULL // Check key NULL

View File

@ -6,8 +6,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -38,7 +36,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testDeleteClassificationInDomain() public void testDeleteClassificationInDomain()
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException { throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
classificationService.deleteClassification("L140101", "DOMAIN_A"); classificationService.deleteClassification("L140101", "DOMAIN_A");
Classification classification = classificationService.getClassification("L140101", "DOMAIN_A"); Classification classification = classificationService.getClassification("L140101", "DOMAIN_A");
@ -51,7 +49,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testDeleteClassificationInDomainUserIsNotAuthorized() public void testDeleteClassificationInDomainUserIsNotAuthorized()
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException { throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
classificationService.deleteClassification("L140101", "DOMAIN_A"); classificationService.deleteClassification("L140101", "DOMAIN_A");
fail("NotAuthorizedException should have been thrown"); fail("NotAuthorizedException should have been thrown");
} }
@ -61,7 +59,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
groupNames = {"group_1", "businessadmin"}) groupNames = {"group_1", "businessadmin"})
@Test(expected = ClassificationInUseException.class) @Test(expected = ClassificationInUseException.class)
public void testThrowExeptionIfDeleteClassificationWithExistingTasks() public void testThrowExeptionIfDeleteClassificationWithExistingTasks()
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException { throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
classificationService.deleteClassification("L1050", "DOMAIN_A"); classificationService.deleteClassification("L1050", "DOMAIN_A");
} }
@ -70,7 +68,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
groupNames = {"group_1", "businessadmin"}) groupNames = {"group_1", "businessadmin"})
@Test(expected = ClassificationInUseException.class) @Test(expected = ClassificationInUseException.class)
public void testThrowExeptionIfDeleteMasterClassificationWithExistingTasks() public void testThrowExeptionIfDeleteMasterClassificationWithExistingTasks()
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException { throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
classificationService.deleteClassification("L1050", ""); classificationService.deleteClassification("L1050", "");
} }
@ -79,7 +77,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testDeleteMasterClassification() public void testDeleteMasterClassification()
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException { throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
classificationService.deleteClassification("L3060", ""); classificationService.deleteClassification("L3060", "");
@ -97,7 +95,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test(expected = ClassificationInUseException.class) @Test(expected = ClassificationInUseException.class)
public void testDeleteMasterClassificationWithExistingAttachment() public void testDeleteMasterClassificationWithExistingAttachment()
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException { throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
classificationService.deleteClassification("L12010", ""); classificationService.deleteClassification("L12010", "");
@ -115,7 +113,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
groupNames = {"group_1", "businessadmin"}) groupNames = {"group_1", "businessadmin"})
@Test @Test
public void testThrowExceptionWhenChildClassificationIsInUseAndRollback() public void testThrowExceptionWhenChildClassificationIsInUseAndRollback()
throws ClassificationInUseException, NotAuthorizedException, ClassificationNotFoundException { throws NotAuthorizedException, ClassificationNotFoundException {
boolean classificationInUse = false; boolean classificationInUse = false;
try { try {
classificationService.deleteClassification("L11010", "DOMAIN_A"); classificationService.deleteClassification("L11010", "DOMAIN_A");

View File

@ -3,7 +3,6 @@ package acceptance.classification;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -12,9 +11,6 @@ import org.junit.Test;
import acceptance.AbstractAccTest; import acceptance.AbstractAccTest;
import pro.taskana.ClassificationService; import pro.taskana.ClassificationService;
import pro.taskana.ClassificationSummary; import pro.taskana.ClassificationSummary;
import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
/** /**
* Acceptance test for all "get classification" scenarios. * Acceptance test for all "get classification" scenarios.
@ -26,8 +22,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryClassificationValuesForColumnName() public void testQueryClassificationValuesForColumnName() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<String> columnValueList = classificationService.createClassificationQuery() List<String> columnValueList = classificationService.createClassificationQuery()
.listValues("NAME", null); .listValues("NAME", null);
@ -59,8 +54,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindClassificationsByCategoryAndDomain() public void testFindClassificationsByCategoryAndDomain() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.categoryIn("MANUAL") .categoryIn("MANUAL")
@ -72,8 +66,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetOneClassificationForMultipleDomains() public void testGetOneClassificationForMultipleDomains() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.keyIn("L10000") .keyIn("L10000")
@ -85,8 +78,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsForTypeAndParent() public void testGetClassificationsForTypeAndParent() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.typeIn("TASK", "DOCUMENT") .typeIn("TASK", "DOCUMENT")
@ -110,8 +102,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsForKeyAndCategories() public void testGetClassificationsForKeyAndCategories() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.keyIn("T2100", "L10000") .keyIn("T2100", "L10000")
@ -135,8 +126,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsWithParentKey() public void testGetClassificationsWithParentKey() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.keyIn("A12", "A13") .keyIn("A12", "A13")
@ -159,8 +149,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsWithCustom1() public void testGetClassificationsWithCustom1() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.custom1Like("VNR,RVNR,KOLVNR", "VNR") .custom1Like("VNR,RVNR,KOLVNR", "VNR")
@ -171,8 +160,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsWithCustom1Like() public void testGetClassificationsWithCustom1Like() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.custom1Like("%RVNR%") .custom1Like("%RVNR%")
@ -184,8 +172,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsWithParentAndCustom2() public void testGetClassificationsWithParentAndCustom2() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.parentIdIn("CLI:100000000000000000000000000000000004") .parentIdIn("CLI:100000000000000000000000000000000004")
@ -197,8 +184,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindClassificationsByCreatedTimestamp() public void testFindClassificationsByCreatedTimestamp() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -210,8 +196,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindClassificationsByPriorityAndValidInDomain() public void testFindClassificationsByPriorityAndValidInDomain() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> list = classificationService.createClassificationQuery() List<ClassificationSummary> list = classificationService.createClassificationQuery()
.validInDomainEquals(Boolean.TRUE) .validInDomainEquals(Boolean.TRUE)

View File

@ -27,7 +27,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetFirstPageOfClassificationQueryWithOffset() throws NotAuthorizedException { public void testGetFirstPageOfClassificationQueryWithOffset() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -36,7 +36,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetSecondPageOfClassificationQueryWithOffset() throws NotAuthorizedException { public void testGetSecondPageOfClassificationQueryWithOffset() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -45,7 +45,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testListOffsetAndLimitOutOfBounds() throws NotAuthorizedException { public void testListOffsetAndLimitOutOfBounds() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
// both will be 0, working // both will be 0, working
@ -68,7 +68,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testPaginationWithPages() throws NotAuthorizedException { public void testPaginationWithPages() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
// Getting full page // Getting full page
@ -105,7 +105,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testPaginationNullAndNegativeLimitsIgnoring() throws NotAuthorizedException { public void testPaginationNullAndNegativeLimitsIgnoring() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
// 0 limit/size = 0 results // 0 limit/size = 0 results
@ -153,8 +153,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testCountOfClassificationsQuery() public void testCountOfClassificationsQuery() {
throws NotAuthorizedException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
long count = classificationService.createClassificationQuery() long count = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")

View File

@ -7,7 +7,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
@ -50,7 +49,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testUpdateClassification() public void testUpdateClassification()
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
InvalidArgumentException { InvalidArgumentException {
String newName = "updated Name"; String newName = "updated Name";
String newEntryPoint = "updated EntryPoint"; String newEntryPoint = "updated EntryPoint";
@ -89,7 +88,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testUpdateClassificationFails() public void testUpdateClassificationFails()
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
InvalidArgumentException { InvalidArgumentException {
String newName = "updated Name"; String newName = "updated Name";
String newEntryPoint = "updated EntryPoint"; String newEntryPoint = "updated EntryPoint";
@ -188,7 +187,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
groupNames = {"admin"}) groupNames = {"admin"})
@Test @Test
public void testUpdateClassificationPrioServiceLevel() public void testUpdateClassificationPrioServiceLevel()
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
InterruptedException, TaskNotFoundException, InvalidArgumentException { InterruptedException, TaskNotFoundException, InvalidArgumentException {
String newEntryPoint = "updated EntryPoint"; String newEntryPoint = "updated EntryPoint";
Instant before = Instant.now(); Instant before = Instant.now();

View File

@ -54,7 +54,7 @@ public class TaskanaRoleConfigAccTest extends TaskanaEngineImpl {
} }
@Test @Test
public void testOtherConfigFileSameDelimiter() throws IOException, SQLException { public void testOtherConfigFileSameDelimiter() throws IOException {
String propertiesFileName = createNewConfigFileWithSameDelimiter("/dummyTestConfig.properties"); String propertiesFileName = createNewConfigFileWithSameDelimiter("/dummyTestConfig.properties");
try { try {
getConfiguration().initTaskanaProperties(propertiesFileName, "|"); getConfiguration().initTaskanaProperties(propertiesFileName, "|");
@ -81,7 +81,7 @@ public class TaskanaRoleConfigAccTest extends TaskanaEngineImpl {
} }
@Test @Test
public void testOtherConfigFileDifferentDelimiter() throws IOException, SQLException { public void testOtherConfigFileDifferentDelimiter() throws IOException {
String delimiter = ";"; String delimiter = ";";
String propertiesFileName = createNewConfigFileWithDifferentDelimiter("/dummyTestConfig.properties", delimiter); String propertiesFileName = createNewConfigFileWithDifferentDelimiter("/dummyTestConfig.properties", delimiter);
try { try {

View File

@ -3,7 +3,6 @@ package acceptance.objectreference;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Test; import org.junit.Test;
@ -11,9 +10,6 @@ import org.junit.Test;
import acceptance.AbstractAccTest; import acceptance.AbstractAccTest;
import pro.taskana.ObjectReference; import pro.taskana.ObjectReference;
import pro.taskana.TaskQuery; import pro.taskana.TaskQuery;
import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
/** /**
* Acceptance test for all "get classification" scenarios. * Acceptance test for all "get classification" scenarios.
@ -42,8 +38,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceByCompany() public void testFindObjectReferenceByCompany() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()
@ -55,8 +50,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceBySystem() public void testFindObjectReferenceBySystem() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()
@ -69,8 +63,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceBySystemInstance() public void testFindObjectReferenceBySystemInstance() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()
@ -83,8 +76,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceByType() public void testFindObjectReferenceByType() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()
@ -96,8 +88,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceByValue() public void testFindObjectReferenceByValue() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()

View File

@ -41,20 +41,20 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
} }
@Test @Test
public void testGetFirstPageOfObjectRefQueryWithOffset() throws NotAuthorizedException { public void testGetFirstPageOfObjectRefQueryWithOffset() {
List<ObjectReference> results = objRefQuery.list(0, 5); List<ObjectReference> results = objRefQuery.list(0, 5);
assertThat(results.size(), equalTo(3)); assertThat(results.size(), equalTo(3));
} }
@Test @Test
public void testGetSecondPageOfObjectRefQueryWithOffset() throws NotAuthorizedException { public void testGetSecondPageOfObjectRefQueryWithOffset() {
List<ObjectReference> results = objRefQuery.list(2, 5); List<ObjectReference> results = objRefQuery.list(2, 5);
assertThat(results.size(), equalTo(1)); assertThat(results.size(), equalTo(1));
} }
@Test @Test
public void testListOffsetAndLimitOutOfBounds() throws NotAuthorizedException { public void testListOffsetAndLimitOutOfBounds() {
// both will be 0, working // both will be 0, working
List<ObjectReference> results = objRefQuery.list(-1, -3); List<ObjectReference> results = objRefQuery.list(-1, -3);
assertThat(results.size(), equalTo(0)); assertThat(results.size(), equalTo(0));
@ -69,7 +69,7 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
} }
@Test @Test
public void testPaginationWithPages() throws NotAuthorizedException { public void testPaginationWithPages() {
// Getting full page // Getting full page
int pageNumber = 1; int pageNumber = 1;
int pageSize = 10; int pageSize = 10;
@ -96,7 +96,7 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
} }
@Test @Test
public void testPaginationNullAndNegativeLimitsIgnoring() throws NotAuthorizedException { public void testPaginationNullAndNegativeLimitsIgnoring() {
// 0 limit/size = 0 results // 0 limit/size = 0 results
int pageNumber = 2; int pageNumber = 2;
int pageSize = 0; int pageSize = 0;
@ -132,8 +132,7 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
} }
@Test @Test
public void testCountOfClassificationsQuery() public void testCountOfClassificationsQuery() {
throws NotAuthorizedException {
long count = objRefQuery.count(); long count = objRefQuery.count();
assertThat(count, equalTo(3L)); assertThat(count, equalTo(3L));
} }

View File

@ -3,7 +3,6 @@ package acceptance.security;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Test; import org.junit.Test;
@ -12,9 +11,6 @@ import org.junit.runner.RunWith;
import acceptance.AbstractAccTest; import acceptance.AbstractAccTest;
import pro.taskana.ClassificationService; import pro.taskana.ClassificationService;
import pro.taskana.ClassificationSummary; import pro.taskana.ClassificationSummary;
import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId; import pro.taskana.security.WithAccessId;
@ -31,8 +27,7 @@ public class ClassificationQueryAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindClassificationsByDomainUnauthenticated() public void testFindClassificationsByDomainUnauthenticated() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -44,8 +39,7 @@ public class ClassificationQueryAccTest extends AbstractAccTest {
@WithAccessId(userName = "businessadmin") @WithAccessId(userName = "businessadmin")
@Test @Test
public void testFindClassificationsByDomainBusinessAdmin() public void testFindClassificationsByDomainBusinessAdmin() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -57,8 +51,7 @@ public class ClassificationQueryAccTest extends AbstractAccTest {
@WithAccessId(userName = "admin") @WithAccessId(userName = "admin")
@Test @Test
public void testFindClassificationsByDomainAdmin() public void testFindClassificationsByDomainAdmin() {
throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")

View File

@ -1,6 +1,5 @@
package acceptance.security; package acceptance.security;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Assert; import org.junit.Assert;
@ -27,8 +26,7 @@ public class WorkbasketQueryAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryWorkbasketByUnauthenticated() public void testQueryWorkbasketByUnauthenticated() throws InvalidArgumentException {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
@ -50,8 +48,7 @@ public class WorkbasketQueryAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "unknown") userName = "unknown")
@Test @Test
public void testQueryWorkbasketByUnknownUser() public void testQueryWorkbasketByUnknownUser() throws InvalidArgumentException {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
@ -74,8 +71,7 @@ public class WorkbasketQueryAccTest extends AbstractAccTest {
userName = "unknown", userName = "unknown",
groupNames = "businessadmin") groupNames = "businessadmin")
@Test @Test
public void testQueryWorkbasketByBusinessAdmin() public void testQueryWorkbasketByBusinessAdmin() throws NotAuthorizedException, InvalidArgumentException {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
@ -95,8 +91,7 @@ public class WorkbasketQueryAccTest extends AbstractAccTest {
userName = "unknown", userName = "unknown",
groupNames = "admin") groupNames = "admin")
@Test @Test
public void testQueryWorkbasketByAdmin() public void testQueryWorkbasketByAdmin() throws NotAuthorizedException, InvalidArgumentException {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")

View File

@ -7,7 +7,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.Collections; import java.util.Collections;
@ -26,9 +25,7 @@ import pro.taskana.TaskState;
import pro.taskana.Workbasket; import pro.taskana.Workbasket;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.ConcurrencyException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskAlreadyExistException;
import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.exceptions.TaskNotFoundException;
@ -58,8 +55,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCreateSimpleManualTask() public void testCreateSimpleManualTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException { WorkbasketNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
@ -90,8 +87,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCreateSimpleTaskWithCustomAttributes() public void testCreateSimpleTaskWithCustomAttributes()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException { WorkbasketNotFoundException, TaskAlreadyExistException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
@ -157,9 +154,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCreateExternalTaskWithAttachment() public void testCreateExternalTaskWithAttachment()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, TaskNotFoundException {
ConcurrencyException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
@ -223,8 +219,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCreateExternalTaskWithMultipleAttachments() public void testCreateExternalTaskWithMultipleAttachments()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException { WorkbasketNotFoundException, TaskAlreadyExistException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
@ -260,8 +256,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPrioDurationOfTaskFromAttachmentsAtCreate() public void testPrioDurationOfTaskFromAttachmentsAtCreate()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException { WorkbasketNotFoundException, TaskAlreadyExistException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
@ -306,8 +302,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfAttachmentIsInvalid() public void testThrowsExceptionIfAttachmentIsInvalid()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException { WorkbasketNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = makeNewTask(taskService); Task newTask = makeNewTask(taskService);
@ -378,7 +374,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
} }
} }
private Task makeNewTask(TaskService taskService) throws ClassificationNotFoundException { private Task makeNewTask(TaskService taskService) {
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
newTask.setClassificationKey("L12010"); newTask.setClassificationKey("L12010");
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567")); newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
@ -391,8 +387,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUseCustomNameIfSetForNewTask() public void testUseCustomNameIfSetForNewTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException { WorkbasketNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
@ -411,8 +407,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUseClassificationMetadataFromCorrectDomainForNewTask() public void testUseClassificationMetadataFromCorrectDomainForNewTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException { WorkbasketNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
@ -431,8 +427,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = WorkbasketNotFoundException.class) @Test(expected = WorkbasketNotFoundException.class)
public void testGetExceptionIfWorkbasketDoesNotExist() public void testGetExceptionIfWorkbasketDoesNotExist()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException { WorkbasketNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("UNKNOWN"); Task newTask = taskService.newTask("UNKNOWN");
@ -446,8 +442,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testGetExceptionIfAppendIsNotPermitted() public void testGetExceptionIfAppendIsNotPermitted()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException { WorkbasketNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("GPK_KSC", "DOMAIN_A"); Task newTask = taskService.newTask("GPK_KSC", "DOMAIN_A");
@ -461,8 +457,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete() public void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException { WorkbasketNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
@ -535,8 +531,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testSetDomainFromWorkbasket() public void testSetDomainFromWorkbasket()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException { WorkbasketNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -559,8 +555,8 @@ public class CreateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCreatedTaskObjectEqualsReadTaskObject() public void testCreatedTaskObjectEqualsReadTaskObject()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException { WorkbasketNotFoundException, TaskAlreadyExistException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");

View File

@ -4,7 +4,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -64,7 +63,7 @@ public class DeleteTaskAccTest extends AbstractAccTest {
groupNames = {"group_1", "admin"}) groupNames = {"group_1", "admin"})
@Test(expected = InvalidStateException.class) @Test(expected = InvalidStateException.class)
public void testThrowsExceptionIfTaskIsNotCompleted() public void testThrowsExceptionIfTaskIsNotCompleted()
throws TaskNotFoundException, InvalidStateException, SQLException, NotAuthorizedException { throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000029"); Task task = taskService.getTask("TKI:000000000000000000000000000000000029");
@ -76,7 +75,7 @@ public class DeleteTaskAccTest extends AbstractAccTest {
groupNames = {"group_1", "admin"}) groupNames = {"group_1", "admin"})
@Test(expected = TaskNotFoundException.class) @Test(expected = TaskNotFoundException.class)
public void testForceDeleteTaskIfNotCompleted() public void testForceDeleteTaskIfNotCompleted()
throws SQLException, TaskNotFoundException, InvalidStateException, NotAuthorizedException { throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000027"); Task task = taskService.getTask("TKI:000000000000000000000000000000000027");
try { try {

View File

@ -6,7 +6,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.sql.SQLException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -79,8 +78,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryForOwnerLike() public void testQueryForOwnerLike() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -102,8 +100,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryForParentBusinessProcessId() public void testQueryForParentBusinessProcessId() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -126,8 +123,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryForName() public void testQueryForName() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -150,8 +146,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryForClassificationKey() public void testQueryForClassificationKey() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -175,7 +170,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForAttachmentInSummary() public void testQueryForAttachmentInSummary()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
TaskNotFoundException, WorkbasketNotFoundException, ConcurrencyException, InvalidWorkbasketException, TaskNotFoundException, WorkbasketNotFoundException, ConcurrencyException, InvalidWorkbasketException,
AttachmentPersistenceException { AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -201,8 +196,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForWorkbasketKeyDomain() public void testQueryForWorkbasketKeyDomain() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<KeyDomain> workbasketIdentifiers = Arrays.asList(new KeyDomain("GPK_KSC", "DOMAIN_A"), List<KeyDomain> workbasketIdentifiers = Arrays.asList(new KeyDomain("GPK_KSC", "DOMAIN_A"),
new KeyDomain("USER_1_2", "DOMAIN_A")); new KeyDomain("USER_1_2", "DOMAIN_A"));
@ -228,7 +222,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom1() public void testQueryForCustom1()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -262,7 +256,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom2() public void testQueryForCustom2()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -296,7 +290,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom3() public void testQueryForCustom3()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -330,7 +324,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom4() public void testQueryForCustom4()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -364,7 +358,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom5() public void testQueryForCustom5()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -398,7 +392,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom6() public void testQueryForCustom6()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -432,7 +426,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom7() public void testQueryForCustom7()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -466,7 +460,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom8() public void testQueryForCustom8()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -500,7 +494,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom9() public void testQueryForCustom9()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -534,7 +528,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom10() public void testQueryForCustom10()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -568,8 +562,8 @@ public class QueryTasksAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryTaskByCustomAttributes() public void testQueryTaskByCustomAttributes()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException { WorkbasketNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A"); Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");

View File

@ -1,6 +1,5 @@
package acceptance.task; package acceptance.task;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Assert; import org.junit.Assert;
@ -10,8 +9,6 @@ import org.junit.runner.RunWith;
import acceptance.AbstractAccTest; import acceptance.AbstractAccTest;
import pro.taskana.TaskService; import pro.taskana.TaskService;
import pro.taskana.TaskSummary; import pro.taskana.TaskSummary;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.SystemException; import pro.taskana.exceptions.SystemException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId; import pro.taskana.security.WithAccessId;
@ -31,7 +28,7 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryTasksByExcactValueOfObjectReference() public void testQueryTasksByExcactValueOfObjectReference()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException { throws SystemException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceValueIn("11223344", "22334455") .primaryObjectReferenceValueIn("11223344", "22334455")
@ -44,7 +41,7 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryTasksByExcactValueAndTypeOfObjectReference() public void testQueryTasksByExcactValueAndTypeOfObjectReference()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException { throws SystemException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceTypeIn("SDNR") .primaryObjectReferenceTypeIn("SDNR")
@ -58,7 +55,7 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryTasksByValueLikeOfObjectReference() public void testQueryTasksByValueLikeOfObjectReference()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException { throws SystemException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceValueLike("%567%") .primaryObjectReferenceValueLike("%567%")

View File

@ -3,7 +3,6 @@ package acceptance.task;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import java.sql.SQLException;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
@ -16,8 +15,6 @@ import pro.taskana.BaseQuery.SortDirection;
import pro.taskana.TaskService; import pro.taskana.TaskService;
import pro.taskana.TaskSummary; import pro.taskana.TaskSummary;
import pro.taskana.TimeInterval; import pro.taskana.TimeInterval;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId; import pro.taskana.security.WithAccessId;
@ -38,8 +35,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testCreatedWithin2Intervals() public void testCreatedWithin2Intervals() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval( TimeInterval interval1 = new TimeInterval(
@ -71,8 +67,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testCreatedBefore() public void testCreatedBefore() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval( TimeInterval interval1 = new TimeInterval(
@ -101,8 +96,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testCreatedAfter() public void testCreatedAfter() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval( TimeInterval interval1 = new TimeInterval(
@ -130,8 +124,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testClaimedWithin2Intervals() public void testClaimedWithin2Intervals() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval( TimeInterval interval1 = new TimeInterval(
@ -163,8 +156,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testCompletedWithin() public void testCompletedWithin() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval( TimeInterval interval = new TimeInterval(
@ -192,8 +184,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testModifiedWithin() public void testModifiedWithin() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval( TimeInterval interval = new TimeInterval(
@ -221,8 +212,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testPlannedWithin() public void testPlannedWithin() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval( TimeInterval interval = new TimeInterval(
@ -250,8 +240,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testDueWithin() public void testDueWithin() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval( TimeInterval interval = new TimeInterval(

View File

@ -1,7 +1,5 @@
package acceptance.task; package acceptance.task;
import java.sql.SQLException;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -9,8 +7,6 @@ import org.junit.runner.RunWith;
import acceptance.AbstractAccTest; import acceptance.AbstractAccTest;
import pro.taskana.KeyDomain; import pro.taskana.KeyDomain;
import pro.taskana.TaskService; import pro.taskana.TaskService;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException; import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId; import pro.taskana.security.WithAccessId;
@ -30,8 +26,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = NotAuthorizedToQueryWorkbasketException.class) @Test(expected = NotAuthorizedToQueryWorkbasketException.class)
public void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket() public void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
taskService.createTaskQuery() taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_2_1", "DOMAIN_A")) .workbasketKeyDomainIn(new KeyDomain("USER_2_1", "DOMAIN_A"))
@ -43,8 +38,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = NotAuthorizedToQueryWorkbasketException.class) @Test(expected = NotAuthorizedToQueryWorkbasketException.class)
public void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket() public void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
taskService.createTaskQuery() taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_1_1", "DOMAIN_A"), new KeyDomain("USER_2_1", "DOMAIN_A")) .workbasketKeyDomainIn(new KeyDomain("USER_1_1", "DOMAIN_A"), new KeyDomain("USER_2_1", "DOMAIN_A"))

View File

@ -34,8 +34,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetFirstPageOfTaskQueryWithOffset() public void testGetFirstPageOfTaskQueryWithOffset() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")) .workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A"))
@ -47,8 +46,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testSecondPageOfTaskQueryWithOffset() public void testSecondPageOfTaskQueryWithOffset() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")) .workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A"))
@ -60,8 +58,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testListOffsetAndLimitOutOfBounds() public void testListOffsetAndLimitOutOfBounds() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// both will be 0, working // both will be 0, working
@ -87,8 +84,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPaginationWithPages() public void testPaginationWithPages() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// Getting full page // Getting full page
@ -128,8 +124,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPaginationNullAndNegativeLimitsIgnoring() public void testPaginationNullAndNegativeLimitsIgnoring() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// 0 limit/size = 0 results // 0 limit/size = 0 results
@ -186,8 +181,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCountOfTaskQuery() public void testCountOfTaskQuery() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
long count = taskService.createTaskQuery() long count = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")) .workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A"))

View File

@ -3,7 +3,6 @@ package acceptance.task;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Assert; import org.junit.Assert;
@ -16,8 +15,6 @@ import pro.taskana.KeyDomain;
import pro.taskana.TaskService; import pro.taskana.TaskService;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskSummary; import pro.taskana.TaskSummary;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId; import pro.taskana.security.WithAccessId;
@ -38,8 +35,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByModifiedAndDomain() public void testSortByModifiedAndDomain() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -61,8 +57,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByDomainNameAndCreated() public void testSortByDomainNameAndCreated() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -93,8 +88,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByPorSystemNoteDueAndOwner() public void testSortByPorSystemNoteDueAndOwner() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -119,8 +113,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByPorSystemInstanceParentProcPlannedAndState() public void testSortByPorSystemInstanceParentProcPlannedAndState() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -145,8 +138,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByPorCompanyAndClaimed() public void testSortByPorCompanyAndClaimed() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -171,8 +163,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByWbKeyPrioPorValueAndCompleted() public void testSortByWbKeyPrioPorValueAndCompleted() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.stateIn(TaskState.READY) .stateIn(TaskState.READY)
@ -198,8 +189,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortBpIdClassificationIdDescriptionAndPorType() public void testSortBpIdClassificationIdDescriptionAndPorType() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.stateIn(TaskState.READY) .stateIn(TaskState.READY)

View File

@ -241,7 +241,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
@WithAccessId(userName = "teamlead_1") @WithAccessId(userName = "teamlead_1")
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testBulkTransferTaskWithoutAppendPermissionOnTarget() public void testBulkTransferTaskWithoutAppendPermissionOnTarget()
throws InvalidArgumentException, WorkbasketNotFoundException, TaskNotFoundException, NotAuthorizedException { throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
ArrayList<String> taskIdList = new ArrayList<>(); ArrayList<String> taskIdList = new ArrayList<>();
taskIdList.add("TKI:000000000000000000000000000000000006"); // working taskIdList.add("TKI:000000000000000000000000000000000006"); // working

View File

@ -11,7 +11,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.time.Instant; import java.time.Instant;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -54,8 +53,8 @@ public class UpdateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdatePrimaryObjectReferenceOfTask() public void testUpdatePrimaryObjectReferenceOfTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, WorkbasketNotFoundException, InvalidWorkbasketException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException { ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -84,8 +83,8 @@ public class UpdateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete() public void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, WorkbasketNotFoundException, InvalidWorkbasketException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException { ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -141,8 +140,8 @@ public class UpdateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfTaskHasAlreadyBeenUpdated() public void testThrowsExceptionIfTaskHasAlreadyBeenUpdated()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, WorkbasketNotFoundException, InvalidWorkbasketException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException { ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -193,9 +192,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdateReadFlagOfTask() public void testUpdateReadFlagOfTask()
throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException, throws TaskNotFoundException, NotAuthorizedException {
InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException,
AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -235,8 +232,8 @@ public class UpdateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = InvalidArgumentException.class) @Test(expected = InvalidArgumentException.class)
public void testUpdateOfWorkbasketKeyWhatIsNotAllowed() public void testUpdateOfWorkbasketKeyWhatIsNotAllowed()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, WorkbasketNotFoundException, InvalidWorkbasketException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException { ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();

View File

@ -8,7 +8,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
@ -59,7 +58,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
// since only @Test and not @Before methods are run by JAASRunner, we call this method explicitely at // since only @Test and not @Before methods are run by JAASRunner, we call this method explicitely at
// the begin of each testcase.... // the begin of each testcase....
private void setUpMethod() private void setUpMethod()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, SQLException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException,
AttachmentPersistenceException { AttachmentPersistenceException {
taskService = taskanaEngine.getTaskService(); taskService = taskanaEngine.getTaskService();
@ -81,7 +80,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void testAddNewAttachment() public void testAddNewAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
int attachmentCount = task.getAttachments().size(); int attachmentCount = task.getAttachments().size();
assertTrue(task.getPriority() == 1); assertTrue(task.getPriority() == 1);
@ -104,7 +103,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void testAddNewAttachmentTwiceWithoutTaskanaMethodWillThrowAttachmentPersistenceException() public void testAddNewAttachmentTwiceWithoutTaskanaMethodWillThrowAttachmentPersistenceException()
throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException,
InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
int attachmentCount = 0; int attachmentCount = 0;
task.getAttachments().clear(); task.getAttachments().clear();
@ -127,7 +126,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void testAddExistingAttachmentAgainWillUpdateWhenNotEqual() public void testAddExistingAttachmentAgainWillUpdateWhenNotEqual()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
// Add attachment before // Add attachment before
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
@ -162,7 +161,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void testAddExistingAttachmentAgainWillDoNothingWhenEqual() public void testAddExistingAttachmentAgainWillDoNothingWhenEqual()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
// Add Attachment before // Add Attachment before
int attachmentCount = task.getAttachments().size(); int attachmentCount = task.getAttachments().size();
@ -189,7 +188,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void testAddAttachmentAsNullValueWillBeIgnored() public void testAddAttachmentAsNullValueWillBeIgnored()
throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException,
InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
// Try to add a single NULL-Element // Try to add a single NULL-Element
int attachmentCount = task.getAttachments().size(); int attachmentCount = task.getAttachments().size();
@ -226,7 +225,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void testRemoveAttachment() public void testRemoveAttachment()
throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException,
InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
task.addAttachment(attachment); task.addAttachment(attachment);
task = taskService.updateTask(task); task = taskService.updateTask(task);
@ -250,7 +249,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void testRemoveAttachmentWithNullAndNotAddedId() public void testRemoveAttachmentWithNullAndNotAddedId()
throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException,
InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
task.addAttachment(attachment); task.addAttachment(attachment);
task = taskService.updateTask(task); task = taskService.updateTask(task);
@ -276,7 +275,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void testUpdateAttachment() public void testUpdateAttachment()
throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException, throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException,
InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
((TaskImpl) task).setAttachments(new ArrayList<>()); ((TaskImpl) task).setAttachments(new ArrayList<>());
task = taskService.updateTask(task); task = taskService.updateTask(task);
@ -312,7 +311,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void modifyExistingAttachment() public void modifyExistingAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
// setup test // setup test
assertThat(task.getAttachments().size(), equalTo(0)); assertThat(task.getAttachments().size(), equalTo(0));
@ -396,7 +395,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void replaceExistingAttachments() public void replaceExistingAttachments()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
setUpMethod(); setUpMethod();
// setup test // setup test
assertThat(task.getAttachments().size(), equalTo(0)); assertThat(task.getAttachments().size(), equalTo(0));
@ -441,7 +440,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPrioDurationOfTaskFromAttachmentsAtUpdate() public void testPrioDurationOfTaskFromAttachmentsAtUpdate()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException, WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException { ConcurrencyException, AttachmentPersistenceException {
@ -491,7 +490,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
public void testAddCustomAttributeToAttachment() public void testAddCustomAttributeToAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, WorkbasketNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException,
AttachmentPersistenceException, SQLException { AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
task = taskService.getTask("TKI:000000000000000000000000000000000000"); // class T2000, prio 1, SL P1D task = taskService.getTask("TKI:000000000000000000000000000000000000"); // class T2000, prio 1, SL P1D

View File

@ -9,7 +9,6 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.sql.SQLException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
@ -23,18 +22,12 @@ import pro.taskana.BulkOperationResults;
import pro.taskana.Task; import pro.taskana.Task;
import pro.taskana.TaskService; import pro.taskana.TaskService;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.exceptions.AttachmentPersistenceException;
import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.ConcurrencyException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidOwnerException; import pro.taskana.exceptions.InvalidOwnerException;
import pro.taskana.exceptions.InvalidStateException; import pro.taskana.exceptions.InvalidStateException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskAlreadyExistException;
import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.exceptions.TaskNotFoundException;
import pro.taskana.exceptions.TaskanaException; import pro.taskana.exceptions.TaskanaException;
import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId; import pro.taskana.security.WithAccessId;
@ -53,8 +46,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testClaimTask() public void testClaimTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000025"); Task task = taskService.getTask("TKI:000000000000000000000000000000000025");
@ -76,8 +68,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = InvalidOwnerException.class) @Test(expected = InvalidOwnerException.class)
public void testThrowsExceptionIfTaskIsAlreadyClaimed() public void testThrowsExceptionIfTaskIsAlreadyClaimed()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000026"); Task task = taskService.getTask("TKI:000000000000000000000000000000000026");
@ -90,8 +81,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testClaimAlreadyClaimedByCallerTask() public void testClaimAlreadyClaimedByCallerTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000027"); Task task = taskService.getTask("TKI:000000000000000000000000000000000027");
@ -104,8 +94,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = InvalidOwnerException.class) @Test(expected = InvalidOwnerException.class)
public void testForceClaimTaskWhichIsAlreadyClaimedByAnotherUser() public void testForceClaimTaskWhichIsAlreadyClaimedByAnotherUser()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000028"); Task task = taskService.getTask("TKI:000000000000000000000000000000000028");
@ -118,8 +107,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCancelClaimTask() public void testCancelClaimTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000029"); Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000029");
@ -139,8 +127,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = InvalidOwnerException.class) @Test(expected = InvalidOwnerException.class)
public void testThrowsExceptionIfCancelClaimOfTaskFromAnotherUser() public void testThrowsExceptionIfCancelClaimOfTaskFromAnotherUser()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000030"); Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000030");
@ -153,8 +140,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testForceCancelClaimOfTaskFromAnotherUser() public void testForceCancelClaimOfTaskFromAnotherUser()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000031"); Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000031");
@ -174,8 +160,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCompleteTask() public void testCompleteTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
Instant before = Instant.now().minus(Duration.ofSeconds(3L)); Instant before = Instant.now().minus(Duration.ofSeconds(3L));
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -199,8 +184,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testForceCompleteUnclaimedTask() public void testForceCompleteUnclaimedTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000033"); Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000033");
@ -221,8 +205,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = InvalidOwnerException.class) @Test(expected = InvalidOwnerException.class)
public void testThrowsExceptionIfCompletingClaimedTaskOfAnotherUser() public void testThrowsExceptionIfCompletingClaimedTaskOfAnotherUser()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000034"); Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000034");
@ -235,8 +218,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testForceCompleteClaimedTaskOfAnotherUser() public void testForceCompleteClaimedTaskOfAnotherUser()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000035"); Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000035");
@ -257,9 +239,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testBulkCompleteTasks() public void testBulkCompleteTasks()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, TaskNotFoundException {
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<String> taskIdList = new ArrayList<>(); List<String> taskIdList = new ArrayList<>();
@ -282,9 +262,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testBulkDeleteTasksWithException() public void testBulkDeleteTasksWithException()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws InvalidArgumentException {
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<String> taskIdList = new ArrayList<>(); List<String> taskIdList = new ArrayList<>();

View File

@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Test; import org.junit.Test;
@ -39,7 +38,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testCreateWorkbasket() public void testCreateWorkbasket()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException { InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size(); int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size();
@ -67,8 +66,8 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
userName = "dummy") userName = "dummy")
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testCreateWorkbasketNotAuthorized() public void testCreateWorkbasketNotAuthorized()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException { DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.newWorkbasket("key3", "DOMAIN_A"); Workbasket workbasket = workbasketService.newWorkbasket("key3", "DOMAIN_A");
@ -85,8 +84,8 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test(expected = DomainNotFoundException.class) @Test(expected = DomainNotFoundException.class)
public void testCreateWorkbasketWithInvalidDomain() public void testCreateWorkbasketWithInvalidDomain()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException { DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.newWorkbasket("key3", "UNKNOWN_DOMAIN"); Workbasket workbasket = workbasketService.newWorkbasket("key3", "UNKNOWN_DOMAIN");
@ -103,7 +102,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testCreateWorkbasketWithMissingRequiredField() public void testCreateWorkbasketWithMissingRequiredField()
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketAlreadyExistException, throws NotAuthorizedException, WorkbasketAlreadyExistException,
DomainNotFoundException { DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -151,7 +150,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testWorkbasketAccessItemSetName() public void testWorkbasketAccessItemSetName()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException { InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size(); int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size();

View File

@ -6,7 +6,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Before; import org.junit.Before;
@ -140,8 +139,8 @@ public class DeleteWorkbasketAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testCreateAndDeleteWorkbasket() public void testCreateAndDeleteWorkbasket()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException { DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size(); int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size();

View File

@ -18,7 +18,6 @@ import acceptance.AbstractAccTest;
import pro.taskana.Workbasket; import pro.taskana.Workbasket;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
@ -127,7 +126,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_3_1", groupNames = {"group_1"}) userName = "user_3_1", groupNames = {"group_1"})
@Test @Test
public void testDistributionTargetCallsFailWithNotAuthorizedException() public void testDistributionTargetCallsFailWithNotAuthorizedException()
throws NotAuthorizedException, WorkbasketNotFoundException { throws WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
String existingWb = "WBI:100000000000000000000000000000000001"; String existingWb = "WBI:100000000000000000000000000000000001";
@ -170,7 +169,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
groupNames = {"group_1", "group_2", "businessadmin"}) groupNames = {"group_1", "group_2", "businessadmin"})
@Test @Test
public void testAddAndRemoveDistributionTargets() public void testAddAndRemoveDistributionTargets()
throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A"); Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A");
@ -201,7 +200,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testAddAndRemoveDistributionTargetsOnWorkbasketWithoutReadPermission() public void testAddAndRemoveDistributionTargetsOnWorkbasketWithoutReadPermission()
throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("GPK_B_KSC_2", "DOMAIN_B"); Workbasket workbasket = workbasketService.getWorkbasket("GPK_B_KSC_2", "DOMAIN_B");
@ -227,7 +226,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testAddDistributionTargetsFailsNotAuthorized() public void testAddDistributionTargetsFailsNotAuthorized()
throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A"); Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A");
@ -277,7 +276,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testGetDistributionSourcesById() public void testGetDistributionSourcesById()
throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException, SQLException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> distributionSources = workbasketService List<WorkbasketSummary> distributionSources = workbasketService
@ -298,7 +297,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testGetDistributionSourcesByKeyDomain() public void testGetDistributionSourcesByKeyDomain()
throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException, SQLException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> distributionSources = workbasketService List<WorkbasketSummary> distributionSources = workbasketService
@ -318,7 +317,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
groupNames = {"undefinedgroup"}) groupNames = {"undefinedgroup"})
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testQueryDistributionSourcesThrowsNotAuthorized() public void testQueryDistributionSourcesThrowsNotAuthorized()
throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException, SQLException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> distributionSources = workbasketService List<WorkbasketSummary> distributionSources = workbasketService
@ -332,7 +331,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test(expected = WorkbasketNotFoundException.class) @Test(expected = WorkbasketNotFoundException.class)
public void testQueryDistributionSourcesThrowsWorkbasketNotFound() public void testQueryDistributionSourcesThrowsWorkbasketNotFound()
throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException, SQLException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> distributionSources = workbasketService List<WorkbasketSummary> distributionSources = workbasketService

View File

@ -1,6 +1,5 @@
package acceptance.workbasket; package acceptance.workbasket;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Assert; import org.junit.Assert;
@ -12,8 +11,6 @@ import pro.taskana.Workbasket;
import pro.taskana.WorkbasketPermission; import pro.taskana.WorkbasketPermission;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketType; import pro.taskana.WorkbasketType;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
@ -34,8 +31,7 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetWorkbasket() public void testGetWorkbasket()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, WorkbasketNotFoundException {
InvalidWorkbasketException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("WBI:100000000000000000000000000000000007"); Workbasket workbasket = workbasketService.getWorkbasket("WBI:100000000000000000000000000000000007");
@ -67,16 +63,14 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
@Test(expected = WorkbasketNotFoundException.class) @Test(expected = WorkbasketNotFoundException.class)
public void testThrowsExceptionIfIdIsInvalid() public void testThrowsExceptionIfIdIsInvalid()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, WorkbasketNotFoundException {
InvalidWorkbasketException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
workbasketService.getWorkbasket("INVALID_ID"); workbasketService.getWorkbasket("INVALID_ID");
} }
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testThrowsExceptionIfNotAuthorized() public void testThrowsExceptionIfNotAuthorized()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, WorkbasketNotFoundException {
InvalidWorkbasketException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
workbasketService.getWorkbasket("WBI:100000000000000000000000000000000001"); workbasketService.getWorkbasket("WBI:100000000000000000000000000000000001");
} }

View File

@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Assert; import org.junit.Assert;
@ -91,7 +90,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketValuesForColumnName() throws NotAuthorizedException { public void testQueryWorkbasketValuesForColumnName() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<String> columnValueList = workbasketService.createWorkbasketQuery() List<String> columnValueList = workbasketService.createWorkbasketQuery()
.listValues("NAME", null); .listValues("NAME", null);
@ -110,8 +109,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByDomain() public void testQueryWorkbasketByDomain() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_B") .domainIn("DOMAIN_B")
@ -123,8 +121,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByDomainAndType() public void testQueryWorkbasketByDomainAndType() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -137,8 +134,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByName() public void testQueryWorkbasketByName() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameIn("Gruppenpostkorb KSC") .nameIn("Gruppenpostkorb KSC")
@ -151,8 +147,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByNameStartsWith() public void testQueryWorkbasketByNameStartsWith() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Gruppenpostkorb KSC%") .nameLike("%Gruppenpostkorb KSC%")
@ -164,8 +159,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByNameContains() public void testQueryWorkbasketByNameContains() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Teamlead%", "%Gruppenpostkorb KSC%") .nameLike("%Teamlead%", "%Gruppenpostkorb KSC%")
@ -177,8 +171,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByNameContainsCaseInsensitive() public void testQueryWorkbasketByNameContainsCaseInsensitive() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%TEAMLEAD%") .nameLike("%TEAMLEAD%")
@ -190,8 +183,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByDescription() public void testQueryWorkbasketByDescription() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.descriptionLike("%ppk%", "%gruppen%") .descriptionLike("%ppk%", "%gruppen%")
@ -205,8 +197,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByOwnerLike() public void testQueryWorkbasketByOwnerLike() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.ownerLike("%an%", "%te%") .ownerLike("%an%", "%te%")
@ -219,8 +210,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByKey() public void testQueryWorkbasketByKey() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyIn("GPK_KSC") .keyIn("GPK_KSC")
@ -232,8 +222,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByMultipleKeys() public void testQueryWorkbasketByMultipleKeys() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyIn("GPK_KSC_1", "GPK_KSC") .keyIn("GPK_KSC_1", "GPK_KSC")
@ -245,8 +234,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByMultipleKeysWithUnknownKey() public void testQueryWorkbasketByMultipleKeysWithUnknownKey() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyIn("GPK_KSC_1", "GPK_Ksc", "GPK_KSC_3") .keyIn("GPK_KSC_1", "GPK_Ksc", "GPK_KSC_3")
@ -258,8 +246,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByKeyContains() public void testQueryWorkbasketByKeyContains() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyLike("%KSC%") .keyLike("%KSC%")
@ -271,8 +258,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByKeyContainsIgnoreCase() public void testQueryWorkbasketByKeyContainsIgnoreCase() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyLike("%kSc%") .keyLike("%kSc%")
@ -284,8 +270,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByKeyOrNameContainsIgnoreCase() public void testQueryWorkbasketByKeyOrNameContainsIgnoreCase() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyOrNameLike("%kSc%") .keyOrNameLike("%kSc%")
@ -297,8 +282,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByNameStartsWithSortedByNameAscending() public void testQueryWorkbasketByNameStartsWithSortedByNameAscending() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Gruppenpostkorb KSC%") .nameLike("%Gruppenpostkorb KSC%")
@ -322,8 +306,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "max") userName = "max")
@Test @Test
public void testQueryWorkbasketByNameStartsWithSortedByNameDescending() public void testQueryWorkbasketByNameStartsWithSortedByNameDescending() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("basxet%") .nameLike("basxet%")
@ -344,8 +327,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "max") userName = "max")
@Test @Test
public void testQueryWorkbasketByNameStartsWithSortedByKeyAscending() public void testQueryWorkbasketByNameStartsWithSortedByKeyAscending() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("basxet%") .nameLike("basxet%")
@ -366,8 +348,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "max") userName = "max")
@Test @Test
public void testQueryWorkbasketByNameStartsWithSortedByKeyDescending() public void testQueryWorkbasketByNameStartsWithSortedByKeyDescending() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("basxet%") .nameLike("basxet%")
@ -389,8 +370,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByCreated() public void testQueryWorkbasketByCreated() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.createdWithin(todaysInterval()) .createdWithin(todaysInterval())
@ -402,8 +382,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByModified() public void testQueryWorkbasketByModified() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.modifiedWithin(todaysInterval()) .modifiedWithin(todaysInterval())
@ -416,7 +395,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
groupNames = "admin") groupNames = "admin")
@Test @Test
public void testQueryWorkbasketByAdmin() public void testQueryWorkbasketByAdmin()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")

View File

@ -5,7 +5,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Assert; import org.junit.Assert;
@ -17,7 +16,6 @@ import pro.taskana.BaseQuery.SortDirection;
import pro.taskana.WorkbasketAccessItem; import pro.taskana.WorkbasketAccessItem;
import pro.taskana.WorkbasketAccessItemQuery; import pro.taskana.WorkbasketAccessItemQuery;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
import pro.taskana.security.WithAccessId; import pro.taskana.security.WithAccessId;
@ -60,7 +58,7 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsForAccessIds() public void testQueryAccessItemsForAccessIds()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.accessIdIn("user_1_1", "group_1") .accessIdIn("user_1_1", "group_1")
@ -72,7 +70,7 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
userName = "dummy") userName = "dummy")
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testQueryAccessItemsForAccessIdsNotAuthorized() public void testQueryAccessItemsForAccessIdsNotAuthorized()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
workbasketService.createWorkbasketAccessItemQuery() workbasketService.createWorkbasketAccessItemQuery()
.accessIdIn("user_1_1", "group_1") .accessIdIn("user_1_1", "group_1")
@ -85,7 +83,7 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsForAccessIdsOrderedAscending() public void testQueryAccessItemsForAccessIdsOrderedAscending()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketAccessItemQuery query = workbasketService.createWorkbasketAccessItemQuery() WorkbasketAccessItemQuery query = workbasketService.createWorkbasketAccessItemQuery()
.accessIdIn("user_1_1", "group_1") .accessIdIn("user_1_1", "group_1")
@ -103,7 +101,7 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsForAccessIdsAndWorkbasketKey() public void testQueryAccessItemsForAccessIdsAndWorkbasketKey()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.accessIdIn("user_1_1", "group_1") .accessIdIn("user_1_1", "group_1")
@ -117,7 +115,7 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsByWorkbasketKey() public void testQueryAccessItemsByWorkbasketKey()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.workbasketIdIn("WBI:100000000000000000000000000000000006") .workbasketIdIn("WBI:100000000000000000000000000000000006")
@ -130,7 +128,7 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsByWorkbasketKeyOrderedDescending() public void testQueryAccessItemsByWorkbasketKeyOrderedDescending()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.workbasketIdIn("WBI:100000000000000000000000000000000006") .workbasketIdIn("WBI:100000000000000000000000000000000006")

View File

@ -2,7 +2,6 @@ package acceptance.workbasket;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -40,7 +39,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferTargetsForUser() public void testQueryAllTransferTargetsForUser()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1") .accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1")
@ -53,7 +52,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
userName = "dummy") userName = "dummy")
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testQueryAllTransferTargetsForUserNotAuthorized() public void testQueryAllTransferTargetsForUserNotAuthorized()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
workbasketService.createWorkbasketQuery() workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1") .accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1")
@ -66,7 +65,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferTargetsForUserAndGroup() public void testQueryAllTransferTargetsForUserAndGroup()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException { throws NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1") .accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1")
@ -79,7 +78,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferTargetsForUserAndGroupSortedByNameAscending() public void testQueryAllTransferTargetsForUserAndGroupSortedByNameAscending()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException { throws NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1") .accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1")
@ -94,7 +93,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferTargetsForUserAndGroupSortedByNameDescending() public void testQueryAllTransferTargetsForUserAndGroupSortedByNameDescending()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException { throws NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1") .accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1")
@ -110,7 +109,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferSourcesForUserAndGroup() public void testQueryAllTransferSourcesForUserAndGroup()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException { throws NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.DISTRIBUTE, "user_1_1", "group_1") .accessIdsHavePermission(WorkbasketPermission.DISTRIBUTE, "user_1_1", "group_1")
@ -127,7 +126,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryAllTransferTargetsForUserAndGroupFromSubject() public void testQueryAllTransferTargetsForUserAndGroupFromSubject()
throws SQLException, NotAuthorizedException, SystemException { throws SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.callerHasPermission(WorkbasketPermission.APPEND) .callerHasPermission(WorkbasketPermission.APPEND)
@ -137,8 +136,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
@WithAccessId(userName = "user_1_1") @WithAccessId(userName = "user_1_1")
@Test @Test
public void testQueryAllAvailableWorkbasketForOpeningForUserAndGroupFromSubject() public void testQueryAllAvailableWorkbasketForOpeningForUserAndGroupFromSubject() {
throws SQLException, NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.callerHasPermission(WorkbasketPermission.READ) .callerHasPermission(WorkbasketPermission.READ)

View File

@ -3,7 +3,6 @@ package acceptance.workbasket;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Ignore; import org.junit.Ignore;
@ -13,7 +12,6 @@ import org.junit.runner.RunWith;
import acceptance.AbstractAccTest; import acceptance.AbstractAccTest;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskanaRuntimeException; import pro.taskana.exceptions.TaskanaRuntimeException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
@ -33,8 +31,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetFirstPageOfWorkbasketQueryWithOffset() public void testGetFirstPageOfWorkbasketQueryWithOffset() {
throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -46,8 +43,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetSecondPageOfWorkbasketQueryWithOffset() public void testGetSecondPageOfWorkbasketQueryWithOffset() {
throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -59,7 +55,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testListOffsetAndLimitOutOfBounds() throws NotAuthorizedException { public void testListOffsetAndLimitOutOfBounds() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// both will be 0, working // both will be 0, working
@ -85,7 +81,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPaginationWithPages() throws NotAuthorizedException { public void testPaginationWithPages() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// Getting full page // Getting full page
@ -125,8 +121,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPaginationNullAndNegativeLimitsIgnoring() public void testPaginationNullAndNegativeLimitsIgnoring() {
throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// 0 limit/size = 0 results // 0 limit/size = 0 results
@ -163,7 +158,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
@Ignore @Ignore
@Test(expected = TaskanaRuntimeException.class) @Test(expected = TaskanaRuntimeException.class)
public void testPaginationThrowingExceptionWhenPageOutOfBounds() public void testPaginationThrowingExceptionWhenPageOutOfBounds()
throws SQLException, NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// entrypoint set outside result amount // entrypoint set outside result amount
@ -178,8 +173,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCountOfWorkbasketQuery() public void testCountOfWorkbasketQuery() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
long count = workbasketService.createWorkbasketQuery() long count = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -191,8 +185,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testWorkbasketQueryDomA() public void testWorkbasketQueryDomA() {
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> result = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> result = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")

View File

@ -1,6 +1,5 @@
package acceptance.workbasket; package acceptance.workbasket;
import java.sql.SQLException;
import java.time.Instant; import java.time.Instant;
import org.junit.Assert; import org.junit.Assert;
@ -11,7 +10,6 @@ import acceptance.AbstractAccTest;
import pro.taskana.Workbasket; import pro.taskana.Workbasket;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketType; import pro.taskana.WorkbasketType;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidWorkbasketException; import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
@ -33,8 +31,7 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
groupNames = {"group_1", "businessadmin"}) groupNames = {"group_1", "businessadmin"})
@Test @Test
public void testUpdateWorkbasket() public void testUpdateWorkbasket()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException {
InvalidWorkbasketException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A"); Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A");
Instant modified = workbasket.getModified(); Instant modified = workbasket.getModified();
@ -66,8 +63,7 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testCheckAuthorizationToUpdateWorkbasket() public void testCheckAuthorizationToUpdateWorkbasket()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException {
InvalidWorkbasketException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A"); Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");

View File

@ -7,7 +7,6 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.junit.Assert; import org.junit.Assert;
@ -23,7 +22,6 @@ import pro.taskana.WorkbasketAccessItem;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException; import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException;
import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskAlreadyExistException;
@ -83,8 +81,7 @@ public class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
groupNames = {"group_1", "businessadmin"}) groupNames = {"group_1", "businessadmin"})
@Test @Test
public void testUpdateWorkbasketAccessItemRejected() public void testUpdateWorkbasketAccessItemRejected()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException {
InvalidWorkbasketException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketAccessItem accessItem = workbasketService WorkbasketAccessItem accessItem = workbasketService
.newWorkbasketAccessItem("WBI:100000000000000000000000000000000001", "user1"); .newWorkbasketAccessItem("WBI:100000000000000000000000000000000001", "user1");
@ -125,8 +122,8 @@ public class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
groupNames = {"group_2", "businessadmin"}) groupNames = {"group_2", "businessadmin"})
@Test @Test
public void testUpdatedAccessItemLeadsToNotAuthorizedException() public void testUpdatedAccessItemLeadsToNotAuthorizedException()
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
ClassificationNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException { ClassificationNotFoundException, TaskAlreadyExistException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -13,7 +13,6 @@ import acceptance.AbstractAccTest;
import pro.taskana.BaseQuery.SortDirection; import pro.taskana.BaseQuery.SortDirection;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASRunner;
/** /**
@ -31,8 +30,7 @@ public class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest
@Ignore @Ignore
@Test @Test
public void testGetFirstPageOfTaskQueryWithOffset() public void testGetFirstPageOfTaskQueryWithOffset() {
throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -53,8 +51,7 @@ public class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest
@Ignore @Ignore
@Test @Test
public void testGetSecondPageOfTaskQueryWithOffset() public void testGetSecondPageOfTaskQueryWithOffset() {
throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")

View File

@ -15,8 +15,6 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import pro.taskana.ClassificationSummary; import pro.taskana.ClassificationSummary;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
/** /**
* Test for ClassificationQueryImpl. * Test for ClassificationQueryImpl.
@ -40,7 +38,7 @@ public class ClassificationQueryImplTest {
} }
@Test @Test
public void should_ReturnList_when_BuilderIsUsed() throws NotAuthorizedException, InvalidArgumentException { public void should_ReturnList_when_BuilderIsUsed() {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>());
@ -53,8 +51,7 @@ public class ClassificationQueryImplTest {
} }
@Test @Test
public void should_ReturnListWithOffset_when_BuilderIsUsed() public void should_ReturnListWithOffset_when_BuilderIsUsed() {
throws NotAuthorizedException, InvalidArgumentException {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>());
@ -67,7 +64,7 @@ public class ClassificationQueryImplTest {
} }
@Test @Test
public void should_ReturnOneItem_when_BuilderIsUsed() throws NotAuthorizedException, InvalidArgumentException { public void should_ReturnOneItem_when_BuilderIsUsed() {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectOne(any(), any())).thenReturn(new ClassificationSummaryImpl()); when(sqlSession.selectOne(any(), any())).thenReturn(new ClassificationSummaryImpl());

View File

@ -215,7 +215,7 @@ public class ClassificationServiceImplTest {
@Test(expected = ClassificationNotFoundException.class) @Test(expected = ClassificationNotFoundException.class)
public void testUpdateClassificationParentNotExisting() public void testUpdateClassificationParentNotExisting()
throws ClassificationAlreadyExistException, ClassificationNotFoundException, NotAuthorizedException, throws ClassificationNotFoundException, NotAuthorizedException,
ConcurrencyException, InvalidArgumentException { ConcurrencyException, InvalidArgumentException {
Instant now = Instant.now(); Instant now = Instant.now();
ClassificationImpl oldClassification = (ClassificationImpl) createDummyClassification(); ClassificationImpl oldClassification = (ClassificationImpl) createDummyClassification();

View File

@ -15,9 +15,6 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import pro.taskana.ObjectReference; import pro.taskana.ObjectReference;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
/** /**
* Test for ObjectReferenceQueryImpl. * Test for ObjectReferenceQueryImpl.
* *
@ -40,7 +37,7 @@ public class ObjectReferenceQueryImplTest {
} }
@Test @Test
public void should_ReturnList_when_BuilderIsUsed() throws NotAuthorizedException, InvalidArgumentException { public void should_ReturnList_when_BuilderIsUsed() {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>());
@ -53,8 +50,7 @@ public class ObjectReferenceQueryImplTest {
} }
@Test @Test
public void should_ReturnListWithOffset_when_BuilderIsUsed() public void should_ReturnListWithOffset_when_BuilderIsUsed() {
throws NotAuthorizedException, InvalidArgumentException {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>());
@ -67,7 +63,7 @@ public class ObjectReferenceQueryImplTest {
} }
@Test @Test
public void should_ReturnOneItem_when_BuilderIsUsed() throws NotAuthorizedException, InvalidArgumentException { public void should_ReturnOneItem_when_BuilderIsUsed() {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectOne(any(), any())).thenReturn(new ObjectReference()); when(sqlSession.selectOne(any(), any())).thenReturn(new ObjectReference());

View File

@ -18,8 +18,6 @@ import org.mockito.junit.MockitoJUnitRunner;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskSummary; import pro.taskana.TaskSummary;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
/** /**
* Test for TaskQueryImpl. * Test for TaskQueryImpl.
@ -51,7 +49,7 @@ public class TaskQueryImplTest {
} }
@Test @Test
public void should_ReturnList_when_BuilderIsUsed() throws NotAuthorizedException, InvalidArgumentException { public void should_ReturnList_when_BuilderIsUsed() {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>());
List<TaskSummary> intermediate = new ArrayList<>(); List<TaskSummary> intermediate = new ArrayList<>();
@ -66,8 +64,7 @@ public class TaskQueryImplTest {
} }
@Test @Test
public void should_ReturnListWithOffset_when_BuilderIsUsed() public void should_ReturnListWithOffset_when_BuilderIsUsed() {
throws NotAuthorizedException, InvalidArgumentException {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>());
List<TaskSummary> intermediate = new ArrayList<>(); List<TaskSummary> intermediate = new ArrayList<>();
@ -82,7 +79,7 @@ public class TaskQueryImplTest {
} }
@Test @Test
public void should_ReturnOneItem_when_BuilderIsUsed() throws NotAuthorizedException, InvalidArgumentException { public void should_ReturnOneItem_when_BuilderIsUsed() {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectOne(any(), any())).thenReturn(new TaskSummaryImpl()); when(sqlSession.selectOne(any(), any())).thenReturn(new TaskSummaryImpl());
List<TaskSummary> intermediate = new ArrayList<>(); List<TaskSummary> intermediate = new ArrayList<>();

View File

@ -47,13 +47,11 @@ import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.AttachmentPersistenceException; import pro.taskana.exceptions.AttachmentPersistenceException;
import pro.taskana.exceptions.ClassificationAlreadyExistException;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.ConcurrencyException; import pro.taskana.exceptions.ConcurrencyException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidOwnerException; import pro.taskana.exceptions.InvalidOwnerException;
import pro.taskana.exceptions.InvalidStateException; import pro.taskana.exceptions.InvalidStateException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.SystemException; import pro.taskana.exceptions.SystemException;
import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskAlreadyExistException;
@ -123,8 +121,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testCreateSimpleTask() throws NotAuthorizedException, WorkbasketNotFoundException, public void testCreateSimpleTask() throws NotAuthorizedException, WorkbasketNotFoundException,
ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, ClassificationNotFoundException, TaskAlreadyExistException, TaskNotFoundException, InvalidArgumentException {
TaskNotFoundException, InvalidWorkbasketException, InvalidArgumentException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
TaskImpl expectedTask = createUnitTestTask("", "DUMMYTASK", "k1", dummyClassification); TaskImpl expectedTask = createUnitTestTask("", "DUMMYTASK", "k1", dummyClassification);
@ -170,8 +167,7 @@ public class TaskServiceImplTest {
@Test(expected = SystemException.class) @Test(expected = SystemException.class)
public void testCreateTaskWithSecurityButNoUserId() public void testCreateTaskWithSecurityButNoUserId()
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException,
ClassificationNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException {
InvalidArgumentException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
TaskImpl expectedTask = createUnitTestTask("", "DUMMYTASK", "k1", dummyClassification); TaskImpl expectedTask = createUnitTestTask("", "DUMMYTASK", "k1", dummyClassification);
@ -195,8 +191,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testCreateSimpleTaskWithObjectReference() throws NotAuthorizedException, WorkbasketNotFoundException, public void testCreateSimpleTaskWithObjectReference() throws NotAuthorizedException, WorkbasketNotFoundException,
ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, ClassificationNotFoundException, TaskAlreadyExistException, TaskNotFoundException, InvalidArgumentException {
TaskNotFoundException, InvalidWorkbasketException, InvalidArgumentException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
ObjectReference expectedObjectReference = JunitHelper.createDefaultObjRef(); ObjectReference expectedObjectReference = JunitHelper.createDefaultObjRef();
WorkbasketImpl wb = new WorkbasketImpl(); WorkbasketImpl wb = new WorkbasketImpl();
@ -248,8 +243,8 @@ public class TaskServiceImplTest {
@Test @Test
public void testCreateSimpleTaskWithObjectReferenceIsNull() throws NotAuthorizedException, public void testCreateSimpleTaskWithObjectReferenceIsNull() throws NotAuthorizedException,
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, WorkbasketNotFoundException, ClassificationNotFoundException, TaskAlreadyExistException, TaskNotFoundException,
TaskAlreadyExistException, TaskNotFoundException, InvalidWorkbasketException, InvalidArgumentException { InvalidArgumentException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
ObjectReference expectedObjectReference = JunitHelper.createDefaultObjRef(); ObjectReference expectedObjectReference = JunitHelper.createDefaultObjRef();
WorkbasketImpl wb = new WorkbasketImpl(); WorkbasketImpl wb = new WorkbasketImpl();
@ -303,7 +298,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testCreateTaskWithPlanned() public void testCreateTaskWithPlanned()
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
TaskAlreadyExistException, TaskNotFoundException, InvalidWorkbasketException, InvalidArgumentException { TaskAlreadyExistException, TaskNotFoundException, InvalidArgumentException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
ObjectReference expectedObjectReference = JunitHelper.createDefaultObjRef(); ObjectReference expectedObjectReference = JunitHelper.createDefaultObjRef();
@ -376,7 +371,7 @@ public class TaskServiceImplTest {
@Test(expected = TaskAlreadyExistException.class) @Test(expected = TaskAlreadyExistException.class)
public void testCreateTaskThrowingAlreadyExistException() throws WorkbasketNotFoundException, public void testCreateTaskThrowingAlreadyExistException() throws WorkbasketNotFoundException,
ClassificationNotFoundException, NotAuthorizedException, TaskAlreadyExistException, TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, TaskAlreadyExistException, TaskNotFoundException,
InvalidWorkbasketException, InvalidArgumentException { InvalidArgumentException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
TaskImpl task = createUnitTestTask("12", "Task Name", "1", dummyClassification); TaskImpl task = createUnitTestTask("12", "Task Name", "1", dummyClassification);
@ -399,7 +394,7 @@ public class TaskServiceImplTest {
@Test(expected = NotAuthorizedException.class) @Test(expected = NotAuthorizedException.class)
public void testCreateThrowingAuthorizedOnWorkbasket() public void testCreateThrowingAuthorizedOnWorkbasket()
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
TaskAlreadyExistException, TaskNotFoundException, InvalidWorkbasketException, InvalidArgumentException { TaskAlreadyExistException, TaskNotFoundException, InvalidArgumentException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
TaskImpl task = createUnitTestTask("", "dummyTask", "1", dummyClassification); TaskImpl task = createUnitTestTask("", "dummyTask", "1", dummyClassification);
@ -430,7 +425,7 @@ public class TaskServiceImplTest {
@Test(expected = WorkbasketNotFoundException.class) @Test(expected = WorkbasketNotFoundException.class)
public void testCreateThrowsWorkbasketNotFoundException() public void testCreateThrowsWorkbasketNotFoundException()
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
InvalidWorkbasketException, TaskAlreadyExistException, TaskNotFoundException, InvalidArgumentException { TaskAlreadyExistException, TaskNotFoundException, InvalidArgumentException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
TaskImpl task = createUnitTestTask("", "dumma-task", "1", dummyClassification); TaskImpl task = createUnitTestTask("", "dumma-task", "1", dummyClassification);
@ -679,7 +674,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testCompleteTaskDefault() public void testCompleteTaskDefault()
throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, InterruptedException, throws TaskNotFoundException, InvalidOwnerException, InvalidStateException, InterruptedException,
ClassificationNotFoundException, NotAuthorizedException { NotAuthorizedException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
final long sleepTime = 100L; final long sleepTime = 100L;
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
@ -733,7 +728,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testCompleteTaskNotForcedWorking() public void testCompleteTaskNotForcedWorking()
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, InterruptedException, throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, InterruptedException,
ClassificationNotFoundException, NotAuthorizedException { NotAuthorizedException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
final long sleepTime = 100L; final long sleepTime = 100L;
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
@ -764,8 +759,7 @@ public class TaskServiceImplTest {
@Test(expected = InvalidStateException.class) @Test(expected = InvalidStateException.class)
public void testCompleteTaskNotForcedNotClaimedBefore() public void testCompleteTaskNotForcedNotClaimedBefore()
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, ClassificationNotFoundException, throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException {
NotAuthorizedException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1", dummyClassification); TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1", dummyClassification);
@ -789,8 +783,7 @@ public class TaskServiceImplTest {
@Test(expected = InvalidOwnerException.class) @Test(expected = InvalidOwnerException.class)
public void testCompleteTaskNotForcedInvalidOwnerException() public void testCompleteTaskNotForcedInvalidOwnerException()
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, ClassificationNotFoundException, throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException {
NotAuthorizedException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1", dummyClassification); TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1", dummyClassification);
@ -815,8 +808,7 @@ public class TaskServiceImplTest {
@Test(expected = TaskNotFoundException.class) @Test(expected = TaskNotFoundException.class)
public void testCompleteTaskTaskNotFound() public void testCompleteTaskTaskNotFound()
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, ClassificationNotFoundException, throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, NotAuthorizedException {
NotAuthorizedException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
String taskId = "1"; String taskId = "1";
doThrow(TaskNotFoundException.class).when(cutSpy).getTask(taskId); doThrow(TaskNotFoundException.class).when(cutSpy).getTask(taskId);
@ -837,7 +829,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testCompleteForcedAndAlreadyClaimed() public void testCompleteForcedAndAlreadyClaimed()
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, InterruptedException, throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, InterruptedException,
ClassificationNotFoundException, NotAuthorizedException { NotAuthorizedException {
final long sleepTime = 100L; final long sleepTime = 100L;
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
@ -868,7 +860,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testCompleteForcedNotClaimed() public void testCompleteForcedNotClaimed()
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, InterruptedException, throws TaskNotFoundException, InvalidStateException, InvalidOwnerException, InterruptedException,
ClassificationNotFoundException, NotAuthorizedException { NotAuthorizedException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
final long sleepTime = 100L; final long sleepTime = 100L;
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
@ -902,9 +894,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testTransferTaskToDestinationWorkbasketWithoutSecurity() public void testTransferTaskToDestinationWorkbasketWithoutSecurity()
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException {
ClassificationAlreadyExistException, InvalidWorkbasketException, ClassificationNotFoundException,
InvalidStateException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Workbasket destinationWorkbasket = createWorkbasket("2", "k1"); Workbasket destinationWorkbasket = createWorkbasket("2", "k1");
Workbasket sourceWorkbasket = createWorkbasket("47", "key47"); Workbasket sourceWorkbasket = createWorkbasket("47", "key47");
@ -945,9 +935,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testTransferTaskToDestinationWorkbasketUsingSecurityTrue() public void testTransferTaskToDestinationWorkbasketUsingSecurityTrue()
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException {
ClassificationAlreadyExistException, InvalidWorkbasketException, ClassificationNotFoundException,
InvalidStateException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Workbasket destinationWorkbasket = createWorkbasket("2", "k2"); Workbasket destinationWorkbasket = createWorkbasket("2", "k2");
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
@ -1088,8 +1076,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testSetTaskReadWIthExistingTask() public void testSetTaskReadWIthExistingTask()
throws TaskNotFoundException, ClassificationAlreadyExistException, ClassificationNotFoundException, throws TaskNotFoundException, NotAuthorizedException {
NotAuthorizedException {
TaskServiceImpl cutSpy = Mockito.spy(cut); TaskServiceImpl cutSpy = Mockito.spy(cut);
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1", dummyClassification); TaskImpl task = createUnitTestTask("1", "Unit Test Task 1", "1", dummyClassification);
@ -1132,8 +1119,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testGetTaskByIdWithExistingTask() public void testGetTaskByIdWithExistingTask()
throws TaskNotFoundException, ClassificationAlreadyExistException, ClassificationNotFoundException, throws TaskNotFoundException, NotAuthorizedException {
NotAuthorizedException {
Classification dummyClassification = createDummyClassification(); Classification dummyClassification = createDummyClassification();
Task expectedTask = createUnitTestTask("1", "DUMMY-TASK", "1", dummyClassification); Task expectedTask = createUnitTestTask("1", "DUMMY-TASK", "1", dummyClassification);
doReturn(expectedTask).when(taskMapperMock).findById(expectedTask.getId()); doReturn(expectedTask).when(taskMapperMock).findById(expectedTask.getId());
@ -1196,7 +1182,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testUpdateTaskAddingValidAttachment() throws TaskNotFoundException, SystemException, public void testUpdateTaskAddingValidAttachment() throws TaskNotFoundException, SystemException,
WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
InvalidWorkbasketException, NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
Classification classification = createDummyClassification(); Classification classification = createDummyClassification();
Workbasket wb = createWorkbasket("WB-ID", "WB-Key"); Workbasket wb = createWorkbasket("WB-ID", "WB-Key");
Attachment attachment = JunitHelper.createDefaultAttachment(); Attachment attachment = JunitHelper.createDefaultAttachment();
@ -1224,7 +1210,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testUpdateTaskAddingValidAttachmentTwice() throws TaskNotFoundException, SystemException, public void testUpdateTaskAddingValidAttachmentTwice() throws TaskNotFoundException, SystemException,
WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
InvalidWorkbasketException, NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
Classification classification = createDummyClassification(); Classification classification = createDummyClassification();
Workbasket wb = createWorkbasket("WB-ID", "WB-Key"); Workbasket wb = createWorkbasket("WB-ID", "WB-Key");
Attachment attachment = JunitHelper.createDefaultAttachment(); Attachment attachment = JunitHelper.createDefaultAttachment();
@ -1254,7 +1240,7 @@ public class TaskServiceImplTest {
public void testUpdateTaskAddingAttachmentWithSameIdForcedUsingingListMethod() public void testUpdateTaskAddingAttachmentWithSameIdForcedUsingingListMethod()
throws TaskNotFoundException, SystemException, throws TaskNotFoundException, SystemException,
WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
InvalidWorkbasketException, NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
Classification classification = createDummyClassification(); Classification classification = createDummyClassification();
Workbasket wb = createWorkbasket("WB-ID", "WB-Key"); Workbasket wb = createWorkbasket("WB-ID", "WB-Key");
Attachment attachment = JunitHelper.createDefaultAttachment(); Attachment attachment = JunitHelper.createDefaultAttachment();
@ -1287,7 +1273,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testUpdateTaskUpdateAttachment() throws TaskNotFoundException, SystemException, public void testUpdateTaskUpdateAttachment() throws TaskNotFoundException, SystemException,
WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
InvalidWorkbasketException, NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
String channelUpdate = "OTHER CHANNEL"; String channelUpdate = "OTHER CHANNEL";
Classification classification = createDummyClassification(); Classification classification = createDummyClassification();
Workbasket wb = createWorkbasket("WB-ID", "WB-Key"); Workbasket wb = createWorkbasket("WB-ID", "WB-Key");
@ -1321,7 +1307,7 @@ public class TaskServiceImplTest {
@Test @Test
public void testUpdateTaskRemovingAttachment() throws TaskNotFoundException, SystemException, public void testUpdateTaskRemovingAttachment() throws TaskNotFoundException, SystemException,
WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
InvalidWorkbasketException, NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
Classification classification = createDummyClassification(); Classification classification = createDummyClassification();
Workbasket wb = createWorkbasket("WB-ID", "WB-Key"); Workbasket wb = createWorkbasket("WB-ID", "WB-Key");
Attachment attachment = JunitHelper.createDefaultAttachment(); Attachment attachment = JunitHelper.createDefaultAttachment();

View File

@ -87,7 +87,7 @@ public class WorkbasketServiceImplTest {
private TaskanaEngineConfiguration taskanaEngineConfigurationMock; private TaskanaEngineConfiguration taskanaEngineConfigurationMock;
@Before @Before
public void setup() throws NotAuthorizedException { public void setup() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
} }
@ -222,7 +222,7 @@ public class WorkbasketServiceImplTest {
@Test @Test
public void testCreateWorkbasket_InvalidWorkbasketCases() public void testCreateWorkbasket_InvalidWorkbasketCases()
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketAlreadyExistException, throws NotAuthorizedException, WorkbasketAlreadyExistException,
DomainNotFoundException { DomainNotFoundException {
WorkbasketImpl wb = new WorkbasketImpl(); WorkbasketImpl wb = new WorkbasketImpl();
int serviceCalls = 1; int serviceCalls = 1;
@ -464,7 +464,7 @@ public class WorkbasketServiceImplTest {
@Test @Test
public void testDeleteWorkbasketWithNullOrEmptyParam() public void testDeleteWorkbasketWithNullOrEmptyParam()
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException, InvalidArgumentException { throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException {
// null param // null param
try { try {
cutSpy.deleteWorkbasket(null); cutSpy.deleteWorkbasket(null);
@ -579,7 +579,7 @@ public class WorkbasketServiceImplTest {
} }
private List<String> createTestDistributionTargets(int amount) private List<String> createTestDistributionTargets(int amount)
throws WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException, throws InvalidWorkbasketException, NotAuthorizedException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
List<String> distributionsTargets = new ArrayList<>(); List<String> distributionsTargets = new ArrayList<>();
amount = (amount < 0) ? 0 : amount; amount = (amount < 0) ? 0 : amount;

View File

@ -8,7 +8,6 @@ import java.io.InputStream;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Properties; import java.util.Properties;
import javax.security.auth.login.LoginException;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.apache.ibatis.datasource.pooled.PooledDataSource; import org.apache.ibatis.datasource.pooled.PooledDataSource;
@ -32,7 +31,7 @@ public class TaskanaEngineConfigurationTest {
private static final int POOL_TIME_TO_WAIT = 50; private static final int POOL_TIME_TO_WAIT = 50;
@Test @Test
public void testCreateTaskanaEngine() throws FileNotFoundException, SQLException, LoginException { public void testCreateTaskanaEngine() throws SQLException {
DataSource ds = getDataSource(); DataSource ds = getDataSource();
TaskanaEngineConfiguration taskEngineConfiguration = new TaskanaEngineConfiguration(ds, false); TaskanaEngineConfiguration taskEngineConfiguration = new TaskanaEngineConfiguration(ds, false);
@ -45,13 +44,8 @@ public class TaskanaEngineConfigurationTest {
* returns the Datasource used for Junit test. If the file {user.home}/taskanaUnitTest.properties is present, the * returns the Datasource used for Junit test. If the file {user.home}/taskanaUnitTest.properties is present, the
* Datasource is created according to the properties jdbcDriver, jdbcUrl, dbUserName and dbPassword. Assuming, the * Datasource is created according to the properties jdbcDriver, jdbcUrl, dbUserName and dbPassword. Assuming, the
* database has the name tskdb, a sample properties file for DB2 looks as follows: * database has the name tskdb, a sample properties file for DB2 looks as follows:
* * jdbcDriver=com.ibm.db2.jcc.DB2Driver jdbcUrl=jdbc:db2://localhost:50000/tskdb dbUserName=db2user
* jdbcDriver=com.ibm.db2.jcc.DB2Driver * dbPassword=db2password If any of these properties is missing, or the file doesn't exist, the default Datasource
* jdbcUrl=jdbc:db2://localhost:50000/tskdb
* dbUserName=db2user
* dbPassword=db2password
*
* If any of these properties is missing, or the file doesn't exist, the default Datasource
* for h2 in-memory db is created. * for h2 in-memory db is created.
* *
* @return dataSource for unit test * @return dataSource for unit test

View File

@ -6,7 +6,6 @@ import static org.hamcrest.core.StringStartsWith.startsWith;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.FileNotFoundException;
import java.sql.SQLException; import java.sql.SQLException;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
@ -15,7 +14,6 @@ import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.List; import java.util.List;
import javax.security.auth.login.LoginException;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.Assert; import org.junit.Assert;
@ -64,7 +62,7 @@ public class ClassificationServiceImplIntAutoCommitTest {
} }
@Before @Before
public void setup() throws FileNotFoundException, SQLException, LoginException { public void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineConfigurationTest.getDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, false); taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, false);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
@ -401,8 +399,7 @@ public class ClassificationServiceImplIntAutoCommitTest {
return new TimeInterval(begin, end); return new TimeInterval(begin, end);
} }
private Classification createDummyClassificationWithUniqueKey(String domain, String type) private Classification createDummyClassificationWithUniqueKey(String domain, String type) {
throws NotAuthorizedException {
Classification classification = classificationService.newClassification("TEST" + counter, domain, type); Classification classification = classificationService.newClassification("TEST" + counter, domain, type);
counter++; counter++;
return classification; return classification;

View File

@ -440,8 +440,7 @@ public class ClassificationServiceImplIntExplicitTest {
taskanaEngineImpl.setConnection(null); taskanaEngineImpl.setConnection(null);
} }
private Classification createNewClassificationWithUniqueKey(String domain, String type) private Classification createNewClassificationWithUniqueKey(String domain, String type) {
throws NotAuthorizedException {
Classification classification = classificationService.newClassification("TEST" + counter, domain, type); Classification classification = classificationService.newClassification("TEST" + counter, domain, type);
counter++; counter++;
return classification; return classification;

View File

@ -5,12 +5,10 @@ import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.FileNotFoundException;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import javax.security.auth.login.LoginException;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.Assert; import org.junit.Assert;
@ -81,7 +79,7 @@ public class TaskServiceImplIntAutocommitTest {
} }
@Before @Before
public void setup() throws FileNotFoundException, SQLException, LoginException { public void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineConfigurationTest.getDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, false); taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, false);
@ -96,7 +94,7 @@ public class TaskServiceImplIntAutocommitTest {
} }
@Test @Test
public void testStart() throws FileNotFoundException, SQLException, TaskNotFoundException, public void testStart() throws TaskNotFoundException,
WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException,
ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException,
InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException { InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
@ -123,7 +121,7 @@ public class TaskServiceImplIntAutocommitTest {
@Test(expected = TaskNotFoundException.class) @Test(expected = TaskNotFoundException.class)
public void testStartTransactionFail() public void testStartTransactionFail()
throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, throws TaskNotFoundException, NotAuthorizedException,
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException,
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
@ -153,7 +151,7 @@ public class TaskServiceImplIntAutocommitTest {
@Test @Test
public void testCreateTaskInTaskanaWithDefaultDb() public void testCreateTaskInTaskanaWithDefaultDb()
throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, throws SQLException, NotAuthorizedException,
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException,
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
@ -182,7 +180,7 @@ public class TaskServiceImplIntAutocommitTest {
} }
@Test @Test
public void should_ReturnList_when_BuilderIsUsed() throws SQLException, NotAuthorizedException, public void should_ReturnList_when_BuilderIsUsed() throws NotAuthorizedException,
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException,
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, SystemException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, SystemException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
@ -279,8 +277,7 @@ public class TaskServiceImplIntAutocommitTest {
@Test(expected = TaskNotFoundException.class) @Test(expected = TaskNotFoundException.class)
public void shouldNotTransferAnyTask() public void shouldNotTransferAnyTask()
throws WorkbasketNotFoundException, NotAuthorizedException, TaskNotFoundException, InvalidWorkbasketException, throws WorkbasketNotFoundException, NotAuthorizedException, TaskNotFoundException, InvalidStateException {
ClassificationNotFoundException, InvalidStateException {
taskServiceImpl.transfer(UUID.randomUUID() + "_X", "1"); taskServiceImpl.transfer(UUID.randomUUID() + "_X", "1");
} }
@ -373,7 +370,7 @@ public class TaskServiceImplIntAutocommitTest {
} }
@Test @Test
public void testWithPrimaryObjectRef() throws FileNotFoundException, SQLException, TaskNotFoundException, public void testWithPrimaryObjectRef() throws TaskNotFoundException,
WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException,
ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException,
InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException { InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {

View File

@ -5,13 +5,11 @@ import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.FileNotFoundException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import javax.security.auth.login.LoginException;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.After; import org.junit.After;
@ -85,7 +83,7 @@ public class TaskServiceImplIntExplicitTest {
} }
@Before @Before
public void setup() throws FileNotFoundException, SQLException, LoginException { public void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineConfigurationTest.getDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false); taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
@ -101,8 +99,8 @@ public class TaskServiceImplIntExplicitTest {
@WithAccessId(userName = "Elena", groupNames = {"businessadmin"}) @WithAccessId(userName = "Elena", groupNames = {"businessadmin"})
@Test(expected = TaskNotFoundException.class) @Test(expected = TaskNotFoundException.class)
public void testStartTransactionFail() public void testStartTransactionFail()
throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, throws SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException,
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, ClassificationNotFoundException, ClassificationAlreadyExistException,
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
@ -141,7 +139,7 @@ public class TaskServiceImplIntExplicitTest {
@WithAccessId(userName = "Elena", groupNames = {"businessadmin"}) @WithAccessId(userName = "Elena", groupNames = {"businessadmin"})
@Test @Test
public void testCreateTask() public void testCreateTask()
throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, throws SQLException, TaskNotFoundException, NotAuthorizedException,
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException,
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
@ -171,7 +169,7 @@ public class TaskServiceImplIntExplicitTest {
@WithAccessId(userName = "Elena", groupNames = {"businessadmin"}) @WithAccessId(userName = "Elena", groupNames = {"businessadmin"})
@Test @Test
public void testCreateTaskInTaskanaWithDefaultDb() public void testCreateTaskInTaskanaWithDefaultDb()
throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, throws SQLException, NotAuthorizedException,
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException,
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
@ -368,7 +366,7 @@ public class TaskServiceImplIntExplicitTest {
@Test(expected = TaskNotFoundException.class) @Test(expected = TaskNotFoundException.class)
public void shouldNotTransferAnyTask() public void shouldNotTransferAnyTask()
throws WorkbasketNotFoundException, NotAuthorizedException, TaskNotFoundException, SQLException, throws WorkbasketNotFoundException, NotAuthorizedException, TaskNotFoundException, SQLException,
InvalidWorkbasketException, ClassificationNotFoundException, InvalidStateException { InvalidStateException {
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection); taskanaEngineImpl.setConnection(connection);
taskServiceImpl.transfer(UUID.randomUUID() + "_X", "1"); taskServiceImpl.transfer(UUID.randomUUID() + "_X", "1");
@ -462,7 +460,7 @@ public class TaskServiceImplIntExplicitTest {
} }
private Task generateDummyTask() throws ClassificationAlreadyExistException, ClassificationNotFoundException, private Task generateDummyTask() throws ClassificationAlreadyExistException, ClassificationNotFoundException,
WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException, InvalidWorkbasketException, NotAuthorizedException,
WorkbasketAlreadyExistException, DomainNotFoundException, InvalidArgumentException { WorkbasketAlreadyExistException, DomainNotFoundException, InvalidArgumentException {
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket("wb", "DOMAIN_A"); WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket("wb", "DOMAIN_A");
workbasket.setName("wb"); workbasket.setName("wb");

View File

@ -1,6 +1,5 @@
package pro.taskana.impl.integration; package pro.taskana.impl.integration;
import java.io.FileNotFoundException;
import java.sql.SQLException; import java.sql.SQLException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
@ -12,7 +11,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.security.auth.login.LoginException;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
@ -73,7 +71,7 @@ public class WorkbasketServiceImplIntAutocommitTest {
} }
@Before @Before
public void setup() throws FileNotFoundException, SQLException, LoginException { public void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineConfigurationTest.getDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false); taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
@ -87,7 +85,7 @@ public class WorkbasketServiceImplIntAutocommitTest {
@Test(expected = WorkbasketNotFoundException.class) @Test(expected = WorkbasketNotFoundException.class)
public void testGetWorkbasketFail() public void testGetWorkbasketFail()
throws WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException { throws WorkbasketNotFoundException, NotAuthorizedException {
workBasketService.getWorkbasket("fail"); workBasketService.getWorkbasket("fail");
} }
@ -224,8 +222,7 @@ public class WorkbasketServiceImplIntAutocommitTest {
workBasketService.createWorkbasketAccessItem(accessItem); workBasketService.createWorkbasketAccessItem(accessItem);
} }
private Workbasket createTestWorkbasket(String id, String key, String domain, String name, WorkbasketType type) private Workbasket createTestWorkbasket(String id, String key, String domain, String name, WorkbasketType type) {
throws NotAuthorizedException {
WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket(key, domain); WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket(key, domain);
wb.setId(id); wb.setId(id);
wb.setName(name); wb.setName(name);

View File

@ -1,13 +1,11 @@
package pro.taskana.impl.integration; package pro.taskana.impl.integration;
import java.io.FileNotFoundException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.security.auth.login.LoginException;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.After; import org.junit.After;
@ -63,7 +61,7 @@ public class WorkbasketServiceImplIntExplicitTest {
} }
@Before @Before
public void setup() throws FileNotFoundException, SQLException, LoginException { public void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineConfigurationTest.getDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false); taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
@ -178,8 +176,7 @@ public class WorkbasketServiceImplIntExplicitTest {
workBasketService.createWorkbasketAccessItem(accessItem); workBasketService.createWorkbasketAccessItem(accessItem);
} }
private Workbasket createTestWorkbasket(String id, String key, String domain, String name, WorkbasketType type) private Workbasket createTestWorkbasket(String id, String key, String domain, String name, WorkbasketType type) {
throws NotAuthorizedException {
WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket(key, domain); WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket(key, domain);
wb.setId(id); wb.setId(id);
wb.setName(name); wb.setName(name);

View File

@ -10,7 +10,6 @@ import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidOwnerException; import pro.taskana.exceptions.InvalidOwnerException;
import pro.taskana.exceptions.InvalidStateException; import pro.taskana.exceptions.InvalidStateException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskAlreadyExistException;
import pro.taskana.exceptions.TaskNotFoundException; import pro.taskana.exceptions.TaskNotFoundException;
@ -25,8 +24,8 @@ public class ExampleBootstrap {
@PostConstruct @PostConstruct
public void test() throws TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, public void test() throws TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException,
ClassificationNotFoundException, InvalidStateException, InvalidOwnerException, InvalidWorkbasketException, ClassificationNotFoundException, InvalidStateException, InvalidOwnerException, TaskAlreadyExistException,
TaskAlreadyExistException, InvalidArgumentException { InvalidArgumentException {
System.out.println("---------------------------> Start App"); System.out.println("---------------------------> Start App");
Task task = taskService.newTask("1"); Task task = taskService.newTask("1");
task.setName("Spring example task"); task.setName("Spring example task");

View File

@ -67,8 +67,7 @@ public class TaskanaConfig {
} }
@Bean @Bean
public TaskanaEngine taskanaEngine(SpringTaskanaEngineConfiguration taskanaEngineConfiguration) public TaskanaEngine taskanaEngine(SpringTaskanaEngineConfiguration taskanaEngineConfiguration) {
throws SQLException {
TaskanaEngine taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); TaskanaEngine taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
// taskanaEngine.setConnectionManagementMode(TaskanaEngine.ConnectionManagementMode.EXPLICIT); // taskanaEngine.setConnectionManagementMode(TaskanaEngine.ConnectionManagementMode.EXPLICIT);
return taskanaEngine; return taskanaEngine;

View File

@ -15,7 +15,6 @@ import pro.taskana.exceptions.DomainNotFoundException;
import pro.taskana.exceptions.InvalidWorkbasketException; import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.WorkbasketAlreadyExistException; import pro.taskana.exceptions.WorkbasketAlreadyExistException;
import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.impl.WorkbasketImpl; import pro.taskana.impl.WorkbasketImpl;
import pro.taskana.impl.util.IdGenerator; import pro.taskana.impl.util.IdGenerator;
@ -54,7 +53,7 @@ public class TaskanaTestController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@RequestMapping("/transaction") @RequestMapping("/transaction")
public @ResponseBody String transaction(@RequestParam(value = "rollback", defaultValue = "false") String rollback) public @ResponseBody String transaction(@RequestParam(value = "rollback", defaultValue = "false") String rollback)
throws WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException, throws InvalidWorkbasketException, NotAuthorizedException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key", "workbasket")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key", "workbasket"));
@ -70,7 +69,7 @@ public class TaskanaTestController {
@RequestMapping("/transaction-many") @RequestMapping("/transaction-many")
public @ResponseBody String transactionMany( public @ResponseBody String transactionMany(
@RequestParam(value = "rollback", defaultValue = "false") String rollback) @RequestParam(value = "rollback", defaultValue = "false") String rollback)
throws WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException, throws InvalidWorkbasketException, NotAuthorizedException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key1", "workbasket1")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key1", "workbasket1"));
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key2", "workbasket2")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key2", "workbasket2"));
@ -87,7 +86,7 @@ public class TaskanaTestController {
@RequestMapping("/geschbuch") @RequestMapping("/geschbuch")
public @ResponseBody String transactionGeschbuch( public @ResponseBody String transactionGeschbuch(
@RequestParam(value = "rollback", defaultValue = "false") String rollback) @RequestParam(value = "rollback", defaultValue = "false") String rollback)
throws WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException, throws InvalidWorkbasketException, NotAuthorizedException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key1", "workbasket1")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key1", "workbasket1"));
taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key2", "workbasket2")); taskanaEngine.getWorkbasketService().createWorkbasket(createWorkBasket("key2", "workbasket2"));
@ -120,7 +119,7 @@ public class TaskanaTestController {
return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM GESCHBUCH.TEST", Integer.class); return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM GESCHBUCH.TEST", Integer.class);
} }
private Workbasket createWorkBasket(String key, String name) throws NotAuthorizedException { private Workbasket createWorkBasket(String key, String name) {
WorkbasketImpl workbasket = (WorkbasketImpl) taskanaEngine.getWorkbasketService().newWorkbasket(key, WorkbasketImpl workbasket = (WorkbasketImpl) taskanaEngine.getWorkbasketService().newWorkbasket(key,
"DOMAIN_A"); "DOMAIN_A");
String id1 = IdGenerator.generateWithPrefix("TWB"); String id1 = IdGenerator.generateWithPrefix("TWB");

View File

@ -1,7 +1,5 @@
package pro.taskana; package pro.taskana;
import java.sql.SQLException;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.mybatis.spring.transaction.SpringManagedTransactionFactory; import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
@ -19,7 +17,7 @@ public class SpringTaskanaEngineImpl extends TaskanaEngineImpl {
} }
@PostConstruct @PostConstruct
public void init() throws SQLException { public void init() {
this.transactionFactory = new SpringManagedTransactionFactory(); this.transactionFactory = new SpringManagedTransactionFactory();
this.sessionManager = createSqlSessionManager(); this.sessionManager = createSqlSessionManager();
} }

View File

@ -6,7 +6,6 @@ import org.springframework.transaction.annotation.Transactional;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskAlreadyExistException; import pro.taskana.exceptions.TaskAlreadyExistException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
@ -23,8 +22,7 @@ public class TaskanaComponent {
} }
public void triggerRollback() throws NotAuthorizedException, WorkbasketNotFoundException, public void triggerRollback() throws NotAuthorizedException, WorkbasketNotFoundException,
ClassificationNotFoundException, InvalidWorkbasketException, TaskAlreadyExistException, ClassificationNotFoundException, TaskAlreadyExistException, InvalidArgumentException {
InvalidArgumentException {
Task task = taskService.newTask("1"); Task task = taskService.newTask("1");
task.setName("Unit Test Task"); task.setName("Unit Test Task");
ObjectReference objRef = new ObjectReference(); ObjectReference objRef = new ObjectReference();

View File

@ -37,7 +37,7 @@ public class SampleDataGenerator {
runner = new ScriptRunner(dataSource.getConnection()); runner = new ScriptRunner(dataSource.getConnection());
} }
public void generateSampleData() throws SQLException { public void generateSampleData() {
StringWriter outWriter = new StringWriter(); StringWriter outWriter = new StringWriter();
PrintWriter logWriter = new PrintWriter(outWriter); PrintWriter logWriter = new PrintWriter(outWriter);

View File

@ -120,7 +120,6 @@ public class LdapClient {
message += " taskana.ldap.groupNameAttribute is not configured."; message += " taskana.ldap.groupNameAttribute is not configured.";
} }
if (!message.equals(emptyMessage)) { if (!message.equals(emptyMessage)) {
LOGGER.error("Ldap configuration error detected: {}", message);
throw new SystemException(message); throw new SystemException(message);
} }
active = true; active = true;
@ -130,7 +129,6 @@ public class LdapClient {
public List<AccessIdResource> searchUsersAndGroups(final String name) throws InvalidArgumentException { public List<AccessIdResource> searchUsersAndGroups(final String name) throws InvalidArgumentException {
LOGGER.debug("entry to searchUsersAndGroups(name = {})", name); LOGGER.debug("entry to searchUsersAndGroups(name = {})", name);
if (!active) { if (!active) {
LOGGER.error("LdapClient was called but is not active due to missing configuration: " + message);
throw new SystemException( throw new SystemException(
"LdapClient was called but is not active due to missing configuration: " + message); "LdapClient was called but is not active due to missing configuration: " + message);
} }
@ -155,7 +153,6 @@ public class LdapClient {
public List<AccessIdResource> searchUsersByName(final String name) throws InvalidArgumentException { public List<AccessIdResource> searchUsersByName(final String name) throws InvalidArgumentException {
LOGGER.debug("entry to searchUsersByName(name = {}).", name); LOGGER.debug("entry to searchUsersByName(name = {}).", name);
if (!active) { if (!active) {
LOGGER.error("LdapClient was called but is not active due to missing configuration: " + message);
throw new SystemException( throw new SystemException(
"LdapClient was called but is not active due to missing configuration: " + message); "LdapClient was called but is not active due to missing configuration: " + message);
} }
@ -176,22 +173,17 @@ public class LdapClient {
String[] userAttributesToReturn = {getUserFirstnameAttribute(), getUserLastnameAttribute(), String[] userAttributesToReturn = {getUserFirstnameAttribute(), getUserLastnameAttribute(),
getUserIdAttribute()}; getUserIdAttribute()};
try { final List<AccessIdResource> accessIds = ldapTemplate.search(getUserSearchBase(), andFilter.encode(),
final List<AccessIdResource> accessIds = ldapTemplate.search(getUserSearchBase(), andFilter.encode(), SearchControls.SUBTREE_SCOPE, userAttributesToReturn, new UserContextMapper());
SearchControls.SUBTREE_SCOPE, userAttributesToReturn, new UserContextMapper()); LOGGER.debug("exit from searchUsersByName. Retrieved the following users: {}.",
LOGGER.debug("exit from searchUsersByName. Retrieved the following users: {}.", LoggerUtils.listToString(accessIds));
LoggerUtils.listToString(accessIds)); return accessIds;
return accessIds;
} catch (Exception e) {
LOGGER.error("caught Exception {} ", e.getMessage());
throw e;
}
} }
public List<AccessIdResource> searchGroupsByName(final String name) throws InvalidArgumentException { public List<AccessIdResource> searchGroupsByName(final String name) throws InvalidArgumentException {
LOGGER.debug("entry to searchGroupsByName(name = {}).", name); LOGGER.debug("entry to searchGroupsByName(name = {}).", name);
if (!active) { if (!active) {
LOGGER.error("LdapClient was called but is not active due to missing configuration: " + message);
throw new SystemException( throw new SystemException(
"LdapClient was called but is not active due to missing configuration: " + message); "LdapClient was called but is not active due to missing configuration: " + message);
} }
@ -216,16 +208,11 @@ public class LdapClient {
groupAttributesToReturn = new String[] {getGroupNameAttribute(), CN}; groupAttributesToReturn = new String[] {getGroupNameAttribute(), CN};
} }
try { final List<AccessIdResource> accessIds = ldapTemplate.search(getGroupSearchBase(), andFilter.encode(),
final List<AccessIdResource> accessIds = ldapTemplate.search(getGroupSearchBase(), andFilter.encode(), SearchControls.SUBTREE_SCOPE, groupAttributesToReturn, new GroupContextMapper());
SearchControls.SUBTREE_SCOPE, groupAttributesToReturn, new GroupContextMapper()); LOGGER.debug("Exit from searchGroupsByName. Retrieved the following groups: {}",
LOGGER.debug("Exit from searchGroupsByName. Retrieved the following groups: {}", LoggerUtils.listToString(accessIds));
LoggerUtils.listToString(accessIds)); return accessIds;
return accessIds;
} catch (Exception e) {
LOGGER.error("caught Exception {} ", e.getMessage());
throw e;
}
} }

View File

@ -22,7 +22,7 @@ public abstract class AbstractPagingController {
pagesize = Long.valueOf(pagesizeParam); pagesize = Long.valueOf(pagesizeParam);
page = Long.valueOf(pageParam); page = Long.valueOf(pageParam);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new InvalidArgumentException("page and pagesize must be a integer value."); throw new InvalidArgumentException("page and pagesize must be a integer value.", e.getCause());
} }
PageMetadata pageMetadata = new PageMetadata(pagesize, page, totalElements); PageMetadata pageMetadata = new PageMetadata(pagesize, page, totalElements);
if (pageMetadata.getNumber() > pageMetadata.getTotalPages()) { if (pageMetadata.getNumber() > pageMetadata.getTotalPages()) {

View File

@ -194,7 +194,7 @@ public class ClassificationController extends AbstractPagingController {
} }
private ClassificationQuery applyFilterParams(ClassificationQuery query, private ClassificationQuery applyFilterParams(ClassificationQuery query,
MultiValueMap<String, String> params) throws InvalidArgumentException { MultiValueMap<String, String> params) {
if (params.containsKey(NAME)) { if (params.containsKey(NAME)) {
String[] names = extractCommaSeparatedFields(params.get(NAME)); String[] names = extractCommaSeparatedFields(params.get(NAME));
query.nameIn(names); query.nameIn(names);

View File

@ -91,7 +91,7 @@ public class TaskController extends AbstractPagingController {
@GetMapping @GetMapping
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<PagedResources<TaskSummaryResource>> getTasks( public ResponseEntity<PagedResources<TaskSummaryResource>> getTasks(
@RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException, NotAuthorizedException { @RequestParam MultiValueMap<String, String> params) throws InvalidArgumentException {
TaskQuery query = taskService.createTaskQuery(); TaskQuery query = taskService.createTaskQuery();
query = applyFilterParams(query, params); query = applyFilterParams(query, params);
@ -171,7 +171,7 @@ public class TaskController extends AbstractPagingController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity<TaskResource> createTask(@RequestBody TaskResource taskResource) public ResponseEntity<TaskResource> createTask(@RequestBody TaskResource taskResource)
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException { TaskAlreadyExistException, InvalidArgumentException {
Task createdTask = taskService.createTask(taskResourceAssembler.toModel(taskResource)); Task createdTask = taskService.createTask(taskResourceAssembler.toModel(taskResource));
ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(createdTask), ResponseEntity<TaskResource> result = new ResponseEntity<>(taskResourceAssembler.toResource(createdTask),
HttpStatus.CREATED); HttpStatus.CREATED);
@ -212,7 +212,7 @@ public class TaskController extends AbstractPagingController {
} }
private TaskQuery applyFilterParams(TaskQuery taskQuery, MultiValueMap<String, String> params) private TaskQuery applyFilterParams(TaskQuery taskQuery, MultiValueMap<String, String> params)
throws NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
// apply filters // apply filters
if (params.containsKey(NAME)) { if (params.containsKey(NAME)) {
@ -292,7 +292,7 @@ public class TaskController extends AbstractPagingController {
} }
private TaskQuery applySortingParams(TaskQuery taskQuery, MultiValueMap<String, String> params) private TaskQuery applySortingParams(TaskQuery taskQuery, MultiValueMap<String, String> params)
throws NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
// sorting // sorting
String sortBy = params.getFirst(SORT_BY); String sortBy = params.getFirst(SORT_BY);

View File

@ -13,7 +13,6 @@ import pro.taskana.TaskService;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskSummary; import pro.taskana.TaskSummary;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
/** /**
* TODO. * TODO.
@ -51,12 +50,12 @@ public class TaskFilter {
@Autowired @Autowired
private TaskService taskService; private TaskService taskService;
public List<TaskSummary> getAll() throws NotAuthorizedException { public List<TaskSummary> getAll() {
return taskService.createTaskQuery().list(); return taskService.createTaskQuery().list();
} }
public List<TaskSummary> inspectParams(MultiValueMap<String, String> params) public List<TaskSummary> inspectParams(MultiValueMap<String, String> params)
throws NotAuthorizedException, InvalidArgumentException { throws InvalidArgumentException {
TaskQuery taskQuery = taskService.createTaskQuery(); TaskQuery taskQuery = taskService.createTaskQuery();
// apply filters // apply filters

View File

@ -42,7 +42,7 @@ public class ClassificationResourceAssembler {
return addLinks(resource, classification); return addLinks(resource, classification);
} }
public Classification toModel(ClassificationResource classificationResource) throws NotAuthorizedException { public Classification toModel(ClassificationResource classificationResource) {
ClassificationImpl classification = (ClassificationImpl) classificationService.newClassification( ClassificationImpl classification = (ClassificationImpl) classificationService.newClassification(
classificationResource.domain, classificationResource.key, classificationResource.type); classificationResource.domain, classificationResource.key, classificationResource.type);
BeanUtils.copyProperties(classificationResource, classification); BeanUtils.copyProperties(classificationResource, classification);

View File

@ -108,7 +108,7 @@ public class TaskResourceAssembler
resource.setCustom16(task.getCustomAttribute("16")); resource.setCustom16(task.getCustomAttribute("16"));
} }
} catch (InvalidArgumentException e) { } catch (InvalidArgumentException e) {
throw new SystemException("caught unexpected Exception " + e); throw new SystemException("caught unexpected Exception.", e.getCause());
} }
return resource; return resource;

View File

@ -94,7 +94,7 @@ public class TaskSummaryResourceAssembler
resource.setCustom16(taskSummary.getCustomAttribute("16")); resource.setCustom16(taskSummary.getCustomAttribute("16"));
} }
} catch (InvalidArgumentException e) { } catch (InvalidArgumentException e) {
throw new SystemException("caught unexpected Exception " + e); throw new SystemException("caught unexpected Exception.", e.getCause());
} }
return resource; return resource;

View File

@ -37,7 +37,7 @@ public class WorkbasketAssembler {
return addLinks(resource, wb); return addLinks(resource, wb);
} }
public Workbasket toModel(WorkbasketResource wbResource) throws NotAuthorizedException { public Workbasket toModel(WorkbasketResource wbResource) {
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket(wbResource.key, wbResource.domain); WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket(wbResource.key, wbResource.domain);
BeanUtils.copyProperties(wbResource, workbasket); BeanUtils.copyProperties(wbResource, workbasket);
@ -55,7 +55,8 @@ public class WorkbasketAssembler {
resource.add(linkTo(methodOn(WorkbasketController.class).getWorkbasketAccessItems(wb.getId())) resource.add(linkTo(methodOn(WorkbasketController.class).getWorkbasketAccessItems(wb.getId()))
.withRel("accessItems")); .withRel("accessItems"));
resource.add(linkTo(WorkbasketController.class).withRel("allWorkbaskets")); resource.add(linkTo(WorkbasketController.class).withRel("allWorkbaskets"));
resource.add(linkTo(methodOn(WorkbasketController.class).removeDistributionTargetForWorkbasketId(wb.getId())).withRel("removeDistributionTargets")); resource.add(linkTo(methodOn(WorkbasketController.class).removeDistributionTargetForWorkbasketId(wb.getId()))
.withRel("removeDistributionTargets"));
return resource; return resource;
} }
} }

View File

@ -68,7 +68,7 @@ public class ClassificationAssemblerTest {
} }
@Test @Test
public void resourceToClassification() throws NotAuthorizedException { public void resourceToClassification() {
// given // given
ClassificationResource classificationResource = new ClassificationResource(); ClassificationResource classificationResource = new ClassificationResource();
classificationResource.setClassificationId("1"); classificationResource.setClassificationId("1");
@ -95,7 +95,8 @@ public class ClassificationAssemblerTest {
classificationResource.setServiceLevel("P1D"); classificationResource.setServiceLevel("P1D");
classificationResource.setDescription("Test"); classificationResource.setDescription("Test");
// when // when
ClassificationImpl classification = (ClassificationImpl) classificationResourceAssembler.toModel(classificationResource); ClassificationImpl classification = (ClassificationImpl) classificationResourceAssembler
.toModel(classificationResource);
// then // then
testEquality(classification, classificationResource); testEquality(classification, classificationResource);
} }

View File

@ -58,7 +58,7 @@ public class WorkbasketAssemblerTest {
} }
@Test @Test
public void resourceToWorkbasket() throws NotAuthorizedException { public void resourceToWorkbasket() {
// given // given
WorkbasketResource workbasketResource = new WorkbasketResource(); WorkbasketResource workbasketResource = new WorkbasketResource();
workbasketResource.setWorkbasketId("1"); workbasketResource.setWorkbasketId("1");