TSK-990: Fix tests depending on execution order
This commit is contained in:
parent
a02a4e41f7
commit
3ea0ab0bf4
|
@ -1,6 +1,5 @@
|
|||
package acceptance;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
|
@ -37,7 +36,7 @@ public abstract class AbstractAccTest {
|
|||
resetDb(false);
|
||||
}
|
||||
|
||||
public static void resetDb(boolean dropTables) throws SQLException, IOException {
|
||||
public static void resetDb(boolean dropTables) throws SQLException {
|
||||
DataSource dataSource = TaskanaEngineTestConfiguration.getDataSource();
|
||||
String schemaName = TaskanaEngineTestConfiguration.getSchemaName();
|
||||
SampleDataGenerator sampleDataGenerator = new SampleDataGenerator(dataSource, schemaName);
|
||||
|
|
|
@ -3,6 +3,7 @@ package acceptance.jobs;
|
|||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -35,15 +36,21 @@ class TaskCleanupJobAccTest extends AbstractAccTest {
|
|||
TaskService taskService;
|
||||
|
||||
@BeforeEach
|
||||
void before() {
|
||||
void before() throws SQLException {
|
||||
//required if single tests modify database
|
||||
//TODO split test class into readOnly & modifying tests to improve performance
|
||||
resetDb(false);
|
||||
resetDb(false);
|
||||
taskService = taskanaEngine.getTaskService();
|
||||
}
|
||||
|
||||
@WithAccessId(userName = "admin")
|
||||
@Test
|
||||
void shouldCleanCompletedTasksUntilDate() throws Exception {
|
||||
|
||||
createAndCompleteTask();
|
||||
long totalTasksCount = taskService.createTaskQuery().count();
|
||||
assertEquals(73, totalTasksCount);
|
||||
assertEquals(74, totalTasksCount);
|
||||
|
||||
taskanaEngine.getConfiguration().setTaskCleanupJobAllCompletedSameParentBusiness(false);
|
||||
|
||||
|
@ -51,14 +58,14 @@ class TaskCleanupJobAccTest extends AbstractAccTest {
|
|||
job.run();
|
||||
|
||||
totalTasksCount = taskService.createTaskQuery().count();
|
||||
assertEquals(67, totalTasksCount);
|
||||
assertEquals(68, totalTasksCount);
|
||||
}
|
||||
|
||||
@WithAccessId(userName = "admin")
|
||||
@Test
|
||||
void shouldCleanCompletedTasksUntilDateWithSameParentBussiness() throws Exception {
|
||||
long totalTasksCount = taskService.createTaskQuery().count();
|
||||
assertEquals(68, totalTasksCount);
|
||||
assertEquals(73, totalTasksCount);
|
||||
|
||||
taskanaEngine.getConfiguration().setTaskCleanupJobAllCompletedSameParentBusiness(true);
|
||||
|
||||
|
@ -77,7 +84,7 @@ class TaskCleanupJobAccTest extends AbstractAccTest {
|
|||
job.run();
|
||||
|
||||
totalTasksCount = taskService.createTaskQuery().count();
|
||||
assertEquals(67, totalTasksCount);
|
||||
assertEquals(66, totalTasksCount);
|
||||
}
|
||||
|
||||
@WithAccessId(userName = "admin")
|
||||
|
|
|
@ -15,6 +15,7 @@ import static pro.taskana.TaskQueryColumnName.CLASSIFICATION_KEY;
|
|||
import static pro.taskana.TaskQueryColumnName.OWNER;
|
||||
import static pro.taskana.TaskQueryColumnName.STATE;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -22,6 +23,7 @@ import java.util.Map;
|
|||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
|
@ -53,6 +55,13 @@ import pro.taskana.security.WithAccessId;
|
|||
@ExtendWith(JAASExtension.class)
|
||||
class QueryTasksAccTest extends AbstractAccTest {
|
||||
|
||||
@BeforeEach
|
||||
void before() throws SQLException {
|
||||
//required if single tests modify database
|
||||
//TODO split test class into readOnly & modifying tests to improve performance
|
||||
resetDb(false);
|
||||
}
|
||||
|
||||
@WithAccessId(
|
||||
userName = "teamlead_1",
|
||||
groupNames = {"admin"})
|
||||
|
@ -112,7 +121,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|||
.orderByClassificationKey(DESCENDING)
|
||||
.listValues(CLASSIFICATION_KEY, null);
|
||||
assertNotNull(columnValueList);
|
||||
assertEquals(7, columnValueList.size());
|
||||
assertEquals(6, columnValueList.size());
|
||||
}
|
||||
|
||||
@WithAccessId(
|
||||
|
@ -896,7 +905,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|||
List<TaskSummary> results = taskService.createTaskQuery()
|
||||
.classificationCategoryIn("MANUAL", "AUTOMATIC")
|
||||
.list();
|
||||
assertEquals(4, results.size());
|
||||
assertEquals(3, results.size());
|
||||
}
|
||||
|
||||
@WithAccessId(
|
||||
|
@ -1085,7 +1094,7 @@ class QueryTasksAccTest extends AbstractAccTest {
|
|||
List<TaskSummary> results = taskService.createTaskQuery()
|
||||
.orderByCreator(DESCENDING)
|
||||
.list();
|
||||
assertEquals("user_1_1", results.get(0).getCreator());
|
||||
assertEquals("erstellerSpezial", results.get(0).getCreator());
|
||||
}
|
||||
|
||||
@WithAccessId(
|
||||
|
|
Loading…
Reference in New Issue