Search in sources :

Example 6 with ClassificationSummary

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

the class ClassificationServiceImplIntAutoCommitTest method testFindWithClassificationMapperDomainAndCategory.

@Test
public void testFindWithClassificationMapperDomainAndCategory() throws ClassificationAlreadyExistException, NotAuthorizedException, ClassificationNotFoundException, DomainNotFoundException, InvalidArgumentException {
    Classification classification1 = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
    classification1.setCategory("EXTERNAL");
    classificationService.createClassification(classification1);
    Classification classification2 = this.createDummyClassificationWithUniqueKey("DOMAIN_B", "TASK");
    classification2.setCategory("EXTERNAL");
    classificationService.createClassification(classification2);
    Classification classification3 = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
    classification3.setCategory("MANUAL");
    classificationService.createClassification(classification3);
    List<ClassificationSummary> list = classificationService.createClassificationQuery().categoryIn("EXTERNAL").domainIn("DOMAIN_A").list();
    Assert.assertEquals(1, list.size());
    list = classificationService.createClassificationQuery().domainIn("DOMAIN_A", "DOMAIN_C").list();
    Assert.assertEquals(2, list.size());
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) Classification(pro.taskana.Classification) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 7 with ClassificationSummary

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

the class ClassificationServiceImplIntAutoCommitTest method testFindWithClassificationMapperServiceLevelNameAndDescription.

@Test
public void testFindWithClassificationMapperServiceLevelNameAndDescription() throws ClassificationAlreadyExistException, NotAuthorizedException, ClassificationNotFoundException, DomainNotFoundException, InvalidArgumentException {
    int all = 0;
    Classification classification = this.createDummyClassificationWithUniqueKey("", "TASK");
    classification.setServiceLevel("P1D");
    classification.setName("name1");
    classification.setDescription("desc");
    classificationService.createClassification(classification);
    all++;
    Classification classification1 = this.createDummyClassificationWithUniqueKey("", "TASK");
    classification1.setServiceLevel("P1DT1H");
    classification1.setName("name1");
    classification1.setDescription("desc");
    classificationService.createClassification(classification1);
    all++;
    Classification classification2 = this.createDummyClassificationWithUniqueKey("", "TASK");
    classification2.setServiceLevel("P1D");
    classification2.setName("name");
    classification2.setDescription("desc");
    classificationService.createClassification(classification2);
    all++;
    Classification classification3 = this.createDummyClassificationWithUniqueKey("", "TASK");
    classification3.setName("name1");
    classification3.setDescription("description");
    classificationService.createClassification(classification3);
    all++;
    List<ClassificationSummary> list = classificationService.createClassificationQuery().nameIn("name").list();
    Assert.assertEquals(1, list.size());
    list = classificationService.createClassificationQuery().serviceLevelIn("P1D").descriptionLike("desc").list();
    Assert.assertEquals(2, list.size());
    list = classificationService.createClassificationQuery().serviceLevelIn("P1DT1H").nameIn("name").list();
    Assert.assertEquals(0, list.size());
    list = classificationService.createClassificationQuery().descriptionLike("desc%").list();
    Assert.assertEquals(all, list.size());
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) Classification(pro.taskana.Classification) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 8 with ClassificationSummary

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

the class ClassificationServiceImplIntAutoCommitTest method testUpdateAndClassificationMapper.

@Test
public void testUpdateAndClassificationMapper() throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException, ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
    Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
    classification = classificationService.createClassification(classification);
    classification.setDescription("description");
    classification = classificationService.updateClassification(classification);
    List<ClassificationSummary> list = classificationService.createClassificationQuery().validInDomainEquals(true).list();
    Assert.assertEquals(1, list.size());
    classification = classificationService.updateClassification(classification);
    list = classificationService.createClassificationQuery().list();
    Assert.assertEquals(2, list.size());
    List<ClassificationSummary> allClassifications = classificationService.createClassificationQuery().list();
    Assert.assertEquals(2, allClassifications.size());
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) Classification(pro.taskana.Classification) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 9 with ClassificationSummary

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

the class ClassificationServiceImplIntAutoCommitTest method testDefaultSettingsWithClassificationMapper.

@Test
public void testDefaultSettingsWithClassificationMapper() throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException, ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
    Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
    classification = classificationService.createClassification(classification);
    Classification classification1 = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
    classification1 = classificationService.createClassification(classification1);
    classification1.setParentId(classification.getId());
    classification1 = classificationService.updateClassification(classification1);
    List<ClassificationSummary> list = classificationService.createClassificationQuery().parentIdIn("").list();
    Assert.assertEquals(3, list.size());
    list = classificationService.createClassificationQuery().list();
    Assert.assertEquals(4, list.size());
    List<ClassificationSummary> listAll = classificationService.createClassificationQuery().list();
    list = classificationService.createClassificationQuery().list();
    Assert.assertEquals(listAll.size(), list.size());
    list = classificationService.createClassificationQuery().validInDomainEquals(true).list();
    Assert.assertEquals(2, list.size());
    list = classificationService.createClassificationQuery().createdWithin(today()).list();
    Assert.assertEquals(4, list.size());
    list = classificationService.createClassificationQuery().domainIn("DOMAIN_C").validInDomainEquals(false).list();
    Assert.assertEquals(0, list.size());
    list = classificationService.createClassificationQuery().list();
    Assert.assertEquals(4, list.size());
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) Classification(pro.taskana.Classification) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 10 with ClassificationSummary

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

the class QueryClassificationAccTest method testGetClassificationsWithParentKey.

@Test
public void testGetClassificationsWithParentKey() throws SQLException, ClassificationNotFoundException, NotAuthorizedException, InvalidArgumentException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    List<ClassificationSummary> classifications = classificationService.createClassificationQuery().keyIn("A12", "A13").categoryIn("EXTERNAL", "MANUAL").parentIdIn("CLI:100000000000000000000000000000000014").list();
    assertNotNull(classifications);
    assertEquals(1, classifications.size());
    classifications = classificationService.createClassificationQuery().keyIn("A12", "A13").categoryIn("EXTERNAL", "MANUAL", "AUTOMATIC").parentIdIn("CLI:100000000000000000000000000000000014", "CLI:100000000000000000000000000000000010", "CLI:100000000000000000000000000000000011").domainIn("DOMAIN_A").list();
    assertNotNull(classifications);
    assertEquals(2, classifications.size());
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) ClassificationService(pro.taskana.ClassificationService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test)

Aggregations

ClassificationSummary (pro.taskana.ClassificationSummary)51 Test (org.junit.Test)38 AbstractAccTest (acceptance.AbstractAccTest)21 Classification (pro.taskana.Classification)20 ClassificationService (pro.taskana.ClassificationService)20 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)14 Connection (java.sql.Connection)7 Attachment (pro.taskana.Attachment)7 Duration (java.time.Duration)5 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)5 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 Task (pro.taskana.Task)4 ClassificationNotFoundException (pro.taskana.exceptions.ClassificationNotFoundException)4 SystemException (pro.taskana.exceptions.SystemException)4 WithAccessId (pro.taskana.security.WithAccessId)4 PersistenceException (org.apache.ibatis.exceptions.PersistenceException)3 SQLException (java.sql.SQLException)2