Search in sources :

Example 26 with ClassificationService

use of pro.taskana.ClassificationService in project taskana by Taskana.

the class GetClassificationAccTest method testGetOneClassificationByIdFails.

@Test(expected = ClassificationNotFoundException.class)
public void testGetOneClassificationByIdFails() throws ClassificationNotFoundException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    Classification classification = classificationService.getClassification("CLI:100000000470000000000000000000000011");
    Assert.fail("ClassificationNotFoundException was expected");
}
Also used : Classification(pro.taskana.Classification) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 27 with ClassificationService

use of pro.taskana.ClassificationService in project taskana by Taskana.

the class GetClassificationAccTest method testGetOneClassificationForRootDomain.

@Test
public void testGetOneClassificationForRootDomain() throws ClassificationNotFoundException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    Classification classification = classificationService.getClassification("L10000", "");
    Assert.assertNotNull(classification);
    Assert.assertEquals("", classification.getDomain());
    Assert.assertEquals(999L, classification.getPriority());
}
Also used : Classification(pro.taskana.Classification) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 28 with ClassificationService

use of pro.taskana.ClassificationService in project taskana by Taskana.

the class QueryClassificationWithPaginationAccTest method testGetSecondPageOfClassificationQueryWithOffset.

@Test
public void testGetSecondPageOfClassificationQueryWithOffset() throws NotAuthorizedException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    List<ClassificationSummary> results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").list(5, 5);
    assertThat(results.size(), equalTo(5));
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 29 with ClassificationService

use of pro.taskana.ClassificationService in project taskana by Taskana.

the class QueryClassificationWithPaginationAccTest method testPaginationWithPages.

@Test
public void testPaginationWithPages() throws NotAuthorizedException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    // Getting full page
    int pageNumber = 1;
    int pageSize = 4;
    List<ClassificationSummary> results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(4));
    // Getting full page
    pageNumber = 3;
    pageSize = 4;
    results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(4));
    // Getting last results on 1 big page
    pageNumber = 1;
    pageSize = 100;
    results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(17));
    // Getting last results on multiple pages
    pageNumber = 2;
    pageSize = 10;
    results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(7));
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 30 with ClassificationService

use of pro.taskana.ClassificationService in project taskana by Taskana.

the class QueryClassificationWithPaginationAccTest method testPaginationNullAndNegativeLimitsIgnoring.

@Test
public void testPaginationNullAndNegativeLimitsIgnoring() throws NotAuthorizedException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    // 0 limit/size = 0 results
    int pageNumber = 1;
    int pageSize = 0;
    List<ClassificationSummary> results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(0));
    // Negative will be 0 = all results
    pageNumber = 1;
    pageSize = -1;
    results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(0));
    // Negative page = first page
    pageNumber = -1;
    pageSize = 10;
    results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").listPage(pageNumber, pageSize);
    assertThat(results.size(), equalTo(10));
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Aggregations

AbstractAccTest (acceptance.AbstractAccTest)32 Test (org.junit.Test)32 ClassificationService (pro.taskana.ClassificationService)32 ClassificationSummary (pro.taskana.ClassificationSummary)19 Classification (pro.taskana.Classification)10 WithAccessId (pro.taskana.security.WithAccessId)6 SQLException (java.sql.SQLException)2 Instant (java.time.Instant)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertNotNull (org.junit.Assert.assertNotNull)2 ClassificationNotFoundException (pro.taskana.exceptions.ClassificationNotFoundException)2 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)2 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)2 ArrayList (java.util.ArrayList)1 Ignore (org.junit.Ignore)1 Task (pro.taskana.Task)1 TaskService (pro.taskana.TaskService)1 DaysToWorkingDaysConverter (pro.taskana.impl.DaysToWorkingDaysConverter)1