Search in sources :

Example 16 with ClassificationService

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

the class QueryClassificationWithPaginationAccTest method testGetFirstPageOfClassificationQueryWithOffset.

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

Example 17 with ClassificationService

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

the class QueryClassificationAccTest method testGetClassificationsForKeyAndCategories.

@Test
public void testGetClassificationsForKeyAndCategories() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    List<ClassificationSummary> classifications = classificationService.createClassificationQuery().keyIn("T2100", "L10000").categoryIn("EXTERNAL", "MANUAL").list();
    assertNotNull(classifications);
    assertEquals(5, classifications.size());
    List<ClassificationSummary> externCategory = classifications.stream().filter(c -> c.getCategory().equals("EXTERNAL")).collect(Collectors.toList());
    assertEquals(2, externCategory.size());
    List<ClassificationSummary> manualCategory = classifications.stream().filter(c -> c.getCategory().equals("MANUAL")).collect(Collectors.toList());
    assertEquals(3, manualCategory.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 18 with ClassificationService

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

the class QueryClassificationAccTest method testFindClassificationsByPriorityAndValidInDomain.

@Test
public void testFindClassificationsByPriorityAndValidInDomain() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    List<ClassificationSummary> list = classificationService.createClassificationQuery().validInDomainEquals(Boolean.TRUE).priorityIn(1, 2, 3).list();
    assertEquals(14, list.size());
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 19 with ClassificationService

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

the class QueryClassificationAccTest method testGetOneClassificationForMultipleDomains.

@Test
public void testGetOneClassificationForMultipleDomains() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    List<ClassificationSummary> classifications = classificationService.createClassificationQuery().keyIn("L10000").domainIn("DOMAIN_A", "DOMAIN_B", "").list();
    assertNotNull(classifications);
    assertEquals(2, classifications.size());
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Example 20 with ClassificationService

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

the class QueryClassificationAccTest method testGetClassificationsWithCustom1.

@Test
public void testGetClassificationsWithCustom1() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    List<ClassificationSummary> classifications = classificationService.createClassificationQuery().custom1Like("VNR,RVNR,KOLVNR", "VNR").domainIn("DOMAIN_A").list();
    assertNotNull(classifications);
    assertEquals(14, classifications.size());
}
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