TSK-719: Upgrade from JUnit 4 to JUnit5
This commit is contained in:
parent
837aa0c11c
commit
c686da8ba2
|
@ -44,9 +44,22 @@
|
||||||
<version>${version.mybatis}</version>
|
<version>${version.mybatis}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>${version.junit}</version>
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.powermock</groupId>
|
<groupId>org.powermock</groupId>
|
||||||
|
|
|
@ -51,9 +51,21 @@
|
||||||
<artifactId>spring-plugin-core</artifactId>
|
<artifactId>spring-plugin-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>${version.junit}</version>
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -26,9 +26,21 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>${version.junit}</version>
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -37,9 +37,21 @@
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>${version.junit}</version>
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.util.Map;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
||||||
import pro.taskana.Attachment;
|
import pro.taskana.Attachment;
|
||||||
import pro.taskana.ObjectReference;
|
import pro.taskana.ObjectReference;
|
||||||
|
@ -36,6 +37,7 @@ public abstract class AbstractAccTest {
|
||||||
private static DBCleaner cleaner = new DBCleaner();
|
private static DBCleaner cleaner = new DBCleaner();
|
||||||
protected static TestDataGenerator testDataGenerator = new TestDataGenerator();
|
protected static TestDataGenerator testDataGenerator = new TestDataGenerator();
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setupTest() throws Exception {
|
public static void setupTest() throws Exception {
|
||||||
resetDb(false);
|
resetDb(false);
|
||||||
|
|
|
@ -6,8 +6,9 @@ import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Classification;
|
import pro.taskana.Classification;
|
||||||
|
@ -19,20 +20,20 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.TaskanaException;
|
import pro.taskana.exceptions.TaskanaException;
|
||||||
import pro.taskana.impl.ClassificationImpl;
|
import pro.taskana.impl.ClassificationImpl;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "create classification" scenarios.
|
* Acceptance test for all "create classification" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class CreateClassificationAccTest extends AbstractAccTest {
|
class CreateClassificationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private static final String ID_PREFIX_CLASSIFICATION = "CLI";
|
private static final String ID_PREFIX_CLASSIFICATION = "CLI";
|
||||||
|
|
||||||
private ClassificationService classificationService;
|
private ClassificationService classificationService;
|
||||||
|
|
||||||
public CreateClassificationAccTest() {
|
CreateClassificationAccTest() {
|
||||||
super();
|
super();
|
||||||
classificationService = taskanaEngine.getClassificationService();
|
classificationService = taskanaEngine.getClassificationService();
|
||||||
}
|
}
|
||||||
|
@ -41,7 +42,7 @@ public class CreateClassificationAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testCreateMasterClassification()
|
void testCreateMasterClassification()
|
||||||
throws ClassificationAlreadyExistException, ClassificationNotFoundException, NotAuthorizedException,
|
throws ClassificationAlreadyExistException, ClassificationNotFoundException, NotAuthorizedException,
|
||||||
DomainNotFoundException, InvalidArgumentException {
|
DomainNotFoundException, InvalidArgumentException {
|
||||||
long amountOfClassificationsBefore = classificationService.createClassificationQuery().count();
|
long amountOfClassificationsBefore = classificationService.createClassificationQuery().count();
|
||||||
|
@ -66,7 +67,7 @@ public class CreateClassificationAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testCreateClassificationWithMasterCopy()
|
void testCreateClassificationWithMasterCopy()
|
||||||
throws ClassificationAlreadyExistException, ClassificationNotFoundException, NotAuthorizedException,
|
throws ClassificationAlreadyExistException, ClassificationNotFoundException, NotAuthorizedException,
|
||||||
DomainNotFoundException, InvalidArgumentException {
|
DomainNotFoundException, InvalidArgumentException {
|
||||||
long amountOfClassificationsBefore = classificationService.createClassificationQuery().count();
|
long amountOfClassificationsBefore = classificationService.createClassificationQuery().count();
|
||||||
|
@ -110,7 +111,7 @@ public class CreateClassificationAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testCreateClassificationWithExistingMaster()
|
void testCreateClassificationWithExistingMaster()
|
||||||
throws DomainNotFoundException, ClassificationAlreadyExistException,
|
throws DomainNotFoundException, ClassificationAlreadyExistException,
|
||||||
NotAuthorizedException, InvalidArgumentException {
|
NotAuthorizedException, InvalidArgumentException {
|
||||||
|
|
||||||
|
@ -132,9 +133,8 @@ public class CreateClassificationAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testCreateChildInDomainAndCopyInMaster()
|
void testCreateChildInDomainAndCopyInMaster()
|
||||||
throws DomainNotFoundException, ClassificationAlreadyExistException,
|
throws TaskanaException {
|
||||||
TaskanaException, InvalidArgumentException {
|
|
||||||
Classification parent = classificationService.newClassification("Key0816", "DOMAIN_A", "TASK");
|
Classification parent = classificationService.newClassification("Key0816", "DOMAIN_A", "TASK");
|
||||||
Classification actualParent = classificationService.createClassification(parent);
|
Classification actualParent = classificationService.createClassification(parent);
|
||||||
assertNotNull(actualParent);
|
assertNotNull(actualParent);
|
||||||
|
@ -154,109 +154,98 @@ public class CreateClassificationAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testCreateClassificationWithInvalidValues()
|
void testCreateClassificationWithInvalidValues()
|
||||||
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException {
|
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException {
|
||||||
long amountOfClassificationsBefore = classificationService.createClassificationQuery().count();
|
classificationService.createClassificationQuery().count();
|
||||||
|
|
||||||
// Check key NULL
|
// Check key NULL
|
||||||
try {
|
|
||||||
Classification classification = classificationService.newClassification(null, "DOMAIN_A", "TASK");
|
Classification classification = classificationService.newClassification(null, "DOMAIN_A", "TASK");
|
||||||
classification = classificationService.createClassification(classification);
|
Assertions.assertThrows(InvalidArgumentException.class, () ->
|
||||||
} catch (InvalidArgumentException e) {
|
classificationService.createClassification(classification));
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check invalid ServiceLevel
|
// Check invalid ServiceLevel
|
||||||
try {
|
|
||||||
Classification classification = classificationService.newClassification("Key2", "DOMAIN_B", "TASK");
|
Classification classification2 = classificationService.newClassification("Key2", "DOMAIN_B", "TASK");
|
||||||
classification.setServiceLevel("abc");
|
classification2.setServiceLevel("abc");
|
||||||
classification = classificationService.createClassification(classification);
|
Assertions.assertThrows(InvalidArgumentException.class,
|
||||||
} catch (InvalidArgumentException e) {
|
() -> classificationService.createClassification(classification2));
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = ClassificationAlreadyExistException.class)
|
@Test
|
||||||
public void testCreateClassificationAlreadyExisting()
|
void testCreateClassificationAlreadyExisting()
|
||||||
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException,
|
throws TaskanaException {
|
||||||
InvalidArgumentException {
|
|
||||||
Classification classification = classificationService.newClassification("Key3", "", "TASK");
|
Classification classification = classificationService.newClassification("Key3", "", "TASK");
|
||||||
classification = classificationService.createClassification(classification);
|
Classification classificationCreated = classificationService.createClassification(classification);
|
||||||
classification = classificationService.createClassification(classification);
|
Assertions.assertThrows(ClassificationAlreadyExistException.class,
|
||||||
|
() -> classificationService.createClassification(classificationCreated));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = DomainNotFoundException.class)
|
@Test
|
||||||
public void testCreateClassificationInUnknownDomain()
|
void testCreateClassificationInUnknownDomain() {
|
||||||
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException,
|
|
||||||
InvalidArgumentException {
|
|
||||||
Classification classification = classificationService.newClassification("Key3", "UNKNOWN_DOMAIN", "TASK");
|
Classification classification = classificationService.newClassification("Key3", "UNKNOWN_DOMAIN", "TASK");
|
||||||
classification = classificationService.createClassification(classification);
|
Assertions.assertThrows(DomainNotFoundException.class,
|
||||||
|
() -> classificationService.createClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testCreateClassificationOfUnknownType()
|
void testCreateClassificationOfUnknownType() {
|
||||||
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException,
|
|
||||||
InvalidArgumentException {
|
|
||||||
Classification classification = classificationService.newClassification("Key3", "DOMAIN_A", "UNKNOWN_TYPE");
|
Classification classification = classificationService.newClassification("Key3", "DOMAIN_A", "UNKNOWN_TYPE");
|
||||||
classification = classificationService.createClassification(classification);
|
Assertions.assertThrows(InvalidArgumentException.class,
|
||||||
|
() -> classificationService.createClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testCreateClassificationOfUnknownCategory()
|
void testCreateClassificationOfUnknownCategory() {
|
||||||
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException,
|
|
||||||
InvalidArgumentException {
|
|
||||||
Classification classification = classificationService.newClassification("Key4", "DOMAIN_A", "TASK");
|
Classification classification = classificationService.newClassification("Key4", "DOMAIN_A", "TASK");
|
||||||
classification.setCategory("UNKNOWN_CATEGORY");
|
classification.setCategory("UNKNOWN_CATEGORY");
|
||||||
classification = classificationService.createClassification(classification);
|
Assertions.assertThrows(InvalidArgumentException.class,
|
||||||
|
() -> classificationService.createClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testCreateClassificationWithInvalidParentId()
|
void testCreateClassificationWithInvalidParentId() {
|
||||||
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException,
|
|
||||||
InvalidArgumentException {
|
|
||||||
Classification classification = classificationService.newClassification("Key5", "", "TASK");
|
Classification classification = classificationService.newClassification("Key5", "", "TASK");
|
||||||
classification.setParentId("ID WHICH CANT BE FOUND");
|
classification.setParentId("ID WHICH CANT BE FOUND");
|
||||||
classification = classificationService.createClassification(classification);
|
Assertions.assertThrows(InvalidArgumentException.class,
|
||||||
|
() -> classificationService.createClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testCreateClassificationWithInvalidParentKey()
|
void testCreateClassificationWithInvalidParentKey() {
|
||||||
throws ClassificationAlreadyExistException, NotAuthorizedException, DomainNotFoundException,
|
|
||||||
InvalidArgumentException {
|
|
||||||
Classification classification = classificationService.newClassification("Key5", "", "TASK");
|
Classification classification = classificationService.newClassification("Key5", "", "TASK");
|
||||||
classification.setParentKey("KEY WHICH CANT BE FOUND");
|
classification.setParentKey("KEY WHICH CANT BE FOUND");
|
||||||
classification = classificationService.createClassification(classification);
|
Assertions.assertThrows(InvalidArgumentException.class,
|
||||||
|
() -> classificationService.createClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testCreateClassificationWithExplicitId()
|
void testCreateClassificationWithExplicitId() {
|
||||||
throws DomainNotFoundException, ClassificationAlreadyExistException,
|
|
||||||
NotAuthorizedException, InvalidArgumentException {
|
|
||||||
ClassificationImpl classification = (ClassificationImpl) classificationService
|
ClassificationImpl classification = (ClassificationImpl) classificationService
|
||||||
.newClassification("Key0818", "", "TASK");
|
.newClassification("Key0818", "", "TASK");
|
||||||
classification.setId("EXPLICIT ID");
|
classification.setId("EXPLICIT ID");
|
||||||
classificationService.createClassification(classification);
|
Assertions.assertThrows(InvalidArgumentException.class,
|
||||||
|
() -> classificationService.createClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.junit.Assert.assertNotEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Classification;
|
import pro.taskana.Classification;
|
||||||
|
@ -15,13 +15,13 @@ import pro.taskana.ClassificationService;
|
||||||
import pro.taskana.exceptions.ClassificationInUseException;
|
import pro.taskana.exceptions.ClassificationInUseException;
|
||||||
import pro.taskana.exceptions.ClassificationNotFoundException;
|
import pro.taskana.exceptions.ClassificationNotFoundException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "delete classification" scenarios.
|
* Acceptance test for all "delete classification" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class DeleteClassificationAccTest extends AbstractAccTest {
|
public class DeleteClassificationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private ClassificationService classificationService;
|
private ClassificationService classificationService;
|
||||||
|
@ -47,29 +47,29 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "group_2"})
|
groupNames = {"group_1", "group_2"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testDeleteClassificationInDomainUserIsNotAuthorized()
|
public void testDeleteClassificationInDomainUserIsNotAuthorized()
|
||||||
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
|
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
|
||||||
classificationService.deleteClassification("L140101", "DOMAIN_A");
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
fail("NotAuthorizedException should have been thrown");
|
classificationService.deleteClassification("L140101", "DOMAIN_A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = ClassificationInUseException.class)
|
@Test
|
||||||
public void testThrowExeptionIfDeleteClassificationWithExistingTasks()
|
public void testThrowExeptionIfDeleteClassificationWithExistingTasks() {
|
||||||
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
|
Assertions.assertThrows(ClassificationInUseException.class, () ->
|
||||||
classificationService.deleteClassification("L1050", "DOMAIN_A");
|
classificationService.deleteClassification("L1050", "DOMAIN_A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = ClassificationInUseException.class)
|
@Test
|
||||||
public void testThrowExeptionIfDeleteMasterClassificationWithExistingTasks()
|
public void testThrowExeptionIfDeleteMasterClassificationWithExistingTasks() {
|
||||||
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
|
Assertions.assertThrows(ClassificationInUseException.class, () ->
|
||||||
classificationService.deleteClassification("L1050", "");
|
classificationService.deleteClassification("L1050", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -93,19 +93,10 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "dummy",
|
userName = "dummy",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = ClassificationInUseException.class)
|
@Test
|
||||||
public void testDeleteMasterClassificationWithExistingAttachment()
|
public void testDeleteMasterClassificationWithExistingAttachment() {
|
||||||
throws ClassificationNotFoundException, NotAuthorizedException, ClassificationInUseException {
|
Assertions.assertThrows(ClassificationInUseException.class, () ->
|
||||||
|
classificationService.deleteClassification("L12010", ""));
|
||||||
classificationService.deleteClassification("L12010", "");
|
|
||||||
|
|
||||||
boolean classificationNotFound = false;
|
|
||||||
try {
|
|
||||||
classificationService.getClassification("L12010", "DOMAIN_A");
|
|
||||||
} catch (ClassificationNotFoundException e) {
|
|
||||||
classificationNotFound = true;
|
|
||||||
}
|
|
||||||
assertTrue(classificationNotFound);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -140,19 +131,19 @@ public class DeleteClassificationAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "dummy",
|
userName = "dummy",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = ClassificationNotFoundException.class)
|
@Test
|
||||||
public void testThrowClassificationNotFoundIfClassificationNotExists()
|
public void testThrowClassificationNotFoundIfClassificationNotExists() {
|
||||||
throws ClassificationNotFoundException, ClassificationInUseException, NotAuthorizedException {
|
Assertions.assertThrows(ClassificationNotFoundException.class, () ->
|
||||||
classificationService.deleteClassification("not existing classification key", "");
|
classificationService.deleteClassification("not existing classification key", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "dummy",
|
userName = "dummy",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = ClassificationNotFoundException.class)
|
@Test
|
||||||
public void testThrowClassificationNotFoundIfClassificationNotExistsInDomain()
|
public void testThrowClassificationNotFoundIfClassificationNotExistsInDomain() {
|
||||||
throws ClassificationNotFoundException, ClassificationInUseException, NotAuthorizedException {
|
Assertions.assertThrows(ClassificationNotFoundException.class, () ->
|
||||||
classificationService.deleteClassification("L10000", "DOMAIN_B");
|
classificationService.deleteClassification("L10000", "DOMAIN_B"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,12 @@ package acceptance.classification;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Classification;
|
import pro.taskana.Classification;
|
||||||
import pro.taskana.ClassificationService;
|
import pro.taskana.ClassificationService;
|
||||||
|
@ -96,22 +97,23 @@ public class GetClassificationAccTest extends AbstractAccTest {
|
||||||
assertEquals("P2D", classification.getServiceLevel());
|
assertEquals("P2D", classification.getServiceLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ClassificationNotFoundException.class)
|
@Test
|
||||||
public void testGetOneClassificationByIdFails() throws ClassificationNotFoundException {
|
public void testGetOneClassificationByIdFails() {
|
||||||
classificationService.getClassification("CLI:100000000470000000000000000000000011");
|
|
||||||
fail("ClassificationNotFoundException was expected");
|
Assertions.assertThrows(ClassificationNotFoundException.class, () ->
|
||||||
|
classificationService.getClassification("CLI:100000000470000000000000000000000011"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ClassificationNotFoundException.class)
|
@Test
|
||||||
public void testGetClassificationByNullKeyFails() throws ClassificationNotFoundException {
|
public void testGetClassificationByNullKeyFails() {
|
||||||
classificationService.getClassification(null, "");
|
Assertions.assertThrows(ClassificationNotFoundException.class, () ->
|
||||||
fail("ClassificationNotFoundException was expected");
|
classificationService.getClassification(null, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ClassificationNotFoundException.class)
|
@Test
|
||||||
public void testGetClassificationByInvalidKeyAndDomain() throws ClassificationNotFoundException {
|
public void testGetClassificationByInvalidKeyAndDomain() {
|
||||||
classificationService.getClassification("Key0815", "NOT_EXISTING");
|
Assertions.assertThrows(ClassificationNotFoundException.class, () ->
|
||||||
fail("ClassificationNotFoundException was expected");
|
classificationService.getClassification("Key0815", "NOT_EXISTING"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -2,35 +2,34 @@ package acceptance.classification;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import 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;
|
||||||
import static pro.taskana.ClassificationQueryColumnName.CREATED;
|
|
||||||
import static pro.taskana.ClassificationQueryColumnName.VALID_IN_DOMAIN;
|
import static pro.taskana.ClassificationQueryColumnName.VALID_IN_DOMAIN;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
import pro.taskana.ClassificationService;
|
import pro.taskana.ClassificationService;
|
||||||
import pro.taskana.ClassificationSummary;
|
import pro.taskana.ClassificationSummary;
|
||||||
import pro.taskana.TimeInterval;
|
import pro.taskana.TimeInterval;
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
|
||||||
import pro.taskana.exceptions.ClassificationNotFoundException;
|
import pro.taskana.exceptions.ClassificationNotFoundException;
|
||||||
import pro.taskana.exceptions.ConcurrencyException;
|
import pro.taskana.exceptions.ConcurrencyException;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "get classification" scenarios.
|
* Acceptance test for all "get classification" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryClassificationAccTest extends AbstractAccTest {
|
public class QueryClassificationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private static SortDirection asc = SortDirection.ASCENDING;
|
private static SortDirection asc = SortDirection.ASCENDING;
|
||||||
|
|
|
@ -5,20 +5,21 @@ import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Ignore;
|
import org.junit.jupiter.api.Assertions;
|
||||||
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 acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.ClassificationService;
|
import pro.taskana.ClassificationService;
|
||||||
import pro.taskana.ClassificationSummary;
|
import pro.taskana.ClassificationSummary;
|
||||||
import pro.taskana.exceptions.TaskanaRuntimeException;
|
import pro.taskana.exceptions.TaskanaRuntimeException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query classifications with pagination" scenarios.
|
* Acceptance test for all "query classifications with pagination" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
|
public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public QueryClassificationWithPaginationAccTest() {
|
public QueryClassificationWithPaginationAccTest() {
|
||||||
|
@ -136,17 +137,19 @@ public class QueryClassificationWithPaginationAccTest extends AbstractAccTest {
|
||||||
* Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
|
* Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
|
||||||
* Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
|
* Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
@Disabled
|
||||||
@Test(expected = TaskanaRuntimeException.class)
|
@Test
|
||||||
public void testPaginationThrowingExceptionWhenPageOutOfBounds() {
|
public void testPaginationThrowingExceptionWhenPageOutOfBounds() {
|
||||||
ClassificationService classificationService = taskanaEngine.getClassificationService();
|
ClassificationService classificationService = taskanaEngine.getClassificationService();
|
||||||
|
|
||||||
// entrypoint set outside result amount
|
// entrypoint set outside result amount
|
||||||
int pageNumber = 5;
|
int pageNumber = 5;
|
||||||
int pageSize = 10;
|
int pageSize = 10;
|
||||||
|
|
||||||
|
Assertions.assertThrows(TaskanaRuntimeException.class, () ->
|
||||||
classificationService.createClassificationQuery()
|
classificationService.createClassificationQuery()
|
||||||
.domainIn("DOMAIN_A")
|
.domainIn("DOMAIN_A")
|
||||||
.listPage(pageNumber, pageSize);
|
.listPage(pageNumber, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -5,7 +5,6 @@ import static org.hamcrest.CoreMatchers.not;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
@ -14,8 +13,9 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Classification;
|
import pro.taskana.Classification;
|
||||||
|
@ -33,13 +33,13 @@ import pro.taskana.impl.DaysToWorkingDaysConverter;
|
||||||
import pro.taskana.impl.TaskImpl;
|
import pro.taskana.impl.TaskImpl;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.jobs.JobRunner;
|
import pro.taskana.jobs.JobRunner;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "update classification" scenarios.
|
* Acceptance test for all "update classification" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class UpdateClassificationAccTest extends AbstractAccTest {
|
public class UpdateClassificationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private ClassificationService classificationService;
|
private ClassificationService classificationService;
|
||||||
|
@ -91,9 +91,9 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
|
||||||
assertTrue(modifiedBefore.isBefore(updatedClassification.getModified()));
|
assertTrue(modifiedBefore.isBefore(updatedClassification.getModified()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testUpdateClassificationFails()
|
public void testUpdateClassificationFails()
|
||||||
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException,
|
throws ClassificationNotFoundException, ConcurrencyException,
|
||||||
InvalidArgumentException {
|
InvalidArgumentException {
|
||||||
String newName = "updated Name";
|
String newName = "updated Name";
|
||||||
String newEntryPoint = "updated EntryPoint";
|
String newEntryPoint = "updated EntryPoint";
|
||||||
|
@ -116,7 +116,8 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
|
||||||
classification.setPriority(1000);
|
classification.setPriority(1000);
|
||||||
classification.setServiceLevel("P2DT3H4M");
|
classification.setServiceLevel("P2DT3H4M");
|
||||||
|
|
||||||
classificationService.updateClassification(classification);
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
classificationService.updateClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -152,7 +153,7 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = ConcurrencyException.class)
|
@Test
|
||||||
public void testUpdateClassificationNotLatestAnymore()
|
public void testUpdateClassificationNotLatestAnymore()
|
||||||
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InterruptedException,
|
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InterruptedException,
|
||||||
InvalidArgumentException {
|
InvalidArgumentException {
|
||||||
|
@ -168,32 +169,36 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
classification.setName("NOW IT´S MY TURN");
|
classification.setName("NOW IT´S MY TURN");
|
||||||
classification.setDescription("IT SHOULD BE TO LATE...");
|
classification.setDescription("IT SHOULD BE TO LATE...");
|
||||||
classificationService.updateClassification(classification);
|
Assertions.assertThrows(ConcurrencyException.class, () ->
|
||||||
fail("The Classification should not be updated, because it was modified while editing.");
|
classificationService.updateClassification(classification),
|
||||||
|
"The Classification should not be updated, because it was modified while editing.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = ClassificationNotFoundException.class)
|
@Test
|
||||||
public void testUpdateClassificationParentIdToInvalid()
|
public void testUpdateClassificationParentIdToInvalid()
|
||||||
throws NotAuthorizedException, ClassificationNotFoundException,
|
throws NotAuthorizedException, ClassificationNotFoundException,
|
||||||
ConcurrencyException, InvalidArgumentException {
|
ConcurrencyException, InvalidArgumentException {
|
||||||
Classification classification = classificationService.getClassification("T2100", "DOMAIN_A");
|
Classification classification = classificationService.getClassification("T2100", "DOMAIN_A");
|
||||||
classification.setParentId("ID WHICH CANT BE FOUND");
|
classification.setParentId("ID WHICH CANT BE FOUND");
|
||||||
classification = classificationService.updateClassification(classification);
|
Assertions.assertThrows(ClassificationNotFoundException.class, () ->
|
||||||
|
classificationService.updateClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "businessadmin"})
|
groupNames = {"group_1", "businessadmin"})
|
||||||
@Test(expected = ClassificationNotFoundException.class)
|
@Test
|
||||||
public void testUpdateClassificationParentKeyToInvalid()
|
public void testUpdateClassificationParentKeyToInvalid()
|
||||||
throws NotAuthorizedException, ClassificationNotFoundException,
|
throws NotAuthorizedException, ClassificationNotFoundException,
|
||||||
ConcurrencyException, InvalidArgumentException {
|
ConcurrencyException, InvalidArgumentException {
|
||||||
Classification classification = classificationService.getClassification("T2100", "DOMAIN_A");
|
Classification classification = classificationService.getClassification("T2100", "DOMAIN_A");
|
||||||
classification.setParentKey("KEY WHICH CANT BE FOUND");
|
classification.setParentKey("KEY WHICH CANT BE FOUND");
|
||||||
classification = classificationService.updateClassification(classification);
|
|
||||||
|
Assertions.assertThrows(ClassificationNotFoundException.class, () ->
|
||||||
|
classificationService.updateClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -278,14 +283,15 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "dummy",
|
userName = "dummy",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testUpdateClassificationWithSameKeyAndParentKey()
|
public void testUpdateClassificationWithSameKeyAndParentKey()
|
||||||
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InvalidArgumentException {
|
throws ClassificationNotFoundException, NotAuthorizedException, ConcurrencyException, InvalidArgumentException {
|
||||||
|
|
||||||
Classification classification = classificationService.getClassification("T2100", "DOMAIN_A");
|
Classification classification = classificationService.getClassification("T2100", "DOMAIN_A");
|
||||||
|
|
||||||
classification.setParentKey(classification.getKey());
|
classification.setParentKey(classification.getKey());
|
||||||
classificationService.updateClassification(classification);
|
Assertions.assertThrows(InvalidArgumentException.class, () ->
|
||||||
|
classificationService.updateClassification(classification));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -310,7 +316,8 @@ public class UpdateClassificationAccTest extends AbstractAccTest {
|
||||||
assertTrue(task.getPriority() == 1000);
|
assertTrue(task.getPriority() == 1000);
|
||||||
long calendarDays = converter.convertWorkingDaysToDays(task.getPlanned(), serviceLevel);
|
long calendarDays = converter.convertWorkingDaysToDays(task.getPlanned(), serviceLevel);
|
||||||
|
|
||||||
assertTrue("Task: " + taskId + ": Due Date " + task.getDue() + " does not match planned " + task.getPlanned()
|
assertTrue(
|
||||||
|
"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))));
|
task.getDue().equals(task.getPlanned().plus(Duration.ofDays(calendarDays))));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.h2.store.fs.FileUtils;
|
import org.h2.store.fs.FileUtils;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
import pro.taskana.impl.TaskanaEngineImpl;
|
import pro.taskana.impl.TaskanaEngineImpl;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.sql.SQLException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.h2.store.fs.FileUtils;
|
import org.h2.store.fs.FileUtils;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import pro.taskana.TaskanaRole;
|
import pro.taskana.TaskanaRole;
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
|
|
|
@ -2,17 +2,17 @@ package acceptance.history;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for historyEventProducer class.
|
* Acceptance test for historyEventProducer class.
|
||||||
*/
|
*/
|
||||||
public class TaskEventProducerTest extends AbstractAccTest {
|
class TaskEventProducerTest extends AbstractAccTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHistoryEventProducerIsNotEnabled() {
|
void testHistoryEventProducerIsNotEnabled() {
|
||||||
assertFalse(taskanaEngine.isHistoryEnabled());
|
assertFalse(taskanaEngine.isHistoryEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import static org.junit.Assert.assertNotNull;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
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 acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Task;
|
import pro.taskana.Task;
|
||||||
|
@ -23,18 +23,18 @@ import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||||
import pro.taskana.exceptions.TaskNotFoundException;
|
import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.jobs.TaskCleanupJob;
|
import pro.taskana.jobs.TaskCleanupJob;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "jobs tasks runner" scenarios.
|
* Acceptance test for all "jobs tasks runner" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class TaskCleanupJobAccTest extends AbstractAccTest {
|
public class TaskCleanupJobAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
TaskService taskService;
|
TaskService taskService;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
public void before() {
|
||||||
taskService = taskanaEngine.getTaskService();
|
taskService = taskanaEngine.getTaskService();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import static org.junit.Assert.assertNotEquals;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
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 acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BaseQuery;
|
import pro.taskana.BaseQuery;
|
||||||
|
@ -19,25 +19,25 @@ import pro.taskana.WorkbasketSummary;
|
||||||
import pro.taskana.exceptions.TaskanaException;
|
import pro.taskana.exceptions.TaskanaException;
|
||||||
import pro.taskana.jobs.TaskCleanupJob;
|
import pro.taskana.jobs.TaskCleanupJob;
|
||||||
import pro.taskana.jobs.WorkbasketCleanupJob;
|
import pro.taskana.jobs.WorkbasketCleanupJob;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "jobs workbasket runner" scenarios.
|
* Acceptance test for all "jobs workbasket runner" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class WorkbasketCleanupJobAccTest extends AbstractAccTest {
|
public class WorkbasketCleanupJobAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
WorkbasketService workbasketService;
|
WorkbasketService workbasketService;
|
||||||
TaskService taskService;
|
TaskService taskService;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
public void before() {
|
||||||
workbasketService = taskanaEngine.getWorkbasketService();
|
workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
taskService = taskanaEngine.getTaskService();
|
taskService = taskanaEngine.getTaskService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterEach
|
||||||
public void after() throws Exception {
|
public void after() throws Exception {
|
||||||
resetDb(true);
|
resetDb(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,12 @@ package acceptance.objectreference;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import static pro.taskana.ObjectReferenceQueryColumnName.COMPANY;
|
import static pro.taskana.ObjectReferenceQueryColumnName.COMPANY;
|
||||||
import static pro.taskana.ObjectReferenceQueryColumnName.SYSTEM;
|
import static pro.taskana.ObjectReferenceQueryColumnName.SYSTEM;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.ObjectReference;
|
import pro.taskana.ObjectReference;
|
||||||
|
|
|
@ -5,10 +5,11 @@ import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
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 acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.ObjectReference;
|
import pro.taskana.ObjectReference;
|
||||||
|
@ -16,12 +17,12 @@ import pro.taskana.ObjectReferenceQuery;
|
||||||
import pro.taskana.TaskQuery;
|
import pro.taskana.TaskQuery;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
import pro.taskana.exceptions.TaskanaRuntimeException;
|
import pro.taskana.exceptions.TaskanaRuntimeException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query classifications with pagination" scenarios.
|
* Acceptance test for all "query classifications with pagination" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest {
|
public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private TaskService taskService;
|
private TaskService taskService;
|
||||||
|
@ -32,7 +33,7 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
public void before() {
|
||||||
taskService = taskanaEngine.getTaskService();
|
taskService = taskanaEngine.getTaskService();
|
||||||
taskQuery = taskService.createTaskQuery();
|
taskQuery = taskService.createTaskQuery();
|
||||||
|
@ -119,13 +120,14 @@ public class QueryObjectreferencesWithPaginationAccTest extends AbstractAccTest
|
||||||
* Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
|
* Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
|
||||||
* Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
|
* Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
@Disabled
|
||||||
@Test(expected = TaskanaRuntimeException.class)
|
@Test
|
||||||
public void testPaginationThrowingExceptionWhenPageOutOfBounds() {
|
public void testPaginationThrowingExceptionWhenPageOutOfBounds() {
|
||||||
// entrypoint set outside result amount
|
// entrypoint set outside result amount
|
||||||
int pageNumber = 6;
|
int pageNumber = 6;
|
||||||
int pageSize = 10;
|
int pageSize = 10;
|
||||||
objRefQuery.listPage(pageNumber, pageSize);
|
Assertions.assertThrows(TaskanaRuntimeException.class, () ->
|
||||||
|
objRefQuery.listPage(pageNumber, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.sql.SQLException;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
||||||
import pro.taskana.TaskanaEngine;
|
import pro.taskana.TaskanaEngine;
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
|
@ -26,6 +27,7 @@ public class AbstractReportAccTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
@BeforeAll
|
||||||
public static void setupTest() throws Exception {
|
public static void setupTest() throws Exception {
|
||||||
resetDb();
|
resetDb();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,27 +10,29 @@ 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.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import pro.taskana.CustomField;
|
import pro.taskana.CustomField;
|
||||||
import pro.taskana.TaskMonitorService;
|
import pro.taskana.TaskMonitorService;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "classification report" scenarios.
|
* Acceptance test for all "classification report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest {
|
public class GetCustomAttributeValuesForReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testRoleCheck() throws NotAuthorizedException {
|
public void testRoleCheck() {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
taskMonitorService.createWorkbasketReportBuilder()
|
taskMonitorService.createWorkbasketReportBuilder()
|
||||||
.listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_2);
|
.listCustomAttributeValuesForCustomAttributeName(CustomField.CUSTOM_2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,9 @@ 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.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import pro.taskana.CustomField;
|
import pro.taskana.CustomField;
|
||||||
import pro.taskana.TaskMonitorService;
|
import pro.taskana.TaskMonitorService;
|
||||||
|
@ -20,24 +21,25 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.impl.SelectedItem;
|
import pro.taskana.impl.SelectedItem;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "get task ids of category report" scenarios.
|
* Acceptance test for all "get task ids of category report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
|
class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@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();
|
||||||
|
|
||||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||||
|
|
||||||
taskMonitorService.createCategoryReportBuilder().listTaskIdsForSelectedItems(selectedItems);
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskMonitorService.createCategoryReportBuilder().listTaskIdsForSelectedItems(selectedItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -306,8 +308,8 @@ public class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfSubKeysAreUsed() throws InvalidArgumentException, NotAuthorizedException {
|
public void testThrowsExceptionIfSubKeysAreUsed() {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||||
|
@ -321,8 +323,11 @@ public class GetTaskIdsOfCategoryReportAccTest extends AbstractReportAccTest {
|
||||||
s1.setUpperAgeLimit(-2);
|
s1.setUpperAgeLimit(-2);
|
||||||
selectedItems.add(s1);
|
selectedItems.add(s1);
|
||||||
|
|
||||||
taskMonitorService.createCategoryReportBuilder().withColumnHeaders(columnHeaders).listTaskIdsForSelectedItems(
|
Assertions.assertThrows(InvalidArgumentException.class, () ->
|
||||||
selectedItems);
|
taskMonitorService.createCategoryReportBuilder()
|
||||||
|
.withColumnHeaders(columnHeaders)
|
||||||
|
.listTaskIdsForSelectedItems(
|
||||||
|
selectedItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
|
private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
|
||||||
|
|
|
@ -6,25 +6,26 @@ import static org.junit.Assert.assertTrue;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import pro.taskana.TaskMonitorService;
|
import pro.taskana.TaskMonitorService;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.impl.SelectedItem;
|
import pro.taskana.impl.SelectedItem;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "get task ids of classification report" scenarios.
|
* Acceptance test for all "get task ids of classification report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
|
class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testRoleCheck() throws InvalidArgumentException, NotAuthorizedException {
|
void testRoleCheck() {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||||
|
@ -47,13 +48,14 @@ public class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTe
|
||||||
s3.setUpperAgeLimit(-11);
|
s3.setUpperAgeLimit(-11);
|
||||||
selectedItems.add(s3);
|
selectedItems.add(s3);
|
||||||
|
|
||||||
taskMonitorService.createClassificationReportBuilder().listTaskIdsForSelectedItems(selectedItems);
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskMonitorService.createClassificationReportBuilder().listTaskIdsForSelectedItems(selectedItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskIdsOfClassificationReport() throws InvalidArgumentException, NotAuthorizedException {
|
void testGetTaskIdsOfClassificationReport() throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||||
|
@ -95,7 +97,7 @@ public class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTe
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskIdsOfClassificationReportWithAttachments()
|
void testGetTaskIdsOfClassificationReportWithAttachments()
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
|
@ -136,7 +138,7 @@ public class GetTaskIdsOfClassificationReportAccTest extends AbstractReportAccTe
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskIdsOfClassificationReportWithDomainFilter()
|
void testGetTaskIdsOfClassificationReportWithDomainFilter()
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,9 @@ 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.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import pro.taskana.CustomField;
|
import pro.taskana.CustomField;
|
||||||
import pro.taskana.TaskMonitorService;
|
import pro.taskana.TaskMonitorService;
|
||||||
|
@ -20,31 +21,32 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.impl.SelectedItem;
|
import pro.taskana.impl.SelectedItem;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "get task ids of category report" scenarios.
|
* Acceptance test for all "get task ids of category report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@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();
|
||||||
|
|
||||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||||
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
taskMonitorService.createCustomFieldValueReportBuilder(CustomField.CUSTOM_1)
|
taskMonitorService.createCustomFieldValueReportBuilder(CustomField.CUSTOM_1)
|
||||||
.listTaskIdsForSelectedItems(selectedItems);
|
.listTaskIdsForSelectedItems(selectedItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskIdsOfCustomFieldValueReport() throws InvalidArgumentException, NotAuthorizedException {
|
void testGetTaskIdsOfCustomFieldValueReport() throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||||
|
@ -88,7 +90,7 @@ public class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAcc
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskIdsOfCustomFieldValueReportWithWorkbasketFilter()
|
void testGetTaskIdsOfCustomFieldValueReportWithWorkbasketFilter()
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
|
@ -130,7 +132,7 @@ public class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAcc
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskIdsOfCustomFieldValueReportWithStateFilter()
|
void testGetTaskIdsOfCustomFieldValueReportWithStateFilter()
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
|
@ -176,7 +178,7 @@ public class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAcc
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskIdsOfCustomFieldValueReportWithCategoryFilter()
|
void testGetTaskIdsOfCustomFieldValueReportWithCategoryFilter()
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
|
@ -218,7 +220,7 @@ public class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAcc
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskIdsOfCustomFieldValueReportWithDomainFilter()
|
void testGetTaskIdsOfCustomFieldValueReportWithDomainFilter()
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
|
@ -259,7 +261,7 @@ public class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAcc
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskIdsOfCustomFieldValueReportWithCustomFieldValueFilter()
|
void testGetTaskIdsOfCustomFieldValueReportWithCustomFieldValueFilter()
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
|
@ -302,8 +304,8 @@ public class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAcc
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "monitor")
|
userName = "monitor")
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfSubKeysAreUsed() throws InvalidArgumentException, NotAuthorizedException {
|
void testThrowsExceptionIfSubKeysAreUsed() {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
List<TimeIntervalColumnHeader> columnHeaders = getListOfColumnHeaders();
|
||||||
|
@ -317,8 +319,11 @@ public class GetTaskIdsOfCustomFieldValueReportAccTest extends AbstractReportAcc
|
||||||
s1.setUpperAgeLimit(-2);
|
s1.setUpperAgeLimit(-2);
|
||||||
selectedItems.add(s1);
|
selectedItems.add(s1);
|
||||||
|
|
||||||
taskMonitorService.createCategoryReportBuilder().withColumnHeaders(columnHeaders).listTaskIdsForSelectedItems(
|
Assertions.assertThrows(InvalidArgumentException.class, () ->
|
||||||
selectedItems);
|
taskMonitorService.createCategoryReportBuilder()
|
||||||
|
.withColumnHeaders(columnHeaders)
|
||||||
|
.listTaskIdsForSelectedItems(
|
||||||
|
selectedItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
|
private List<TimeIntervalColumnHeader> getListOfColumnHeaders() {
|
||||||
|
|
|
@ -7,24 +7,25 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import pro.taskana.TaskMonitorService;
|
import pro.taskana.TaskMonitorService;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.impl.SelectedItem;
|
import pro.taskana.impl.SelectedItem;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
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.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
|
public class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testRoleCheck() throws InvalidArgumentException, NotAuthorizedException {
|
public void testRoleCheck() throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
|
@ -32,7 +33,8 @@ public class GetTaskIdsOfWorkbasketReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
List<SelectedItem> selectedItems = new ArrayList<>();
|
List<SelectedItem> selectedItems = new ArrayList<>();
|
||||||
|
|
||||||
taskMonitorService.createWorkbasketReportBuilder().listTaskIdsForSelectedItems(selectedItems);
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskMonitorService.createWorkbasketReportBuilder().listTaskIdsForSelectedItems(selectedItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -12,8 +12,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -24,22 +25,23 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.report.CategoryReport;
|
import pro.taskana.report.CategoryReport;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "category report" scenarios.
|
* Acceptance test for all "category report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
|
public class ProvideCategoryReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCategoryReportAccTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCategoryReportAccTest.class);
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testRoleCheck() throws InvalidArgumentException, NotAuthorizedException {
|
public void testRoleCheck() {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
taskMonitorService.createCategoryReportBuilder().buildReport();
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskMonitorService.createCategoryReportBuilder().buildReport());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -12,8 +12,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -24,23 +25,24 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.report.ClassificationReport;
|
import pro.taskana.report.ClassificationReport;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "classification report" scenarios.
|
* Acceptance test for all "classification report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
public class ProvideClassificationReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideClassificationReportAccTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideClassificationReportAccTest.class);
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testRoleCheck()
|
public void testRoleCheck()
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
throws InvalidArgumentException, NotAuthorizedException {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
taskMonitorService.createClassificationReportBuilder().buildReport();
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskMonitorService.createClassificationReportBuilder().buildReport());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -11,8 +11,9 @@ 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.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -23,23 +24,23 @@ import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.report.CustomFieldValueReport;
|
import pro.taskana.report.CustomFieldValueReport;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "classification report" scenarios.
|
* Acceptance test for all "classification report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
public class ProvideCustomFieldValueReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCustomFieldValueReportAccTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideCustomFieldValueReportAccTest.class);
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testRoleCheck()
|
public void testRoleCheck() {
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
taskMonitorService.createCustomFieldValueReportBuilder(CustomField.CUSTOM_1).buildReport();
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskMonitorService.createCustomFieldValueReportBuilder(CustomField.CUSTOM_1).buildReport());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -11,8 +11,9 @@ 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.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -24,25 +25,25 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.impl.report.item.DetailedMonitorQueryItem;
|
import pro.taskana.impl.report.item.DetailedMonitorQueryItem;
|
||||||
import pro.taskana.impl.report.row.FoldableRow;
|
import pro.taskana.impl.report.row.FoldableRow;
|
||||||
import pro.taskana.report.ClassificationReport.DetailedClassificationReport;
|
|
||||||
import pro.taskana.impl.report.structure.Row;
|
import pro.taskana.impl.report.structure.Row;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.report.ClassificationReport.DetailedClassificationReport;
|
||||||
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "detailed classification report" scenarios.
|
* Acceptance test for all "detailed classification report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
public class ProvideDetailedClassificationReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideDetailedClassificationReportAccTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideDetailedClassificationReportAccTest.class);
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testRoleCheck()
|
public void testRoleCheck() {
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
taskMonitorService.createClassificationReportBuilder().buildDetailedReport();
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskMonitorService.createClassificationReportBuilder().buildDetailedReport());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -8,8 +8,9 @@ import static org.junit.Assert.assertNotNull;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -21,21 +22,22 @@ import pro.taskana.impl.report.header.TaskStatusColumnHeader;
|
||||||
import pro.taskana.impl.report.item.TaskQueryItem;
|
import pro.taskana.impl.report.item.TaskQueryItem;
|
||||||
import pro.taskana.impl.report.structure.Row;
|
import pro.taskana.impl.report.structure.Row;
|
||||||
import pro.taskana.report.TaskStatusReport;
|
import pro.taskana.report.TaskStatusReport;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "task status report" scenarios.
|
* Acceptance test for all "task status report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
public class ProvideTaskStatusReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketReportAccTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketReportAccTest.class);
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testRoleCheck() throws NotAuthorizedException, InvalidArgumentException {
|
public void testRoleCheck() {
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
taskMonitorService.createTaskStatusReportBuilder().buildReport();
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskMonitorService.createTaskStatusReportBuilder().buildReport());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -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.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import pro.taskana.TaskMonitorService;
|
import pro.taskana.TaskMonitorService;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
|
@ -19,13 +19,13 @@ import pro.taskana.impl.report.item.TimestampQueryItem;
|
||||||
import pro.taskana.impl.report.row.SingleRow;
|
import pro.taskana.impl.report.row.SingleRow;
|
||||||
import pro.taskana.impl.report.row.TimestampRow;
|
import pro.taskana.impl.report.row.TimestampRow;
|
||||||
import pro.taskana.report.TimestampReport;
|
import pro.taskana.report.TimestampReport;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for {@link TimestampReport}.
|
* Test class for {@link TimestampReport}.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class ProvideTimestampReportAccTest extends AbstractReportAccTest {
|
public class ProvideTimestampReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,8 +12,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -25,23 +26,23 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.impl.report.CombinedClassificationFilter;
|
import pro.taskana.impl.report.CombinedClassificationFilter;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.report.WorkbasketReport;
|
import pro.taskana.report.WorkbasketReport;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "workbasket level report" scenarios.
|
* Acceptance test for all "workbasket level report" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
public class ProvideWorkbasketReportAccTest extends AbstractReportAccTest {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketReportAccTest.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ProvideWorkbasketReportAccTest.class);
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testRoleCheck()
|
public void testRoleCheck() {
|
||||||
throws InvalidArgumentException, NotAuthorizedException {
|
|
||||||
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
TaskMonitorService taskMonitorService = taskanaEngine.getTaskMonitorService();
|
||||||
|
|
||||||
taskMonitorService.createWorkbasketReportBuilder().buildReport();
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskMonitorService.createWorkbasketReportBuilder().buildReport());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -5,13 +5,13 @@ import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.ClassificationService;
|
import pro.taskana.ClassificationService;
|
||||||
import pro.taskana.ClassificationSummary;
|
import pro.taskana.ClassificationSummary;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,7 @@ import pro.taskana.security.WithAccessId;
|
||||||
*
|
*
|
||||||
* @author bbr
|
* @author bbr
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class ClassificationQueryAccTest extends AbstractAccTest {
|
public class ClassificationQueryAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public ClassificationQueryAccTest() {
|
public ClassificationQueryAccTest() {
|
||||||
|
|
|
@ -3,39 +3,42 @@ package acceptance.security;
|
||||||
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 org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.TaskanaRole;
|
import pro.taskana.TaskanaRole;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for task queries and authorization.
|
* Acceptance test for task queries and authorization.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class TaskEngineAccTest extends AbstractAccTest {
|
public class TaskEngineAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public TaskEngineAccTest() {
|
public TaskEngineAccTest() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testUnauthenticated() throws NotAuthorizedException {
|
public void testUnauthenticated() {
|
||||||
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN));
|
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.BUSINESS_ADMIN));
|
||||||
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.ADMIN));
|
assertFalse(taskanaEngine.isUserInRole(TaskanaRole.ADMIN));
|
||||||
taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN);
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1") // , groupNames = {"businessadmin"})
|
userName = "user_1_1") // , groupNames = {"businessadmin"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testUser() throws NotAuthorizedException {
|
public 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));
|
||||||
taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN);
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskanaEngine.checkRoleMembership(TaskanaRole.BUSINESS_ADMIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -5,19 +5,19 @@ import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
import pro.taskana.TaskSummary;
|
import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for task queries and authorization.
|
* Acceptance test for task queries and authorization.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class TaskQueryAccTest extends AbstractAccTest {
|
public class TaskQueryAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public TaskQueryAccTest() {
|
public TaskQueryAccTest() {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package acceptance.security;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.WorkbasketPermission;
|
import pro.taskana.WorkbasketPermission;
|
||||||
|
@ -12,13 +12,13 @@ import pro.taskana.WorkbasketService;
|
||||||
import pro.taskana.WorkbasketSummary;
|
import pro.taskana.WorkbasketSummary;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for workbasket queries and authorization.
|
* Acceptance test for workbasket queries and authorization.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class WorkbasketQueryAccTest extends AbstractAccTest {
|
public class WorkbasketQueryAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public WorkbasketQueryAccTest() {
|
public WorkbasketQueryAccTest() {
|
||||||
|
|
|
@ -10,8 +10,9 @@ import java.time.Instant;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Task;
|
import pro.taskana.Task;
|
||||||
|
@ -27,14 +28,14 @@ import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.impl.TaskImpl;
|
import pro.taskana.impl.TaskImpl;
|
||||||
import pro.taskana.security.CurrentUserContext;
|
import pro.taskana.security.CurrentUserContext;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance tests for all claim and complete scenarios.
|
* Acceptance tests for all claim and complete scenarios.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class CompleteTaskAccTest extends AbstractAccTest {
|
public class CompleteTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public CompleteTaskAccTest() {
|
public CompleteTaskAccTest() {
|
||||||
|
@ -225,49 +226,48 @@ public class CompleteTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = TaskNotFoundException.class)
|
@Test
|
||||||
public void testClaimTaskNotExisting()
|
public void testClaimTaskNotExisting() {
|
||||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
|
||||||
NotAuthorizedException {
|
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
taskService.claim("NOT_EXISTING");
|
Assertions.assertThrows(TaskNotFoundException.class, () -> taskService.claim("NOT_EXISTING"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidStateException.class)
|
@Test
|
||||||
public void testClaimTaskWithInvalidState()
|
public void testClaimTaskWithInvalidState() {
|
||||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
|
||||||
NotAuthorizedException {
|
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
taskService.forceClaim("TKI:000000000000000000000000000000000036");
|
Assertions.assertThrows(InvalidStateException.class, () ->
|
||||||
|
taskService.forceClaim("TKI:000000000000000000000000000000000036"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidOwnerException.class)
|
@Test
|
||||||
public void testClaimTaskWithInvalidOwner()
|
public void testClaimTaskWithInvalidOwner()
|
||||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
||||||
NotAuthorizedException {
|
NotAuthorizedException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
taskService.claim("TKI:000000000000000000000000000000000100");
|
Assertions.assertThrows(InvalidOwnerException.class, () ->
|
||||||
|
taskService.claim("TKI:000000000000000000000000000000000100"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidStateException.class)
|
@Test
|
||||||
public void testCancelClaimForcedWithInvalidState()
|
public void testCancelClaimForcedWithInvalidState()
|
||||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
||||||
NotAuthorizedException {
|
NotAuthorizedException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
taskService.forceCancelClaim("TKI:000000000000000000000000000000000036");
|
Assertions.assertThrows(InvalidStateException.class, () ->
|
||||||
|
taskService.forceCancelClaim("TKI:000000000000000000000000000000000036"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -327,13 +327,12 @@ public class CompleteTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidOwnerException.class)
|
@Test
|
||||||
public void testCancelClaimWithInvalidOwner()
|
public void testCancelClaimWithInvalidOwner() {
|
||||||
throws TaskNotFoundException, InvalidStateException, InvalidOwnerException,
|
|
||||||
NotAuthorizedException {
|
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
taskService.cancelClaim("TKI:000000000000000000000000000000000100");
|
Assertions.assertThrows(InvalidOwnerException.class, () ->
|
||||||
|
taskService.cancelClaim("TKI:000000000000000000000000000000000100"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitAMillisecond() {
|
private void waitAMillisecond() {
|
||||||
|
|
|
@ -16,8 +16,9 @@ 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.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.ObjectReference;
|
import pro.taskana.ObjectReference;
|
||||||
|
@ -38,13 +39,13 @@ import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.mappings.AttachmentMapper;
|
import pro.taskana.mappings.AttachmentMapper;
|
||||||
import pro.taskana.mappings.TaskTestMapper;
|
import pro.taskana.mappings.TaskTestMapper;
|
||||||
import pro.taskana.security.CurrentUserContext;
|
import pro.taskana.security.CurrentUserContext;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "create task" scenarios.
|
* Acceptance test for all "create task" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class CreateTaskAccTest extends AbstractAccTest {
|
public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public CreateTaskAccTest() {
|
public CreateTaskAccTest() {
|
||||||
|
@ -114,7 +115,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = TaskAlreadyExistException.class)
|
@Test
|
||||||
public void testIdempotencyOfTaskCreation()
|
public void testIdempotencyOfTaskCreation()
|
||||||
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||||
WorkbasketNotFoundException, TaskAlreadyExistException {
|
WorkbasketNotFoundException, TaskAlreadyExistException {
|
||||||
|
@ -144,11 +145,13 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
assertEquals(false, createdTask.isRead());
|
assertEquals(false, createdTask.isRead());
|
||||||
assertEquals(false, createdTask.isTransferred());
|
assertEquals(false, createdTask.isTransferred());
|
||||||
|
|
||||||
newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
|
Task newTask2 = taskService.newTask("USER_1_1", "DOMAIN_A");
|
||||||
newTask.setExternalId("MyExternalId");
|
newTask2.setExternalId("MyExternalId");
|
||||||
newTask.setClassificationKey("T2100");
|
newTask2.setClassificationKey("T2100");
|
||||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
newTask2.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||||
taskService.createTask(newTask);
|
|
||||||
|
Assertions.assertThrows(TaskAlreadyExistException.class, () ->
|
||||||
|
taskService.createTask(newTask2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -488,31 +491,31 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = WorkbasketNotFoundException.class)
|
@Test
|
||||||
public void testGetExceptionIfWorkbasketDoesNotExist()
|
public void testGetExceptionIfWorkbasketDoesNotExist() {
|
||||||
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
|
||||||
WorkbasketNotFoundException, TaskAlreadyExistException {
|
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task newTask = taskService.newTask("UNKNOWN");
|
Task newTask = taskService.newTask("UNKNOWN");
|
||||||
newTask.setClassificationKey("T2100");
|
newTask.setClassificationKey("T2100");
|
||||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||||
taskService.createTask(newTask);
|
|
||||||
|
Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
|
||||||
|
taskService.createTask(newTask));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testGetExceptionIfAppendIsNotPermitted()
|
public void testGetExceptionIfAppendIsNotPermitted() {
|
||||||
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
|
||||||
WorkbasketNotFoundException, TaskAlreadyExistException {
|
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task newTask = taskService.newTask("GPK_KSC", "DOMAIN_A");
|
Task newTask = taskService.newTask("GPK_KSC", "DOMAIN_A");
|
||||||
newTask.setClassificationKey("T2100");
|
newTask.setClassificationKey("T2100");
|
||||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
|
||||||
taskService.createTask(newTask);
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskService.createTask(newTask));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -681,7 +684,7 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testCreateTaskWithSecurityButNoUserId()
|
public void testCreateTaskWithSecurityButNoUserId()
|
||||||
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
|
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
|
||||||
TaskAlreadyExistException, InvalidArgumentException {
|
TaskAlreadyExistException, InvalidArgumentException {
|
||||||
|
@ -690,33 +693,39 @@ public class CreateTaskAccTest extends AbstractAccTest {
|
||||||
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
|
Task newTask = taskService.newTask("USER_1_1", "DOMAIN_A");
|
||||||
newTask.setClassificationKey("T2100");
|
newTask.setClassificationKey("T2100");
|
||||||
newTask.setPrimaryObjRef(createObjectReference("COMPANY_B", "SYSTEM_B", "INSTANCE_B", "VNR", "1234567"));
|
newTask.setPrimaryObjRef(createObjectReference("COMPANY_B", "SYSTEM_B", "INSTANCE_B", "VNR", "1234567"));
|
||||||
taskService.createTask(newTask);
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskService.createTask(newTask));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = TaskAlreadyExistException.class)
|
@Test
|
||||||
public void testCreateTaskAlreadyExisting()
|
public void testCreateTaskAlreadyExisting()
|
||||||
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
|
throws WorkbasketNotFoundException, ClassificationNotFoundException, NotAuthorizedException,
|
||||||
TaskAlreadyExistException, InvalidArgumentException, TaskNotFoundException {
|
TaskAlreadyExistException, InvalidArgumentException, TaskNotFoundException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task existingTask = taskService.getTask("TKI:000000000000000000000000000000000000");
|
Task existingTask = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
taskService.createTask(existingTask);
|
|
||||||
|
Assertions.assertThrows(TaskAlreadyExistException.class, () ->
|
||||||
|
taskService.createTask(existingTask));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testCreateTaskNotAuthorizedOnWorkbasket() throws WorkbasketNotFoundException,
|
public void testCreateTaskNotAuthorizedOnWorkbasket() throws WorkbasketNotFoundException,
|
||||||
ClassificationNotFoundException, NotAuthorizedException, TaskAlreadyExistException,
|
ClassificationNotFoundException, NotAuthorizedException, TaskAlreadyExistException,
|
||||||
InvalidArgumentException {
|
InvalidArgumentException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.newTask("TEAMLEAD_2", "DOMAIN_A");
|
Task task = taskService.newTask("TEAMLEAD_2", "DOMAIN_A");
|
||||||
taskService.createTask(task);
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskService.createTask(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task makeNewTask(TaskService taskService) {
|
private Task makeNewTask(TaskService taskService) {
|
||||||
|
|
|
@ -7,8 +7,9 @@ import static org.junit.Assert.fail;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BulkOperationResults;
|
import pro.taskana.BulkOperationResults;
|
||||||
|
@ -19,13 +20,13 @@ import pro.taskana.exceptions.InvalidStateException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.TaskNotFoundException;
|
import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.TaskanaException;
|
import pro.taskana.exceptions.TaskanaException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "delete task" scenarios.
|
* Acceptance test for all "delete task" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class DeleteTaskAccTest extends AbstractAccTest {
|
public class DeleteTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public DeleteTaskAccTest() {
|
public DeleteTaskAccTest() {
|
||||||
|
@ -35,19 +36,19 @@ public class DeleteTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testDeleteSingleTaskNotAuthorized()
|
public void testDeleteSingleTaskNotAuthorized()
|
||||||
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
taskService.deleteTask("TKI:000000000000000000000000000000000037");
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
fail("NotAuthorizedException should have been thrown");
|
taskService.deleteTask("TKI:000000000000000000000000000000000037"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1", "admin"})
|
groupNames = {"group_1", "admin"})
|
||||||
@Test(expected = TaskNotFoundException.class)
|
@Test
|
||||||
public void testDeleteSingleTask()
|
public void testDeleteSingleTask()
|
||||||
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
||||||
|
|
||||||
|
@ -56,25 +57,27 @@ public class DeleteTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
taskService.deleteTask(task.getId());
|
taskService.deleteTask(task.getId());
|
||||||
|
|
||||||
taskService.getTask("TKI:000000000000000000000000000000000036");
|
Assertions.assertThrows(TaskNotFoundException.class, () ->
|
||||||
|
taskService.getTask("TKI:000000000000000000000000000000000036"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1", "admin"})
|
groupNames = {"group_1", "admin"})
|
||||||
@Test(expected = InvalidStateException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfTaskIsNotCompleted()
|
public void testThrowsExceptionIfTaskIsNotCompleted()
|
||||||
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000029");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000029");
|
||||||
|
|
||||||
taskService.deleteTask(task.getId());
|
Assertions.assertThrows(InvalidStateException.class, () ->
|
||||||
|
taskService.deleteTask(task.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1", "admin"})
|
groupNames = {"group_1", "admin"})
|
||||||
@Test(expected = TaskNotFoundException.class)
|
@Test
|
||||||
public void testForceDeleteTaskIfNotCompleted()
|
public void testForceDeleteTaskIfNotCompleted()
|
||||||
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
throws TaskNotFoundException, InvalidStateException, NotAuthorizedException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
@ -86,13 +89,14 @@ public class DeleteTaskAccTest extends AbstractAccTest {
|
||||||
taskService.forceDeleteTask(task.getId());
|
taskService.forceDeleteTask(task.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
taskService.getTask("TKI:000000000000000000000000000000000027");
|
Assertions.assertThrows(TaskNotFoundException.class, () ->
|
||||||
|
taskService.getTask("TKI:000000000000000000000000000000000027"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = TaskNotFoundException.class)
|
@Test
|
||||||
public void testBulkDeleteTask()
|
public void testBulkDeleteTask()
|
||||||
throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedException {
|
throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedException {
|
||||||
|
|
||||||
|
@ -104,13 +108,14 @@ public class DeleteTaskAccTest extends AbstractAccTest {
|
||||||
BulkOperationResults<String, TaskanaException> results = taskService.deleteTasks(taskIdList);
|
BulkOperationResults<String, TaskanaException> results = taskService.deleteTasks(taskIdList);
|
||||||
|
|
||||||
assertFalse(results.containsErrors());
|
assertFalse(results.containsErrors());
|
||||||
taskService.getTask("TKI:000000000000000000000000000000000038");
|
Assertions.assertThrows(TaskNotFoundException.class, () ->
|
||||||
|
taskService.getTask("TKI:000000000000000000000000000000000038"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = TaskNotFoundException.class)
|
@Test
|
||||||
public void testBulkDeleteTasksWithException()
|
public void testBulkDeleteTasksWithException()
|
||||||
throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedException {
|
throws TaskNotFoundException, InvalidArgumentException, NotAuthorizedException {
|
||||||
|
|
||||||
|
@ -131,7 +136,8 @@ public class DeleteTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
Task notDeletedTask = taskService.getTask("TKI:000000000000000000000000000000000028");
|
Task notDeletedTask = taskService.getTask("TKI:000000000000000000000000000000000028");
|
||||||
assertTrue(notDeletedTask != null);
|
assertTrue(notDeletedTask != null);
|
||||||
taskService.getTask("TKI:000000000000000000000000000000000040");
|
Assertions.assertThrows(TaskNotFoundException.class, () ->
|
||||||
|
taskService.getTask("TKI:000000000000000000000000000000000040"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,9 @@ import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Task;
|
import pro.taskana.Task;
|
||||||
|
@ -14,14 +15,14 @@ import pro.taskana.TaskState;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.TaskNotFoundException;
|
import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "get task" scenarios.
|
* Acceptance test for all "get task" scenarios.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class GetTaskAccTest extends AbstractAccTest {
|
public class GetTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public GetTaskAccTest() {
|
public GetTaskAccTest() {
|
||||||
|
@ -84,12 +85,13 @@ public class GetTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = TaskNotFoundException.class)
|
@Test
|
||||||
public void testGetTaskByIdNotExisting()
|
public void testGetTaskByIdNotExisting()
|
||||||
throws TaskNotFoundException, NotAuthorizedException {
|
throws TaskNotFoundException, NotAuthorizedException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
taskService.getTask("INVALID");
|
Assertions.assertThrows(TaskNotFoundException.class, () ->
|
||||||
|
taskService.getTask("INVALID"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,23 +6,23 @@ import static org.junit.Assert.assertNotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.AttachmentSummary;
|
import pro.taskana.AttachmentSummary;
|
||||||
import pro.taskana.TaskQuery;
|
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
|
import pro.taskana.TaskQuery;
|
||||||
import pro.taskana.TaskQueryColumnName;
|
import pro.taskana.TaskQueryColumnName;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
import pro.taskana.TaskSummary;
|
import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
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.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
|
public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private static SortDirection asc = SortDirection.ASCENDING;
|
private static SortDirection asc = SortDirection.ASCENDING;
|
||||||
|
@ -179,7 +179,5 @@ public class QueryTaskByClassificationNameAccTest extends AbstractAccTest {
|
||||||
// therefore, task 001 is counted only once.
|
// therefore, task 001 is counted only once.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Attachment;
|
import pro.taskana.Attachment;
|
||||||
|
@ -19,13 +19,13 @@ import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.TaskNotFoundException;
|
import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
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.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryTaskWithAttachment extends AbstractAccTest {
|
public class QueryTaskWithAttachment extends AbstractAccTest {
|
||||||
|
|
||||||
public QueryTaskWithAttachment() {
|
public QueryTaskWithAttachment() {
|
||||||
|
|
|
@ -21,8 +21,9 @@ import org.apache.ibatis.exceptions.PersistenceException;
|
||||||
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.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Attachment;
|
import pro.taskana.Attachment;
|
||||||
|
@ -44,19 +45,19 @@ import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.impl.TaskImpl;
|
import pro.taskana.impl.TaskImpl;
|
||||||
import pro.taskana.impl.TaskanaEngineProxyForTest;
|
import pro.taskana.impl.TaskanaEngineProxyForTest;
|
||||||
import pro.taskana.mappings.TaskTestMapper;
|
import pro.taskana.mappings.TaskTestMapper;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query tasks with sorting" scenarios.
|
* Acceptance test for all "query tasks with sorting" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryTasksAccTest extends AbstractAccTest {
|
class QueryTasksAccTest 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 QueryTasksAccTest() {
|
QueryTasksAccTest() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"admin"})
|
groupNames = {"admin"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryTaskValuesForEveryColumn() {
|
void testQueryTaskValuesForEveryColumn() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<String> notWorkingColumns = new ArrayList<>();
|
List<String> notWorkingColumns = new ArrayList<>();
|
||||||
for (TaskQueryColumnName columnName : TaskQueryColumnName.values()) {
|
for (TaskQueryColumnName columnName : TaskQueryColumnName.values()) {
|
||||||
|
@ -81,7 +82,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"admin"})
|
groupNames = {"admin"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryTaskValuesForColumnName() {
|
void testQueryTaskValuesForColumnName() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<String> columnValueList = taskService.createTaskQuery()
|
List<String> columnValueList = taskService.createTaskQuery()
|
||||||
.ownerLike("%user%")
|
.ownerLike("%user%")
|
||||||
|
@ -100,7 +101,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"admin"})
|
groupNames = {"admin"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryTaskValuesForColumnNameOnAttachments() {
|
void testQueryTaskValuesForColumnNameOnAttachments() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<String> columnValueList = taskService.createTaskQuery()
|
List<String> columnValueList = taskService.createTaskQuery()
|
||||||
.attachmentReferenceValueIn("val4")
|
.attachmentReferenceValueIn("val4")
|
||||||
|
@ -131,7 +132,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "group_2"})
|
groupNames = {"group_1", "group_2"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOwnerLike() {
|
void testQueryForOwnerLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -153,7 +154,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "group_2"})
|
groupNames = {"group_1", "group_2"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForParentBusinessProcessId() {
|
void testQueryForParentBusinessProcessId() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -179,7 +180,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "group_2"})
|
groupNames = {"group_1", "group_2"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForName() {
|
void testQueryForName() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -202,7 +203,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "group_2"})
|
groupNames = {"group_1", "group_2"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForClassificationKey() {
|
void testQueryForClassificationKey() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -235,7 +236,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForAttachmentInSummary()
|
void testQueryForAttachmentInSummary()
|
||||||
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||||
TaskNotFoundException, ConcurrencyException, AttachmentPersistenceException {
|
TaskNotFoundException, ConcurrencyException, AttachmentPersistenceException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
@ -261,7 +262,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"admin"})
|
groupNames = {"admin"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForExternalId() {
|
void testQueryForExternalId() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -285,7 +286,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom1()
|
void testQueryForCustom1()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -316,7 +317,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom2()
|
void testQueryForCustom2()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -347,7 +348,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom3()
|
void testQueryForCustom3()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -378,7 +379,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom4()
|
void testQueryForCustom4()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -409,7 +410,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom5()
|
void testQueryForCustom5()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -440,7 +441,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom6()
|
void testQueryForCustom6()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -470,22 +471,23 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testQueryForCustom7WithExceptionInLike()
|
void testQueryForCustom7WithExceptionInLike() {
|
||||||
throws InvalidArgumentException {
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
Assertions.assertThrows(InvalidArgumentException.class, () -> {
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("7")
|
.customAttributeLike("7")
|
||||||
.list();
|
.list();
|
||||||
assertThat(results.size(), equalTo(0));
|
assertThat(results.size(), equalTo(0));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testQueryForCustom7WithExceptionInIn()
|
void testQueryForCustom7WithExceptionInIn()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -506,17 +508,19 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
.toArray(new String[0]);
|
.toArray(new String[0]);
|
||||||
|
|
||||||
|
Assertions.assertThrows(InvalidArgumentException.class, () -> {
|
||||||
List<TaskSummary> result2 = taskService.createTaskQuery()
|
List<TaskSummary> result2 = taskService.createTaskQuery()
|
||||||
.customAttributeIn("7", ids)
|
.customAttributeIn("7", ids)
|
||||||
.list();
|
.list();
|
||||||
assertThat(result2.size(), equalTo(0));
|
assertThat(result2.size(), equalTo(0));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom7WithException()
|
void testQueryForCustom7WithException()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -547,7 +551,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom8()
|
void testQueryForCustom8()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -578,7 +582,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom9()
|
void testQueryForCustom9()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -609,7 +613,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom10()
|
void testQueryForCustom10()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -640,7 +644,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom11()
|
void testQueryForCustom11()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -670,7 +674,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom12()
|
void testQueryForCustom12()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -700,7 +704,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom13()
|
void testQueryForCustom13()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -730,7 +734,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom14()
|
void testQueryForCustom14()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -760,7 +764,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom15()
|
void testQueryForCustom15()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -790,7 +794,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCustom16()
|
void testQueryForCustom16()
|
||||||
throws InvalidArgumentException {
|
throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
@ -820,7 +824,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryTaskByCustomAttributes()
|
void testQueryTaskByCustomAttributes()
|
||||||
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
||||||
WorkbasketNotFoundException, TaskAlreadyExistException, NoSuchFieldException, IllegalAccessException {
|
WorkbasketNotFoundException, TaskAlreadyExistException, NoSuchFieldException, IllegalAccessException {
|
||||||
|
|
||||||
|
@ -865,7 +869,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryAndCountMatch() {
|
void testQueryAndCountMatch() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
TaskQuery taskQuery = taskService.createTaskQuery();
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
List<TaskSummary> tasks = taskQuery
|
List<TaskSummary> tasks = taskQuery
|
||||||
|
@ -882,7 +886,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryAllPaged() {
|
void testQueryAllPaged() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
TaskQuery taskQuery = taskService.createTaskQuery();
|
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||||
long numberOfTasks = taskQuery.count();
|
long numberOfTasks = taskQuery.count();
|
||||||
|
@ -904,7 +908,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCreatorIn() {
|
void testQueryForCreatorIn() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.creatorIn("creator_user_id2", "creator_user_id3")
|
.creatorIn("creator_user_id2", "creator_user_id3")
|
||||||
|
@ -915,7 +919,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForCreatorLike() {
|
void testQueryForCreatorLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.creatorLike("ersTeLlEr%")
|
.creatorLike("ersTeLlEr%")
|
||||||
|
@ -926,7 +930,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForNoteLike() {
|
void testQueryForNoteLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.noteLike("Some%")
|
.noteLike("Some%")
|
||||||
|
@ -937,7 +941,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForClassificationCategoryIn() {
|
void testQueryForClassificationCategoryIn() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.classificationCategoryIn("MANUAL", "AUTOMATIC")
|
.classificationCategoryIn("MANUAL", "AUTOMATIC")
|
||||||
|
@ -948,7 +952,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForClassificationCategoryLike() {
|
void testQueryForClassificationCategoryLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.classificationCategoryLike("AUTO%")
|
.classificationCategoryLike("AUTO%")
|
||||||
|
@ -959,7 +963,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForPrimaryObjectReferenceCompanyLike() {
|
void testQueryForPrimaryObjectReferenceCompanyLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.primaryObjectReferenceCompanyLike("My%")
|
.primaryObjectReferenceCompanyLike("My%")
|
||||||
|
@ -970,7 +974,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForPrimaryObjectReferenceSystemLike() {
|
void testQueryForPrimaryObjectReferenceSystemLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.primaryObjectReferenceSystemLike("My%")
|
.primaryObjectReferenceSystemLike("My%")
|
||||||
|
@ -981,7 +985,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForPrimaryObjectReferenceSystemInstanceLike() {
|
void testQueryForPrimaryObjectReferenceSystemInstanceLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.primaryObjectReferenceSystemInstanceLike("My%")
|
.primaryObjectReferenceSystemInstanceLike("My%")
|
||||||
|
@ -992,7 +996,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForPrimaryObjectReferenceTypeLike() {
|
void testQueryForPrimaryObjectReferenceTypeLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.primaryObjectReferenceTypeLike("My%")
|
.primaryObjectReferenceTypeLike("My%")
|
||||||
|
@ -1003,7 +1007,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForReadEquals() {
|
void testQueryForReadEquals() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.readEquals(true)
|
.readEquals(true)
|
||||||
|
@ -1014,7 +1018,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForTransferredEquals() {
|
void testQueryForTransferredEquals() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.transferredEquals(true)
|
.transferredEquals(true)
|
||||||
|
@ -1025,7 +1029,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForBusinessProcessIdIn() {
|
void testQueryForBusinessProcessIdIn() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.businessProcessIdIn("PI_0000000000003", "BPI21")
|
.businessProcessIdIn("PI_0000000000003", "BPI21")
|
||||||
|
@ -1036,7 +1040,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForBusinessProcessIdLike() {
|
void testQueryForBusinessProcessIdLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.businessProcessIdLike("pI_%")
|
.businessProcessIdLike("pI_%")
|
||||||
|
@ -1047,7 +1051,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForAttachmentClassificationKeyIn() {
|
void testQueryForAttachmentClassificationKeyIn() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.attachmentClassificationKeyIn("L110102")
|
.attachmentClassificationKeyIn("L110102")
|
||||||
|
@ -1060,7 +1064,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForAttachmentClassificationKeyLike() {
|
void testQueryForAttachmentClassificationKeyLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.attachmentClassificationKeyLike("%10102")
|
.attachmentClassificationKeyLike("%10102")
|
||||||
|
@ -1073,7 +1077,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForAttachmentclassificationIdIn() {
|
void testQueryForAttachmentclassificationIdIn() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.attachmentClassificationIdIn("CLI:000000000000000000000000000000000002")
|
.attachmentClassificationIdIn("CLI:000000000000000000000000000000000002")
|
||||||
|
@ -1086,7 +1090,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForAttachmentChannelLike() {
|
void testQueryForAttachmentChannelLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.attachmentChannelLike("%6")
|
.attachmentChannelLike("%6")
|
||||||
|
@ -1097,7 +1101,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForAttachmentReferenceIn() {
|
void testQueryForAttachmentReferenceIn() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.attachmentReferenceValueIn("val4")
|
.attachmentReferenceValueIn("val4")
|
||||||
|
@ -1109,7 +1113,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForAttachmentReceivedIn() {
|
void testQueryForAttachmentReceivedIn() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
TimeInterval interval = new TimeInterval(
|
TimeInterval interval = new TimeInterval(
|
||||||
getInstant("2018-01-30T12:00:00"),
|
getInstant("2018-01-30T12:00:00"),
|
||||||
|
@ -1126,7 +1130,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCreatorDesc() {
|
void testQueryForOrderByCreatorDesc() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.orderByCreator(desc)
|
.orderByCreator(desc)
|
||||||
|
@ -1137,7 +1141,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByWorkbasketIdDesc() {
|
void testQueryForOrderByWorkbasketIdDesc() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.orderByWorkbasketId(desc)
|
.orderByWorkbasketId(desc)
|
||||||
|
@ -1149,7 +1153,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom1Asc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom1Asc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("1", "%")
|
.customAttributeLike("1", "%")
|
||||||
|
@ -1161,7 +1165,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom2Desc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom2Desc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("2", "%")
|
.customAttributeLike("2", "%")
|
||||||
|
@ -1173,7 +1177,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom3Asc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom3Asc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("3", "%")
|
.customAttributeLike("3", "%")
|
||||||
|
@ -1185,7 +1189,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom4Desc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom4Desc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("4", "%")
|
.customAttributeLike("4", "%")
|
||||||
|
@ -1199,7 +1203,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom5Asc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom5Asc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("5", "%")
|
.customAttributeLike("5", "%")
|
||||||
|
@ -1211,7 +1215,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom6Desc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom6Desc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("6", "%")
|
.customAttributeLike("6", "%")
|
||||||
|
@ -1223,7 +1227,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom7Asc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom7Asc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.orderByCustomAttribute("7", asc)
|
.orderByCustomAttribute("7", asc)
|
||||||
|
@ -1235,7 +1239,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom8Desc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom8Desc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.orderByCustomAttribute("8", desc)
|
.orderByCustomAttribute("8", desc)
|
||||||
|
@ -1247,7 +1251,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom9Asc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom9Asc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("9", "%")
|
.customAttributeLike("9", "%")
|
||||||
|
@ -1259,7 +1263,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom10Desc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom10Desc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("10", "%")
|
.customAttributeLike("10", "%")
|
||||||
|
@ -1271,7 +1275,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom11Desc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom11Desc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.orderByCustomAttribute("11", desc)
|
.orderByCustomAttribute("11", desc)
|
||||||
|
@ -1286,7 +1290,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom12Asc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom12Asc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("12", "%")
|
.customAttributeLike("12", "%")
|
||||||
|
@ -1298,7 +1302,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom13Desc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom13Desc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("13", "%")
|
.customAttributeLike("13", "%")
|
||||||
|
@ -1312,7 +1316,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom14Asc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom14Asc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("14", "%")
|
.customAttributeLike("14", "%")
|
||||||
|
@ -1324,7 +1328,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom15Desc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom15Desc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("15", "%")
|
.customAttributeLike("15", "%")
|
||||||
|
@ -1338,7 +1342,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByCustom16Asc() throws InvalidArgumentException {
|
void testQueryForOrderByCustom16Asc() throws InvalidArgumentException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.customAttributeLike("16", "%")
|
.customAttributeLike("16", "%")
|
||||||
|
@ -1350,7 +1354,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderWithDirectionNull() {
|
void testQueryForOrderWithDirectionNull() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.orderByPrimaryObjectReferenceSystemInstance(null)
|
.orderByPrimaryObjectReferenceSystemInstance(null)
|
||||||
|
@ -1361,7 +1365,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByAttachmentClassificationIdAsc() {
|
void testQueryForOrderByAttachmentClassificationIdAsc() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
|
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
|
||||||
|
@ -1375,7 +1379,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByAttachmentClassificationIdDesc() {
|
void testQueryForOrderByAttachmentClassificationIdDesc() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
|
.idIn("TKI:000000000000000000000000000000000010", "TKI:000000000000000000000000000000000011",
|
||||||
|
@ -1389,7 +1393,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByAttachmentClassificationKeyAsc() {
|
void testQueryForOrderByAttachmentClassificationKeyAsc() {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -1405,7 +1409,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByAttachmentClassificationKeyDesc() {
|
void testQueryForOrderByAttachmentClassificationKeyDesc() {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -1421,7 +1425,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByAttachmentRefValueDesc() {
|
void testQueryForOrderByAttachmentRefValueDesc() {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -1437,7 +1441,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForOrderByAttachmentChannelAscAndReferenceDesc() {
|
void testQueryForOrderByAttachmentChannelAscAndReferenceDesc() {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -1454,7 +1458,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "admin")
|
userName = "admin")
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForAttachmentLikeCHAndOrderByClassificationKeyDescAndAsc() {
|
void testQueryForAttachmentLikeCHAndOrderByClassificationKeyDescAndAsc() {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -1478,7 +1482,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "group_2"})
|
groupNames = {"group_1", "group_2"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForExternalIdIn() {
|
void testQueryForExternalIdIn() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
@ -1505,7 +1509,7 @@ public class QueryTasksAccTest extends AbstractAccTest {
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1", "group_2"})
|
groupNames = {"group_1", "group_2"})
|
||||||
@Test
|
@Test
|
||||||
public void testQueryForExternalIdLike() {
|
void testQueryForExternalIdLike() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
List<TaskSummary> results = taskService.createTaskQuery()
|
List<TaskSummary> results = taskService.createTaskQuery()
|
||||||
|
|
|
@ -3,20 +3,20 @@ package acceptance.task;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
import pro.taskana.TaskSummary;
|
import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.exceptions.SystemException;
|
import pro.taskana.exceptions.SystemException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
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.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
|
public class QueryTasksByObjectReferenceAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public QueryTasksByObjectReferenceAccTest() {
|
public QueryTasksByObjectReferenceAccTest() {
|
||||||
|
|
|
@ -7,21 +7,21 @@ import java.time.Instant;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
import pro.taskana.TaskSummary;
|
import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.TimeInterval;
|
import pro.taskana.TimeInterval;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query tasks with sorting" scenarios.
|
* Acceptance test for all "query tasks with sorting" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
|
public class QueryTasksByTimeIntervalsAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private static SortDirection asc = SortDirection.ASCENDING;
|
private static SortDirection asc = SortDirection.ASCENDING;
|
||||||
|
|
|
@ -7,21 +7,22 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.KeyDomain;
|
import pro.taskana.KeyDomain;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
import pro.taskana.TaskSummary;
|
import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException;
|
import pro.taskana.exceptions.NotAuthorizedToQueryWorkbasketException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query tasks by workbasket" scenarios.
|
* Acceptance test for all "query tasks by workbasket" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
|
public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public QueryTasksByWorkbasketAccTest() {
|
public QueryTasksByWorkbasketAccTest() {
|
||||||
|
@ -56,23 +57,26 @@ public class QueryTasksByWorkbasketAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedToQueryWorkbasketException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket() {
|
public void testThrowsExceptionIfNoOpenerPermissionOnQueriedWorkbasket() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedToQueryWorkbasketException.class, () ->
|
||||||
taskService.createTaskQuery()
|
taskService.createTaskQuery()
|
||||||
.workbasketKeyDomainIn(new KeyDomain("USER_2_1", "DOMAIN_A"))
|
.workbasketKeyDomainIn(new KeyDomain("USER_2_1", "DOMAIN_A"))
|
||||||
.list();
|
.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedToQueryWorkbasketException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket() {
|
public void testThrowsExceptionIfNoOpenerPermissionOnAtLeastOneQueriedWorkbasket() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
Assertions.assertThrows(NotAuthorizedToQueryWorkbasketException.class, () ->
|
||||||
taskService.createTaskQuery()
|
taskService.createTaskQuery()
|
||||||
.workbasketKeyDomainIn(new KeyDomain("USER_1_1", "DOMAIN_A"), new KeyDomain("USER_2_1", "DOMAIN_A"))
|
.workbasketKeyDomainIn(new KeyDomain("USER_1_1", "DOMAIN_A"), new KeyDomain("USER_2_1", "DOMAIN_A"))
|
||||||
.list();
|
.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,22 +5,23 @@ import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Ignore;
|
import org.junit.jupiter.api.Assertions;
|
||||||
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 acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.KeyDomain;
|
import pro.taskana.KeyDomain;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
import pro.taskana.TaskSummary;
|
import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.exceptions.TaskanaRuntimeException;
|
import pro.taskana.exceptions.TaskanaRuntimeException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
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.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
|
public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public QueryTasksWithPaginationAccTest() {
|
public QueryTasksWithPaginationAccTest() {
|
||||||
|
@ -153,20 +154,22 @@ public class QueryTasksWithPaginationAccTest extends AbstractAccTest {
|
||||||
* Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
|
* Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
|
||||||
* Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
|
* Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
@Disabled
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = TaskanaRuntimeException.class)
|
@Test
|
||||||
public void testPaginationThrowingExceptionWhenPageOutOfBounds() {
|
public void testPaginationThrowingExceptionWhenPageOutOfBounds() {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
// entrypoint set outside result amount
|
// entrypoint set outside result amount
|
||||||
int pageNumber = 6;
|
int pageNumber = 6;
|
||||||
int pageSize = 10;
|
int pageSize = 10;
|
||||||
|
|
||||||
|
Assertions.assertThrows(TaskanaRuntimeException.class, () ->
|
||||||
taskService.createTaskQuery()
|
taskService.createTaskQuery()
|
||||||
.workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A"))
|
.workbasketKeyDomainIn(new KeyDomain("GPK_KSC", "DOMAIN_A"))
|
||||||
.listPage(pageNumber, pageSize);
|
.listPage(pageNumber, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -6,8 +6,8 @@ import static org.junit.Assert.assertThat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
|
@ -15,13 +15,13 @@ import pro.taskana.KeyDomain;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
import pro.taskana.TaskState;
|
import pro.taskana.TaskState;
|
||||||
import pro.taskana.TaskSummary;
|
import pro.taskana.TaskSummary;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query tasks with sorting" scenarios.
|
* Acceptance test for all "query tasks with sorting" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryTasksWithSortingAccTest extends AbstractAccTest {
|
public class QueryTasksWithSortingAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private static SortDirection asc = SortDirection.ASCENDING;
|
private static SortDirection asc = SortDirection.ASCENDING;
|
||||||
|
|
|
@ -15,8 +15,9 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BulkOperationResults;
|
import pro.taskana.BulkOperationResults;
|
||||||
|
@ -31,13 +32,13 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.TaskNotFoundException;
|
import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.TaskanaException;
|
import pro.taskana.exceptions.TaskanaException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "transfer task" scenarios.
|
* Acceptance test for all "transfer task" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class TransferTaskAccTest extends AbstractAccTest {
|
public class TransferTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public TransferTaskAccTest() {
|
public TransferTaskAccTest() {
|
||||||
|
@ -105,74 +106,79 @@ public class TransferTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfTransferWithNoTransferAuthorization()
|
public void testThrowsExceptionIfTransferWithNoTransferAuthorization()
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException {
|
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000001");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000001");
|
||||||
|
|
||||||
taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000005");
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000005"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = WorkbasketNotFoundException.class)
|
@Test
|
||||||
public void testTransferDestinationWorkbasketDoesNotExist()
|
public void testTransferDestinationWorkbasketDoesNotExist()
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException,
|
throws NotAuthorizedException, TaskNotFoundException, InvalidStateException,
|
||||||
InvalidOwnerException {
|
InvalidOwnerException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000003");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000003");
|
||||||
taskService.claim(task.getId());
|
taskService.claim(task.getId());
|
||||||
taskService.setTaskRead(task.getId(), true);
|
taskService.setTaskRead(task.getId(), true);
|
||||||
|
|
||||||
taskService.transfer(task.getId(), "INVALID");
|
Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
|
||||||
|
taskService.transfer(task.getId(), "INVALID"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = TaskNotFoundException.class)
|
@Test
|
||||||
public void testTransferTaskDoesNotExist()
|
public void testTransferTaskDoesNotExist() {
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException {
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
taskService.transfer("Invalid", "WBI:100000000000000000000000000000000006");
|
Assertions.assertThrows(TaskNotFoundException.class, () ->
|
||||||
|
taskService.transfer("Invalid", "WBI:100000000000000000000000000000000006"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"teamlead_1"})
|
groupNames = {"teamlead_1"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testTransferNotAuthorizationOnWorkbasketTransfer()
|
public void testTransferNotAuthorizationOnWorkbasketTransfer() {
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException {
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
|
|
||||||
taskService.transfer("TKI:200000000000000000000000000000000007", "WBI:100000000000000000000000000000000006");
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskService.transfer("TKI:200000000000000000000000000000000007",
|
||||||
|
"WBI:100000000000000000000000000000000006"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidStateException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfTaskIsAlreadyCompleted()
|
public void testThrowsExceptionIfTaskIsAlreadyCompleted()
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException {
|
throws NotAuthorizedException, TaskNotFoundException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTask("TKI:100000000000000000000000000000000006");
|
Task task = taskService.getTask("TKI:100000000000000000000000000000000006");
|
||||||
|
|
||||||
taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000005");
|
Assertions.assertThrows(InvalidStateException.class, () ->
|
||||||
|
taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000005"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfTransferWithNoAppendAuthorization()
|
public void testThrowsExceptionIfTransferWithNoAppendAuthorization()
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException, TaskNotFoundException, InvalidStateException {
|
throws NotAuthorizedException, TaskNotFoundException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000002");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000002");
|
||||||
|
|
||||||
taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000008");
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
taskService.transfer(task.getId(), "WBI:100000000000000000000000000000000008"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -271,21 +277,18 @@ public class TransferTaskAccTest extends AbstractAccTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(userName = "teamlead_1")
|
@WithAccessId(userName = "teamlead_1")
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testBulkTransferTaskWithoutAppendPermissionOnTarget()
|
public void testBulkTransferTaskWithoutAppendPermissionOnTarget() {
|
||||||
throws InvalidArgumentException, WorkbasketNotFoundException, NotAuthorizedException {
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
ArrayList<String> taskIdList = new ArrayList<>();
|
ArrayList<String> taskIdList = new ArrayList<>();
|
||||||
taskIdList.add("TKI:000000000000000000000000000000000006"); // working
|
taskIdList.add("TKI:000000000000000000000000000000000006"); // working
|
||||||
taskIdList.add("TKI:000000000000000000000000000000000041"); // NotAuthorized READ
|
taskIdList.add("TKI:000000000000000000000000000000000041"); // NotAuthorized READ
|
||||||
|
|
||||||
try {
|
Throwable t = Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
taskService
|
taskService
|
||||||
.transferTasks("WBI:100000000000000000000000000000000010", taskIdList);
|
.transferTasks("WBI:100000000000000000000000000000000010", taskIdList));
|
||||||
} catch (NotAuthorizedException e) {
|
|
||||||
assertTrue(e.getMessage().contains("APPEND"));
|
assertTrue(t.getMessage().contains("APPEND"));
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -326,12 +329,13 @@ public class TransferTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "teamlead_1",
|
userName = "teamlead_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfEmptyListIsSupplied()
|
public void testThrowsExceptionIfEmptyListIsSupplied()
|
||||||
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException {
|
throws NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException {
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
List<String> taskIds = new ArrayList<>();
|
List<String> taskIds = new ArrayList<>();
|
||||||
taskService.transferTasks("WBI:100000000000000000000000000000000006", taskIds);
|
Assertions.assertThrows(InvalidArgumentException.class, () ->
|
||||||
|
taskService.transferTasks("WBI:100000000000000000000000000000000006", taskIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -17,8 +17,9 @@ 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.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.ClassificationSummary;
|
import pro.taskana.ClassificationSummary;
|
||||||
|
@ -35,13 +36,13 @@ import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||||
import pro.taskana.exceptions.TaskNotFoundException;
|
import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.impl.TaskImpl;
|
import pro.taskana.impl.TaskImpl;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "update task" scenarios.
|
* Acceptance test for all "update task" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class UpdateTaskAccTest extends AbstractAccTest {
|
public class UpdateTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public UpdateTaskAccTest() {
|
public UpdateTaskAccTest() {
|
||||||
|
@ -207,7 +208,8 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
||||||
try {
|
try {
|
||||||
taskService.setTaskRead("INVALID", true);
|
taskService.setTaskRead("INVALID", true);
|
||||||
fail("TaskNotFoundException should have been thrown.");
|
fail("TaskNotFoundException should have been thrown.");
|
||||||
} catch (TaskNotFoundException e) { }
|
} catch (TaskNotFoundException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -229,15 +231,17 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidArgumentException.class)
|
@Test
|
||||||
public void testUpdateOfWorkbasketKeyWhatIsNotAllowed()
|
public void testUpdateOfWorkbasketKeyWhatIsNotAllowed()
|
||||||
throws NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
|
throws NotAuthorizedException,
|
||||||
TaskNotFoundException, ConcurrencyException, AttachmentPersistenceException {
|
TaskNotFoundException {
|
||||||
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
|
||||||
((TaskImpl) task).setWorkbasketKey("USER_2_2");
|
((TaskImpl) task).setWorkbasketKey("USER_2_2");
|
||||||
taskService.updateTask(task);
|
|
||||||
|
Assertions.assertThrows(InvalidArgumentException.class, () ->
|
||||||
|
taskService.updateTask(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -14,8 +14,9 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Attachment;
|
import pro.taskana.Attachment;
|
||||||
|
@ -36,13 +37,13 @@ import pro.taskana.impl.DaysToWorkingDaysConverter;
|
||||||
import pro.taskana.impl.TaskImpl;
|
import pro.taskana.impl.TaskImpl;
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
import pro.taskana.security.CurrentUserContext;
|
import pro.taskana.security.CurrentUserContext;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
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.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
|
public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private Task task;
|
private Task task;
|
||||||
|
@ -125,7 +126,7 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = AttachmentPersistenceException.class)
|
@Test
|
||||||
public void testAddNewAttachmentTwiceWithoutTaskanaMethodWillThrowAttachmentPersistenceException()
|
public void testAddNewAttachmentTwiceWithoutTaskanaMethodWillThrowAttachmentPersistenceException()
|
||||||
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
|
throws TaskNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException,
|
||||||
NotAuthorizedException,
|
NotAuthorizedException,
|
||||||
|
@ -142,7 +143,8 @@ public class UpdateTaskAttachmentsAccTest extends AbstractAccTest {
|
||||||
task.getAttachments().add(attachment);
|
task.getAttachments().add(attachment);
|
||||||
task.getAttachments().add(attachment);
|
task.getAttachments().add(attachment);
|
||||||
task.getAttachments().add(attachment);
|
task.getAttachments().add(attachment);
|
||||||
task = taskService.updateTask(task);
|
Assertions.assertThrows(AttachmentPersistenceException.class, () ->
|
||||||
|
task = taskService.updateTask(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -14,8 +14,9 @@ import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BulkOperationResults;
|
import pro.taskana.BulkOperationResults;
|
||||||
|
@ -28,13 +29,13 @@ import pro.taskana.exceptions.InvalidStateException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.TaskNotFoundException;
|
import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.TaskanaException;
|
import pro.taskana.exceptions.TaskanaException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
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...
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class WorkOnTaskAccTest extends AbstractAccTest {
|
public class WorkOnTaskAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public WorkOnTaskAccTest() {
|
public WorkOnTaskAccTest() {
|
||||||
|
@ -66,14 +67,14 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidOwnerException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfTaskIsAlreadyClaimed()
|
public void testThrowsExceptionIfTaskIsAlreadyClaimed()
|
||||||
throws NotAuthorizedException, TaskNotFoundException,
|
throws NotAuthorizedException, TaskNotFoundException {
|
||||||
InvalidStateException, InvalidOwnerException {
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000026");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000026");
|
||||||
|
|
||||||
taskService.claim(task.getId());
|
Assertions.assertThrows(InvalidOwnerException.class, () ->
|
||||||
|
taskService.claim(task.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -92,14 +93,14 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidOwnerException.class)
|
@Test
|
||||||
public void testForceClaimTaskWhichIsAlreadyClaimedByAnotherUser()
|
public void testForceClaimTaskWhichIsAlreadyClaimedByAnotherUser()
|
||||||
throws NotAuthorizedException, TaskNotFoundException,
|
throws NotAuthorizedException, TaskNotFoundException {
|
||||||
InvalidStateException, InvalidOwnerException {
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task task = taskService.getTask("TKI:000000000000000000000000000000000028");
|
Task task = taskService.getTask("TKI:000000000000000000000000000000000028");
|
||||||
|
|
||||||
taskService.claim(task.getId());
|
Assertions.assertThrows(InvalidOwnerException.class, () ->
|
||||||
|
taskService.claim(task.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -125,14 +126,14 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidOwnerException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfCancelClaimOfTaskFromAnotherUser()
|
public void testThrowsExceptionIfCancelClaimOfTaskFromAnotherUser()
|
||||||
throws NotAuthorizedException, TaskNotFoundException,
|
throws NotAuthorizedException, TaskNotFoundException {
|
||||||
InvalidStateException, InvalidOwnerException {
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000030");
|
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000030");
|
||||||
|
|
||||||
taskService.cancelClaim(claimedTask.getId());
|
Assertions.assertThrows(InvalidOwnerException.class, () ->
|
||||||
|
taskService.cancelClaim(claimedTask.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -203,14 +204,14 @@ public class WorkOnTaskAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = InvalidOwnerException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfCompletingClaimedTaskOfAnotherUser()
|
public void testThrowsExceptionIfCompletingClaimedTaskOfAnotherUser()
|
||||||
throws NotAuthorizedException, TaskNotFoundException,
|
throws NotAuthorizedException, TaskNotFoundException {
|
||||||
InvalidStateException, InvalidOwnerException {
|
|
||||||
TaskService taskService = taskanaEngine.getTaskService();
|
TaskService taskService = taskanaEngine.getTaskService();
|
||||||
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000034");
|
Task claimedTask = taskService.getTask("TKI:000000000000000000000000000000000034");
|
||||||
|
|
||||||
taskService.completeTask(claimedTask.getId());
|
Assertions.assertThrows(InvalidOwnerException.class, () ->
|
||||||
|
taskService.completeTask(claimedTask.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -7,8 +7,9 @@ import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Workbasket;
|
import pro.taskana.Workbasket;
|
||||||
|
@ -21,13 +22,13 @@ import pro.taskana.exceptions.InvalidWorkbasketException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.WorkbasketAlreadyExistException;
|
import pro.taskana.exceptions.WorkbasketAlreadyExistException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "create workbasket" scenarios.
|
* Acceptance test for all "create workbasket" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class CreateWorkbasketAccTest extends AbstractAccTest {
|
public class CreateWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public CreateWorkbasketAccTest() {
|
public CreateWorkbasketAccTest() {
|
||||||
|
@ -67,37 +68,33 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "dummy")
|
userName = "dummy")
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testCreateWorkbasketNotAuthorized()
|
public void testCreateWorkbasketNotAuthorized() {
|
||||||
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
|
|
||||||
DomainNotFoundException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
Workbasket workbasket = workbasketService.newWorkbasket("key3", "DOMAIN_A");
|
Workbasket workbasket = workbasketService.newWorkbasket("key3", "DOMAIN_A");
|
||||||
workbasket.setName("Megabasket");
|
workbasket.setName("Megabasket");
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setOrgLevel1("company");
|
workbasket.setOrgLevel1("company");
|
||||||
workbasketService.createWorkbasket(workbasket);
|
|
||||||
|
|
||||||
fail("NotAuthorizedException should have been thrown");
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
workbasketService.createWorkbasket(workbasket));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = DomainNotFoundException.class)
|
@Test
|
||||||
public void testCreateWorkbasketWithInvalidDomain()
|
public void testCreateWorkbasketWithInvalidDomain() {
|
||||||
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
|
|
||||||
DomainNotFoundException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
Workbasket workbasket = workbasketService.newWorkbasket("key3", "UNKNOWN_DOMAIN");
|
Workbasket workbasket = workbasketService.newWorkbasket("key3", "UNKNOWN_DOMAIN");
|
||||||
workbasket.setName("Megabasket");
|
workbasket.setName("Megabasket");
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setOrgLevel1("company");
|
workbasket.setOrgLevel1("company");
|
||||||
workbasketService.createWorkbasket(workbasket);
|
Assertions.assertThrows(DomainNotFoundException.class, () ->
|
||||||
|
workbasketService.createWorkbasket(workbasket));
|
||||||
fail("DomainNotFoundException should have been thrown");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -171,7 +168,7 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = WorkbasketAlreadyExistException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfWorkbasketWithCaseInsensitiveSameKeyDomainIsCreated()
|
public void testThrowsExceptionIfWorkbasketWithCaseInsensitiveSameKeyDomainIsCreated()
|
||||||
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
|
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketAlreadyExistException,
|
||||||
DomainNotFoundException {
|
DomainNotFoundException {
|
||||||
|
@ -185,15 +182,18 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
|
||||||
Workbasket duplicateWorkbasketWithSmallX = workbasketService.newWorkbasket("x123456", "DOMAIN_A");
|
Workbasket duplicateWorkbasketWithSmallX = workbasketService.newWorkbasket("x123456", "DOMAIN_A");
|
||||||
duplicateWorkbasketWithSmallX.setName("Personal Workbasket for UID X123456");
|
duplicateWorkbasketWithSmallX.setName("Personal Workbasket for UID X123456");
|
||||||
duplicateWorkbasketWithSmallX.setType(WorkbasketType.PERSONAL);
|
duplicateWorkbasketWithSmallX.setType(WorkbasketType.PERSONAL);
|
||||||
duplicateWorkbasketWithSmallX = workbasketService.createWorkbasket(duplicateWorkbasketWithSmallX);
|
|
||||||
|
Assertions.assertThrows(WorkbasketAlreadyExistException.class, () ->
|
||||||
|
workbasketService.createWorkbasket(duplicateWorkbasketWithSmallX));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = WorkbasketAlreadyExistException.class)
|
@Test
|
||||||
public void testCreateWorkbasketWithAlreadyExistingKeyAndDomainAndEmptyIdUpdatesOlderWorkbasket()
|
public void testCreateWorkbasketWithAlreadyExistingKeyAndDomainAndEmptyIdUpdatesOlderWorkbasket()
|
||||||
throws DomainNotFoundException, InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException {
|
throws DomainNotFoundException, InvalidWorkbasketException,
|
||||||
|
NotAuthorizedException, WorkbasketAlreadyExistException {
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
// First create a new Workbasket.
|
// First create a new Workbasket.
|
||||||
Workbasket wb = workbasketService.newWorkbasket("newKey", "DOMAIN_A");
|
Workbasket wb = workbasketService.newWorkbasket("newKey", "DOMAIN_A");
|
||||||
|
@ -205,11 +205,9 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
|
||||||
Workbasket sameKeyAndDomain = workbasketService.newWorkbasket("newKey", "DOMAIN_A");
|
Workbasket sameKeyAndDomain = workbasketService.newWorkbasket("newKey", "DOMAIN_A");
|
||||||
sameKeyAndDomain.setType(WorkbasketType.TOPIC);
|
sameKeyAndDomain.setType(WorkbasketType.TOPIC);
|
||||||
sameKeyAndDomain.setName("new name");
|
sameKeyAndDomain.setName("new name");
|
||||||
sameKeyAndDomain = workbasketService.createWorkbasket(sameKeyAndDomain);
|
|
||||||
|
|
||||||
assertEquals(wb.getId(), sameKeyAndDomain.getId());
|
Assertions.assertThrows(WorkbasketAlreadyExistException.class, () ->
|
||||||
assertEquals(WorkbasketType.TOPIC, sameKeyAndDomain.getType());
|
workbasketService.createWorkbasket(sameKeyAndDomain));
|
||||||
assertEquals("new name", sameKeyAndDomain.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -9,9 +9,10 @@ import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
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 acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.TaskService;
|
import pro.taskana.TaskService;
|
||||||
|
@ -28,32 +29,28 @@ import pro.taskana.exceptions.TaskNotFoundException;
|
||||||
import pro.taskana.exceptions.WorkbasketInUseException;
|
import pro.taskana.exceptions.WorkbasketInUseException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.impl.TaskImpl;
|
import pro.taskana.impl.TaskImpl;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test which does test the deletion of a workbasket and all wanted failures.
|
* Acceptance test which does test the deletion of a workbasket and all wanted failures.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class DeleteWorkbasketAccTest extends AbstractAccTest {
|
class DeleteWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private WorkbasketService workbasketService;
|
private WorkbasketService workbasketService;
|
||||||
|
|
||||||
private TaskService taskService;
|
private TaskService taskService;
|
||||||
|
|
||||||
public DeleteWorkbasketAccTest() {
|
@BeforeEach
|
||||||
super();
|
void setUpMethod() {
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUpMethod() {
|
|
||||||
workbasketService = taskanaEngine.getWorkbasketService();
|
workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
taskService = taskanaEngine.getTaskService();
|
taskService = taskanaEngine.getTaskService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(userName = "admin", groupNames = {"businessadmin"})
|
@WithAccessId(userName = "admin", groupNames = {"businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteWorkbasket()
|
void testDeleteWorkbasket()
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException {
|
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException {
|
||||||
Workbasket wb = workbasketService.getWorkbasket("USER_2_2", "DOMAIN_A");
|
Workbasket wb = workbasketService.getWorkbasket("USER_2_2", "DOMAIN_A");
|
||||||
|
|
||||||
|
@ -67,19 +64,27 @@ public class DeleteWorkbasketAccTest extends AbstractAccTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(userName = "elena")
|
@WithAccessId(userName = "elena")
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testDeleteWorkbasketNotAuthorized()
|
void testDeleteWorkbasketNotAuthorized() {
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException, InvalidArgumentException {
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () -> {
|
||||||
Workbasket wb = workbasketService.getWorkbasket("TEAMLEAD_2", "DOMAIN_A");
|
Workbasket wb = workbasketService.getWorkbasket("TEAMLEAD_2", "DOMAIN_A");
|
||||||
workbasketService.deleteWorkbasket(wb.getId());
|
workbasketService.deleteWorkbasket(wb.getId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@WithAccessId(userName = "elena")
|
||||||
|
@Test
|
||||||
|
void testGetWorkbasketNotAuthorized() {
|
||||||
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
workbasketService.getWorkbasket("TEAMLEAD_2", "DOMAIN_A"));
|
||||||
|
|
||||||
workbasketService.getWorkbasket("TEAMLEAD_2", "DOMAIN_A");
|
|
||||||
fail("NotAuthorizedException was expected.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(userName = "user_1_1", groupNames = {"teamlead_1", "group_1", "businessadmin"})
|
@WithAccessId(userName = "user_1_1", groupNames = {"teamlead_1", "group_1", "businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteWorkbasketAlsoAsDistributionTarget()
|
void testDeleteWorkbasketAlsoAsDistributionTarget()
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException {
|
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException {
|
||||||
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")
|
||||||
|
@ -104,7 +109,7 @@ public class DeleteWorkbasketAccTest extends AbstractAccTest {
|
||||||
userName = "dummy",
|
userName = "dummy",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteWorkbasketWithNullOrEmptyParam()
|
void testDeleteWorkbasketWithNullOrEmptyParam()
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException {
|
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException {
|
||||||
// Test Null-Value
|
// Test Null-Value
|
||||||
try {
|
try {
|
||||||
|
@ -126,40 +131,41 @@ public class DeleteWorkbasketAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "dummy",
|
userName = "dummy",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = WorkbasketNotFoundException.class)
|
@Test
|
||||||
public void testDeleteWorkbasketButNotExisting()
|
void testDeleteWorkbasketButNotExisting() {
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException, InvalidArgumentException {
|
Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
|
||||||
workbasketService.deleteWorkbasket("SOME NOT EXISTING ID");
|
workbasketService.deleteWorkbasket("SOME NOT EXISTING ID"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(userName = "user_1_2",
|
@WithAccessId(userName = "user_1_2",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = WorkbasketInUseException.class)
|
@Test
|
||||||
public void testDeleteWorkbasketWhichIsUsed()
|
void testDeleteWorkbasketWhichIsUsed()
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException, InvalidArgumentException {
|
throws WorkbasketNotFoundException, NotAuthorizedException, WorkbasketInUseException, InvalidArgumentException {
|
||||||
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
|
||||||
workbasketService.deleteWorkbasket(wb.getId());
|
Assertions.assertThrows(WorkbasketInUseException.class, () ->
|
||||||
|
workbasketService.deleteWorkbasket(wb.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_2",
|
userName = "user_1_2",
|
||||||
groupNames = {"businessadmin"})
|
groupNames = {"businessadmin"})
|
||||||
@Test(expected = NotAuthorizedToQueryWorkbasketException.class)
|
@Test
|
||||||
public void testCreateAndDeleteWorkbasket() throws Exception {
|
void testCreateAndDeleteWorkbasket() throws Exception {
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
Workbasket workbasket = workbasketService.newWorkbasket("NT1234", "DOMAIN_A");
|
Workbasket workbasket = workbasketService.newWorkbasket("NT1234", "DOMAIN_A");
|
||||||
workbasket.setName("TheUltimate");
|
workbasket.setName("TheUltimate");
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setOrgLevel1("company");
|
workbasket.setOrgLevel1("company");
|
||||||
workbasket = workbasketService.createWorkbasket(workbasket);
|
Workbasket workbasket2 = workbasketService.createWorkbasket(workbasket);
|
||||||
|
Assertions.assertThrows(NotAuthorizedToQueryWorkbasketException.class, () ->
|
||||||
workbasketService.deleteWorkbasket(workbasket.getId());
|
workbasketService.deleteWorkbasket(workbasket2.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(userName = "teamlead_2", groupNames = {"businessadmin"})
|
@WithAccessId(userName = "teamlead_2", groupNames = {"businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testCascadingDeleteOfAccessItems()
|
void testCascadingDeleteOfAccessItems()
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException {
|
throws WorkbasketNotFoundException, NotAuthorizedException, InvalidArgumentException {
|
||||||
Workbasket wb = workbasketService.getWorkbasket("WBI:100000000000000000000000000000000008");
|
Workbasket wb = workbasketService.getWorkbasket("WBI:100000000000000000000000000000000008");
|
||||||
String wbId = wb.getId();
|
String wbId = wb.getId();
|
||||||
|
@ -190,7 +196,7 @@ public class DeleteWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
@WithAccessId(userName = "admin", groupNames = {"businessadmin"})
|
@WithAccessId(userName = "admin", groupNames = {"businessadmin"})
|
||||||
@Test
|
@Test
|
||||||
public void testMarkWorkbasketForDeletion()
|
void testMarkWorkbasketForDeletion()
|
||||||
throws WorkbasketInUseException, NotAuthorizedException, WorkbasketNotFoundException, InvalidArgumentException,
|
throws WorkbasketInUseException, NotAuthorizedException, WorkbasketNotFoundException, InvalidArgumentException,
|
||||||
InvalidOwnerException, InvalidStateException, TaskNotFoundException {
|
InvalidOwnerException, InvalidStateException, TaskNotFoundException {
|
||||||
Workbasket wb = workbasketService.getWorkbasket("WBI:100000000000000000000000000000000006");
|
Workbasket wb = workbasketService.getWorkbasket("WBI:100000000000000000000000000000000006");
|
||||||
|
|
|
@ -2,7 +2,6 @@ package acceptance.workbasket;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
@ -11,8 +10,9 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Workbasket;
|
import pro.taskana.Workbasket;
|
||||||
|
@ -20,13 +20,13 @@ import pro.taskana.WorkbasketService;
|
||||||
import pro.taskana.WorkbasketSummary;
|
import pro.taskana.WorkbasketSummary;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "get workbasket" scenarios.
|
* Acceptance test for all "get workbasket" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class DistributionTargetsAccTest extends AbstractAccTest {
|
public class DistributionTargetsAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public DistributionTargetsAccTest() {
|
public DistributionTargetsAccTest() {
|
||||||
|
@ -224,7 +224,7 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_2_2",
|
userName = "user_2_2",
|
||||||
groupNames = {"group_1", "group_2"})
|
groupNames = {"group_1", "group_2"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testAddDistributionTargetsFailsNotAuthorized()
|
public void testAddDistributionTargetsFailsNotAuthorized()
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
@ -235,8 +235,10 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
// add a new distribution target
|
// add a new distribution target
|
||||||
Workbasket newTarget = workbasketService.getWorkbasket("GPK_B_KSC_2", "DOMAIN_B");
|
Workbasket newTarget = workbasketService.getWorkbasket("GPK_B_KSC_2", "DOMAIN_B");
|
||||||
workbasketService.addDistributionTarget(workbasket.getId(), newTarget.getId());
|
|
||||||
fail("NotAuthorizedException should have been thrown");
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
workbasketService.addDistributionTarget(workbasket.getId(), newTarget.getId()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
@ -315,29 +317,25 @@ public class DistributionTargetsAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "henry",
|
userName = "henry",
|
||||||
groupNames = {"undefinedgroup"})
|
groupNames = {"undefinedgroup"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testQueryDistributionSourcesThrowsNotAuthorized()
|
public void testQueryDistributionSourcesThrowsNotAuthorized() {
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
List<WorkbasketSummary> distributionSources = workbasketService
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
.getDistributionSources("WBI:100000000000000000000000000000000004");
|
workbasketService
|
||||||
|
.getDistributionSources("WBI:100000000000000000000000000000000004"));
|
||||||
|
|
||||||
assertEquals(2, distributionSources.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_2_2",
|
userName = "user_2_2",
|
||||||
groupNames = {"group_1", "group_2"})
|
groupNames = {"group_1", "group_2"})
|
||||||
@Test(expected = WorkbasketNotFoundException.class)
|
@Test
|
||||||
public void testQueryDistributionSourcesThrowsWorkbasketNotFound()
|
public void testQueryDistributionSourcesThrowsWorkbasketNotFound() {
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
List<WorkbasketSummary> distributionSources = workbasketService
|
Assertions.assertThrows(WorkbasketNotFoundException.class, () -> workbasketService
|
||||||
.getDistributionSources("WBI:10dasgibtsdochnicht00000000000000004");
|
.getDistributionSources("WBI:10dasgibtsdochnicht00000000000000004"));
|
||||||
|
|
||||||
assertEquals(2, distributionSources.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,9 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Workbasket;
|
import pro.taskana.Workbasket;
|
||||||
|
@ -16,13 +17,13 @@ import pro.taskana.WorkbasketSummary;
|
||||||
import pro.taskana.WorkbasketType;
|
import pro.taskana.WorkbasketType;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "get workbasket" scenarios.
|
* Acceptance test for all "get workbasket" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class GetWorkbasketAccTest extends AbstractAccTest {
|
public class GetWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public GetWorkbasketAccTest() {
|
public GetWorkbasketAccTest() {
|
||||||
|
@ -136,42 +137,43 @@ public class GetWorkbasketAccTest extends AbstractAccTest {
|
||||||
assertEquals(false, workbasketSummary.isMarkedForDeletion());
|
assertEquals(false, workbasketSummary.isMarkedForDeletion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = WorkbasketNotFoundException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfIdIsInvalid()
|
public void testThrowsExceptionIfIdIsInvalid() {
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
workbasketService.getWorkbasket("INVALID_ID");
|
Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
|
||||||
|
workbasketService.getWorkbasket("INVALID_ID"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = WorkbasketNotFoundException.class)
|
@Test
|
||||||
public void testThrowsExceptionIfKeyOrDomainIsInvalid()
|
public void testThrowsExceptionIfKeyOrDomainIsInvalid() {
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
workbasketService.getWorkbasket("INVALID_KEY", "INVALID_DOMAIN");
|
|
||||||
|
Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
|
||||||
|
workbasketService.getWorkbasket("INVALID_KEY", "INVALID_DOMAIN"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testGetByIdNotAuthorized()
|
public void testGetByIdNotAuthorized() {
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
workbasketService.getWorkbasket("WBI:100000000000000000000000000000000001");
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
workbasketService.getWorkbasket("WBI:100000000000000000000000000000000001"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testGetByKeyDomainNotAuthorized()
|
public void testGetByKeyDomainNotAuthorized() {
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A");
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
workbasketService.getWorkbasket("GPK_KSC", "DOMAIN_A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = WorkbasketNotFoundException.class)
|
@Test
|
||||||
public void testGetWorkbasketByIdNotExisting()
|
public void testGetWorkbasketByIdNotExisting() {
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
workbasketService.getWorkbasket("NOT EXISTING ID");
|
Assertions.assertThrows(WorkbasketNotFoundException.class, () ->
|
||||||
|
workbasketService.getWorkbasket("NOT EXISTING ID"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,14 @@ package acceptance.workbasket;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import static pro.taskana.WorkbasketQueryColumnName.NAME;
|
import static pro.taskana.WorkbasketQueryColumnName.NAME;
|
||||||
|
|
||||||
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.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
|
@ -22,13 +21,13 @@ import pro.taskana.WorkbasketSummary;
|
||||||
import pro.taskana.WorkbasketType;
|
import pro.taskana.WorkbasketType;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query workbasket by permission" scenarios.
|
* Acceptance test for all "query workbasket by permission" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryWorkbasketAccTest extends AbstractAccTest {
|
public class QueryWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private static SortDirection asc = SortDirection.ASCENDING;
|
private static SortDirection asc = SortDirection.ASCENDING;
|
||||||
|
|
|
@ -3,18 +3,17 @@ package acceptance.workbasket;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
import static pro.taskana.AccessItemQueryColumnName.WORKBASKET_ID;
|
|
||||||
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_KEY;
|
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.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
|
@ -22,13 +21,13 @@ import pro.taskana.WorkbasketAccessItem;
|
||||||
import pro.taskana.WorkbasketAccessItemQuery;
|
import pro.taskana.WorkbasketAccessItemQuery;
|
||||||
import pro.taskana.WorkbasketService;
|
import pro.taskana.WorkbasketService;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
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.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
|
public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public QueryWorkbasketAccessItemsAccTest() {
|
public QueryWorkbasketAccessItemsAccTest() {
|
||||||
|
@ -75,14 +74,15 @@ public class QueryWorkbasketAccessItemsAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "dummy")
|
userName = "dummy")
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testQueryAccessItemsForAccessIdsNotAuthorized()
|
public void testQueryAccessItemsForAccessIdsNotAuthorized()
|
||||||
throws NotAuthorizedException {
|
throws NotAuthorizedException {
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
workbasketService.createWorkbasketAccessItemQuery()
|
workbasketService.createWorkbasketAccessItemQuery()
|
||||||
.accessIdIn("user_1_1", "group_1")
|
.accessIdIn("user_1_1", "group_1")
|
||||||
.list();
|
.list());
|
||||||
fail("NotAuthorizedException was expected.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package acceptance.workbasket;
|
package acceptance.workbasket;
|
||||||
|
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
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.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
|
@ -18,13 +17,13 @@ import pro.taskana.WorkbasketSummary;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.SystemException;
|
import pro.taskana.exceptions.SystemException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query workbasket by permission" scenarios.
|
* Acceptance test for all "query workbasket by permission" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
|
public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private static SortDirection asc = SortDirection.ASCENDING;
|
private static SortDirection asc = SortDirection.ASCENDING;
|
||||||
|
@ -50,14 +49,14 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "dummy")
|
userName = "dummy")
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testQueryAllTransferTargetsForUserNotAuthorized()
|
public void testQueryAllTransferTargetsForUserNotAuthorized() {
|
||||||
throws NotAuthorizedException, InvalidArgumentException {
|
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
workbasketService.createWorkbasketQuery()
|
workbasketService.createWorkbasketQuery()
|
||||||
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1")
|
.accessIdsHavePermission(WorkbasketPermission.APPEND, "user_1_1")
|
||||||
.list();
|
.list());
|
||||||
fail("NotAuthorizedException was expected");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -5,21 +5,22 @@ import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Ignore;
|
import org.junit.jupiter.api.Assertions;
|
||||||
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 acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.WorkbasketService;
|
import pro.taskana.WorkbasketService;
|
||||||
import pro.taskana.WorkbasketSummary;
|
import pro.taskana.WorkbasketSummary;
|
||||||
import pro.taskana.exceptions.TaskanaRuntimeException;
|
import pro.taskana.exceptions.TaskanaRuntimeException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query classifications with pagination" scenarios.
|
* Acceptance test for all "query classifications with pagination" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
|
public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public QueryWorkbasketsWithPaginationAccTest() {
|
public QueryWorkbasketsWithPaginationAccTest() {
|
||||||
|
@ -152,17 +153,19 @@ public class QueryWorkbasketsWithPaginationAccTest extends AbstractAccTest {
|
||||||
* Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
|
* Testcase only for DB2 users, because H2 doesn´t throw a Exception when the offset is set to high.<br>
|
||||||
* Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
|
* Using DB2 should throw a unchecked RuntimeException for a offset which is out of bounds.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
@Disabled
|
||||||
@Test(expected = TaskanaRuntimeException.class)
|
@Test
|
||||||
public void testPaginationThrowingExceptionWhenPageOutOfBounds() {
|
public void testPaginationThrowingExceptionWhenPageOutOfBounds() {
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
// entrypoint set outside result amount
|
// entrypoint set outside result amount
|
||||||
int pageNumber = 6;
|
int pageNumber = 6;
|
||||||
int pageSize = 10;
|
int pageSize = 10;
|
||||||
|
|
||||||
|
Assertions.assertThrows(TaskanaRuntimeException.class, () ->
|
||||||
workbasketService.createWorkbasketQuery()
|
workbasketService.createWorkbasketQuery()
|
||||||
.domainIn("DOMAIN_A")
|
.domainIn("DOMAIN_A")
|
||||||
.listPage(pageNumber, pageSize);
|
.listPage(pageNumber, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
|
|
|
@ -3,8 +3,9 @@ package acceptance.workbasket;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Workbasket;
|
import pro.taskana.Workbasket;
|
||||||
|
@ -12,13 +13,13 @@ import pro.taskana.WorkbasketService;
|
||||||
import pro.taskana.WorkbasketType;
|
import pro.taskana.WorkbasketType;
|
||||||
import pro.taskana.exceptions.NotAuthorizedException;
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "update workbasket" scenarios.
|
* Acceptance test for all "update workbasket" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class UpdateWorkbasketAccTest extends AbstractAccTest {
|
public class UpdateWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public UpdateWorkbasketAccTest() {
|
public UpdateWorkbasketAccTest() {
|
||||||
|
@ -60,14 +61,16 @@ public class UpdateWorkbasketAccTest extends AbstractAccTest {
|
||||||
@WithAccessId(
|
@WithAccessId(
|
||||||
userName = "user_1_1",
|
userName = "user_1_1",
|
||||||
groupNames = {"group_1"})
|
groupNames = {"group_1"})
|
||||||
@Test(expected = NotAuthorizedException.class)
|
@Test
|
||||||
public void testCheckAuthorizationToUpdateWorkbasket()
|
public void testCheckAuthorizationToUpdateWorkbasket()
|
||||||
throws NotAuthorizedException, WorkbasketNotFoundException {
|
throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");
|
Workbasket workbasket = workbasketService.getWorkbasket("USER_1_1", "DOMAIN_A");
|
||||||
|
|
||||||
workbasket.setName("new name");
|
workbasket.setName("new name");
|
||||||
workbasketService.updateWorkbasket(workbasket);
|
|
||||||
|
Assertions.assertThrows(NotAuthorizedException.class, () ->
|
||||||
|
workbasketService.updateWorkbasket(workbasket));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import static org.junit.Assert.fail;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.KeyDomain;
|
import pro.taskana.KeyDomain;
|
||||||
|
@ -30,13 +30,13 @@ import pro.taskana.exceptions.TaskAlreadyExistException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.impl.WorkbasketAccessItemImpl;
|
import pro.taskana.impl.WorkbasketAccessItemImpl;
|
||||||
import pro.taskana.security.CurrentUserContext;
|
import pro.taskana.security.CurrentUserContext;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
import pro.taskana.security.WithAccessId;
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "update workbasket" scenarios.
|
* Acceptance test for all "update workbasket" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
public class UpdateWorkbasketAuthorizationsAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
public UpdateWorkbasketAuthorizationsAccTest() {
|
public UpdateWorkbasketAuthorizationsAccTest() {
|
||||||
|
|
|
@ -5,20 +5,20 @@ import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Ignore;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.BaseQuery.SortDirection;
|
import pro.taskana.BaseQuery.SortDirection;
|
||||||
import pro.taskana.WorkbasketService;
|
import pro.taskana.WorkbasketService;
|
||||||
import pro.taskana.WorkbasketSummary;
|
import pro.taskana.WorkbasketSummary;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "query classifications with pagination" scenarios.
|
* Acceptance test for all "query classifications with pagination" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@ExtendWith(JAASExtension.class)
|
||||||
public class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest {
|
public class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
private static SortDirection asc = SortDirection.ASCENDING;
|
private static SortDirection asc = SortDirection.ASCENDING;
|
||||||
|
@ -28,7 +28,7 @@ public class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
@Disabled
|
||||||
@Test
|
@Test
|
||||||
public void testGetFirstPageOfTaskQueryWithOffset() {
|
public void testGetFirstPageOfTaskQueryWithOffset() {
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
@ -49,7 +49,7 @@ public class WorkbasketQueryWithOrderedPaginationAccTest extends AbstractAccTest
|
||||||
assertThat(results.get(4).getKey(), equalTo("TEAMLEAD_2"));
|
assertThat(results.get(4).getKey(), equalTo("TEAMLEAD_2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
@Disabled
|
||||||
@Test
|
@Test
|
||||||
public void testGetSecondPageOfTaskQueryWithOffset() {
|
public void testGetSecondPageOfTaskQueryWithOffset() {
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package pro.taskana.security;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.security.Principal;
|
||||||
|
import java.security.PrivilegedExceptionAction;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.security.auth.Subject;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||||
|
import org.junit.jupiter.api.extension.InvocationInterceptor;
|
||||||
|
import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runner for integration tests that enables JAAS subject.
|
||||||
|
*/
|
||||||
|
public class JAASExtension implements InvocationInterceptor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void interceptTestMethod(Invocation<Void> invocation,
|
||||||
|
ReflectiveInvocationContext<Method> invocationContext,
|
||||||
|
ExtensionContext extensionContext) throws Throwable {
|
||||||
|
|
||||||
|
//check for access
|
||||||
|
Subject subject = new Subject();
|
||||||
|
List<Principal> principalList = new ArrayList<>();
|
||||||
|
|
||||||
|
WithAccessId withAccessId = invocationContext.getExecutable().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);
|
||||||
|
Subject.doAs(subject, (PrivilegedExceptionAction<Object>) () -> {
|
||||||
|
|
||||||
|
try {
|
||||||
|
invocation.proceed();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
throw new Exception(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -36,9 +36,21 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>${version.junit}</version>
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -18,9 +18,9 @@ import java.util.Optional;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
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.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Captor;
|
import org.mockito.Captor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
|
@ -32,7 +32,7 @@ import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
|
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
import ch.qos.logback.classic.spi.LoggingEvent;
|
import ch.qos.logback.classic.spi.LoggingEvent;
|
||||||
|
@ -54,12 +54,12 @@ import pro.taskana.transaction.TaskanaTransactionProvider;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@SpringBootTest(classes = TaskanaConfigTestApplication.class,
|
@SpringBootTest(classes = TaskanaConfigTestApplication.class,
|
||||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
@ActiveProfiles({"inmemorydb", "dev"})
|
@ActiveProfiles({"inmemorydb", "dev"})
|
||||||
@Import({TransactionalJobsConfiguration.class})
|
@Import({TransactionalJobsConfiguration.class})
|
||||||
public class TaskanaTransactionIntTest {
|
class TaskanaTransactionIntTest {
|
||||||
|
|
||||||
private static final int POOL_TIME_TO_WAIT = 50;
|
private static final int POOL_TIME_TO_WAIT = 50;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -88,8 +88,8 @@ public class TaskanaTransactionIntTest {
|
||||||
return objRef;
|
return objRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
void before() {
|
||||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
jdbcTemplate.execute("DELETE FROM TASK");
|
jdbcTemplate.execute("DELETE FROM TASK");
|
||||||
jdbcTemplate.execute("DELETE FROM WORKBASKET");
|
jdbcTemplate.execute("DELETE FROM WORKBASKET");
|
||||||
|
@ -97,13 +97,13 @@ public class TaskanaTransactionIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTaskanaSchema() {
|
void testTaskanaSchema() {
|
||||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/schema", String.class);
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/schema", String.class);
|
||||||
assertThat(responseEntity.getBody(), is("TASKANA"));
|
assertThat(responseEntity.getBody(), is("TASKANA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransaction() {
|
void testTransaction() {
|
||||||
assertBefore(0, 0);
|
assertBefore(0, 0);
|
||||||
|
|
||||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/transaction", String.class);
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/transaction", String.class);
|
||||||
|
@ -114,7 +114,7 @@ public class TaskanaTransactionIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionRollback() {
|
void testTransactionRollback() {
|
||||||
assertBefore(0, 0);
|
assertBefore(0, 0);
|
||||||
|
|
||||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/transaction?rollback={rollback}",
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/transaction?rollback={rollback}",
|
||||||
|
@ -126,7 +126,7 @@ public class TaskanaTransactionIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCombined() {
|
void testTransactionCombined() {
|
||||||
assertBefore(0, 0);
|
assertBefore(0, 0);
|
||||||
|
|
||||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/transaction-many", String.class);
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/transaction-many", String.class);
|
||||||
|
@ -137,7 +137,7 @@ public class TaskanaTransactionIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCombinedRollback() {
|
void testTransactionCombinedRollback() {
|
||||||
assertBefore(0, 0);
|
assertBefore(0, 0);
|
||||||
|
|
||||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/transaction-many?rollback={rollback}",
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/transaction-many?rollback={rollback}",
|
||||||
|
@ -149,7 +149,7 @@ public class TaskanaTransactionIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCustomdb() {
|
void testTransactionCustomdb() {
|
||||||
assertBefore(0, 0);
|
assertBefore(0, 0);
|
||||||
|
|
||||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/customdb", String.class);
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/customdb", String.class);
|
||||||
|
@ -162,7 +162,7 @@ public class TaskanaTransactionIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCustomdbRollback() {
|
void testTransactionCustomdbRollback() {
|
||||||
assertBefore(0, 0);
|
assertBefore(0, 0);
|
||||||
|
|
||||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/customdb?rollback={rollback}",
|
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/customdb?rollback={rollback}",
|
||||||
|
@ -175,7 +175,7 @@ public class TaskanaTransactionIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCustomDbWithSchemaSetToTaskana()
|
void testTransactionCustomDbWithSchemaSetToTaskana()
|
||||||
throws SQLException, NotAuthorizedException, WorkbasketNotFoundException, DomainNotFoundException,
|
throws SQLException, NotAuthorizedException, WorkbasketNotFoundException, DomainNotFoundException,
|
||||||
InvalidWorkbasketException, WorkbasketAlreadyExistException {
|
InvalidWorkbasketException, WorkbasketAlreadyExistException {
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ public class TaskanaTransactionIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWorkbasketCleanupJobTransaction() {
|
void testWorkbasketCleanupJobTransaction() {
|
||||||
try {
|
try {
|
||||||
ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory
|
ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory
|
||||||
.getLogger(WorkbasketCleanupJob.class);
|
.getLogger(WorkbasketCleanupJob.class);
|
||||||
|
|
|
@ -55,6 +55,24 @@
|
||||||
<version>${version.spring.boot}</version>
|
<version>${version.spring.boot}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
|
|
8
pom.xml
8
pom.xml
|
@ -63,7 +63,7 @@
|
||||||
<version.arquillian>1.1.10.Final</version.arquillian>
|
<version.arquillian>1.1.10.Final</version.arquillian>
|
||||||
|
|
||||||
<!-- test dependencies -->
|
<!-- test dependencies -->
|
||||||
<version.junit>4.12</version.junit>
|
<version.junit.jupiter>5.5.2</version.junit.jupiter>
|
||||||
<version.log4j>2.8.1</version.log4j>
|
<version.log4j>2.8.1</version.log4j>
|
||||||
<version.mockito>2.8.47</version.mockito>
|
<version.mockito>2.8.47</version.mockito>
|
||||||
<version.powermock>1.7.1</version.powermock>
|
<version.powermock>1.7.1</version.powermock>
|
||||||
|
@ -266,6 +266,12 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<!-- JUnit 5 requires Surefire version 2.22.0 or higher -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${version.maven.surefire}</version>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
|
|
@ -70,6 +70,24 @@
|
||||||
<artifactId>spring-restdocs-mockmvc</artifactId>
|
<artifactId>spring-restdocs-mockmvc</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package pro.taskana;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Inherited;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
|
|
||||||
|
import pro.taskana.rest.RestConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this annotation to test with a spring context and a standardized configuration.
|
||||||
|
*/
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Inherited
|
||||||
|
@ActiveProfiles({"test"})
|
||||||
|
@ExtendWith(SpringExtension.class)
|
||||||
|
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
public @interface TaskanaSpringBootTest {
|
||||||
|
|
||||||
|
}
|
|
@ -6,8 +6,8 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.subsecti
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
@ -16,14 +16,14 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
/**
|
/**
|
||||||
* Generate Rest Docu for AbstractPagingController.
|
* Generate Rest Docu for AbstractPagingController.
|
||||||
*/
|
*/
|
||||||
public class AbstractPagingControllerRestDocumentation extends BaseRestDocumentation {
|
class AbstractPagingControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
private HashMap<String, String> pagingFieldDescriptionsMap = new HashMap<String, String>();
|
private HashMap<String, String> pagingFieldDescriptionsMap = new HashMap<String, String>();
|
||||||
|
|
||||||
private FieldDescriptor[] pagingFieldDescriptors;
|
private FieldDescriptor[] pagingFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
pagingFieldDescriptionsMap.put("page", "Contains metainfo if there are multiple pages, else it is null");
|
pagingFieldDescriptionsMap.put("page", "Contains metainfo if there are multiple pages, else it is null");
|
||||||
pagingFieldDescriptionsMap.put("page.size", "Number of items per page");
|
pagingFieldDescriptionsMap.put("page.size", "Number of items per page");
|
||||||
|
@ -53,7 +53,7 @@ public class AbstractPagingControllerRestDocumentation extends BaseRestDocumenta
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void commonSummaryResourceFieldsDocTest() throws Exception {
|
void commonSummaryResourceFieldsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications?page=2&page-size=5")
|
.get("http://127.0.0.1:" + port + "/api/v1/classifications?page=2&page-size=5")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
|
|
@ -1,56 +1,44 @@
|
||||||
package pro.taskana.doc.api;
|
package pro.taskana.doc.api;
|
||||||
|
|
||||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
|
||||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
|
|
||||||
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
|
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
|
||||||
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
|
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
|
||||||
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
|
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
|
||||||
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs;
|
||||||
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.restdocs.JUnitRestDocumentation;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
import pro.taskana.rest.RestConfiguration;
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for Rest Documentation tests.
|
* Base class for Rest Documentation tests.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@AutoConfigureMockMvc
|
||||||
|
@AutoConfigureRestDocs
|
||||||
|
@TaskanaSpringBootTest
|
||||||
public abstract class BaseRestDocumentation {
|
public abstract class BaseRestDocumentation {
|
||||||
|
|
||||||
@Rule
|
|
||||||
public JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation();
|
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
protected int port;
|
protected int port;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected WebApplicationContext context;
|
protected WebApplicationContext context;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
protected MockMvc mockMvc;
|
protected MockMvc mockMvc;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUpMockMvc() {
|
public void setUpMockMvc() {
|
||||||
document("{methodName}",
|
document("{methodName}",
|
||||||
preprocessRequest(prettyPrint()),
|
preprocessRequest(prettyPrint()),
|
||||||
preprocessResponse(prettyPrint()));
|
preprocessResponse(prettyPrint()));
|
||||||
|
|
||||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
|
|
||||||
.apply(springSecurity())
|
|
||||||
.apply(documentationConfiguration(this.restDocumentation)
|
|
||||||
.operationPreprocessors()
|
|
||||||
.withResponseDefaults(prettyPrint())
|
|
||||||
.withRequestDefaults(prettyPrint()))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
@ -23,7 +23,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
/**
|
/**
|
||||||
* Generate REST Dokumentation for ClassificationController.
|
* Generate REST Dokumentation for ClassificationController.
|
||||||
*/
|
*/
|
||||||
public class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
class ClassificationControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
private HashMap<String, String> classificationFieldDescriptionsMap = new HashMap<String, String>();
|
private HashMap<String, String> classificationFieldDescriptionsMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ public class ClassificationControllerRestDocumentation extends BaseRestDocumenta
|
||||||
private FieldDescriptor[] classificationSubsetFieldDescriptors;
|
private FieldDescriptor[] classificationSubsetFieldDescriptors;
|
||||||
private FieldDescriptor[] createClassificationFieldDescriptors;
|
private FieldDescriptor[] createClassificationFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
classificationFieldDescriptionsMap.put("classificationId", "Unique Id");
|
classificationFieldDescriptionsMap.put("classificationId", "Unique Id");
|
||||||
classificationFieldDescriptionsMap.put("key",
|
classificationFieldDescriptionsMap.put("key",
|
||||||
|
@ -198,7 +198,7 @@ public class ClassificationControllerRestDocumentation extends BaseRestDocumenta
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllClassificationsDocTest() throws Exception {
|
void getAllClassificationsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications?domain=DOMAIN_B")
|
.get("http://127.0.0.1:" + port + "/api/v1/classifications?domain=DOMAIN_B")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
@ -209,7 +209,7 @@ public class ClassificationControllerRestDocumentation extends BaseRestDocumenta
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSpecificClassificationDocTest() throws Exception {
|
void getSpecificClassificationDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
.get("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
@ -219,7 +219,7 @@ public class ClassificationControllerRestDocumentation extends BaseRestDocumenta
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void classificationSubsetDocTest() throws Exception {
|
void classificationSubsetDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
.get("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
@ -229,7 +229,7 @@ public class ClassificationControllerRestDocumentation extends BaseRestDocumenta
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createAndDeleteClassificationDocTest() throws Exception {
|
void createAndDeleteClassificationDocTest() throws Exception {
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/classifications")
|
.post("http://127.0.0.1:" + port + "/api/v1/classifications")
|
||||||
.contentType("application/hal+json")
|
.contentType("application/hal+json")
|
||||||
|
@ -252,7 +252,7 @@ public class ClassificationControllerRestDocumentation extends BaseRestDocumenta
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateClassificationDocTest() throws Exception {
|
void updateClassificationDocTest() throws Exception {
|
||||||
URL url = new URL(
|
URL url = new URL(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009");
|
"http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
|
|
|
@ -7,8 +7,8 @@ import static org.springframework.restdocs.request.RequestDocumentation.partWith
|
||||||
import static org.springframework.restdocs.request.RequestDocumentation.requestParts;
|
import static org.springframework.restdocs.request.RequestDocumentation.requestParts;
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
@ -17,12 +17,12 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
/**
|
/**
|
||||||
* Test ClassificationDefinitionControlller.
|
* Test ClassificationDefinitionControlller.
|
||||||
*/
|
*/
|
||||||
public class ClassificationDefinitionControllerRestDocumentation extends BaseRestDocumentation {
|
class ClassificationDefinitionControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
private FieldDescriptor[] classificationDefinitionsFieldDescriptors;
|
private FieldDescriptor[] classificationDefinitionsFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
classificationDefinitionsFieldDescriptors = new FieldDescriptor[] {
|
classificationDefinitionsFieldDescriptors = new FieldDescriptor[] {
|
||||||
subsectionWithPath("[]").description("An array of <<ClassificationResource, classifications>>")
|
subsectionWithPath("[]").description("An array of <<ClassificationResource, classifications>>")
|
||||||
|
@ -30,7 +30,7 @@ public class ClassificationDefinitionControllerRestDocumentation extends BaseRes
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void exportAllClassificationDefinitions() throws Exception {
|
void exportAllClassificationDefinitions() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classification-definitions")
|
.get("http://127.0.0.1:" + port + "/api/v1/classification-definitions")
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
|
@ -41,7 +41,7 @@ public class ClassificationDefinitionControllerRestDocumentation extends BaseRes
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void importClassificationDefinitions() throws Exception {
|
void importClassificationDefinitions() throws Exception {
|
||||||
String definitionString = "[{\"key\":\"Key0815\", \"domain\":\"DOMAIN_B\"}]";
|
String definitionString = "[{\"key\":\"Key0815\", \"domain\":\"DOMAIN_B\"}]";
|
||||||
|
|
||||||
this.mockMvc.perform(multipart("http://127.0.0.1:" + port + "/api/v1/classification-definitions")
|
this.mockMvc.perform(multipart("http://127.0.0.1:" + port + "/api/v1/classification-definitions")
|
||||||
|
|
|
@ -5,8 +5,8 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.response
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
@ -16,14 +16,14 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
* Generate common REST Documentation.
|
* Generate common REST Documentation.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CommonRestDocumentation extends BaseRestDocumentation {
|
class CommonRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
private HashMap<String, String> selfLinkFieldDescriptionsMap = new HashMap<String, String>();
|
private HashMap<String, String> selfLinkFieldDescriptionsMap = new HashMap<String, String>();
|
||||||
|
|
||||||
private FieldDescriptor[] selfLinkFieldDescriptors;
|
private FieldDescriptor[] selfLinkFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
selfLinkFieldDescriptionsMap.put("_links", "Links section");
|
selfLinkFieldDescriptionsMap.put("_links", "Links section");
|
||||||
selfLinkFieldDescriptionsMap.put("_links.self", "Link to self");
|
selfLinkFieldDescriptionsMap.put("_links.self", "Link to self");
|
||||||
|
@ -61,7 +61,7 @@ public class CommonRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void commonFieldsDocTest() throws Exception {
|
void commonFieldsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
.get("http://127.0.0.1:" + port + "/api/v1/classifications/CLI:100000000000000000000000000000000009")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
|
|
@ -4,8 +4,8 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWit
|
||||||
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
|
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
|
||||||
import static org.springframework.restdocs.payload.PayloadDocumentation.subsectionWithPath;
|
import static org.springframework.restdocs.payload.PayloadDocumentation.subsectionWithPath;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
@ -15,12 +15,12 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
* Generate REST docu for the monitor controller.
|
* Generate REST docu for the monitor controller.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
private FieldDescriptor[] taskReportFieldDescriptors;
|
private FieldDescriptor[] taskReportFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
taskReportFieldDescriptors = new FieldDescriptor[] {
|
taskReportFieldDescriptors = new FieldDescriptor[] {
|
||||||
fieldWithPath("meta").description("Object holding metainfo on the report"),
|
fieldWithPath("meta").description("Object holding metainfo on the report"),
|
||||||
|
@ -44,7 +44,7 @@ public class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTaskStatusReport() throws Exception {
|
void getTaskStatusReport() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/monitor/tasks-status-report")
|
.get("http://127.0.0.1:" + port + "/api/v1/monitor/tasks-status-report")
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
||||||
|
@ -54,7 +54,7 @@ public class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void tasksWorkbasketReport() throws Exception {
|
void tasksWorkbasketReport() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port
|
.get("http://127.0.0.1:" + port
|
||||||
+ "/api/v1/monitor/tasks-workbasket-report?daysInPast=4&states=READY,CLAIMED,COMPLETED")
|
+ "/api/v1/monitor/tasks-workbasket-report?daysInPast=4&states=READY,CLAIMED,COMPLETED")
|
||||||
|
@ -66,7 +66,7 @@ public class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void tasksClassificationReport() throws Exception {
|
void tasksClassificationReport() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/monitor/tasks-classification-report")
|
.get("http://127.0.0.1:" + port + "/api/v1/monitor/tasks-classification-report")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
@ -77,7 +77,7 @@ public class MonitorControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTimestampReport() throws Exception {
|
void getTimestampReport() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/monitor/timestamp-report")
|
.get("http://127.0.0.1:" + port + "/api/v1/monitor/timestamp-report")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
|
|
@ -12,8 +12,8 @@ import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
@ -23,7 +23,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
/**
|
/**
|
||||||
* Generate REST Documentation for the TaskController.
|
* Generate REST Documentation for the TaskController.
|
||||||
*/
|
*/
|
||||||
public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
private HashMap<String, String> taskFieldDescriptionsMap = new HashMap<String, String>();
|
private HashMap<String, String> taskFieldDescriptionsMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
private FieldDescriptor[] taskSubsetFieldDescriptors;
|
private FieldDescriptor[] taskSubsetFieldDescriptors;
|
||||||
private FieldDescriptor[] createTaskFieldDescriptors;
|
private FieldDescriptor[] createTaskFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
taskFieldDescriptionsMap.put("taskId", "Unique ID");
|
taskFieldDescriptionsMap.put("taskId", "Unique ID");
|
||||||
taskFieldDescriptionsMap.put("externalId",
|
taskFieldDescriptionsMap.put("externalId",
|
||||||
|
@ -288,7 +288,7 @@ public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllTasksDocTest() throws Exception {
|
void getAllTasksDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/tasks?por.type=VNR&por.value=22334455")
|
.get("http://127.0.0.1:" + port + "/api/v1/tasks?por.type=VNR&por.value=22334455")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
@ -299,7 +299,7 @@ public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSpecificTaskDocTest() throws Exception {
|
void getSpecificTaskDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000")
|
.get("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
@ -310,7 +310,7 @@ public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void taskSubSetDocTest() throws Exception {
|
void taskSubSetDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000")
|
.get("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
@ -321,7 +321,7 @@ public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateTaskDocTest() throws Exception {
|
void updateTaskDocTest() throws Exception {
|
||||||
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000");
|
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
|
@ -351,7 +351,7 @@ public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createAndDeleteTaskDocTest() throws Exception {
|
void createAndDeleteTaskDocTest() throws Exception {
|
||||||
|
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
||||||
|
@ -377,7 +377,7 @@ public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void claimTaskDocTest() throws Exception {
|
void claimTaskDocTest() throws Exception {
|
||||||
|
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
||||||
|
@ -410,7 +410,7 @@ public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void completeTaskDocTest() throws Exception {
|
void completeTaskDocTest() throws Exception {
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
||||||
.contentType("application/hal+json")
|
.contentType("application/hal+json")
|
||||||
|
@ -442,7 +442,7 @@ public class TaskControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void transferTaskDocTest() throws Exception {
|
void transferTaskDocTest() throws Exception {
|
||||||
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
MvcResult result = this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
.post("http://127.0.0.1:" + port + "/api/v1/tasks")
|
||||||
.contentType("application/hal+json")
|
.contentType("application/hal+json")
|
||||||
|
|
|
@ -3,8 +3,8 @@ package pro.taskana.doc.api;
|
||||||
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
|
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
|
||||||
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
|
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
@ -14,15 +14,15 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
* Generate REST Docu for the TaskanaEngineController.
|
* Generate REST Docu for the TaskanaEngineController.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
|
class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
private FieldDescriptor[] allDomainsFieldDescriptors;
|
private FieldDescriptor[] allDomainsFieldDescriptors;
|
||||||
private FieldDescriptor[] allClassificationCategoriesFieldDescriptors;
|
private FieldDescriptor[] allClassificationCategoriesFieldDescriptors;
|
||||||
private FieldDescriptor[] allClassificationTypesFieldDescriptors;
|
private FieldDescriptor[] allClassificationTypesFieldDescriptors;
|
||||||
private FieldDescriptor[] currentUserInfoFieldDescriptors;
|
private FieldDescriptor[] currentUserInfoFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
allDomainsFieldDescriptors = new FieldDescriptor[] {
|
allDomainsFieldDescriptors = new FieldDescriptor[] {
|
||||||
fieldWithPath("[]").description("An array with the domain-names as strings")
|
fieldWithPath("[]").description("An array with the domain-names as strings")
|
||||||
|
@ -44,7 +44,7 @@ public class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllDomainsDocTest() throws Exception {
|
void getAllDomainsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/domains")
|
.get("http://127.0.0.1:" + port + "/api/v1/domains")
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
|
@ -55,7 +55,7 @@ public class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllClassificationCategoriesDocTest() throws Exception {
|
void getAllClassificationCategoriesDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classification-categories")
|
.get("http://127.0.0.1:" + port + "/api/v1/classification-categories")
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
|
@ -66,7 +66,7 @@ public class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllClassificationTypesDocTest() throws Exception {
|
void getAllClassificationTypesDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/classification-types")
|
.get("http://127.0.0.1:" + port + "/api/v1/classification-types")
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
|
@ -77,7 +77,7 @@ public class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getCurrentUserInfo() throws Exception {
|
void getCurrentUserInfo() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/current-user-info")
|
.get("http://127.0.0.1:" + port + "/api/v1/current-user-info")
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
|
@ -88,7 +88,7 @@ public class TaskanaEngineControllerRestDocumentation extends BaseRestDocumentat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getHistoryProviderIsEnabled() throws Exception {
|
void getHistoryProviderIsEnabled() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/history-provider-enabled")
|
.get("http://127.0.0.1:" + port + "/api/v1/history-provider-enabled")
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
|
|
|
@ -5,26 +5,24 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.response
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runners.MethodSorters;
|
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
import org.springframework.test.annotation.DirtiesContext;
|
||||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate REST Docu for the WorkbasketAccessItemController.
|
* Generate REST Docu for the WorkbasketAccessItemController.
|
||||||
*/
|
*/
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
public class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDocumentation {
|
|
||||||
|
|
||||||
private HashMap<String, String> accessItemFieldDescriptionsMap = new HashMap<String, String>();
|
private HashMap<String, String> accessItemFieldDescriptionsMap = new HashMap<String, String>();
|
||||||
private FieldDescriptor[] accessItemFieldDescriptors;
|
private FieldDescriptor[] accessItemFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
accessItemFieldDescriptionsMap.put("accessItems.accessItemId", "Unique ID");
|
accessItemFieldDescriptionsMap.put("accessItems.accessItemId", "Unique ID");
|
||||||
accessItemFieldDescriptionsMap.put("accessItems.workbasketId", "The workbasket id");
|
accessItemFieldDescriptionsMap.put("accessItems.workbasketId", "The workbasket id");
|
||||||
|
@ -108,7 +106,7 @@ public class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDoc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_getWorkbasketAccessItemsDocTest() throws Exception {
|
void getWorkbasketAccessItemsDocTest() throws Exception {
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(RestDocumentationRequestBuilders
|
.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port
|
.get("http://127.0.0.1:" + port
|
||||||
|
@ -121,7 +119,8 @@ public class WorkbasketAccessItemControllerRestDocumentation extends BaseRestDoc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test02_removeWorkbasketAccessItemsDocTest() throws Exception {
|
@DirtiesContext
|
||||||
|
void removeWorkbasketAccessItemsDocTest() throws Exception {
|
||||||
this.mockMvc
|
this.mockMvc
|
||||||
.perform(RestDocumentationRequestBuilders
|
.perform(RestDocumentationRequestBuilders
|
||||||
.delete("http://127.0.0.1:" + port + "/api/v1/workbasket-access-items/?access-id=user_2_2")
|
.delete("http://127.0.0.1:" + port + "/api/v1/workbasket-access-items/?access-id=user_2_2")
|
||||||
|
|
|
@ -12,8 +12,8 @@ import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
@ -22,7 +22,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
/**
|
/**
|
||||||
* Generate REST Documentatioon for the WorkbasketController.
|
* Generate REST Documentatioon for the WorkbasketController.
|
||||||
*/
|
*/
|
||||||
public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
class WorkbasketControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
// HashMaps to store the field descriptions centrally for multiple uses
|
// HashMaps to store the field descriptions centrally for multiple uses
|
||||||
private HashMap<String, String> workbasketFieldDescriptionsMap = new HashMap<String, String>();
|
private HashMap<String, String> workbasketFieldDescriptionsMap = new HashMap<String, String>();
|
||||||
|
@ -36,8 +36,8 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
private FieldDescriptor[] allDistributionTargetsFieldDescriptors;
|
private FieldDescriptor[] allDistributionTargetsFieldDescriptors;
|
||||||
private FieldDescriptor[] createWorkbasketFieldDescriptors;
|
private FieldDescriptor[] createWorkbasketFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
workbasketFieldDescriptionsMap.put("workbasketId", "Unique ID");
|
workbasketFieldDescriptionsMap.put("workbasketId", "Unique ID");
|
||||||
workbasketFieldDescriptionsMap.put("key", "");
|
workbasketFieldDescriptionsMap.put("key", "");
|
||||||
|
@ -272,7 +272,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllWorkbasketsDocTest() throws Exception {
|
void getAllWorkbasketsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(
|
this.mockMvc.perform(
|
||||||
RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port + "/api/v1/workbaskets?type=PERSONAL")
|
RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port + "/api/v1/workbaskets?type=PERSONAL")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
@ -283,7 +283,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSpecificWorkbasketDocTest() throws Exception {
|
void getSpecificWorkbasketDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000001")
|
"http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000001")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
@ -294,7 +294,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllWorkbasketAccessItemsDocTest() throws Exception {
|
void getAllWorkbasketAccessItemsDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port
|
||||||
+ "/api/v1/workbaskets/WBI:100000000000000000000000000000000001/workbasketAccessItems")
|
+ "/api/v1/workbaskets/WBI:100000000000000000000000000000000001/workbasketAccessItems")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
@ -305,7 +305,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void workbasketSubsetDocTest() throws Exception {
|
void workbasketSubsetDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000001")
|
"http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000001")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
@ -316,7 +316,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void removeWorkbasketAsDistributionTargetDocTest() throws Exception {
|
void removeWorkbasketAsDistributionTargetDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.delete("http://127.0.0.1:" + port
|
this.mockMvc.perform(RestDocumentationRequestBuilders.delete("http://127.0.0.1:" + port
|
||||||
+ "/api/v1/workbaskets/distribution-targets/WBI:100000000000000000000000000000000007")
|
+ "/api/v1/workbaskets/distribution-targets/WBI:100000000000000000000000000000000007")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
@ -325,7 +325,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllWorkbasketDistributionTargets() throws Exception {
|
void getAllWorkbasketDistributionTargets() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port
|
||||||
+ "/api/v1/workbaskets/WBI:100000000000000000000000000000000002/distribution-targets")
|
+ "/api/v1/workbaskets/WBI:100000000000000000000000000000000002/distribution-targets")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"))
|
||||||
|
@ -335,7 +335,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createWorkbasketDocTest() throws Exception {
|
void createWorkbasketDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.post("http://127.0.0.1:" + port + "/api/v1/workbaskets")
|
this.mockMvc.perform(RestDocumentationRequestBuilders.post("http://127.0.0.1:" + port + "/api/v1/workbaskets")
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
.header("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x")
|
||||||
|
@ -351,7 +351,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateWorkbasketDocTest() throws Exception {
|
void updateWorkbasketDocTest() throws Exception {
|
||||||
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000002");
|
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/workbaskets/WBI:100000000000000000000000000000000002");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
|
@ -382,7 +382,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void markWorkbasketForDeletionDocTest() throws Exception {
|
void markWorkbasketForDeletionDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.delete(
|
this.mockMvc.perform(RestDocumentationRequestBuilders.delete(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/workbaskets/" + "WBI:100000000000000000000000000000000005")
|
"http://127.0.0.1:" + port + "/api/v1/workbaskets/" + "WBI:100000000000000000000000000000000005")
|
||||||
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
.header("Authorization", "Basic YWRtaW46YWRtaW4="))
|
||||||
|
@ -391,7 +391,7 @@ public class WorkbasketControllerRestDocumentation extends BaseRestDocumentation
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void accessItemDocTest() throws Exception {
|
void accessItemDocTest() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port
|
this.mockMvc.perform(RestDocumentationRequestBuilders.get("http://127.0.0.1:" + port
|
||||||
+ "/api/v1/workbaskets/WBI:100000000000000000000000000000000001/workbasketAccessItems")
|
+ "/api/v1/workbaskets/WBI:100000000000000000000000000000000001/workbasketAccessItems")
|
||||||
.accept("application/hal+json")
|
.accept("application/hal+json")
|
||||||
|
|
|
@ -7,8 +7,8 @@ import static org.springframework.restdocs.request.RequestDocumentation.partWith
|
||||||
import static org.springframework.restdocs.request.RequestDocumentation.requestParts;
|
import static org.springframework.restdocs.request.RequestDocumentation.requestParts;
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
|
||||||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders;
|
||||||
import org.springframework.restdocs.payload.FieldDescriptor;
|
import org.springframework.restdocs.payload.FieldDescriptor;
|
||||||
|
@ -17,12 +17,12 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||||
/**
|
/**
|
||||||
* Generate Rest Documentation for Workbasket Definitions.
|
* Generate Rest Documentation for Workbasket Definitions.
|
||||||
*/
|
*/
|
||||||
public class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentation {
|
class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDocumentation {
|
||||||
|
|
||||||
private FieldDescriptor[] workbasketDefinitionsFieldDescriptors;
|
private FieldDescriptor[] workbasketDefinitionsFieldDescriptors;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void setUp() {
|
void setUp() {
|
||||||
|
|
||||||
workbasketDefinitionsFieldDescriptors = new FieldDescriptor[] {
|
workbasketDefinitionsFieldDescriptors = new FieldDescriptor[] {
|
||||||
subsectionWithPath("[]").description("An array of <<WorkbasketDefinitions, workbasketsDefinitions>>")
|
subsectionWithPath("[]").description("An array of <<WorkbasketDefinitions, workbasketsDefinitions>>")
|
||||||
|
@ -30,7 +30,7 @@ public class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDoc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void exportAllWorkbasketDefinitions() throws Exception {
|
void exportAllWorkbasketDefinitions() throws Exception {
|
||||||
this.mockMvc.perform(RestDocumentationRequestBuilders
|
this.mockMvc.perform(RestDocumentationRequestBuilders
|
||||||
.get("http://127.0.0.1:" + port + "/api/v1/workbasket-definitions")
|
.get("http://127.0.0.1:" + port + "/api/v1/workbasket-definitions")
|
||||||
.accept("application/json")
|
.accept("application/json")
|
||||||
|
@ -41,7 +41,7 @@ public class WorkbasketDefinitionControllerRestDocumentation extends BaseRestDoc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void importWorkbasketDefinition() throws Exception {
|
void importWorkbasketDefinition() throws Exception {
|
||||||
String definitionString = "["
|
String definitionString = "["
|
||||||
+ "{"
|
+ "{"
|
||||||
+ "\"distributionTargets\":[], "
|
+ "\"distributionTargets\":[], "
|
||||||
|
|
|
@ -9,12 +9,9 @@ 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.BeforeEach;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
@ -27,7 +24,6 @@ import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
@ -36,8 +32,8 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
|
||||||
import pro.taskana.Classification;
|
import pro.taskana.Classification;
|
||||||
import pro.taskana.Task;
|
import pro.taskana.Task;
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.rest.RestConfiguration;
|
|
||||||
import pro.taskana.rest.resource.ClassificationResource;
|
import pro.taskana.rest.resource.ClassificationResource;
|
||||||
import pro.taskana.rest.resource.ClassificationResourceAssembler;
|
import pro.taskana.rest.resource.ClassificationResourceAssembler;
|
||||||
import pro.taskana.rest.resource.TaskResource;
|
import pro.taskana.rest.resource.TaskResource;
|
||||||
|
@ -46,10 +42,8 @@ import pro.taskana.rest.resource.TaskResourceAssembler;
|
||||||
/**
|
/**
|
||||||
* Test async updates.
|
* Test async updates.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@TaskanaSpringBootTest
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT,
|
class AsyncUpdateJobIntTest {
|
||||||
properties = {"devMode=true"})
|
|
||||||
public class AsyncUpdateJobIntTest {
|
|
||||||
|
|
||||||
private static final String CLASSIFICATION_ID = "CLI:100000000000000000000000000000000003";
|
private static final String CLASSIFICATION_ID = "CLI:100000000000000000000000000000000003";
|
||||||
|
|
||||||
|
@ -72,14 +66,14 @@ public class AsyncUpdateJobIntTest {
|
||||||
|
|
||||||
private RestTemplate template;
|
private RestTemplate template;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
void before() {
|
||||||
template = getRestTemplate();
|
template = getRestTemplate();
|
||||||
server = "http://127.0.0.1:" + port;
|
server = "http://127.0.0.1:" + port;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateClassificationPrioServiceLevel()
|
void testUpdateClassificationPrioServiceLevel()
|
||||||
throws IOException, InvalidArgumentException {
|
throws IOException, InvalidArgumentException {
|
||||||
|
|
||||||
// 1st step: get old classification :
|
// 1st step: get old classification :
|
||||||
|
|
|
@ -4,33 +4,26 @@ import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.impl.util.LoggerUtils;
|
import pro.taskana.impl.util.LoggerUtils;
|
||||||
import pro.taskana.rest.RestConfiguration;
|
|
||||||
import pro.taskana.rest.resource.AccessIdResource;
|
import pro.taskana.rest.resource.AccessIdResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Ldap attachment.
|
* Test Ldap attachment.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@TaskanaSpringBootTest
|
||||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"devMode=true"})
|
class LdapTest {
|
||||||
@ContextConfiguration(classes = {RestConfiguration.class})
|
|
||||||
public class LdapTest {
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LdapClient ldapClient;
|
private LdapClient ldapClient;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFindUsers() throws InvalidArgumentException {
|
void testFindUsers() throws InvalidArgumentException {
|
||||||
if (ldapClient.useLdap()) {
|
if (ldapClient.useLdap()) {
|
||||||
List<AccessIdResource> usersAndGroups = ldapClient.searchUsersAndGroups("ser0");
|
List<AccessIdResource> usersAndGroups = ldapClient.searchUsersAndGroups("ser0");
|
||||||
System.out.println("#### found " + LoggerUtils.listToString(usersAndGroups));
|
System.out.println("#### found " + LoggerUtils.listToString(usersAndGroups));
|
||||||
|
|
|
@ -9,10 +9,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.hateoas.hal.Jackson2HalModule;
|
import org.springframework.hateoas.hal.Jackson2HalModule;
|
||||||
|
@ -24,29 +21,27 @@ import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||||
import pro.taskana.rest.resource.AccessIdResource;
|
import pro.taskana.rest.resource.AccessIdResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test AccessIdValidation.
|
* Test AccessIdValidation.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@TaskanaSpringBootTest
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
|
class AccessIdValidationControllerIntTest {
|
||||||
"devMode=true"})
|
|
||||||
public class AccessIdValidationControllerIntTest {
|
|
||||||
|
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetMatches() {
|
void testGetMatches() {
|
||||||
AccessIdController.setLdapCache(new LdapCacheTestImpl());
|
AccessIdController.setLdapCache(new LdapCacheTestImpl());
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
@ -55,6 +50,7 @@ public class AccessIdValidationControllerIntTest {
|
||||||
ResponseEntity<List<AccessIdResource>> response = template.exchange(
|
ResponseEntity<List<AccessIdResource>> response = template.exchange(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/access-ids?search-for=ali", HttpMethod.GET, request,
|
"http://127.0.0.1:" + port + "/api/v1/access-ids?search-for=ali", HttpMethod.GET, request,
|
||||||
new ParameterizedTypeReference<List<AccessIdResource>>() {
|
new ParameterizedTypeReference<List<AccessIdResource>>() {
|
||||||
|
|
||||||
});
|
});
|
||||||
List<AccessIdResource> body = response.getBody();
|
List<AccessIdResource> body = response.getBody();
|
||||||
assertNotNull(body);
|
assertNotNull(body);
|
||||||
|
@ -66,7 +62,7 @@ public class AccessIdValidationControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBadRequestWhenSearchForIsTooShort() {
|
void testBadRequestWhenSearchForIsTooShort() {
|
||||||
AccessIdController.setLdapCache(new LdapCacheTestImpl());
|
AccessIdController.setLdapCache(new LdapCacheTestImpl());
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
|
|
@ -3,6 +3,7 @@ package pro.taskana.rest;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -12,12 +13,9 @@ import java.net.URL;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
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.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
@ -32,7 +30,6 @@ import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.annotation.DirtiesContext;
|
import org.springframework.test.annotation.DirtiesContext;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@ -40,6 +37,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import pro.taskana.Task;
|
import pro.taskana.Task;
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.rest.resource.ClassificationSummaryListResource;
|
import pro.taskana.rest.resource.ClassificationSummaryListResource;
|
||||||
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
||||||
|
@ -51,10 +49,8 @@ import pro.taskana.rest.resource.TaskResourceAssembler;
|
||||||
*
|
*
|
||||||
* @author bbr
|
* @author bbr
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@TaskanaSpringBootTest
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT,
|
class ClassificationControllerIntTest {
|
||||||
properties = {"devMode=true"})
|
|
||||||
public class ClassificationControllerIntTest {
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TaskResourceAssembler taskResourceAssembler;
|
private TaskResourceAssembler taskResourceAssembler;
|
||||||
|
@ -69,15 +65,15 @@ public class ClassificationControllerIntTest {
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
void before() {
|
||||||
template = getRestTemplate();
|
template = getRestTemplate();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
request = new HttpEntity<String>(headers);
|
request = new HttpEntity<String>(headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllClassifications() {
|
void testGetAllClassifications() {
|
||||||
ResponseEntity<ClassificationSummaryListResource> response = template.exchange(
|
ResponseEntity<ClassificationSummaryListResource> response = template.exchange(
|
||||||
server + port + "/api/v1/classifications", HttpMethod.GET, request,
|
server + port + "/api/v1/classifications", HttpMethod.GET, request,
|
||||||
ParameterizedTypeReference.forType(ClassificationSummaryListResource.class));
|
ParameterizedTypeReference.forType(ClassificationSummaryListResource.class));
|
||||||
|
@ -85,7 +81,7 @@ public class ClassificationControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllClassificationsFilterByCustomAttribute() {
|
void testGetAllClassificationsFilterByCustomAttribute() {
|
||||||
ResponseEntity<ClassificationSummaryListResource> response = template.exchange(
|
ResponseEntity<ClassificationSummaryListResource> response = template.exchange(
|
||||||
server + port + "/api/v1/classifications?domain=DOMAIN_A&custom-1-like=RVNR", HttpMethod.GET,
|
server + port + "/api/v1/classifications?domain=DOMAIN_A&custom-1-like=RVNR", HttpMethod.GET,
|
||||||
request,
|
request,
|
||||||
|
@ -95,7 +91,7 @@ public class ClassificationControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllClassificationsKeepingFilters() {
|
void testGetAllClassificationsKeepingFilters() {
|
||||||
ResponseEntity<ClassificationSummaryListResource> response = template.exchange(
|
ResponseEntity<ClassificationSummaryListResource> response = template.exchange(
|
||||||
server + port + "/api/v1/classifications?domain=DOMAIN_A&sort-by=key&order=asc", HttpMethod.GET,
|
server + port + "/api/v1/classifications?domain=DOMAIN_A&sort-by=key&order=asc", HttpMethod.GET,
|
||||||
request,
|
request,
|
||||||
|
@ -110,7 +106,7 @@ public class ClassificationControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSecondPageSortedByKey() {
|
void testGetSecondPageSortedByKey() {
|
||||||
ResponseEntity<ClassificationSummaryListResource> response = template.exchange(
|
ResponseEntity<ClassificationSummaryListResource> response = template.exchange(
|
||||||
server + port + "/api/v1/classifications?domain=DOMAIN_A&sort-by=key&order=asc&page=2&page-size=5",
|
server + port + "/api/v1/classifications?domain=DOMAIN_A&sort-by=key&order=asc&page=2&page-size=5",
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
|
@ -131,7 +127,7 @@ public class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public void testCreateClassification() throws IOException {
|
void testCreateClassification() throws IOException {
|
||||||
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\",\"name\":\"new classification\",\"type\":\"TASK\"}";
|
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\",\"name\":\"new classification\",\"type\":\"TASK\"}";
|
||||||
URL url = new URL(server + port + "/api/v1/classifications");
|
URL url = new URL(server + port + "/api/v1/classifications");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
|
@ -163,7 +159,7 @@ public class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public void testCreateClassificationWithParentId() throws IOException {
|
void testCreateClassificationWithParentId() throws IOException {
|
||||||
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P1\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\"}";
|
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P1\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\"}";
|
||||||
URL url = new URL(server + port + "/api/v1/classifications");
|
URL url = new URL(server + port + "/api/v1/classifications");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
|
@ -181,7 +177,7 @@ public class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public void testCreateClassificationWithParentKey() throws IOException {
|
void testCreateClassificationWithParentKey() throws IOException {
|
||||||
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentKey\":\"T2100\"}";
|
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentKey\":\"T2100\"}";
|
||||||
URL url = new URL(server + port + "/api/v1/classifications");
|
URL url = new URL(server + port + "/api/v1/classifications");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
|
@ -199,7 +195,7 @@ public class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public void testCreateClassificationWithParentKeyInDOMAIN_AShouldCreateAClassificationInRootDomain()
|
void testCreateClassificationWithParentKeyInDOMAIN_AShouldCreateAClassificationInRootDomain()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentKey\":\"T2100\"}";
|
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentKey\":\"T2100\"}";
|
||||||
|
|
||||||
|
@ -234,7 +230,7 @@ public class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public void testReturn400IfCreateClassificationWithIncompatibleParentIdAndKey() throws IOException {
|
void testReturn400IfCreateClassificationWithIncompatibleParentIdAndKey() throws IOException {
|
||||||
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P3\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\",\"parentKey\":\"T2000\"}";
|
String newClassification = "{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P3\",\"name\":\"new classification\",\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\",\"parentKey\":\"T2000\"}";
|
||||||
URL url = new URL(server + port + "/api/v1/classifications");
|
URL url = new URL(server + port + "/api/v1/classifications");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
|
@ -252,7 +248,7 @@ public class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public void testCreateClassificationWithClassificationIdReturnsError400() throws IOException {
|
void testCreateClassificationWithClassificationIdReturnsError400() throws IOException {
|
||||||
String newClassification = "{\"classificationId\":\"someId\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\",\"name\":\"new classification\",\"type\":\"TASK\"}";
|
String newClassification = "{\"classificationId\":\"someId\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\",\"name\":\"new classification\",\"type\":\"TASK\"}";
|
||||||
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/classifications");
|
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/classifications");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
|
@ -269,7 +265,7 @@ public class ClassificationControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetClassificationWithSpecialCharacter() {
|
void testGetClassificationWithSpecialCharacter() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -282,9 +278,9 @@ public class ClassificationControllerIntTest {
|
||||||
assertEquals("Zustimmungserklärung", response.getBody().name);
|
assertEquals("Zustimmungserklärung", response.getBody().name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = HttpClientErrorException.class)
|
@Test
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public void testDeleteClassification() {
|
void testDeleteClassification() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -297,11 +293,13 @@ public class ClassificationControllerIntTest {
|
||||||
ParameterizedTypeReference.forType(ClassificationSummaryResource.class));
|
ParameterizedTypeReference.forType(ClassificationSummaryResource.class));
|
||||||
assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
|
assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
|
||||||
|
|
||||||
response = template.exchange(
|
assertThrows(HttpClientErrorException.class, () -> {
|
||||||
|
template.exchange(
|
||||||
"http://127.0.0.1:" + port + "/api/v1/classifications/CLI:200000000000000000000000000000000004",
|
"http://127.0.0.1:" + port + "/api/v1/classifications/CLI:200000000000000000000000000000000004",
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
request,
|
request,
|
||||||
ParameterizedTypeReference.forType(ClassificationSummaryResource.class));
|
ParameterizedTypeReference.forType(ClassificationSummaryResource.class));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyTaskIsModifiedAfter(String taskId, Instant before)
|
private void verifyTaskIsModifiedAfter(String taskId, Instant before)
|
||||||
|
|
|
@ -17,14 +17,11 @@ import java.util.ArrayList;
|
||||||
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.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
@ -38,7 +35,6 @@ import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
@ -47,6 +43,7 @@ import org.springframework.web.client.RestTemplate;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.rest.resource.ClassificationResource;
|
import pro.taskana.rest.resource.ClassificationResource;
|
||||||
import pro.taskana.rest.resource.ClassificationSummaryListResource;
|
import pro.taskana.rest.resource.ClassificationSummaryListResource;
|
||||||
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
import pro.taskana.rest.resource.ClassificationSummaryResource;
|
||||||
|
@ -54,10 +51,9 @@ import pro.taskana.rest.resource.ClassificationSummaryResource;
|
||||||
/**
|
/**
|
||||||
* Test classification definitions.
|
* Test classification definitions.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = {
|
@TaskanaSpringBootTest
|
||||||
"devMode=true"})
|
class ClassificationDefinitionControllerIntTest {
|
||||||
public class ClassificationDefinitionControllerIntTest {
|
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class);
|
||||||
|
|
||||||
|
@ -77,8 +73,8 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
Environment env;
|
Environment env;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
void before() {
|
||||||
LOGGER.debug("before");
|
LOGGER.debug("before");
|
||||||
template = getRestTemplate();
|
template = getRestTemplate();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -86,7 +82,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExportClassifications() {
|
void testExportClassifications() {
|
||||||
ResponseEntity<ClassificationResource[]> response = template.exchange(
|
ResponseEntity<ClassificationResource[]> response = template.exchange(
|
||||||
server + port + "/api/v1/classification-definitions?domain=DOMAIN_B",
|
server + port + "/api/v1/classification-definitions?domain=DOMAIN_B",
|
||||||
HttpMethod.GET, request, ParameterizedTypeReference.forType(ClassificationResource[].class));
|
HttpMethod.GET, request, ParameterizedTypeReference.forType(ClassificationResource[].class));
|
||||||
|
@ -97,7 +93,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExportClassificationsFromWrongDomain() {
|
void testExportClassificationsFromWrongDomain() {
|
||||||
ResponseEntity<ClassificationResource[]> response = template.exchange(
|
ResponseEntity<ClassificationResource[]> response = template.exchange(
|
||||||
server + port + "/api/v1/classification-definitions?domain=ADdfe",
|
server + port + "/api/v1/classification-definitions?domain=ADdfe",
|
||||||
HttpMethod.GET, request, ParameterizedTypeReference.forType(ClassificationResource[].class));
|
HttpMethod.GET, request, ParameterizedTypeReference.forType(ClassificationResource[].class));
|
||||||
|
@ -105,7 +101,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportFilledClassification() throws IOException {
|
void testImportFilledClassification() throws IOException {
|
||||||
ClassificationResource classification = new ClassificationResource();
|
ClassificationResource classification = new ClassificationResource();
|
||||||
classification.setClassificationId("classificationId_");
|
classification.setClassificationId("classificationId_");
|
||||||
classification.setKey("key drelf");
|
classification.setKey("key drelf");
|
||||||
|
@ -139,7 +135,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailureWhenKeyIsMissing() throws IOException {
|
void testFailureWhenKeyIsMissing() throws IOException {
|
||||||
ClassificationResource classification = new ClassificationResource();
|
ClassificationResource classification = new ClassificationResource();
|
||||||
classification.setDomain("DOMAIN_A");
|
classification.setDomain("DOMAIN_A");
|
||||||
List<String> clList = new ArrayList<>();
|
List<String> clList = new ArrayList<>();
|
||||||
|
@ -153,7 +149,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailureWhenDomainIsMissing() throws IOException {
|
void testFailureWhenDomainIsMissing() throws IOException {
|
||||||
ClassificationResource classification = new ClassificationResource();
|
ClassificationResource classification = new ClassificationResource();
|
||||||
classification.setKey("one");
|
classification.setKey("one");
|
||||||
List<String> clList = new ArrayList<>();
|
List<String> clList = new ArrayList<>();
|
||||||
|
@ -167,7 +163,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailureWhenUpdatingTypeOfExistingClassification() throws IOException {
|
void testFailureWhenUpdatingTypeOfExistingClassification() throws IOException {
|
||||||
ClassificationSummaryResource classification = this.getClassificationWithKeyAndDomain("T6310", "");
|
ClassificationSummaryResource classification = this.getClassificationWithKeyAndDomain("T6310", "");
|
||||||
classification.setType("DOCUMENT");
|
classification.setType("DOCUMENT");
|
||||||
List<String> clList = new ArrayList<>();
|
List<String> clList = new ArrayList<>();
|
||||||
|
@ -181,7 +177,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportMultipleClassifications() throws IOException {
|
void testImportMultipleClassifications() throws IOException {
|
||||||
ClassificationResource classification1 = this.createClassification("id1", "ImportKey1", "DOMAIN_A", null, null);
|
ClassificationResource classification1 = this.createClassification("id1", "ImportKey1", "DOMAIN_A", null, null);
|
||||||
String c1 = objMapper.writeValueAsString(classification1);
|
String c1 = objMapper.writeValueAsString(classification1);
|
||||||
|
|
||||||
|
@ -208,7 +204,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportDuplicateClassification() throws IOException {
|
void testImportDuplicateClassification() throws IOException {
|
||||||
ClassificationResource classification1 = new ClassificationResource();
|
ClassificationResource classification1 = new ClassificationResource();
|
||||||
classification1.setClassificationId("id1");
|
classification1.setClassificationId("id1");
|
||||||
classification1.setKey("ImportKey3");
|
classification1.setKey("ImportKey3");
|
||||||
|
@ -227,7 +223,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInsertExistingClassificationWithOlderTimestamp() throws IOException {
|
void testInsertExistingClassificationWithOlderTimestamp() throws IOException {
|
||||||
ClassificationSummaryResource existingClassification = getClassificationWithKeyAndDomain("L110107", "DOMAIN_A");
|
ClassificationSummaryResource existingClassification = getClassificationWithKeyAndDomain("L110107", "DOMAIN_A");
|
||||||
existingClassification.setName("first new Name");
|
existingClassification.setName("first new Name");
|
||||||
List<String> clList = new ArrayList<>();
|
List<String> clList = new ArrayList<>();
|
||||||
|
@ -249,7 +245,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHookExistingChildToNewParent() throws IOException {
|
void testHookExistingChildToNewParent() throws IOException {
|
||||||
ClassificationResource newClassification = createClassification(
|
ClassificationResource newClassification = createClassification(
|
||||||
"new Classification", "newClass", "DOMAIN_A", null, "L11010");
|
"new Classification", "newClass", "DOMAIN_A", null, "L11010");
|
||||||
ClassificationSummaryResource existingClassification = getClassificationWithKeyAndDomain("L110102", "DOMAIN_A");
|
ClassificationSummaryResource existingClassification = getClassificationWithKeyAndDomain("L110102", "DOMAIN_A");
|
||||||
|
@ -275,7 +271,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportParentAndChildClassification() throws IOException {
|
void testImportParentAndChildClassification() throws IOException {
|
||||||
ClassificationResource classification1 = this.createClassification("parentId", "ImportKey6", "DOMAIN_A", null,
|
ClassificationResource classification1 = this.createClassification("parentId", "ImportKey6", "DOMAIN_A", null,
|
||||||
null);
|
null);
|
||||||
String c1 = objMapper.writeValueAsString(classification1);
|
String c1 = objMapper.writeValueAsString(classification1);
|
||||||
|
@ -314,7 +310,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportParentAndChildClassificationWithKey() throws IOException {
|
void testImportParentAndChildClassificationWithKey() throws IOException {
|
||||||
ClassificationResource classification1 = createClassification("parent", "ImportKey11", "DOMAIN_A", null, null);
|
ClassificationResource classification1 = createClassification("parent", "ImportKey11", "DOMAIN_A", null, null);
|
||||||
classification1.setCustom1("parent is correct");
|
classification1.setCustom1("parent is correct");
|
||||||
String parent = objMapper.writeValueAsString(classification1);
|
String parent = objMapper.writeValueAsString(classification1);
|
||||||
|
@ -345,7 +341,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testChangeParentByImportingExistingClassification() throws IOException, InterruptedException {
|
void testChangeParentByImportingExistingClassification() throws IOException, InterruptedException {
|
||||||
ClassificationSummaryResource child1 = this.getClassificationWithKeyAndDomain("L110105", "DOMAIN_A");
|
ClassificationSummaryResource child1 = this.getClassificationWithKeyAndDomain("L110105", "DOMAIN_A");
|
||||||
assertEquals("L11010", child1.getParentKey());
|
assertEquals("L11010", child1.getParentKey());
|
||||||
child1.setParentId("CLI:100000000000000000000000000000000002");
|
child1.setParentId("CLI:100000000000000000000000000000000002");
|
||||||
|
@ -378,7 +374,7 @@ public class ClassificationDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailOnImportDuplicates() throws IOException {
|
void testFailOnImportDuplicates() throws IOException {
|
||||||
ClassificationSummaryResource classification = this.getClassificationWithKeyAndDomain("L110105", "DOMAIN_A");
|
ClassificationSummaryResource classification = this.getClassificationWithKeyAndDomain("L110105", "DOMAIN_A");
|
||||||
String classificationString = objMapper.writeValueAsString(classification);
|
String classificationString = objMapper.writeValueAsString(classification);
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,13 @@ import static org.mockito.Mockito.verify;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
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.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Captor;
|
import org.mockito.Captor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.hateoas.hal.Jackson2HalModule;
|
import org.springframework.hateoas.hal.Jackson2HalModule;
|
||||||
|
@ -24,7 +22,6 @@ import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
@ -34,17 +31,16 @@ import ch.qos.logback.classic.Logger;
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
import ch.qos.logback.classic.spi.LoggingEvent;
|
import ch.qos.logback.classic.spi.LoggingEvent;
|
||||||
import ch.qos.logback.core.Appender;
|
import ch.qos.logback.core.Appender;
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||||
import pro.taskana.rest.resource.ClassificationSummaryListResource;
|
import pro.taskana.rest.resource.ClassificationSummaryListResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test general Exception Handling.
|
* Test general Exception Handling.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
@TaskanaSpringBootTest
|
||||||
properties = {
|
class GenenalExceptionHandlingTest {
|
||||||
"devMode=true"})
|
|
||||||
public class GenenalExceptionHandlingTest {
|
|
||||||
|
|
||||||
String server = "http://127.0.0.1:";
|
String server = "http://127.0.0.1:";
|
||||||
RestTemplate template;
|
RestTemplate template;
|
||||||
|
@ -58,8 +54,8 @@ public class GenenalExceptionHandlingTest {
|
||||||
@Captor
|
@Captor
|
||||||
private ArgumentCaptor<LoggingEvent> captorLoggingEvent;
|
private ArgumentCaptor<LoggingEvent> captorLoggingEvent;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
void before() {
|
||||||
template = getRestTemplate();
|
template = getRestTemplate();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
request = new HttpEntity<String>(headers);
|
request = new HttpEntity<String>(headers);
|
||||||
|
@ -69,14 +65,14 @@ public class GenenalExceptionHandlingTest {
|
||||||
|
|
||||||
// Always have this teardown otherwise we can stuff up our expectations. Besides, it's
|
// Always have this teardown otherwise we can stuff up our expectations. Besides, it's
|
||||||
// good coding practise
|
// good coding practise
|
||||||
@After
|
@AfterEach
|
||||||
public void teardown() {
|
void teardown() {
|
||||||
final Logger logger = (Logger) LoggerFactory.getLogger(TaskanaRestExceptionHandler.class);
|
final Logger logger = (Logger) LoggerFactory.getLogger(TaskanaRestExceptionHandler.class);
|
||||||
logger.detachAppender(mockAppender);
|
logger.detachAppender(mockAppender);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAccessIdValidationMinimunValueExceptionIsLogged() {
|
void testAccessIdValidationMinimunValueExceptionIsLogged() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
AccessIdController.setLdapCache(new LdapCacheTestImpl());
|
AccessIdController.setLdapCache(new LdapCacheTestImpl());
|
||||||
|
@ -91,7 +87,7 @@ public class GenenalExceptionHandlingTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteNonExisitingClassificationExceptionIsLogged() {
|
void testDeleteNonExisitingClassificationExceptionIsLogged() {
|
||||||
try {
|
try {
|
||||||
template.exchange(
|
template.exchange(
|
||||||
server + port + "/api/v1/classifications/non-existing-id", HttpMethod.DELETE, request,
|
server + port + "/api/v1/classifications/non-existing-id", HttpMethod.DELETE, request,
|
||||||
|
|
|
@ -19,12 +19,9 @@ import java.util.Collections;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.hateoas.Link;
|
import org.springframework.hateoas.Link;
|
||||||
|
@ -37,7 +34,6 @@ import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@ -45,6 +41,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.exceptions.SystemException;
|
import pro.taskana.exceptions.SystemException;
|
||||||
import pro.taskana.rest.resource.TaskResource;
|
import pro.taskana.rest.resource.TaskResource;
|
||||||
import pro.taskana.rest.resource.TaskSummaryListResource;
|
import pro.taskana.rest.resource.TaskSummaryListResource;
|
||||||
|
@ -53,10 +50,9 @@ import pro.taskana.sampledata.SampleDataGenerator;
|
||||||
/**
|
/**
|
||||||
* Test Task Controller.
|
* Test Task Controller.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT,
|
@TaskanaSpringBootTest
|
||||||
properties = {"devMode=true"})
|
class TaskControllerIntTest {
|
||||||
public class TaskControllerIntTest {
|
|
||||||
|
|
||||||
@Value("${taskana.schemaName:TASKANA}")
|
@Value("${taskana.schemaName:TASKANA}")
|
||||||
public String schemaName;
|
public String schemaName;
|
||||||
|
@ -67,7 +63,7 @@ public class TaskControllerIntTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataSource dataSource;
|
private DataSource dataSource;
|
||||||
|
|
||||||
public void resetDb() {
|
void resetDb() {
|
||||||
SampleDataGenerator sampleDataGenerator;
|
SampleDataGenerator sampleDataGenerator;
|
||||||
try {
|
try {
|
||||||
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
sampleDataGenerator = new SampleDataGenerator(dataSource);
|
||||||
|
@ -78,7 +74,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllTasks() {
|
void testGetAllTasks() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -91,7 +87,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllTasksByWorkbasketId() {
|
void testGetAllTasksByWorkbasketId() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"); // teamlead_1
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x"); // teamlead_1
|
||||||
|
@ -105,7 +101,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllTasksByWorkbasketKeyAndDomain() {
|
void testGetAllTasksByWorkbasketKeyAndDomain() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dXNlcl8xXzI6dXNlcl8xXzI="); // user_1_2
|
headers.add("Authorization", "Basic dXNlcl8xXzI6dXNlcl8xXzI="); // user_1_2
|
||||||
|
@ -119,7 +115,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExceptionIfKeyIsSetButDomainIsMissing() {
|
void testExceptionIfKeyIsSetButDomainIsMissing() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dXNlcl8xXzI6dXNlcl8xXzI="); // user_1_2
|
headers.add("Authorization", "Basic dXNlcl8xXzI6dXNlcl8xXzI="); // user_1_2
|
||||||
|
@ -136,7 +132,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllTasksWithAdminRole() {
|
void testGetAllTasksWithAdminRole() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic YWRtaW46YWRtaW4="); // Role Admin
|
headers.add("Authorization", "Basic YWRtaW46YWRtaW4="); // Role Admin
|
||||||
|
@ -149,7 +145,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllTasksKeepingFilters() {
|
void testGetAllTasksKeepingFilters() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -166,7 +162,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThrowsExceptionIfInvalidFilterIsUsed() {
|
void testThrowsExceptionIfInvalidFilterIsUsed() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -184,7 +180,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetLastPageSortedByPorValue() {
|
void testGetLastPageSortedByPorValue() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic YWRtaW46YWRtaW4="); // Role Admin
|
headers.add("Authorization", "Basic YWRtaW46YWRtaW4="); // Role Admin
|
||||||
|
@ -210,7 +206,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetLastPageSortedByDueWithHiddenTasksRemovedFromResult() {
|
void testGetLastPageSortedByDueWithHiddenTasksRemovedFromResult() {
|
||||||
resetDb(); // required because ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
|
resetDb(); // required because ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
|
||||||
// tasks and this test depends on the tasks as they are in sampledata
|
// tasks and this test depends on the tasks as they are in sampledata
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
|
@ -243,7 +239,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetQueryByPorSecondPageSortedByType() {
|
void testGetQueryByPorSecondPageSortedByType() {
|
||||||
resetDb(); // required because ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
|
resetDb(); // required because ClassificationControllerIntTest.testGetQueryByPorSecondPageSortedByType changes
|
||||||
// tasks and this test depends on the tasks as they are in sampledata
|
// tasks and this test depends on the tasks as they are in sampledata
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
|
@ -271,7 +267,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetTaskWithAttachments() throws IOException {
|
void testGetTaskWithAttachments() throws IOException {
|
||||||
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:000000000000000000000000000000000002");
|
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:000000000000000000000000000000000002");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
|
@ -297,7 +293,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAndUpdateTask() throws IOException {
|
void testGetAndUpdateTask() throws IOException {
|
||||||
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000");
|
URL url = new URL("http://127.0.0.1:" + port + "/api/v1/tasks/TKI:100000000000000000000000000000000000");
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
|
@ -354,7 +350,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAndDeleteTask() throws IOException {
|
void testCreateAndDeleteTask() throws IOException {
|
||||||
String taskToCreateJson = "{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
String taskToCreateJson = "{\"classificationSummaryResource\":{\"key\":\"L11010\"},"
|
||||||
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
||||||
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
|
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
|
||||||
|
@ -398,7 +394,7 @@ public class TaskControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateTaskWithInvalidParameter() throws IOException {
|
void testCreateTaskWithInvalidParameter() throws IOException {
|
||||||
String taskToCreateJson = "{\"classificationKey\":\"L11010\","
|
String taskToCreateJson = "{\"classificationKey\":\"L11010\","
|
||||||
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"WBI:100000000000000000000000000000000004\"},"
|
||||||
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
|
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
|
||||||
|
@ -416,7 +412,8 @@ public class TaskControllerIntTest {
|
||||||
assertEquals(400, con.getResponseCode());
|
assertEquals(400, con.getResponseCode());
|
||||||
con.disconnect();
|
con.disconnect();
|
||||||
|
|
||||||
taskToCreateJson = "{\"classificationSummaryResource\":{\"classificationId\":\"CLI:100000000000000000000000000000000004\"},"
|
taskToCreateJson =
|
||||||
|
"{\"classificationSummaryResource\":{\"classificationId\":\"CLI:100000000000000000000000000000000004\"},"
|
||||||
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"\"},"
|
+ "\"workbasketSummaryResource\":{\"workbasketId\":\"\"},"
|
||||||
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
|
+ "\"primaryObjRef\":{\"company\":\"MyCompany1\",\"system\":\"MySystem1\",\"systemInstance\":\"MyInstance1\",\"type\":\"MyType1\",\"value\":\"00000001\"}}";
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.hateoas.hal.Jackson2HalModule;
|
import org.springframework.hateoas.hal.Jackson2HalModule;
|
||||||
|
@ -21,28 +18,27 @@ import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import pro.taskana.TaskanaRole;
|
import pro.taskana.TaskanaRole;
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.rest.resource.TaskanaUserInfoResource;
|
import pro.taskana.rest.resource.TaskanaUserInfoResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test TaskanaEngineController.
|
* Test TaskanaEngineController.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT,
|
@TaskanaSpringBootTest
|
||||||
properties = {"devMode=true"})
|
|
||||||
public class TaskanaEngineControllerIntTest {
|
public class TaskanaEngineControllerIntTest {
|
||||||
|
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDomains() {
|
void testDomains() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -54,7 +50,7 @@ public class TaskanaEngineControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClassificationTypes() {
|
void testClassificationTypes() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -68,7 +64,7 @@ public class TaskanaEngineControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClassificationCategories() {
|
void testClassificationCategories() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -84,7 +80,7 @@ public class TaskanaEngineControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCurrentUserInfo() {
|
void testGetCurrentUserInfo() {
|
||||||
RestTemplate template = getRestTemplate();
|
RestTemplate template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
|
|
@ -8,20 +8,18 @@ import java.util.Collections;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.hateoas.hal.Jackson2HalModule;
|
import org.springframework.hateoas.hal.Jackson2HalModule;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.configuration.SpringTaskanaEngineConfiguration;
|
import pro.taskana.configuration.SpringTaskanaEngineConfiguration;
|
||||||
import pro.taskana.exceptions.SystemException;
|
import pro.taskana.exceptions.SystemException;
|
||||||
import pro.taskana.sampledata.SampleDataGenerator;
|
import pro.taskana.sampledata.SampleDataGenerator;
|
||||||
|
@ -30,9 +28,9 @@ import pro.taskana.sampledata.SampleDataGenerator;
|
||||||
* Test that the schema name can be customized.
|
* Test that the schema name can be customized.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@TaskanaSpringBootTest
|
||||||
public class TestSchemaNameCustomizable {
|
class TestSchemaNameCustomizable {
|
||||||
|
|
||||||
String schemaName = "CUSTOMSCHEMANAME";
|
String schemaName = "CUSTOMSCHEMANAME";
|
||||||
boolean isPostgres = false;
|
boolean isPostgres = false;
|
||||||
|
@ -40,7 +38,7 @@ public class TestSchemaNameCustomizable {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataSource dataSource;
|
private DataSource dataSource;
|
||||||
|
|
||||||
public void resetDb() {
|
void resetDb() {
|
||||||
SampleDataGenerator sampleDataGenerator;
|
SampleDataGenerator sampleDataGenerator;
|
||||||
try {
|
try {
|
||||||
if ("PostgreSQL".equals(dataSource.getConnection().getMetaData().getDatabaseProductName())) {
|
if ("PostgreSQL".equals(dataSource.getConnection().getMetaData().getDatabaseProductName())) {
|
||||||
|
@ -56,7 +54,7 @@ public class TestSchemaNameCustomizable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void chekCustomSchemaNameIsDefined() {
|
void chekCustomSchemaNameIsDefined() {
|
||||||
resetDb();
|
resetDb();
|
||||||
ResultSet rs;
|
ResultSet rs;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -8,12 +8,10 @@ import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
import org.junit.runners.MethodSorters;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.hateoas.Link;
|
import org.springframework.hateoas.Link;
|
||||||
|
@ -26,23 +24,22 @@ import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.rest.resource.WorkbasketAccessItemListResource;
|
import pro.taskana.rest.resource.WorkbasketAccessItemListResource;
|
||||||
import pro.taskana.rest.resource.WorkbasketAccessItemPaginatedListResource;
|
import pro.taskana.rest.resource.WorkbasketAccessItemPaginatedListResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test WorkbasketAccessItemController.
|
* Test WorkbasketAccessItemController.
|
||||||
*/
|
*/
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@TestMethodOrder(MethodOrderer.Alphanumeric.class)
|
||||||
@RunWith(SpringRunner.class)
|
@TaskanaSpringBootTest
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
class WorkbasketAccessItemControllerIntTest {
|
||||||
public class WorkbasketAccessItemControllerIntTest {
|
|
||||||
|
|
||||||
String url = "http://127.0.0.1:";
|
String url = "http://127.0.0.1:";
|
||||||
RestTemplate template;
|
RestTemplate template;
|
||||||
|
@ -50,8 +47,8 @@ public class WorkbasketAccessItemControllerIntTest {
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
void before() {
|
||||||
template = getRestTemplate();
|
template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -59,7 +56,7 @@ public class WorkbasketAccessItemControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllWorkbasketAccessItems() {
|
void testGetAllWorkbasketAccessItems() {
|
||||||
ResponseEntity<WorkbasketAccessItemListResource> response = template.exchange(
|
ResponseEntity<WorkbasketAccessItemListResource> response = template.exchange(
|
||||||
url + port + "/api/v1/workbasket-access-items", HttpMethod.GET, request,
|
url + port + "/api/v1/workbasket-access-items", HttpMethod.GET, request,
|
||||||
ParameterizedTypeReference.forType(WorkbasketAccessItemListResource.class));
|
ParameterizedTypeReference.forType(WorkbasketAccessItemListResource.class));
|
||||||
|
@ -67,7 +64,7 @@ public class WorkbasketAccessItemControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetWorkbasketAccessItemsKeepingFilters() {
|
void testGetWorkbasketAccessItemsKeepingFilters() {
|
||||||
String parameters = "/api/v1/workbasket-access-items?sort-by=workbasket-key&order=asc&page=1&page-size=9&access-ids=user_1_1";
|
String parameters = "/api/v1/workbasket-access-items?sort-by=workbasket-key&order=asc&page=1&page-size=9&access-ids=user_1_1";
|
||||||
ResponseEntity<WorkbasketAccessItemListResource> response = template.exchange(
|
ResponseEntity<WorkbasketAccessItemListResource> response = template.exchange(
|
||||||
url + port + parameters, HttpMethod.GET, request,
|
url + port + parameters, HttpMethod.GET, request,
|
||||||
|
@ -80,7 +77,7 @@ public class WorkbasketAccessItemControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThrowsExceptionIfInvalidFilterIsUsed() {
|
void testThrowsExceptionIfInvalidFilterIsUsed() {
|
||||||
try {
|
try {
|
||||||
template.exchange(
|
template.exchange(
|
||||||
url + port
|
url + port
|
||||||
|
@ -95,7 +92,7 @@ public class WorkbasketAccessItemControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSecondPageSortedByWorkbasketKey() {
|
void testGetSecondPageSortedByWorkbasketKey() {
|
||||||
String parameters = "/api/v1/workbasket-access-items?sort-by=workbasket-key&order=asc&page=2&page-size=9&access-ids=user_1_1";
|
String parameters = "/api/v1/workbasket-access-items?sort-by=workbasket-key&order=asc&page=2&page-size=9&access-ids=user_1_1";
|
||||||
ResponseEntity<WorkbasketAccessItemPaginatedListResource> response = template.exchange(
|
ResponseEntity<WorkbasketAccessItemPaginatedListResource> response = template.exchange(
|
||||||
url + port + parameters, HttpMethod.GET, request,
|
url + port + parameters, HttpMethod.GET, request,
|
||||||
|
@ -116,7 +113,7 @@ public class WorkbasketAccessItemControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveWorkbasketAccessItemsOfUser() {
|
void testRemoveWorkbasketAccessItemsOfUser() {
|
||||||
|
|
||||||
String parameters = "/api/v1/workbasket-access-items/?access-id=user_1_1";
|
String parameters = "/api/v1/workbasket-access-items/?access-id=user_1_1";
|
||||||
ResponseEntity<Void> response = template.exchange(
|
ResponseEntity<Void> response = template.exchange(
|
||||||
|
@ -127,7 +124,7 @@ public class WorkbasketAccessItemControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetBadRequestIfTryingToDeleteAccessItemsForGroup() {
|
void testGetBadRequestIfTryingToDeleteAccessItemsForGroup() {
|
||||||
String parameters = "/api/v1/workbasket-access-items?access-id=cn=DevelopersGroup,ou=groups,o=TaskanaTest";
|
String parameters = "/api/v1/workbasket-access-items?access-id=cn=DevelopersGroup,ou=groups,o=TaskanaTest";
|
||||||
try {
|
try {
|
||||||
ResponseEntity<Void> response = template.exchange(
|
ResponseEntity<Void> response = template.exchange(
|
||||||
|
|
|
@ -9,11 +9,8 @@ import static org.junit.Assert.fail;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
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.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.hateoas.Link;
|
import org.springframework.hateoas.Link;
|
||||||
|
@ -26,13 +23,13 @@ import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.rest.resource.DistributionTargetListResource;
|
import pro.taskana.rest.resource.DistributionTargetListResource;
|
||||||
import pro.taskana.rest.resource.DistributionTargetResource;
|
import pro.taskana.rest.resource.DistributionTargetResource;
|
||||||
import pro.taskana.rest.resource.WorkbasketSummaryListResource;
|
import pro.taskana.rest.resource.WorkbasketSummaryListResource;
|
||||||
|
@ -40,10 +37,9 @@ import pro.taskana.rest.resource.WorkbasketSummaryListResource;
|
||||||
/**
|
/**
|
||||||
* Test WorkbasketController.
|
* Test WorkbasketController.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT,
|
@TaskanaSpringBootTest
|
||||||
properties = {"devMode=true"})
|
class WorkbasketControllerIntTest {
|
||||||
public class WorkbasketControllerIntTest {
|
|
||||||
|
|
||||||
String url = "http://127.0.0.1:";
|
String url = "http://127.0.0.1:";
|
||||||
RestTemplate template;
|
RestTemplate template;
|
||||||
|
@ -51,8 +47,8 @@ public class WorkbasketControllerIntTest {
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
void before() {
|
||||||
template = getRestTemplate();
|
template = getRestTemplate();
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -60,7 +56,7 @@ public class WorkbasketControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllWorkbaskets() {
|
void testGetAllWorkbaskets() {
|
||||||
ResponseEntity<WorkbasketSummaryListResource> response = template.exchange(
|
ResponseEntity<WorkbasketSummaryListResource> response = template.exchange(
|
||||||
url + port + "/api/v1/workbaskets", HttpMethod.GET, request,
|
url + port + "/api/v1/workbaskets", HttpMethod.GET, request,
|
||||||
ParameterizedTypeReference.forType(WorkbasketSummaryListResource.class));
|
ParameterizedTypeReference.forType(WorkbasketSummaryListResource.class));
|
||||||
|
@ -68,7 +64,7 @@ public class WorkbasketControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllWorkbasketsBusinessAdminHasOpenPermission() {
|
void testGetAllWorkbasketsBusinessAdminHasOpenPermission() {
|
||||||
ResponseEntity<WorkbasketSummaryListResource> response = template.exchange(
|
ResponseEntity<WorkbasketSummaryListResource> response = template.exchange(
|
||||||
url + port + "/api/v1/workbaskets?required-permission=OPEN", HttpMethod.GET, request,
|
url + port + "/api/v1/workbaskets?required-permission=OPEN", HttpMethod.GET, request,
|
||||||
ParameterizedTypeReference.forType(WorkbasketSummaryListResource.class));
|
ParameterizedTypeReference.forType(WorkbasketSummaryListResource.class));
|
||||||
|
@ -77,7 +73,7 @@ public class WorkbasketControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllWorkbasketsKeepingFilters() {
|
void testGetAllWorkbasketsKeepingFilters() {
|
||||||
String parameters = "/api/v1/workbaskets?type=PERSONAL&sort-by=key&order=desc";
|
String parameters = "/api/v1/workbaskets?type=PERSONAL&sort-by=key&order=desc";
|
||||||
ResponseEntity<WorkbasketSummaryListResource> response = template.exchange(
|
ResponseEntity<WorkbasketSummaryListResource> response = template.exchange(
|
||||||
url + port + parameters, HttpMethod.GET, request,
|
url + port + parameters, HttpMethod.GET, request,
|
||||||
|
@ -90,7 +86,7 @@ public class WorkbasketControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThrowsExceptionIfInvalidFilterIsUsed() {
|
void testThrowsExceptionIfInvalidFilterIsUsed() {
|
||||||
try {
|
try {
|
||||||
template.exchange(
|
template.exchange(
|
||||||
url + port + "/api/v1/workbaskets?invalid=PERSONAL", HttpMethod.GET, request,
|
url + port + "/api/v1/workbaskets?invalid=PERSONAL", HttpMethod.GET, request,
|
||||||
|
@ -103,7 +99,7 @@ public class WorkbasketControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSecondPageSortedByKey() {
|
void testGetSecondPageSortedByKey() {
|
||||||
|
|
||||||
String parameters = "/api/v1/workbaskets?sort-by=key&order=desc&page=2&page-size=5";
|
String parameters = "/api/v1/workbaskets?sort-by=key&order=desc&page=2&page-size=5";
|
||||||
ResponseEntity<WorkbasketSummaryListResource> response = template.exchange(
|
ResponseEntity<WorkbasketSummaryListResource> response = template.exchange(
|
||||||
|
@ -123,7 +119,7 @@ public class WorkbasketControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveWorkbasketAsDistributionTarget() {
|
void testRemoveWorkbasketAsDistributionTarget() {
|
||||||
String parameters = "/api/v1/workbaskets/distribution-targets/WBI:100000000000000000000000000000000007";
|
String parameters = "/api/v1/workbaskets/distribution-targets/WBI:100000000000000000000000000000000007";
|
||||||
ResponseEntity<?> response = template.exchange(
|
ResponseEntity<?> response = template.exchange(
|
||||||
url + port + parameters, HttpMethod.DELETE, request,
|
url + port + parameters, HttpMethod.DELETE, request,
|
||||||
|
|
|
@ -14,13 +14,10 @@ import java.util.ArrayList;
|
||||||
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.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.web.server.LocalServerPort;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
import org.springframework.core.io.FileSystemResource;
|
||||||
|
@ -33,7 +30,6 @@ import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
@ -42,14 +38,15 @@ import org.springframework.web.client.RestTemplate;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import pro.taskana.TaskanaSpringBootTest;
|
||||||
import pro.taskana.rest.resource.WorkbasketDefinitionResource;
|
import pro.taskana.rest.resource.WorkbasketDefinitionResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration tests for WorkbasketDefinitionController.
|
* Integration tests for WorkbasketDefinitionController.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = RestConfiguration.class, webEnvironment = WebEnvironment.RANDOM_PORT)
|
@TaskanaSpringBootTest
|
||||||
public class WorkbasketDefinitionControllerIntTest {
|
class WorkbasketDefinitionControllerIntTest {
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class);
|
||||||
private String server = "http://127.0.0.1:";
|
private String server = "http://127.0.0.1:";
|
||||||
|
@ -60,8 +57,8 @@ public class WorkbasketDefinitionControllerIntTest {
|
||||||
@LocalServerPort
|
@LocalServerPort
|
||||||
private int port;
|
private int port;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
void before() {
|
||||||
LOGGER.debug("before");
|
LOGGER.debug("before");
|
||||||
template = getRestTemplate();
|
template = getRestTemplate();
|
||||||
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
headers.add("Authorization", "Basic dGVhbWxlYWRfMTp0ZWFtbGVhZF8x");
|
||||||
|
@ -69,10 +66,11 @@ public class WorkbasketDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExportWorkbasketFromDomain() {
|
void testExportWorkbasketFromDomain() {
|
||||||
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
||||||
server + port + "/api/v1/workbasket-definitions?domain=DOMAIN_A", HttpMethod.GET, request,
|
server + port + "/api/v1/workbasket-definitions?domain=DOMAIN_A", HttpMethod.GET, request,
|
||||||
new ParameterizedTypeReference<List<WorkbasketDefinitionResource>>() {
|
new ParameterizedTypeReference<List<WorkbasketDefinitionResource>>() {
|
||||||
|
|
||||||
});
|
});
|
||||||
assertNotNull(response.getBody());
|
assertNotNull(response.getBody());
|
||||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
assertEquals(HttpStatus.OK, response.getStatusCode());
|
||||||
|
@ -95,7 +93,7 @@ public class WorkbasketDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExportWorkbasketsFromWrongDomain() {
|
void testExportWorkbasketsFromWrongDomain() {
|
||||||
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
||||||
server + port + "/api/v1/workbasket-definitions?domain=wrongDomain",
|
server + port + "/api/v1/workbasket-definitions?domain=wrongDomain",
|
||||||
HttpMethod.GET, request, ParameterizedTypeReference.forType(List.class));
|
HttpMethod.GET, request, ParameterizedTypeReference.forType(List.class));
|
||||||
|
@ -103,7 +101,7 @@ public class WorkbasketDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportWorkbasket() throws IOException {
|
void testImportWorkbasket() throws IOException {
|
||||||
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
||||||
server + port + "/api/v1/workbasket-definitions?domain=DOMAIN_A",
|
server + port + "/api/v1/workbasket-definitions?domain=DOMAIN_A",
|
||||||
HttpMethod.GET, request, ParameterizedTypeReference.forType(List.class));
|
HttpMethod.GET, request, ParameterizedTypeReference.forType(List.class));
|
||||||
|
@ -115,7 +113,7 @@ public class WorkbasketDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailOnImportDuplicates() throws IOException {
|
void testFailOnImportDuplicates() throws IOException {
|
||||||
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
||||||
server + port + "/api/v1/workbasket-definitions?domain=DOMAIN_A",
|
server + port + "/api/v1/workbasket-definitions?domain=DOMAIN_A",
|
||||||
HttpMethod.GET, request, new ParameterizedTypeReference<List<WorkbasketDefinitionResource>>() {
|
HttpMethod.GET, request, new ParameterizedTypeReference<List<WorkbasketDefinitionResource>>() {
|
||||||
|
@ -134,11 +132,12 @@ public class WorkbasketDefinitionControllerIntTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNoErrorWhenImportWithSameIdButDifferentKeyAndDomain()
|
void testNoErrorWhenImportWithSameIdButDifferentKeyAndDomain()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
ResponseEntity<List<WorkbasketDefinitionResource>> response = template.exchange(
|
||||||
server + port + "/api/v1/workbasket-definitions?domain=DOMAIN_A",
|
server + port + "/api/v1/workbasket-definitions?domain=DOMAIN_A",
|
||||||
HttpMethod.GET, request, new ParameterizedTypeReference<List<WorkbasketDefinitionResource>>() {
|
HttpMethod.GET, request, new ParameterizedTypeReference<List<WorkbasketDefinitionResource>>() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
|
|
|
@ -93,8 +93,21 @@
|
||||||
|
|
||||||
<!-- TEST -->
|
<!-- TEST -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -86,9 +86,21 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>${version.junit}</version>
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.vintage</groupId>
|
||||||
|
<artifactId>junit-vintage-engine</artifactId>
|
||||||
|
<version>${version.junit.jupiter}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -3,11 +3,11 @@ package pro.taskana.rest.resource;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
import pro.taskana.Classification;
|
import pro.taskana.Classification;
|
||||||
|
@ -18,10 +18,10 @@ import pro.taskana.rest.TestConfiguration;
|
||||||
/**
|
/**
|
||||||
* Test for {@link ClassificationResourceAssembler}.
|
* Test for {@link ClassificationResourceAssembler}.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = {TestConfiguration.class})
|
@ContextConfiguration(classes = {TestConfiguration.class})
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
public class ClassificationAssemblerTest {
|
class ClassificationAssemblerTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ClassificationResourceAssembler classificationResourceAssembler;
|
private ClassificationResourceAssembler classificationResourceAssembler;
|
||||||
|
@ -30,7 +30,7 @@ public class ClassificationAssemblerTest {
|
||||||
private ClassificationService classificationService;
|
private ClassificationService classificationService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void classificationToResource() {
|
void classificationToResource() {
|
||||||
// given
|
// given
|
||||||
ClassificationImpl classification = (ClassificationImpl) classificationService.newClassification("DOMAIN_A",
|
ClassificationImpl classification = (ClassificationImpl) classificationService.newClassification("DOMAIN_A",
|
||||||
"1", "A");
|
"1", "A");
|
||||||
|
@ -60,7 +60,7 @@ public class ClassificationAssemblerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resourceToClassification() {
|
void resourceToClassification() {
|
||||||
ClassificationImpl classification = (ClassificationImpl) classificationService.newClassification("12",
|
ClassificationImpl classification = (ClassificationImpl) classificationService.newClassification("12",
|
||||||
"DOMAIN_B", "AB");
|
"DOMAIN_B", "AB");
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
package pro.taskana.rest.resource;
|
package pro.taskana.rest.resource;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import pro.taskana.configuration.TaskanaEngineConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for Taskana lib configuration.
|
* Tests for Taskana lib configuration.
|
||||||
*/
|
*/
|
||||||
public class ConfigurationTest {
|
class ConfigurationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImplementationVersionIsInTaskanaCorePackage() {
|
void testImplementationVersionIsInTaskanaCorePackage() {
|
||||||
assertNotNull(TaskanaEngineConfiguration.class.getPackage().getImplementationVersion());
|
assertNotNull(TaskanaEngineConfiguration.class.getPackage().getImplementationVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,12 @@ 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 org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
import pro.taskana.impl.report.header.TimeIntervalColumnHeader;
|
||||||
|
@ -31,10 +31,10 @@ import pro.taskana.rest.TestConfiguration;
|
||||||
/**
|
/**
|
||||||
* Test for {@link ReportResourceAssembler}.
|
* Test for {@link ReportResourceAssembler}.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = {TestConfiguration.class})
|
@ContextConfiguration(classes = {TestConfiguration.class})
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
public class ReportResourceTest {
|
class ReportResourceTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ReportResourceAssembler reportResourceAssembler;
|
private ReportResourceAssembler reportResourceAssembler;
|
||||||
|
@ -43,8 +43,8 @@ public class ReportResourceTest {
|
||||||
private LocalDateTime now;
|
private LocalDateTime now;
|
||||||
private List<TimeIntervalColumnHeader> headers;
|
private List<TimeIntervalColumnHeader> headers;
|
||||||
|
|
||||||
@Before
|
@BeforeEach
|
||||||
public void before() {
|
void before() {
|
||||||
now = LocalDate.parse("2019-01-02").atStartOfDay();
|
now = LocalDate.parse("2019-01-02").atStartOfDay();
|
||||||
daysDiff = (int) LocalDateTime.now().until(now, ChronoUnit.DAYS);
|
daysDiff = (int) LocalDateTime.now().until(now, ChronoUnit.DAYS);
|
||||||
headers = IntStream.range(daysDiff - 5, daysDiff)
|
headers = IntStream.range(daysDiff - 5, daysDiff)
|
||||||
|
@ -54,7 +54,7 @@ public class ReportResourceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmptyReport() {
|
void testEmptyReport() {
|
||||||
// given
|
// given
|
||||||
WorkbasketReport report = new WorkbasketReport(headers);
|
WorkbasketReport report = new WorkbasketReport(headers);
|
||||||
// when
|
// when
|
||||||
|
@ -83,7 +83,7 @@ public class ReportResourceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOneSingleRow() {
|
void testOneSingleRow() {
|
||||||
// given
|
// given
|
||||||
ClassificationReport report = new ClassificationReport(headers);
|
ClassificationReport report = new ClassificationReport(headers);
|
||||||
MonitorQueryItem item = new MonitorQueryItem();
|
MonitorQueryItem item = new MonitorQueryItem();
|
||||||
|
@ -126,7 +126,7 @@ public class ReportResourceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultipleSingleRows() {
|
void testMultipleSingleRows() {
|
||||||
// given
|
// given
|
||||||
ClassificationReport report = new ClassificationReport(headers);
|
ClassificationReport report = new ClassificationReport(headers);
|
||||||
MonitorQueryItem item = new MonitorQueryItem();
|
MonitorQueryItem item = new MonitorQueryItem();
|
||||||
|
@ -177,7 +177,7 @@ public class ReportResourceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOneFoldableRow() {
|
void testOneFoldableRow() {
|
||||||
// given
|
// given
|
||||||
ClassificationReport.DetailedClassificationReport report = new ClassificationReport.DetailedClassificationReport(
|
ClassificationReport.DetailedClassificationReport report = new ClassificationReport.DetailedClassificationReport(
|
||||||
headers);
|
headers);
|
||||||
|
@ -253,7 +253,7 @@ public class ReportResourceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultipleFoldableRows() {
|
void testMultipleFoldableRows() {
|
||||||
// given
|
// given
|
||||||
ClassificationReport.DetailedClassificationReport report = new ClassificationReport.DetailedClassificationReport(
|
ClassificationReport.DetailedClassificationReport report = new ClassificationReport.DetailedClassificationReport(
|
||||||
headers);
|
headers);
|
||||||
|
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
import pro.taskana.Attachment;
|
import pro.taskana.Attachment;
|
||||||
|
@ -23,10 +23,10 @@ import pro.taskana.rest.TestConfiguration;
|
||||||
/**
|
/**
|
||||||
* Test for {@link TaskResourceAssembler}.
|
* Test for {@link TaskResourceAssembler}.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = {TestConfiguration.class})
|
@ContextConfiguration(classes = {TestConfiguration.class})
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
public class TaskResourceAssemberTest {
|
class TaskResourceAssemberTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TaskService taskService;
|
TaskService taskService;
|
||||||
|
@ -34,7 +34,7 @@ public class TaskResourceAssemberTest {
|
||||||
TaskResourceAssembler taskResourceAssembler;
|
TaskResourceAssembler taskResourceAssembler;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleResourceToModel() throws InvalidArgumentException {
|
void testSimpleResourceToModel() throws InvalidArgumentException {
|
||||||
//given
|
//given
|
||||||
ObjectReference primaryObjRef = new ObjectReference();
|
ObjectReference primaryObjRef = new ObjectReference();
|
||||||
primaryObjRef.setId("abc");
|
primaryObjRef.setId("abc");
|
||||||
|
@ -94,7 +94,7 @@ public class TaskResourceAssemberTest {
|
||||||
testEquality(task, resource);
|
testEquality(task, resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEquality(Task task, TaskResource resource) throws InvalidArgumentException {
|
void testEquality(Task task, TaskResource resource) throws InvalidArgumentException {
|
||||||
Assert.assertEquals(task.getId(), resource.getTaskId());
|
Assert.assertEquals(task.getId(), resource.getTaskId());
|
||||||
Assert.assertEquals(task.getExternalId(), resource.getExternalId());
|
Assert.assertEquals(task.getExternalId(), resource.getExternalId());
|
||||||
Assert.assertEquals(task.getCreated() == null ? null : task.getCreated().toString(), resource.getCreated());
|
Assert.assertEquals(task.getCreated() == null ? null : task.getCreated().toString(), resource.getCreated());
|
||||||
|
@ -142,7 +142,7 @@ public class TaskResourceAssemberTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEqualityAttachements(List<Attachment> attachments, List<AttachmentResource> resources) {
|
void testEqualityAttachements(List<Attachment> attachments, List<AttachmentResource> resources) {
|
||||||
Assert.assertEquals(attachments.size(), resources.size());
|
Assert.assertEquals(attachments.size(), resources.size());
|
||||||
for (int i = 0; i < resources.size(); i++) {
|
for (int i = 0; i < resources.size(); i++) {
|
||||||
AttachmentResource resource = resources.get(i);
|
AttachmentResource resource = resources.get(i);
|
||||||
|
@ -152,7 +152,7 @@ public class TaskResourceAssemberTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEquality(Map<String, String> customAttributes,
|
void testEquality(Map<String, String> customAttributes,
|
||||||
List<TaskResource.CustomAttribute> resourceAttributes) {
|
List<TaskResource.CustomAttribute> resourceAttributes) {
|
||||||
Assert.assertEquals(customAttributes.size(), resourceAttributes.size());
|
Assert.assertEquals(customAttributes.size(), resourceAttributes.size());
|
||||||
resourceAttributes.forEach(
|
resourceAttributes.forEach(
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package pro.taskana.rest.resource;
|
package pro.taskana.rest.resource;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
import pro.taskana.WorkbasketAccessItem;
|
import pro.taskana.WorkbasketAccessItem;
|
||||||
|
@ -16,10 +16,10 @@ import pro.taskana.rest.TestConfiguration;
|
||||||
/**
|
/**
|
||||||
* Test for {@link WorkbasketAccessItemResourceAssembler}.
|
* Test for {@link WorkbasketAccessItemResourceAssembler}.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = {TestConfiguration.class})
|
@ContextConfiguration(classes = {TestConfiguration.class})
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
public class WorkbasketAccessItemResourceAssemblerTest {
|
class WorkbasketAccessItemResourceAssemblerTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
WorkbasketAccessItemResourceAssembler workbasketAccessItemResourceAssembler;
|
WorkbasketAccessItemResourceAssembler workbasketAccessItemResourceAssembler;
|
||||||
|
@ -28,7 +28,7 @@ public class WorkbasketAccessItemResourceAssemblerTest {
|
||||||
WorkbasketService workbasketService;
|
WorkbasketService workbasketService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void workBasketAccessItemToResourcePropertiesEqual() {
|
void workBasketAccessItemToResourcePropertiesEqual() {
|
||||||
// given
|
// given
|
||||||
WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("1", "2");
|
WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("1", "2");
|
||||||
((WorkbasketAccessItemImpl) accessItem).setWorkbasketKey("workbasketKey");
|
((WorkbasketAccessItemImpl) accessItem).setWorkbasketKey("workbasketKey");
|
||||||
|
@ -57,7 +57,7 @@ public class WorkbasketAccessItemResourceAssemblerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void workBasketAccessItemToModelPropertiesEqual() {
|
void workBasketAccessItemToModelPropertiesEqual() {
|
||||||
// given
|
// given
|
||||||
WorkbasketAccessItemResource resource = new WorkbasketAccessItemResource();
|
WorkbasketAccessItemResource resource = new WorkbasketAccessItemResource();
|
||||||
resource.setAccessId("10");
|
resource.setAccessId("10");
|
||||||
|
|
|
@ -3,11 +3,11 @@ package pro.taskana.rest.resource;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
import pro.taskana.Workbasket;
|
import pro.taskana.Workbasket;
|
||||||
|
@ -21,10 +21,10 @@ import pro.taskana.rest.TestConfiguration;
|
||||||
/**
|
/**
|
||||||
* Test for {@link WorkbasketResourceAssembler}.
|
* Test for {@link WorkbasketResourceAssembler}.
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = {TestConfiguration.class})
|
@ContextConfiguration(classes = {TestConfiguration.class})
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
public class WorkbasketResourceAssemblerTest {
|
class WorkbasketResourceAssemblerTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
WorkbasketService workbasketService;
|
WorkbasketService workbasketService;
|
||||||
|
@ -32,7 +32,7 @@ public class WorkbasketResourceAssemblerTest {
|
||||||
WorkbasketResourceAssembler workbasketResourceAssembler;
|
WorkbasketResourceAssembler workbasketResourceAssembler;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void workbasketToResource() throws NotAuthorizedException, WorkbasketNotFoundException {
|
void workbasketToResource() throws NotAuthorizedException, WorkbasketNotFoundException {
|
||||||
// given
|
// given
|
||||||
Workbasket workbasket = workbasketService.newWorkbasket("1", "DOMAIN_A");
|
Workbasket workbasket = workbasketService.newWorkbasket("1", "DOMAIN_A");
|
||||||
((WorkbasketImpl) workbasket).setId("ID");
|
((WorkbasketImpl) workbasket).setId("ID");
|
||||||
|
@ -57,7 +57,7 @@ public class WorkbasketResourceAssemblerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resourceWithoutCreated() {
|
void resourceWithoutCreated() {
|
||||||
//given
|
//given
|
||||||
WorkbasketResource resource = new WorkbasketResource();
|
WorkbasketResource resource = new WorkbasketResource();
|
||||||
resource.setWorkbasketId("1");
|
resource.setWorkbasketId("1");
|
||||||
|
@ -70,7 +70,7 @@ public class WorkbasketResourceAssemblerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resourceWithoutModified() {
|
void resourceWithoutModified() {
|
||||||
//given
|
//given
|
||||||
WorkbasketResource resource = new WorkbasketResource();
|
WorkbasketResource resource = new WorkbasketResource();
|
||||||
resource.setWorkbasketId("1");
|
resource.setWorkbasketId("1");
|
||||||
|
@ -83,7 +83,7 @@ public class WorkbasketResourceAssemblerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resourceToWorkbasket() {
|
void resourceToWorkbasket() {
|
||||||
// given
|
// given
|
||||||
WorkbasketResource workbasketResource = new WorkbasketResource();
|
WorkbasketResource workbasketResource = new WorkbasketResource();
|
||||||
workbasketResource.setWorkbasketId("1");
|
workbasketResource.setWorkbasketId("1");
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue