TSK-1207: extended JaasExtension to run with multiple access ids

This commit is contained in:
Mustapha Zorgati 2020-04-25 23:39:18 +02:00
parent 10fa326d5b
commit ac5f04ff3b
75 changed files with 961 additions and 1283 deletions

View File

@ -9,12 +9,12 @@ public interface CheckedFunction<T, E> {
static <T, E> Function<T, E> wrap(CheckedFunction<T, E> checkedFunction) {
return t -> {
try {
return checkedFunction.accept(t);
return checkedFunction.apply(t);
} catch (Throwable e) {
throw new SystemException("Caught exception", e);
}
};
}
E accept(T t) throws Throwable;
E apply(T t) throws Throwable;
}

View File

@ -63,11 +63,9 @@ public interface MonitorMapper {
+ ") AS B "
+ "GROUP BY B.WORKBASKET_KEY, B.AGE_IN_DAYS"
+ "</script>")
@Results({
@Result(column = "WORKBASKET_KEY", property = "key"),
@Result(column = "AGE_IN_DAYS", property = "ageInDays"),
@Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")
})
@Result(column = "WORKBASKET_KEY", property = "key")
@Result(column = "AGE_IN_DAYS", property = "ageInDays")
@Result(column = "NUMBER_OF_TASKS", property = "numberOfTasks")
List<MonitorQueryItem> getTaskCountOfWorkbaskets(
@Param("workbasketIds") List<String> workbasketIds,
@Param("states") List<TaskState> states,

View File

@ -34,6 +34,7 @@ public enum WildcardSearchField {
(first, second) -> first,
() -> new TreeMap<>(String.CASE_INSENSITIVE_ORDER)));
private String name;
WildcardSearchField(String name) {
this.name = name;
}

View File

@ -1,6 +1,5 @@
package acceptance;
import java.sql.Connection;
import java.sql.SQLException;
import java.time.Instant;
import java.time.LocalDate;
@ -101,13 +100,7 @@ public abstract class AbstractAccTest {
return attachment;
}
protected String getDatabaseProductId() throws SQLException {
try (Connection connection = taskanaEngineConfiguration.getDatasource().getConnection()) {
return connection.getMetaData().getDatabaseProductName();
}
}
protected TimeInterval todaysInterval() {
protected TimeInterval toDaysInterval() {
Instant begin =
LocalDateTime.of(LocalDate.now(), LocalTime.MIN).atZone(ZoneId.of("UTC")).toInstant();
Instant end =

View File

@ -33,8 +33,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateMasterClassification()
throws ClassificationAlreadyExistException, ClassificationNotFoundException,
@ -59,8 +59,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationWithMasterCopy()
throws ClassificationAlreadyExistException, ClassificationNotFoundException,
@ -108,8 +108,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationWithExistingMaster()
throws DomainNotFoundException, ClassificationAlreadyExistException, NotAuthorizedException,
@ -131,8 +131,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateChildInDomainAndCopyInMaster() throws TaskanaException {
Classification parent = classificationService.newClassification("Key0816", "DOMAIN_A", "TASK");
@ -151,8 +151,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationWithInvalidValues() {
classificationService.createClassificationQuery().count();
@ -173,8 +173,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationAlreadyExisting() throws TaskanaException {
Classification classification = classificationService.newClassification("Key3", "", "TASK");
@ -185,8 +185,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationInUnknownDomain() {
Classification classification =
@ -196,8 +196,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationOfUnknownType() {
Classification classification =
@ -207,8 +207,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationOfUnknownCategory() {
Classification classification =
@ -219,8 +219,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationWithInvalidParentId() {
Classification classification = classificationService.newClassification("Key5", "", "TASK");
@ -230,8 +230,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationWithInvalidParentKey() {
Classification classification = classificationService.newClassification("Key5", "", "TASK");
@ -241,8 +241,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testCreateClassificationWithExplicitId() {
ClassificationImpl classification =
@ -253,8 +253,8 @@ class CreateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void should_beAbleToCreateNewClassification_When_ClassificationCopy() throws Exception {
ClassificationImpl oldClassification =

View File

@ -27,9 +27,7 @@ class DeleteClassificationAccTest extends AbstractAccTest {
classificationService = taskanaEngine.getClassificationService();
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testDeleteClassificationInDomain()
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
@ -41,8 +39,8 @@ class DeleteClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testDeleteClassificationInDomainUserIsNotAuthorized() {
ThrowingCallable call = () -> classificationService.deleteClassification("L140101", "DOMAIN_A");
@ -50,8 +48,8 @@ class DeleteClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testThrowExeptionIfDeleteClassificationWithExistingTasks() {
ThrowingCallable call = () -> classificationService.deleteClassification("L1050", "DOMAIN_A");
@ -59,17 +57,15 @@ class DeleteClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testThrowExeptionIfDeleteMasterClassificationWithExistingTasks() {
ThrowingCallable call = () -> classificationService.deleteClassification("L1050", "");
assertThatThrownBy(call).isInstanceOf(ClassificationInUseException.class);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testDeleteMasterClassification()
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
@ -79,9 +75,7 @@ class DeleteClassificationAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(ClassificationNotFoundException.class);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testDeleteMasterClassificationWithExistingAttachment() {
ThrowingCallable call = () -> classificationService.deleteClassification("L12010", "");
@ -89,8 +83,8 @@ class DeleteClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testThrowExceptionWhenChildClassificationIsInUseAndRollback()
throws ClassificationNotFoundException {
@ -110,9 +104,7 @@ class DeleteClassificationAccTest extends AbstractAccTest {
assertThat(rollbackA.getDomain()).isNotEqualTo(rollbackMaster.getDomain());
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testThrowClassificationNotFoundIfClassificationNotExists() {
ThrowingCallable call =
@ -120,9 +112,7 @@ class DeleteClassificationAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(ClassificationNotFoundException.class);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testThrowClassificationNotFoundIfClassificationNotExistsInDomain() {
ThrowingCallable call = () -> classificationService.deleteClassification("L10000", "DOMAIN_B");

View File

@ -215,7 +215,7 @@ class QueryClassificationAccTest extends AbstractAccTest {
classificationService
.createClassificationQuery()
.domainIn("DOMAIN_A")
.createdWithin(todaysInterval())
.createdWithin(toDaysInterval())
.list();
assertThat(classificationSummaryList).hasSize(17);
@ -233,7 +233,7 @@ class QueryClassificationAccTest extends AbstractAccTest {
assertThat(list).hasSize(15);
}
@WithAccessId(userName = "businessadmin")
@WithAccessId(user = "businessadmin")
@Test
void testFindClassificationByModifiedWithin()
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,

View File

@ -41,9 +41,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
classificationService = taskanaEngine.getClassificationService();
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
public void testUpdateClassification()
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
@ -113,8 +111,8 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
public void testUpdateTaskOnClassificationKeyCategoryChange() throws Exception {
setupTest();
@ -145,8 +143,8 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
public void testUpdateClassificationNotLatestAnymore()
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
@ -172,8 +170,8 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
public void testUpdateClassificationParentIdToInvalid()
throws NotAuthorizedException, ClassificationNotFoundException, ConcurrencyException,
@ -185,8 +183,8 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
public void testUpdateClassificationParentKeyToInvalid()
throws NotAuthorizedException, ClassificationNotFoundException, ConcurrencyException,
@ -197,9 +195,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(ClassificationNotFoundException.class);
}
@WithAccessId(
userName = "dummy",
groupNames = {"admin"})
@WithAccessId(user = "dummy", groups = "admin")
@Test
public void testUpdateClassificationPrioServiceLevel()
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
@ -285,9 +281,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
before, tasksWithP15D, taskService, converter, 15, 1000);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
public void testUpdateClassificationWithSameKeyAndParentKey()
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
@ -300,9 +294,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
public void testUpdateClassificationWithEmptyServiceLevel()
throws DomainNotFoundException, ClassificationAlreadyExistException, NotAuthorizedException,
@ -315,9 +307,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
classificationService.updateClassification(created);
}
@WithAccessId(
userName = "dummy",
groupNames = {"admin"})
@WithAccessId(user = "dummy", groups = "admin")
@Test
public void testUpdateClassificationChangePriority()
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
@ -455,9 +445,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
before, tasksWithPrio101, taskService, converter, 1, 101);
}
@WithAccessId(
userName = "dummy",
groupNames = {"admin"})
@WithAccessId(user = "dummy", groups = "admin")
@Test
public void testUpdateClassificationChangeServiceLevel()
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,

View File

@ -39,7 +39,7 @@ class TaskCleanupJobAccTest extends AbstractAccTest {
taskService = taskanaEngine.getTaskService();
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void shouldCleanCompletedTasksUntilDate() throws Exception {
@ -56,7 +56,7 @@ class TaskCleanupJobAccTest extends AbstractAccTest {
assertThat(totalTasksCount).isEqualTo(68);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void shouldCleanCompletedTasksUntilDateWithSameParentBussiness() throws Exception {
long totalTasksCount = taskService.createTaskQuery().count();
@ -82,7 +82,7 @@ class TaskCleanupJobAccTest extends AbstractAccTest {
assertThat(totalTasksCount).isEqualTo(66);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void shouldNotCleanCompleteTasksAfterDefinedDay() throws Exception {
Task createdTask = createAndCompleteTask();

View File

@ -38,7 +38,7 @@ class WorkbasketCleanupJobAccTest extends AbstractAccTest {
resetDb(true);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void shouldCleanWorkbasketMarkedForDeletionWithoutTasks() throws TaskanaException {
long totalWorkbasketCount = workbasketService.createWorkbasketQuery().count();
@ -69,7 +69,7 @@ class WorkbasketCleanupJobAccTest extends AbstractAccTest {
assertThat(totalWorkbasketCount).isEqualTo(24);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void shouldNotCleanWorkbasketMarkedForDeletionIfWorkbasketHasTasks() throws Exception {
long totalWorkbasketCount = workbasketService.createWorkbasketQuery().count();

View File

@ -46,9 +46,7 @@ import pro.taskana.workbasket.api.models.WorkbasketAccessItem;
@ExtendWith(JaasExtension.class)
public class UpdateObjectsUseUtcTimeStampsAccTest extends AbstractAccTest {
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testTimestampsOnTaskUpdate()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -75,9 +73,7 @@ public class UpdateObjectsUseUtcTimeStampsAccTest extends AbstractAccTest {
assertThat(retrievedTask).isEqualTo(updatedTask);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreatedTaskObjectEqualsReadTaskObjectInNewTimezone()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -115,9 +111,7 @@ public class UpdateObjectsUseUtcTimeStampsAccTest extends AbstractAccTest {
assertThat(readTask).isEqualTo(createdTask);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testTimestampsOnClassificationUpdate()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -138,8 +132,8 @@ public class UpdateObjectsUseUtcTimeStampsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testTimestampsOnCreateMasterClassification()
throws ClassificationAlreadyExistException, ClassificationNotFoundException,
@ -163,9 +157,7 @@ public class UpdateObjectsUseUtcTimeStampsAccTest extends AbstractAccTest {
assertThat(retrievedClassification).isEqualTo(classification);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testTimestampsOnWorkbasketUpdate()
throws TaskNotFoundException, InvalidArgumentException, ConcurrencyException,
@ -183,9 +175,7 @@ public class UpdateObjectsUseUtcTimeStampsAccTest extends AbstractAccTest {
assertThat(retrievedWorkbasket).isEqualTo(updatedWorkbasket);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_2", groups = "businessadmin")
@Test
void testTimestampsOnCreateWorkbasket()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
@ -214,9 +204,7 @@ public class UpdateObjectsUseUtcTimeStampsAccTest extends AbstractAccTest {
assertThat(retrievedWorkbasket).isEqualTo(workbasket);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_2", groups = "businessadmin")
@Test
void testTimestampsOnCreateScheduledJob()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,

View File

@ -34,7 +34,7 @@ class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetCustomAttributeValuesForOneWorkbasket() throws NotAuthorizedException {
MonitorService monitorService = taskanaEngine.getMonitorService();
@ -48,7 +48,7 @@ class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest {
assertThat(values).containsOnly("Vollkasko", "Teilkasko");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetCustomAttributeValuesForOneDomain() throws NotAuthorizedException {
MonitorService monitorService = taskanaEngine.getMonitorService();
@ -61,7 +61,7 @@ class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest {
assertThat(values).hasSize(26);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetCustomAttributeValuesForCustomAttribute() throws NotAuthorizedException {
MonitorService monitorService = taskanaEngine.getMonitorService();
@ -79,7 +79,7 @@ class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest {
assertThat(values).hasSize(12);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetCustomAttributeValuesForExcludedClassifications() throws NotAuthorizedException {
MonitorService monitorService = taskanaEngine.getMonitorService();

View File

@ -39,7 +39,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCategoryReport() throws InvalidArgumentException, NotAuthorizedException {
final MonitorService monitorService = taskanaEngine.getMonitorService();
@ -88,7 +88,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000032");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCategoryReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -134,7 +134,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000031");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCategoryReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -186,7 +186,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000032");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCategoryReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -224,7 +224,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000032");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCategoryReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -269,7 +269,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000028");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCategoryReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -316,7 +316,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000032");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testThrowsExceptionIfSubKeysAreUsed() {
final MonitorService monitorService = taskanaEngine.getMonitorService();

View File

@ -54,7 +54,7 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfClassificationReport()
throws InvalidArgumentException, NotAuthorizedException {
@ -99,7 +99,7 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000006");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfClassificationReportWithAttachments()
throws InvalidArgumentException, NotAuthorizedException {
@ -141,7 +141,7 @@ class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000001", "TKI:000000000000000000000000000000000033");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfClassificationReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {

View File

@ -42,7 +42,7 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCustomFieldValueReport()
throws InvalidArgumentException, NotAuthorizedException {
@ -89,7 +89,7 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000033");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCustomFieldValueReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -134,7 +134,7 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000020");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCustomFieldValueReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -181,7 +181,7 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(ids.contains("TKI:000000000000000000000000000000000033")).isTrue();
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCustomFieldValueReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -224,7 +224,7 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(ids.contains("TKI:000000000000000000000000000000000029")).isTrue();
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCustomFieldValueReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -266,7 +266,7 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(ids.contains("TKI:000000000000000000000000000000000033")).isTrue();
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfCustomFieldValueReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -311,7 +311,7 @@ class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(ids.contains("TKI:000000000000000000000000000000000029")).isTrue();
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testThrowsExceptionIfSubKeysAreUsed() {
final MonitorService monitorService = taskanaEngine.getMonitorService();

View File

@ -35,7 +35,7 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfWorkbasketReport() throws InvalidArgumentException, NotAuthorizedException {
final MonitorService monitorService = taskanaEngine.getMonitorService();
@ -80,7 +80,7 @@ class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
"TKI:000000000000000000000000000000000050");
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTaskIdsOfWorkbasketReportWithExcludedClassifications()
throws InvalidArgumentException, NotAuthorizedException {

View File

@ -46,7 +46,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTotalNumbersOfTasksOfCategoryReport()
throws InvalidArgumentException, NotAuthorizedException {
@ -70,7 +70,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetCategoryReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
@ -104,7 +104,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertThat(sumLineCount).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCategoryReport() throws InvalidArgumentException, NotAuthorizedException {
MonitorService monitorService = taskanaEngine.getMonitorService();
@ -135,7 +135,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {2, 2, 2, 0, 4});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCategoryReportNotInWorkingDays()
throws InvalidArgumentException, NotAuthorizedException {
@ -163,7 +163,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {4, 0, 2, 0, 4});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCategoryReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -198,7 +198,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {1, 0, 1, 0, 1});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCategoryReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -232,7 +232,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {2, 2, 2, 0, 0});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCategoryReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -263,7 +263,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertThat(row2).isEqualTo(new int[] {2, 2, 2, 0, 4});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCategoryReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -297,7 +297,7 @@ class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {2, 0, 0, 0, 3});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCategoryReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException {

View File

@ -44,7 +44,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTotalNumbersOfTasksOfClassificationReport()
throws InvalidArgumentException, NotAuthorizedException {
@ -72,7 +72,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetClassificationReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
@ -115,7 +115,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
assertThat(sumLineCount).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfClassificationReport()
throws InvalidArgumentException, NotAuthorizedException {
@ -153,7 +153,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
assertThat(row5).isEqualTo(new int[] {3, 3, 0, 5, 2});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfClassificationReportNotInWorkingDays()
throws InvalidArgumentException, NotAuthorizedException {
@ -190,7 +190,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
assertThat(row5).isEqualTo(new int[] {6, 0, 0, 0, 7});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfClassificationReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -231,7 +231,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
assertThat(row5).isEqualTo(new int[] {2, 2, 0, 0, 0});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfClassificationReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -271,7 +271,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
assertThat(row5).isEqualTo(new int[] {3, 3, 0, 5, 0});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfClassificationReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -302,7 +302,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
assertThat(row2).isEqualTo(new int[] {2, 2, 2, 0, 4});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfClassificationReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -342,7 +342,7 @@ class ProvideClassificationReportAccTest extends AbstractReportAccTest {
assertThat(row5).isEqualTo(new int[] {0, 1, 0, 3, 0});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfClassificationReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException {

View File

@ -43,7 +43,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom1()
throws InvalidArgumentException, NotAuthorizedException {
@ -69,7 +69,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom2()
throws InvalidArgumentException, NotAuthorizedException {
@ -94,7 +94,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetCustomFieldValueReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
@ -126,7 +126,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCustomFieldValueReport()
throws InvalidArgumentException, NotAuthorizedException {
@ -158,7 +158,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {3, 4, 1, 1, 6});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCustomFieldValueReportNotInWorkingDays()
throws InvalidArgumentException, NotAuthorizedException {
@ -189,7 +189,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {7, 0, 1, 0, 7});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCustomFieldValueReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -224,7 +224,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {3, 1, 0, 0, 1});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCustomFieldValueReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -258,7 +258,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {3, 4, 1, 1, 0});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCustomFieldValueReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -292,7 +292,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {0, 2, 0, 0, 4});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCustomFieldValueReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -326,7 +326,7 @@ class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {1, 1, 1, 0, 3});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfCustomFieldValueReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException {

View File

@ -46,7 +46,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTotalNumbersOfTasksOfDetailedClassificationReport()
throws InvalidArgumentException, NotAuthorizedException {
@ -99,7 +99,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetDetailedClassificationReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
@ -132,7 +132,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfDetailedClassificationReport()
throws InvalidArgumentException, NotAuthorizedException {
@ -197,7 +197,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {3, 3, 0, 5, 2});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfDetailedClassificationReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -262,7 +262,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {2, 2, 0, 0, 0});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfDetailedClassificationReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -326,7 +326,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {3, 3, 0, 5, 0});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfDetailedClassificationReportNotInWorkingDays()
throws InvalidArgumentException, NotAuthorizedException {
@ -390,7 +390,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {6, 0, 0, 0, 7});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfDetailedClassificationReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -433,7 +433,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
assertThat(detailedLine2WithoutAttachment.getCells()).isEqualTo(new int[] {2, 2, 2, 0, 4});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfDetailedClassificationReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -497,7 +497,7 @@ class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
assertThat(detailedLineNoAttachment5.getCells()).isEqualTo(new int[] {0, 1, 0, 3, 0});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfDetailedClassificationReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException {

View File

@ -50,7 +50,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testCompleteTaskStatusReport() throws NotAuthorizedException, InvalidArgumentException {
// given
@ -81,7 +81,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
assertThat(sumRow.getTotalValue()).isEqualTo(50);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testCompleteTaskStatusReportAsAdmin()
throws NotAuthorizedException, InvalidArgumentException {
@ -89,7 +89,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
monitorService.createTaskStatusReportBuilder().buildReport();
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testCompleteTaskStatusReportWithDomainFilter()
throws NotAuthorizedException, InvalidArgumentException {
@ -121,7 +121,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
assertThat(sumRow.getTotalValue()).isEqualTo(38);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testCompleteTaskStatusReportWithStateFilter()
throws NotAuthorizedException, InvalidArgumentException {
@ -157,9 +157,7 @@ class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
assertThat(sumRow.getTotalValue()).isEqualTo(41);
}
@WithAccessId(
userName = "monitor",
groupNames = {"admin"})
@WithAccessId(user = "monitor", groups = "admin")
@Test
void testCompleteTaskStatusReportWithStates()
throws NotAuthorizedException, InvalidArgumentException, InvalidStateException,

View File

@ -32,7 +32,7 @@ class ProvideTimestampReportAccTest extends AbstractReportAccTest {
*
* @throws Exception if any error occurs during the test.
*/
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testProperInsertionOfQueryItems() throws Exception {
MonitorService monitorService = taskanaEngine.getMonitorService();

View File

@ -44,7 +44,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTotalNumbersOfTasksOfWorkbasketReportBasedOnDueDate()
throws InvalidArgumentException, NotAuthorizedException {
@ -66,7 +66,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(report.getSumRow().getTotalValue()).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetWorkbasketReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {
@ -101,7 +101,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(sumLineCount).isEqualTo(50);
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReport() throws InvalidArgumentException, NotAuthorizedException {
MonitorService monitorService = taskanaEngine.getMonitorService();
@ -132,7 +132,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {2, 2, 0, 0, 6});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReportNotInWorkingDays()
throws InvalidArgumentException, NotAuthorizedException {
@ -163,7 +163,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {4, 0, 0, 0, 6});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -192,7 +192,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(row1).isEqualTo(new int[] {13, 3, 1, 1, 2});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -226,7 +226,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {2, 2, 0, 0, 0});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -260,7 +260,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {0, 1, 0, 0, 4});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -294,7 +294,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {1, 1, 0, 0, 2});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException {
@ -329,7 +329,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {2, 1, 0, 0, 1});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testEachItemOfWorkbasketReportForSelectedClassifications()
throws InvalidArgumentException, NotAuthorizedException {
@ -377,7 +377,7 @@ class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
assertThat(row3).isEqualTo(new int[] {1, 0, 0, 0, 3});
}
@WithAccessId(userName = "monitor")
@WithAccessId(user = "monitor")
@Test
void testGetTotalNumbersOfTasksOfWorkbasketReportBasedOnPlannedDateWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException {

View File

@ -34,7 +34,7 @@ class ClassificationQueryAccTest extends AbstractAccTest {
assertThat(classificationSummaryList).hasSize(17);
}
@WithAccessId(userName = "businessadmin")
@WithAccessId(user = "businessadmin")
@Test
void testFindClassificationsByDomainBusinessAdmin() {
ClassificationService classificationService = taskanaEngine.getClassificationService();
@ -45,7 +45,7 @@ class ClassificationQueryAccTest extends AbstractAccTest {
assertThat(classificationSummaryList).hasSize(17);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testFindClassificationsByDomainAdmin() {
ClassificationService classificationService = taskanaEngine.getClassificationService();

View File

@ -30,9 +30,7 @@ class TaskEngineAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_1", groups = "businessadmin")
@Test
void testRunAsAdminIsOnlyTemporary() throws NoSuchFieldException, IllegalAccessException {
assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isTrue();
@ -45,7 +43,7 @@ class TaskEngineAccTest extends AbstractAccTest {
assertThat(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)).isFalse();
}
@WithAccessId(userName = "user_1_1") // , groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_1") // , groupNames = {"businessadmin"})
@Test
void testUser() {
assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isFalse();
@ -54,9 +52,7 @@ class TaskEngineAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_1", groups = "businessadmin")
@Test
void testBusinessAdmin() throws NotAuthorizedException {
assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isTrue();
@ -64,9 +60,7 @@ class TaskEngineAccTest extends AbstractAccTest {
taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"admin"})
@WithAccessId(user = "user_1_1", groups = "admin")
@Test
void testAdmin() throws NotAuthorizedException {
assertThat(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)).isFalse();

View File

@ -29,7 +29,7 @@ class TaskQueryAccTest extends AbstractAccTest {
assertThat(results).isEmpty();
}
@WithAccessId(userName = "user_1_1") // , groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_1") // , groupNames = {"businessadmin"})
@Test
void testTaskQueryUser_1_1() {
TaskService taskService = taskanaEngine.getTaskService();
@ -39,9 +39,7 @@ class TaskQueryAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_1", groups = "businessadmin")
@Test
void testTaskQueryUser_1_1BusinessAdm() {
TaskService taskService = taskanaEngine.getTaskService();
@ -51,9 +49,7 @@ class TaskQueryAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"admin"})
@WithAccessId(user = "user_1_1", groups = "admin")
@Test
void testTaskQueryUser_1_1Admin() {
TaskService taskService = taskanaEngine.getTaskService();

View File

@ -43,7 +43,7 @@ class WorkbasketQueryAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "unknown")
@WithAccessId(user = "unknown")
@Test
void testQueryWorkbasketByUnknownUser() throws InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -62,7 +62,7 @@ class WorkbasketQueryAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "unknown", groupNames = "businessadmin")
@WithAccessId(user = "unknown", groups = "businessadmin")
@Test
void testQueryWorkbasketByBusinessAdmin()
throws NotAuthorizedException, InvalidArgumentException {
@ -82,7 +82,7 @@ class WorkbasketQueryAccTest extends AbstractAccTest {
assertThat(results).hasSize(13);
}
@WithAccessId(userName = "unknown", groupNames = "admin")
@WithAccessId(user = "unknown", groups = "admin")
@Test
void testQueryWorkbasketByAdmin() throws NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -37,9 +37,7 @@ import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
@ExtendWith(JaasExtension.class)
class CallbackStateAccTest extends AbstractAccTest {
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateTaskWithDifferentCallbackStates()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -65,9 +63,7 @@ class CallbackStateAccTest extends AbstractAccTest {
assertThat(createdTask.getCallbackState()).isEqualTo(CallbackState.CLAIMED);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testDeletionOfTaskWithWrongCallbackStateIsBlocked()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -114,9 +110,7 @@ class CallbackStateAccTest extends AbstractAccTest {
.hasMessageEndingWith(endOfMessage);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testUpdateOfCallbackState()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -182,9 +176,7 @@ class CallbackStateAccTest extends AbstractAccTest {
assertThat(bulkResult3.containsErrors()).isFalse();
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testInvalidUpdateOfCallbackStateToNone()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -220,9 +212,7 @@ class CallbackStateAccTest extends AbstractAccTest {
assertThat(failedTaskIds).hasSize(3);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testInvalidUpdateOfCallbackStateToComplete()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -262,9 +252,7 @@ class CallbackStateAccTest extends AbstractAccTest {
assertThat(failedTaskIds).hasSize(2).doesNotContain(createdTask3.getExternalId());
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testInvalidUpdateOfCallbackStateToClaimed()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -308,9 +296,7 @@ class CallbackStateAccTest extends AbstractAccTest {
.containsOnly(createdTask2.getExternalId(), createdTask3.getExternalId());
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testInvalidUpdateOfCallbackStateToRequired()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -347,9 +333,7 @@ class CallbackStateAccTest extends AbstractAccTest {
assertThat(failedTaskIds).containsOnly(createdTask3.getExternalId());
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testQueriesWithCallbackState() throws Exception {
resetDb(false);

View File

@ -34,9 +34,7 @@ class CancelTaskAccTest extends AbstractAccTest {
resetDb(false);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testQeryCancelledTasks() {
List<TaskSummary> taskSummaries =
@ -44,9 +42,7 @@ class CancelTaskAccTest extends AbstractAccTest {
assertThat(taskSummaries).hasSize(5);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testCancelReadyTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException {
@ -59,9 +55,7 @@ class CancelTaskAccTest extends AbstractAccTest {
assertThat(numTasks).isEqualTo(6);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testCancelClaimedTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException {
@ -79,9 +73,7 @@ class CancelTaskAccTest extends AbstractAccTest {
assertThat(numTasksCancelled).isEqualTo(6);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testCancelCompletedTask() {
List<TaskSummary> taskSummaries =
@ -93,9 +85,7 @@ class CancelTaskAccTest extends AbstractAccTest {
assertThatThrownBy(taskanaCall).isInstanceOf(InvalidStateException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testCancelTerminatedTask() {
List<TaskSummary> taskSummaries =
@ -106,9 +96,7 @@ class CancelTaskAccTest extends AbstractAccTest {
assertThatThrownBy(taskanaCall).isInstanceOf(InvalidStateException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testCancelCancelledTask() {
List<TaskSummary> taskSummaries =

View File

@ -33,9 +33,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCompleteTask()
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
@ -51,9 +49,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThat(completedTask.getModified()).isNotEqualTo(completedTask.getCreated());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCompleteTaskTwice()
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
@ -64,9 +60,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThat(completedTask2).isEqualTo(completedTask);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testForceCompleteAlreadyClaimed()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -92,9 +86,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThat(completedTask.getCompleted()).isEqualTo(completedTask.getModified());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testForceCompleteNotClaimed()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -119,9 +111,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThat(completedTask.getCompleted()).isEqualTo(completedTask.getModified());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCompleteTaskThrowsErrors() {
TaskService taskService = taskanaEngine.getTaskService();
@ -151,9 +141,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidOwnerException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testClaimTaskWithDefaultFlag()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -183,9 +171,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThat(claimedTask.getModified()).isEqualTo(claimedTask.getClaimed());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testForceClaimTaskFromOtherUser()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -215,9 +201,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThat(taskAfterClaim.isRead()).isTrue();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testClaimTaskNotExisting() {
@ -229,9 +213,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testClaimTaskWithInvalidState() {
@ -243,9 +225,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidStateException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testClaimTaskWithInvalidOwner() {
@ -257,9 +237,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidOwnerException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCancelClaimForcedWithInvalidState() {
@ -271,9 +249,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidStateException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCancelClaimDefaultFlag()
throws NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException,
@ -296,9 +272,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThat(TaskState.READY).isEqualTo(createdTask.getState());
}
@WithAccessId(
userName = "admin",
groupNames = {"admin"})
@WithAccessId(user = "admin", groups = "admin")
@Test
void testForceCancelClaimSuccessfull()
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
@ -322,9 +296,7 @@ class CompleteTaskAccTest extends AbstractAccTest {
assertThat(taskAfter.isRead()).isTrue();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCancelClaimWithInvalidOwner() {

View File

@ -60,9 +60,7 @@ class CreateTaskAccTest extends AbstractAccTest {
classificationService = taskanaEngine.getClassificationService();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_beAbleToCreateNewTask_When_TaskCopy() throws Exception {
Task oldTask = taskService.getTask("TKI:000000000000000000000000000000000000");
@ -77,9 +75,7 @@ class CreateTaskAccTest extends AbstractAccTest {
.containsOnly(newTask.getId());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateSimpleManualTask()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -113,9 +109,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(createdTask.isTransferred()).isFalse();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateTaskWithPlanned()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -140,9 +134,7 @@ class CreateTaskAccTest extends AbstractAccTest {
.isCloseTo(createdTask.getCreated(), new TemporalUnitWithinOffset(5L, ChronoUnit.SECONDS));
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateTaskWithInvalidPlannedAndDue() {
@ -162,9 +154,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateTaskWithValidPlannedAndDue()
throws ClassificationNotFoundException, InvalidArgumentException {
@ -196,9 +186,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThatCode(call).doesNotThrowAnyException();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testIdempotencyOfTaskCreation()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -242,9 +230,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(TaskAlreadyExistException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateSimpleTaskWithCustomAttributes()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -311,9 +297,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(customAttributesForCreate).isEqualTo(customAttributesFromDb);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateExternalTaskWithAttachment()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -399,9 +383,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(customAttributesForCreate).isEqualTo(customAttributesFromDb);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateExternalTaskWithMultipleAttachments()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -453,9 +435,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(readTask.getAttachments().get(0).getObjectReference()).isNotNull();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCalculationOfDueDateAtCreate()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -488,9 +468,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(shouldBeDueDate).isEqualTo(readTask.getDue());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCalculationOfPlannedDateAtCreate()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -525,9 +503,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(shouldBePlannedDate).isEqualTo(readTask.getPlanned());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testPrioDurationOfTaskFromAttachmentsAtCreate()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -588,9 +564,7 @@ class CreateTaskAccTest extends AbstractAccTest {
.isEqualTo(readTask.getDue());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testThrowsExceptionIfAttachmentIsInvalid() throws ClassificationNotFoundException {
@ -674,9 +648,7 @@ class CreateTaskAccTest extends AbstractAccTest {
createSimpleCustomProperties(3)));
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testUseCustomNameIfSetForNewTask()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -694,9 +666,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(createdTask.getName()).isEqualTo("Test Name");
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testUseClassificationMetadataFromCorrectDomainForNewTask()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -714,9 +684,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(createdTask.getPriority()).isEqualTo(2);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetExceptionIfWorkbasketDoesNotExist() {
@ -732,9 +700,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(WorkbasketNotFoundException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetExceptionIfAppendIsNotPermitted() {
@ -750,9 +716,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete() {
@ -783,9 +747,7 @@ class CreateTaskAccTest extends AbstractAccTest {
testCreateTask.accept(createObjectReference(null, "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testSetDomainFromWorkbasket()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -807,9 +769,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(createdTask.getDomain()).isEqualTo(workbasket.getDomain());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreatedTaskObjectEqualsReadTaskObject()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -843,9 +803,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThat(readTask).isEqualTo(createdTask);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateSimpleTaskWithCallbackInfo()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -897,9 +855,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateTaskAlreadyExisting() throws NotAuthorizedException, TaskNotFoundException {
@ -912,9 +868,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(TaskAlreadyExistException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testCreateTaskNotAuthorizedOnWorkbasket() {
@ -927,9 +881,7 @@ class CreateTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testCreateTaskWithWorkbasketMarkedForDeletion()
throws NotAuthorizedException, InvalidStateException, TaskNotFoundException,

View File

@ -23,9 +23,7 @@ public class CreateTaskCommentAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_CreateTaskComment_For_TaskComment()
throws TaskNotFoundException, NotAuthorizedException, InvalidArgumentException {
@ -48,9 +46,7 @@ public class CreateTaskCommentAccTest extends AbstractAccTest {
assertThat(taskCommentsAfterInsert).hasSize(3);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_FailToCreateTaskComment_When_TaskIdIsNullOrNonExisting() {

View File

@ -29,9 +29,7 @@ class DeleteTaskAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testDeleteSingleTaskNotAuthorized() {
@ -44,8 +42,8 @@ class DeleteTaskAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1", "admin"})
user = "user_1_2",
groups = {"group_1", "admin"})
@Test
void testDeleteSingleTask()
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
@ -63,8 +61,8 @@ class DeleteTaskAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1", "admin"})
user = "user_1_2",
groups = {"group_1", "admin"})
@Test
void testThrowsExceptionIfTaskIsNotCompleted()
throws TaskNotFoundException, NotAuthorizedException {
@ -79,8 +77,8 @@ class DeleteTaskAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1", "admin"})
user = "user_1_2",
groups = {"group_1", "admin"})
@Test
void testForceDeleteTaskIfNotCompleted()
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
@ -104,9 +102,7 @@ class DeleteTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testBulkDeleteTask() throws InvalidArgumentException {
@ -125,9 +121,7 @@ class DeleteTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testBulkDeleteTasksWithException()
throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedException {

View File

@ -25,9 +25,7 @@ public class DeleteTaskCommentAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_DeleteTaskComment_For_TaskCommentId()
throws TaskCommentNotFoundException, NotAuthorizedException, TaskNotFoundException,
@ -47,9 +45,7 @@ public class DeleteTaskCommentAccTest extends AbstractAccTest {
assertThat(taskCommentsAfterDeletion).hasSize(1);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void should_FailToDeleteTaskComment_When_UserHasNoAuthorization()
throws NotAuthorizedException, TaskNotFoundException {
@ -71,9 +67,7 @@ public class DeleteTaskCommentAccTest extends AbstractAccTest {
assertThat(taskCommentsAfterDeletion).hasSize(2);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_FailToDeleteTaskComment_When_TaskCommentIdIsInvalid()
throws NotAuthorizedException, TaskNotFoundException {
@ -96,9 +90,7 @@ public class DeleteTaskCommentAccTest extends AbstractAccTest {
assertThat(taskCommentsAfterDeletion).hasSize(2);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_FailToDeleteTaskComment_When_TaskCommentIsNotExisting()
throws NotAuthorizedException, TaskNotFoundException {

View File

@ -26,9 +26,7 @@ class GetTaskAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetTaskById()
throws TaskNotFoundException, NotAuthorizedException, InvalidArgumentException {
@ -81,9 +79,7 @@ class GetTaskAccTest extends AbstractAccTest {
assertThat(task.getCustomAttribute("16")).isEqualTo("custom16");
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetTaskByIdNotExisting() {
TaskService taskService = taskanaEngine.getTaskService();

View File

@ -25,9 +25,7 @@ public class GetTaskCommentAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_ReturnTaskComments_For_TaskId() throws NotAuthorizedException, TaskNotFoundException {
@ -39,9 +37,7 @@ public class GetTaskCommentAccTest extends AbstractAccTest {
assertThat(taskComments).hasSize(3);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_ReturnEmptyList_When_TaskCommentsDontExist()
throws NotAuthorizedException, TaskNotFoundException {
@ -51,9 +47,7 @@ public class GetTaskCommentAccTest extends AbstractAccTest {
assertThat(taskService.getTaskComments("TKI:000000000000000000000000000000000036")).isEmpty();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_FailToReturnTaskComments_When_TaskIstNotVisible() {
@ -66,9 +60,7 @@ public class GetTaskCommentAccTest extends AbstractAccTest {
assertThatThrownBy(httpCall).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_ReturnTaskComment_For_TaskCommentId()
throws TaskCommentNotFoundException, NotAuthorizedException, TaskNotFoundException,
@ -81,9 +73,7 @@ public class GetTaskCommentAccTest extends AbstractAccTest {
assertThat(taskComment.getCreator()).isEqualTo("user_1_1");
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_FailToReturnTaskComment_When_TaskCommentIsNotExisting() {
@ -94,9 +84,7 @@ public class GetTaskCommentAccTest extends AbstractAccTest {
assertThatThrownBy(lambda).isInstanceOf(TaskCommentNotFoundException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_FailToReturntaskComment_When_TaskIstNotVisible() {

View File

@ -30,9 +30,7 @@ class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@WithAccessId(user = "teamlead_1", groups = "admin")
@Test
void testQueryTaskValuesForAttachmentClassificationName() {
TaskService taskService = taskanaEngine.getTaskService();
@ -46,9 +44,7 @@ class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
assertThat(columnValueList).hasSize(8);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@WithAccessId(user = "teamlead_1", groups = "admin")
@Test
void testQueryTaskValuesForClassificationName() {
TaskService taskService = taskanaEngine.getTaskService();
@ -62,9 +58,7 @@ class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
assertThat(columnValueList).hasSize(5);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testQueryByClassificationNameIn() {
TaskService taskService = taskanaEngine.getTaskService();
@ -85,9 +79,7 @@ class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
assertThat(tasks).hasSize(1);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testQueryByClassificationNameLike() {
TaskService taskService = taskanaEngine.getTaskService();
@ -104,9 +96,7 @@ class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
assertThat(tasks).hasSize(32);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testSelectByAttachmentClassificationNameLike() {
TaskService taskService = taskanaEngine.getTaskService();
@ -127,9 +117,7 @@ class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
assertThat(tasks).hasSize(7);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testSelectByAttachmentClassificationNameIn() {
TaskService taskService = taskanaEngine.getTaskService();
@ -150,9 +138,7 @@ class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
assertThat(tasks).hasSize(4);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testQueryAndCountMatchForClassificationName() {
TaskService taskService = taskanaEngine.getTaskService();
@ -164,9 +150,7 @@ class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
assertThat(tasks).hasSize((int) numberOfTasks);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testQueryAndCountForAttachmentClassificationName() {
TaskService taskService = taskanaEngine.getTaskService();

View File

@ -34,9 +34,7 @@ class QueryTaskWithAttachmentAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetAttachmentSummariesFromTask() {
TaskService taskService = taskanaEngine.getTaskService();
@ -48,7 +46,7 @@ class QueryTaskWithAttachmentAccTest extends AbstractAccTest {
assertThat(attachmentSummaries).hasSize(2);
}
@WithAccessId(userName = "user_1_2")
@WithAccessId(user = "user_1_2")
@Test
void testGetNoAttachmentSummaryFromTask() {
TaskService taskService = taskanaEngine.getTaskService();
@ -60,9 +58,7 @@ class QueryTaskWithAttachmentAccTest extends AbstractAccTest {
assertThat(attachmentSummaries).isEmpty();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testIfNewTaskHasEmptyAttachmentList() {
TaskService taskService = taskanaEngine.getTaskService();
@ -71,9 +67,7 @@ class QueryTaskWithAttachmentAccTest extends AbstractAccTest {
assertThat(task.asSummary().getAttachmentSummaries()).isNotNull();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_ConfirmIfAttachmentSummariesAreCorrect_When_UsingTaskQueryAndGetTaskById()
throws TaskNotFoundException, NotAuthorizedException {
@ -97,9 +91,7 @@ class QueryTaskWithAttachmentAccTest extends AbstractAccTest {
.doesNotContain(toArray(originalAttachments)); // but not same reference
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_ConfirmIfAttachmentSummariesAreCorrect()
throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException {

View File

@ -80,9 +80,7 @@ class QueryTasksAccTest extends AbstractAccTest {
resetDb(false);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@WithAccessId(user = "teamlead_1", groups = "admin")
@Test
void testQueryTaskValuesForEveryColumn() {
SoftAssertions softly = new SoftAssertions();
@ -97,9 +95,7 @@ class QueryTasksAccTest extends AbstractAccTest {
softly.assertAll();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@WithAccessId(user = "teamlead_1", groups = "admin")
@Test
void testQueryTaskValuesForColumnName() {
List<String> columnValueList =
@ -116,9 +112,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(columnValueList).hasSize(5);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@WithAccessId(user = "teamlead_1", groups = "admin")
@Test
void testQueryTaskValuesForColumnNameOnAttachments() {
List<String> columnValueList =
@ -155,8 +149,8 @@ class QueryTasksAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testQueryForOwnerLike() {
@ -174,8 +168,8 @@ class QueryTasksAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testQueryForParentBusinessProcessId() {
@ -195,8 +189,8 @@ class QueryTasksAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testQueryForName() {
@ -210,8 +204,8 @@ class QueryTasksAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testQueryForClassificationKey() {
@ -233,9 +227,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(result4).hasSize(6);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryForAttachmentInSummary()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -267,9 +259,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results.get(0).getAttachmentSummaries().get(0)).isNotNull();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@WithAccessId(user = "teamlead_1", groups = "admin")
@Test
void testQueryForExternalId() {
@ -294,9 +284,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(countAllExternalIds).isEqualTo(countAllIds);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@TestFactory
Stream<DynamicTest> testQueryForCustomX() {
List<Triplet<String, String[], Integer>> list =
@ -338,9 +326,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(result2).hasSize(expectedResult);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryForCustom7WithExceptionInLike() {
@ -352,9 +338,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryForCustom7WithExceptionInIn() throws InvalidArgumentException {
@ -374,9 +358,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryForCustom7WithException() throws InvalidArgumentException {
@ -390,9 +372,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(result2).hasSize(2);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testQueryTaskByCustomAttributes()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -438,9 +418,7 @@ class QueryTasksAccTest extends AbstractAccTest {
}
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testQueryAndCountMatch() {
TaskQuery taskQuery = taskService.createTaskQuery();
@ -449,9 +427,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(tasks).hasSize((int) numberOfTasks);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"businessadmin"})
@WithAccessId(user = "teamlead_1", groups = "businessadmin")
@Test
void testQueryAllPaged() {
TaskQuery taskQuery = taskService.createTaskQuery();
@ -465,7 +441,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(tasksp).hasSize(5);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForCreatorIn() {
List<TaskSummary> results =
@ -473,21 +449,21 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results).hasSize(4);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForCreatorLike() {
List<TaskSummary> results = taskService.createTaskQuery().creatorLike("ersTeLlEr%").list();
assertThat(results).hasSize(3);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForNoteLike() {
List<TaskSummary> results = taskService.createTaskQuery().noteLike("Some%").list();
assertThat(results).hasSize(6);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForClassificationCategoryIn() {
List<TaskSummary> results =
@ -495,7 +471,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForClassificationCategoryLike() {
List<TaskSummary> results =
@ -503,7 +479,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results).hasSize(1);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForPrimaryObjectReferenceCompanyLike() {
List<TaskSummary> results =
@ -511,7 +487,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results).hasSize(6);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForPrimaryObjectReferenceSystemLike() {
List<TaskSummary> results =
@ -519,7 +495,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results).hasSize(6);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForPrimaryObjectReferenceSystemInstanceLike() {
List<TaskSummary> results =
@ -527,7 +503,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results).hasSize(6);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForPrimaryObjectReferenceTypeLike() {
List<TaskSummary> results =
@ -535,21 +511,21 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results).hasSize(6);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForReadEquals() {
List<TaskSummary> results = taskService.createTaskQuery().readEquals(true).list();
assertThat(results).hasSize(35);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForTransferredEquals() {
List<TaskSummary> results = taskService.createTaskQuery().transferredEquals(true).list();
assertThat(results).hasSize(2);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForBusinessProcessIdIn() {
List<TaskSummary> results =
@ -557,14 +533,14 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results).hasSize(8);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForBusinessProcessIdLike() {
List<TaskSummary> results = taskService.createTaskQuery().businessProcessIdLike("pI_%").list();
assertThat(results).hasSize(77);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForAttachmentClassificationKeyIn() {
List<TaskSummary> results =
@ -573,7 +549,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results.get(0).getId()).isEqualTo("TKI:000000000000000000000000000000000002");
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForAttachmentClassificationKeyLike() {
List<TaskSummary> results =
@ -582,7 +558,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results.get(0).getId()).isEqualTo("TKI:000000000000000000000000000000000002");
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForAttachmentclassificationIdIn() {
List<TaskSummary> results =
@ -594,14 +570,14 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results.get(0).getId()).isEqualTo("TKI:000000000000000000000000000000000001");
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForAttachmentChannelLike() {
List<TaskSummary> results = taskService.createTaskQuery().attachmentChannelLike("%6").list();
assertThat(results).hasSize(2);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForAttachmentReferenceIn() {
List<TaskSummary> results =
@ -610,7 +586,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results.get(5).getAttachmentSummaries()).hasSize(1);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForAttachmentReceivedIn() {
TimeInterval interval =
@ -626,7 +602,7 @@ class QueryTasksAccTest extends AbstractAccTest {
assertThat(results.get(1).getId()).isEqualTo("TKI:000000000000000000000000000000000011");
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByCreatorDesc() {
List<TaskSummary> results = taskService.createTaskQuery().orderByCreator(DESCENDING).list();
@ -637,7 +613,7 @@ class QueryTasksAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByWorkbasketIdDesc() {
List<TaskSummary> results =
@ -650,7 +626,7 @@ class QueryTasksAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@TestFactory
Stream<DynamicTest> testQueryForOrderByCustomXAsc() {
Iterator<String> iterator = IntStream.rangeClosed(1, 16).mapToObj(String::valueOf).iterator();
@ -660,10 +636,11 @@ class QueryTasksAccTest extends AbstractAccTest {
s -> testQueryForOrderByCustomX(s, ASCENDING));
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@TestFactory
Stream<DynamicTest> testQueryForOrderByCustomXDesc() {
Iterator<String> iterator = IntStream.rangeClosed(1, 16).mapToObj(String::valueOf).iterator();
return DynamicTest.stream(
iterator,
s -> String.format("order by custom%s desc", s),
@ -685,7 +662,7 @@ class QueryTasksAccTest extends AbstractAccTest {
.isSortedAccordingTo(comparator);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderWithDirectionNull() {
List<TaskSummary> results =
@ -698,7 +675,7 @@ class QueryTasksAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByAttachmentClassificationIdAsc() {
List<TaskSummary> results =
@ -720,7 +697,7 @@ class QueryTasksAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByAttachmentClassificationIdDesc() {
List<TaskSummary> results =
@ -742,7 +719,7 @@ class QueryTasksAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByAttachmentClassificationKeyAsc() {
List<TaskSummary> results =
@ -764,7 +741,7 @@ class QueryTasksAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByAttachmentClassificationKeyDesc() {
List<TaskSummary> results =
@ -786,7 +763,7 @@ class QueryTasksAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByAttachmentRefValueDesc() {
List<TaskSummary> results =
@ -807,7 +784,7 @@ class QueryTasksAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByAttachmentChannelAscAndReferenceDesc() {
List<TaskSummary> results =
@ -831,7 +808,7 @@ class QueryTasksAccTest extends AbstractAccTest {
a -> a.getObjectReference().getValue(), CASE_INSENSITIVE_ORDER.reversed()));
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForAttachmentChannelLikeAndOrdering() {
List<TaskSummary> results =
@ -860,8 +837,8 @@ class QueryTasksAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testQueryForExternalIdIn() {
@ -889,8 +866,8 @@ class QueryTasksAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testQueryForExternalIdLike() {

View File

@ -22,8 +22,8 @@ class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testQueryTasksByExcactValueOfObjectReference() throws SystemException {
TaskService taskService = taskanaEngine.getTaskService();
@ -33,8 +33,8 @@ class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testQueryTasksByExcactValueAndTypeOfObjectReference() throws SystemException {
TaskService taskService = taskanaEngine.getTaskService();
@ -48,8 +48,8 @@ class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testQueryTasksByValueLikeOfObjectReference() throws SystemException {
TaskService taskService = taskanaEngine.getTaskService();

View File

@ -26,8 +26,8 @@ class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testCreatedWithin2Intervals() {
TaskService taskService = taskanaEngine.getTaskService();
@ -58,8 +58,8 @@ class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testCreatedBefore() {
TaskService taskService = taskanaEngine.getTaskService();
@ -83,8 +83,8 @@ class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testCreatedAfter() {
TaskService taskService = taskanaEngine.getTaskService();
@ -108,8 +108,8 @@ class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testClaimedWithin2Intervals() {
TaskService taskService = taskanaEngine.getTaskService();
@ -140,8 +140,8 @@ class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testCompletedWithin() {
TaskService taskService = taskanaEngine.getTaskService();
@ -165,8 +165,8 @@ class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testModifiedWithin() {
TaskService taskService = taskanaEngine.getTaskService();
@ -190,8 +190,8 @@ class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testPlannedWithin() {
TaskService taskService = taskanaEngine.getTaskService();
@ -215,8 +215,8 @@ class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testDueWithin() {
TaskService taskService = taskanaEngine.getTaskService();

View File

@ -20,8 +20,8 @@ import pro.taskana.task.api.models.TaskSummary;
public class QueryTasksByWildcardSearchAccTest extends AbstractAccTest {
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void should_ReturnAllTasksByWildcardSearch_For_ProvidedSearchValue() {
TaskService taskService = taskanaEngine.getTaskService();
@ -42,8 +42,8 @@ public class QueryTasksByWildcardSearchAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void should_ReturnAllTasks_For_ProvidedSearchValueAndAdditionalParameters() {
TaskService taskService = taskanaEngine.getTaskService();
@ -66,8 +66,8 @@ public class QueryTasksByWildcardSearchAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void should_ThrowException_When_NotUsingSearchFieldsAndValueParamsTogether() {

View File

@ -26,9 +26,7 @@ class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryForWorkbasketKeyDomain() {
TaskService taskService = taskanaEngine.getTaskService();
@ -52,9 +50,7 @@ class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
assertThat(result2).hasSize(52);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket() {
TaskService taskService = taskanaEngine.getTaskService();
@ -69,9 +65,7 @@ class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedToQueryWorkbasketException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket() {
TaskService taskService = taskanaEngine.getTaskService();

View File

@ -21,9 +21,7 @@ class QueryTasksWithPaginationAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testGetFirstPageOfTaskQueryWithOffset() {
TaskService taskService = taskanaEngine.getTaskService();
@ -35,9 +33,7 @@ class QueryTasksWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(10);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testSecondPageOfTaskQueryWithOffset() {
TaskService taskService = taskanaEngine.getTaskService();
@ -49,9 +45,7 @@ class QueryTasksWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(10);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testListOffsetAndLimitOutOfBounds() {
TaskService taskService = taskanaEngine.getTaskService();
@ -81,9 +75,7 @@ class QueryTasksWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testPaginationWithPages() {
TaskService taskService = taskanaEngine.getTaskService();
@ -129,9 +121,7 @@ class QueryTasksWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testPaginationNullAndNegativeLimitsIgnoring() {
TaskService taskService = taskanaEngine.getTaskService();
@ -167,9 +157,7 @@ class QueryTasksWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(10);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testCountOfTaskQuery() {
TaskService taskService = taskanaEngine.getTaskService();
@ -181,9 +169,7 @@ class QueryTasksWithPaginationAccTest extends AbstractAccTest {
assertThat(count).isEqualTo(22L);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testCountOfTaskQueryWithAttachmentChannelFilter() {
TaskService taskService = taskanaEngine.getTaskService();

View File

@ -30,8 +30,8 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testSortByModifiedAndDomain() {
TaskService taskService = taskanaEngine.getTaskService();
@ -54,8 +54,8 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testSortByTaskIdDesc() {
TaskService taskService = taskanaEngine.getTaskService();
@ -81,8 +81,8 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testSortByTaskIdAsc() {
TaskService taskService = taskanaEngine.getTaskService();
@ -105,8 +105,8 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testSortByDomainNameAndCreated() {
TaskService taskService = taskanaEngine.getTaskService();
@ -127,8 +127,8 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testSortByPorSystemNoteDueAndOwner() {
TaskService taskService = taskanaEngine.getTaskService();
@ -159,8 +159,8 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testSortByPorSystemInstanceParentProcPlannedAndState() {
TaskService taskService = taskanaEngine.getTaskService();
@ -191,8 +191,8 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testSortByPorCompanyAndClaimed() {
TaskService taskService = taskanaEngine.getTaskService();
@ -224,8 +224,8 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testSortByWbKeyPrioPorValueAndCompleted() {
TaskService taskService = taskanaEngine.getTaskService();
@ -257,8 +257,8 @@ class QueryTasksWithSortingAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
@Test
void testSortBpIdClassificationIdDescriptionAndPorType() {
TaskService taskService = taskanaEngine.getTaskService();

View File

@ -26,9 +26,7 @@ import pro.taskana.task.api.models.TaskSummary;
public class ServiceLevelOfAllTasksAccTest extends AbstractAccTest {
TaskService taskService;
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void testSetPlannedPropertyOnAllTasks() throws SQLException {
taskService = taskanaEngine.getTaskService();

View File

@ -42,9 +42,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
taskService = taskanaEngine.getTaskService();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
public void should_ThrowException_When_DueAndPlannedAreChangedInconsistently() throws Exception {
TaskService taskService = taskanaEngine.getTaskService();
@ -58,9 +56,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
+ "date 2020-07-02T00:00:00Z not matching the service level PT24H.");
}
@WithAccessId(
userName = "user_3_2",
groupNames = {"group_2"})
@WithAccessId(user = "user_3_2", groups = "group_2")
@Test
void should_SetPlanned_When_SetPlannedRequestContainsDuplicateTaskIds()
throws NotAuthorizedException, TaskNotFoundException {
@ -97,9 +93,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(due4).isEqualTo(dueExpected);
}
@WithAccessId(
userName = "user_3_2",
groupNames = {"group_2"})
@WithAccessId(user = "user_3_2", groups = "group_2")
@Test
void should_SetPlanned_When_RequestContainsDuplicatesAndNotExistingTaskIds()
throws NotAuthorizedException, TaskNotFoundException {
@ -126,9 +120,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(due5).isEqualTo(dueExpected);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_2"})
@WithAccessId(user = "user_1_1", groups = "group_2")
@Test
void should_SetPlanned_When_RequestContainsTasksWithAttachments()
throws NotAuthorizedException, TaskNotFoundException, ClassificationNotFoundException,
@ -207,9 +199,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
// |TAI:000000000000000000000000000000000014 | CLI:100000000000000000000000000000000004,| P14D |
// +-----------------------------------------+------------------------------------------+------+
@WithAccessId(
userName = "user_3_2",
groupNames = {"group_2"})
@WithAccessId(user = "user_3_2", groups = "group_2")
@Test
void should_ReturnBulkLog_When_UserIsNotAuthorizedForTasks() {
String tkId1 = "TKI:000000000000000000000000000000000008";
@ -230,9 +220,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
.hasOnlyElementsOfType(NotAuthorizedException.class);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void should_SetPlannedPropertyOfTasks_When_RequestedByAdminUser()
throws NotAuthorizedException, TaskNotFoundException {
@ -257,9 +245,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(dueBulk4).isEqualTo(getInstant("2020-05-22T07:00:00"));
}
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void should_DoNothing_When_SetPlannedIsCalledWithEmptyTasksList() {
Instant planned = getInstant("2020-05-03T07:00:00");
@ -276,9 +262,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
// |TAI:000000000000000000000000000000000006 | CLI:000000000000000000000000000000000007 | P6D |
// |TAI:000000000000000000000000000000000007 | CLI:100000000000000000000000000000000008 | P1D |
// +-----------------------------------------+------------------------------------------+------+
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void should_SetPlannedPropertyWithBulkUpdate_When_RequestContainsASingleTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException {
@ -294,9 +278,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(task.getDue()).isEqualTo(planned.plus(Duration.ofDays(days)));
}
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void should_SetPlannedPropertyOnSingle_When_UpdateTaskWasCalled()
throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException,
@ -312,9 +294,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(task.getDue()).isEqualTo(task.getPlanned().plus(Duration.ofDays(days)));
}
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void should_SetPlanned_When_OnlyDueWasChanged()
throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException,
@ -330,9 +310,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(task.getPlanned()).isEqualTo(getInstant("2020-05-08T07:00:00"));
}
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void should_SetDue_When_OnlyPlannedWasChanged()
throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException,
@ -350,9 +328,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(task.getPlanned()).isEqualTo(task.getDue().plus(Duration.ofDays(days)));
}
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void should_SetPlanned_When_DueIsChangedAndPlannedIsNulled()
throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException,
@ -369,9 +345,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(task.getPlanned()).isEqualTo(task.getDue().plus(Duration.ofDays(days)));
}
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void should_SetDue_When_TaskUpdateIsCalled()
throws NotAuthorizedException, TaskNotFoundException, InvalidArgumentException,
@ -406,9 +380,7 @@ public class ServiceLevelPriorityAccTest extends AbstractAccTest {
assertThat(task.getDue()).isEqualTo(getInstant("2020-05-15T07:00:00"));
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void should_UpdateTaskPlannedOrDue_When_PlannedOrDueAreWeekendDays()
throws NotAuthorizedException, TaskNotFoundException, ClassificationNotFoundException,

View File

@ -37,9 +37,7 @@ import pro.taskana.task.api.models.TaskSummary;
@ExtendWith(JaasExtension.class)
public class SetOwnerAccTest extends AbstractAccTest {
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testSetOwnerAndSubsequentClaimSucceeds()
throws TaskNotFoundException, NotAuthorizedException, InvalidStateException,
@ -61,9 +59,7 @@ public class SetOwnerAccTest extends AbstractAccTest {
assertThat(taskClaimed.getOwner()).isEqualTo("user_1_2");
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testSetOwnerViaUpdateTaskNotAuthorized() {
@ -77,9 +73,7 @@ public class SetOwnerAccTest extends AbstractAccTest {
.isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testSetOwnerOfClaimedTaskFails() throws TaskNotFoundException, NotAuthorizedException {
@ -93,9 +87,7 @@ public class SetOwnerAccTest extends AbstractAccTest {
.isInstanceOf(InvalidStateException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testSetOwnerNotAuthorized() {
@ -111,9 +103,7 @@ public class SetOwnerAccTest extends AbstractAccTest {
assertThat(results.getErrorForId(taskReadyId)).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "user_3_2",
groupNames = {"group_2"})
@WithAccessId(user = "user_3_2", groups = "group_2")
@Test
void testSetOwnerOfTasksWithDuplicatesSucceeds() {
@ -128,9 +118,7 @@ public class SetOwnerAccTest extends AbstractAccTest {
assertThat(results.containsErrors()).isFalse();
}
@WithAccessId(
userName = "user_3_2",
groupNames = {"group_2"})
@WithAccessId(user = "user_3_2", groups = "group_2")
@Test
void testSetOwnerOfTasksWithDuplicatesAndNotExistingSucceeds() {
List<String> taskIds =
@ -148,9 +136,7 @@ public class SetOwnerAccTest extends AbstractAccTest {
.isInstanceOf(TaskNotFoundException.class);
}
@WithAccessId(
userName = "user_3_2",
groupNames = {"group_2"})
@WithAccessId(user = "user_3_2", groups = "group_2")
@Test
void testSetOwnerOfTasksWithNoQualifyingTasks() {
@ -166,9 +152,7 @@ public class SetOwnerAccTest extends AbstractAccTest {
assertThat(results.getErrorMap()).hasSize(3);
}
@WithAccessId(
userName = "user_3_2",
groupNames = {"group_2"})
@WithAccessId(user = "user_3_2", groups = "group_2")
@Test
void testSetOwnerWithEmptyList() {
List<String> taskIds = new ArrayList<>();
@ -177,9 +161,7 @@ public class SetOwnerAccTest extends AbstractAccTest {
assertThat(results.containsErrors()).isFalse();
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_2"})
@WithAccessId(user = "user_1_2", groups = "group_2")
@Test
void testSetOwnerWithAllTasksAndVariousExceptions()
throws NoSuchFieldException, IllegalAccessException, SQLException {
@ -208,9 +190,7 @@ public class SetOwnerAccTest extends AbstractAccTest {
.areExactly(23, notAuthorizedException);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_2"})
@WithAccessId(user = "admin", groups = "group_2")
@Test
void testSetOwnerWithAllTasksAndVariousExceptionsAsAdmin() throws SQLException {
resetDb(false);

View File

@ -35,9 +35,7 @@ class TerminateTaskAccTest extends AbstractAccTest {
taskService = taskanaEngine.getTaskService();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testQueryTerminatedTasks() {
List<TaskSummary> taskSummaries =
@ -45,9 +43,7 @@ class TerminateTaskAccTest extends AbstractAccTest {
assertThat(taskSummaries).hasSize(5);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testTerminateReadyTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException {
@ -60,9 +56,7 @@ class TerminateTaskAccTest extends AbstractAccTest {
assertThat(numTasks).isEqualTo(6);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testTerminateClaimedTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException {
@ -80,9 +74,7 @@ class TerminateTaskAccTest extends AbstractAccTest {
assertThat(numTasksTerminated).isEqualTo(6);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testTerminateCompletedTask() {
List<TaskSummary> taskSummaries =
@ -93,9 +85,7 @@ class TerminateTaskAccTest extends AbstractAccTest {
assertThatThrownBy(taskanaCall).isInstanceOf(InvalidStateException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testTerminateTerminatedTask() {
List<TaskSummary> taskSummaries =
@ -106,9 +96,7 @@ class TerminateTaskAccTest extends AbstractAccTest {
assertThatThrownBy(taskanaCall).isInstanceOf(InvalidStateException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testTerminateCancelledTask() {
List<TaskSummary> taskSummaries =

View File

@ -36,9 +36,7 @@ class TransferTaskAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testTransferTaskToWorkbasketId()
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException,
@ -57,9 +55,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThat(transferredTask.getState()).isEqualTo(TaskState.READY);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testTransferTaskToWorkbasketKeyDomain()
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException,
@ -78,9 +74,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThat(transferredTask.getState()).isEqualTo(TaskState.READY);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testDomainChangingWhenTransferTask()
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException,
@ -95,9 +89,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThat(transferedTask.getDomain()).isNotEqualTo(domain1);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testThrowsExceptionIfTransferWithNoTransferAuthorization()
throws NotAuthorizedException, TaskNotFoundException {
@ -111,9 +103,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testTransferDestinationWorkbasketDoesNotExist()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
@ -130,9 +120,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(WorkbasketNotFoundException.class);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testTransferTaskDoesNotExist() {
TaskService taskService = taskanaEngine.getTaskService();
@ -144,9 +132,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"teamlead_1"})
@WithAccessId(user = "teamlead_1", groups = "teamlead_1")
@Test
void testTransferNotAuthorizationOnWorkbasketTransfer() {
TaskService taskService = taskanaEngine.getTaskService();
@ -160,9 +146,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testThrowsExceptionIfTaskIsAlreadyCompleted()
throws NotAuthorizedException, TaskNotFoundException {
@ -176,9 +160,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidStateException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testThrowsExceptionIfTransferWithNoAppendAuthorization()
throws NotAuthorizedException, TaskNotFoundException {
@ -192,9 +174,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testBulkTransferTaskToWorkbasketById()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
@ -231,9 +211,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThat(transferredTask.getOwner()).isNull();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testBulkTransferTaskWithExceptions()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
@ -293,7 +271,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThat(transferredTask.getWorkbasketKey()).isEqualTo("TEAMLEAD_1");
}
@WithAccessId(userName = "teamlead_1")
@WithAccessId(user = "teamlead_1")
@Test
void testBulkTransferTaskWithoutAppendPermissionOnTarget() {
TaskService taskService = taskanaEngine.getTaskService();
@ -310,9 +288,7 @@ class TransferTaskAccTest extends AbstractAccTest {
.hasMessageContaining("APPEND");
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testTransferTasksWithListNotSupportingRemove()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException {
@ -321,9 +297,7 @@ class TransferTaskAccTest extends AbstractAccTest {
taskService.transferTasks("WBI:100000000000000000000000000000000006", taskIds);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testTransferTasksWithInvalidTasksIdList() {
TaskService taskService = taskanaEngine.getTaskService();
@ -348,9 +322,7 @@ class TransferTaskAccTest extends AbstractAccTest {
.hasMessage("TaskIds must not contain only invalid arguments.");
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testThrowsExceptionIfEmptyListIsSupplied() {
TaskService taskService = taskanaEngine.getTaskService();
@ -362,9 +334,7 @@ class TransferTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testBulkTransferByWorkbasketAndDomainByKey()
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException,

View File

@ -39,9 +39,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_UpdatePrimaryObjectReferenceOfTask_When_Requested()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -70,9 +68,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
assertThat(updatedTask.getParentBusinessProcessId()).isEqualTo("MY_PARENT_PROCESS_ID");
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_ThrowException_When_MandatoryPrimaryObjectReferenceIsNotSetOrIncomplete()
throws NotAuthorizedException, TaskNotFoundException {
@ -112,9 +108,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
.isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_ThrowException_When_TaskHasAlreadyBeenUpdated()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -135,9 +129,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
.withFailMessage("The task has already been updated by another user");
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_UpdateTaskProperties_When_ClassificationOfTaskIsChanged()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -161,9 +153,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
resetDb(false); // classification of task TKI:0..00 was changed...
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void should_UpdateReadFlagOfTask_When_SetTaskReadIsCalled()
throws TaskNotFoundException, NotAuthorizedException {
@ -186,9 +176,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
.isInstanceOf(TaskNotFoundException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_UpdateTask_When_CustomPropertiesOfTaskWereChanged()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -203,9 +191,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
assertThat(updatedTask).isNotNull();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_ThrowException_When_ModificationOfWorkbasketKeyIsAttempted()
throws NotAuthorizedException, TaskNotFoundException {
@ -218,9 +204,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
.isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_UpdateNoTasks_When_UpdateTasksWithUnmatchedObjectReferenceWasCalled()
throws InvalidArgumentException {
@ -241,9 +225,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
assertThat(taskIds).isEmpty();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void should_UpdateTasks_When_MatchingPrimaryObjectReferenceWasChanged()
throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException {
@ -271,9 +253,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
}
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void should_UpdateTaskCustomAttributes_When_UpdateTasksIsCalled()
throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException {
@ -301,9 +281,7 @@ class UpdateTaskAccTest extends AbstractAccTest {
}
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_UpdateCallbackInfo_When_RequestedByApi()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,

View File

@ -48,7 +48,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
private TaskService taskService;
@BeforeEach
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
void setUp()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException,
@ -75,9 +75,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task).isNotNull();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testAddNewAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -97,9 +95,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
.containsOnly(task.getModified());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testAddValidAttachmentTwice()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -122,9 +118,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
.containsOnly(task.getModified());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testAddNewAttachmentTwiceWithoutTaskanaMethodWillThrowAttachmentPersistenceException()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -144,9 +138,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(AttachmentPersistenceException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testAddExistingAttachmentAgainWillUpdateWhenNotEqual()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -182,9 +174,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getPlanned().plus(Duration.ofDays(calendarDays))).isEqualTo(task.getDue());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testAddExistingAttachmentAgainWillDoNothingWhenEqual()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -208,9 +198,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getAttachments()).hasSize(attachmentCount2);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testAddAttachmentAsNullValueWillBeIgnored()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -244,9 +232,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getPlanned().plus(Duration.ofDays(1))).isEqualTo(task.getDue());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testRemoveAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -268,9 +254,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getPlanned().plus(Duration.ofDays(1))).isEqualTo(task.getDue());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testRemoveAttachmentWithNullAndNotAddedId()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -293,9 +277,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getAttachments()).hasSize(attachmentCount); // persisted, still same
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testUpdateAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException,
@ -332,9 +314,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getPlanned().plus(Duration.ofDays(calendarDays))).isEqualTo(task.getDue());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void modifyExistingAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -431,9 +411,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(faxFound && rohrpostFound).isTrue();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void replaceExistingAttachments()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -494,9 +472,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getAttachments().get(0).getChannel()).isEqualTo("DHL");
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testPrioDurationOfTaskFromAttachmentsAtUpdate()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
@ -560,9 +536,7 @@ class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
.isEqualTo(readTask.getDue());
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testAddCustomAttributeToAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,

View File

@ -25,9 +25,7 @@ public class UpdateTaskCommentAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_UpdateTaskComment_For_TaskComment()
throws TaskCommentNotFoundException, NotAuthorizedException, ConcurrencyException,
@ -51,9 +49,7 @@ public class UpdateTaskCommentAccTest extends AbstractAccTest {
assertThat(taskCommentsAfterUpdate.get(0).getTextField()).isEqualTo("updated textfield");
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void should_FailToUpdateTaskComment_When_UserHasNoAuthorization()
throws TaskCommentNotFoundException, NotAuthorizedException, TaskNotFoundException,
@ -80,9 +76,7 @@ public class UpdateTaskCommentAccTest extends AbstractAccTest {
.isEqualTo("some other text in textfield");
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void should_FailToUpdateTaskComment_When_TaskCommentWasModifiedConcurrently()
throws TaskCommentNotFoundException, NotAuthorizedException, TaskNotFoundException,

View File

@ -33,9 +33,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testClaimTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
@ -55,9 +53,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThat(claimedTask.getOwner()).isEqualTo("user_1_2");
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testThrowsExceptionIfTaskIsAlreadyClaimed()
throws NotAuthorizedException, TaskNotFoundException {
@ -73,9 +69,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidOwnerException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testClaimAlreadyClaimedByCallerTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
@ -86,9 +80,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
taskService.claim(task.getId());
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testForceClaimTaskWhichIsAlreadyClaimedByAnotherUser()
throws NotAuthorizedException, TaskNotFoundException {
@ -104,9 +96,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidOwnerException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testCancelClaimTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
@ -124,9 +114,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThat(unclaimedTask.getOwner()).isNull();
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testThrowsExceptionIfCancelClaimOfTaskFromAnotherUser()
throws NotAuthorizedException, TaskNotFoundException {
@ -142,9 +130,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidOwnerException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testForceCancelClaimOfTaskFromAnotherUser()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
@ -162,9 +148,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThat(unclaimedTask.getOwner()).isNull();
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testCompleteTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
@ -186,9 +170,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThat(completedTask.getOwner()).isEqualTo("user_1_2");
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testForceCompleteUnclaimedTask()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
@ -207,9 +189,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThat(completedTask.getOwner()).isEqualTo("user_1_2");
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testThrowsExceptionIfCompletingClaimedTaskOfAnotherUser()
throws NotAuthorizedException, TaskNotFoundException {
@ -225,9 +205,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidOwnerException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testForceCompleteClaimedTaskOfAnotherUser()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
@ -246,9 +224,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThat(completedTask.getOwner()).isEqualTo("user_1_2");
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testBulkCompleteTasks()
throws NotAuthorizedException, InvalidArgumentException, TaskNotFoundException {
@ -269,9 +245,7 @@ class WorkOnTaskAccTest extends AbstractAccTest {
assertThat(completedTask2.getCompleted()).isNotNull();
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_2", groups = "group_1")
@Test
void testBulkDeleteTasksWithException() throws InvalidArgumentException {

View File

@ -23,9 +23,7 @@ import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
@ExtendWith(JaasExtension.class)
class TaskRoutingAccTest extends AbstractAccTest {
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testCreateTaskWithoutWorkbasketAndVoidNewTaskMethod()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -48,9 +46,7 @@ class TaskRoutingAccTest extends AbstractAccTest {
.isEqualTo(createdTask.getWorkbasketSummary().getId());
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testCreateTaskWithNullWorkbasket()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -65,9 +61,7 @@ class TaskRoutingAccTest extends AbstractAccTest {
.isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testCreateTaskWithNullRouting()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -83,9 +77,7 @@ class TaskRoutingAccTest extends AbstractAccTest {
.isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "admin",
groupNames = {"group_1"})
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testCreateTaskWithRoutingToMultipleWorkbaskets()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,

View File

@ -31,9 +31,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_2", groups = "businessadmin")
@Test
void testCreateWorkbasket()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
@ -64,7 +62,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
assertThat(createdWorkbasket2).isEqualTo(createdWorkbasket);
}
@WithAccessId(userName = "dummy")
@WithAccessId(user = "dummy")
@Test
void testCreateWorkbasketNotAuthorized() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -79,8 +77,8 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void should_beAbleToCreateNewWorkbasket_When_WorkbasketCopy() throws Exception {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -93,9 +91,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
assertThat(newWorkbasket.getId()).isNotEqualTo(oldWorkbasket.getId());
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_2", groups = "businessadmin")
@Test
void testCreateWorkbasketWithInvalidDomain() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -108,9 +104,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(DomainNotFoundException.class);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testCreateWorkbasketWithMissingRequiredField()
throws NotAuthorizedException, WorkbasketAlreadyExistException, DomainNotFoundException {
@ -175,9 +169,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(InvalidWorkbasketException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_2", groups = "businessadmin")
@Test
void testThrowsExceptionIfWorkbasketWithCaseInsensitiveSameKeyDomainIsCreated()
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
@ -201,9 +193,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(WorkbasketAlreadyExistException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_2", groups = "businessadmin")
@Test
void testCreateWorkbasketWithAlreadyExistingKeyAndDomainAndEmptyIdUpdatesOlderWorkbasket()
throws DomainNotFoundException, InvalidWorkbasketException, NotAuthorizedException,
@ -227,9 +217,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(WorkbasketAlreadyExistException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_2", groups = "businessadmin")
@Test
void testWorkbasketAccessItemSetName()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
@ -260,9 +248,7 @@ class CreateWorkbasketAccTest extends AbstractAccTest {
assertThat(item.getAccessName()).isEqualTo("Karl Napf");
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_2", groups = "businessadmin")
@Test
void testCreateDuplicateWorkbasketAccessListFails() throws Exception {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -40,9 +40,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
taskService = taskanaEngine.getTaskService();
}
@WithAccessId(
userName = "admin",
groupNames = {"businessadmin"})
@WithAccessId(user = "admin", groups = "businessadmin")
@Test
void testDeleteWorkbasket() throws WorkbasketNotFoundException, NotAuthorizedException {
Workbasket wb = workbasketService.getWorkbasket("USER_2_2", "DOMAIN_A");
@ -57,7 +55,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
.isInstanceOf(WorkbasketNotFoundException.class);
}
@WithAccessId(userName = "elena")
@WithAccessId(user = "elena")
@Test
void testDeleteWorkbasketNotAuthorized() {
@ -69,7 +67,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(userName = "elena")
@WithAccessId(user = "elena")
@Test
void testGetWorkbasketNotAuthorized() {
@ -81,8 +79,8 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"teamlead_1", "group_1", "businessadmin"})
user = "user_1_1",
groups = {"teamlead_1", "group_1", "businessadmin"})
@Test
void testDeleteWorkbasketAlsoAsDistributionTarget()
throws WorkbasketNotFoundException, NotAuthorizedException {
@ -105,9 +103,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
assertThat(newDistTargets).isEqualTo(3).isLessThan(distTargets);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testDeleteWorkbasketWithNullOrEmptyParam() {
// Test Null-Value
@ -133,9 +129,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
.isInstanceOf(InvalidArgumentException.class);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testDeleteWorkbasketButNotExisting() {
ThrowingCallable call =
@ -145,9 +139,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(WorkbasketNotFoundException.class);
}
@WithAccessId(
userName = "user_1_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_1_2", groups = "businessadmin")
@Test
void testDeleteWorkbasketWhichIsUsed()
throws WorkbasketNotFoundException, NotAuthorizedException {
@ -160,9 +152,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(WorkbasketInUseException.class);
}
@WithAccessId(
userName = "teamlead_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "teamlead_2", groups = "businessadmin")
@Test
void testCascadingDeleteOfAccessItems()
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException,
@ -196,9 +186,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
assertThat(accessItemsAfter).isEmpty();
}
@WithAccessId(
userName = "admin",
groupNames = {"businessadmin"})
@WithAccessId(user = "admin", groups = "businessadmin")
@Test
void testMarkWorkbasketForDeletion()
throws WorkbasketInUseException, NotAuthorizedException, WorkbasketNotFoundException,

View File

@ -31,9 +31,7 @@ class DistributionTargetsAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"teamlead_1"})
@WithAccessId(user = "user_1_1", groups = "teamlead_1")
@Test
void testGetDistributionTargetsSucceedsById()
throws NotAuthorizedException, WorkbasketNotFoundException {
@ -55,9 +53,7 @@ class DistributionTargetsAccTest extends AbstractAccTest {
.containsExactlyInAnyOrderElementsOf(expectedTargetIds);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"teamlead_1"})
@WithAccessId(user = "user_1_1", groups = "teamlead_1")
@Test
void testGetDistributionTargetsSucceeds()
throws NotAuthorizedException, WorkbasketNotFoundException {
@ -81,8 +77,8 @@ class DistributionTargetsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"teamlead_1", "group_1", "group_2", "businessadmin"})
user = "user_1_1",
groups = {"teamlead_1", "group_1", "group_2", "businessadmin"})
@Test
void testDistributionTargetCallsWithNonExistingWorkbaskets()
throws NotAuthorizedException, WorkbasketNotFoundException {
@ -113,9 +109,7 @@ class DistributionTargetsAccTest extends AbstractAccTest {
assertThat(beforeCount).isEqualTo(afterCount);
}
@WithAccessId(
userName = "user_3_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_3_1", groups = "group_1")
@Test
void testDistributionTargetCallsFailWithNotAuthorizedException() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -150,8 +144,8 @@ class DistributionTargetsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_2_2",
groupNames = {"group_1", "group_2", "businessadmin"})
user = "user_2_2",
groups = {"group_1", "group_2", "businessadmin"})
@Test
void testAddAndRemoveDistributionTargets()
throws NotAuthorizedException, WorkbasketNotFoundException {
@ -180,9 +174,7 @@ class DistributionTargetsAccTest extends AbstractAccTest {
assertThat(distributionTargets).hasSize(4);
}
@WithAccessId(
userName = "user_2_2",
groupNames = {"businessadmin"})
@WithAccessId(user = "user_2_2", groups = "businessadmin")
@Test
void testAddAndRemoveDistributionTargetsOnWorkbasketWithoutReadPermission()
throws NotAuthorizedException, WorkbasketNotFoundException {
@ -207,8 +199,8 @@ class DistributionTargetsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_2_2",
groupNames = {"group_1", "group_2"})
user = "user_2_2",
groups = {"group_1", "group_2"})
@Test
void testAddDistributionTargetsFailsNotAuthorized()
throws NotAuthorizedException, WorkbasketNotFoundException {
@ -230,8 +222,8 @@ class DistributionTargetsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_2_2",
groupNames = {"group_1", "group_2", "businessadmin"})
user = "user_2_2",
groups = {"group_1", "group_2", "businessadmin"})
@Test
void testSetDistributionTargets()
throws NotAuthorizedException, WorkbasketNotFoundException, SQLException, IOException {
@ -260,8 +252,8 @@ class DistributionTargetsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_2_2",
groupNames = {"group_1", "group_2"})
user = "user_2_2",
groups = {"group_1", "group_2"})
@Test
void testGetDistributionSourcesById() throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -282,8 +274,8 @@ class DistributionTargetsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_2_2",
groupNames = {"group_1", "group_2"})
user = "user_2_2",
groups = {"group_1", "group_2"})
@Test
void testGetDistributionSourcesByKeyDomain()
throws NotAuthorizedException, WorkbasketNotFoundException {
@ -304,9 +296,7 @@ class DistributionTargetsAccTest extends AbstractAccTest {
}
}
@WithAccessId(
userName = "henry",
groupNames = {"undefinedgroup"})
@WithAccessId(user = "henry", groups = "undefinedgroup")
@Test
void testQueryDistributionSourcesThrowsNotAuthorized() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -319,8 +309,8 @@ class DistributionTargetsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_2_2",
groupNames = {"group_1", "group_2"})
user = "user_2_2",
groups = {"group_1", "group_2"})
@Test
void testQueryDistributionSourcesThrowsWorkbasketNotFound() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -27,9 +27,7 @@ class GetWorkbasketAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetWorkbasketById() throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -53,9 +51,7 @@ class GetWorkbasketAccTest extends AbstractAccTest {
assertThat(workbasket.getCustom4()).isEqualTo("custom4");
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetWorkbasketByKeyAndDomain()
throws NotAuthorizedException, WorkbasketNotFoundException {
@ -78,9 +74,7 @@ class GetWorkbasketAccTest extends AbstractAccTest {
assertThat(workbasket.getCustom4()).isEqualTo("custom4");
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetWorkbasketPermissions() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -94,9 +88,7 @@ class GetWorkbasketAccTest extends AbstractAccTest {
assertThat(permissions.contains(WorkbasketPermission.APPEND)).isTrue();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetWorkbasketPermissionsForInvalidWorkbasketId() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -106,9 +98,7 @@ class GetWorkbasketAccTest extends AbstractAccTest {
assertThat(permissions).isEmpty();
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetWorkbasketAsSummary() throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -174,9 +164,7 @@ class GetWorkbasketAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testGetWorkbasketByIdNotExisting() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -36,9 +36,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
workbasketService = taskanaEngine.getWorkbasketService();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1_1")
@Test
void testQueryAllForUserMultipleTimes() {
WorkbasketQuery query = workbasketService.createWorkbasketQuery();
@ -52,9 +50,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(workbaskets).hasSize(count);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"businessadmin"})
@WithAccessId(user = "teamlead_1", groups = "businessadmin")
@Test
void testQueryAllForBusinessAdminMultipleTimes() {
WorkbasketQuery query = workbasketService.createWorkbasketQuery();
@ -68,9 +64,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(workbaskets).hasSize(count);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"admin"})
@WithAccessId(user = "teamlead_1", groups = "admin")
@Test
void testQueryAllForAdminMultipleTimes() {
WorkbasketQuery query = workbasketService.createWorkbasketQuery();
@ -84,9 +78,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(workbaskets).hasSize(count);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketValuesForColumnName() {
List<String> columnValueList = workbasketService.createWorkbasketQuery().listValues(NAME, null);
@ -103,9 +95,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(columnValueList).hasSize(4);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByDomain() {
List<WorkbasketSummary> results =
@ -113,9 +103,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(1);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByDomainAndType() {
List<WorkbasketSummary> results =
@ -127,9 +115,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(6);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByName() {
List<WorkbasketSummary> results =
@ -141,9 +127,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isEqualTo("GPK_KSC");
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByNameStartsWith() {
List<WorkbasketSummary> results =
@ -151,9 +135,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByNameContains() {
List<WorkbasketSummary> results =
@ -164,9 +146,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(5);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByNameContainsCaseInsensitive() {
List<WorkbasketSummary> results =
@ -174,9 +154,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByDescription() {
List<WorkbasketSummary> results =
@ -189,9 +167,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(9);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByOwnerLike() {
List<WorkbasketSummary> results =
@ -203,9 +179,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(1);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByKey() {
List<WorkbasketSummary> results =
@ -213,9 +187,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(1);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByMultipleKeys() {
List<WorkbasketSummary> results =
@ -223,9 +195,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByMultipleKeysWithUnknownKey() {
List<WorkbasketSummary> results =
@ -233,9 +203,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByKeyContains() {
List<WorkbasketSummary> results =
@ -243,9 +211,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByKeyContainsIgnoreCase() {
List<WorkbasketSummary> results =
@ -253,9 +219,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByKeyOrNameContainsIgnoreCase() {
List<WorkbasketSummary> results =
@ -263,9 +227,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(9);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByNameStartsWithSortedByNameAscending() {
List<WorkbasketSummary> results =
@ -280,7 +242,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER);
}
@WithAccessId(userName = "max")
@WithAccessId(user = "max")
@Test
void testQueryWorkbasketByNameStartsWithSortedByNameDescending() {
List<WorkbasketSummary> results =
@ -295,7 +257,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(userName = "max")
@WithAccessId(user = "max")
@Test
void testQueryWorkbasketByNameStartsWithSortedByKeyAscending() {
List<WorkbasketSummary> results =
@ -306,7 +268,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER);
}
@WithAccessId(userName = "max")
@WithAccessId(user = "max")
@Test
void testQueryWorkbasketByNameStartsWithSortedByKeyDescending() {
List<WorkbasketSummary> results =
@ -317,27 +279,23 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByCreated() {
List<WorkbasketSummary> results =
workbasketService.createWorkbasketQuery().createdWithin(todaysInterval()).list();
workbasketService.createWorkbasketQuery().createdWithin(toDaysInterval()).list();
assertThat(results).hasSize(9);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByModified() {
List<WorkbasketSummary> results =
workbasketService.createWorkbasketQuery().modifiedWithin(todaysInterval()).list();
workbasketService.createWorkbasketQuery().modifiedWithin(toDaysInterval()).list();
assertThat(results).hasSize(9);
}
@WithAccessId(userName = "unknown", groupNames = "admin")
@WithAccessId(user = "unknown", groups = "admin")
@Test
void testQueryWorkbasketByAdmin() throws NotAuthorizedException, InvalidArgumentException {
List<WorkbasketSummary> results =
@ -359,7 +317,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(13);
}
@WithAccessId(userName = "teamlead_1", groupNames = "group_1")
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryWorkbasketByDomainLike() {
List<WorkbasketSummary> results =
@ -388,7 +346,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.containsOnly(toArray(expectedIds));
}
@WithAccessId(userName = "admin", groupNames = "group_1")
@WithAccessId(user = "admin", groups = "group_1")
@Test
void testQueryWorkbasketByOwnerInOrderByDomainDesc() {
List<WorkbasketSummary> results =
@ -403,9 +361,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results.get(1).getId()).isEqualTo("WBI:100000000000000000000000000000000001");
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testQueryForCustom1In() {
List<WorkbasketSummary> results =
@ -415,7 +371,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results.get(0).getId()).isEqualTo("WBI:100000000000000000000000000000000001");
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForCustom1Like() {
List<WorkbasketSummary> results =
@ -423,7 +379,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForCustom2In() {
List<WorkbasketSummary> results =
@ -431,7 +387,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForCustom2Like() {
List<WorkbasketSummary> results =
@ -439,7 +395,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForCustom3In() {
List<WorkbasketSummary> results =
@ -447,7 +403,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForCustom3Like() {
List<WorkbasketSummary> results =
@ -455,7 +411,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForCustom4In() {
List<WorkbasketSummary> results =
@ -463,7 +419,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForCustom4Like() {
List<WorkbasketSummary> results =
@ -471,7 +427,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(5);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrgLevl1In() {
List<WorkbasketSummary> results =
@ -479,7 +435,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(24);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrgLevel1Like() {
List<WorkbasketSummary> results =
@ -487,7 +443,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrgLevel2In() {
List<WorkbasketSummary> results =
@ -495,7 +451,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(1);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrgLevel2Like() {
List<WorkbasketSummary> results =
@ -503,7 +459,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(1);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrgLevel3In() {
List<WorkbasketSummary> results =
@ -511,7 +467,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrgLevel3Like() {
List<WorkbasketSummary> results =
@ -519,7 +475,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrgLevel4In() {
List<WorkbasketSummary> results =
@ -527,7 +483,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(2);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrgLevel4Like() {
List<WorkbasketSummary> results =
@ -535,7 +491,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
assertThat(results).hasSize(25);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByOrgLevel1Desc() {
List<WorkbasketSummary> results =
@ -547,7 +503,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByOrgLevel2Asc() {
List<WorkbasketSummary> results =
@ -559,7 +515,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByOrgLevel3Desc() {
List<WorkbasketSummary> results =
@ -571,7 +527,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByOrgLevel4Asc() {
List<WorkbasketSummary> results =
@ -583,7 +539,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByCustom1Asc() {
List<WorkbasketSummary> results =
@ -595,7 +551,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByCustom2Desc() {
List<WorkbasketSummary> results =
@ -607,7 +563,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER.reversed());
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByCustom3Asc() {
List<WorkbasketSummary> results =
@ -619,7 +575,7 @@ class QueryWorkbasketAccTest extends AbstractAccTest {
.isSortedAccordingTo(CASE_INSENSITIVE_ORDER);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForOrderByCustom4Desc() {
List<WorkbasketSummary> results =

View File

@ -29,9 +29,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryWorkbasketAccessItemValuesForColumnName() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -54,9 +52,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThat(countEntries).isGreaterThan(columnValueList.size()); // DISTINCT
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAccessItemsForAccessIds() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -68,7 +64,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThat(results).hasSize(8);
}
@WithAccessId(userName = "dummy")
@WithAccessId(user = "dummy")
@Test
void testQueryAccessItemsForAccessIdsNotAuthorized() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -83,9 +79,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAccessItemsForAccessIdsOrderedDescending() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -101,9 +95,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThat(results.get(0).getId()).isEqualTo("WAI:100000000000000000000000000000000003");
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAccessItemsForAccessIdsAndWorkbasketKey() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -118,9 +110,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAccessItemsForAccessIdsWorkbasketKeyLike() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -129,9 +119,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThat(results).hasSize(4);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAccessItemsForAccessIdsWorkbasketKeyLikeAndOrderAsc()
throws NotAuthorizedException {
@ -147,9 +135,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThat(results.get(3).getWorkbasketKey()).isEqualTo("GPK_KSC_2");
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAccessItemsByWorkbasketKey() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -161,9 +147,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAccessItemsByWorkbasketKeyOrderedDescending() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -178,7 +162,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThat(results.get(0).getId()).isEqualTo("WAI:100000000000000000000000000000000009");
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testQueryForIdIn() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -192,7 +176,7 @@ class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
assertThat(results).extracting(WorkbasketAccessItem::getId).containsOnly(expectedIds);
}
@WithAccessId(userName = "businessadmin")
@WithAccessId(user = "businessadmin")
@Test
void testQueryForOrderById() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -32,9 +32,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAllTransferTargetsForUser()
throws NotAuthorizedException, InvalidArgumentException {
@ -48,7 +46,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
assertThat(results.get(0).getKey()).isEqualTo("USER_1_1");
}
@WithAccessId(userName = "dummy")
@WithAccessId(user = "dummy")
@Test
void testQueryAllTransferTargetsForUserNotAuthorized() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -63,9 +61,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
assertThatThrownBy(call).isInstanceOf(NotAuthorizedException.class);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAllTransferTargetsForUserAndGroup()
throws NotAuthorizedException, InvalidArgumentException, SystemException {
@ -78,9 +74,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
assertThat(results).hasSize(6);
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAllTransferTargetsForUserAndGroupSortedByNameAscending()
throws NotAuthorizedException, InvalidArgumentException, SystemException {
@ -95,9 +89,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
assertThat(results.get(0).getKey()).isEqualTo("GPK_KSC_1");
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAllTransferTargetsForUserAndGroupSortedByNameDescending()
throws NotAuthorizedException, InvalidArgumentException, SystemException {
@ -113,9 +105,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
assertThat(results.get(0).getKey()).isEqualTo("USER_2_2");
}
@WithAccessId(
userName = "dummy",
groupNames = {"businessadmin"})
@WithAccessId(user = "dummy", groups = "businessadmin")
@Test
void testQueryAllTransferSourcesForUserAndGroup()
throws NotAuthorizedException, InvalidArgumentException, SystemException {
@ -132,9 +122,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
}
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
void testQueryAllTransferTargetsForUserAndGroupFromSubject() throws SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -146,7 +134,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
assertThat(results).hasSize(6);
}
@WithAccessId(userName = "user_1_1")
@WithAccessId(user = "user_1_1")
@Test
void testQueryAllAvailableWorkbasketForOpeningForUserAndGroupFromSubject() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -158,9 +146,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
assertThat(results).hasSize(1);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"businessadmin"})
@WithAccessId(user = "teamlead_1", groups = "businessadmin")
@Test
void testConsiderBusinessAdminPermissionsWhileQueryingWorkbaskets() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -172,7 +158,7 @@ class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(userName = "admin")
@WithAccessId(user = "admin")
@Test
void testSkipAuthorizationCheckForAdminWhileQueryingWorkbaskets() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -20,9 +20,7 @@ class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
super();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testGetFirstPageOfWorkbasketQueryWithOffset() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -31,9 +29,7 @@ class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(5);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testGetSecondPageOfWorkbasketQueryWithOffset() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -42,9 +38,7 @@ class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(4);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testListOffsetAndLimitOutOfBounds() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -63,9 +57,7 @@ class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(3);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testPaginationWithPages() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -111,9 +103,7 @@ class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(4);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testPaginationNullAndNegativeLimitsIgnoring() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -149,9 +139,7 @@ class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
assertThat(results).hasSize(9);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testCountOfWorkbasketQuery() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -159,9 +147,7 @@ class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
assertThat(count).isEqualTo(9L);
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1"})
@WithAccessId(user = "teamlead_1", groups = "group_1")
@Test
void testWorkbasketQueryDomA() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -29,8 +29,8 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
public void testUpdateWorkbasket()
throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException {
@ -63,8 +63,8 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
public void testUpdateWorkbasketWithConcurrentModificationShouldThrowException()
throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException {
@ -81,8 +81,8 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
public void testUpdateWorkbasketOfNonExistingWorkbasketShouldThrowException()
throws NotAuthorizedException, WorkbasketNotFoundException, ConcurrencyException {
@ -99,9 +99,7 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
.isThrownBy(() -> workbasketService.updateWorkbasket(workbasket));
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_1"})
@WithAccessId(user = "user_1_1", groups = "group_1")
@Test
public void testCheckAuthorizationToUpdateWorkbasket()
throws NotAuthorizedException, WorkbasketNotFoundException {

View File

@ -22,8 +22,8 @@ public class UpdateWorkbasketAuthorizations2AccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testUpdatedAccessItemListToEmptyList() throws Exception {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -37,8 +37,8 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testUpdateWorkbasketAccessItemSucceeds()
throws InvalidArgumentException, NotAuthorizedException, WorkbasketNotFoundException,
@ -73,8 +73,8 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testUpdateWorkbasketAccessItemRejected()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
@ -122,8 +122,8 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "user_1_1",
groupNames = {"group_2", "businessadmin"})
user = "user_1_1",
groups = {"group_2", "businessadmin"})
@Test
void testUpdatedAccessItemLeadsToNotAuthorizedException()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
@ -168,8 +168,8 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testUpdatedAccessItemList() throws Exception {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -208,8 +208,8 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testInsertAccessItemList() throws Exception {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -246,8 +246,8 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"})
user = "teamlead_1",
groups = {"group_1", "businessadmin"})
@Test
void testDeleteAccessItemForAccessItemId() throws Exception {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -279,9 +279,7 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
assertThat(new HashSet<>(listEqualToOriginal)).isEqualTo(new HashSet<>(originalList));
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"businessadmin"})
@WithAccessId(user = "teamlead_1", groups = "businessadmin")
@Test
void testDeleteAccessItemsForAccessId() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -296,9 +294,7 @@ class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
assertThat(accessIdCountBefore > accessIdCountAfter).isTrue();
}
@WithAccessId(
userName = "teamlead_1",
groupNames = {"businessadmin"})
@WithAccessId(user = "teamlead_1", groups = "businessadmin")
@Test
void testDeleteAccessItemsForAccessIdWithUnusedValuesThrowingNoException()
throws NotAuthorizedException {

View File

@ -22,8 +22,8 @@ class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest {
@Test
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
void testGetFirstPageOfTaskQueryWithOffset() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results =
@ -41,8 +41,8 @@ class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest {
@Test
@WithAccessId(
userName = "teamlead_1",
groupNames = {"group_1", "group_2"})
user = "teamlead_1",
groups = {"group_1", "group_2"})
void testGetSecondPageOfTaskQueryWithOffset() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results =

View File

@ -1,86 +1,250 @@
package pro.taskana.security;
import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated;
import static pro.taskana.common.internal.util.CheckedFunction.wrap;
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.security.Principal;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.security.auth.Subject;
import org.junit.jupiter.api.DynamicContainer;
import org.junit.jupiter.api.DynamicNode;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.junit.jupiter.api.extension.ExtensionContext.Store;
import org.junit.jupiter.api.extension.InvocationInterceptor;
import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
import org.junit.jupiter.api.extension.TestTemplateInvocationContext;
import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider;
import org.junit.platform.commons.JUnitException;
import pro.taskana.common.api.exceptions.SystemException;
import pro.taskana.common.internal.security.GroupPrincipal;
import pro.taskana.common.internal.security.UserPrincipal;
/** Runner for integration tests that enables JAAS subject. */
public class JaasExtension implements InvocationInterceptor {
public class JaasExtension implements InvocationInterceptor, TestTemplateInvocationContextProvider {
private static final String ACCESS_IDS_STORE_KEY = "accessIds";
// region InvocationInterceptor
@Override
public <T> T interceptTestClassConstructor(
Invocation<T> invocation,
ReflectiveInvocationContext<Constructor<T>> invocationContext,
ExtensionContext extensionContext) {
return extractAccessIdAndPerformInvocation(invocation, invocationContext.getExecutable());
}
@Override
public void interceptBeforeAllMethod(
Invocation<Void> invocation,
ReflectiveInvocationContext<Method> invocationContext,
ExtensionContext extensionContext) {
extractAccessIdAndPerformInvocation(invocation, invocationContext.getExecutable());
}
@Override
public void interceptBeforeEachMethod(
Invocation<Void> invocation,
ReflectiveInvocationContext<Method> invocationContext,
ExtensionContext extensionContext)
throws Throwable {
extractAccessId(invocation, invocationContext.getExecutable());
ExtensionContext extensionContext) {
extractAccessIdAndPerformInvocation(invocation, invocationContext.getExecutable());
}
@Override
public void interceptTestMethod(
Invocation<Void> invocation,
ReflectiveInvocationContext<Method> invocationContext,
ExtensionContext extensionContext)
throws Throwable {
extractAccessId(invocation, invocationContext.getExecutable());
ExtensionContext extensionContext) {
boolean annotated = isAnnotated(invocationContext.getExecutable(), WithAccessIds.class);
if (annotated) {
throw new JUnitException("Please use @TestTemplate instead of @Test for multiple access Ids");
}
extractAccessIdAndPerformInvocation(invocation, invocationContext.getExecutable());
}
@Override
@SuppressWarnings("unchecked")
public <T> T interceptTestFactoryMethod(
Invocation<T> invocation,
ReflectiveInvocationContext<Method> invocationContext,
ExtensionContext extensionContext)
throws Throwable {
return extractAccessId(invocation, invocationContext.getExecutable());
ExtensionContext extensionContext) {
WithAccessIds annotation = invocationContext.getExecutable().getAnnotation(WithAccessIds.class);
if (annotation != null) {
// we are using the first annotation to run the factory method with.
T t = performInvocationWithAccessId(invocation, annotation.value()[0]);
Iterable<DynamicNode> iterable;
// TestFactory must have one of the following return types. See link below for further details
// https://junit.org/junit5/docs/current/user-guide/#writing-tests-dynamic-tests
if (t instanceof DynamicNode) {
iterable = Collections.singleton((DynamicNode) t);
} else if (t instanceof Stream) {
Stream<DynamicNode> tt = (Stream<DynamicNode>) t;
iterable = tt.collect(Collectors.toList());
} else if (t instanceof Iterable) {
iterable = (Iterable<DynamicNode>) t;
} else if (t instanceof Iterator) {
iterable = () -> (Iterator<DynamicNode>) t;
// TODO: add instanceof DynamicNode[]
} else {
throw new SystemException(
String.format(
"Testfactory '%s' did not return a proper type",
invocationContext.getExecutable().getName()));
}
// StreamSupport.stream(iterable.spliterator(), false).map(node -> {
// if (node instanceof DynamicContainer) {
// return DynamicContainer.dynamicContainer(node.getDisplayName(),
// ((DynamicContainer) node).getChildren());
// } return node;
// }).forEach(System.out::println);
Store store = getStore(extensionContext);
return (T)
Stream.of(annotation.value())
.peek(a -> store.put(ACCESS_IDS_STORE_KEY, a))
.map(a -> DynamicContainer.dynamicContainer(getDisplayNameForAccessId(a), iterable));
}
return extractAccessIdAndPerformInvocation(invocation, invocationContext.getExecutable());
}
@Override
public void interceptDynamicTest(Invocation<Void> invocation, ExtensionContext extensionContext)
throws Throwable {
extractAccessId(invocation, extensionContext.getParent().get().getRequiredTestMethod());
public void interceptTestTemplateMethod(
Invocation<Void> invocation,
ReflectiveInvocationContext<Method> invocationContext,
ExtensionContext extensionContext) {
WithAccessId accessId =
getStore(extensionContext).get(ACCESS_IDS_STORE_KEY, WithAccessId.class);
performInvocationWithAccessId(invocation, accessId);
}
private <T> T extractAccessId(Invocation<T> invocation, Method method)
throws PrivilegedActionException {
// check for access
Subject subject = new Subject();
List<Principal> principalList = new ArrayList<>();
WithAccessId withAccessId = method.getAnnotation(WithAccessId.class);
if (withAccessId != null) {
withAccessId.userName();
principalList.add(new UserPrincipal(withAccessId.userName()));
for (String groupName : withAccessId.groupNames()) {
if (groupName != null) {
principalList.add(new GroupPrincipal(groupName));
}
}
@Override
public void interceptDynamicTest(Invocation<Void> invocation, ExtensionContext extensionContext) {
ExtensionContext testContext = getParentMethodExtensionContent(extensionContext);
// Check if the test factory provided an access Id for this dynamic test.
WithAccessId o = getStore(testContext).get(ACCESS_IDS_STORE_KEY, WithAccessId.class);
if (o != null) {
performInvocationWithAccessId(invocation, o);
} else {
extractAccessIdAndPerformInvocation(invocation, testContext.getRequiredTestMethod());
}
subject.getPrincipals().addAll(principalList);
return Subject.doAs(subject, getObjectPrivilegedExceptionAction(invocation, method));
}
private <T> PrivilegedExceptionAction<T> getObjectPrivilegedExceptionAction(
Invocation<T> invocation, Method invocationContext) {
return () -> {
try {
return invocation.proceed();
} catch (Exception | Error e) {
throw e;
} catch (Throwable e) {
throw new JUnitException("Execution of test failed: " + invocationContext.getName(), e);
}
};
@Override
public void interceptAfterEachMethod(
Invocation<Void> invocation,
ReflectiveInvocationContext<Method> invocationContext,
ExtensionContext extensionContext) {
extractAccessIdAndPerformInvocation(invocation, invocationContext.getExecutable());
}
@Override
public void interceptAfterAllMethod(
Invocation<Void> invocation,
ReflectiveInvocationContext<Method> invocationContext,
ExtensionContext extensionContext) {
extractAccessIdAndPerformInvocation(invocation, invocationContext.getExecutable());
}
// endregion
// region TestTemplateInvocationContextProvider
@Override
public boolean supportsTestTemplate(ExtensionContext context) {
return isAnnotated(context.getRequiredTestMethod(), WithAccessIds.class);
}
@Override
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(
ExtensionContext context) {
WithAccessIds annotation = context.getRequiredTestMethod().getAnnotation(WithAccessIds.class);
Store store = getStore(context);
return Stream.of(annotation.value())
.peek(a -> store.put(ACCESS_IDS_STORE_KEY, a))
.map(JaasExtensionInvocationContext::new);
}
// endregion
private static <T> T extractAccessIdAndPerformInvocation(
Invocation<T> invocation, Executable executable) {
return performInvocationWithAccessId(invocation, executable.getAnnotation(WithAccessId.class));
}
private static <T> T performInvocationWithAccessId(
Invocation<T> invocation, WithAccessId withAccessId) {
Subject subject = new Subject();
subject.getPrincipals().addAll(getPrincipals(withAccessId));
Function<Invocation<T>, T> proceedInvocation = wrap(Invocation::proceed);
PrivilegedAction<T> performInvocation = () -> proceedInvocation.apply(invocation);
return Subject.doAs(subject, performInvocation);
}
private static List<Principal> getPrincipals(WithAccessId withAccessId) {
if (withAccessId != null) {
return Stream.concat(
Stream.of(withAccessId.user()).map(UserPrincipal::new),
Arrays.stream(withAccessId.groups()).map(GroupPrincipal::new))
.collect(Collectors.toList());
}
return Collections.emptyList();
}
private ExtensionContext getParentMethodExtensionContent(ExtensionContext extensionContext) {
Optional<ExtensionContext> parent = extensionContext.getParent();
// the class MethodExtensionContext is part of junit-jupiter-engine.
// This is a workaround so that the engine dependency doesn't have to be included.
while (!parent
.map(Object::getClass)
.map(Class::getName)
.filter(s -> s.endsWith("MethodExtensionContext"))
.isPresent()) {
parent = parent.flatMap(ExtensionContext::getParent);
}
return parent.orElseThrow(
() ->
new JUnitException(
String.format(
"Test '%s' does not have a parent method", extensionContext.getUniqueId())));
}
/**
* Gets the store with a <b>method-level</b> scope.
*
* @param context context for current extension
* @return The store
*/
private Store getStore(ExtensionContext context) {
return context.getStore(Namespace.create(getClass(), context.getRequiredTestMethod()));
}
private static String getDisplayNameForAccessId(WithAccessId withAccessId) {
return String.format("for user '%s'", withAccessId.user());
}
private static class JaasExtensionInvocationContext implements TestTemplateInvocationContext {
private final WithAccessId withAccessId;
private JaasExtensionInvocationContext(WithAccessId withAccessId) {
this.withAccessId = withAccessId;
}
@Override
public String getDisplayName(int invocationIndex) {
return getDisplayNameForAccessId(withAccessId);
}
}
}

View File

@ -0,0 +1,112 @@
package pro.taskana.security;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.common.internal.security.CurrentUserContext;
@ExtendWith(JaasExtension.class)
public class JaasExtensionTest {
// region JaasExtension#interceptTestClassConstructor
@WithAccessId(user = "constructor")
public JaasExtensionTest() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("constructor");
}
// endregion
@WithAccessId(user = "beforeall")
@BeforeAll
static void should_SetJaasSubject_When_AnnotationExists_On_BeforeAll() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("beforeall");
}
@WithAccessId(user = "beforeall")
@WithAccessId(user = "beforeall2")
@BeforeAll
static void should_NotSetJaasSubject_When_MultipleAnnotationsExist_On_BeforeAll() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
}
@BeforeAll
static void should_NotSetJaasSubject_When_AnnotationIsMissing_On_BeforeAll() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
}
@BeforeEach
void should_NotJaasSubject_When_AnnotationIsMissing_On_BeforeEach() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
}
@WithAccessId(user = "beforeeach")
@BeforeEach
void should_SetJaasSubject_When_AnnotationExists_On_BeforeEach() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("beforeeach");
}
@WithAccessId(user = "beforeeach")
@WithAccessId(user = "beforeeach2")
@BeforeEach
void should_NotSetJaasSubject_When_MultipleAnnotationsExist_On_BeforeEach() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
}
@WithAccessId(user = "user")
@Test
void should_SetJaasSubject_When_AnnotationExists_On_Test() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("user");
}
@WithAccessId(user = "user")
@WithAccessId(user = "user2")
@Test
@Disabled("can we make this work somehow?")
void should_NotSetJaasSubject_When_MultipleAnnotationsExist_On_Test() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
}
@Test
void should_NotSetJaasSubject_When_AnnotationIsMissing_On_Test() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
}
@WithAccessId(user = "testtemplate1")
@WithAccessId(user = "testtemplate2")
@WithAccessId(user = "testtemplate3")
@TestTemplate
void should_SetMultipleJaasSubjects_When_MultipleAnnotationsExist_On_TestTemplate() {
assertThat(CurrentUserContext.getUserid()).isNotNull();
}
@Nested
class ConstructorWithoutAccessId {
ConstructorWithoutAccessId() {
assertThat(CurrentUserContext.getUserid()).isEqualTo(null);
}
@Test
void should_NotSetJaasSubject_When_AnnotationIsMissing_On_Constructor() {
assertThat(CurrentUserContext.getUserid()).isNull();
}
}
@Nested
class ConstructorWithAccessId {
@WithAccessId(user = "constructor")
ConstructorWithAccessId() {
assertThat(CurrentUserContext.getUserid()).isEqualTo("constructor");
}
@Test
void should_SetJaasSubject_When_AnnotationExists_On_Constructor() {
assertThat(CurrentUserContext.getUserid()).isNull();
}
}
}

View File

@ -1,20 +1,17 @@
package pro.taskana.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specify user id for JUnit JAASRunner.
*
* @author bbr
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
@Repeatable(WithAccessIds.class)
public @interface WithAccessId {
String userName();
String user();
String[] groupNames() default {};
String[] groups() default {};
}

View File

@ -0,0 +1,12 @@
package pro.taskana.security;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface WithAccessIds {
WithAccessId[] value();
}

View File

@ -266,9 +266,7 @@ class TaskServiceImplIntAutocommitTest {
assertThatThrownBy(call).isInstanceOf(TaskNotFoundException.class);
}
@WithAccessId(
userName = "User",
groupNames = {"businessadmin"})
@WithAccessId(user = "User", groups = "businessadmin")
@Test
void shouldNotTransferByFailingSecurity()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,

View File

@ -109,9 +109,7 @@ class TaskServiceImplIntExplicitTest {
sampleDataGenerator.clearDb();
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void testStartTransactionFail()
throws SQLException, TaskNotFoundException, NotAuthorizedException,
@ -159,9 +157,7 @@ class TaskServiceImplIntExplicitTest {
}
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void testCreateTask()
throws SQLException, TaskNotFoundException, NotAuthorizedException,
@ -193,9 +189,7 @@ class TaskServiceImplIntExplicitTest {
}
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void createTaskShouldThrowWorkbasketNotFoundException()
throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException,
@ -214,9 +208,7 @@ class TaskServiceImplIntExplicitTest {
}
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void createManualTaskShouldThrowClassificationNotFoundException()
throws NotAuthorizedException, WorkbasketNotFoundException, SQLException,
@ -252,8 +244,8 @@ class TaskServiceImplIntExplicitTest {
}
@WithAccessId(
userName = "Elena",
groupNames = {"DummyGroup", "businessadmin"})
user = "Elena",
groups = {"DummyGroup", "businessadmin"})
@Test
void should_ReturnList_when_BuilderIsUsed()
throws SQLException, NotAuthorizedException, WorkbasketNotFoundException,
@ -308,9 +300,7 @@ class TaskServiceImplIntExplicitTest {
}
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void shouldTransferTaskToOtherWorkbasket()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
@ -402,9 +392,7 @@ class TaskServiceImplIntExplicitTest {
}
}
@WithAccessId(
userName = "User",
groupNames = {"businessadmin"})
@WithAccessId(user = "User", groups = "businessadmin")
@Test
void shouldNotTransferByFailingSecurity()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,

View File

@ -77,9 +77,7 @@ class WorkbasketServiceImplIntAutocommitTest {
assertThatThrownBy(call).isInstanceOf(WorkbasketNotFoundException.class);
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void testUpdateWorkbasket() throws Exception {
String id0 = IdGenerator.generateWithPrefix("TWB");
@ -130,9 +128,7 @@ class WorkbasketServiceImplIntAutocommitTest {
.isEqualTo(workBasketService.getWorkbasket(id3).getModified());
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void testInsertWorkbasketAccessUser()
throws NotAuthorizedException, InvalidArgumentException, DomainNotFoundException,
@ -161,9 +157,7 @@ class WorkbasketServiceImplIntAutocommitTest {
.size());
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void testUpdateWorkbasketAccessUser()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,

View File

@ -74,9 +74,7 @@ class WorkbasketServiceImplIntExplicitTest {
sampleDataGenerator.clearDb();
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void testUpdateWorkbasket() throws Exception {
try (Connection connection = dataSource.getConnection()) {
@ -132,9 +130,7 @@ class WorkbasketServiceImplIntExplicitTest {
}
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void testInsertWorkbasketAccessUser()
throws NotAuthorizedException, SQLException, InvalidArgumentException,
@ -157,9 +153,7 @@ class WorkbasketServiceImplIntExplicitTest {
}
}
@WithAccessId(
userName = "Elena",
groupNames = {"businessadmin"})
@WithAccessId(user = "Elena", groups = "businessadmin")
@Test
void testUpdateWorkbasketAccessUser()
throws NotAuthorizedException, SQLException, InvalidArgumentException,