TSK-170: added tests for sorting by name and key ascending and descending for the WorkbasketQuery.

This commit is contained in:
Holger Hagen 2018-01-29 15:26:21 +01:00 committed by Marcel Lengl
parent 3862e1d71d
commit 7497518281
2 changed files with 88 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.h2.store.fs.FileUtils;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -153,4 +154,61 @@ public class QueryWorkbasketAccTest extends AbstractAccTest {
public static void cleanUpClass() {
FileUtils.deleteRecursive("~/data", true);
}
@Ignore
@Test
public void testQueryWorkbasketByNameStartsWithSortedByNameAscending()
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Gruppenpostkorb KSC%")
// .orderByName()
// .ascending()
.list();
Assert.assertEquals(6L, results.size());
Assert.assertEquals("GPK_KSC", results.get(0).getKey());
}
@Ignore
@Test
public void testQueryWorkbasketByNameStartsWithSortedByNameDescending()
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Gruppenpostkorb KSC%")
// .orderByName()
// .descending()
.list();
Assert.assertEquals(6L, results.size());
Assert.assertEquals("GPK_B_KSC_2", results.get(0).getKey());
}
@Ignore
@Test
public void testQueryWorkbasketByNameStartsWithSortedByKeyAscending()
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Gruppenpostkorb KSC%")
// .orderByKey()
// .ascending()
.list();
Assert.assertEquals(6L, results.size());
Assert.assertEquals("GPK_B_KSC", results.get(0).getKey());
}
@Ignore
@Test
public void testQueryWorkbasketByNameStartsWithSortedByKeyDescending()
throws SQLException, NotAuthorizedException, InvalidArgumentException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.nameLike("%Gruppenpostkorb KSC%")
// .orderByKey()
// .descending()
.list();
Assert.assertEquals(6L, results.size());
Assert.assertEquals("GPK_KSC_2", results.get(0).getKey());
}
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.h2.store.fs.FileUtils;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -50,9 +51,37 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
Assert.assertEquals(9, results.size());
}
@Ignore
@Test
public void testQueryAllTransferTargetsForUserAndGroupSortedByNameAscending()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePersmission(WorkbasketAuthorization.APPEND, "user_1_1", "group_1")
// .orderByName()
// .ascending()
.list();
Assert.assertEquals(9, results.size());
Assert.assertEquals("GPK_B_KSC_2", results.get(0).getKey());
}
@Ignore
@Test
public void testQueryAllTransferTargetsForUserAndGroupSortedByNameDescending()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
List<WorkbasketSummary> results = workbasketService.createWorkbasketQuery()
.accessIdsHavePersmission(WorkbasketAuthorization.APPEND, "user_1_1", "group_1")
// .orderByName()
// .descending()
.list();
Assert.assertEquals(9, results.size());
Assert.assertEquals("GPK_B_KSC_2", results.get(0).getKey());
}
@WithAccessId(
userName = "user_1_1",
groupNames = { "group_1" })
groupNames = {"group_1"})
@Test
public void testQueryAllTransferTargetsForUserAndGroupFromSubject()
throws SQLException, NotAuthorizedException, InvalidArgumentException, SystemException {