TSK-983: Remove junit 4 from taskana-core

This commit is contained in:
Benjamin Eckstein 2019-12-10 14:45:19 +01:00 committed by Mustapha Zorgati
parent 6123639aea
commit 757ac1e379
93 changed files with 1366 additions and 1454 deletions

View File

@ -15,6 +15,10 @@
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<properties>
<version.mockito>2.8.47</version.mockito>
</properties>
<modules> <modules>
<module>taskana-simplehistory-provider</module> <module>taskana-simplehistory-provider</module>
<module>taskana-simplehistory-rest-spring</module> <module>taskana-simplehistory-rest-spring</module>

View File

@ -55,9 +55,9 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.vintage</groupId> <groupId>org.hamcrest</groupId>
<artifactId>junit-vintage-engine</artifactId> <artifactId>hamcrest-library</artifactId>
<version>${version.junit.jupiter}</version> <version>2.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -67,9 +67,9 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.powermock</groupId> <groupId>org.mockito</groupId>
<artifactId>powermock-module-junit4</artifactId> <artifactId>mockito-junit-jupiter</artifactId>
<version>${version.powermock}</version> <version>${version.junit.mockito}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -13,7 +13,6 @@ import java.util.Map;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.BeforeClass;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import pro.taskana.Attachment; import pro.taskana.Attachment;
@ -21,9 +20,8 @@ import pro.taskana.ObjectReference;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
import pro.taskana.TaskanaEngine.ConnectionManagementMode; import pro.taskana.TaskanaEngine.ConnectionManagementMode;
import pro.taskana.TimeInterval; import pro.taskana.TimeInterval;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
import pro.taskana.sampledata.SampleDataGenerator; import pro.taskana.sampledata.SampleDataGenerator;
/** /**
@ -31,24 +29,23 @@ import pro.taskana.sampledata.SampleDataGenerator;
*/ */
public abstract class AbstractAccTest { public abstract class AbstractAccTest {
protected static TaskanaEngineConfiguration taskanaEngineConfiguration; protected static pro.taskana.configuration.TaskanaEngineConfiguration taskanaEngineConfiguration;
protected static TaskanaEngine taskanaEngine; protected static TaskanaEngine taskanaEngine;
@BeforeAll @BeforeAll
@BeforeClass
public static void setupTest() throws Exception { public static void setupTest() throws Exception {
resetDb(false); resetDb(false);
} }
public static void resetDb(boolean dropTables) throws SQLException, IOException { public static void resetDb(boolean dropTables) throws SQLException, IOException {
DataSource dataSource = TaskanaEngineConfigurationTest.getDataSource(); DataSource dataSource = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource, schemaName); SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource, schemaName);
if (dropTables) { if (dropTables) {
sampleDataGenerator.dropDb(); sampleDataGenerator.dropDb();
} }
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineTestConfiguration.getDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(dataSource, false,
schemaName); schemaName);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
taskanaEngine.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT); taskanaEngine.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);

View File

@ -1,10 +1,10 @@
package acceptance.classification; package acceptance.classification;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -154,8 +154,7 @@ class CreateClassificationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"}) groupNames = {"group_1", "businessadmin"})
@Test @Test
void testCreateClassificationWithInvalidValues() void testCreateClassificationWithInvalidValues() {
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException {
classificationService.createClassificationQuery().count(); classificationService.createClassificationQuery().count();
// Check key NULL // Check key NULL

View File

@ -1,8 +1,8 @@
package acceptance.classification; package acceptance.classification;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -21,11 +21,11 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "delete classification" scenarios. * Acceptance test for all "delete classification" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class DeleteClassificationAccTest extends AbstractAccTest { class DeleteClassificationAccTest extends AbstractAccTest {
private ClassificationService classificationService; private ClassificationService classificationService;
public DeleteClassificationAccTest() { DeleteClassificationAccTest() {
super(); super();
classificationService = taskanaEngine.getClassificationService(); classificationService = taskanaEngine.getClassificationService();
} }
@ -34,7 +34,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testDeleteClassificationInDomain() void testDeleteClassificationInDomain()
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException { throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
classificationService.deleteClassification("L140101", "DOMAIN_A"); classificationService.deleteClassification("L140101", "DOMAIN_A");
@ -47,8 +47,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testDeleteClassificationInDomainUserIsNotAuthorized() void testDeleteClassificationInDomainUserIsNotAuthorized() {
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
classificationService.deleteClassification("L140101", "DOMAIN_A")); classificationService.deleteClassification("L140101", "DOMAIN_A"));
} }
@ -57,7 +56,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"}) groupNames = {"group_1", "businessadmin"})
@Test @Test
public void testThrowExeptionIfDeleteClassificationWithExistingTasks() { void testThrowExeptionIfDeleteClassificationWithExistingTasks() {
Assertions.assertThrows(ClassificationInUseException.class, () -> Assertions.assertThrows(ClassificationInUseException.class, () ->
classificationService.deleteClassification("L1050", "DOMAIN_A")); classificationService.deleteClassification("L1050", "DOMAIN_A"));
} }
@ -66,7 +65,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"}) groupNames = {"group_1", "businessadmin"})
@Test @Test
public void testThrowExeptionIfDeleteMasterClassificationWithExistingTasks() { void testThrowExeptionIfDeleteMasterClassificationWithExistingTasks() {
Assertions.assertThrows(ClassificationInUseException.class, () -> Assertions.assertThrows(ClassificationInUseException.class, () ->
classificationService.deleteClassification("L1050", "")); classificationService.deleteClassification("L1050", ""));
} }
@ -75,7 +74,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testDeleteMasterClassification() void testDeleteMasterClassification()
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException { throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
classificationService.deleteClassification("L3060", ""); classificationService.deleteClassification("L3060", "");
@ -88,7 +87,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testDeleteMasterClassificationWithExistingAttachment() { void testDeleteMasterClassificationWithExistingAttachment() {
Assertions.assertThrows(ClassificationInUseException.class, () -> Assertions.assertThrows(ClassificationInUseException.class, () ->
classificationService.deleteClassification("L12010", "")); classificationService.deleteClassification("L12010", ""));
} }
@ -97,7 +96,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "businessadmin"}) groupNames = {"group_1", "businessadmin"})
@Test @Test
public void testThrowExceptionWhenChildClassificationIsInUseAndRollback() void testThrowExceptionWhenChildClassificationIsInUseAndRollback()
throws ClassificationNotFoundException { throws ClassificationNotFoundException {
Assertions.assertThrows(ClassificationInUseException.class, () -> Assertions.assertThrows(ClassificationInUseException.class, () ->
@ -119,7 +118,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testThrowClassificationNotFoundIfClassificationNotExists() { void testThrowClassificationNotFoundIfClassificationNotExists() {
Assertions.assertThrows(ClassificationNotFoundException.class, () -> Assertions.assertThrows(ClassificationNotFoundException.class, () ->
classificationService.deleteClassification("not existing classification key", "")); classificationService.deleteClassification("not existing classification key", ""));
} }
@ -128,7 +127,7 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testThrowClassificationNotFoundIfClassificationNotExistsInDomain() { void testThrowClassificationNotFoundIfClassificationNotExistsInDomain() {
Assertions.assertThrows(ClassificationNotFoundException.class, () -> Assertions.assertThrows(ClassificationNotFoundException.class, () ->
classificationService.deleteClassification("L10000", "DOMAIN_B")); classificationService.deleteClassification("L10000", "DOMAIN_B"));
} }

View File

@ -1,7 +1,7 @@
package acceptance.classification; package acceptance.classification;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.List; import java.util.List;
@ -17,24 +17,24 @@ import pro.taskana.exceptions.ClassificationNotFoundException;
/** /**
* Acceptance test for all "get classification" scenarios. * Acceptance test for all "get classification" scenarios.
*/ */
public class GetClassificationAccTest extends AbstractAccTest { class GetClassificationAccTest extends AbstractAccTest {
private ClassificationService classificationService; private ClassificationService classificationService;
public GetClassificationAccTest() { GetClassificationAccTest() {
super(); super();
classificationService = taskanaEngine.getClassificationService(); classificationService = taskanaEngine.getClassificationService();
} }
@Test @Test
public void testFindAllClassifications() { void testFindAllClassifications() {
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.list(); .list();
assertNotNull(classificationSummaryList); assertNotNull(classificationSummaryList);
} }
@Test @Test
public void testGetOneClassificationByKeyAndDomain() throws ClassificationNotFoundException { void testGetOneClassificationByKeyAndDomain() throws ClassificationNotFoundException {
Classification classification = classificationService.getClassification("T6310", "DOMAIN_A"); Classification classification = classificationService.getClassification("T6310", "DOMAIN_A");
assertNotNull(classification); assertNotNull(classification);
assertEquals("CLI:100000000000000000000000000000000011", classification.getId()); assertEquals("CLI:100000000000000000000000000000000011", classification.getId());
@ -57,7 +57,7 @@ public class GetClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetOneClassificationById() throws ClassificationNotFoundException { void testGetOneClassificationById() throws ClassificationNotFoundException {
Classification classification = classificationService Classification classification = classificationService
.getClassification("CLI:100000000000000000000000000000000011"); .getClassification("CLI:100000000000000000000000000000000011");
assertNotNull(classification); assertNotNull(classification);
@ -89,7 +89,7 @@ public class GetClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationAsSummary() throws ClassificationNotFoundException { void testGetClassificationAsSummary() throws ClassificationNotFoundException {
ClassificationSummary classification = classificationService ClassificationSummary classification = classificationService
.getClassification("CLI:100000000000000000000000000000000011").asSummary(); .getClassification("CLI:100000000000000000000000000000000011").asSummary();
assertNotNull(classification); assertNotNull(classification);
@ -105,26 +105,26 @@ public class GetClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetOneClassificationByIdFails() { void testGetOneClassificationByIdFails() {
Assertions.assertThrows(ClassificationNotFoundException.class, () -> Assertions.assertThrows(ClassificationNotFoundException.class, () ->
classificationService.getClassification("CLI:100000000470000000000000000000000011")); classificationService.getClassification("CLI:100000000470000000000000000000000011"));
} }
@Test @Test
public void testGetClassificationByNullKeyFails() { void testGetClassificationByNullKeyFails() {
Assertions.assertThrows(ClassificationNotFoundException.class, () -> Assertions.assertThrows(ClassificationNotFoundException.class, () ->
classificationService.getClassification(null, "")); classificationService.getClassification(null, ""));
} }
@Test @Test
public void testGetClassificationByInvalidKeyAndDomain() { void testGetClassificationByInvalidKeyAndDomain() {
Assertions.assertThrows(ClassificationNotFoundException.class, () -> Assertions.assertThrows(ClassificationNotFoundException.class, () ->
classificationService.getClassification("Key0815", "NOT_EXISTING")); classificationService.getClassification("Key0815", "NOT_EXISTING"));
} }
@Test @Test
public void testGetOneClassificationForDomainAndGetClassificationFromMasterDomain() void testGetOneClassificationForDomainAndGetClassificationFromMasterDomain()
throws ClassificationNotFoundException { throws ClassificationNotFoundException {
Classification classification = classificationService.getClassification("L10000", "DOMAIN_B"); Classification classification = classificationService.getClassification("L10000", "DOMAIN_B");
assertNotNull(classification); assertNotNull(classification);
@ -133,7 +133,7 @@ public class GetClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetOneClassificationForMasterDomain() throws ClassificationNotFoundException { void testGetOneClassificationForMasterDomain() throws ClassificationNotFoundException {
Classification classification = classificationService.getClassification("L10000", ""); Classification classification = classificationService.getClassification("L10000", "");
assertNotNull(classification); assertNotNull(classification);
assertEquals("", classification.getDomain()); assertEquals("", classification.getDomain());

View File

@ -1,7 +1,7 @@
package acceptance.classification; package acceptance.classification;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static pro.taskana.ClassificationQueryColumnName.CREATED; import static pro.taskana.ClassificationQueryColumnName.CREATED;
import static pro.taskana.ClassificationQueryColumnName.NAME; import static pro.taskana.ClassificationQueryColumnName.NAME;
import static pro.taskana.ClassificationQueryColumnName.TYPE; import static pro.taskana.ClassificationQueryColumnName.TYPE;
@ -30,17 +30,17 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "get classification" scenarios. * Acceptance test for all "get classification" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryClassificationAccTest extends AbstractAccTest { class QueryClassificationAccTest extends AbstractAccTest {
private static SortDirection asc = SortDirection.ASCENDING; private static SortDirection asc = SortDirection.ASCENDING;
private static SortDirection desc = SortDirection.DESCENDING; private static SortDirection desc = SortDirection.DESCENDING;
public QueryClassificationAccTest() { QueryClassificationAccTest() {
super(); super();
} }
@Test @Test
public void testQueryClassificationValuesForColumnName() { void testQueryClassificationValuesForColumnName() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<String> columnValueList = classificationService.createClassificationQuery() List<String> columnValueList = classificationService.createClassificationQuery()
.listValues(NAME, null); .listValues(NAME, null);
@ -72,7 +72,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindClassificationsByCategoryAndDomain() { void testFindClassificationsByCategoryAndDomain() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.categoryIn("MANUAL") .categoryIn("MANUAL")
@ -84,7 +84,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetOneClassificationForMultipleDomains() { void testGetOneClassificationForMultipleDomains() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.keyIn("L10000") .keyIn("L10000")
@ -96,7 +96,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsForTypeAndParent() { void testGetClassificationsForTypeAndParent() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.typeIn("TASK", "DOCUMENT") .typeIn("TASK", "DOCUMENT")
@ -120,7 +120,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsForKeyAndCategories() { void testGetClassificationsForKeyAndCategories() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.keyIn("T2100", "L10000") .keyIn("T2100", "L10000")
@ -144,7 +144,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsWithParentId() { void testGetClassificationsWithParentId() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.keyIn("A12", "A13") .keyIn("A12", "A13")
@ -167,7 +167,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsWithParentKey() { void testGetClassificationsWithParentKey() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.keyIn("A12", "A13") .keyIn("A12", "A13")
@ -189,7 +189,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsWithCustom1() throws InvalidArgumentException { void testGetClassificationsWithCustom1() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.customAttributeIn("1", "VNR,RVNR,KOLVNR", "VNR") .customAttributeIn("1", "VNR,RVNR,KOLVNR", "VNR")
@ -200,7 +200,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsWithCustom1Like() throws InvalidArgumentException { void testGetClassificationsWithCustom1Like() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.customAttributeLike("1", "%RVNR%") .customAttributeLike("1", "%RVNR%")
@ -212,7 +212,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetClassificationsWithParentAndCustom2() throws InvalidArgumentException { void testGetClassificationsWithParentAndCustom2() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classifications = classificationService.createClassificationQuery() List<ClassificationSummary> classifications = classificationService.createClassificationQuery()
.parentIdIn("CLI:100000000000000000000000000000000004") .parentIdIn("CLI:100000000000000000000000000000000004")
@ -224,7 +224,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindClassificationsByCreatedTimestamp() { void testFindClassificationsByCreatedTimestamp() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -236,7 +236,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindClassificationsByPriorityAndValidInDomain() { void testFindClassificationsByPriorityAndValidInDomain() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> list = classificationService.createClassificationQuery() List<ClassificationSummary> list = classificationService.createClassificationQuery()
.validInDomainEquals(Boolean.TRUE) .validInDomainEquals(Boolean.TRUE)
@ -249,7 +249,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "businessadmin") userName = "businessadmin")
@Test @Test
public void testFindClassificationByModifiedWithin() void testFindClassificationByModifiedWithin()
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InvalidArgumentException { throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
String clId = "CLI:200000000000000000000000000000000015"; String clId = "CLI:200000000000000000000000000000000015";
@ -264,7 +264,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForNameLike() { void testQueryForNameLike() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.nameLike("Dynamik%") .nameLike("Dynamik%")
@ -273,7 +273,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForNameIn() { void testQueryForNameIn() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.nameIn("Widerruf", "OLD-Leistungsfall") .nameIn("Widerruf", "OLD-Leistungsfall")
@ -282,7 +282,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForDescriptionLike() { void testQueryForDescriptionLike() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.descriptionLike("Widerruf%") .descriptionLike("Widerruf%")
@ -291,7 +291,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForServiceLevelIn() { void testQueryForServiceLevelIn() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.serviceLevelIn("P2D") .serviceLevelIn("P2D")
@ -300,7 +300,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForServiceLevelLike() { void testQueryForServiceLevelLike() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.serviceLevelLike("PT%") .serviceLevelLike("PT%")
@ -309,7 +309,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForApplicationEntryPointIn() { void testQueryForApplicationEntryPointIn() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.applicationEntryPointIn("specialPoint", "point0815") .applicationEntryPointIn("specialPoint", "point0815")
@ -318,7 +318,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForApplicationEntryPointLike() { void testQueryForApplicationEntryPointLike() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.applicationEntryPointLike("point%") .applicationEntryPointLike("point%")
@ -327,7 +327,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom1In() throws InvalidArgumentException { void testQueryForCustom1In() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeIn("1", "VNR,RVNR,KOLVNR, ANR", "VNR") .customAttributeIn("1", "VNR,RVNR,KOLVNR, ANR", "VNR")
@ -336,7 +336,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom2In() throws InvalidArgumentException { void testQueryForCustom2In() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeIn("2", "CUSTOM2", "custom2") .customAttributeIn("2", "CUSTOM2", "custom2")
@ -345,7 +345,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom3In() throws InvalidArgumentException { void testQueryForCustom3In() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeIn("3", "Custom3", "custom3") .customAttributeIn("3", "Custom3", "custom3")
@ -354,7 +354,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom4In() throws InvalidArgumentException { void testQueryForCustom4In() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeIn("4", "custom4") .customAttributeIn("4", "custom4")
@ -363,7 +363,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom5In() throws InvalidArgumentException { void testQueryForCustom5In() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeIn("5", "custom5") .customAttributeIn("5", "custom5")
@ -372,7 +372,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom6In() throws InvalidArgumentException { void testQueryForCustom6In() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeIn("6", "custom6") .customAttributeIn("6", "custom6")
@ -381,7 +381,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom7In() throws InvalidArgumentException { void testQueryForCustom7In() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeIn("7", "custom7", "custom_7") .customAttributeIn("7", "custom7", "custom_7")
@ -390,7 +390,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom8In() throws InvalidArgumentException { void testQueryForCustom8In() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeIn("8", "custom_8", "custom8") .customAttributeIn("8", "custom_8", "custom8")
@ -399,7 +399,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom2Like() throws InvalidArgumentException { void testQueryForCustom2Like() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeLike("2", "cus%") .customAttributeLike("2", "cus%")
@ -408,7 +408,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom3Like() throws InvalidArgumentException { void testQueryForCustom3Like() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeLike("3", "cus%") .customAttributeLike("3", "cus%")
@ -417,7 +417,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom4Like() throws InvalidArgumentException { void testQueryForCustom4Like() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeLike("4", "cus%") .customAttributeLike("4", "cus%")
@ -426,7 +426,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom5Like() throws InvalidArgumentException { void testQueryForCustom5Like() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeLike("5", "cus%") .customAttributeLike("5", "cus%")
@ -435,7 +435,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom6Like() throws InvalidArgumentException { void testQueryForCustom6Like() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeLike("6", "cus%") .customAttributeLike("6", "cus%")
@ -444,7 +444,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom7Like() throws InvalidArgumentException { void testQueryForCustom7Like() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeLike("7", "cus%") .customAttributeLike("7", "cus%")
@ -453,7 +453,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForCustom8Like() throws InvalidArgumentException { void testQueryForCustom8Like() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.customAttributeLike("8", "cus%") .customAttributeLike("8", "cus%")
@ -462,7 +462,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByKeyAsc() { void testQueryForOrderByKeyAsc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByKey(asc) .orderByKey(asc)
@ -471,7 +471,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByParentIdDesc() { void testQueryForOrderByParentIdDesc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByDomain(asc) .orderByDomain(asc)
@ -481,7 +481,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByParentKeyDesc() { void testQueryForOrderByParentKeyDesc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByParentKey(desc) .orderByParentKey(desc)
@ -490,7 +490,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByCategoryDesc() { void testQueryForOrderByCategoryDesc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCategory(desc) .orderByCategory(desc)
@ -499,7 +499,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByDomainAsc() { void testQueryForOrderByDomainAsc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByDomain(asc) .orderByDomain(asc)
@ -508,7 +508,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByPriorityDesc() { void testQueryForOrderByPriorityDesc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByPriority(desc) .orderByPriority(desc)
@ -517,7 +517,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByNameAsc() { void testQueryForOrderByNameAsc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByName(asc) .orderByName(asc)
@ -526,7 +526,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByServiceLevelDesc() { void testQueryForOrderByServiceLevelDesc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByServiceLevel(desc) .orderByServiceLevel(desc)
@ -535,7 +535,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByApplicationEntryPointAsc() { void testQueryForOrderByApplicationEntryPointAsc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByApplicationEntryPoint(asc) .orderByApplicationEntryPoint(asc)
@ -545,7 +545,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByParentKeyAsc() { void testQueryForOrderByParentKeyAsc() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByParentKey(asc) .orderByParentKey(asc)
@ -555,7 +555,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByCustom1Desc() throws InvalidArgumentException { void testQueryForOrderByCustom1Desc() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCustomAttribute("1", desc) .orderByCustomAttribute("1", desc)
@ -566,7 +566,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByCustom2Asc() throws InvalidArgumentException { void testQueryForOrderByCustom2Asc() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCustomAttribute("2", asc) .orderByCustomAttribute("2", asc)
@ -578,7 +578,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByCustom3Desc() throws InvalidArgumentException { void testQueryForOrderByCustom3Desc() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCustomAttribute("3", desc) .orderByCustomAttribute("3", desc)
@ -588,7 +588,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByCustom4Asc() throws InvalidArgumentException { void testQueryForOrderByCustom4Asc() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCustomAttribute("4", asc) .orderByCustomAttribute("4", asc)
@ -598,7 +598,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByCustom5Desc() throws InvalidArgumentException { void testQueryForOrderByCustom5Desc() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCustomAttribute("5", desc) .orderByCustomAttribute("5", desc)
@ -608,7 +608,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByCustom6Asc() throws InvalidArgumentException { void testQueryForOrderByCustom6Asc() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCustomAttribute("6", asc) .orderByCustomAttribute("6", asc)
@ -618,7 +618,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByCustom7Desc() throws InvalidArgumentException { void testQueryForOrderByCustom7Desc() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCustomAttribute("7", desc) .orderByCustomAttribute("7", desc)
@ -628,7 +628,7 @@ public class QueryClassificationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testQueryForOrderByCustom8Asc() throws InvalidArgumentException { void testQueryForOrderByCustom8Asc() throws InvalidArgumentException {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.orderByCustomAttribute("8", asc) .orderByCustomAttribute("8", asc)

View File

@ -1,7 +1,7 @@
package acceptance.classification; package acceptance.classification;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import java.util.List; import java.util.List;
@ -20,14 +20,14 @@ import pro.taskana.security.JAASExtension;
* Acceptance test for all "query classifications with pagination" scenarios. * Acceptance test for all "query classifications with pagination" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryClassificationWithPaginationAccTest extends AbstractAccTest { class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
public QueryClassificationWithPaginationAccTest() { QueryClassificationWithPaginationAccTest() {
super(); super();
} }
@Test @Test
public void testGetFirstPageOfClassificationQueryWithOffset() { void testGetFirstPageOfClassificationQueryWithOffset() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -36,7 +36,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetSecondPageOfClassificationQueryWithOffset() { void testGetSecondPageOfClassificationQueryWithOffset() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> results = classificationService.createClassificationQuery() List<ClassificationSummary> results = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -45,7 +45,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testListOffsetAndLimitOutOfBounds() { void testListOffsetAndLimitOutOfBounds() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
// both will be 0, working // both will be 0, working
@ -68,7 +68,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testPaginationWithPages() { void testPaginationWithPages() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
// Getting full page // Getting full page
@ -105,7 +105,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testPaginationNullAndNegativeLimitsIgnoring() { void testPaginationNullAndNegativeLimitsIgnoring() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
// 0 limit/size = 0 results // 0 limit/size = 0 results
@ -139,7 +139,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
*/ */
@Disabled @Disabled
@Test @Test
public void testPaginationThrowingExceptionWhenPageOutOfBounds() { void testPaginationThrowingExceptionWhenPageOutOfBounds() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
// entrypoint set outside result amount // entrypoint set outside result amount
@ -153,7 +153,7 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
} }
@Test @Test
public void testCountOfClassificationsQuery() { void testCountOfClassificationsQuery() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
long count = classificationService.createClassificationQuery() long count = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")

View File

@ -1,10 +1,11 @@
package acceptance.classification; package acceptance.classification;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertNotNull; import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
@ -314,14 +315,14 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
DaysToWorkingDaysConverter converter, int serviceLevel) throws TaskNotFoundException, NotAuthorizedException { DaysToWorkingDaysConverter converter, int serviceLevel) throws TaskNotFoundException, NotAuthorizedException {
for (String taskId : tasksWithP15D) { for (String taskId : tasksWithP15D) {
Task task = taskService.getTask(taskId); Task task = taskService.getTask(taskId);
assertTrue("Task " + task.getId() + " has not been refreshed.", task.getModified().isAfter(before)); assertTrue(task.getModified().isAfter(before), "Task " + task.getId() + " has not been refreshed.");
assertTrue(task.getPriority() == 1000); assertEquals(1000, task.getPriority());
long calendarDays = converter.convertWorkingDaysToDays(task.getPlanned(), serviceLevel); long calendarDays = converter.convertWorkingDaysToDays(task.getPlanned(), serviceLevel);
assertTrue( String msg =
"Task: " + taskId + ": Due Date " + task.getDue() + " does not match planned " + task.getPlanned() "Task: " + taskId + ": Due Date " + task.getDue() + " does not match planned " + task.getPlanned()
+ " + calendar days " + calendarDays, + " + calendar days " + calendarDays;
task.getDue().equals(task.getPlanned().plus(Duration.ofDays(calendarDays)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(calendarDays)), msg);
} }
} }

View File

@ -1,9 +1,9 @@
package acceptance.config; package acceptance.config;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -11,29 +11,28 @@ import java.io.PrintWriter;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import org.h2.store.fs.FileUtils; import org.h2.store.fs.FileUtils;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
/** /**
* Test taskana configuration without roles. * Test taskana configuration without roles.
* *
* @author bbr * @author bbr
*/ */
public class TaskanaConfigAccTest extends TaskanaEngineImpl { class TaskanaConfigAccTest extends TaskanaEngineImpl {
public TaskanaConfigAccTest() throws SQLException { TaskanaConfigAccTest() throws SQLException {
super(new TaskanaEngineConfiguration(TaskanaEngineConfigurationTest.getDataSource(), true, super(new pro.taskana.configuration.TaskanaEngineConfiguration(TaskanaEngineTestConfiguration.getDataSource(),
TaskanaEngineConfigurationTest.getSchemaName())); true,
TaskanaEngineTestConfiguration.getSchemaName()));
} }
@Test @Test
public void testDomains() { void testDomains() {
assertEquals(2, getConfiguration().getDomains().size()); assertEquals(2, getConfiguration().getDomains().size());
assertTrue(getConfiguration().getDomains().contains("DOMAIN_A")); assertTrue(getConfiguration().getDomains().contains("DOMAIN_A"));
assertTrue(getConfiguration().getDomains().contains("DOMAIN_B")); assertTrue(getConfiguration().getDomains().contains("DOMAIN_B"));
@ -41,7 +40,7 @@ public class TaskanaConfigAccTest extends TaskanaEngineImpl {
} }
@Test @Test
public void testClassificationTypes() { void testClassificationTypes() {
assertEquals(2, getConfiguration().getClassificationTypes().size()); assertEquals(2, getConfiguration().getClassificationTypes().size());
assertTrue(getConfiguration().getClassificationTypes().contains("TASK")); assertTrue(getConfiguration().getClassificationTypes().contains("TASK"));
assertTrue(getConfiguration().getClassificationTypes().contains("DOCUMENT")); assertTrue(getConfiguration().getClassificationTypes().contains("DOCUMENT"));
@ -49,7 +48,7 @@ public class TaskanaConfigAccTest extends TaskanaEngineImpl {
} }
@Test @Test
public void testClassificationCategories() { void testClassificationCategories() {
assertEquals(4, getConfiguration().getClassificationCategoriesByType("TASK").size()); assertEquals(4, getConfiguration().getClassificationCategoriesByType("TASK").size());
assertTrue(getConfiguration().getClassificationCategoriesByType("TASK").contains("EXTERNAL")); assertTrue(getConfiguration().getClassificationCategoriesByType("TASK").contains("EXTERNAL"));
assertTrue(getConfiguration().getClassificationCategoriesByType("TASK").contains("MANUAL")); assertTrue(getConfiguration().getClassificationCategoriesByType("TASK").contains("MANUAL"));
@ -59,7 +58,7 @@ public class TaskanaConfigAccTest extends TaskanaEngineImpl {
} }
@Test @Test
public void testDoesNotExistPropertyClassificationTypeOrItIsEmpty() throws IOException { void testDoesNotExistPropertyClassificationTypeOrItIsEmpty() throws IOException {
taskanaEngineConfiguration.setClassificationTypes(new ArrayList<>()); taskanaEngineConfiguration.setClassificationTypes(new ArrayList<>());
String propertiesFileName = createNewConfigFile("/dummyTestConfig.properties", false, true); String propertiesFileName = createNewConfigFile("/dummyTestConfig.properties", false, true);
String delimiter = ";"; String delimiter = ";";
@ -72,7 +71,7 @@ public class TaskanaConfigAccTest extends TaskanaEngineImpl {
} }
@Test @Test
public void testDoesNotExistPropertyClassificatioCategoryOrItIsEmpty() throws IOException { void testDoesNotExistPropertyClassificatioCategoryOrItIsEmpty() throws IOException {
taskanaEngineConfiguration.setClassificationTypes(new ArrayList<>()); taskanaEngineConfiguration.setClassificationTypes(new ArrayList<>());
taskanaEngineConfiguration.setClassificationCategoriesByType(new HashMap<>()); taskanaEngineConfiguration.setClassificationCategoriesByType(new HashMap<>());
String propertiesFileName = createNewConfigFile("/dummyTestConfig.properties", true, false); String propertiesFileName = createNewConfigFile("/dummyTestConfig.properties", true, false);
@ -87,9 +86,9 @@ public class TaskanaConfigAccTest extends TaskanaEngineImpl {
} }
@Test @Test
public void testWithCategoriesAndClassificationFilled() throws IOException { void testWithCategoriesAndClassificationFilled() throws IOException {
taskanaEngineConfiguration.setClassificationTypes(new ArrayList<String>()); taskanaEngineConfiguration.setClassificationTypes(new ArrayList<>());
taskanaEngineConfiguration.setClassificationCategoriesByType(new HashMap<String, List<String>>()); taskanaEngineConfiguration.setClassificationCategoriesByType(new HashMap<>());
String propertiesFileName = createNewConfigFile("/dummyTestConfig.properties", true, true); String propertiesFileName = createNewConfigFile("/dummyTestConfig.properties", true, true);
String delimiter = ";"; String delimiter = ";";
try { try {

View File

@ -1,6 +1,6 @@
package acceptance.config; package acceptance.config;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -12,24 +12,24 @@ import org.h2.store.fs.FileUtils;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import pro.taskana.TaskanaRole; import pro.taskana.TaskanaRole;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
/** /**
* Test taskana's role configuration. * Test taskana's role configuration.
* *
* @author bbr * @author bbr
*/ */
public class TaskanaRoleConfigAccTest extends TaskanaEngineImpl { class TaskanaRoleConfigAccTest extends TaskanaEngineImpl {
public TaskanaRoleConfigAccTest() throws SQLException { TaskanaRoleConfigAccTest() throws SQLException {
super(new TaskanaEngineConfiguration(TaskanaEngineConfigurationTest.getDataSource(), true, super(new pro.taskana.configuration.TaskanaEngineConfiguration(TaskanaEngineTestConfiguration.getDataSource(),
TaskanaEngineConfigurationTest.getSchemaName())); true,
TaskanaEngineTestConfiguration.getSchemaName()));
} }
@Test @Test
public void testStandardConfig() { void testStandardConfig() {
Set<TaskanaRole> rolesConfigured = getConfiguration().getRoleMap().keySet(); Set<TaskanaRole> rolesConfigured = getConfiguration().getRoleMap().keySet();
assertTrue(rolesConfigured.contains(TaskanaRole.ADMIN)); assertTrue(rolesConfigured.contains(TaskanaRole.ADMIN));
assertTrue(rolesConfigured.contains(TaskanaRole.BUSINESS_ADMIN)); assertTrue(rolesConfigured.contains(TaskanaRole.BUSINESS_ADMIN));
@ -55,7 +55,7 @@ public class TaskanaRoleConfigAccTest extends TaskanaEngineImpl {
} }
@Test @Test
public void testOtherConfigFileSameDelimiter() throws IOException { void testOtherConfigFileSameDelimiter() throws IOException {
String propertiesFileName = createNewConfigFileWithSameDelimiter("/dummyTestConfig.properties"); String propertiesFileName = createNewConfigFileWithSameDelimiter("/dummyTestConfig.properties");
try { try {
getConfiguration().initTaskanaProperties(propertiesFileName, "|"); getConfiguration().initTaskanaProperties(propertiesFileName, "|");
@ -82,7 +82,7 @@ public class TaskanaRoleConfigAccTest extends TaskanaEngineImpl {
} }
@Test @Test
public void testOtherConfigFileDifferentDelimiter() throws IOException { void testOtherConfigFileDifferentDelimiter() throws IOException {
String delimiter = ";"; String delimiter = ";";
String propertiesFileName = createNewConfigFileWithDifferentDelimiter("/dummyTestConfig.properties", delimiter); String propertiesFileName = createNewConfigFileWithDifferentDelimiter("/dummyTestConfig.properties", delimiter);
try { try {

View File

@ -1,6 +1,6 @@
package acceptance.history; package acceptance.history;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -1,7 +1,7 @@
package acceptance.jobs; package acceptance.jobs;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -30,18 +30,18 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "jobs tasks runner" scenarios. * Acceptance test for all "jobs tasks runner" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class TaskCleanupJobAccTest extends AbstractAccTest { class TaskCleanupJobAccTest extends AbstractAccTest {
TaskService taskService; TaskService taskService;
@BeforeEach @BeforeEach
public void before() { void before() {
taskService = taskanaEngine.getTaskService(); taskService = taskanaEngine.getTaskService();
} }
@WithAccessId(userName = "admin") @WithAccessId(userName = "admin")
@Test @Test
public void shouldCleanCompletedTasksUntilDate() throws Exception { void shouldCleanCompletedTasksUntilDate() throws Exception {
long totalTasksCount = taskService.createTaskQuery().count(); long totalTasksCount = taskService.createTaskQuery().count();
assertEquals(73, totalTasksCount); assertEquals(73, totalTasksCount);
@ -56,7 +56,7 @@ public class TaskCleanupJobAccTest extends AbstractAccTest {
@WithAccessId(userName = "admin") @WithAccessId(userName = "admin")
@Test @Test
public void shouldCleanCompletedTasksUntilDateWithSameParentBussiness() throws Exception { void shouldCleanCompletedTasksUntilDateWithSameParentBussiness() throws Exception {
long totalTasksCount = taskService.createTaskQuery().count(); long totalTasksCount = taskService.createTaskQuery().count();
assertEquals(68, totalTasksCount); assertEquals(68, totalTasksCount);
@ -82,7 +82,7 @@ public class TaskCleanupJobAccTest extends AbstractAccTest {
@WithAccessId(userName = "admin") @WithAccessId(userName = "admin")
@Test @Test
public void shouldNotCleanCompleteTasksAfterDefinedDay() throws Exception { void shouldNotCleanCompleteTasksAfterDefinedDay() throws Exception {
Task createdTask = createAndCompleteTask(); Task createdTask = createAndCompleteTask();
TaskCleanupJob job = new TaskCleanupJob(taskanaEngine, null, null); TaskCleanupJob job = new TaskCleanupJob(taskanaEngine, null, null);

View File

@ -1,7 +1,7 @@
package acceptance.jobs; package acceptance.jobs;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.util.List; import java.util.List;
@ -26,25 +26,25 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "jobs workbasket runner" scenarios. * Acceptance test for all "jobs workbasket runner" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class WorkbasketCleanupJobAccTest extends AbstractAccTest { class WorkbasketCleanupJobAccTest extends AbstractAccTest {
WorkbasketService workbasketService; WorkbasketService workbasketService;
TaskService taskService; TaskService taskService;
@BeforeEach @BeforeEach
public void before() { void before() {
workbasketService = taskanaEngine.getWorkbasketService(); workbasketService = taskanaEngine.getWorkbasketService();
taskService = taskanaEngine.getTaskService(); taskService = taskanaEngine.getTaskService();
} }
@AfterEach @AfterEach
public void after() throws Exception { void after() throws Exception {
resetDb(true); resetDb(true);
} }
@WithAccessId(userName = "admin") @WithAccessId(userName = "admin")
@Test @Test
public void shouldCleanWorkbasketMarkedForDeletionWithoutTasks() throws TaskanaException { void shouldCleanWorkbasketMarkedForDeletionWithoutTasks() throws TaskanaException {
long totalWorkbasketCount = workbasketService.createWorkbasketQuery().count(); long totalWorkbasketCount = workbasketService.createWorkbasketQuery().count();
assertEquals(25, totalWorkbasketCount); assertEquals(25, totalWorkbasketCount);
List<WorkbasketSummary> workbaskets = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> workbaskets = workbasketService.createWorkbasketQuery()
@ -74,7 +74,7 @@ public class WorkbasketCleanupJobAccTest extends AbstractAccTest {
@WithAccessId(userName = "admin") @WithAccessId(userName = "admin")
@Test @Test
public void shouldNotCleanWorkbasketMarkedForDeletionIfWorkbasketHasTasks() throws Exception { void shouldNotCleanWorkbasketMarkedForDeletionIfWorkbasketHasTasks() throws Exception {
long totalWorkbasketCount = workbasketService.createWorkbasketQuery().count(); long totalWorkbasketCount = workbasketService.createWorkbasketQuery().count();
assertEquals(25, totalWorkbasketCount); assertEquals(25, totalWorkbasketCount);
List<WorkbasketSummary> workbaskets = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> workbaskets = workbasketService.createWorkbasketQuery()

View File

@ -1,7 +1,7 @@
package acceptance.objectreference; package acceptance.objectreference;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static pro.taskana.ObjectReferenceQueryColumnName.COMPANY; import static pro.taskana.ObjectReferenceQueryColumnName.COMPANY;
import static pro.taskana.ObjectReferenceQueryColumnName.SYSTEM; import static pro.taskana.ObjectReferenceQueryColumnName.SYSTEM;
@ -16,14 +16,14 @@ import pro.taskana.TaskQuery;
/** /**
* Acceptance test for all "get classification" scenarios. * Acceptance test for all "get classification" scenarios.
*/ */
public class QueryObjectReferenceAccTest extends AbstractAccTest { class QueryObjectReferenceAccTest extends AbstractAccTest {
public QueryObjectReferenceAccTest() { QueryObjectReferenceAccTest() {
super(); super();
} }
@Test @Test
public void testQueryObjectReferenceValuesForColumnName() { void testQueryObjectReferenceValuesForColumnName() {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<String> columnValues = taskQuery.createObjectReferenceQuery() List<String> columnValues = taskQuery.createObjectReferenceQuery()
.listValues(COMPANY, null); .listValues(COMPANY, null);
@ -40,7 +40,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceByCompany() { void testFindObjectReferenceByCompany() {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()
@ -52,7 +52,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceBySystem() { void testFindObjectReferenceBySystem() {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()
@ -65,7 +65,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceBySystemInstance() { void testFindObjectReferenceBySystemInstance() {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()
@ -78,7 +78,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceByType() { void testFindObjectReferenceByType() {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()
@ -90,7 +90,7 @@ public class QueryObjectReferenceAccTest extends AbstractAccTest {
} }
@Test @Test
public void testFindObjectReferenceByValue() { void testFindObjectReferenceByValue() {
TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery(); TaskQuery taskQuery = taskanaEngine.getTaskService().createTaskQuery();
List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery() List<ObjectReference> objectReferenceList = taskQuery.createObjectReferenceQuery()

View File

@ -1,7 +1,7 @@
package acceptance.objectreference; package acceptance.objectreference;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import java.util.List; import java.util.List;
@ -23,38 +23,38 @@ import pro.taskana.security.JAASExtension;
* Acceptance test for all "query classifications with pagination" scenarios. * Acceptance test for all "query classifications with pagination" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest { class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest {
private TaskService taskService; private TaskService taskService;
private TaskQuery taskQuery; private TaskQuery taskQuery;
private ObjectReferenceQuery objRefQuery; private ObjectReferenceQuery objRefQuery;
public QueryObjectreferencesWithPaginationAccTest() { QueryObjectreferencesWithPaginationAccTest() {
super(); super();
} }
@BeforeEach @BeforeEach
public void before() { void before() {
taskService = taskanaEngine.getTaskService(); taskService = taskanaEngine.getTaskService();
taskQuery = taskService.createTaskQuery(); taskQuery = taskService.createTaskQuery();
objRefQuery = taskQuery.createObjectReferenceQuery(); objRefQuery = taskQuery.createObjectReferenceQuery();
} }
@Test @Test
public void testGetFirstPageOfObjectRefQueryWithOffset() { void testGetFirstPageOfObjectRefQueryWithOffset() {
List<ObjectReference> results = objRefQuery.list(0, 5); List<ObjectReference> results = objRefQuery.list(0, 5);
assertThat(results.size(), equalTo(3)); assertThat(results.size(), equalTo(3));
} }
@Test @Test
public void testGetSecondPageOfObjectRefQueryWithOffset() { void testGetSecondPageOfObjectRefQueryWithOffset() {
List<ObjectReference> results = objRefQuery.list(2, 5); List<ObjectReference> results = objRefQuery.list(2, 5);
assertThat(results.size(), equalTo(1)); assertThat(results.size(), equalTo(1));
} }
@Test @Test
public void testListOffsetAndLimitOutOfBounds() { void testListOffsetAndLimitOutOfBounds() {
// both will be 0, working // both will be 0, working
List<ObjectReference> results = objRefQuery.list(-1, -3); List<ObjectReference> results = objRefQuery.list(-1, -3);
assertThat(results.size(), equalTo(0)); assertThat(results.size(), equalTo(0));
@ -69,7 +69,7 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
} }
@Test @Test
public void testPaginationWithPages() { void testPaginationWithPages() {
// Getting full page // Getting full page
int pageNumber = 1; int pageNumber = 1;
int pageSize = 10; int pageSize = 10;
@ -96,7 +96,7 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
} }
@Test @Test
public void testPaginationNullAndNegativeLimitsIgnoring() { void testPaginationNullAndNegativeLimitsIgnoring() {
// 0 limit/size = 0 results // 0 limit/size = 0 results
int pageNumber = 2; int pageNumber = 2;
int pageSize = 0; int pageSize = 0;
@ -122,7 +122,7 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
*/ */
@Disabled @Disabled
@Test @Test
public void testPaginationThrowingExceptionWhenPageOutOfBounds() { void testPaginationThrowingExceptionWhenPageOutOfBounds() {
// entrypoint set outside result amount // entrypoint set outside result amount
int pageNumber = 6; int pageNumber = 6;
int pageSize = 10; int pageSize = 10;
@ -131,7 +131,7 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
} }
@Test @Test
public void testCountOfClassificationsQuery() { void testCountOfClassificationsQuery() {
long count = objRefQuery.count(); long count = objRefQuery.count();
assertThat(count, equalTo(3L)); assertThat(count, equalTo(3L));
} }

View File

@ -5,12 +5,10 @@ import java.sql.SQLException;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.BeforeClass;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest;
import pro.taskana.sampledata.SampleDataGenerator; import pro.taskana.sampledata.SampleDataGenerator;
/** /**
@ -18,24 +16,23 @@ import pro.taskana.sampledata.SampleDataGenerator;
*/ */
public class AbstractReportAccTest { public class AbstractReportAccTest {
protected static TaskanaEngineConfiguration taskanaEngineConfiguration; protected static pro.taskana.configuration.TaskanaEngineConfiguration taskanaEngineConfiguration;
protected static TaskanaEngine taskanaEngine; protected static TaskanaEngine taskanaEngine;
// checkstyle needs this constructor, since this is only a "utility" class // checkstyle needs this constructor, since this is only a "utility" class
protected AbstractReportAccTest() { protected AbstractReportAccTest() {
} }
@BeforeClass
@BeforeAll @BeforeAll
public static void setupTest() throws Exception { public static void setupTest() throws Exception {
resetDb(); resetDb();
} }
private static void resetDb() throws SQLException, IOException { private static void resetDb() throws SQLException, IOException {
DataSource dataSource = TaskanaEngineConfigurationTest.getDataSource(); DataSource dataSource = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource, schemaName); SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource, schemaName);
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(dataSource, false,
schemaName); schemaName);
taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false); taskanaEngineConfiguration.setGermanPublicHolidaysEnabled(false);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();

View File

@ -1,8 +1,8 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -24,10 +24,10 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "classification report" scenarios. * Acceptance test for all "classification report" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest { class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest {
@Test @Test
public void testRoleCheck() { void testRoleCheck() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -39,7 +39,7 @@ public class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccT
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetCustomAttributeValuesForOneWorkbasket() throws NotAuthorizedException { void testGetCustomAttributeValuesForOneWorkbasket() throws NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> values = taskMonitorService.createWorkbasketReportBuilder() List<String> values = taskMonitorService.createWorkbasketReportBuilder()
@ -55,7 +55,7 @@ public class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccT
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetCustomAttributeValuesForOneDomain() throws NotAuthorizedException { void testGetCustomAttributeValuesForOneDomain() throws NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> values = taskMonitorService.createWorkbasketReportBuilder() List<String> values = taskMonitorService.createWorkbasketReportBuilder()
@ -68,7 +68,7 @@ public class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccT
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetCustomAttributeValuesForCustomAttribute() void testGetCustomAttributeValuesForCustomAttribute()
throws NotAuthorizedException { throws NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -87,7 +87,7 @@ public class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccT
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetCustomAttributeValuesForExcludedClassifications() void testGetCustomAttributeValuesForExcludedClassifications()
throws NotAuthorizedException { throws NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();

View File

@ -1,7 +1,7 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -45,7 +45,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTaskIdsOfCategoryReport() throws InvalidArgumentException, NotAuthorizedException { void testGetTaskIdsOfCategoryReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
@ -92,7 +92,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTaskIdsOfCategoryReportWithWorkbasketFilter() void testGetTaskIdsOfCategoryReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -135,7 +135,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTaskIdsOfCategoryReportWithStateFilter() void testGetTaskIdsOfCategoryReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -185,7 +185,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTaskIdsOfCategoryReportWithCategoryFilter() void testGetTaskIdsOfCategoryReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -221,7 +221,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTaskIdsOfCategoryReportWithDomainFilter() void testGetTaskIdsOfCategoryReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -264,7 +264,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTaskIdsOfCategoryReportWithCustomFieldValueFilter() void testGetTaskIdsOfCategoryReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -309,7 +309,7 @@ class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testThrowsExceptionIfSubKeysAreUsed() { void testThrowsExceptionIfSubKeysAreUsed() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();

View File

@ -1,7 +1,7 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,7 +1,7 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -1,7 +1,7 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -23,10 +23,10 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "get task ids of workbasket report" scenarios. * Acceptance test for all "get task ids of workbasket report" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest { class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
@Test @Test
public void testRoleCheck() throws InvalidArgumentException, NotAuthorizedException { void testRoleCheck() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
@ -40,7 +40,7 @@ public class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTaskIdsOfWorkbasketReport() throws InvalidArgumentException, NotAuthorizedException { void testGetTaskIdsOfWorkbasketReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
@ -83,7 +83,7 @@ public class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTaskIdsOfWorkbasketReportWithExcludedClassifications() void testGetTaskIdsOfWorkbasketReportWithExcludedClassifications()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();

View File

@ -1,8 +1,8 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -32,12 +32,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "category report" scenarios. * Acceptance test for all "category report" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class ProvideCategoryReportAccTest extends AbstractReportAccTest { class ProvideCategoryReportAccTest extends AbstractReportAccTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCategoryReportAccTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCategoryReportAccTest.class);
@Test @Test
public void testRoleCheck() { void testRoleCheck() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -47,7 +47,7 @@ public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTotalNumbersOfTasksOfCategoryReport() throws InvalidArgumentException, NotAuthorizedException { void testGetTotalNumbersOfTasksOfCategoryReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
CategoryReport report = taskMonitorService.createCategoryReportBuilder().buildReport(); CategoryReport report = taskMonitorService.createCategoryReportBuilder().buildReport();
@ -71,7 +71,7 @@ public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetCategoryReportWithReportLineItemDefinitions() void testGetCategoryReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -101,10 +101,9 @@ public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
assertEquals(50, sumLineCount); assertEquals(50, sumLineCount);
} }
@WithAccessId( @WithAccessId(userName = "monitor")
userName = "monitor")
@Test @Test
public void testEachItemOfCategoryReport() throws InvalidArgumentException, NotAuthorizedException { void testEachItemOfCategoryReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
@ -134,7 +133,7 @@ public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCategoryReportNotInWorkingDays() throws InvalidArgumentException, NotAuthorizedException { void testEachItemOfCategoryReportNotInWorkingDays() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
@ -163,7 +162,7 @@ public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCategoryReportWithWorkbasketFilter() void testEachItemOfCategoryReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -196,7 +195,7 @@ public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCategoryReportWithStateFilter() throws InvalidArgumentException, NotAuthorizedException { void testEachItemOfCategoryReportWithStateFilter() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TaskState> states = Collections.singletonList(TaskState.READY); List<TaskState> states = Collections.singletonList(TaskState.READY);
@ -228,7 +227,7 @@ public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCategoryReportWithCategoryFilter() void testEachItemOfCategoryReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -259,7 +258,7 @@ public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCategoryReportWithDomainFilter() throws InvalidArgumentException, NotAuthorizedException { void testEachItemOfCategoryReportWithDomainFilter() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<String> domains = Collections.singletonList("DOMAIN_A"); List<String> domains = Collections.singletonList("DOMAIN_A");
@ -291,7 +290,7 @@ public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCategoryReportWithCustomFieldValueFilter() void testEachItemOfCategoryReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();

View File

@ -1,8 +1,8 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -32,12 +32,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "classification report" scenarios. * Acceptance test for all "classification report" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class ProvideClassificationReportAccTest extends AbstractReportAccTest { class ProvideClassificationReportAccTest extends AbstractReportAccTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideClassificationReportAccTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(ProvideClassificationReportAccTest.class);
@Test @Test
public void testRoleCheck() void testRoleCheck()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -48,7 +48,7 @@ public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTotalNumbersOfTasksOfClassificationReport() void testGetTotalNumbersOfTasksOfClassificationReport()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -77,7 +77,7 @@ public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetClassificationReportWithReportLineItemDefinitions() void testGetClassificationReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -119,7 +119,7 @@ public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfClassificationReport() throws InvalidArgumentException, NotAuthorizedException { void testEachItemOfClassificationReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
@ -155,7 +155,7 @@ public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfClassificationReportNotInWorkingDays() void testEachItemOfClassificationReportNotInWorkingDays()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -191,7 +191,7 @@ public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfClassificationReportWithWorkbasketFilter() void testEachItemOfClassificationReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -230,7 +230,7 @@ public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfClassificationReportWithStateFilter() void testEachItemOfClassificationReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -269,7 +269,7 @@ public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfClassificationReportWithCategoryFilter() void testEachItemOfClassificationReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -300,7 +300,7 @@ public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfClassificationReportWithDomainFilter() void testEachItemOfClassificationReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -339,7 +339,7 @@ public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfClassificationReportWithCustomFieldValueFilter() void testEachItemOfClassificationReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();

View File

@ -1,8 +1,8 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -31,12 +31,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "classification report" scenarios. * Acceptance test for all "classification report" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest { class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCustomFieldValueReportAccTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCustomFieldValueReportAccTest.class);
@Test @Test
public void testRoleCheck() { void testRoleCheck() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -46,7 +46,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom1() void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom1()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -73,7 +73,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom2() void testGetTotalNumbersOfTasksOfCustomFieldValueReportForCustom2()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -99,7 +99,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetCustomFieldValueReportWithReportLineItemDefinitions() void testGetCustomFieldValueReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -130,7 +130,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCustomFieldValueReport() throws InvalidArgumentException, NotAuthorizedException { void testEachItemOfCustomFieldValueReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
@ -160,7 +160,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCustomFieldValueReportNotInWorkingDays() void testEachItemOfCustomFieldValueReportNotInWorkingDays()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -190,7 +190,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCustomFieldValueReportWithWorkbasketFilter() void testEachItemOfCustomFieldValueReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -223,7 +223,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCustomFieldValueReportWithStateFilter() void testEachItemOfCustomFieldValueReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -256,7 +256,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCustomFieldValueReportWithCategoryFilter() void testEachItemOfCustomFieldValueReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -289,7 +289,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCustomFieldValueReportWithDomainFilter() void testEachItemOfCustomFieldValueReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -322,7 +322,7 @@ public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfCustomFieldValueReportWithCustomFieldValueFilter() void testEachItemOfCustomFieldValueReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();

View File

@ -1,8 +1,8 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -34,12 +34,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "detailed classification report" scenarios. * Acceptance test for all "detailed classification report" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest { class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideDetailedClassificationReportAccTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(ProvideDetailedClassificationReportAccTest.class);
@Test @Test
public void testRoleCheck() { void testRoleCheck() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -49,7 +49,7 @@ public class ProvideDetailedClassificationReportAccTest extends AbstractReportAc
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTotalNumbersOfTasksOfDetailedClassificationReport() void testGetTotalNumbersOfTasksOfDetailedClassificationReport()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -103,7 +103,7 @@ public class ProvideDetailedClassificationReportAccTest extends AbstractReportAc
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetDetailedClassificationReportWithReportLineItemDefinitions() void testGetDetailedClassificationReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -135,7 +135,7 @@ public class ProvideDetailedClassificationReportAccTest extends AbstractReportAc
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfDetailedClassificationReport() throws InvalidArgumentException, NotAuthorizedException { void testEachItemOfDetailedClassificationReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
@ -198,7 +198,7 @@ public class ProvideDetailedClassificationReportAccTest extends AbstractReportAc
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfDetailedClassificationReportWithWorkbasketFilter() void testEachItemOfDetailedClassificationReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -261,7 +261,7 @@ public class ProvideDetailedClassificationReportAccTest extends AbstractReportAc
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfDetailedClassificationReportWithStateFilter() void testEachItemOfDetailedClassificationReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -324,7 +324,7 @@ public class ProvideDetailedClassificationReportAccTest extends AbstractReportAc
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfDetailedClassificationReportNotInWorkingDays() void testEachItemOfDetailedClassificationReportNotInWorkingDays()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -387,7 +387,7 @@ public class ProvideDetailedClassificationReportAccTest extends AbstractReportAc
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfDetailedClassificationReportWithCategoryFilter() void testEachItemOfDetailedClassificationReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -430,7 +430,7 @@ public class ProvideDetailedClassificationReportAccTest extends AbstractReportAc
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfDetailedClassificationReportWithDomainFilter() void testEachItemOfDetailedClassificationReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -493,7 +493,7 @@ public class ProvideDetailedClassificationReportAccTest extends AbstractReportAc
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfDetailedClassificationReportWithCustomFieldValueFilter() void testEachItemOfDetailedClassificationReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();

View File

@ -1,9 +1,9 @@
package acceptance.report; package acceptance.report;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -29,12 +29,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "task status report" scenarios. * Acceptance test for all "task status report" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class ProvideTaskStatusReportAccTest extends AbstractReportAccTest { class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketReportAccTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketReportAccTest.class);
@Test @Test
public void testRoleCheck() { void testRoleCheck() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
taskMonitorService.createTaskStatusReportBuilder().buildReport()); taskMonitorService.createTaskStatusReportBuilder().buildReport());
@ -43,7 +43,7 @@ public class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testCompleteTaskStatusReport() throws NotAuthorizedException, InvalidArgumentException { void testCompleteTaskStatusReport() throws NotAuthorizedException, InvalidArgumentException {
// given // given
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
// when // when
@ -75,7 +75,7 @@ public class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testCompleteTaskStatusReportAsAdmin() throws NotAuthorizedException, InvalidArgumentException { void testCompleteTaskStatusReportAsAdmin() throws NotAuthorizedException, InvalidArgumentException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
taskMonitorService.createTaskStatusReportBuilder().buildReport(); taskMonitorService.createTaskStatusReportBuilder().buildReport();
} }
@ -83,7 +83,7 @@ public class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testCompleteTaskStatusReportWithDomainFilter() throws NotAuthorizedException, InvalidArgumentException { void testCompleteTaskStatusReportWithDomainFilter() throws NotAuthorizedException, InvalidArgumentException {
// given // given
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
// when // when
@ -114,7 +114,7 @@ public class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testCompleteTaskStatusReportWithStateFilter() throws NotAuthorizedException, InvalidArgumentException { void testCompleteTaskStatusReportWithStateFilter() throws NotAuthorizedException, InvalidArgumentException {
// given // given
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
// when // when

View File

@ -1,7 +1,7 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -26,7 +26,7 @@ import pro.taskana.security.WithAccessId;
* Test class for {@link TimestampReport}. * Test class for {@link TimestampReport}.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class ProvideTimestampReportAccTest extends AbstractReportAccTest { class ProvideTimestampReportAccTest extends AbstractReportAccTest {
/** /**
* This test covers every insert operation of the TimestampReport. * This test covers every insert operation of the TimestampReport.
@ -39,7 +39,7 @@ public class ProvideTimestampReportAccTest extends AbstractReportAccTest {
*/ */
@WithAccessId(userName = "monitor") @WithAccessId(userName = "monitor")
@Test @Test
public void testProperInsertionOfQueryItems() throws Exception { void testProperInsertionOfQueryItems() throws Exception {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
//last 14 days. Today excluded. //last 14 days. Today excluded.

View File

@ -1,8 +1,8 @@
package acceptance.report; package acceptance.report;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -33,12 +33,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "workbasket level report" scenarios. * Acceptance test for all "workbasket level report" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest { class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketReportAccTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketReportAccTest.class);
@Test @Test
public void testRoleCheck() { void testRoleCheck() {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -48,7 +48,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTotalNumbersOfTasksOfWorkbasketReportBasedOnDueDate() void testGetTotalNumbersOfTasksOfWorkbasketReportBasedOnDueDate()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -71,7 +71,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetWorkbasketReportWithReportLineItemDefinitions() void testGetWorkbasketReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -105,7 +105,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfWorkbasketReport() throws InvalidArgumentException, NotAuthorizedException { void testEachItemOfWorkbasketReport() throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getShortListOfColumnHeaders();
@ -135,7 +135,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfWorkbasketReportNotInWorkingDays() void testEachItemOfWorkbasketReportNotInWorkingDays()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -165,7 +165,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfWorkbasketReportWithWorkbasketFilter() void testEachItemOfWorkbasketReportWithWorkbasketFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -193,7 +193,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfWorkbasketReportWithStateFilter() void testEachItemOfWorkbasketReportWithStateFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -226,7 +226,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfWorkbasketReportWithCategoryFilter() void testEachItemOfWorkbasketReportWithCategoryFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -260,7 +260,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfWorkbasketReportWithDomainFilter() void testEachItemOfWorkbasketReportWithDomainFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -293,7 +293,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfWorkbasketReportWithCustomFieldValueFilter() void testEachItemOfWorkbasketReportWithCustomFieldValueFilter()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -327,7 +327,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testEachItemOfWorkbasketReportForSelectedClassifications() void testEachItemOfWorkbasketReportForSelectedClassifications()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
@ -371,7 +371,7 @@ public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
@WithAccessId( @WithAccessId(
userName = "monitor") userName = "monitor")
@Test @Test
public void testGetTotalNumbersOfTasksOfWorkbasketReportBasedOnPlannedDateWithReportLineItemDefinitions() void testGetTotalNumbersOfTasksOfWorkbasketReportBasedOnPlannedDateWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService(); TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders(); List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();

View File

@ -1,7 +1,7 @@
package acceptance.security; package acceptance.security;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.List; import java.util.List;
@ -20,14 +20,14 @@ import pro.taskana.security.WithAccessId;
* @author bbr * @author bbr
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class ClassificationQueryAccTest extends AbstractAccTest { class ClassificationQueryAccTest extends AbstractAccTest {
public ClassificationQueryAccTest() { ClassificationQueryAccTest() {
super(); super();
} }
@Test @Test
public void testFindClassificationsByDomainUnauthenticated() { void testFindClassificationsByDomainUnauthenticated() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -39,7 +39,7 @@ public class ClassificationQueryAccTest extends AbstractAccTest {
@WithAccessId(userName = "businessadmin") @WithAccessId(userName = "businessadmin")
@Test @Test
public void testFindClassificationsByDomainBusinessAdmin() { void testFindClassificationsByDomainBusinessAdmin() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -51,7 +51,7 @@ public class ClassificationQueryAccTest extends AbstractAccTest {
@WithAccessId(userName = "admin") @WithAccessId(userName = "admin")
@Test @Test
public void testFindClassificationsByDomainAdmin() { void testFindClassificationsByDomainAdmin() {
ClassificationService classificationService = taskanaEngine.getClassificationService(); ClassificationService classificationService = taskanaEngine.getClassificationService();
List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery() List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")

View File

@ -1,7 +1,7 @@
package acceptance.security; package acceptance.security;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -17,14 +17,14 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for task queries and authorization. * Acceptance test for task queries and authorization.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class TaskEngineAccTest extends AbstractAccTest { class TaskEngineAccTest extends AbstractAccTest {
public TaskEngineAccTest() { TaskEngineAccTest() {
super(); super();
} }
@Test @Test
public void testUnauthenticated() { void testUnauthenticated() {
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)); assertFalse(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN));
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)); assertFalse(taskanaEngine.isUserInRole(TaskanaRole.ADMIN));
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -34,7 +34,7 @@ public class TaskEngineAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "user_1_1") // , groupNames = {"businessadmin"}) userName = "user_1_1") // , groupNames = {"businessadmin"})
@Test @Test
public void testUser() throws NotAuthorizedException { void testUser() throws NotAuthorizedException {
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)); assertFalse(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN));
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)); assertFalse(taskanaEngine.isUserInRole(TaskanaRole.ADMIN));
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -44,7 +44,7 @@ public class TaskEngineAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "user_1_1", groupNames = {"businessadmin"}) userName = "user_1_1", groupNames = {"businessadmin"})
@Test @Test
public void testBusinessAdmin() throws NotAuthorizedException { void testBusinessAdmin() throws NotAuthorizedException {
assertTrue(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)); assertTrue(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN));
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)); assertFalse(taskanaEngine.isUserInRole(TaskanaRole.ADMIN));
taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN); taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN);
@ -53,7 +53,7 @@ public class TaskEngineAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "user_1_1", groupNames = {"admin"}) userName = "user_1_1", groupNames = {"admin"})
@Test @Test
public void testAdmin() throws NotAuthorizedException { void testAdmin() throws NotAuthorizedException {
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN)); assertFalse(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN));
assertTrue(taskanaEngine.isUserInRole(TaskanaRole.ADMIN)); assertTrue(taskanaEngine.isUserInRole(TaskanaRole.ADMIN));
taskanaEngine.checkRoleMembership(TaskanaRole.ADMIN); taskanaEngine.checkRoleMembership(TaskanaRole.ADMIN);

View File

@ -1,7 +1,7 @@
package acceptance.security; package acceptance.security;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import java.util.List; import java.util.List;
@ -18,13 +18,14 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for task queries and authorization. * Acceptance test for task queries and authorization.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class TaskQueryAccTest extends AbstractAccTest { class TaskQueryAccTest extends AbstractAccTest {
public TaskQueryAccTest() { TaskQueryAccTest() {
super(); super();
} }
public void testTaskQueryUnauthenticated() { @Test
void testTaskQueryUnauthenticated() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -38,7 +39,7 @@ public class TaskQueryAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "user_1_1") // , groupNames = {"businessadmin"}) userName = "user_1_1") // , groupNames = {"businessadmin"})
@Test @Test
public void testTaskQueryUser_1_1() { void testTaskQueryUser_1_1() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -52,7 +53,7 @@ public class TaskQueryAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "user_1_1", groupNames = {"businessadmin"}) userName = "user_1_1", groupNames = {"businessadmin"})
@Test @Test
public void testTaskQueryUser_1_1BusinessAdm() { void testTaskQueryUser_1_1BusinessAdm() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
@ -66,7 +67,7 @@ public class TaskQueryAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "user_1_1", groupNames = {"admin"}) userName = "user_1_1", groupNames = {"admin"})
@Test @Test
public void testTaskQueryUser_1_1Admin() { void testTaskQueryUser_1_1Admin() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()

View File

@ -1,8 +1,9 @@
package acceptance.security; package acceptance.security;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -20,19 +21,19 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for workbasket queries and authorization. * Acceptance test for workbasket queries and authorization.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class WorkbasketQueryAccTest extends AbstractAccTest { class WorkbasketQueryAccTest extends AbstractAccTest {
public WorkbasketQueryAccTest() { WorkbasketQueryAccTest() {
super(); super();
} }
@Test @Test
public void testQueryWorkbasketByUnauthenticated() throws InvalidArgumentException { void testQueryWorkbasketByUnauthenticated() throws InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
.list(); .list();
Assert.assertEquals(0L, results.size()); assertEquals(0L, results.size());
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
workbasketService.createWorkbasketQuery() workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
@ -43,12 +44,12 @@ public class WorkbasketQueryAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "unknown") userName = "unknown")
@Test @Test
public void testQueryWorkbasketByUnknownUser() throws InvalidArgumentException { void testQueryWorkbasketByUnknownUser() throws InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
.list(); .list();
Assert.assertEquals(0L, results.size()); assertEquals(0L, results.size());
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
workbasketService.createWorkbasketQuery() workbasketService.createWorkbasketQuery()
@ -61,19 +62,19 @@ public class WorkbasketQueryAccTest extends AbstractAccTest {
userName = "unknown", userName = "unknown",
groupNames = "businessadmin") groupNames = "businessadmin")
@Test @Test
public void testQueryWorkbasketByBusinessAdmin() throws NotAuthorizedException, InvalidArgumentException { void testQueryWorkbasketByBusinessAdmin() throws NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
.list(); .list();
Assert.assertEquals(25L, results.size()); assertEquals(25L, results.size());
results = workbasketService.createWorkbasketQuery() results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
.accessIdsHavePermission(WorkbasketPermission.TRANSFER, "teamlead_1", "group_1", "group_2") .accessIdsHavePermission(WorkbasketPermission.TRANSFER, "teamlead_1", "group_1", "group_2")
.list(); .list();
Assert.assertEquals(13L, results.size()); assertEquals(13L, results.size());
} }
@ -81,18 +82,18 @@ public class WorkbasketQueryAccTest extends AbstractAccTest {
userName = "unknown", userName = "unknown",
groupNames = "admin") groupNames = "admin")
@Test @Test
public void testQueryWorkbasketByAdmin() throws NotAuthorizedException, InvalidArgumentException { void testQueryWorkbasketByAdmin() throws NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
.list(); .list();
Assert.assertEquals(25L, results.size()); assertEquals(25L, results.size());
results = workbasketService.createWorkbasketQuery() results = workbasketService.createWorkbasketQuery()
.nameLike("%") .nameLike("%")
.accessIdsHavePermission(WorkbasketPermission.TRANSFER, "teamlead_1", "group_1", "group_2") .accessIdsHavePermission(WorkbasketPermission.TRANSFER, "teamlead_1", "group_1", "group_2")
.list(); .list();
Assert.assertEquals(13L, results.size()); assertEquals(13L, results.size());
} }
} }

View File

@ -1,8 +1,14 @@
package acceptance.task; package acceptance.task;
<<<<<<< master
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
=======
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
>>>>>>> TSK-983: Remove junit 4 from taskana-core
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
@ -87,25 +93,22 @@ class CallbackStateAccTest extends AbstractAccTest {
assertEquals(TaskState.READY, createdTask.getState()); assertEquals(TaskState.READY, createdTask.getState());
String endOfMessage = " cannot be deleted because its callback is not yet processed"; String endOfMessage = " cannot be deleted because its callback is not yet processed";
Throwable t = Assertions.assertThrows(InvalidStateException.class, () -> { Throwable t = Assertions.assertThrows(InvalidStateException.class,
taskService.forceDeleteTask(createdTask.getId()); () -> taskService.forceDeleteTask(createdTask.getId()));
});
assertTrue(t.getMessage().endsWith(endOfMessage)); assertTrue(t.getMessage().endsWith(endOfMessage));
final TaskImpl createdTask2 = (TaskImpl) taskService.claim(createdTask.getId()); final TaskImpl createdTask2 = (TaskImpl) taskService.claim(createdTask.getId());
assertEquals(TaskState.CLAIMED, createdTask2.getState()); assertEquals(TaskState.CLAIMED, createdTask2.getState());
Throwable t2 = Assertions.assertThrows(InvalidStateException.class, () -> { Throwable t2 = Assertions.assertThrows(InvalidStateException.class,
taskService.forceDeleteTask(createdTask2.getId()); () -> taskService.forceDeleteTask(createdTask2.getId()));
});
assertTrue(t2.getMessage().endsWith(endOfMessage)); assertTrue(t2.getMessage().endsWith(endOfMessage));
final TaskImpl createdTask3 = (TaskImpl) taskService.completeTask(createdTask.getId()); final TaskImpl createdTask3 = (TaskImpl) taskService.completeTask(createdTask.getId());
Throwable t3 = Assertions.assertThrows(InvalidStateException.class, () -> { Throwable t3 = Assertions.assertThrows(InvalidStateException.class,
taskService.forceDeleteTask(createdTask3.getId()); () -> taskService.forceDeleteTask(createdTask3.getId()));
});
assertTrue(t3.getMessage().endsWith(endOfMessage)); assertTrue(t3.getMessage().endsWith(endOfMessage));
} }
@ -146,7 +149,7 @@ class CallbackStateAccTest extends AbstractAccTest {
assertTrue(bulkResult1.containsErrors()); assertTrue(bulkResult1.containsErrors());
List<String> failedTaskIds = bulkResult1.getFailedIds(); List<String> failedTaskIds = bulkResult1.getFailedIds();
assertTrue(failedTaskIds.size() == 3); assertEquals(3, failedTaskIds.size());
for (String taskId : failedTaskIds) { for (String taskId : failedTaskIds) {
TaskanaException excpt = bulkResult1.getErrorForId(taskId); TaskanaException excpt = bulkResult1.getErrorForId(taskId);
assertEquals("pro.taskana.exceptions.InvalidStateException", excpt.getClass().getName()); assertEquals("pro.taskana.exceptions.InvalidStateException", excpt.getClass().getName());
@ -309,8 +312,13 @@ class CallbackStateAccTest extends AbstractAccTest {
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
void testQueriesWithCallbackState() void testQueriesWithCallbackState()
<<<<<<< master
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
TaskAlreadyExistException, InvalidArgumentException, TaskNotFoundException, InvalidStateException, TaskAlreadyExistException, InvalidArgumentException, TaskNotFoundException, InvalidStateException,
=======
throws NotAuthorizedException,
TaskNotFoundException, InvalidStateException,
>>>>>>> TSK-983: Remove junit 4 from taskana-core
InvalidOwnerException, SQLException, IOException { InvalidOwnerException, SQLException, IOException {
resetDb(false); resetDb(false);
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -344,7 +352,7 @@ class CallbackStateAccTest extends AbstractAccTest {
.stateIn(TaskState.COMPLETED) .stateIn(TaskState.COMPLETED)
.callbackStateIn(CallbackState.CALLBACK_PROCESSING_REQUIRED) .callbackStateIn(CallbackState.CALLBACK_PROCESSING_REQUIRED)
.list(); .list();
assertTrue(tasksToBeActedUpon.size() == numberOfCompletedTasksAtStartOfTest); assertEquals(tasksToBeActedUpon.size(), numberOfCompletedTasksAtStartOfTest);
// now we set callback state to callback_processing_completed // now we set callback state to callback_processing_completed
externalIds = tasksToBeActedUpon.stream().map(TaskSummary::getExternalId).collect(Collectors.toList()); externalIds = tasksToBeActedUpon.stream().map(TaskSummary::getExternalId).collect(Collectors.toList());
BulkOperationResults<String, TaskanaException> bulkResult = taskService.setCallbackStateForTasks(externalIds, BulkOperationResults<String, TaskanaException> bulkResult = taskService.setCallbackStateForTasks(externalIds,
@ -355,7 +363,7 @@ class CallbackStateAccTest extends AbstractAccTest {
.stateIn(TaskState.COMPLETED) .stateIn(TaskState.COMPLETED)
.callbackStateIn(CallbackState.CALLBACK_PROCESSING_REQUIRED) .callbackStateIn(CallbackState.CALLBACK_PROCESSING_REQUIRED)
.count(); .count();
assertTrue(numOfTasksRemaining == 0); assertEquals(0, numOfTasksRemaining);
} }
@ -371,8 +379,7 @@ class CallbackStateAccTest extends AbstractAccTest {
newTask.setCallbackInfo(callbackInfo); newTask.setCallbackInfo(callbackInfo);
augmentCallbackInfo(newTask); augmentCallbackInfo(newTask);
TaskImpl createdTask = (TaskImpl) taskService.createTask(newTask); return (TaskImpl) taskService.createTask(newTask);
return createdTask;
} }
private void augmentCallbackInfo(Task task) { private void augmentCallbackInfo(Task task) {

View File

@ -1,10 +1,10 @@
package acceptance.task; package acceptance.task;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Instant; import java.time.Instant;

View File

@ -1,12 +1,12 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;

View File

@ -1,7 +1,10 @@
package acceptance.task; package acceptance.task;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -26,9 +29,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "delete task" scenarios. * Acceptance test for all "delete task" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class DeleteTaskAccTest extends AbstractAccTest { class DeleteTaskAccTest extends AbstractAccTest {
public DeleteTaskAccTest() { DeleteTaskAccTest() {
super(); super();
} }
@ -36,8 +39,7 @@ public class DeleteTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testDeleteSingleTaskNotAuthorized() void testDeleteSingleTaskNotAuthorized() {
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -48,7 +50,7 @@ public class DeleteTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1", "admin"}) groupNames = {"group_1", "admin"})
@Test @Test
public void testDeleteSingleTask() void testDeleteSingleTask()
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -64,8 +66,8 @@ public class DeleteTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1", "admin"}) groupNames = {"group_1", "admin"})
@Test @Test
public void testThrowsExceptionIfTaskIsNotCompleted() void testThrowsExceptionIfTaskIsNotCompleted()
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { throws TaskNotFoundException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000029"); Task task = taskService.getTask("TKI:000000000000000000000000000000000029");
@ -77,7 +79,7 @@ public class DeleteTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1", "admin"}) groupNames = {"group_1", "admin"})
@Test @Test
public void testForceDeleteTaskIfNotCompleted() void testForceDeleteTaskIfNotCompleted()
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException { throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000027"); Task task = taskService.getTask("TKI:000000000000000000000000000000000027");
@ -95,8 +97,8 @@ public class DeleteTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testBulkDeleteTask() void testBulkDeleteTask()
throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
ArrayList<String> taskIdList = new ArrayList<>(); ArrayList<String> taskIdList = new ArrayList<>();
@ -114,7 +116,7 @@ public class DeleteTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testBulkDeleteTasksWithException() void testBulkDeleteTasksWithException()
throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedException { throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -128,12 +130,12 @@ public class DeleteTaskAccTest extends AbstractAccTest {
String expectedFailedId = "TKI:000000000000000000000000000000000028"; String expectedFailedId = "TKI:000000000000000000000000000000000028";
assertTrue(results.containsErrors()); assertTrue(results.containsErrors());
List<String> failedTaskIds = results.getFailedIds(); List<String> failedTaskIds = results.getFailedIds();
assertTrue(failedTaskIds.size() == 1); assertEquals(1, failedTaskIds.size());
assertTrue(expectedFailedId.equals(failedTaskIds.get(0))); assertEquals(expectedFailedId, failedTaskIds.get(0));
assertTrue(results.getErrorMap().get(expectedFailedId).getClass() == InvalidStateException.class); assertSame(results.getErrorMap().get(expectedFailedId).getClass(), InvalidStateException.class);
Task notDeletedTask = taskService.getTask("TKI:000000000000000000000000000000000028"); Task notDeletedTask = taskService.getTask("TKI:000000000000000000000000000000000028");
assertTrue(notDeletedTask != null); assertNotNull(notDeletedTask);
Assertions.assertThrows(TaskNotFoundException.class, () -> Assertions.assertThrows(TaskNotFoundException.class, () ->
taskService.getTask("TKI:000000000000000000000000000000000040")); taskService.getTask("TKI:000000000000000000000000000000000040"));

View File

@ -1,6 +1,9 @@
package acceptance.task; package acceptance.task;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.HashMap; import java.util.HashMap;
@ -23,9 +26,9 @@ import pro.taskana.security.WithAccessId;
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class GetTaskAccTest extends AbstractAccTest { class GetTaskAccTest extends AbstractAccTest {
public GetTaskAccTest() { GetTaskAccTest() {
super(); super();
} }
@ -33,13 +36,13 @@ public class GetTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetTaskById() void testGetTaskById()
throws TaskNotFoundException, NotAuthorizedException, InvalidArgumentException { throws TaskNotFoundException, NotAuthorizedException, InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000000"); Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
assertEquals(null, task.getCompleted()); assertNull(task.getCompleted());
assertEquals("Task99", task.getName()); assertEquals("Task99", task.getName());
assertEquals("creator_user_id", task.getCreator()); assertEquals("creator_user_id", task.getCreator());
assertEquals("Lorem ipsum was n Quatsch dolor sit amet.", task.getDescription()); assertEquals("Lorem ipsum was n Quatsch dolor sit amet.", task.getDescription());
@ -60,8 +63,8 @@ public class GetTaskAccTest extends AbstractAccTest {
assertEquals("MyInstance1", task.getPrimaryObjRef().getSystemInstance()); assertEquals("MyInstance1", task.getPrimaryObjRef().getSystemInstance());
assertEquals("MyType1", task.getPrimaryObjRef().getType()); assertEquals("MyType1", task.getPrimaryObjRef().getType());
assertEquals("MyValue1", task.getPrimaryObjRef().getValue()); assertEquals("MyValue1", task.getPrimaryObjRef().getValue());
assertEquals(true, task.isRead()); assertTrue(task.isRead());
assertEquals(false, task.isTransferred()); assertFalse(task.isTransferred());
assertEquals(new HashMap<String, String>(), task.getCallbackInfo()); assertEquals(new HashMap<String, String>(), task.getCallbackInfo());
assertEquals(new HashMap<String, String>(), task.getCustomAttributes()); assertEquals(new HashMap<String, String>(), task.getCustomAttributes());
assertEquals("custom1", task.getCustomAttribute("1")); assertEquals("custom1", task.getCustomAttribute("1"));
@ -86,8 +89,7 @@ public class GetTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetTaskByIdNotExisting() void testGetTaskByIdNotExisting() {
throws TaskNotFoundException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Assertions.assertThrows(TaskNotFoundException.class, () -> Assertions.assertThrows(TaskNotFoundException.class, () ->

View File

@ -1,11 +1,10 @@
package acceptance.task; package acceptance.task;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -23,12 +22,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for the usecase of adding/removing an attachment of a task and update the result correctly. * Acceptance test for the usecase of adding/removing an attachment of a task and update the result correctly.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryTaskByClassificationNameAccTest extends AbstractAccTest { class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
private static SortDirection asc = SortDirection.ASCENDING; private static SortDirection asc = SortDirection.ASCENDING;
private static SortDirection desc = SortDirection.DESCENDING; private static SortDirection desc = SortDirection.DESCENDING;
public QueryTaskByClassificationNameAccTest() { QueryTaskByClassificationNameAccTest() {
super(); super();
} }
@ -36,7 +35,7 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"admin"}) groupNames = {"admin"})
@Test @Test
public void testQueryTaskValuesForAttachmentClassificationName() { void testQueryTaskValuesForAttachmentClassificationName() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<String> columnValueList = taskService.createTaskQuery() List<String> columnValueList = taskService.createTaskQuery()
.ownerLike("%user%") .ownerLike("%user%")
@ -50,7 +49,7 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"admin"}) groupNames = {"admin"})
@Test @Test
public void testQueryTaskValuesForClassificationName() { void testQueryTaskValuesForClassificationName() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<String> columnValueList = taskService.createTaskQuery() List<String> columnValueList = taskService.createTaskQuery()
.ownerLike("%user%") .ownerLike("%user%")
@ -64,7 +63,7 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryByClassificationNameIn() { void testQueryByClassificationNameIn() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> tasks = taskService.createTaskQuery() List<TaskSummary> tasks = taskService.createTaskQuery()
.classificationNameIn("Dynamik-Ablehnung") .classificationNameIn("Dynamik-Ablehnung")
@ -86,7 +85,7 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryByClassificationNameLike() { void testQueryByClassificationNameLike() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> tasks = taskService.createTaskQuery() List<TaskSummary> tasks = taskService.createTaskQuery()
.classificationNameLike("Dynamik%", "Widerruf") .classificationNameLike("Dynamik%", "Widerruf")
@ -105,7 +104,7 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testSelectByAttachmentClassificationNameLike() { void testSelectByAttachmentClassificationNameLike() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// find Task with attachment classification names // find Task with attachment classification names
List<TaskSummary> tasks = taskService.createTaskQuery() List<TaskSummary> tasks = taskService.createTaskQuery()
@ -125,7 +124,7 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testSelectByAttachmentClassificationNameIn() { void testSelectByAttachmentClassificationNameIn() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// find Task with attachment classification names // find Task with attachment classification names
List<TaskSummary> tasks = taskService.createTaskQuery() List<TaskSummary> tasks = taskService.createTaskQuery()
@ -145,7 +144,7 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryAndCountMatchForClassificationName() { void testQueryAndCountMatchForClassificationName() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TaskQuery taskQuery = taskService.createTaskQuery(); TaskQuery taskQuery = taskService.createTaskQuery();
List<TaskSummary> tasks = taskQuery List<TaskSummary> tasks = taskQuery
@ -154,7 +153,7 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
long numberOfTasks = taskQuery long numberOfTasks = taskQuery
.classificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikänderung") .classificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikänderung")
.count(); .count();
Assert.assertEquals(numberOfTasks, tasks.size()); assertEquals(numberOfTasks, tasks.size());
} }
@ -162,7 +161,7 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryAndCountForAttachmentClassificationName() { void testQueryAndCountForAttachmentClassificationName() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TaskQuery taskQuery = taskService.createTaskQuery(); TaskQuery taskQuery = taskService.createTaskQuery();
List<TaskSummary> tasks = taskQuery List<TaskSummary> tasks = taskQuery
@ -170,11 +169,11 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
.list(); .list();
// we expect 4 result objects in this case, because task TKI:000000000000000000000000000000000001 has 2 attachments with different Classifications // we expect 4 result objects in this case, because task TKI:000000000000000000000000000000000001 has 2 attachments with different Classifications
// therefore task TKI:000000000000000000000000000000000001 occurs twice in the result set // therefore task TKI:000000000000000000000000000000000001 occurs twice in the result set
Assert.assertEquals(4, tasks.size()); assertEquals(4, tasks.size());
long numberOfTasks = taskQuery long numberOfTasks = taskQuery
.attachmentClassificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikänderung") .attachmentClassificationNameIn("Widerruf", "Beratungsprotokoll", "Dynamikänderung")
.count(); .count();
Assert.assertEquals(3, numberOfTasks); assertEquals(3, numberOfTasks);
// the count returns only the number of tasks that have an attachment with the specified classification name. // the count returns only the number of tasks that have an attachment with the specified classification name.
// therefore, task 001 is counted only once. // therefore, task 001 is counted only once.
} }

View File

@ -1,9 +1,9 @@
package acceptance.task; package acceptance.task;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List; import java.util.List;
@ -26,9 +26,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for the usecase of adding/removing an attachment of a task and update the result correctly. * Acceptance test for the usecase of adding/removing an attachment of a task and update the result correctly.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryTaskWithAttachment extends AbstractAccTest { class QueryTaskWithAttachment extends AbstractAccTest {
public QueryTaskWithAttachment() { QueryTaskWithAttachment() {
super(); super();
} }
@ -36,7 +36,7 @@ public class QueryTaskWithAttachment extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetAttachmentSummariesFromTask() { void testGetAttachmentSummariesFromTask() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> tasks = taskService.createTaskQuery() List<TaskSummary> tasks = taskService.createTaskQuery()
.classificationKeyIn("L110102") .classificationKeyIn("L110102")
@ -51,7 +51,7 @@ public class QueryTaskWithAttachment extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "user_1_2") userName = "user_1_2")
@Test @Test
public void testGetNoAttachmentSummaryFromTask() { void testGetNoAttachmentSummaryFromTask() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> tasks = taskService.createTaskQuery() List<TaskSummary> tasks = taskService.createTaskQuery()
.list(); .list();
@ -66,7 +66,7 @@ public class QueryTaskWithAttachment extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testIfNewTaskHasEmptyAttachmentList() { void testIfNewTaskHasEmptyAttachmentList() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.newTask("WBI:100000000000000000000000000000000006"); Task task = taskService.newTask("WBI:100000000000000000000000000000000006");
assertNotNull(task.getAttachments()); assertNotNull(task.getAttachments());
@ -77,7 +77,7 @@ public class QueryTaskWithAttachment extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testIfAttachmentSummariesAreCorrectUsingTaskQueryAndGetTaskById() void testIfAttachmentSummariesAreCorrectUsingTaskQueryAndGetTaskById()
throws TaskNotFoundException, NotAuthorizedException { throws TaskNotFoundException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// find Task with ID TKI:00...00 // find Task with ID TKI:00...00
@ -117,7 +117,7 @@ public class QueryTaskWithAttachment extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testIfAttachmentSummariesAreCorrect() void testIfAttachmentSummariesAreCorrect()
throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException { throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// find Task with ID TKI:00...00 // find Task with ID TKI:00...00

View File

@ -1,10 +1,11 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static pro.taskana.BaseQuery.SortDirection.ASCENDING; import static pro.taskana.BaseQuery.SortDirection.ASCENDING;
import static pro.taskana.BaseQuery.SortDirection.DESCENDING; import static pro.taskana.BaseQuery.SortDirection.DESCENDING;
import static pro.taskana.TaskQueryColumnName.A_CHANNEL; import static pro.taskana.TaskQueryColumnName.A_CHANNEL;
@ -20,7 +21,6 @@ import java.util.Map;
import org.apache.ibatis.session.Configuration; import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -131,7 +131,7 @@ class QueryTasksAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertFalse(previousSummary.getCreated().isAfter(taskSummary.getCreated())); assertFalse(previousSummary.getCreated().isAfter(taskSummary.getCreated()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }
@ -828,7 +828,7 @@ class QueryTasksAccTest extends AbstractAccTest {
long numberOfTasks = taskQuery long numberOfTasks = taskQuery
.nameIn("Task99", "Task01", "Widerruf") .nameIn("Task99", "Task01", "Widerruf")
.count(); .count();
Assert.assertEquals(numberOfTasks, tasks.size()); assertEquals(numberOfTasks, tasks.size());
} }

View File

@ -1,8 +1,9 @@
package acceptance.task; package acceptance.task;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -17,9 +18,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "query tasks by object reference" scenarios. * Acceptance test for all "query tasks by object reference" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest { class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
public QueryTasksByObjectReferenceAccTest() { QueryTasksByObjectReferenceAccTest() {
super(); super();
} }
@ -27,40 +28,40 @@ public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryTasksByExcactValueOfObjectReference() void testQueryTasksByExcactValueOfObjectReference()
throws SystemException { throws SystemException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceValueIn("11223344", "22334455") .primaryObjectReferenceValueIn("11223344", "22334455")
.list(); .list();
Assert.assertEquals(33L, results.size()); assertEquals(33L, results.size());
} }
@WithAccessId( @WithAccessId(
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryTasksByExcactValueAndTypeOfObjectReference() void testQueryTasksByExcactValueAndTypeOfObjectReference()
throws SystemException { throws SystemException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceTypeIn("SDNR") .primaryObjectReferenceTypeIn("SDNR")
.primaryObjectReferenceValueIn("11223344") .primaryObjectReferenceValueIn("11223344")
.list(); .list();
Assert.assertEquals(10L, results.size()); assertEquals(10L, results.size());
} }
@WithAccessId( @WithAccessId(
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryTasksByValueLikeOfObjectReference() void testQueryTasksByValueLikeOfObjectReference()
throws SystemException { throws SystemException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.primaryObjectReferenceValueLike("%567%") .primaryObjectReferenceValueLike("%567%")
.list(); .list();
Assert.assertEquals(10L, results.size()); assertEquals(10L, results.size());
} }
} }

View File

@ -1,12 +1,13 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -22,12 +23,11 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "query tasks with sorting" scenarios. * Acceptance test for all "query tasks with sorting" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest { class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
private static SortDirection asc = SortDirection.ASCENDING; private static SortDirection asc = SortDirection.ASCENDING;
private static SortDirection desc = SortDirection.DESCENDING;
public QueryTasksByTimeIntervalsAccTest() { QueryTasksByTimeIntervalsAccTest() {
super(); super();
} }
@ -35,7 +35,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testCreatedWithin2Intervals() { void testCreatedWithin2Intervals() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval( TimeInterval interval1 = new TimeInterval(
@ -54,10 +54,10 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getCreated(); Instant cr = taskSummary.getCreated();
Assert.assertTrue(interval1.contains(cr) || interval2.contains(cr)); assertTrue(interval1.contains(cr) || interval2.contains(cr));
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getCreated().isAfter(taskSummary.getCreated())); assertFalse(previousSummary.getCreated().isAfter(taskSummary.getCreated()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }
@ -67,7 +67,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testCreatedBefore() { void testCreatedBefore() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval( TimeInterval interval1 = new TimeInterval(
@ -83,10 +83,10 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getCreated(); Instant cr = taskSummary.getCreated();
Assert.assertTrue(interval1.contains(cr)); assertTrue(interval1.contains(cr));
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getCreated().isAfter(taskSummary.getCreated())); assertFalse(previousSummary.getCreated().isAfter(taskSummary.getCreated()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }
@ -96,7 +96,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testCreatedAfter() { void testCreatedAfter() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval( TimeInterval interval1 = new TimeInterval(
@ -111,10 +111,10 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getCreated(); Instant cr = taskSummary.getCreated();
Assert.assertTrue(interval1.contains(cr)); assertTrue(interval1.contains(cr));
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getCreated().isAfter(taskSummary.getCreated())); assertFalse(previousSummary.getCreated().isAfter(taskSummary.getCreated()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }
@ -124,7 +124,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testClaimedWithin2Intervals() { void testClaimedWithin2Intervals() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval1 = new TimeInterval( TimeInterval interval1 = new TimeInterval(
@ -143,10 +143,10 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getClaimed(); Instant cr = taskSummary.getClaimed();
Assert.assertTrue(interval1.contains(cr) || interval2.contains(cr)); assertTrue(interval1.contains(cr) || interval2.contains(cr));
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getClaimed().isAfter(taskSummary.getClaimed())); assertFalse(previousSummary.getClaimed().isAfter(taskSummary.getClaimed()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }
@ -156,7 +156,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testCompletedWithin() { void testCompletedWithin() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval( TimeInterval interval = new TimeInterval(
@ -171,10 +171,10 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getCompleted(); Instant cr = taskSummary.getCompleted();
Assert.assertTrue(interval.contains(cr)); assertTrue(interval.contains(cr));
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getCompleted().isAfter(taskSummary.getCompleted())); assertFalse(previousSummary.getCompleted().isAfter(taskSummary.getCompleted()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }
@ -184,7 +184,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testModifiedWithin() { void testModifiedWithin() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval( TimeInterval interval = new TimeInterval(
@ -199,10 +199,10 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getModified(); Instant cr = taskSummary.getModified();
Assert.assertTrue(interval.contains(cr)); assertTrue(interval.contains(cr));
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getModified().isAfter(taskSummary.getModified())); assertFalse(previousSummary.getModified().isAfter(taskSummary.getModified()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }
@ -212,7 +212,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testPlannedWithin() { void testPlannedWithin() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval( TimeInterval interval = new TimeInterval(
@ -227,10 +227,10 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getPlanned(); Instant cr = taskSummary.getPlanned();
Assert.assertTrue(interval.contains(cr)); assertTrue(interval.contains(cr));
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getPlanned().isAfter(taskSummary.getPlanned())); assertFalse(previousSummary.getPlanned().isAfter(taskSummary.getPlanned()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }
@ -240,7 +240,7 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testDueWithin() { void testDueWithin() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
TimeInterval interval = new TimeInterval( TimeInterval interval = new TimeInterval(
@ -255,10 +255,10 @@ public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
Instant cr = taskSummary.getDue(); Instant cr = taskSummary.getDue();
Assert.assertTrue(interval.contains(cr)); assertTrue(interval.contains(cr));
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getPlanned().isAfter(taskSummary.getPlanned())); assertFalse(previousSummary.getPlanned().isAfter(taskSummary.getPlanned()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }

View File

@ -1,7 +1,7 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -23,9 +23,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "query tasks by workbasket" scenarios. * Acceptance test for all "query tasks by workbasket" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryTasksByWorkbasketAccTest extends AbstractAccTest { class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
public QueryTasksByWorkbasketAccTest() { QueryTasksByWorkbasketAccTest() {
super(); super();
} }
@ -33,7 +33,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForWorkbasketKeyDomain() { void testQueryForWorkbasketKeyDomain() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<KeyDomain> workbasketIdentifiers = Arrays.asList(new KeyDomain("GPK_KSC", "DOMAIN_A"), List<KeyDomain> workbasketIdentifiers = Arrays.asList(new KeyDomain("GPK_KSC", "DOMAIN_A"),
new KeyDomain("USER_1_2", "DOMAIN_A")); new KeyDomain("USER_1_2", "DOMAIN_A"));
@ -58,7 +58,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket() { void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Assertions.assertThrows(NotAuthorizedToQueryWorkbasketException.class, () -> Assertions.assertThrows(NotAuthorizedToQueryWorkbasketException.class, () ->
@ -71,7 +71,7 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket() { void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Assertions.assertThrows(NotAuthorizedToQueryWorkbasketException.class, () -> Assertions.assertThrows(NotAuthorizedToQueryWorkbasketException.class, () ->
taskService.createTaskQuery() taskService.createTaskQuery()

View File

@ -1,7 +1,7 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import java.util.List; import java.util.List;
@ -22,9 +22,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "query tasks by workbasket with pagination" scenarios. * Acceptance test for all "query tasks by workbasket with pagination" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryTasksWithPaginationAccTest extends AbstractAccTest { class QueryTasksWithPaginationAccTest extends AbstractAccTest {
public QueryTasksWithPaginationAccTest() { QueryTasksWithPaginationAccTest() {
super(); super();
} }
@ -32,7 +32,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetFirstPageOfTaskQueryWithOffset() { void testGetFirstPageOfTaskQueryWithOffset() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")) .workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A"))
@ -44,7 +44,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testSecondPageOfTaskQueryWithOffset() { void testSecondPageOfTaskQueryWithOffset() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")) .workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A"))
@ -56,7 +56,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testListOffsetAndLimitOutOfBounds() { void testListOffsetAndLimitOutOfBounds() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// both will be 0, working // both will be 0, working
@ -82,7 +82,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPaginationWithPages() { void testPaginationWithPages() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// Getting full page // Getting full page
@ -122,7 +122,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPaginationNullAndNegativeLimitsIgnoring() { void testPaginationNullAndNegativeLimitsIgnoring() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// 0 limit/size = 0 results // 0 limit/size = 0 results
@ -159,7 +159,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPaginationThrowingExceptionWhenPageOutOfBounds() { void testPaginationThrowingExceptionWhenPageOutOfBounds() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// entrypoint set outside result amount // entrypoint set outside result amount
@ -176,7 +176,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCountOfTaskQuery() { void testCountOfTaskQuery() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
long count = taskService.createTaskQuery() long count = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A")) .workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A"))
@ -188,7 +188,7 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCountOfTaskQueryWithAttachmentChannelFilter() { void testCountOfTaskQueryWithAttachmentChannelFilter() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
long count = taskService.createTaskQuery() long count = taskService.createTaskQuery()
.attachmentChannelIn("ch6") .attachmentChannelIn("ch6")

View File

@ -1,11 +1,12 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -22,12 +23,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "query tasks with sorting" scenarios. * Acceptance test for all "query tasks with sorting" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryTasksWithSortingAccTest extends AbstractAccTest { class QueryTasksWithSortingAccTest extends AbstractAccTest {
private static SortDirection asc = SortDirection.ASCENDING; private static SortDirection asc = SortDirection.ASCENDING;
private static SortDirection desc = SortDirection.DESCENDING; private static SortDirection desc = SortDirection.DESCENDING;
public QueryTasksWithSortingAccTest() { QueryTasksWithSortingAccTest() {
super(); super();
} }
@ -35,7 +36,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByModifiedAndDomain() { void testSortByModifiedAndDomain() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -47,7 +48,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(!previousSummary.getModified().isBefore(taskSummary.getModified())); assertFalse(previousSummary.getModified().isBefore(taskSummary.getModified()));
} }
previousSummary = taskSummary; previousSummary = taskSummary;
} }
@ -57,7 +58,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByDomainNameAndCreated() { void testSortByDomainNameAndCreated() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -72,11 +73,11 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
// System.out.println("domain: " + taskSummary.getDomain() + ", name: " + taskSummary.getName() + ", // System.out.println("domain: " + taskSummary.getDomain() + ", name: " + taskSummary.getName() + ",
// created: " + taskSummary.getCreated()); // created: " + taskSummary.getCreated());
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(taskSummary.getDomain().compareToIgnoreCase(previousSummary.getDomain()) >= 0); assertTrue(taskSummary.getDomain().compareToIgnoreCase(previousSummary.getDomain()) >= 0);
if (taskSummary.getDomain().equals(previousSummary.getDomain())) { if (taskSummary.getDomain().equals(previousSummary.getDomain())) {
Assert.assertTrue(taskSummary.getName().compareToIgnoreCase(previousSummary.getName()) >= 0); assertTrue(taskSummary.getName().compareToIgnoreCase(previousSummary.getName()) >= 0);
if (taskSummary.getName().equals(previousSummary.getName())) { if (taskSummary.getName().equals(previousSummary.getName())) {
Assert.assertTrue(!taskSummary.getCreated().isBefore(previousSummary.getCreated())); assertFalse(taskSummary.getCreated().isBefore(previousSummary.getCreated()));
} }
} }
} }
@ -88,7 +89,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByPorSystemNoteDueAndOwner() { void testSortByPorSystemNoteDueAndOwner() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -102,7 +103,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(taskSummary.getPrimaryObjRef().getSystem().compareToIgnoreCase( assertTrue(taskSummary.getPrimaryObjRef().getSystem().compareToIgnoreCase(
previousSummary.getPrimaryObjRef().getSystem()) <= 0); previousSummary.getPrimaryObjRef().getSystem()) <= 0);
} }
previousSummary = taskSummary; previousSummary = taskSummary;
@ -113,7 +114,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByPorSystemInstanceParentProcPlannedAndState() { void testSortByPorSystemInstanceParentProcPlannedAndState() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -127,7 +128,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(taskSummary.getPrimaryObjRef().getSystemInstance().compareToIgnoreCase( assertTrue(taskSummary.getPrimaryObjRef().getSystemInstance().compareToIgnoreCase(
previousSummary.getPrimaryObjRef().getSystemInstance()) <= 0); previousSummary.getPrimaryObjRef().getSystemInstance()) <= 0);
} }
previousSummary = taskSummary; previousSummary = taskSummary;
@ -138,7 +139,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByPorCompanyAndClaimed() { void testSortByPorCompanyAndClaimed() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B")) .workbasketKeyDomainIn(new KeyDomain("USER_3_2", "DOMAIN_B"))
@ -152,7 +153,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
// System.out.println("porCompany: " + taskSummary.getPrimaryObjRef().getCompany() + ", claimed: " // System.out.println("porCompany: " + taskSummary.getPrimaryObjRef().getCompany() + ", claimed: "
// + taskSummary.getClaimed()); // + taskSummary.getClaimed());
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(taskSummary.getPrimaryObjRef().getCompany().compareToIgnoreCase( assertTrue(taskSummary.getPrimaryObjRef().getCompany().compareToIgnoreCase(
previousSummary.getPrimaryObjRef().getCompany()) <= 0); previousSummary.getPrimaryObjRef().getCompany()) <= 0);
} }
previousSummary = taskSummary; previousSummary = taskSummary;
@ -163,7 +164,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortByWbKeyPrioPorValueAndCompleted() { void testSortByWbKeyPrioPorValueAndCompleted() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.stateIn(TaskState.READY) .stateIn(TaskState.READY)
@ -178,7 +179,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(taskSummary.getWorkbasketSummary().getKey().compareToIgnoreCase( assertTrue(taskSummary.getWorkbasketSummary().getKey().compareToIgnoreCase(
previousSummary.getWorkbasketSummary().getKey()) >= 0); previousSummary.getWorkbasketSummary().getKey()) >= 0);
} }
previousSummary = taskSummary; previousSummary = taskSummary;
@ -189,7 +190,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testSortBpIdClassificationIdDescriptionAndPorType() { void testSortBpIdClassificationIdDescriptionAndPorType() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<TaskSummary> results = taskService.createTaskQuery() List<TaskSummary> results = taskService.createTaskQuery()
.stateIn(TaskState.READY) .stateIn(TaskState.READY)
@ -203,7 +204,7 @@ public class QueryTasksWithSortingAccTest extends AbstractAccTest {
TaskSummary previousSummary = null; TaskSummary previousSummary = null;
for (TaskSummary taskSummary : results) { for (TaskSummary taskSummary : results) {
if (previousSummary != null) { if (previousSummary != null) {
Assert.assertTrue(taskSummary.getBusinessProcessId().compareToIgnoreCase( assertTrue(taskSummary.getBusinessProcessId().compareToIgnoreCase(
previousSummary.getBusinessProcessId()) >= 0); previousSummary.getBusinessProcessId()) >= 0);
} }
previousSummary = taskSummary; previousSummary = taskSummary;

View File

@ -1,12 +1,12 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.Assert.assertTrue;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
@ -14,7 +14,6 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -39,9 +38,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "transfer task" scenarios. * Acceptance test for all "transfer task" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class TransferTaskAccTest extends AbstractAccTest { class TransferTaskAccTest extends AbstractAccTest {
public TransferTaskAccTest() { TransferTaskAccTest() {
super(); super();
} }
@ -49,7 +48,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testTransferTaskToWorkbasketId() void testTransferTaskToWorkbasketId()
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException, throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException,
InvalidOwnerException { InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -70,7 +69,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testTransferTaskToWorkbasketKeyDomain() void testTransferTaskToWorkbasketKeyDomain()
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException, throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException,
InvalidOwnerException { InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -91,7 +90,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testDomainChangingWhenTransferTask() void testDomainChangingWhenTransferTask()
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException { throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000000"); Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
@ -107,8 +106,8 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfTransferWithNoTransferAuthorization() void testThrowsExceptionIfTransferWithNoTransferAuthorization()
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException { throws NotAuthorizedException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000001"); Task task = taskService.getTask("TKI:000000000000000000000000000000000001");
@ -120,7 +119,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testTransferDestinationWorkbasketDoesNotExist() void testTransferDestinationWorkbasketDoesNotExist()
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException, throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
InvalidOwnerException { InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -136,7 +135,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testTransferTaskDoesNotExist() { void testTransferTaskDoesNotExist() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Assertions.assertThrows(TaskNotFoundException.class, () -> Assertions.assertThrows(TaskNotFoundException.class, () ->
@ -147,7 +146,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"teamlead_1"}) groupNames = {"teamlead_1"})
@Test @Test
public void testTransferNotAuthorizationOnWorkbasketTransfer() { void testTransferNotAuthorizationOnWorkbasketTransfer() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -159,7 +158,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfTaskIsAlreadyCompleted() void testThrowsExceptionIfTaskIsAlreadyCompleted()
throws NotAuthorizedException, TaskNotFoundException { throws NotAuthorizedException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:100000000000000000000000000000000006"); Task task = taskService.getTask("TKI:100000000000000000000000000000000006");
@ -172,7 +171,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfTransferWithNoAppendAuthorization() void testThrowsExceptionIfTransferWithNoAppendAuthorization()
throws NotAuthorizedException, TaskNotFoundException { throws NotAuthorizedException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000002"); Task task = taskService.getTask("TKI:000000000000000000000000000000000002");
@ -185,7 +184,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testBulkTransferTaskToWorkbasketById() void testBulkTransferTaskToWorkbasketById()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, TaskNotFoundException { throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, TaskNotFoundException {
Instant before = Instant.now(); Instant before = Instant.now();
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -220,7 +219,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
@WithAccessId(userName = "teamlead_1", groupNames = {"group_1"}) @WithAccessId(userName = "teamlead_1", groupNames = {"group_1"})
@Test @Test
public void testBulkTransferTaskWithExceptions() void testBulkTransferTaskWithExceptions()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, TaskNotFoundException { throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Workbasket wb = taskanaEngine.getWorkbasketService().getWorkbasket("USER_1_1", "DOMAIN_A"); Workbasket wb = taskanaEngine.getWorkbasketService().getWorkbasket("USER_1_1", "DOMAIN_A");
@ -278,7 +277,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
@WithAccessId(userName = "teamlead_1") @WithAccessId(userName = "teamlead_1")
@Test @Test
public void testBulkTransferTaskWithoutAppendPermissionOnTarget() { void testBulkTransferTaskWithoutAppendPermissionOnTarget() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
ArrayList<String> taskIdList = new ArrayList<>(); ArrayList<String> taskIdList = new ArrayList<>();
taskIdList.add("TKI:000000000000000000000000000000000006"); // working taskIdList.add("TKI:000000000000000000000000000000000006"); // working
@ -295,7 +294,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testTransferTasksWithListNotSupportingRemove() throws NotAuthorizedException, InvalidArgumentException, void testTransferTasksWithListNotSupportingRemove() throws NotAuthorizedException, InvalidArgumentException,
WorkbasketNotFoundException { WorkbasketNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<String> taskIds = Collections.singletonList("TKI:000000000000000000000000000000000006"); List<String> taskIds = Collections.singletonList("TKI:000000000000000000000000000000000006");
@ -306,26 +305,25 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testTransferTasksWithInvalidTasksIdList() throws NotAuthorizedException, WorkbasketNotFoundException { void testTransferTasksWithInvalidTasksIdList() {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
// test with invalid list // test with invalid list
Throwable t = Assertions.assertThrows(InvalidArgumentException.class, () -> Throwable t = Assertions.assertThrows(InvalidArgumentException.class, () ->
taskService.transferTasks("WBI:100000000000000000000000000000000006", null)); taskService.transferTasks("WBI:100000000000000000000000000000000006", null));
Assert.assertEquals(t.getMessage(), "TaskIds must not be null."); assertEquals(t.getMessage(), "TaskIds must not be null.");
// test with list containing only invalid arguments // test with list containing only invalid arguments
Throwable t2 = Assertions.assertThrows(InvalidArgumentException.class, () -> Throwable t2 = Assertions.assertThrows(InvalidArgumentException.class, () ->
taskService.transferTasks("WBI:100000000000000000000000000000000006", Arrays.asList("", "", "", null))); taskService.transferTasks("WBI:100000000000000000000000000000000006", Arrays.asList("", "", "", null)));
Assert.assertEquals(t2.getMessage(), "TaskIds must not contain only invalid arguments."); assertEquals(t2.getMessage(), "TaskIds must not contain only invalid arguments.");
} }
@WithAccessId( @WithAccessId(
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfEmptyListIsSupplied() void testThrowsExceptionIfEmptyListIsSupplied() {
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
List<String> taskIds = new ArrayList<>(); List<String> taskIds = new ArrayList<>();
Assertions.assertThrows(InvalidArgumentException.class, () -> Assertions.assertThrows(InvalidArgumentException.class, () ->
@ -336,7 +334,7 @@ public class TransferTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testBulkTransferByWorkbasketAndDomainByKey() void testBulkTransferByWorkbasketAndDomainByKey()
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException, TaskNotFoundException { throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException, TaskNotFoundException {
Instant before = Instant.now(); Instant before = Instant.now();
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();

View File

@ -1,14 +1,14 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.Assert.assertTrue;
import java.time.Instant; import java.time.Instant;
import java.util.Arrays; import java.util.Arrays;
@ -42,9 +42,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "update task" scenarios. * Acceptance test for all "update task" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class UpdateTaskAccTest extends AbstractAccTest { class UpdateTaskAccTest extends AbstractAccTest {
public UpdateTaskAccTest() { UpdateTaskAccTest() {
super(); super();
} }
@ -52,7 +52,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdatePrimaryObjectReferenceOfTask() void testUpdatePrimaryObjectReferenceOfTask()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, TaskNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, TaskNotFoundException,
ConcurrencyException, AttachmentPersistenceException { ConcurrencyException, AttachmentPersistenceException {
@ -81,7 +81,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete() void testThrowsExceptionIfMandatoryPrimaryObjectReferenceIsNotSetOrIncomplete()
throws NotAuthorizedException, ClassificationNotFoundException, TaskNotFoundException, ConcurrencyException, throws NotAuthorizedException, ClassificationNotFoundException, TaskNotFoundException, ConcurrencyException,
AttachmentPersistenceException { AttachmentPersistenceException {
@ -111,7 +111,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfTaskHasAlreadyBeenUpdated() void testThrowsExceptionIfTaskHasAlreadyBeenUpdated()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
TaskNotFoundException, ConcurrencyException, AttachmentPersistenceException { TaskNotFoundException, ConcurrencyException, AttachmentPersistenceException {
@ -134,7 +134,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdateClassificationOfTask() void testUpdateClassificationOfTask()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
@ -158,7 +158,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdateReadFlagOfTask() void testUpdateReadFlagOfTask()
throws TaskNotFoundException, NotAuthorizedException { throws TaskNotFoundException, NotAuthorizedException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -182,7 +182,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCustomPropertiesOfTask() void testCustomPropertiesOfTask()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -198,7 +198,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdateOfWorkbasketKeyWhatIsNotAllowed() void testUpdateOfWorkbasketKeyWhatIsNotAllowed()
throws NotAuthorizedException, throws NotAuthorizedException,
TaskNotFoundException { TaskNotFoundException {
@ -214,7 +214,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdateTasksByPorForUser1() throws InvalidArgumentException { void testUpdateTasksByPorForUser1() throws InvalidArgumentException {
ObjectReference por = new ObjectReference(); ObjectReference por = new ObjectReference();
por.setCompany("00"); por.setCompany("00");
por.setSystem("PASystem"); por.setSystem("PASystem");
@ -237,7 +237,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdateTasksByPor() void testUpdateTasksByPor()
throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException { throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException {
ObjectReference por = new ObjectReference(); ObjectReference por = new ObjectReference();
por.setCompany("00"); por.setCompany("00");
@ -269,7 +269,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
groupNames = {"group_1"} groupNames = {"group_1"}
) )
@Test @Test
public void testUpdateTasksById() void testUpdateTasksById()
throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException { throws InvalidArgumentException, TaskNotFoundException, NotAuthorizedException {
List<String> taskIds = Arrays.asList( List<String> taskIds = Arrays.asList(
"TKI:000000000000000000000000000000000008", "TKI:000000000000000000000000000000000008",
@ -299,7 +299,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdateCallbackInfoOfSimpleTask() void testUpdateCallbackInfoOfSimpleTask()
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
TaskAlreadyExistException, InvalidArgumentException, TaskNotFoundException, ConcurrencyException, TaskAlreadyExistException, InvalidArgumentException, TaskNotFoundException, ConcurrencyException,
AttachmentPersistenceException { AttachmentPersistenceException {

View File

@ -1,12 +1,12 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.Assert.fail;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
@ -44,13 +44,13 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for the usecase of adding/removing an attachment of a task and update the result correctly. * Acceptance test for the usecase of adding/removing an attachment of a task and update the result correctly.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class UpdateTaskAttachmentsAccTest extends AbstractAccTest { class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
private Task task; private Task task;
private Attachment attachment; private Attachment attachment;
private TaskService taskService; private TaskService taskService;
public UpdateTaskAttachmentsAccTest() { UpdateTaskAttachmentsAccTest() {
super(); super();
} }
@ -76,13 +76,13 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testAddNewAttachment() void testAddNewAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException { InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
int attachmentCount = task.getAttachments().size(); int attachmentCount = task.getAttachments().size();
assertTrue(task.getPriority() == 1); assertEquals(1, task.getPriority());
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(1)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
task.addAttachment(attachment); task.addAttachment(attachment);
task = taskService.updateTask(task); task = taskService.updateTask(task);
@ -96,15 +96,15 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getAttachments().get(0).getObjectReference().getType(), equalTo("ArchiveId")); assertThat(task.getAttachments().get(0).getObjectReference().getType(), equalTo("ArchiveId"));
assertThat(task.getAttachments().get(0).getObjectReference().getValue(), assertThat(task.getAttachments().get(0).getObjectReference().getValue(),
equalTo("12345678901234567890123456789012345678901234567890")); equalTo("12345678901234567890123456789012345678901234567890"));
assertTrue(task.getPriority() == 99); assertEquals(99, task.getPriority());
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(1)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
} }
@WithAccessId( @WithAccessId(
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testAddValidAttachmentTwice() void testAddValidAttachmentTwice()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
NotAuthorizedException, NotAuthorizedException,
AttachmentPersistenceException { AttachmentPersistenceException {
@ -127,7 +127,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testAddNewAttachmentTwiceWithoutTaskanaMethodWillThrowAttachmentPersistenceException() void testAddNewAttachmentTwiceWithoutTaskanaMethodWillThrowAttachmentPersistenceException()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
NotAuthorizedException, NotAuthorizedException,
AttachmentPersistenceException { AttachmentPersistenceException {
@ -151,7 +151,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testAddExistingAttachmentAgainWillUpdateWhenNotEqual() void testAddExistingAttachmentAgainWillUpdateWhenNotEqual()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException { InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
@ -176,19 +176,19 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
assertThat(task.getAttachments().size(), equalTo(attachmentCount)); assertThat(task.getAttachments().size(), equalTo(attachmentCount));
assertThat(task.getAttachments().get(0).getChannel(), equalTo(newChannel)); assertThat(task.getAttachments().get(0).getChannel(), equalTo(newChannel));
assertTrue(task.getPriority() == 999); assertEquals(999, task.getPriority());
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter
.initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now()); .initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
long calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 1); long calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 1);
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(calendarDays)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(calendarDays)));
} }
@WithAccessId( @WithAccessId(
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testAddExistingAttachmentAgainWillDoNothingWhenEqual() void testAddExistingAttachmentAgainWillDoNothingWhenEqual()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException { InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
@ -214,7 +214,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testAddAttachmentAsNullValueWillBeIgnored() void testAddAttachmentAsNullValueWillBeIgnored()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
@ -242,22 +242,22 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getAttachments().size(), equalTo(attachmentCount)); // locally, not persisted assertThat(task.getAttachments().size(), equalTo(attachmentCount)); // locally, not persisted
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
assertThat(task.getAttachments().size(), equalTo(attachmentCount)); // persisted values not changed assertThat(task.getAttachments().size(), equalTo(attachmentCount)); // persisted values not changed
assertTrue(task.getPriority() == 1); assertEquals(1, task.getPriority());
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(1)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
} }
@WithAccessId( @WithAccessId(
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testRemoveAttachment() void testRemoveAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
task.addAttachment(attachment); task.addAttachment(attachment);
task = taskService.updateTask(task); task = taskService.updateTask(task);
assertTrue(task.getPriority() == 99); assertEquals(99, task.getPriority());
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(1)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
int attachmentCount = task.getAttachments().size(); int attachmentCount = task.getAttachments().size();
Attachment attachmentToRemove = task.getAttachments().get(0); Attachment attachmentToRemove = task.getAttachments().get(0);
task.removeAttachment(attachmentToRemove.getId()); task.removeAttachment(attachmentToRemove.getId());
@ -265,15 +265,15 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
assertThat(task.getAttachments().size(), equalTo(attachmentCount - 1)); // locally, removed and not persisted assertThat(task.getAttachments().size(), equalTo(attachmentCount - 1)); // locally, removed and not persisted
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
assertThat(task.getAttachments().size(), equalTo(attachmentCount - 1)); // persisted, values removed assertThat(task.getAttachments().size(), equalTo(attachmentCount - 1)); // persisted, values removed
assertTrue(task.getPriority() == 1); assertEquals(1, task.getPriority());
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(1)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
} }
@WithAccessId( @WithAccessId(
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testRemoveAttachmentWithNullAndNotAddedId() void testRemoveAttachmentWithNullAndNotAddedId()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
@ -298,20 +298,20 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testUpdateAttachment() void testUpdateAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
NotAuthorizedException, AttachmentPersistenceException { NotAuthorizedException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
((TaskImpl) task).setAttachments(new ArrayList<>()); ((TaskImpl) task).setAttachments(new ArrayList<>());
task = taskService.updateTask(task); task = taskService.updateTask(task);
assertTrue(task.getPriority() == 1); assertEquals(1, task.getPriority());
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(1)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
Attachment attachment = this.attachment; Attachment attachment = this.attachment;
task.addAttachment(attachment); task.addAttachment(attachment);
task = taskService.updateTask(task); task = taskService.updateTask(task);
assertTrue(task.getPriority() == 99); assertEquals(99, task.getPriority());
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(1)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(1)));
int attachmentCount = task.getAttachments().size(); int attachmentCount = task.getAttachments().size();
@ -324,20 +324,20 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
assertThat(task.getAttachments().size(), equalTo(attachmentCount)); assertThat(task.getAttachments().size(), equalTo(attachmentCount));
assertThat(task.getAttachments().get(0).getChannel(), equalTo(newChannel)); assertThat(task.getAttachments().get(0).getChannel(), equalTo(newChannel));
assertTrue(task.getPriority() == 999); assertEquals(999, task.getPriority());
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter
.initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now()); .initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
long calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 1); long calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 1);
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(calendarDays)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(calendarDays)));
} }
@WithAccessId( @WithAccessId(
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void modifyExistingAttachment() void modifyExistingAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException { InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
@ -352,12 +352,12 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
task.addAttachment(attachment2); task.addAttachment(attachment2);
task = taskService.updateTask(task); task = taskService.updateTask(task);
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
assertTrue(task.getPriority() == 101); assertEquals(101, task.getPriority());
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter
.initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now()); .initialize(Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
long calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 1); long calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 1);
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(calendarDays)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(calendarDays)));
assertThat(task.getAttachments().size(), equalTo(2)); assertThat(task.getAttachments().size(), equalTo(2));
List<Attachment> attachments = task.getAttachments(); List<Attachment> attachments = task.getAttachments();
@ -392,11 +392,11 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
task.setClassificationKey("DOCTYPE_DEFAULT"); // Prio 99, SL P2000D task.setClassificationKey("DOCTYPE_DEFAULT"); // Prio 99, SL P2000D
task = taskService.updateTask(task); task = taskService.updateTask(task);
task = taskService.getTask(task.getId()); task = taskService.getTask(task.getId());
assertTrue(task.getPriority() == 99); assertEquals(99, task.getPriority());
calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 16); calendarDays = converter.convertWorkingDaysToDays(task.getDue(), 16);
assertTrue(task.getDue().equals(task.getPlanned().plus(Duration.ofDays(calendarDays)))); assertEquals(task.getDue(), task.getPlanned().plus(Duration.ofDays(calendarDays)));
rohrpostFound = false; rohrpostFound = false;
boolean faxFound = false; boolean faxFound = false;
@ -422,7 +422,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void replaceExistingAttachments() void replaceExistingAttachments()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException { InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {
setUpMethod(); setUpMethod();
@ -468,7 +468,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPrioDurationOfTaskFromAttachmentsAtUpdate() void testPrioDurationOfTaskFromAttachmentsAtUpdate()
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException, throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, TaskNotFoundException, ConcurrencyException, WorkbasketNotFoundException, TaskAlreadyExistException, TaskNotFoundException, ConcurrencyException,
AttachmentPersistenceException { AttachmentPersistenceException {
@ -503,20 +503,20 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
// assertNotNull(readTask.getAttachments().get(0).getClassification()); // assertNotNull(readTask.getAttachments().get(0).getClassification());
assertNotNull(readTask.getAttachments().get(0).getObjectReference()); assertNotNull(readTask.getAttachments().get(0).getObjectReference());
assertTrue(readTask.getPriority() == 99); assertEquals(99, readTask.getPriority());
DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter.initialize( DaysToWorkingDaysConverter converter = DaysToWorkingDaysConverter.initialize(
Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now()); Collections.singletonList(new TimeIntervalColumnHeader(0)), Instant.now());
long calendarDays = converter.convertWorkingDaysToDays(readTask.getPlanned(), 1); long calendarDays = converter.convertWorkingDaysToDays(readTask.getPlanned(), 1);
assertTrue(readTask.getDue().equals(readTask.getPlanned().plus(Duration.ofDays(calendarDays)))); assertEquals(readTask.getDue(), readTask.getPlanned().plus(Duration.ofDays(calendarDays)));
} }
@WithAccessId( @WithAccessId(
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testAddCustomAttributeToAttachment() void testAddCustomAttributeToAttachment()
throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException, throws TaskNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException { InvalidArgumentException, ConcurrencyException, AttachmentPersistenceException {

View File

@ -1,13 +1,13 @@
package acceptance.task; package acceptance.task;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.Assert.assertTrue;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
@ -36,9 +36,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "work on task" scenarios. This includes claim, complete... * Acceptance test for all "work on task" scenarios. This includes claim, complete...
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class WorkOnTaskAccTest extends AbstractAccTest { class WorkOnTaskAccTest extends AbstractAccTest {
public WorkOnTaskAccTest() { WorkOnTaskAccTest() {
super(); super();
} }
@ -46,7 +46,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testClaimTask() void testClaimTask()
throws NotAuthorizedException, TaskNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -68,7 +68,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfTaskIsAlreadyClaimed() void testThrowsExceptionIfTaskIsAlreadyClaimed()
throws NotAuthorizedException, TaskNotFoundException { throws NotAuthorizedException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000026"); Task task = taskService.getTask("TKI:000000000000000000000000000000000026");
@ -81,7 +81,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testClaimAlreadyClaimedByCallerTask() void testClaimAlreadyClaimedByCallerTask()
throws NotAuthorizedException, TaskNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -94,7 +94,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testForceClaimTaskWhichIsAlreadyClaimedByAnotherUser() void testForceClaimTaskWhichIsAlreadyClaimedByAnotherUser()
throws NotAuthorizedException, TaskNotFoundException { throws NotAuthorizedException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000028"); Task task = taskService.getTask("TKI:000000000000000000000000000000000028");
@ -107,7 +107,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCancelClaimTask() void testCancelClaimTask()
throws NotAuthorizedException, TaskNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -127,7 +127,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfCancelClaimOfTaskFromAnotherUser() void testThrowsExceptionIfCancelClaimOfTaskFromAnotherUser()
throws NotAuthorizedException, TaskNotFoundException { throws NotAuthorizedException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000030"); Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000030");
@ -140,7 +140,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testForceCancelClaimOfTaskFromAnotherUser() void testForceCancelClaimOfTaskFromAnotherUser()
throws NotAuthorizedException, TaskNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -160,7 +160,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCompleteTask() void testCompleteTask()
throws NotAuthorizedException, TaskNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
Instant before = Instant.now().minus(Duration.ofSeconds(3L)); Instant before = Instant.now().minus(Duration.ofSeconds(3L));
@ -184,7 +184,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testForceCompleteUnclaimedTask() void testForceCompleteUnclaimedTask()
throws NotAuthorizedException, TaskNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -205,7 +205,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testThrowsExceptionIfCompletingClaimedTaskOfAnotherUser() void testThrowsExceptionIfCompletingClaimedTaskOfAnotherUser()
throws NotAuthorizedException, TaskNotFoundException { throws NotAuthorizedException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000034"); Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000034");
@ -218,7 +218,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testForceCompleteClaimedTaskOfAnotherUser() void testForceCompleteClaimedTaskOfAnotherUser()
throws NotAuthorizedException, TaskNotFoundException, throws NotAuthorizedException, TaskNotFoundException,
InvalidStateException, InvalidOwnerException { InvalidStateException, InvalidOwnerException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -239,7 +239,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testBulkCompleteTasks() void testBulkCompleteTasks()
throws NotAuthorizedException, InvalidArgumentException, TaskNotFoundException { throws NotAuthorizedException, InvalidArgumentException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();
@ -262,7 +262,7 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testBulkDeleteTasksWithException() void testBulkDeleteTasksWithException()
throws InvalidArgumentException { throws InvalidArgumentException {
TaskService taskService = taskanaEngine.getTaskService(); TaskService taskService = taskanaEngine.getTaskService();

View File

@ -1,8 +1,8 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List; import java.util.List;
@ -28,9 +28,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "create workbasket" scenarios. * Acceptance test for all "create workbasket" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class CreateWorkbasketAccTest extends AbstractAccTest { class CreateWorkbasketAccTest extends AbstractAccTest {
public CreateWorkbasketAccTest() { CreateWorkbasketAccTest() {
super(); super();
} }
@ -38,7 +38,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testCreateWorkbasket() void testCreateWorkbasket()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException { InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -68,7 +68,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "dummy") userName = "dummy")
@Test @Test
public void testCreateWorkbasketNotAuthorized() { void testCreateWorkbasketNotAuthorized() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.newWorkbasket("key3", "DOMAIN_A"); Workbasket workbasket = workbasketService.newWorkbasket("key3", "DOMAIN_A");
@ -85,7 +85,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testCreateWorkbasketWithInvalidDomain() { void testCreateWorkbasketWithInvalidDomain() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.newWorkbasket("key3", "UNKNOWN_DOMAIN"); Workbasket workbasket = workbasketService.newWorkbasket("key3", "UNKNOWN_DOMAIN");
@ -100,7 +100,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testCreateWorkbasketWithMissingRequiredField() void testCreateWorkbasketWithMissingRequiredField()
throws NotAuthorizedException, WorkbasketAlreadyExistException, throws NotAuthorizedException, WorkbasketAlreadyExistException,
DomainNotFoundException { DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -154,7 +154,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testThrowsExceptionIfWorkbasketWithCaseInsensitiveSameKeyDomainIsCreated() void testThrowsExceptionIfWorkbasketWithCaseInsensitiveSameKeyDomainIsCreated()
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException, throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
DomainNotFoundException { DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -176,7 +176,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testCreateWorkbasketWithAlreadyExistingKeyAndDomainAndEmptyIdUpdatesOlderWorkbasket() void testCreateWorkbasketWithAlreadyExistingKeyAndDomainAndEmptyIdUpdatesOlderWorkbasket()
throws DomainNotFoundException, InvalidWorkbasketException, throws DomainNotFoundException, InvalidWorkbasketException,
NotAuthorizedException, WorkbasketAlreadyExistException { NotAuthorizedException, WorkbasketAlreadyExistException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -199,7 +199,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_2", userName = "user_1_2",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testWorkbasketAccessItemSetName() void testWorkbasketAccessItemSetName()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException { InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();

View File

@ -1,10 +1,10 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.Assert.assertTrue;
import java.util.List; import java.util.List;
@ -50,7 +50,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
@WithAccessId(userName = "admin", groupNames = {"businessadmin"}) @WithAccessId(userName = "admin", groupNames = {"businessadmin"})
@Test @Test
void testDeleteWorkbasket() void testDeleteWorkbasket()
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException { throws WorkbasketNotFoundException, NotAuthorizedException {
Workbasket wb = workbasketService.getWorkbasket("USER_2_2", "DOMAIN_A"); Workbasket wb = workbasketService.getWorkbasket("USER_2_2", "DOMAIN_A");
Assertions.assertThrows(WorkbasketNotFoundException.class, () -> { Assertions.assertThrows(WorkbasketNotFoundException.class, () -> {
@ -81,7 +81,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
@WithAccessId(userName = "user_1_1", groupNames = {"teamlead_1", "group_1", "businessadmin"}) @WithAccessId(userName = "user_1_1", groupNames = {"teamlead_1", "group_1", "businessadmin"})
@Test @Test
void testDeleteWorkbasketAlsoAsDistributionTarget() void testDeleteWorkbasketAlsoAsDistributionTarget()
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException { throws WorkbasketNotFoundException, NotAuthorizedException {
Workbasket wb = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A"); Workbasket wb = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A");
int distTargets = workbasketService.getDistributionTargets("WBI:100000000000000000000000000000000001") int distTargets = workbasketService.getDistributionTargets("WBI:100000000000000000000000000000000001")
.size(); .size();
@ -102,8 +102,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
void testDeleteWorkbasketWithNullOrEmptyParam() void testDeleteWorkbasketWithNullOrEmptyParam() {
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException {
// Test Null-Value // Test Null-Value
Assertions.assertThrows(InvalidArgumentException.class, () -> Assertions.assertThrows(InvalidArgumentException.class, () ->
workbasketService.deleteWorkbasket(null), workbasketService.deleteWorkbasket(null),
@ -129,7 +128,7 @@ class DeleteWorkbasketAccTest extends AbstractAccTest {
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
void testDeleteWorkbasketWhichIsUsed() void testDeleteWorkbasketWhichIsUsed()
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException, InvalidArgumentException { throws WorkbasketNotFoundException, NotAuthorizedException {
Workbasket wb = workbasketService.getWorkbasket("USER_1_2", "DOMAIN_A"); // all rights, DOMAIN_A with Tasks Workbasket wb = workbasketService.getWorkbasket("USER_1_2", "DOMAIN_A"); // all rights, DOMAIN_A with Tasks
Assertions.assertThrows(WorkbasketInUseException.class, () -> Assertions.assertThrows(WorkbasketInUseException.class, () ->
workbasketService.deleteWorkbasket(wb.getId())); workbasketService.deleteWorkbasket(wb.getId()));

View File

@ -1,7 +1,7 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
@ -27,9 +27,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "get workbasket" scenarios. * Acceptance test for all "get workbasket" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class DistributionTargetsAccTest extends AbstractAccTest { class DistributionTargetsAccTest extends AbstractAccTest {
public DistributionTargetsAccTest() { DistributionTargetsAccTest() {
super(); super();
} }
@ -37,7 +37,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"teamlead_1"}) groupNames = {"teamlead_1"})
@Test @Test
public void testGetDistributionTargetsSucceedsById() throws NotAuthorizedException, WorkbasketNotFoundException { void testGetDistributionTargetsSucceedsById() throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketSummary workbasketSummary = workbasketService.createWorkbasketQuery() WorkbasketSummary workbasketSummary = workbasketService.createWorkbasketQuery()
.keyIn("GPK_KSC") .keyIn("GPK_KSC")
@ -61,7 +61,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"teamlead_1"}) groupNames = {"teamlead_1"})
@Test @Test
public void testGetDistributionTargetsSucceeds() throws NotAuthorizedException, WorkbasketNotFoundException { void testGetDistributionTargetsSucceeds() throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketSummary workbasketSummary = workbasketService.createWorkbasketQuery() WorkbasketSummary workbasketSummary = workbasketService.createWorkbasketQuery()
.keyIn("GPK_KSC") .keyIn("GPK_KSC")
@ -85,7 +85,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"teamlead_1", "group_1", "group_2", "businessadmin"}) groupNames = {"teamlead_1", "group_1", "group_2", "businessadmin"})
@Test @Test
public void testDistributionTargetCallsWithNonExistingWorkbaskets() void testDistributionTargetCallsWithNonExistingWorkbaskets()
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
String existingWb = "WBI:100000000000000000000000000000000001"; String existingWb = "WBI:100000000000000000000000000000000001";
@ -112,23 +112,21 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "user_3_1", groupNames = {"group_1"}) userName = "user_3_1", groupNames = {"group_1"})
@Test @Test
public void testDistributionTargetCallsFailWithNotAuthorizedException() void testDistributionTargetCallsFailWithNotAuthorizedException() {
throws WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
String existingWb = "WBI:100000000000000000000000000000000001"; String existingWb = "WBI:100000000000000000000000000000000001";
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
workbasketService.getDistributionTargets(existingWb)); workbasketService.getDistributionTargets(existingWb));
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
workbasketService.setDistributionTargets(existingWb, Arrays.asList("WBI:100000000000000000000000000000000002"))); workbasketService.setDistributionTargets(existingWb,
Arrays.asList("WBI:100000000000000000000000000000000002")));
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
workbasketService.addDistributionTarget(existingWb, workbasketService.addDistributionTarget(existingWb,
"WBI:100000000000000000000000000000000002")); "WBI:100000000000000000000000000000000002"));
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
workbasketService.removeDistributionTarget(existingWb, workbasketService.removeDistributionTarget(existingWb,
"WBI:100000000000000000000000000000000002")); "WBI:100000000000000000000000000000000002"));
@ -139,7 +137,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_2_2", userName = "user_2_2",
groupNames = {"group_1", "group_2", "businessadmin"}) groupNames = {"group_1", "group_2", "businessadmin"})
@Test @Test
public void testAddAndRemoveDistributionTargets() void testAddAndRemoveDistributionTargets()
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A"); Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A");
@ -170,7 +168,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_2_2", userName = "user_2_2",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testAddAndRemoveDistributionTargetsOnWorkbasketWithoutReadPermission() void testAddAndRemoveDistributionTargetsOnWorkbasketWithoutReadPermission()
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("GPK_B_KSC_2", "DOMAIN_B"); Workbasket workbasket = workbasketService.getWorkbasket("GPK_B_KSC_2", "DOMAIN_B");
@ -196,7 +194,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_2_2", userName = "user_2_2",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testAddDistributionTargetsFailsNotAuthorized() void testAddDistributionTargetsFailsNotAuthorized()
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A"); Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A");
@ -216,7 +214,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_2_2", userName = "user_2_2",
groupNames = {"group_1", "group_2", "businessadmin"}) groupNames = {"group_1", "group_2", "businessadmin"})
@Test @Test
public void testSetDistributionTargets() void testSetDistributionTargets()
throws NotAuthorizedException, WorkbasketNotFoundException, SQLException, IOException { throws NotAuthorizedException, WorkbasketNotFoundException, SQLException, IOException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -248,7 +246,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_2_2", userName = "user_2_2",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testGetDistributionSourcesById() void testGetDistributionSourcesById()
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -269,7 +267,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_2_2", userName = "user_2_2",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testGetDistributionSourcesByKeyDomain() void testGetDistributionSourcesByKeyDomain()
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -289,7 +287,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "henry", userName = "henry",
groupNames = {"undefinedgroup"}) groupNames = {"undefinedgroup"})
@Test @Test
public void testQueryDistributionSourcesThrowsNotAuthorized() { void testQueryDistributionSourcesThrowsNotAuthorized() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -302,7 +300,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
userName = "user_2_2", userName = "user_2_2",
groupNames = {"group_1", "group_2"}) groupNames = {"group_1", "group_2"})
@Test @Test
public void testQueryDistributionSourcesThrowsWorkbasketNotFound() { void testQueryDistributionSourcesThrowsWorkbasketNotFound() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Assertions.assertThrows(WorkbasketNotFoundException.class, () -> workbasketService Assertions.assertThrows(WorkbasketNotFoundException.class, () -> workbasketService

View File

@ -1,7 +1,7 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List; import java.util.List;
@ -24,9 +24,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "get workbasket" scenarios. * Acceptance test for all "get workbasket" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class GetWorkbasketAccTest extends AbstractAccTest { class GetWorkbasketAccTest extends AbstractAccTest {
public GetWorkbasketAccTest() { GetWorkbasketAccTest() {
super(); super();
} }
@ -34,7 +34,7 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetWorkbasketById() void testGetWorkbasketById()
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -60,7 +60,7 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetWorkbasketByKeyAndDomain() void testGetWorkbasketByKeyAndDomain()
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -85,7 +85,7 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetWorkbasketPermissions() { void testGetWorkbasketPermissions() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketPermission> permissions = workbasketService List<WorkbasketPermission> permissions = workbasketService
.getPermissionsForWorkbasket("WBI:100000000000000000000000000000000007"); .getPermissionsForWorkbasket("WBI:100000000000000000000000000000000007");
@ -101,7 +101,7 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetWorkbasketPermissionsForInvalidWorkbasketId() { void testGetWorkbasketPermissionsForInvalidWorkbasketId() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketPermission> permissions = workbasketService List<WorkbasketPermission> permissions = workbasketService
.getPermissionsForWorkbasket("WBI:invalid"); .getPermissionsForWorkbasket("WBI:invalid");
@ -113,7 +113,7 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetWorkbasketAsSummary() void testGetWorkbasketAsSummary()
throws NotAuthorizedException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
@ -138,14 +138,14 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
} }
@Test @Test
public void testThrowsExceptionIfIdIsInvalid() { void testThrowsExceptionIfIdIsInvalid() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Assertions.assertThrows(WorkbasketNotFoundException.class, () -> Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
workbasketService.getWorkbasket("INVALID_ID")); workbasketService.getWorkbasket("INVALID_ID"));
} }
@Test @Test
public void testThrowsExceptionIfKeyOrDomainIsInvalid() { void testThrowsExceptionIfKeyOrDomainIsInvalid() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Assertions.assertThrows(WorkbasketNotFoundException.class, () -> Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
@ -153,14 +153,14 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
} }
@Test @Test
public void testGetByIdNotAuthorized() { void testGetByIdNotAuthorized() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
workbasketService.getWorkbasket("WBI:100000000000000000000000000000000001")); workbasketService.getWorkbasket("WBI:100000000000000000000000000000000001"));
} }
@Test @Test
public void testGetByKeyDomainNotAuthorized() { void testGetByKeyDomainNotAuthorized() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A")); workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A"));
@ -170,7 +170,7 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetWorkbasketByIdNotExisting() { void testGetWorkbasketByIdNotExisting() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Assertions.assertThrows(WorkbasketNotFoundException.class, () -> Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
workbasketService.getWorkbasket("NOT EXISTING ID")); workbasketService.getWorkbasket("NOT EXISTING ID"));

View File

@ -1,8 +1,8 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static pro.taskana.WorkbasketQueryColumnName.NAME; import static pro.taskana.WorkbasketQueryColumnName.NAME;
import java.util.ArrayList; import java.util.ArrayList;
@ -28,12 +28,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "query workbasket by permission" scenarios. * Acceptance test for all "query workbasket by permission" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryWorkbasketAccTest extends AbstractAccTest { class QueryWorkbasketAccTest extends AbstractAccTest {
private static SortDirection asc = SortDirection.ASCENDING; private static SortDirection asc = SortDirection.ASCENDING;
private static SortDirection desc = SortDirection.DESCENDING; private static SortDirection desc = SortDirection.DESCENDING;
public QueryWorkbasketAccTest() { QueryWorkbasketAccTest() {
super(); super();
} }
@ -41,7 +41,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1_1"}) groupNames = {"group_1_1"})
@Test @Test
public void testQueryAllForUserMultipleTimes() { void testQueryAllForUserMultipleTimes() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketQuery query = workbasketService.createWorkbasketQuery(); WorkbasketQuery query = workbasketService.createWorkbasketQuery();
long count = query.count(); long count = query.count();
@ -58,11 +58,11 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllForBusinessAdminMultipleTimes() { void testQueryAllForBusinessAdminMultipleTimes() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketQuery query = workbasketService.createWorkbasketQuery(); WorkbasketQuery query = workbasketService.createWorkbasketQuery();
long count = query.count(); long count = query.count();
assertTrue(count == 25); assertEquals(25, count);
List<WorkbasketSummary> workbaskets = query.list(); List<WorkbasketSummary> workbaskets = query.list();
assertNotNull(workbaskets); assertNotNull(workbaskets);
assertEquals(count, workbaskets.size()); assertEquals(count, workbaskets.size());
@ -75,11 +75,11 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"admin"}) groupNames = {"admin"})
@Test @Test
public void testQueryAllForAdminMultipleTimes() { void testQueryAllForAdminMultipleTimes() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketQuery query = workbasketService.createWorkbasketQuery(); WorkbasketQuery query = workbasketService.createWorkbasketQuery();
long count = query.count(); long count = query.count();
assertTrue(count == 25); assertEquals(25, count);
List<WorkbasketSummary> workbaskets = query.list(); List<WorkbasketSummary> workbaskets = query.list();
assertNotNull(workbaskets); assertNotNull(workbaskets);
assertEquals(count, workbaskets.size()); assertEquals(count, workbaskets.size());
@ -92,7 +92,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketValuesForColumnName() { void testQueryWorkbasketValuesForColumnName() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<String> columnValueList = workbasketService.createWorkbasketQuery() List<String> columnValueList = workbasketService.createWorkbasketQuery()
.listValues(NAME, null); .listValues(NAME, null);
@ -111,7 +111,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByDomain() { void testQueryWorkbasketByDomain() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_B") .domainIn("DOMAIN_B")
@ -123,7 +123,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByDomainAndType() { void testQueryWorkbasketByDomainAndType() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -136,7 +136,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByName() { void testQueryWorkbasketByName() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameIn("Gruppenpostkorb KSC") .nameIn("Gruppenpostkorb KSC")
@ -149,7 +149,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByNameStartsWith() { void testQueryWorkbasketByNameStartsWith() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Gruppenpostkorb KSC%") .nameLike("%Gruppenpostkorb KSC%")
@ -161,7 +161,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByNameContains() { void testQueryWorkbasketByNameContains() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Teamlead%", "%Gruppenpostkorb KSC%") .nameLike("%Teamlead%", "%Gruppenpostkorb KSC%")
@ -173,7 +173,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByNameContainsCaseInsensitive() { void testQueryWorkbasketByNameContainsCaseInsensitive() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%TEAMLEAD%") .nameLike("%TEAMLEAD%")
@ -185,7 +185,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByDescription() { void testQueryWorkbasketByDescription() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.descriptionLike("%ppk%", "%gruppen%") .descriptionLike("%ppk%", "%gruppen%")
@ -199,7 +199,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByOwnerLike() { void testQueryWorkbasketByOwnerLike() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.ownerLike("%an%", "%te%") .ownerLike("%an%", "%te%")
@ -212,7 +212,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByKey() { void testQueryWorkbasketByKey() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyIn("GPK_KSC") .keyIn("GPK_KSC")
@ -224,7 +224,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByMultipleKeys() { void testQueryWorkbasketByMultipleKeys() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyIn("GPK_KSC_1", "GPK_KSC") .keyIn("GPK_KSC_1", "GPK_KSC")
@ -236,7 +236,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByMultipleKeysWithUnknownKey() { void testQueryWorkbasketByMultipleKeysWithUnknownKey() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyIn("GPK_KSC_1", "GPK_Ksc", "GPK_KSC_3") .keyIn("GPK_KSC_1", "GPK_Ksc", "GPK_KSC_3")
@ -248,7 +248,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByKeyContains() { void testQueryWorkbasketByKeyContains() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyLike("%KSC%") .keyLike("%KSC%")
@ -260,7 +260,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByKeyContainsIgnoreCase() { void testQueryWorkbasketByKeyContainsIgnoreCase() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyLike("%kSc%") .keyLike("%kSc%")
@ -272,7 +272,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByKeyOrNameContainsIgnoreCase() { void testQueryWorkbasketByKeyOrNameContainsIgnoreCase() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.keyOrNameLike("%kSc%") .keyOrNameLike("%kSc%")
@ -284,7 +284,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByNameStartsWithSortedByNameAscending() { void testQueryWorkbasketByNameStartsWithSortedByNameAscending() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Gruppenpostkorb KSC%") .nameLike("%Gruppenpostkorb KSC%")
@ -308,7 +308,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "max") userName = "max")
@Test @Test
public void testQueryWorkbasketByNameStartsWithSortedByNameDescending() { void testQueryWorkbasketByNameStartsWithSortedByNameDescending() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("basxet%") .nameLike("basxet%")
@ -329,7 +329,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "max") userName = "max")
@Test @Test
public void testQueryWorkbasketByNameStartsWithSortedByKeyAscending() { void testQueryWorkbasketByNameStartsWithSortedByKeyAscending() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("basxet%") .nameLike("basxet%")
@ -350,7 +350,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "max") userName = "max")
@Test @Test
public void testQueryWorkbasketByNameStartsWithSortedByKeyDescending() { void testQueryWorkbasketByNameStartsWithSortedByKeyDescending() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("basxet%") .nameLike("basxet%")
@ -372,7 +372,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByCreated() { void testQueryWorkbasketByCreated() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.createdWithin(todaysInterval()) .createdWithin(todaysInterval())
@ -384,7 +384,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryWorkbasketByModified() { void testQueryWorkbasketByModified() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.modifiedWithin(todaysInterval()) .modifiedWithin(todaysInterval())
@ -396,7 +396,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "unknown", userName = "unknown",
groupNames = "admin") groupNames = "admin")
@Test @Test
public void testQueryWorkbasketByAdmin() void testQueryWorkbasketByAdmin()
throws NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
@ -428,12 +428,12 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = "group_1") groupNames = "group_1")
@Test @Test
public void testQueryWorkbasketByDomainLike() { void testQueryWorkbasketByDomainLike() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainLike("DOMAIN_%").orderByDomain(asc).list(); .domainLike("DOMAIN_%").orderByDomain(asc).list();
ArrayList<String> expectedIds = new ArrayList<String>( ArrayList<String> expectedIds = new ArrayList<>(
Arrays.asList("WBI:100000000000000000000000000000000001", "WBI:100000000000000000000000000000000002", Arrays.asList("WBI:100000000000000000000000000000000001", "WBI:100000000000000000000000000000000002",
"WBI:100000000000000000000000000000000004", "WBI:100000000000000000000000000000000005", "WBI:100000000000000000000000000000000004", "WBI:100000000000000000000000000000000005",
"WBI:100000000000000000000000000000000006", "WBI:100000000000000000000000000000000007", "WBI:100000000000000000000000000000000006", "WBI:100000000000000000000000000000000007",
@ -449,7 +449,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "admin", userName = "admin",
groupNames = "group_1") groupNames = "group_1")
@Test @Test
public void testQueryWorkbasketByOwnerInOrderByDomainDesc() { void testQueryWorkbasketByOwnerInOrderByDomainDesc() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.ownerIn("owner0815").orderByDomain(desc).list(); .ownerIn("owner0815").orderByDomain(desc).list();
@ -463,7 +463,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryForCustom1In() { void testQueryForCustom1In() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.custom1In("ABCQVW").list(); .custom1In("ABCQVW").list();
@ -475,7 +475,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForCustom1Like() { void testQueryForCustom1Like() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.custom1Like("custo%") .custom1Like("custo%")
@ -486,7 +486,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForCustom2In() { void testQueryForCustom2In() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.custom2In("cust2", "custom2") .custom2In("cust2", "custom2")
@ -497,7 +497,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForCustom2Like() { void testQueryForCustom2Like() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.custom2Like("cusTo%") .custom2Like("cusTo%")
@ -508,7 +508,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForCustom3In() { void testQueryForCustom3In() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.custom3In("custom3") .custom3In("custom3")
@ -519,7 +519,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForCustom3Like() { void testQueryForCustom3Like() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.custom3Like("cu%") .custom3Like("cu%")
@ -530,7 +530,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForCustom4In() { void testQueryForCustom4In() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.custom4In("custom4", "team") .custom4In("custom4", "team")
@ -541,7 +541,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForCustom4Like() { void testQueryForCustom4Like() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.custom4Like("%u%") .custom4Like("%u%")
@ -552,7 +552,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrgLevl1In() { void testQueryForOrgLevl1In() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orgLevel1In("orgl1", "") .orgLevel1In("orgl1", "")
@ -563,7 +563,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrgLevel1Like() { void testQueryForOrgLevel1Like() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orgLevel1Like("%1") .orgLevel1Like("%1")
@ -574,7 +574,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrgLevel2In() { void testQueryForOrgLevel2In() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orgLevel2In("abteilung") .orgLevel2In("abteilung")
@ -585,7 +585,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrgLevel2Like() { void testQueryForOrgLevel2Like() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orgLevel2Like("ab%") .orgLevel2Like("ab%")
@ -596,7 +596,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrgLevel3In() { void testQueryForOrgLevel3In() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orgLevel3In("orgl3") .orgLevel3In("orgl3")
@ -607,7 +607,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrgLevel3Like() { void testQueryForOrgLevel3Like() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orgLevel3Like("org%") .orgLevel3Like("org%")
@ -618,7 +618,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrgLevel4In() { void testQueryForOrgLevel4In() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orgLevel4In("team", "orgl4") .orgLevel4In("team", "orgl4")
@ -629,7 +629,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrgLevel4Like() { void testQueryForOrgLevel4Like() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orgLevel4Like("%") .orgLevel4Like("%")
@ -640,7 +640,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrderByOrgLevel1Desc() { void testQueryForOrderByOrgLevel1Desc() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByOrgLevel1(desc) .orderByOrgLevel1(desc)
@ -651,7 +651,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrderByOrgLevel2Asc() { void testQueryForOrderByOrgLevel2Asc() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByOrgLevel2(asc) .orderByOrgLevel2(asc)
@ -662,7 +662,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrderByOrgLevel3Desc() { void testQueryForOrderByOrgLevel3Desc() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByOrgLevel3(desc) .orderByOrgLevel3(desc)
@ -673,7 +673,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrderByOrgLevel4Asc() { void testQueryForOrderByOrgLevel4Asc() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByOrgLevel4(asc) .orderByOrgLevel4(asc)
@ -684,7 +684,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrderByCustom1Asc() { void testQueryForOrderByCustom1Asc() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByCustom1(asc) .orderByCustom1(asc)
@ -695,7 +695,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrderByCustom2Desc() { void testQueryForOrderByCustom2Desc() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByCustom2(desc) .orderByCustom2(desc)
@ -706,7 +706,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrderByCustom3Asc() { void testQueryForOrderByCustom3Asc() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByCustom3(asc) .orderByCustom3(asc)
@ -717,7 +717,7 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForOrderByCustom4Desc() { void testQueryForOrderByCustom4Desc() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.orderByCustom4(desc) .orderByCustom4(desc)

View File

@ -1,8 +1,8 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static pro.taskana.AccessItemQueryColumnName.ACCESS_ID; import static pro.taskana.AccessItemQueryColumnName.ACCESS_ID;
import static pro.taskana.AccessItemQueryColumnName.WORKBASKET_ID; import static pro.taskana.AccessItemQueryColumnName.WORKBASKET_ID;
import static pro.taskana.AccessItemQueryColumnName.WORKBASKET_KEY; import static pro.taskana.AccessItemQueryColumnName.WORKBASKET_KEY;
@ -10,7 +10,6 @@ import static pro.taskana.AccessItemQueryColumnName.WORKBASKET_KEY;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -28,9 +27,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "query access items for workbaskets" scenarios. * Acceptance test for all "query access items for workbaskets" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest { class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
public QueryWorkbasketAccessItemsAccTest() { QueryWorkbasketAccessItemsAccTest() {
super(); super();
} }
@ -38,7 +37,7 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryWorkbasketAccessItemValuesForColumnName() throws NotAuthorizedException { void testQueryWorkbasketAccessItemValuesForColumnName() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<String> columnValueList = workbasketService.createWorkbasketAccessItemQuery() List<String> columnValueList = workbasketService.createWorkbasketAccessItemQuery()
.listValues(WORKBASKET_ID, null); .listValues(WORKBASKET_ID, null);
@ -63,20 +62,19 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsForAccessIds() void testQueryAccessItemsForAccessIds()
throws NotAuthorizedException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.accessIdIn("user_1_1", "group_1") .accessIdIn("user_1_1", "group_1")
.list(); .list();
Assert.assertEquals(8L, results.size()); assertEquals(8L, results.size());
} }
@WithAccessId( @WithAccessId(
userName = "dummy") userName = "dummy")
@Test @Test
public void testQueryAccessItemsForAccessIdsNotAuthorized() void testQueryAccessItemsForAccessIdsNotAuthorized() {
throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -89,7 +87,7 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsForAccessIdsOrderedDescending() void testQueryAccessItemsForAccessIdsOrderedDescending()
throws NotAuthorizedException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
WorkbasketAccessItemQuery query = workbasketService.createWorkbasketAccessItemQuery() WorkbasketAccessItemQuery query = workbasketService.createWorkbasketAccessItemQuery()
@ -98,52 +96,52 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
.orderByWorkbasketId(SortDirection.DESCENDING); .orderByWorkbasketId(SortDirection.DESCENDING);
List<WorkbasketAccessItem> results = query.list(); List<WorkbasketAccessItem> results = query.list();
long count = query.count(); long count = query.count();
Assert.assertEquals(8L, results.size()); assertEquals(8L, results.size());
Assert.assertEquals(results.size(), count); assertEquals(results.size(), count);
Assert.assertEquals("WAI:100000000000000000000000000000000003", results.get(0).getId()); assertEquals("WAI:100000000000000000000000000000000003", results.get(0).getId());
} }
@WithAccessId( @WithAccessId(
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsForAccessIdsAndWorkbasketKey() void testQueryAccessItemsForAccessIdsAndWorkbasketKey()
throws NotAuthorizedException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.accessIdIn("user_1_1", "group_1") .accessIdIn("user_1_1", "group_1")
.workbasketIdIn("WBI:100000000000000000000000000000000006", "WBI:100000000000000000000000000000000002") .workbasketIdIn("WBI:100000000000000000000000000000000006", "WBI:100000000000000000000000000000000002")
.list(); .list();
Assert.assertEquals(3L, results.size()); assertEquals(3L, results.size());
} }
@WithAccessId( @WithAccessId(
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsForAccessIdsWorkbasketKeyLike() void testQueryAccessItemsForAccessIdsWorkbasketKeyLike()
throws NotAuthorizedException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.workbasketKeyLike("GPK_KSC%") .workbasketKeyLike("GPK_KSC%")
.list(); .list();
Assert.assertEquals(4L, results.size()); assertEquals(4L, results.size());
} }
@WithAccessId( @WithAccessId(
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsForAccessIdsWorkbasketKeyLikeAndOrderAsc() void testQueryAccessItemsForAccessIdsWorkbasketKeyLikeAndOrderAsc()
throws NotAuthorizedException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.workbasketKeyLike("GPK_KSC%") .workbasketKeyLike("GPK_KSC%")
.orderByWorkbasketKey(SortDirection.ASCENDING) .orderByWorkbasketKey(SortDirection.ASCENDING)
.list(); .list();
Assert.assertEquals(4L, results.size()); assertEquals(4L, results.size());
Assert.assertEquals("GPK_KSC", results.get(0).getWorkbasketKey()); assertEquals("GPK_KSC", results.get(0).getWorkbasketKey());
Assert.assertEquals("GPK_KSC_2", results.get(3).getWorkbasketKey()); assertEquals("GPK_KSC_2", results.get(3).getWorkbasketKey());
} }
@ -151,20 +149,20 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsByWorkbasketKey() void testQueryAccessItemsByWorkbasketKey()
throws NotAuthorizedException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.workbasketIdIn("WBI:100000000000000000000000000000000006") .workbasketIdIn("WBI:100000000000000000000000000000000006")
.list(); .list();
Assert.assertEquals(3L, results.size()); assertEquals(3L, results.size());
} }
@WithAccessId( @WithAccessId(
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAccessItemsByWorkbasketKeyOrderedDescending() void testQueryAccessItemsByWorkbasketKeyOrderedDescending()
throws NotAuthorizedException { throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
@ -172,14 +170,14 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
.orderByWorkbasketId(SortDirection.DESCENDING) .orderByWorkbasketId(SortDirection.DESCENDING)
.orderByAccessId(SortDirection.ASCENDING) .orderByAccessId(SortDirection.ASCENDING)
.list(); .list();
Assert.assertEquals(3L, results.size()); assertEquals(3L, results.size());
Assert.assertEquals("WAI:100000000000000000000000000000000009", results.get(0).getId()); assertEquals("WAI:100000000000000000000000000000000009", results.get(0).getId());
} }
@WithAccessId( @WithAccessId(
userName = "admin") userName = "admin")
@Test @Test
public void testQueryForIdIn() throws NotAuthorizedException { void testQueryForIdIn() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
String[] expectedIds = {"WAI:100000000000000000000000000000000001", String[] expectedIds = {"WAI:100000000000000000000000000000000001",
"WAI:100000000000000000000000000000000015", "WAI:100000000000000000000000000000000015",
@ -195,7 +193,7 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
@WithAccessId( @WithAccessId(
userName = "businessadmin") userName = "businessadmin")
@Test @Test
public void testQueryForOrderById() throws NotAuthorizedException { void testQueryForOrderById() throws NotAuthorizedException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery() List<WorkbasketAccessItem> results = workbasketService.createWorkbasketAccessItemQuery()
.orderById(SortDirection.ASCENDING) .orderById(SortDirection.ASCENDING)

View File

@ -1,10 +1,12 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -24,12 +26,12 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "query workbasket by permission" scenarios. * Acceptance test for all "query workbasket by permission" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest { class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
private static SortDirection asc = SortDirection.ASCENDING; private static SortDirection asc = SortDirection.ASCENDING;
private static SortDirection desc = SortDirection.DESCENDING; private static SortDirection desc = SortDirection.DESCENDING;
public QueryWorkbasketByPermissionAccTest() { QueryWorkbasketByPermissionAccTest() {
super(); super();
} }
@ -37,20 +39,20 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferTargetsForUser() void testQueryAllTransferTargetsForUser()
throws NotAuthorizedException, InvalidArgumentException { throws NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1") .accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1")
.list(); .list();
Assert.assertEquals(1, results.size()); assertEquals(1, results.size());
Assert.assertEquals("USER_1_1", results.get(0).getKey()); assertEquals("USER_1_1", results.get(0).getKey());
} }
@WithAccessId( @WithAccessId(
userName = "dummy") userName = "dummy")
@Test @Test
public void testQueryAllTransferTargetsForUserNotAuthorized() { void testQueryAllTransferTargetsForUserNotAuthorized() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Assertions.assertThrows(NotAuthorizedException.class, () -> Assertions.assertThrows(NotAuthorizedException.class, () ->
@ -63,35 +65,35 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferTargetsForUserAndGroup() void testQueryAllTransferTargetsForUserAndGroup()
throws NotAuthorizedException, InvalidArgumentException, SystemException { throws NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1") .accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1")
.list(); .list();
Assert.assertEquals(6, results.size()); assertEquals(6, results.size());
} }
@WithAccessId( @WithAccessId(
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferTargetsForUserAndGroupSortedByNameAscending() void testQueryAllTransferTargetsForUserAndGroupSortedByNameAscending()
throws NotAuthorizedException, InvalidArgumentException, SystemException { throws NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1") .accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1", "group_1")
.orderByName(asc) .orderByName(asc)
.list(); .list();
Assert.assertEquals(6, results.size()); assertEquals(6, results.size());
Assert.assertEquals("GPK_KSC_1", results.get(0).getKey()); assertEquals("GPK_KSC_1", results.get(0).getKey());
} }
@WithAccessId( @WithAccessId(
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferTargetsForUserAndGroupSortedByNameDescending() void testQueryAllTransferTargetsForUserAndGroupSortedByNameDescending()
throws NotAuthorizedException, InvalidArgumentException, SystemException { throws NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
@ -99,24 +101,24 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
.orderByName(desc) .orderByName(desc)
.orderByKey(asc) .orderByKey(asc)
.list(); .list();
Assert.assertEquals(6, results.size()); assertEquals(6, results.size());
Assert.assertEquals("USER_2_2", results.get(0).getKey()); assertEquals("USER_2_2", results.get(0).getKey());
} }
@WithAccessId( @WithAccessId(
userName = "dummy", userName = "dummy",
groupNames = {"businessadmin"}) groupNames = {"businessadmin"})
@Test @Test
public void testQueryAllTransferSourcesForUserAndGroup() void testQueryAllTransferSourcesForUserAndGroup()
throws NotAuthorizedException, InvalidArgumentException, SystemException { throws NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePermission(WorkbasketPermission.DISTRIBUTE, "user_1_1", "group_1") .accessIdsHavePermission(WorkbasketPermission.DISTRIBUTE, "user_1_1", "group_1")
.list(); .list();
Assert.assertEquals(2, results.size()); assertEquals(2, results.size());
List<String> keys = new ArrayList<>(Arrays.asList("GPK_KSC_1", "USER_1_1")); List<String> keys = new ArrayList<>(Arrays.asList("GPK_KSC_1", "USER_1_1"));
for (WorkbasketSummary wb : results) { for (WorkbasketSummary wb : results) {
Assert.assertTrue(keys.contains(wb.getKey())); assertTrue(keys.contains(wb.getKey()));
} }
} }
@ -124,43 +126,43 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
userName = "user_1_1", userName = "user_1_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testQueryAllTransferTargetsForUserAndGroupFromSubject() void testQueryAllTransferTargetsForUserAndGroupFromSubject()
throws SystemException { throws SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.callerHasPermission(WorkbasketPermission.APPEND) .callerHasPermission(WorkbasketPermission.APPEND)
.list(); .list();
Assert.assertEquals(6, results.size()); assertEquals(6, results.size());
} }
@WithAccessId(userName = "user_1_1") @WithAccessId(userName = "user_1_1")
@Test @Test
public void testQueryAllAvailableWorkbasketForOpeningForUserAndGroupFromSubject() { void testQueryAllAvailableWorkbasketForOpeningForUserAndGroupFromSubject() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.callerHasPermission(WorkbasketPermission.READ) .callerHasPermission(WorkbasketPermission.READ)
.list(); .list();
Assert.assertEquals(1, results.size()); assertEquals(1, results.size());
} }
@WithAccessId(userName = "teamlead_1", groupNames = {"businessadmin"}) @WithAccessId(userName = "teamlead_1", groupNames = {"businessadmin"})
@Test @Test
public void testConsiderBusinessAdminPermissionsWhileQueryingWorkbaskets() { void testConsiderBusinessAdminPermissionsWhileQueryingWorkbaskets() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.callerHasPermission(WorkbasketPermission.OPEN) .callerHasPermission(WorkbasketPermission.OPEN)
.list(); .list();
Assert.assertEquals(3, results.size()); assertEquals(3, results.size());
} }
@WithAccessId(userName = "admin") @WithAccessId(userName = "admin")
@Test @Test
public void testSkipAuthorizationCheckForAdminWhileQueryingWorkbaskets() { void testSkipAuthorizationCheckForAdminWhileQueryingWorkbaskets() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.callerHasPermission(WorkbasketPermission.OPEN) .callerHasPermission(WorkbasketPermission.OPEN)
.list(); .list();
Assert.assertEquals(25, results.size()); assertEquals(25, results.size());
} }
} }

View File

@ -1,7 +1,7 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import java.util.List; import java.util.List;
@ -21,9 +21,9 @@ import pro.taskana.security.WithAccessId;
* Acceptance test for all "query classifications with pagination" scenarios. * Acceptance test for all "query classifications with pagination" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest { class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
public QueryWorkbasketsWithPaginationAccTest() { QueryWorkbasketsWithPaginationAccTest() {
super(); super();
} }
@ -31,7 +31,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetFirstPageOfWorkbasketQueryWithOffset() { void testGetFirstPageOfWorkbasketQueryWithOffset() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -43,7 +43,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testGetSecondPageOfWorkbasketQueryWithOffset() { void testGetSecondPageOfWorkbasketQueryWithOffset() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -55,7 +55,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testListOffsetAndLimitOutOfBounds() { void testListOffsetAndLimitOutOfBounds() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// both will be 0, working // both will be 0, working
@ -81,7 +81,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPaginationWithPages() { void testPaginationWithPages() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// Getting full page // Getting full page
@ -121,7 +121,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testPaginationNullAndNegativeLimitsIgnoring() { void testPaginationNullAndNegativeLimitsIgnoring() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// 0 limit/size = 0 results // 0 limit/size = 0 results
@ -155,7 +155,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
*/ */
@Disabled @Disabled
@Test @Test
public void testPaginationThrowingExceptionWhenPageOutOfBounds() { void testPaginationThrowingExceptionWhenPageOutOfBounds() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
// entrypoint set outside result amount // entrypoint set outside result amount
@ -172,7 +172,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testCountOfWorkbasketQuery() { void testCountOfWorkbasketQuery() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
long count = workbasketService.createWorkbasketQuery() long count = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -184,7 +184,7 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
userName = "teamlead_1", userName = "teamlead_1",
groupNames = {"group_1"}) groupNames = {"group_1"})
@Test @Test
public void testWorkbasketQueryDomA() { void testWorkbasketQueryDomA() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> result = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> result = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")

View File

@ -1,8 +1,10 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.time.Instant; import java.time.Instant;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -51,11 +53,11 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
workbasketService.updateWorkbasket(workbasket); workbasketService.updateWorkbasket(workbasket);
Workbasket updatedWorkbasket = workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A"); Workbasket updatedWorkbasket = workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A");
Assert.assertEquals(workbasket.getId(), updatedWorkbasket.getId()); assertEquals(workbasket.getId(), updatedWorkbasket.getId());
Assert.assertEquals(workbasket.getCreated(), updatedWorkbasket.getCreated()); assertEquals(workbasket.getCreated(), updatedWorkbasket.getCreated());
Assert.assertNotEquals(modified, updatedWorkbasket.getModified()); assertNotEquals(modified, updatedWorkbasket.getModified());
Assert.assertEquals("new name", updatedWorkbasket.getName()); assertEquals("new name", updatedWorkbasket.getName());
Assert.assertEquals(WorkbasketType.TOPIC, updatedWorkbasket.getType()); assertEquals(WorkbasketType.TOPIC, updatedWorkbasket.getType());
} }
@WithAccessId( @WithAccessId(

View File

@ -1,13 +1,13 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -1,7 +1,7 @@
package acceptance.workbasket; package acceptance.workbasket;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import java.util.List; import java.util.List;
@ -19,18 +19,18 @@ import pro.taskana.security.JAASExtension;
* Acceptance test for all "query classifications with pagination" scenarios. * Acceptance test for all "query classifications with pagination" scenarios.
*/ */
@ExtendWith(JAASExtension.class) @ExtendWith(JAASExtension.class)
public class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest { class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest {
private static SortDirection asc = SortDirection.ASCENDING; private static SortDirection asc = SortDirection.ASCENDING;
private static SortDirection desc = SortDirection.DESCENDING; private static SortDirection desc = SortDirection.DESCENDING;
public WorkbasketQueryWithOrderedPaginationAccTest() { WorkbasketQueryWithOrderedPaginationAccTest() {
super(); super();
} }
@Disabled @Disabled
@Test @Test
public void testGetFirstPageOfTaskQueryWithOffset() { void testGetFirstPageOfTaskQueryWithOffset() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")
@ -51,7 +51,7 @@ public class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest
@Disabled @Disabled
@Test @Test
public void testGetSecondPageOfTaskQueryWithOffset() { void testGetSecondPageOfTaskQueryWithOffset() {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService(); WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery() List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.domainIn("DOMAIN_A") .domainIn("DOMAIN_A")

View File

@ -52,6 +52,7 @@ class PojoTest {
)) ))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@TestFactory @TestFactory
Collection<DynamicTest> validateSetters() { Collection<DynamicTest> validateSetters() {
return getPojoClasses() return getPojoClasses()
@ -70,8 +71,6 @@ class PojoTest {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@TestFactory @TestFactory
Collection<DynamicTest> validateNoStaticExceptFinalFields() { Collection<DynamicTest> validateNoStaticExceptFinalFields() {
return getPojoClasses() return getPojoClasses()
@ -90,14 +89,13 @@ class PojoTest {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
private void validateWithRules(Class<?> cl, Rule... rules) { private void validateWithRules(Class<?> cl, Rule... rules) {
ValidatorBuilder.create() ValidatorBuilder.create()
.with(rules) .with(rules)
.build() .build()
.validate(PojoClassFactory.getPojoClass(cl)); .validate(PojoClassFactory.getPojoClass(cl));
} }
private void validateWithTester(Class<?> cl, Tester... testers) { private void validateWithTester(Class<?> cl, Tester... testers) {
ValidatorBuilder.create() ValidatorBuilder.create()
.with(testers) .with(testers)

View File

@ -1,7 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
@ -16,12 +16,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.CustomField; import pro.taskana.CustomField;
import pro.taskana.TaskState; import pro.taskana.TaskState;
@ -37,8 +37,8 @@ import pro.taskana.report.CategoryReport;
/** /**
* Unit Test for CategoryBuilderImpl. * Unit Test for CategoryBuilderImpl.
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class CategoryReportBuilderImplTest { class CategoryReportBuilderImplTest {
@InjectMocks @InjectMocks
private TaskMonitorServiceImpl cut; private TaskMonitorServiceImpl cut;
@ -55,8 +55,8 @@ public class CategoryReportBuilderImplTest {
@Mock @Mock
private TaskMonitorMapper taskMonitorMapperMock; private TaskMonitorMapper taskMonitorMapperMock;
@Before @BeforeEach
public void setup() { void setup() {
when(taskanaEngineMock.getConfiguration()).thenReturn(taskanaEngineConfiguration); when(taskanaEngineMock.getConfiguration()).thenReturn(taskanaEngineConfiguration);
when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock); when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock);
when(taskanaEngineConfiguration.isGermanPublicHolidaysEnabled()).thenReturn(true); when(taskanaEngineConfiguration.isGermanPublicHolidaysEnabled()).thenReturn(true);
@ -64,7 +64,7 @@ public class CategoryReportBuilderImplTest {
} }
@Test @Test
public void testGetTotalNumbersOfCatgoryReport() throws InvalidArgumentException, NotAuthorizedException { void testGetTotalNumbersOfCatgoryReport() throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN"); List<String> categories = Collections.singletonList("EXTERN");
@ -110,7 +110,7 @@ public class CategoryReportBuilderImplTest {
} }
@Test @Test
public void testGetCategoryReportWithReportLineItemDefinitions() void testGetCategoryReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -163,7 +163,7 @@ public class CategoryReportBuilderImplTest {
} }
@Test @Test
public void testListTaskIdsOfCategoryReportForSelectedItems() void testListTaskIdsOfCategoryReportForSelectedItems()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -215,7 +215,7 @@ public class CategoryReportBuilderImplTest {
} }
@Test @Test
public void testListTaskIdsForSelectedItemsIsEmptyResult() throws NotAuthorizedException, InvalidArgumentException { void testListTaskIdsForSelectedItemsIsEmptyResult() throws NotAuthorizedException, InvalidArgumentException {
SelectedItem selectedItem = new SelectedItem(); SelectedItem selectedItem = new SelectedItem();
List<SelectedItem> selectedItems = Collections.singletonList(selectedItem); List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
List<String> result = cut.createCategoryReportBuilder() List<String> result = cut.createCategoryReportBuilder()
@ -224,7 +224,7 @@ public class CategoryReportBuilderImplTest {
} }
@Test @Test
public void testListCustomAttributeValuesForCustomAttributeName() void testListCustomAttributeValuesForCustomAttributeName()
throws NotAuthorizedException { throws NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -276,7 +276,7 @@ public class CategoryReportBuilderImplTest {
} }
@Test @Test
public void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws NotAuthorizedException { void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() throws NotAuthorizedException {
List<String> result = cut.createCategoryReportBuilder() List<String> result = cut.createCategoryReportBuilder()
.workbasketIdIn(Arrays.asList("DieGibtsSicherNed")) .workbasketIdIn(Arrays.asList("DieGibtsSicherNed"))
.listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_1); .listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_1);

View File

@ -1,5 +1,6 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -7,12 +8,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.junit.Assert; import org.junit.jupiter.api.Test;
import org.junit.Test; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.ClassificationSummary; import pro.taskana.ClassificationSummary;
@ -21,8 +21,9 @@ import pro.taskana.ClassificationSummary;
* *
* @author EH * @author EH
*/ */
@RunWith(MockitoJUnitRunner.class)
public class ClassificationQueryImplTest { @ExtendWith(MockitoExtension.class)
class ClassificationQueryImplTest {
@InjectMocks @InjectMocks
private ClassificationQueryImpl classificationQueryImpl; private ClassificationQueryImpl classificationQueryImpl;
@ -34,7 +35,7 @@ public class ClassificationQueryImplTest {
private SqlSession sqlSession; private SqlSession sqlSession;
@Test @Test
public void should_ReturnList_when_BuilderIsUsed() { void should_ReturnList_when_BuilderIsUsed() {
when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession); when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>());
@ -43,11 +44,11 @@ public class ClassificationQueryImplTest {
.priorityIn(1, 2) .priorityIn(1, 2)
.parentIdIn("superId") .parentIdIn("superId")
.list(); .list();
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnListWithOffset_when_BuilderIsUsed() { void should_ReturnListWithOffset_when_BuilderIsUsed() {
when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession); when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>());
@ -56,11 +57,11 @@ public class ClassificationQueryImplTest {
.priorityIn(1, 2) .priorityIn(1, 2)
.parentIdIn("superId") .parentIdIn("superId")
.list(1, 1); .list(1, 1);
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnOneItem_when_BuilderIsUsed() { void should_ReturnOneItem_when_BuilderIsUsed() {
when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession); when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectOne(any(), any())).thenReturn(new ClassificationSummaryImpl()); when(sqlSession.selectOne(any(), any())).thenReturn(new ClassificationSummaryImpl());
@ -69,6 +70,6 @@ public class ClassificationQueryImplTest {
.priorityIn(1, 2) .priorityIn(1, 2)
.parentIdIn("superId") .parentIdIn("superId")
.single(); .single();
Assert.assertNotNull(result); assertNotNull(result);
} }
} }

View File

@ -1,7 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
@ -16,12 +16,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.CustomField; import pro.taskana.CustomField;
import pro.taskana.TaskState; import pro.taskana.TaskState;
@ -40,8 +40,8 @@ import pro.taskana.report.ClassificationReport.DetailedClassificationReport;
/** /**
* Unit Test for ClassificationReportBuilderImpl. * Unit Test for ClassificationReportBuilderImpl.
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class ClassificationReportBuilderImplTest { class ClassificationReportBuilderImplTest {
@InjectMocks @InjectMocks
private TaskMonitorServiceImpl cut; private TaskMonitorServiceImpl cut;
@ -58,8 +58,8 @@ public class ClassificationReportBuilderImplTest {
@Mock @Mock
private TaskMonitorMapper taskMonitorMapperMock; private TaskMonitorMapper taskMonitorMapperMock;
@Before @BeforeEach
public void setup() { void setup() {
when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock); when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock);
when(taskanaEngineMock.getConfiguration()).thenReturn(taskanaEngineConfiguration); when(taskanaEngineMock.getConfiguration()).thenReturn(taskanaEngineConfiguration);
when(taskanaEngineConfiguration.isGermanPublicHolidaysEnabled()).thenReturn(true); when(taskanaEngineConfiguration.isGermanPublicHolidaysEnabled()).thenReturn(true);
@ -67,7 +67,7 @@ public class ClassificationReportBuilderImplTest {
} }
@Test @Test
public void testGetTotalNumbersOfClassificationReport() throws InvalidArgumentException, NotAuthorizedException { void testGetTotalNumbersOfClassificationReport() throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN"); List<String> categories = Collections.singletonList("EXTERN");
@ -114,7 +114,7 @@ public class ClassificationReportBuilderImplTest {
} }
@Test @Test
public void testGetClassificationReportWithReportLineItemDefinitions() void testGetClassificationReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -169,7 +169,7 @@ public class ClassificationReportBuilderImplTest {
} }
@Test @Test
public void testGetTotalNumbersOfDetailedClassificationReport() void testGetTotalNumbersOfDetailedClassificationReport()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -220,7 +220,7 @@ public class ClassificationReportBuilderImplTest {
} }
@Test @Test
public void testGetDetailedClassificationReportWithReportLineItemDefinitions() void testGetDetailedClassificationReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -278,7 +278,7 @@ public class ClassificationReportBuilderImplTest {
} }
@Test @Test
public void testGetTaskIdsForSelectedItems() throws InvalidArgumentException, NotAuthorizedException { void testGetTaskIdsForSelectedItems() throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN"); List<String> categories = Collections.singletonList("EXTERN");
@ -329,7 +329,7 @@ public class ClassificationReportBuilderImplTest {
} }
@Test @Test
public void testGetTaskIdsForSelectedItemsIsEmptyResult() throws NotAuthorizedException, InvalidArgumentException { void testGetTaskIdsForSelectedItemsIsEmptyResult() throws NotAuthorizedException, InvalidArgumentException {
SelectedItem selectedItem = new SelectedItem(); SelectedItem selectedItem = new SelectedItem();
selectedItem.setKey("GIBTSNED"); selectedItem.setKey("GIBTSNED");
List<SelectedItem> selectedItems = Collections.singletonList(selectedItem); List<SelectedItem> selectedItems = Collections.singletonList(selectedItem);
@ -340,7 +340,7 @@ public class ClassificationReportBuilderImplTest {
} }
@Test @Test
public void testListCustomAttributeValuesForCustomAttributeName() void testListCustomAttributeValuesForCustomAttributeName()
throws NotAuthorizedException { throws NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -392,7 +392,7 @@ public class ClassificationReportBuilderImplTest {
} }
@Test @Test
public void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult()
throws NotAuthorizedException { throws NotAuthorizedException {
List<String> result = cut.createClassificationReportBuilder() List<String> result = cut.createClassificationReportBuilder()
.workbasketIdIn(Collections.singletonList("DieGibtsGarantiertNed")) .workbasketIdIn(Collections.singletonList("DieGibtsGarantiertNed"))

View File

@ -1,24 +1,21 @@
package pro.taskana.impl; package pro.taskana.impl;
import static junit.framework.TestCase.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import org.junit.Before; import org.junit.jupiter.api.Assertions;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Spy; import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.Classification; import pro.taskana.Classification;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
import pro.taskana.exceptions.ClassificationAlreadyExistException;
import pro.taskana.exceptions.DomainNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.mappings.ClassificationMapper; import pro.taskana.mappings.ClassificationMapper;
/** /**
@ -26,8 +23,8 @@ import pro.taskana.mappings.ClassificationMapper;
* *
* @author EH * @author EH
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class ClassificationServiceImplTest { class ClassificationServiceImplTest {
@Spy @Spy
@InjectMocks @InjectMocks
@ -41,30 +38,25 @@ public class ClassificationServiceImplTest {
@Mock @Mock
private ClassificationQueryImpl classificationQueryImplMock; private ClassificationQueryImpl classificationQueryImplMock;
@Before
public void setup() {
when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock);
}
@Test @Test
public void testCreateClassificationQuery() { void testCreateClassificationQuery() {
cutSpy.createClassificationQuery(); cutSpy.createClassificationQuery();
verifyNoMoreInteractions(classificationMapperMock, internalTaskanaEngineMock, taskanaEngineMock, verifyNoMoreInteractions(classificationMapperMock, internalTaskanaEngineMock, taskanaEngineMock,
classificationQueryImplMock); classificationQueryImplMock);
} }
@Test(expected = InvalidArgumentException.class) @Test
public void testThrowExceptionIdIfClassificationIsCreatedWithAnExplicitId() void testThrowExceptionIdIfClassificationIsCreatedWithAnExplicitId() {
throws DomainNotFoundException, InvalidArgumentException, when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock);
NotAuthorizedException, ClassificationAlreadyExistException { InvalidArgumentException invalidArgumentException = Assertions.assertThrows(InvalidArgumentException.class,
try { () -> {
Classification classification = createDummyClassification(); Classification classification = createDummyClassification();
when(internalTaskanaEngineMock.domainExists(any())).thenReturn(true); when(internalTaskanaEngineMock.domainExists(any())).thenReturn(true);
cutSpy.createClassification(classification); cutSpy.createClassification(classification);
} catch (InvalidArgumentException e) { });
assertEquals(e.getMessage(), "ClassificationId should be null on creation");
throw e; assertEquals(invalidArgumentException.getMessage(), "ClassificationId should be null on creation");
}
} }
private Classification createDummyClassification() { private Classification createDummyClassification() {

View File

@ -1,7 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
@ -15,12 +15,12 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.CustomField; import pro.taskana.CustomField;
import pro.taskana.TaskState; import pro.taskana.TaskState;
@ -36,8 +36,8 @@ import pro.taskana.report.CustomFieldValueReport;
/** /**
* Unit Test for CustomFieldValueReportBuilderImpl. * Unit Test for CustomFieldValueReportBuilderImpl.
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class CustomFieldValueReportBuilderImplTest { class CustomFieldValueReportBuilderImplTest {
@InjectMocks @InjectMocks
private TaskMonitorServiceImpl cut; private TaskMonitorServiceImpl cut;
@ -54,8 +54,8 @@ public class CustomFieldValueReportBuilderImplTest {
@Mock @Mock
private TaskMonitorMapper taskMonitorMapperMock; private TaskMonitorMapper taskMonitorMapperMock;
@Before @BeforeEach
public void setup() { void setup() {
when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock); when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock);
when(taskanaEngineMock.getConfiguration()).thenReturn(taskanaEngineConfigurationMock); when(taskanaEngineMock.getConfiguration()).thenReturn(taskanaEngineConfigurationMock);
when(taskanaEngineConfigurationMock.isGermanPublicHolidaysEnabled()).thenReturn(true); when(taskanaEngineConfigurationMock.isGermanPublicHolidaysEnabled()).thenReturn(true);
@ -63,7 +63,7 @@ public class CustomFieldValueReportBuilderImplTest {
} }
@Test @Test
public void testGetTotalNumbersOfCustomFieldValueReport() throws InvalidArgumentException, NotAuthorizedException { void testGetTotalNumbersOfCustomFieldValueReport() throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
List<String> categories = Collections.singletonList("EXTERN"); List<String> categories = Collections.singletonList("EXTERN");
@ -111,7 +111,7 @@ public class CustomFieldValueReportBuilderImplTest {
} }
@Test @Test
public void testGetCustomFieldValueReportWithReportLineItemDefinitions() void testGetCustomFieldValueReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -164,7 +164,7 @@ public class CustomFieldValueReportBuilderImplTest {
} }
@Test @Test
public void testListCustomAttributeValuesForCustomAttributeName() void testListCustomAttributeValuesForCustomAttributeName()
throws NotAuthorizedException { throws NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);

View File

@ -1,8 +1,8 @@
package pro.taskana.impl; package pro.taskana.impl;
import static java.util.Collections.singletonList; import static java.util.Collections.singletonList;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static pro.taskana.impl.DaysToWorkingDaysConverter.getEasterSunday; import static pro.taskana.impl.DaysToWorkingDaysConverter.getEasterSunday;
import java.time.Instant; import java.time.Instant;

View File

@ -1,5 +1,6 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -7,12 +8,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.junit.Assert; import org.junit.jupiter.api.BeforeEach;
import org.junit.Before; import org.junit.jupiter.api.Test;
import org.junit.Test; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.ObjectReference; import pro.taskana.ObjectReference;
@ -21,8 +21,8 @@ import pro.taskana.ObjectReference;
* *
* @author EH * @author EH
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class ObjectReferenceQueryImplTest { class ObjectReferenceQueryImplTest {
ObjectReferenceQueryImpl objectReferenceQueryImpl; ObjectReferenceQueryImpl objectReferenceQueryImpl;
@ -32,13 +32,13 @@ public class ObjectReferenceQueryImplTest {
@Mock @Mock
SqlSession sqlSession; SqlSession sqlSession;
@Before @BeforeEach
public void setup() { void setup() {
objectReferenceQueryImpl = new ObjectReferenceQueryImpl(taskanaEngine); objectReferenceQueryImpl = new ObjectReferenceQueryImpl(taskanaEngine);
} }
@Test @Test
public void should_ReturnList_when_BuilderIsUsed() { void should_ReturnList_when_BuilderIsUsed() {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>());
@ -47,11 +47,11 @@ public class ObjectReferenceQueryImplTest {
.systemInstanceIn("1", "2") .systemInstanceIn("1", "2")
.systemIn("superId") .systemIn("superId")
.list(); .list();
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnListWithOffset_when_BuilderIsUsed() { void should_ReturnListWithOffset_when_BuilderIsUsed() {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>());
@ -60,11 +60,11 @@ public class ObjectReferenceQueryImplTest {
.systemInstanceIn("1", "2") .systemInstanceIn("1", "2")
.systemIn("superId") .systemIn("superId")
.list(1, 1); .list(1, 1);
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnOneItem_when_BuilderIsUsed() { void should_ReturnOneItem_when_BuilderIsUsed() {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession); when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectOne(any(), any())).thenReturn(new ObjectReference()); when(sqlSession.selectOne(any(), any())).thenReturn(new ObjectReference());
@ -73,6 +73,6 @@ public class ObjectReferenceQueryImplTest {
.systemInstanceIn("1", "2") .systemInstanceIn("1", "2")
.systemIn("superId") .systemIn("superId")
.single(); .single();
Assert.assertNotNull(result); assertNotNull(result);
} }
} }

View File

@ -1,18 +1,18 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.Assert.assertThat;
import java.time.Instant; import java.time.Instant;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.Attachment; import pro.taskana.Attachment;
import pro.taskana.AttachmentSummary; import pro.taskana.AttachmentSummary;
@ -22,14 +22,14 @@ import pro.taskana.ObjectReference;
* Unit Test for methods needed fot attachment at TaskImpl.<br> * Unit Test for methods needed fot attachment at TaskImpl.<br>
* This test should test every interaction with Attachments, which means adding, removing, nulling them. * This test should test every interaction with Attachments, which means adding, removing, nulling them.
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class TaskAttachmentTest { class TaskAttachmentTest {
@InjectMocks @InjectMocks
private TaskImpl cut; private TaskImpl cut;
@Test @Test
public void testAddAttachmentWithValidValue() { void testAddAttachmentWithValidValue() {
Attachment attachment1 = createAttachment("ID1", "taskId1"); Attachment attachment1 = createAttachment("ID1", "taskId1");
Attachment attachment2 = createAttachment("ID2", "taskId1"); Attachment attachment2 = createAttachment("ID2", "taskId1");
Attachment attachment3 = createAttachment("ID3", "taskId1"); Attachment attachment3 = createAttachment("ID3", "taskId1");
@ -42,7 +42,7 @@ public class TaskAttachmentTest {
} }
@Test @Test
public void testAddNullValue() { void testAddNullValue() {
Attachment attachment1 = createAttachment("ID1", "taskId1"); Attachment attachment1 = createAttachment("ID1", "taskId1");
Attachment attachment2 = null; Attachment attachment2 = null;
@ -53,7 +53,7 @@ public class TaskAttachmentTest {
} }
@Test @Test
public void testAddSameTwice() { void testAddSameTwice() {
// Same values, not same REF. Important. // Same values, not same REF. Important.
Attachment attachment1 = createAttachment("ID1", "taskId1"); Attachment attachment1 = createAttachment("ID1", "taskId1");
Attachment attachment2 = createAttachment("ID1", "taskId1"); Attachment attachment2 = createAttachment("ID1", "taskId1");
@ -72,7 +72,7 @@ public class TaskAttachmentTest {
} }
@Test @Test
public void testRemoveAttachment() { void testRemoveAttachment() {
// Testing normal way // Testing normal way
Attachment attachment1 = createAttachment("ID1", "taskId1"); Attachment attachment1 = createAttachment("ID1", "taskId1");
Attachment attachment2 = createAttachment("ID2", "taskId1"); Attachment attachment2 = createAttachment("ID2", "taskId1");
@ -86,7 +86,7 @@ public class TaskAttachmentTest {
} }
@Test @Test
public void testRemoveLoopStopsAtResult() { void testRemoveLoopStopsAtResult() {
Attachment attachment1 = createAttachment("ID2", "taskId1"); Attachment attachment1 = createAttachment("ID2", "taskId1");
// adding same uncommon way to test that the loop will stop. // adding same uncommon way to test that the loop will stop.
cut.getAttachments().add(attachment1); cut.getAttachments().add(attachment1);
@ -101,12 +101,12 @@ public class TaskAttachmentTest {
} }
@Test @Test
public void testGetAttachmentSummaries() { void testGetAttachmentSummaries() {
ObjectReference objRef = new ObjectReference(); ObjectReference objRef = new ObjectReference();
objRef.setId("ObjRefId"); objRef.setId("ObjRefId");
objRef.setCompany("company"); objRef.setCompany("company");
Map<String, String> customAttr = new HashMap<String, String>(); Map<String, String> customAttr = new HashMap<>();
customAttr.put("key", "value"); customAttr.put("key", "value");
Attachment attachment1 = createAttachment("ID1", "taskId1"); Attachment attachment1 = createAttachment("ID1", "taskId1");

View File

@ -1,5 +1,6 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -8,12 +9,11 @@ import java.util.List;
import org.apache.ibatis.session.Configuration; import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.junit.Assert; import org.junit.jupiter.api.BeforeEach;
import org.junit.Before; import org.junit.jupiter.api.Test;
import org.junit.Test; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskSummary; import pro.taskana.TaskSummary;
@ -24,8 +24,8 @@ import pro.taskana.TaskanaEngine;
* *
* @author EH * @author EH
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class TaskQueryImplTest { class TaskQueryImplTest {
@Mock @Mock
TaskServiceImpl taskServiceMock; TaskServiceImpl taskServiceMock;
@ -38,8 +38,8 @@ public class TaskQueryImplTest {
@Mock @Mock
private SqlSession sqlSession; private SqlSession sqlSession;
@Before @BeforeEach
public void setup() { void setup() {
when(internalTaskanaEngine.getEngine()).thenReturn(taskanaEngine); when(internalTaskanaEngine.getEngine()).thenReturn(taskanaEngine);
when(taskanaEngine.getTaskService()).thenReturn(taskServiceMock); when(taskanaEngine.getTaskService()).thenReturn(taskServiceMock);
@ -52,7 +52,7 @@ public class TaskQueryImplTest {
} }
@Test @Test
public void should_ReturnList_when_BuilderIsUsed() { void should_ReturnList_when_BuilderIsUsed() {
when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>());
List<TaskSummary> intermediate = new ArrayList<>(); List<TaskSummary> intermediate = new ArrayList<>();
intermediate.add(new TaskSummaryImpl()); intermediate.add(new TaskSummaryImpl());
@ -62,11 +62,11 @@ public class TaskQueryImplTest {
.priorityIn(1, 2) .priorityIn(1, 2)
.stateIn(TaskState.CLAIMED, TaskState.COMPLETED) .stateIn(TaskState.CLAIMED, TaskState.COMPLETED)
.list(); .list();
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnListWithOffset_when_BuilderIsUsed() { void should_ReturnListWithOffset_when_BuilderIsUsed() {
when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>());
List<TaskSummary> intermediate = new ArrayList<>(); List<TaskSummary> intermediate = new ArrayList<>();
intermediate.add(new TaskSummaryImpl()); intermediate.add(new TaskSummaryImpl());
@ -76,11 +76,11 @@ public class TaskQueryImplTest {
.priorityIn(1, 2) .priorityIn(1, 2)
.stateIn(TaskState.CLAIMED, TaskState.COMPLETED) .stateIn(TaskState.CLAIMED, TaskState.COMPLETED)
.list(1, 1); .list(1, 1);
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnOneItem_when_BuilderIsUsed() { void should_ReturnOneItem_when_BuilderIsUsed() {
when(sqlSession.selectOne(any(), any())).thenReturn(new TaskSummaryImpl()); when(sqlSession.selectOne(any(), any())).thenReturn(new TaskSummaryImpl());
List<TaskSummary> intermediate = new ArrayList<>(); List<TaskSummary> intermediate = new ArrayList<>();
intermediate.add(new TaskSummaryImpl()); intermediate.add(new TaskSummaryImpl());
@ -91,6 +91,6 @@ public class TaskQueryImplTest {
.priorityIn(1, 2) .priorityIn(1, 2)
.stateIn(TaskState.CLAIMED, TaskState.COMPLETED) .stateIn(TaskState.CLAIMED, TaskState.COMPLETED)
.single(); .single();
Assert.assertNotNull(result); assertNotNull(result);
} }
} }

View File

@ -1,7 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import java.time.Duration; import java.time.Duration;
@ -9,13 +9,11 @@ import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.mockito.junit.jupiter.MockitoExtension;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import pro.taskana.Classification; import pro.taskana.Classification;
import pro.taskana.ObjectReference; import pro.taskana.ObjectReference;
@ -27,17 +25,14 @@ import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.mappings.AttachmentMapper; import pro.taskana.mappings.AttachmentMapper;
import pro.taskana.mappings.ObjectReferenceMapper; import pro.taskana.mappings.ObjectReferenceMapper;
import pro.taskana.mappings.TaskMapper; import pro.taskana.mappings.TaskMapper;
import pro.taskana.security.CurrentUserContext;
/** /**
* Unit Test for TaskServiceImpl. * Unit Test for TaskServiceImpl.
* *
* @author EH * @author EH
*/ */
@RunWith(PowerMockRunner.class) @ExtendWith(MockitoExtension.class)
@PrepareForTest(CurrentUserContext.class) class TaskServiceImplTest {
@PowerMockIgnore("javax.management.*")
public class TaskServiceImplTest {
private TaskServiceImpl cut; private TaskServiceImpl cut;
@ -71,8 +66,8 @@ public class TaskServiceImplTest {
@Mock @Mock
private SqlSession sqlSessionMock; private SqlSession sqlSessionMock;
@Before @BeforeEach
public void setup() { void setup() {
when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock); when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock);
when(taskanaEngineMock.getWorkbasketService()).thenReturn(workbasketServiceMock); when(taskanaEngineMock.getWorkbasketService()).thenReturn(workbasketServiceMock);
when(taskanaEngineMock.getClassificationService()).thenReturn(classificationServiceImplMock); when(taskanaEngineMock.getClassificationService()).thenReturn(classificationServiceImplMock);
@ -80,7 +75,7 @@ public class TaskServiceImplTest {
} }
@Test @Test
public void testTaskSummaryEqualsHashCode() throws InterruptedException { void testTaskSummaryEqualsHashCode() throws InterruptedException {
Classification classification = createDummyClassification(); Classification classification = createDummyClassification();
Workbasket wb = createWorkbasket("WB-ID", "WB-Key"); Workbasket wb = createWorkbasket("WB-ID", "WB-Key");
ObjectReference objectReference = JunitHelper.createDefaultObjRef(); ObjectReference objectReference = JunitHelper.createDefaultObjRef();

View File

@ -1,8 +1,8 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
@ -12,13 +12,13 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InOrder; import org.mockito.InOrder;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.TaskState; import pro.taskana.TaskState;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
@ -32,8 +32,8 @@ import pro.taskana.report.TaskStatusReport;
/** /**
* Unit Test for TaskStatusReportBuilderImpl. * Unit Test for TaskStatusReportBuilderImpl.
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class TaskStatusReportBuilderImplTest { class TaskStatusReportBuilderImplTest {
@InjectMocks @InjectMocks
private TaskMonitorServiceImpl cut; private TaskMonitorServiceImpl cut;
@ -47,13 +47,13 @@ public class TaskStatusReportBuilderImplTest {
@Mock @Mock
private TaskMonitorMapper taskMonitorMapperMock; private TaskMonitorMapper taskMonitorMapperMock;
@Before @BeforeEach
public void setup() { void setup() {
when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock); when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock);
} }
@Test @Test
public void testGetTaskStateReportWithoutFilters() throws NotAuthorizedException, InvalidArgumentException { void testGetTaskStateReportWithoutFilters() throws NotAuthorizedException, InvalidArgumentException {
// given // given
TaskQueryItem queryItem1 = new TaskQueryItem(); TaskQueryItem queryItem1 = new TaskQueryItem();
queryItem1.setCount(50); queryItem1.setCount(50);
@ -88,7 +88,7 @@ public class TaskStatusReportBuilderImplTest {
} }
@Test @Test
public void testGetTotalNumberOfTaskStateReport() throws NotAuthorizedException, InvalidArgumentException { void testGetTotalNumberOfTaskStateReport() throws NotAuthorizedException, InvalidArgumentException {
// given // given
TaskQueryItem queryItem1 = new TaskQueryItem(); TaskQueryItem queryItem1 = new TaskQueryItem();
queryItem1.setCount(50); queryItem1.setCount(50);

View File

@ -1,10 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
@ -13,14 +10,11 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.junit.Before; import org.junit.jupiter.api.Test;
import org.junit.Test; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.mockito.junit.jupiter.MockitoExtension;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import pro.taskana.Classification; import pro.taskana.Classification;
import pro.taskana.Task; import pro.taskana.Task;
@ -37,17 +31,14 @@ import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.mappings.AttachmentMapper; import pro.taskana.mappings.AttachmentMapper;
import pro.taskana.mappings.ObjectReferenceMapper; import pro.taskana.mappings.ObjectReferenceMapper;
import pro.taskana.mappings.TaskMapper; import pro.taskana.mappings.TaskMapper;
import pro.taskana.security.CurrentUserContext;
/** /**
* Unit Test for TaskServiceImpl. * Unit Test for TaskServiceImpl.
* *
* @author EH * @author EH
*/ */
@RunWith(PowerMockRunner.class) @ExtendWith(MockitoExtension.class)
@PrepareForTest(CurrentUserContext.class) class TaskTransferrerTest {
@PowerMockIgnore("javax.management.*")
public class TaskTransferrerTest {
private TaskTransferrer cut; private TaskTransferrer cut;
@Mock @Mock
@ -83,17 +74,14 @@ public class TaskTransferrerTest {
@Mock @Mock
private SqlSession sqlSessionMock; private SqlSession sqlSessionMock;
@Before @Test
public void setup() { void testTransferTaskToDestinationWorkbasketWithoutSecurity()
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException {
when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock); when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock);
when(taskanaEngineMock.getWorkbasketService()).thenReturn(workbasketServiceMock); when(taskanaEngineMock.getWorkbasketService()).thenReturn(workbasketServiceMock);
when(taskanaEngineMock.getClassificationService()).thenReturn(classificationServiceImplMock);
cut = new TaskTransferrer(internalTaskanaEngineMock, taskMapperMock, taskServiceImplMock); cut = new TaskTransferrer(internalTaskanaEngineMock, taskMapperMock, taskServiceImplMock);
}
@Test
public void testTransferTaskToDestinationWorkbasketWithoutSecurity()
throws TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, InvalidStateException {
TaskTransferrer cutSpy = Mockito.spy(cut); TaskTransferrer cutSpy = Mockito.spy(cut);
Workbasket destinationWorkbasket = TaskServiceImplTest.createWorkbasket("2", "k1"); Workbasket destinationWorkbasket = TaskServiceImplTest.createWorkbasket("2", "k1");
Workbasket sourceWorkbasket = TaskServiceImplTest.createWorkbasket("47", "key47"); Workbasket sourceWorkbasket = TaskServiceImplTest.createWorkbasket("47", "key47");
@ -102,9 +90,6 @@ public class TaskTransferrerTest {
task.setWorkbasketSummary(sourceWorkbasket.asSummary()); task.setWorkbasketSummary(sourceWorkbasket.asSummary());
task.setRead(true); task.setRead(true);
when(workbasketServiceMock.getWorkbasket(destinationWorkbasket.getId())).thenReturn(destinationWorkbasket); when(workbasketServiceMock.getWorkbasket(destinationWorkbasket.getId())).thenReturn(destinationWorkbasket);
when(workbasketServiceMock.getWorkbasket(sourceWorkbasket.getId())).thenReturn(sourceWorkbasket);
when(taskanaEngineMock.getConfiguration()).thenReturn(taskanaEngineConfigurationMock);
when(taskanaEngineConfigurationMock.isSecurityEnabled()).thenReturn(false);
doReturn(task).when(taskServiceImplMock).getTask(task.getId()); doReturn(task).when(taskServiceImplMock).getTask(task.getId());
Task actualTask = cutSpy.transfer(task.getId(), destinationWorkbasket.getId()); Task actualTask = cutSpy.transfer(task.getId(), destinationWorkbasket.getId());

View File

@ -1,5 +1,6 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -7,12 +8,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.junit.Assert; import org.junit.jupiter.api.Test;
import org.junit.Test; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.WorkbasketAccessItem; import pro.taskana.WorkbasketAccessItem;
@ -21,8 +21,8 @@ import pro.taskana.WorkbasketAccessItem;
* *
* @author jsa * @author jsa
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class WorkbasketAccessItemQueryImplTest { class WorkbasketAccessItemQueryImplTest {
@InjectMocks @InjectMocks
private WorkbasketAccessItemQueryImpl workbasketAccessItemQueryImpl; private WorkbasketAccessItemQueryImpl workbasketAccessItemQueryImpl;
@ -34,31 +34,31 @@ public class WorkbasketAccessItemQueryImplTest {
private SqlSession sqlSession; private SqlSession sqlSession;
@Test @Test
public void should_ReturnList_when_BuilderIsUsed() { void should_ReturnList_when_BuilderIsUsed() {
when(internalTaskanaEngine.openAndReturnConnection(any())).thenReturn(new ArrayList<>()); when(internalTaskanaEngine.openAndReturnConnection(any())).thenReturn(new ArrayList<>());
List<WorkbasketAccessItem> result = workbasketAccessItemQueryImpl.accessIdIn("test", "asd") List<WorkbasketAccessItem> result = workbasketAccessItemQueryImpl.accessIdIn("test", "asd")
.list(); .list();
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnListWithOffset_when_BuilderIsUsed() { void should_ReturnListWithOffset_when_BuilderIsUsed() {
when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession); when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>());
List<WorkbasketAccessItem> result = workbasketAccessItemQueryImpl.accessIdIn("test", "asd") List<WorkbasketAccessItem> result = workbasketAccessItemQueryImpl.accessIdIn("test", "asd")
.list(1, 1); .list(1, 1);
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnOneItem_when_BuilderIsUsed() { void should_ReturnOneItem_when_BuilderIsUsed() {
when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession); when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectOne(any(), any())).thenReturn(new WorkbasketAccessItemImpl()); when(sqlSession.selectOne(any(), any())).thenReturn(new WorkbasketAccessItemImpl());
WorkbasketAccessItem result = workbasketAccessItemQueryImpl.accessIdIn("test", "asd") WorkbasketAccessItem result = workbasketAccessItemQueryImpl.accessIdIn("test", "asd")
.single(); .single();
Assert.assertNotNull(result); assertNotNull(result);
} }
} }

View File

@ -1,5 +1,6 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -7,13 +8,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.junit.Assert; import org.junit.jupiter.api.BeforeEach;
import org.junit.Before; import org.junit.jupiter.api.Test;
import org.junit.Test; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
@ -23,8 +23,8 @@ import pro.taskana.WorkbasketSummary;
* *
* @author jsa * @author jsa
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class WorkbasketQueryImplTest { class WorkbasketQueryImplTest {
@InjectMocks @InjectMocks
private WorkbasketQueryImpl workbasketQueryImpl; private WorkbasketQueryImpl workbasketQueryImpl;
@ -38,13 +38,13 @@ public class WorkbasketQueryImplTest {
@Mock @Mock
private SqlSession sqlSession; private SqlSession sqlSession;
@Before @BeforeEach
public void setup() { void setup() {
when(internalTaskanaEngine.getEngine()).thenReturn(taskanaEngine); when(internalTaskanaEngine.getEngine()).thenReturn(taskanaEngine);
} }
@Test @Test
public void should_ReturnList_when_BuilderIsUsed() { void should_ReturnList_when_BuilderIsUsed() {
when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession); when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any())).thenReturn(new ArrayList<>());
@ -52,11 +52,11 @@ public class WorkbasketQueryImplTest {
.nameIn("Gruppenpostkorb KSC 1", "Gruppenpostkorb KSC 2") .nameIn("Gruppenpostkorb KSC 1", "Gruppenpostkorb KSC 2")
.keyLike("GPK_%") .keyLike("GPK_%")
.list(); .list();
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnListWithOffset_when_BuilderIsUsed() { void should_ReturnListWithOffset_when_BuilderIsUsed() {
when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession); when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>()); when(sqlSession.selectList(any(), any(), any())).thenReturn(new ArrayList<>());
@ -64,11 +64,11 @@ public class WorkbasketQueryImplTest {
.nameIn("Gruppenpostkorb KSC 1", "Gruppenpostkorb KSC 2") .nameIn("Gruppenpostkorb KSC 1", "Gruppenpostkorb KSC 2")
.keyLike("GPK_%") .keyLike("GPK_%")
.list(1, 1); .list(1, 1);
Assert.assertNotNull(result); assertNotNull(result);
} }
@Test @Test
public void should_ReturnOneItem_when_BuilderIsUsed() { void should_ReturnOneItem_when_BuilderIsUsed() {
when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession); when(internalTaskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectOne(any(), any())).thenReturn(new WorkbasketSummaryImpl()); when(sqlSession.selectOne(any(), any())).thenReturn(new WorkbasketSummaryImpl());
@ -76,6 +76,6 @@ public class WorkbasketQueryImplTest {
.nameIn("Gruppenpostkorb KSC 1", "Gruppenpostkorb KSC 2") .nameIn("Gruppenpostkorb KSC 1", "Gruppenpostkorb KSC 2")
.keyLike("GPK_%") .keyLike("GPK_%")
.single(); .single();
Assert.assertNotNull(result); assertNotNull(result);
} }
} }

View File

@ -1,7 +1,7 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
@ -16,12 +16,13 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.junit.Before; import org.junit.jupiter.api.Assertions;
import org.junit.Test; import org.junit.jupiter.api.BeforeEach;
import org.junit.runner.RunWith; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.CustomField; import pro.taskana.CustomField;
import pro.taskana.TaskState; import pro.taskana.TaskState;
@ -39,8 +40,8 @@ import pro.taskana.report.WorkbasketReport;
/** /**
* Unit Test for WorkbasketReportBuilderImpl. * Unit Test for WorkbasketReportBuilderImpl.
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class WorkbasketReportBuilderImplTest { class WorkbasketReportBuilderImplTest {
@InjectMocks @InjectMocks
private TaskMonitorServiceImpl cut; private TaskMonitorServiceImpl cut;
@ -57,8 +58,8 @@ public class WorkbasketReportBuilderImplTest {
@Mock @Mock
private TaskMonitorMapper taskMonitorMapperMock; private TaskMonitorMapper taskMonitorMapperMock;
@Before @BeforeEach
public void setup() { void setup() {
when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock); when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngineMock);
when(taskanaEngineMock.getConfiguration()).thenReturn(taskanaEngineConfiguration); when(taskanaEngineMock.getConfiguration()).thenReturn(taskanaEngineConfiguration);
when(taskanaEngineConfiguration.isGermanPublicHolidaysEnabled()).thenReturn(true); when(taskanaEngineConfiguration.isGermanPublicHolidaysEnabled()).thenReturn(true);
@ -66,7 +67,7 @@ public class WorkbasketReportBuilderImplTest {
} }
@Test @Test
public void testGetTotalNumbersOfWorkbasketReportBasedOnDueDate() void testGetTotalNumbersOfWorkbasketReportBasedOnDueDate()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -120,7 +121,7 @@ public class WorkbasketReportBuilderImplTest {
} }
@Test @Test
public void testGetWorkbasketReportWithReportLineItemDefinitions() void testGetWorkbasketReportWithReportLineItemDefinitions()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -178,7 +179,7 @@ public class WorkbasketReportBuilderImplTest {
} }
@Test @Test
public void testGetTaskIdsOfCategoryReportForSelectedItems() void testGetTaskIdsOfCategoryReportForSelectedItems()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -229,18 +230,19 @@ public class WorkbasketReportBuilderImplTest {
assertEquals(expectedResult, actualResult); assertEquals(expectedResult, actualResult);
} }
@Test(expected = InvalidArgumentException.class) @Test
public void testListTaskIdsForSelectedItemsIsEmptyResult() void testListTaskIdsForSelectedItemsIsEmptyResult() {
throws NotAuthorizedException, InvalidArgumentException {
List<SelectedItem> selectedItems = new ArrayList<>(); List<SelectedItem> selectedItems = new ArrayList<>();
Assertions.assertThrows(InvalidArgumentException.class, () -> {
List<String> result = cut.createWorkbasketReportBuilder() List<String> result = cut.createWorkbasketReportBuilder()
.workbasketIdIn(Arrays.asList("DieGibtsGarantiertNed")) .workbasketIdIn(Arrays.asList("DieGibtsGarantiertNed"))
.listTaskIdsForSelectedItems(selectedItems); .listTaskIdsForSelectedItems(selectedItems);
assertNotNull(result); assertNotNull(result);
});
} }
@Test @Test
public void testListCustomAttributeValuesForCustomAttributeName() void testListCustomAttributeValuesForCustomAttributeName()
throws NotAuthorizedException { throws NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);
@ -292,7 +294,7 @@ public class WorkbasketReportBuilderImplTest {
} }
@Test @Test
public void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult() void testListCustomAttributeValuesForCustomAttributeNameIsEmptyResult()
throws NotAuthorizedException { throws NotAuthorizedException {
List<String> result = cut.createWorkbasketReportBuilder() List<String> result = cut.createWorkbasketReportBuilder()
.workbasketIdIn(Arrays.asList("GibtsSicherNed")) .workbasketIdIn(Arrays.asList("GibtsSicherNed"))
@ -301,7 +303,7 @@ public class WorkbasketReportBuilderImplTest {
} }
@Test @Test
public void testGetTotalNumbersOfWorkbasketReportBasedOnCreatedDate() void testGetTotalNumbersOfWorkbasketReportBasedOnCreatedDate()
throws InvalidArgumentException, NotAuthorizedException { throws InvalidArgumentException, NotAuthorizedException {
List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001"); List<String> workbasketIds = Collections.singletonList("WBI:000000000000000000000000000000000001");
List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY); List<TaskState> states = Arrays.asList(TaskState.CLAIMED, TaskState.READY);

View File

@ -1,9 +1,9 @@
package pro.taskana.impl; package pro.taskana.impl;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.startsWith;
import static org.hamcrest.core.IsEqual.equalTo; import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.core.StringStartsWith.startsWith;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.doThrow;
@ -16,14 +16,15 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.junit.Before; import org.junit.jupiter.api.Assertions;
import org.junit.Ignore; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Disabled;
import org.junit.runner.RunWith; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Spy; import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.jupiter.MockitoExtension;
import pro.taskana.TaskQuery; import pro.taskana.TaskQuery;
import pro.taskana.TaskService; import pro.taskana.TaskService;
@ -33,11 +34,9 @@ import pro.taskana.Workbasket;
import pro.taskana.WorkbasketType; import pro.taskana.WorkbasketType;
import pro.taskana.configuration.TaskanaEngineConfiguration; import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.DomainNotFoundException; import pro.taskana.exceptions.DomainNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidWorkbasketException; import pro.taskana.exceptions.InvalidWorkbasketException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.WorkbasketAlreadyExistException; import pro.taskana.exceptions.WorkbasketAlreadyExistException;
import pro.taskana.exceptions.WorkbasketInUseException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.mappings.DistributionTargetMapper; import pro.taskana.mappings.DistributionTargetMapper;
import pro.taskana.mappings.WorkbasketAccessMapper; import pro.taskana.mappings.WorkbasketAccessMapper;
@ -48,8 +47,8 @@ import pro.taskana.mappings.WorkbasketMapper;
* *
* @author EH * @author EH
*/ */
@RunWith(MockitoJUnitRunner.class) @ExtendWith(MockitoExtension.class)
public class WorkbasketServiceImplTest { class WorkbasketServiceImplTest {
@Spy @Spy
@InjectMocks @InjectMocks
@ -79,13 +78,13 @@ public class WorkbasketServiceImplTest {
@Mock @Mock
private TaskanaEngineConfiguration taskanaEngineConfigurationMock; private TaskanaEngineConfiguration taskanaEngineConfigurationMock;
@Before @BeforeEach
public void setup() { void setup() {
when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngine); when(internalTaskanaEngineMock.getEngine()).thenReturn(taskanaEngine);
} }
@Test @Test
public void testCreateWorkbasket_WithDistibutionTargets() void testCreateWorkbasket_WithDistibutionTargets()
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidWorkbasketException, throws WorkbasketNotFoundException, NotAuthorizedException, InvalidWorkbasketException,
WorkbasketAlreadyExistException, DomainNotFoundException { WorkbasketAlreadyExistException, DomainNotFoundException {
final int distTargetAmount = 2; final int distTargetAmount = 2;
@ -116,21 +115,24 @@ public class WorkbasketServiceImplTest {
assertThat(actualWb.getModified(), not(equalTo(null))); assertThat(actualWb.getModified(), not(equalTo(null)));
} }
@Test(expected = WorkbasketNotFoundException.class) @Test
public void testCreateWorkbasket_DistibutionTargetNotExisting() void testCreateWorkbasket_DistibutionTargetNotExisting()
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidWorkbasketException, throws NotAuthorizedException, WorkbasketNotFoundException {
WorkbasketAlreadyExistException, DomainNotFoundException {
WorkbasketImpl expectedWb = createTestWorkbasket("ID-1", "Key-1"); WorkbasketImpl expectedWb = createTestWorkbasket("ID-1", "Key-1");
when(internalTaskanaEngineMock.domainExists(any())).thenReturn(true); when(internalTaskanaEngineMock.domainExists(any())).thenReturn(true);
try { WorkbasketNotFoundException e = Assertions.assertThrows(
WorkbasketNotFoundException.class, () -> {
cutSpy.createWorkbasket(expectedWb); cutSpy.createWorkbasket(expectedWb);
String id1 = "4711"; String id1 = "4711";
List<String> destinations = new ArrayList<>(Arrays.asList(id1)); List<String> destinations = new ArrayList<>(Arrays.asList(id1));
cutSpy.setDistributionTargets(expectedWb.getId(), destinations); cutSpy.setDistributionTargets(expectedWb.getId(), destinations);
doThrow(WorkbasketNotFoundException.class).when(cutSpy).getDistributionTargets(expectedWb.getId()).get(0); doThrow(WorkbasketNotFoundException.class).when(cutSpy)
.getDistributionTargets(expectedWb.getId())
.get(0);
});
} catch (WorkbasketNotFoundException e) {
verify(internalTaskanaEngineMock, times(3)).openConnection(); verify(internalTaskanaEngineMock, times(3)).openConnection();
verify(workbasketMapperMock, times(1)).insert(expectedWb); verify(workbasketMapperMock, times(1)).insert(expectedWb);
verify(workbasketMapperMock, times(1)).findById(any()); verify(workbasketMapperMock, times(1)).findById(any());
@ -143,21 +145,20 @@ public class WorkbasketServiceImplTest {
verifyNoMoreInteractions(taskQueryMock, taskServiceMock, workbasketMapperMock, workbasketAccessMapperMock, verifyNoMoreInteractions(taskQueryMock, taskServiceMock, workbasketMapperMock, workbasketAccessMapperMock,
distributionTargetMapperMock, distributionTargetMapperMock,
internalTaskanaEngineMock, taskanaEngine, taskanaEngineConfigurationMock); internalTaskanaEngineMock, taskanaEngine, taskanaEngineConfigurationMock);
throw e;
}
} }
// TODO Add stored-check. Not getWorkbasket() because permissions are not set with this action here. // TODO Add stored-check. Not getWorkbasket() because permissions are not set with this action here.
@Ignore @Disabled
@Test(expected = WorkbasketNotFoundException.class) @Test
public void testCreateWorkbasket_NotCreated() void testCreateWorkbasket_NotCreated() {
throws Exception {
WorkbasketImpl expectedWb = createTestWorkbasket(null, "Key-1"); WorkbasketImpl expectedWb = createTestWorkbasket(null, "Key-1");
when(workbasketMapperMock.findById(any())).thenThrow(WorkbasketNotFoundException.class); when(workbasketMapperMock.findById(any())).thenThrow(WorkbasketNotFoundException.class);
try { WorkbasketNotFoundException e = Assertions.assertThrows(
cutSpy.createWorkbasket(expectedWb); WorkbasketNotFoundException.class, () ->
} catch (Exception e) { cutSpy.createWorkbasket(expectedWb));
verify(internalTaskanaEngineMock, times(1)).openConnection(); verify(internalTaskanaEngineMock, times(1)).openConnection();
verify(workbasketMapperMock, times(1)).insert(expectedWb); verify(workbasketMapperMock, times(1)).insert(expectedWb);
verify(workbasketMapperMock, times(1)).findById(expectedWb.getId()); verify(workbasketMapperMock, times(1)).findById(expectedWb.getId());
@ -165,19 +166,19 @@ public class WorkbasketServiceImplTest {
verifyNoMoreInteractions(taskQueryMock, taskServiceMock, workbasketMapperMock, workbasketAccessMapperMock, verifyNoMoreInteractions(taskQueryMock, taskServiceMock, workbasketMapperMock, workbasketAccessMapperMock,
distributionTargetMapperMock, distributionTargetMapperMock,
internalTaskanaEngineMock, taskanaEngineConfigurationMock); internalTaskanaEngineMock, taskanaEngineConfigurationMock);
throw e;
}
} }
@Test(expected = WorkbasketNotFoundException.class) @Test
public void testDeleteWorkbasketIsUsed() void testDeleteWorkbasketIsUsed()
throws NotAuthorizedException, WorkbasketInUseException, InvalidArgumentException, WorkbasketNotFoundException { throws NotAuthorizedException, WorkbasketNotFoundException {
Workbasket wb = createTestWorkbasket("WBI:0", "wb-key"); Workbasket wb = createTestWorkbasket("WBI:0", "wb-key");
List<TaskSummary> usages = Arrays.asList(new TaskSummaryImpl(), new TaskSummaryImpl()); List<TaskSummary> usages = Arrays.asList(new TaskSummaryImpl(), new TaskSummaryImpl());
try { WorkbasketNotFoundException e = Assertions.assertThrows(
cutSpy.deleteWorkbasket(wb.getId()); WorkbasketNotFoundException.class, () ->
} catch (WorkbasketNotFoundException e) { cutSpy.deleteWorkbasket(wb.getId()));
verify(internalTaskanaEngineMock, times(2)).openConnection(); verify(internalTaskanaEngineMock, times(2)).openConnection();
verify(cutSpy, times(1)).getWorkbasket(wb.getId()); verify(cutSpy, times(1)).getWorkbasket(wb.getId());
verify(taskanaEngine, times(0)).getTaskService(); verify(taskanaEngine, times(0)).getTaskService();
@ -187,8 +188,6 @@ public class WorkbasketServiceImplTest {
verify(internalTaskanaEngineMock, times(2)).returnConnection(); verify(internalTaskanaEngineMock, times(2)).returnConnection();
verifyNoMoreInteractions(taskQueryMock, taskServiceMock, workbasketAccessMapperMock, verifyNoMoreInteractions(taskQueryMock, taskServiceMock, workbasketAccessMapperMock,
distributionTargetMapperMock, taskanaEngineConfigurationMock); distributionTargetMapperMock, taskanaEngineConfigurationMock);
throw e;
}
} }
private WorkbasketImpl createTestWorkbasket(String id, String key) { private WorkbasketImpl createTestWorkbasket(String id, String key) {

View File

@ -5,32 +5,29 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.sql.SQLException;
import java.util.Properties; import java.util.Properties;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.apache.ibatis.datasource.pooled.PooledDataSource; import org.apache.ibatis.datasource.pooled.PooledDataSource;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pro.taskana.TaskanaEngine;
import pro.taskana.configuration.TaskanaEngineConfiguration;
/** /**
* Integration Test for TaskanaEngineConfiguration. * Integration Test for TaskanaEngineConfiguration.
* *
* @author EH * @author EH
*/ */
public class TaskanaEngineConfigurationTest { public final class TaskanaEngineTestConfiguration {
private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaEngineConfigurationTest.class); private static final Logger LOGGER = LoggerFactory.getLogger(TaskanaEngineTestConfiguration.class);
private static final int POOL_TIME_TO_WAIT = 50; private static final int POOL_TIME_TO_WAIT = 50;
private static DataSource dataSource = null; private static DataSource dataSource = null;
private static String schemaName = null; private static String schemaName = null;
private TaskanaEngineTestConfiguration() {
}
/** /**
* returns the Datasource used for Junit test. If the file {user.home}/taskanaUnitTest.properties is present, the * returns the Datasource used for Junit test. If the file {user.home}/taskanaUnitTest.properties is present, the
* Datasource is created according to the properties jdbcDriver, jdbcUrl, dbUserName and dbPassword. Assuming, the * Datasource is created according to the properties jdbcDriver, jdbcUrl, dbUserName and dbPassword. Assuming, the
@ -185,15 +182,4 @@ public class TaskanaEngineConfigurationTest {
return schemaName; return schemaName;
} }
@Test
public void testCreateTaskanaEngine() throws SQLException {
DataSource ds = getDataSource();
TaskanaEngineConfiguration taskEngineConfiguration = new TaskanaEngineConfiguration(ds, false,
TaskanaEngineConfigurationTest.getSchemaName());
TaskanaEngine te = taskEngineConfiguration.buildTaskanaEngine();
Assert.assertNotNull(te);
}
} }

View File

@ -0,0 +1,29 @@
package pro.taskana.impl.configuration;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.junit.jupiter.api.Test;
import pro.taskana.TaskanaEngine;
/**
* Test of configuration.
*/
class TaskanaEngineTestConfigurationTest {
@Test
void testCreateTaskanaEngine() throws SQLException {
DataSource ds = TaskanaEngineTestConfiguration.getDataSource();
pro.taskana.configuration.TaskanaEngineConfiguration taskEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(
ds, false,
TaskanaEngineTestConfiguration.getSchemaName());
TaskanaEngine te = taskEngineConfiguration.buildTaskanaEngine();
assertNotNull(te);
}
}

View File

@ -1,6 +1,8 @@
package pro.taskana.impl.integration; package pro.taskana.impl.integration;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.sql.SQLException; import java.sql.SQLException;
import java.time.Instant; import java.time.Instant;
@ -12,10 +14,9 @@ import java.util.List;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.Assert; import org.junit.jupiter.api.BeforeAll;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.BeforeClass; import org.junit.jupiter.api.Test;
import org.junit.Test;
import pro.taskana.Classification; import pro.taskana.Classification;
import pro.taskana.ClassificationService; import pro.taskana.ClassificationService;
@ -23,7 +24,6 @@ import pro.taskana.ClassificationSummary;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
import pro.taskana.TaskanaEngine.ConnectionManagementMode; import pro.taskana.TaskanaEngine.ConnectionManagementMode;
import pro.taskana.TimeInterval; import pro.taskana.TimeInterval;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.ClassificationAlreadyExistException; import pro.taskana.exceptions.ClassificationAlreadyExistException;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.ConcurrencyException; import pro.taskana.exceptions.ConcurrencyException;
@ -31,7 +31,7 @@ import pro.taskana.exceptions.DomainNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
import pro.taskana.sampledata.SampleDataGenerator; import pro.taskana.sampledata.SampleDataGenerator;
/** /**
@ -39,27 +39,27 @@ import pro.taskana.sampledata.SampleDataGenerator;
* *
* @author EH * @author EH
*/ */
public class ClassificationServiceImplIntAutoCommitTest { class ClassificationServiceImplIntAutoCommitTest {
static int counter = 0; static int counter = 0;
private DataSource dataSource; private DataSource dataSource;
private ClassificationService classificationService; private ClassificationService classificationService;
private TaskanaEngineConfiguration taskanaEngineConfiguration; private pro.taskana.configuration.TaskanaEngineConfiguration taskanaEngineConfiguration;
private TaskanaEngine taskanaEngine; private TaskanaEngine taskanaEngine;
private TaskanaEngineImpl taskanaEngineImpl; private TaskanaEngineImpl taskanaEngineImpl;
@BeforeClass @BeforeAll
public static void resetDb() { static void resetDb() {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource(); DataSource ds = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
new SampleDataGenerator(ds, schemaName).dropDb(); new SampleDataGenerator(ds, schemaName).dropDb();
} }
@Before @BeforeEach
public void setup() throws SQLException { void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, false, taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(dataSource, false, false,
schemaName); schemaName);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
classificationService = taskanaEngine.getClassificationService(); classificationService = taskanaEngine.getClassificationService();
@ -70,7 +70,7 @@ public class ClassificationServiceImplIntAutoCommitTest {
} }
@Test @Test
public void testFindAllClassifications() void testFindAllClassifications()
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException, throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException,
InvalidArgumentException { InvalidArgumentException {
Classification classification0 = this.createDummyClassificationWithUniqueKey("", "TASK"); Classification classification0 = this.createDummyClassificationWithUniqueKey("", "TASK");
@ -81,11 +81,11 @@ public class ClassificationServiceImplIntAutoCommitTest {
classification2.setParentId(classification0.getId()); classification2.setParentId(classification0.getId());
classificationService.createClassification(classification2); classificationService.createClassification(classification2);
Assert.assertEquals(2 + 1, classificationService.createClassificationQuery().list().size()); assertEquals(2 + 1, classificationService.createClassificationQuery().list().size());
} }
@Test @Test
public void testModifiedClassification() void testModifiedClassification()
throws ClassificationAlreadyExistException, ClassificationNotFoundException, NotAuthorizedException, throws ClassificationAlreadyExistException, ClassificationNotFoundException, NotAuthorizedException,
ConcurrencyException, DomainNotFoundException, InvalidArgumentException { ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
String description = "TEST SOMETHING"; String description = "TEST SOMETHING";
@ -96,11 +96,11 @@ public class ClassificationServiceImplIntAutoCommitTest {
classificationService.updateClassification(classification); classificationService.updateClassification(classification);
classification = classificationService.getClassification(classification.getKey(), classification.getDomain()); classification = classificationService.getClassification(classification.getKey(), classification.getDomain());
Assert.assertThat(description, equalTo(classification.getDescription())); assertThat(description, equalTo(classification.getDescription()));
} }
@Test @Test
public void testInsertClassification() void testInsertClassification()
throws NotAuthorizedException, ClassificationAlreadyExistException, InvalidArgumentException, throws NotAuthorizedException, ClassificationAlreadyExistException, InvalidArgumentException,
DomainNotFoundException { DomainNotFoundException {
Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK"); Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
@ -111,11 +111,11 @@ public class ClassificationServiceImplIntAutoCommitTest {
.createdWithin(today()) .createdWithin(today())
.list(); .list();
Assert.assertEquals(1, list.size()); assertEquals(1, list.size());
} }
@Test @Test
public void testUpdateClassification() void testUpdateClassification()
throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException, throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException,
ConcurrencyException, DomainNotFoundException, InvalidArgumentException { ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK"); Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
@ -126,19 +126,19 @@ public class ClassificationServiceImplIntAutoCommitTest {
List<ClassificationSummary> list = classificationService.createClassificationQuery() List<ClassificationSummary> list = classificationService.createClassificationQuery()
.validInDomainEquals(true) .validInDomainEquals(true)
.list(); .list();
Assert.assertEquals(1, list.size()); assertEquals(1, list.size());
classification = classificationService.updateClassification(classification); classification = classificationService.updateClassification(classification);
list = classificationService.createClassificationQuery() list = classificationService.createClassificationQuery()
.list(); .list();
Assert.assertEquals(2, list.size()); assertEquals(2, list.size());
List<ClassificationSummary> allClassifications = classificationService.createClassificationQuery().list(); List<ClassificationSummary> allClassifications = classificationService.createClassificationQuery().list();
Assert.assertEquals(2, allClassifications.size()); assertEquals(2, allClassifications.size());
} }
@Test @Test
public void testDefaultSettings() void testDefaultSettings()
throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException, throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException,
ConcurrencyException, DomainNotFoundException, InvalidArgumentException { ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK"); Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
@ -153,27 +153,27 @@ public class ClassificationServiceImplIntAutoCommitTest {
List<ClassificationSummary> list = classificationService.createClassificationQuery() List<ClassificationSummary> list = classificationService.createClassificationQuery()
.parentIdIn("") .parentIdIn("")
.list(); .list();
Assert.assertEquals(3, list.size()); assertEquals(3, list.size());
list = classificationService.createClassificationQuery() list = classificationService.createClassificationQuery()
.list(); .list();
Assert.assertEquals(4, list.size()); assertEquals(4, list.size());
List<ClassificationSummary> listAll = classificationService.createClassificationQuery().list(); List<ClassificationSummary> listAll = classificationService.createClassificationQuery().list();
list = classificationService.createClassificationQuery().list(); list = classificationService.createClassificationQuery().list();
Assert.assertEquals(listAll.size(), list.size()); assertEquals(listAll.size(), list.size());
list = classificationService.createClassificationQuery().validInDomainEquals(true).list(); list = classificationService.createClassificationQuery().validInDomainEquals(true).list();
Assert.assertEquals(2, list.size()); assertEquals(2, list.size());
list = classificationService.createClassificationQuery().createdWithin(today()).list(); list = classificationService.createClassificationQuery().createdWithin(today()).list();
Assert.assertEquals(4, list.size()); assertEquals(4, list.size());
list = classificationService.createClassificationQuery().domainIn("DOMAIN_C").validInDomainEquals(false).list(); list = classificationService.createClassificationQuery().domainIn("DOMAIN_C").validInDomainEquals(false).list();
Assert.assertEquals(0, list.size()); assertEquals(0, list.size());
list = classificationService.createClassificationQuery() list = classificationService.createClassificationQuery()
.list(); .list();
Assert.assertEquals(4, list.size()); assertEquals(4, list.size());
} }
private TimeInterval today() { private TimeInterval today() {

View File

@ -1,9 +1,9 @@
package pro.taskana.impl.integration; package pro.taskana.impl.integration;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.core.StringStartsWith.startsWith; import static org.hamcrest.core.StringStartsWith.startsWith;
import static org.junit.Assert.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
@ -16,12 +16,12 @@ import java.util.List;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.After; import org.hamcrest.core.IsEqual;
import org.junit.Assert; import org.junit.jupiter.api.AfterEach;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import pro.taskana.Classification; import pro.taskana.Classification;
import pro.taskana.ClassificationService; import pro.taskana.ClassificationService;
@ -29,7 +29,6 @@ import pro.taskana.ClassificationSummary;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
import pro.taskana.TaskanaEngine.ConnectionManagementMode; import pro.taskana.TaskanaEngine.ConnectionManagementMode;
import pro.taskana.TimeInterval; import pro.taskana.TimeInterval;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.ClassificationAlreadyExistException; import pro.taskana.exceptions.ClassificationAlreadyExistException;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.ConcurrencyException; import pro.taskana.exceptions.ConcurrencyException;
@ -38,7 +37,7 @@ import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.NotAuthorizedException; import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.impl.ClassificationImpl; import pro.taskana.impl.ClassificationImpl;
import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
import pro.taskana.sampledata.SampleDataGenerator; import pro.taskana.sampledata.SampleDataGenerator;
/** /**
@ -53,22 +52,22 @@ public class ClassificationServiceImplIntExplicitTest {
static int counter = 0; static int counter = 0;
private DataSource dataSource; private DataSource dataSource;
private ClassificationService classificationService; private ClassificationService classificationService;
private TaskanaEngineConfiguration taskanaEngineConfiguration; private pro.taskana.configuration.TaskanaEngineConfiguration taskanaEngineConfiguration;
private TaskanaEngine taskanaEngine; private TaskanaEngine taskanaEngine;
private TaskanaEngineImpl taskanaEngineImpl; private TaskanaEngineImpl taskanaEngineImpl;
@BeforeClass @BeforeAll
public static void resetDb() throws SQLException { public static void resetDb() throws SQLException {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource(); DataSource ds = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
new SampleDataGenerator(ds, schemaName).dropDb(); new SampleDataGenerator(ds, schemaName).dropDb();
} }
@Before @BeforeEach
public void setup() throws SQLException { public void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, false, taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(dataSource, false, false,
schemaName); schemaName);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
classificationService = taskanaEngine.getClassificationService(); classificationService = taskanaEngine.getClassificationService();
@ -78,6 +77,11 @@ public class ClassificationServiceImplIntExplicitTest {
sampleDataGenerator.clearDb(); sampleDataGenerator.clearDb();
} }
@AfterEach
public void cleanUp() throws SQLException {
taskanaEngineImpl.setConnection(null);
}
@Test @Test
public void testInsertClassification() public void testInsertClassification()
throws SQLException, ClassificationNotFoundException, ClassificationAlreadyExistException, throws SQLException, ClassificationNotFoundException, ClassificationAlreadyExistException,
@ -97,14 +101,14 @@ public class ClassificationServiceImplIntExplicitTest {
classificationService.createClassification(expectedClassification); classificationService.createClassification(expectedClassification);
connection.commit(); connection.commit();
actualClassification = classificationService.getClassification(key, "DOMAIN_B"); actualClassification = classificationService.getClassification(key, "DOMAIN_B");
assertThat(actualClassification, not(equalTo(null))); assertThat(actualClassification, not(IsEqual.equalTo(null)));
assertThat(actualClassification.getCreated(), not(equalTo(null))); assertThat(actualClassification.getCreated(), not(IsEqual.equalTo(null)));
assertThat(actualClassification.getId(), not(equalTo(null))); assertThat(actualClassification.getId(), not(IsEqual.equalTo(null)));
assertThat(actualClassification.getKey(), equalTo(key)); assertThat(actualClassification.getKey(), IsEqual.equalTo(key));
assertThat(actualClassification.getDomain(), equalTo("DOMAIN_B")); assertThat(actualClassification.getDomain(), IsEqual.equalTo("DOMAIN_B"));
assertThat(actualClassification.getId(), startsWith(ID_PREFIX_CLASSIFICATION)); assertThat(actualClassification.getId(), startsWith(ID_PREFIX_CLASSIFICATION));
Classification masterResult = classificationService.getClassification(key, ""); Classification masterResult = classificationService.getClassification(key, "");
assertThat(masterResult, not(equalTo(null))); assertThat(masterResult, not(IsEqual.equalTo(null)));
// invalid serviceLevel // invalid serviceLevel
ClassificationImpl expectedClassificationCreated = (ClassificationImpl) this.createNewClassificationWithUniqueKey( ClassificationImpl expectedClassificationCreated = (ClassificationImpl) this.createNewClassificationWithUniqueKey(
@ -135,7 +139,7 @@ public class ClassificationServiceImplIntExplicitTest {
classification2.setParentId(classification0.getId()); classification2.setParentId(classification0.getId());
classificationService.createClassification(classification2); classificationService.createClassification(classification2);
Assert.assertEquals(2 + 1, classificationService.createClassificationQuery().list().size()); assertEquals(2 + 1, classificationService.createClassificationQuery().list().size());
connection.commit(); connection.commit();
} }
@ -156,7 +160,7 @@ public class ClassificationServiceImplIntExplicitTest {
connection.commit(); connection.commit();
classification = classificationService.getClassification(classification.getKey(), classification.getDomain()); classification = classificationService.getClassification(classification.getKey(), classification.getDomain());
assertThat(classification.getDescription(), equalTo(updatedDescription)); assertThat(classification.getDescription(), IsEqual.equalTo(updatedDescription));
} }
@Test @Test
@ -171,7 +175,7 @@ public class ClassificationServiceImplIntExplicitTest {
.validInDomainEquals(Boolean.TRUE) .validInDomainEquals(Boolean.TRUE)
.createdWithin(today()) .createdWithin(today())
.list(); .list();
Assert.assertEquals(1, list.size()); assertEquals(1, list.size());
} }
@Test @Test
@ -188,19 +192,19 @@ public class ClassificationServiceImplIntExplicitTest {
List<ClassificationSummary> list = classificationService.createClassificationQuery() List<ClassificationSummary> list = classificationService.createClassificationQuery()
.list(); .list();
Assert.assertEquals(2, list.size()); assertEquals(2, list.size());
list = classificationService.createClassificationQuery().validInDomainEquals(true).list(); list = classificationService.createClassificationQuery().validInDomainEquals(true).list();
Assert.assertEquals(1, list.size()); assertEquals(1, list.size());
classification = classificationService.getClassification(classification.getKey(), classification.getDomain()); classification = classificationService.getClassification(classification.getKey(), classification.getDomain());
assertThat(classification.getDescription(), equalTo("description")); assertThat(classification.getDescription(), IsEqual.equalTo("description"));
classification = classificationService.updateClassification(classification); classification = classificationService.updateClassification(classification);
list = classificationService.createClassificationQuery() list = classificationService.createClassificationQuery()
.list(); .list();
Assert.assertEquals(2, list.size()); assertEquals(2, list.size());
List<ClassificationSummary> allClassifications = classificationService.createClassificationQuery().list(); List<ClassificationSummary> allClassifications = classificationService.createClassificationQuery().list();
Assert.assertEquals(2, allClassifications.size()); assertEquals(2, allClassifications.size());
connection.commit(); connection.commit();
} }
@ -221,36 +225,31 @@ public class ClassificationServiceImplIntExplicitTest {
List<ClassificationSummary> list = classificationService.createClassificationQuery() List<ClassificationSummary> list = classificationService.createClassificationQuery()
.parentIdIn("") .parentIdIn("")
.list(); .list();
Assert.assertEquals(3, list.size()); assertEquals(3, list.size());
list = classificationService.createClassificationQuery() list = classificationService.createClassificationQuery()
.list(); .list();
Assert.assertEquals(4, list.size()); assertEquals(4, list.size());
connection.commit(); connection.commit();
list = classificationService.createClassificationQuery().validInDomainEquals(true).list(); list = classificationService.createClassificationQuery().validInDomainEquals(true).list();
Assert.assertEquals(2, list.size()); assertEquals(2, list.size());
list = classificationService.createClassificationQuery().createdWithin(today()).list(); list = classificationService.createClassificationQuery().createdWithin(today()).list();
Assert.assertEquals(4, list.size()); assertEquals(4, list.size());
list = classificationService.createClassificationQuery().domainIn("DOMAIN_C").validInDomainEquals(false).list(); list = classificationService.createClassificationQuery().domainIn("DOMAIN_C").validInDomainEquals(false).list();
Assert.assertEquals(0, list.size()); assertEquals(0, list.size());
list = classificationService.createClassificationQuery() list = classificationService.createClassificationQuery()
.keyIn(classification1.getKey()) .keyIn(classification1.getKey())
.list(); .list();
Assert.assertEquals(2, list.size()); assertEquals(2, list.size());
list = classificationService.createClassificationQuery() list = classificationService.createClassificationQuery()
.parentIdIn(classification.getId()) .parentIdIn(classification.getId())
.list(); .list();
Assert.assertEquals(1, list.size()); assertEquals(1, list.size());
assertThat(list.get(0).getKey(), equalTo(classification1.getKey())); assertThat(list.get(0).getKey(), IsEqual.equalTo(classification1.getKey()));
connection.commit(); connection.commit();
} }
@After
public void cleanUp() throws SQLException {
taskanaEngineImpl.setConnection(null);
}
private Classification createNewClassificationWithUniqueKey(String domain, String type) { private Classification createNewClassificationWithUniqueKey(String domain, String type) {
Classification classification = classificationService.newClassification("TEST" + counter, domain, type); Classification classification = classificationService.newClassification("TEST" + counter, domain, type);
counter++; counter++;

View File

@ -1,8 +1,10 @@
package pro.taskana.impl.integration; package pro.taskana.impl.integration;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat; import static org.hamcrest.core.IsNot.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
@ -10,7 +12,6 @@ import java.util.UUID;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -29,7 +30,6 @@ import pro.taskana.Workbasket;
import pro.taskana.WorkbasketAccessItem; import pro.taskana.WorkbasketAccessItem;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketType; import pro.taskana.WorkbasketType;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.ClassificationAlreadyExistException; import pro.taskana.exceptions.ClassificationAlreadyExistException;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.DomainNotFoundException; import pro.taskana.exceptions.DomainNotFoundException;
@ -48,7 +48,7 @@ import pro.taskana.impl.TaskImpl;
import pro.taskana.impl.TaskServiceImpl; import pro.taskana.impl.TaskServiceImpl;
import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.WorkbasketImpl; import pro.taskana.impl.WorkbasketImpl;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
import pro.taskana.impl.util.IdGenerator; import pro.taskana.impl.util.IdGenerator;
import pro.taskana.sampledata.SampleDataGenerator; import pro.taskana.sampledata.SampleDataGenerator;
import pro.taskana.security.CurrentUserContext; import pro.taskana.security.CurrentUserContext;
@ -67,7 +67,7 @@ class TaskServiceImplIntAutocommitTest {
private TaskServiceImpl taskServiceImpl; private TaskServiceImpl taskServiceImpl;
private TaskanaEngineConfiguration taskanaEngineConfiguration; private pro.taskana.configuration.TaskanaEngineConfiguration taskanaEngineConfiguration;
private TaskanaEngine taskanaEngine; private TaskanaEngine taskanaEngine;
@ -79,9 +79,9 @@ class TaskServiceImplIntAutocommitTest {
@BeforeEach @BeforeEach
void setup() throws SQLException { void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, false, taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(dataSource, false, false,
schemaName); schemaName);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
@ -118,7 +118,7 @@ class TaskServiceImplIntAutocommitTest {
TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine(); TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService(); TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
Task resultTask = taskServiceImpl2.getTask(task.getId()); Task resultTask = taskServiceImpl2.getTask(task.getId());
Assert.assertNotNull(resultTask); assertNotNull(resultTask);
} }
@Test @Test
@ -188,7 +188,7 @@ class TaskServiceImplIntAutocommitTest {
.primaryObjectReferenceValueIn("val1", "val2", "val3") .primaryObjectReferenceValueIn("val1", "val2", "val3")
.list(); .list();
Assert.assertEquals(0, results.size()); assertEquals(0, results.size());
} }
@Test @Test
@ -266,9 +266,9 @@ class TaskServiceImplIntAutocommitTest {
final String user = CurrentUserContext.getUserid(); final String user = CurrentUserContext.getUserid();
// Set up Security for this Test // Set up Security for this Test
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineTestConfiguration.getDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, true, taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(dataSource, false, true,
TaskanaEngineConfigurationTest.getSchemaName()); TaskanaEngineTestConfiguration.getSchemaName());
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT); taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
@ -375,7 +375,7 @@ class TaskServiceImplIntAutocommitTest {
Task task2 = taskServiceImpl.getTask(task.getId()); Task task2 = taskServiceImpl.getTask(task.getId());
// skanaEngineImpl.getSqlSession().commit(); // needed so that the change is visible in the other session // skanaEngineImpl.getSqlSession().commit(); // needed so that the change is visible in the other session
Assert.assertNotNull(task2); assertNotNull(task2);
} }
private void createWorkbasketWithSecurity(Workbasket wb, String accessId, boolean permOpen, private void createWorkbasketWithSecurity(Workbasket wb, String accessId, boolean permOpen,

View File

@ -1,8 +1,10 @@
package pro.taskana.impl.integration; package pro.taskana.impl.integration;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat; import static org.hamcrest.core.IsNot.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File; import java.io.File;
@ -13,7 +15,6 @@ import java.util.UUID;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.Assert;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
@ -34,7 +35,6 @@ import pro.taskana.WorkbasketAccessItem;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketType; import pro.taskana.WorkbasketType;
import pro.taskana.configuration.DbSchemaCreator; import pro.taskana.configuration.DbSchemaCreator;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.ClassificationAlreadyExistException; import pro.taskana.exceptions.ClassificationAlreadyExistException;
import pro.taskana.exceptions.ClassificationNotFoundException; import pro.taskana.exceptions.ClassificationNotFoundException;
import pro.taskana.exceptions.DomainNotFoundException; import pro.taskana.exceptions.DomainNotFoundException;
@ -54,7 +54,7 @@ import pro.taskana.impl.TaskServiceImpl;
import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.WorkbasketImpl; import pro.taskana.impl.WorkbasketImpl;
import pro.taskana.impl.WorkbasketSummaryImpl; import pro.taskana.impl.WorkbasketSummaryImpl;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
import pro.taskana.impl.util.IdGenerator; import pro.taskana.impl.util.IdGenerator;
import pro.taskana.sampledata.SampleDataGenerator; import pro.taskana.sampledata.SampleDataGenerator;
import pro.taskana.security.CurrentUserContext; import pro.taskana.security.CurrentUserContext;
@ -73,7 +73,7 @@ class TaskServiceImplIntExplicitTest {
private static TaskServiceImpl taskServiceImpl; private static TaskServiceImpl taskServiceImpl;
private static TaskanaEngineConfiguration taskanaEngineConfiguration; private static pro.taskana.configuration.TaskanaEngineConfiguration taskanaEngineConfiguration;
private static TaskanaEngine taskanaEngine; private static TaskanaEngine taskanaEngine;
@ -89,10 +89,10 @@ class TaskServiceImplIntExplicitTest {
String propertiesFileName = userHomeDirectory + "/taskanaUnitTest.properties"; String propertiesFileName = userHomeDirectory + "/taskanaUnitTest.properties";
dataSource = new File(propertiesFileName).exists() dataSource = new File(propertiesFileName).exists()
? TaskanaEngineConfigurationTest.createDataSourceFromProperties(propertiesFileName) ? TaskanaEngineTestConfiguration.createDataSourceFromProperties(propertiesFileName)
: TaskanaEngineConfiguration.createDefaultDataSource(); : pro.taskana.configuration.TaskanaEngineConfiguration.createDefaultDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(dataSource, false,
TaskanaEngineConfigurationTest.getSchemaName()); TaskanaEngineTestConfiguration.getSchemaName());
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
taskServiceImpl = (TaskServiceImpl) taskanaEngine.getTaskService(); taskServiceImpl = (TaskServiceImpl) taskanaEngine.getTaskService();
taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
@ -105,7 +105,7 @@ class TaskServiceImplIntExplicitTest {
@BeforeEach @BeforeEach
void resetDb() { void resetDb() {
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource, schemaName); SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource, schemaName);
sampleDataGenerator.clearDb(); sampleDataGenerator.clearDb();
} }
@ -177,7 +177,7 @@ class TaskServiceImplIntExplicitTest {
TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine(); TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService(); TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
Task resultTask = taskServiceImpl2.getTask(task.getId()); Task resultTask = taskServiceImpl2.getTask(task.getId());
Assert.assertNotNull(resultTask); assertNotNull(resultTask);
connection.commit(); connection.commit();
} }
@ -268,7 +268,7 @@ class TaskServiceImplIntExplicitTest {
.primaryObjectReferenceValueIn("val1", "val2", "val3") .primaryObjectReferenceValueIn("val1", "val2", "val3")
.list(); .list();
Assert.assertEquals(0, results.size()); assertEquals(0, results.size());
connection.commit(); connection.commit();
} }
@ -361,9 +361,9 @@ class TaskServiceImplIntExplicitTest {
final String user = "User"; final String user = "User";
// Set up Security for this Test // Set up Security for this Test
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineTestConfiguration.getDataSource();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, true, taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(dataSource, false, true,
TaskanaEngineConfigurationTest.getSchemaName()); TaskanaEngineTestConfiguration.getSchemaName());
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT); taskanaEngineImpl.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);

View File

@ -1,5 +1,8 @@
package pro.taskana.impl.integration; package pro.taskana.impl.integration;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.sql.SQLException; import java.sql.SQLException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
@ -14,11 +17,11 @@ import java.util.List;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSession;
import org.junit.Assert; import org.junit.jupiter.api.Assertions;
import org.junit.Before; import org.junit.jupiter.api.BeforeAll;
import org.junit.BeforeClass; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.jupiter.api.extension.ExtendWith;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
import pro.taskana.TaskanaEngine.ConnectionManagementMode; import pro.taskana.TaskanaEngine.ConnectionManagementMode;
@ -28,7 +31,6 @@ import pro.taskana.WorkbasketAccessItem;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
import pro.taskana.WorkbasketType; import pro.taskana.WorkbasketType;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.DomainNotFoundException; import pro.taskana.exceptions.DomainNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidWorkbasketException; import pro.taskana.exceptions.InvalidWorkbasketException;
@ -37,11 +39,11 @@ import pro.taskana.exceptions.WorkbasketAlreadyExistException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.impl.TaskanaEngineProxyForTest; import pro.taskana.impl.TaskanaEngineProxyForTest;
import pro.taskana.impl.WorkbasketImpl; import pro.taskana.impl.WorkbasketImpl;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
import pro.taskana.impl.util.IdGenerator; import pro.taskana.impl.util.IdGenerator;
import pro.taskana.mappings.WorkbasketMapper; import pro.taskana.mappings.WorkbasketMapper;
import pro.taskana.sampledata.SampleDataGenerator; import pro.taskana.sampledata.SampleDataGenerator;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASExtension;
import pro.taskana.security.WithAccessId; import pro.taskana.security.WithAccessId;
/** /**
@ -49,28 +51,27 @@ import pro.taskana.security.WithAccessId;
* *
* @author EH * @author EH
*/ */
@RunWith(JAASRunner.class) @ExtendWith(JAASExtension.class)
public class WorkbasketServiceImplIntAutocommitTest { class WorkbasketServiceImplIntAutocommitTest {
private static final int SLEEP_TIME = 100; private static final int SLEEP_TIME = 100;
private DataSource dataSource;
private TaskanaEngineConfiguration taskanaEngineConfiguration;
private TaskanaEngine taskanaEngine; private TaskanaEngine taskanaEngine;
private WorkbasketService workBasketService; private WorkbasketService workBasketService;
private Instant now; private Instant now;
@BeforeClass @BeforeAll
public static void resetDb() throws SQLException { static void resetDb() {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource(); DataSource ds = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
new SampleDataGenerator(ds, schemaName).dropDb(); new SampleDataGenerator(ds, schemaName).dropDb();
} }
@Before @BeforeEach
public void setup() throws SQLException { void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); DataSource dataSource = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, pro.taskana.configuration.TaskanaEngineConfiguration taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(
dataSource, false,
schemaName); schemaName);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
taskanaEngine.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT); taskanaEngine.setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
@ -80,15 +81,15 @@ public class WorkbasketServiceImplIntAutocommitTest {
now = Instant.now(); now = Instant.now();
} }
@Test(expected = WorkbasketNotFoundException.class) @Test
public void testGetWorkbasketFail() void testGetWorkbasketFail() {
throws WorkbasketNotFoundException, NotAuthorizedException { Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
workBasketService.getWorkbasket("fail"); workBasketService.getWorkbasket("fail"));
} }
@WithAccessId(userName = "Elena", groupNames = {"businessadmin"}) @WithAccessId(userName = "Elena", groupNames = {"businessadmin"})
@Test @Test
public void testUpdateWorkbasket() throws Exception { void testUpdateWorkbasket() throws Exception {
String id0 = IdGenerator.generateWithPrefix("TWB"); String id0 = IdGenerator.generateWithPrefix("TWB");
Workbasket workbasket0 = createTestWorkbasket(id0, "key0", "DOMAIN_A", "Superbasket", WorkbasketType.GROUP); Workbasket workbasket0 = createTestWorkbasket(id0, "key0", "DOMAIN_A", "Superbasket", WorkbasketType.GROUP);
workbasket0 = workBasketService.createWorkbasket(workbasket0); workbasket0 = workBasketService.createWorkbasket(workbasket0);
@ -121,19 +122,19 @@ public class WorkbasketServiceImplIntAutocommitTest {
List<WorkbasketSummary> distributionTargets = workBasketService.getDistributionTargets(foundBasket.getId()); List<WorkbasketSummary> distributionTargets = workBasketService.getDistributionTargets(foundBasket.getId());
Assert.assertEquals(1, distributionTargets.size()); assertEquals(1, distributionTargets.size());
Assert.assertEquals(id3, distributionTargets.get(0).getId()); assertEquals(id3, distributionTargets.get(0).getId());
Assert.assertNotEquals(workBasketService.getWorkbasket(id2).getCreated(), assertNotEquals(workBasketService.getWorkbasket(id2).getCreated(),
workBasketService.getWorkbasket(id2).getModified()); workBasketService.getWorkbasket(id2).getModified());
Assert.assertEquals(workBasketService.getWorkbasket(id1).getCreated(), assertEquals(workBasketService.getWorkbasket(id1).getCreated(),
workBasketService.getWorkbasket(id1).getModified()); workBasketService.getWorkbasket(id1).getModified());
Assert.assertEquals(workBasketService.getWorkbasket(id3).getCreated(), assertEquals(workBasketService.getWorkbasket(id3).getCreated(),
workBasketService.getWorkbasket(id3).getModified()); workBasketService.getWorkbasket(id3).getModified());
} }
@WithAccessId(userName = "Elena", groupNames = {"businessadmin"}) @WithAccessId(userName = "Elena", groupNames = {"businessadmin"})
@Test @Test
public void testInsertWorkbasketAccessUser() throws NotAuthorizedException, InvalidArgumentException, void testInsertWorkbasketAccessUser() throws NotAuthorizedException, InvalidArgumentException,
DomainNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException, DomainNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
WorkbasketNotFoundException { WorkbasketNotFoundException {
@ -146,13 +147,13 @@ public class WorkbasketServiceImplIntAutocommitTest {
accessItem.setPermRead(true); accessItem.setPermRead(true);
workBasketService.createWorkbasketAccessItem(accessItem); workBasketService.createWorkbasketAccessItem(accessItem);
Assert.assertEquals(1, assertEquals(1,
workBasketService.getWorkbasketAccessItems("k100000000000000000000000000000000000000").size()); workBasketService.getWorkbasketAccessItems("k100000000000000000000000000000000000000").size());
} }
@WithAccessId(userName = "Elena", groupNames = {"businessadmin"}) @WithAccessId(userName = "Elena", groupNames = {"businessadmin"})
@Test @Test
public void testUpdateWorkbasketAccessUser() void testUpdateWorkbasketAccessUser()
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, DomainNotFoundException, throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException, DomainNotFoundException,
InvalidWorkbasketException, WorkbasketAlreadyExistException { InvalidWorkbasketException, WorkbasketAlreadyExistException {
WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket("key", "DOMAIN_A"); WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket("key", "DOMAIN_A");
@ -169,16 +170,16 @@ public class WorkbasketServiceImplIntAutocommitTest {
accessItem.setPermRead(true); accessItem.setPermRead(true);
workBasketService.createWorkbasketAccessItem(accessItem); workBasketService.createWorkbasketAccessItem(accessItem);
Assert.assertEquals(1, assertEquals(1,
workBasketService.getWorkbasketAccessItems("k200000000000000000000000000000000000000").size()); workBasketService.getWorkbasketAccessItems("k200000000000000000000000000000000000000").size());
accessItem.setPermAppend(true); accessItem.setPermAppend(true);
workBasketService.updateWorkbasketAccessItem(accessItem); workBasketService.updateWorkbasketAccessItem(accessItem);
if (TaskanaEngineConfiguration.shouldUseLowerCaseForAccessIds()) { if (pro.taskana.configuration.TaskanaEngineConfiguration.shouldUseLowerCaseForAccessIds()) {
Assert.assertEquals("zaphod beeblebrox", accessItem.getAccessId()); assertEquals("zaphod beeblebrox", accessItem.getAccessId());
} else { } else {
Assert.assertEquals("Zaphod Beeblebrox", accessItem.getAccessId()); assertEquals("Zaphod Beeblebrox", accessItem.getAccessId());
} }
} }

View File

@ -1,5 +1,8 @@
package pro.taskana.impl.integration; package pro.taskana.impl.integration;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
@ -8,12 +11,11 @@ import java.util.List;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.junit.After; import org.junit.jupiter.api.AfterEach;
import org.junit.Assert; import org.junit.jupiter.api.BeforeAll;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.BeforeClass; import org.junit.jupiter.api.Test;
import org.junit.Test; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import pro.taskana.TaskanaEngine; import pro.taskana.TaskanaEngine;
import pro.taskana.TaskanaEngine.ConnectionManagementMode; import pro.taskana.TaskanaEngine.ConnectionManagementMode;
@ -22,7 +24,6 @@ import pro.taskana.WorkbasketAccessItem;
import pro.taskana.WorkbasketService; import pro.taskana.WorkbasketService;
import pro.taskana.WorkbasketSummary; import pro.taskana.WorkbasketSummary;
import pro.taskana.WorkbasketType; import pro.taskana.WorkbasketType;
import pro.taskana.configuration.TaskanaEngineConfiguration;
import pro.taskana.exceptions.DomainNotFoundException; import pro.taskana.exceptions.DomainNotFoundException;
import pro.taskana.exceptions.InvalidArgumentException; import pro.taskana.exceptions.InvalidArgumentException;
import pro.taskana.exceptions.InvalidWorkbasketException; import pro.taskana.exceptions.InvalidWorkbasketException;
@ -31,10 +32,10 @@ import pro.taskana.exceptions.WorkbasketAlreadyExistException;
import pro.taskana.exceptions.WorkbasketNotFoundException; import pro.taskana.exceptions.WorkbasketNotFoundException;
import pro.taskana.impl.TaskanaEngineImpl; import pro.taskana.impl.TaskanaEngineImpl;
import pro.taskana.impl.WorkbasketImpl; import pro.taskana.impl.WorkbasketImpl;
import pro.taskana.impl.configuration.TaskanaEngineConfigurationTest; import pro.taskana.impl.configuration.TaskanaEngineTestConfiguration;
import pro.taskana.impl.util.IdGenerator; import pro.taskana.impl.util.IdGenerator;
import pro.taskana.sampledata.SampleDataGenerator; import pro.taskana.sampledata.SampleDataGenerator;
import pro.taskana.security.JAASRunner; import pro.taskana.security.JAASExtension;
import pro.taskana.security.WithAccessId; import pro.taskana.security.WithAccessId;
/** /**
@ -42,29 +43,29 @@ import pro.taskana.security.WithAccessId;
* *
* @author bbr * @author bbr
*/ */
@RunWith(JAASRunner.class) @ExtendWith(JAASExtension.class)
public class WorkbasketServiceImplIntExplicitTest { class WorkbasketServiceImplIntExplicitTest {
private static final int SLEEP_TIME = 100; private static final int SLEEP_TIME = 100;
static int counter = 0; static int counter = 0;
private DataSource dataSource; private DataSource dataSource;
private TaskanaEngineConfiguration taskanaEngineConfiguration; private pro.taskana.configuration.TaskanaEngineConfiguration taskanaEngineConfiguration;
private TaskanaEngine taskanaEngine; private TaskanaEngine taskanaEngine;
private TaskanaEngineImpl taskanaEngineImpl; private TaskanaEngineImpl taskanaEngineImpl;
private WorkbasketService workBasketService; private WorkbasketService workBasketService;
@BeforeClass @BeforeAll
public static void resetDb() { static void resetDb() {
DataSource ds = TaskanaEngineConfigurationTest.getDataSource(); DataSource ds = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
new SampleDataGenerator(ds, schemaName).dropDb(); new SampleDataGenerator(ds, schemaName).dropDb();
} }
@Before @BeforeEach
public void setup() throws SQLException { void setup() throws SQLException {
dataSource = TaskanaEngineConfigurationTest.getDataSource(); dataSource = TaskanaEngineTestConfiguration.getDataSource();
String schemaName = TaskanaEngineConfigurationTest.getSchemaName(); String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
taskanaEngineConfiguration = new TaskanaEngineConfiguration(dataSource, false, taskanaEngineConfiguration = new pro.taskana.configuration.TaskanaEngineConfiguration(dataSource, false,
schemaName); schemaName);
taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine(); taskanaEngine = taskanaEngineConfiguration.buildTaskanaEngine();
taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine; taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
@ -75,7 +76,7 @@ public class WorkbasketServiceImplIntExplicitTest {
@WithAccessId(userName = "Elena", groupNames = {"businessadmin"}) @WithAccessId(userName = "Elena", groupNames = {"businessadmin"})
@Test @Test
public void testUpdateWorkbasket() throws Exception { void testUpdateWorkbasket() throws Exception {
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection); taskanaEngineImpl.setConnection(connection);
workBasketService = taskanaEngine.getWorkbasketService(); workBasketService = taskanaEngine.getWorkbasketService();
@ -111,20 +112,20 @@ public class WorkbasketServiceImplIntExplicitTest {
Workbasket foundBasket = workBasketService.getWorkbasket(workbasket2.getId()); Workbasket foundBasket = workBasketService.getWorkbasket(workbasket2.getId());
List<WorkbasketSummary> distributionTargets = workBasketService.getDistributionTargets(foundBasket.getId()); List<WorkbasketSummary> distributionTargets = workBasketService.getDistributionTargets(foundBasket.getId());
Assert.assertEquals(1, distributionTargets.size()); assertEquals(1, distributionTargets.size());
Assert.assertEquals(workbasket3.getId(), distributionTargets.get(0).getId()); assertEquals(workbasket3.getId(), distributionTargets.get(0).getId());
Assert.assertNotEquals(workBasketService.getWorkbasket(id2).getCreated(), assertNotEquals(workBasketService.getWorkbasket(id2).getCreated(),
workBasketService.getWorkbasket(id2).getModified()); workBasketService.getWorkbasket(id2).getModified());
Assert.assertEquals(workBasketService.getWorkbasket(id1).getCreated(), assertEquals(workBasketService.getWorkbasket(id1).getCreated(),
workBasketService.getWorkbasket(id1).getModified()); workBasketService.getWorkbasket(id1).getModified());
Assert.assertEquals(workBasketService.getWorkbasket(id3).getCreated(), assertEquals(workBasketService.getWorkbasket(id3).getCreated(),
workBasketService.getWorkbasket(id3).getModified()); workBasketService.getWorkbasket(id3).getModified());
connection.commit(); connection.commit();
} }
@WithAccessId(userName = "Elena", groupNames = {"businessadmin"}) @WithAccessId(userName = "Elena", groupNames = {"businessadmin"})
@Test @Test
public void testInsertWorkbasketAccessUser() void testInsertWorkbasketAccessUser()
throws NotAuthorizedException, SQLException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, SQLException, InvalidArgumentException, WorkbasketNotFoundException,
DomainNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException { DomainNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException {
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
@ -139,13 +140,13 @@ public class WorkbasketServiceImplIntExplicitTest {
accessItem.setPermRead(true); accessItem.setPermRead(true);
workBasketService.createWorkbasketAccessItem(accessItem); workBasketService.createWorkbasketAccessItem(accessItem);
Assert.assertEquals(1, workBasketService.getWorkbasketAccessItems("id1").size()); assertEquals(1, workBasketService.getWorkbasketAccessItems("id1").size());
connection.commit(); connection.commit();
} }
@WithAccessId(userName = "Elena", groupNames = {"businessadmin"}) @WithAccessId(userName = "Elena", groupNames = {"businessadmin"})
@Test @Test
public void testUpdateWorkbasketAccessUser() void testUpdateWorkbasketAccessUser()
throws NotAuthorizedException, SQLException, InvalidArgumentException, WorkbasketNotFoundException, throws NotAuthorizedException, SQLException, InvalidArgumentException, WorkbasketNotFoundException,
DomainNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException { DomainNotFoundException, InvalidWorkbasketException, WorkbasketAlreadyExistException {
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
@ -161,8 +162,8 @@ public class WorkbasketServiceImplIntExplicitTest {
accessItem.setPermRead(true); accessItem.setPermRead(true);
workBasketService.createWorkbasketAccessItem(accessItem); workBasketService.createWorkbasketAccessItem(accessItem);
Assert.assertEquals(1, workBasketService.getWorkbasketAccessItems("key2").size()); assertEquals(1, workBasketService.getWorkbasketAccessItems("key2").size());
Assert.assertEquals("zaphod beeblebrox", accessItem.getAccessId()); assertEquals("zaphod beeblebrox", accessItem.getAccessId());
connection.commit(); connection.commit();
} }
@ -187,8 +188,8 @@ public class WorkbasketServiceImplIntExplicitTest {
return wb; return wb;
} }
@After @AfterEach
public void cleanUp() throws SQLException { void cleanUp() throws SQLException {
taskanaEngineImpl.setConnection(null); taskanaEngineImpl.setConnection(null);
} }

View File

@ -1,7 +1,7 @@
package pro.taskana.impl.report.structure; package pro.taskana.impl.report.structure;
import static org.junit.Assert.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -10,8 +10,8 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import pro.taskana.impl.report.header.TimeIntervalColumnHeader; import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
import pro.taskana.impl.report.item.MonitorQueryItem; import pro.taskana.impl.report.item.MonitorQueryItem;
@ -19,7 +19,7 @@ import pro.taskana.impl.report.item.MonitorQueryItem;
/** /**
* Tests for {@link Report}. * Tests for {@link Report}.
*/ */
public class ReportTest { class ReportTest {
private static final List<TimeIntervalColumnHeader> HEADERS = IntStream.range(0, 4) private static final List<TimeIntervalColumnHeader> HEADERS = IntStream.range(0, 4)
.mapToObj(TimeIntervalColumnHeader::new) .mapToObj(TimeIntervalColumnHeader::new)
@ -27,8 +27,8 @@ public class ReportTest {
private Report<MonitorQueryItem, TimeIntervalColumnHeader> report; private Report<MonitorQueryItem, TimeIntervalColumnHeader> report;
private MonitorQueryItem item; private MonitorQueryItem item;
@Before @BeforeEach
public void before() { void before() {
this.report = new Report<MonitorQueryItem, TimeIntervalColumnHeader>(HEADERS, new String[] {"rowDesc"}) { this.report = new Report<MonitorQueryItem, TimeIntervalColumnHeader>(HEADERS, new String[] {"rowDesc"}) {
}; };
@ -40,7 +40,7 @@ public class ReportTest {
} }
@Test @Test
public void testEmptyReport() { void testEmptyReport() {
//then //then
assertEquals(0, report.getRows().size()); assertEquals(0, report.getRows().size());
Row<MonitorQueryItem> sumRow = report.getSumRow(); Row<MonitorQueryItem> sumRow = report.getSumRow();
@ -49,7 +49,7 @@ public class ReportTest {
} }
@Test @Test
public void testInsertSingleItem() { void testInsertSingleItem() {
//when //when
report.addItem(item); report.addItem(item);
@ -62,7 +62,7 @@ public class ReportTest {
} }
@Test @Test
public void testInsertSameItemMultipleTimes() { void testInsertSameItemMultipleTimes() {
//when //when
report.addItem(item); report.addItem(item);
report.addItem(item); report.addItem(item);
@ -76,7 +76,7 @@ public class ReportTest {
} }
@Test @Test
public void testInsertSameItemMultipleTimes2() { void testInsertSameItemMultipleTimes2() {
//given //given
MonitorQueryItem item = new MonitorQueryItem(); MonitorQueryItem item = new MonitorQueryItem();
item.setKey("key"); item.setKey("key");
@ -95,7 +95,7 @@ public class ReportTest {
} }
@Test @Test
public void testInsertSameItemMultipleTimesWithPreProcessor() { void testInsertSameItemMultipleTimesWithPreProcessor() {
//given //given
int overrideValue = 5; int overrideValue = 5;
QueryItemPreprocessor<MonitorQueryItem> preprocessor = (item) -> { QueryItemPreprocessor<MonitorQueryItem> preprocessor = (item) -> {
@ -114,7 +114,7 @@ public class ReportTest {
} }
@Test @Test
public void testInsertItemWithNoColumnHeaders() { void testInsertItemWithNoColumnHeaders() {
//given //given
report = new Report<MonitorQueryItem, TimeIntervalColumnHeader>(Collections.emptyList(), report = new Report<MonitorQueryItem, TimeIntervalColumnHeader>(Collections.emptyList(),
new String[] {"rowDesc"}) { new String[] {"rowDesc"}) {
@ -131,7 +131,7 @@ public class ReportTest {
} }
@Test @Test
public void testInsertItemWhichIsNotInHeaderScopes() { void testInsertItemWhichIsNotInHeaderScopes() {
//given //given
item.setAgeInDays(-2); item.setAgeInDays(-2);
//when //when
@ -145,7 +145,7 @@ public class ReportTest {
} }
@Test @Test
public void testInsertItemWhichIsInMultipleHeaderScopes() { void testInsertItemWhichIsInMultipleHeaderScopes() {
//given //given
List<TimeIntervalColumnHeader> headers = new ArrayList<>(HEADERS); List<TimeIntervalColumnHeader> headers = new ArrayList<>(HEADERS);
headers.add(new TimeIntervalColumnHeader(0, 3)); headers.add(new TimeIntervalColumnHeader(0, 3));
@ -171,7 +171,7 @@ public class ReportTest {
} }
@Test @Test
public void testInsertItemWithPreProcessor() { void testInsertItemWithPreProcessor() {
//given //given
int overrideValue = 5; int overrideValue = 5;
QueryItemPreprocessor<MonitorQueryItem> preprocessor = item -> { QueryItemPreprocessor<MonitorQueryItem> preprocessor = item -> {

View File

@ -24,7 +24,8 @@ public interface TaskTestMapper {
}) })
String getCustomAttributesAsString(@Param("taskId") String taskId); String getCustomAttributesAsString(@Param("taskId") String taskId);
@Select("SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, CLASSIFICATION_CATEGORY, CLASSIFICATION_KEY, CLASSIFICATION_ID, WORKBASKET_ID, WORKBASKET_KEY, DOMAIN, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_ATTRIBUTES, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10 " @Select(
"SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, CREATOR, DESCRIPTION, NOTE, PRIORITY, STATE, CLASSIFICATION_CATEGORY, CLASSIFICATION_KEY, CLASSIFICATION_ID, WORKBASKET_ID, WORKBASKET_KEY, DOMAIN, BUSINESS_PROCESS_ID, PARENT_BUSINESS_PROCESS_ID, OWNER, POR_COMPANY, POR_SYSTEM, POR_INSTANCE, POR_TYPE, POR_VALUE, IS_READ, IS_TRANSFERRED, CUSTOM_ATTRIBUTES, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10 "
+ "FROM TASK " + "FROM TASK "
+ "WHERE CUSTOM_ATTRIBUTES like #{searchText}") + "WHERE CUSTOM_ATTRIBUTES like #{searchText}")
@Results(value = { @Results(value = {

View File

@ -1,83 +0,0 @@
package pro.taskana.security;
import java.security.Principal;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.List;
import javax.security.auth.Subject;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
/**
* Runner for integration tests that enables JAAS subject.
*/
public class JAASRunner extends BlockJUnit4ClassRunner {
public JAASRunner(Class<?> c) throws InitializationError {
super(c);
}
@Override
protected Statement methodInvoker(FrameworkMethod method, Object test) {
Subject subject = new Subject();
List<Principal> principalList = new ArrayList<>();
if (test != null) {
WithAccessId withAccessId = method.getMethod().getAnnotation(WithAccessId.class);
if (withAccessId != null) {
if (withAccessId.userName() != null) {
principalList.add(new UserPrincipal(withAccessId.userName()));
}
for (String groupName : withAccessId.groupNames()) {
if (groupName != null) {
principalList.add(new GroupPrincipal(groupName));
}
}
}
subject.getPrincipals().addAll(principalList);
}
final Statement base = super.methodInvoker(method, test);
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
Subject.doAs(subject, new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
try {
base.evaluate();
} catch (Throwable e) {
throw new Exception(e);
}
return null;
}
});
} catch (PrivilegedActionException e) {
Throwable cause = e.getCause();
Throwable nestedCause = null;
if (cause != null) {
nestedCause = cause.getCause();
}
if (nestedCause != null) {
throw nestedCause;
} else if (cause != null) {
throw cause;
} else {
throw e;
}
}
}
};
}
}

View File

@ -13,6 +13,8 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD}) @Target({ElementType.METHOD})
public @interface WithAccessId { public @interface WithAccessId {
String userName(); String userName();
String[] groupNames() default {}; String[] groupNames() default {};
} }

View File

@ -3,12 +3,12 @@
<Configuration status="WARN"> <Configuration status="WARN">
<Appenders> <Appenders>
<Console name="Console" target="SYSTEM_OUT"> <Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console> </Console>
</Appenders> </Appenders>
<Loggers> <Loggers>
<Root level="info"> <Root level="info">
<AppenderRef ref="Console" /> <AppenderRef ref="Console"/>
</Root> </Root>
</Loggers> </Loggers>
</Configuration> </Configuration>

View File

@ -1,14 +1,11 @@
taskana.roles.user = group1 | group2|teamlead_1 | teamlead_2 |user_1_1| user_1_1| user_1_2| user_2_1| user_2_2| max|elena|simone taskana.roles.user=group1 | group2|teamlead_1 | teamlead_2 |user_1_1| user_1_1| user_1_2| user_2_1| user_2_2| max|elena|simone
taskana.roles.Admin=name=konrad,Organisation=novatec|admin taskana.roles.Admin=name=konrad,Organisation=novatec|admin
taskana.roles.businessadmin=max|Moritz|businessadmin taskana.roles.businessadmin=max|Moritz|businessadmin
taskana.roles.monitor=john|teamlead_2 | monitor taskana.roles.monitor=john|teamlead_2 | monitor
taskana.domains=Domain_A , DOMAIN_B
taskana.domains= Domain_A , DOMAIN_B taskana.classification.types=TASK , document
taskana.classification.categories.task=EXTERNAL, manual, autoMAtic, Process
taskana.classification.types= TASK , document taskana.classification.categories.document=EXTERNAL
taskana.classification.categories.task= EXTERNAL, manual, autoMAtic, Process
taskana.classification.categories.document= EXTERNAL
taskana.jobs.maxRetries=3 taskana.jobs.maxRetries=3
taskana.jobs.batchSize=50 taskana.jobs.batchSize=50
taskana.jobs.cleanup.runEvery=P1D taskana.jobs.cleanup.runEvery=P1D

View File

@ -68,7 +68,8 @@
<version.junit.jupiter>5.5.2</version.junit.jupiter> <version.junit.jupiter>5.5.2</version.junit.jupiter>
<version.log4j>2.8.1</version.log4j> <version.log4j>2.8.1</version.log4j>
<version.archunit>0.12.0</version.archunit> <version.archunit>0.12.0</version.archunit>
<version.mockito>2.8.47</version.mockito> <version.mockito>2.24.0</version.mockito>
<version.junit.mockito>3.2.0</version.junit.mockito>
<version.powermock>1.7.1</version.powermock> <version.powermock>1.7.1</version.powermock>
<version.hamcrest>1.3</version.hamcrest> <version.hamcrest>1.3</version.hamcrest>
<version.equalsverifier>3.1.10</version.equalsverifier> <version.equalsverifier>3.1.10</version.equalsverifier>