Search in sources :

Example 11 with ClassificationService

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

the class QueryClassificationAccTest method testGetClassificationsWithParentAndCustom2.

@Test
public void testGetClassificationsWithParentAndCustom2() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    List<ClassificationSummary> classifications = classificationService.createClassificationQuery().parentIdIn("CLI:100000000000000000000000000000000004").custom2Like("TEXT_1", "TEXT_2").list();
    // zwei tests
    assertNotNull(classifications);
    assertEquals(3, classifications.size());
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 12 with ClassificationService

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

the class QueryClassificationAccTest method testGetClassificationsForTypeAndParent.

@Test
public void testGetClassificationsForTypeAndParent() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    List<ClassificationSummary> classifications = classificationService.createClassificationQuery().typeIn("TASK", "DOCUMENT").parentIdIn("").list();
    assertNotNull(classifications);
    assertEquals(25, classifications.size());
    List<ClassificationSummary> documentTypes = classifications.stream().filter(c -> c.getType().equals("DOCUMENT")).collect(Collectors.toList());
    assertEquals(2, documentTypes.size());
    List<ClassificationSummary> taskTypes = classifications.stream().filter(c -> c.getType().equals("TASK")).collect(Collectors.toList());
    assertEquals(23, taskTypes.size());
}
Also used : SQLException(java.sql.SQLException) List(java.util.List) ClassificationNotFoundException(pro.taskana.exceptions.ClassificationNotFoundException) Assert.assertNotNull(org.junit.Assert.assertNotNull) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) NotAuthorizedException(pro.taskana.exceptions.NotAuthorizedException) Test(org.junit.Test) ClassificationSummary(pro.taskana.ClassificationSummary) Collectors(java.util.stream.Collectors) Assert.assertEquals(org.junit.Assert.assertEquals) InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) ClassificationSummary(pro.taskana.ClassificationSummary) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 13 with ClassificationService

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

the class GetClassificationAccTest method testGetOneClassificationById.

@Test
public void testGetOneClassificationById() throws ClassificationNotFoundException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    Classification classification = classificationService.getClassification("CLI:100000000000000000000000000000000011");
    Assert.assertNotNull(classification);
}
Also used : Classification(pro.taskana.Classification) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 14 with ClassificationService

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

the class GetClassificationAccTest method testFindAllClassifications.

@Test
public void testFindAllClassifications() {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    List<ClassificationSummary> classificationSummaryList = classificationService.createClassificationQuery().list();
    Assert.assertNotNull(classificationSummaryList);
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 15 with ClassificationService

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

the class QueryClassificationWithPaginationAccTest method testListOffsetAndLimitOutOfBounds.

@Test
public void testListOffsetAndLimitOutOfBounds() throws NotAuthorizedException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    // both will be 0, working
    List<ClassificationSummary> results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").list(-1, -3);
    assertThat(results.size(), equalTo(0));
    // limit will be 0
    results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").list(1, -3);
    assertThat(results.size(), equalTo(0));
    // offset will be 0
    results = classificationService.createClassificationQuery().domainIn("DOMAIN_A").list(-1, 3);
    assertThat(results.size(), equalTo(3));
}
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