Search in sources :

Example 26 with Classification

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

the class ClassificationServiceImplIntAutoCommitTest method testInsertAndClassificationMapper.

@Test
public void testInsertAndClassificationMapper() throws NotAuthorizedException, ClassificationAlreadyExistException, ClassificationNotFoundException, InvalidArgumentException, DomainNotFoundException {
    Classification classification = this.createDummyClassificationWithUniqueKey("DOMAIN_A", "TASK");
    classification = classificationService.createClassification(classification);
    List<ClassificationSummary> list = classificationService.createClassificationQuery().validInDomainEquals(Boolean.TRUE).createdWithin(today()).list();
    Assert.assertEquals(1, list.size());
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) Classification(pro.taskana.Classification) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 27 with Classification

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

the class ClassificationServiceImplIntAutoCommitTest method testFindAllClassifications.

@Test
public void testFindAllClassifications() throws ClassificationAlreadyExistException, NotAuthorizedException, ClassificationNotFoundException, DomainNotFoundException, InvalidArgumentException {
    Classification classification0 = this.createDummyClassificationWithUniqueKey("", "TASK");
    classificationService.createClassification(classification0);
    Classification classification1 = this.createDummyClassificationWithUniqueKey("", "TASK");
    classificationService.createClassification(classification1);
    Classification classification2 = this.createDummyClassificationWithUniqueKey("", "TASK");
    classification2.setParentId(classification0.getId());
    classificationService.createClassification(classification2);
    Assert.assertEquals(2 + 1, classificationService.createClassificationQuery().list().size());
}
Also used : Classification(pro.taskana.Classification) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 28 with Classification

use of pro.taskana.Classification 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 29 with Classification

use of pro.taskana.Classification 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 30 with Classification

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

the class ClassificationServiceImplIntAutoCommitTest method createDummyClassificationWithUniqueKey.

private Classification createDummyClassificationWithUniqueKey(String domain, String type) throws NotAuthorizedException {
    Classification classification = classificationService.newClassification("TEST" + counter, domain, type);
    counter++;
    return classification;
}
Also used : Classification(pro.taskana.Classification)

Aggregations

Classification (pro.taskana.Classification)102 Test (org.junit.Test)88 Task (pro.taskana.Task)32 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)29 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)28 AbstractAccTest (acceptance.AbstractAccTest)23 WithAccessId (pro.taskana.security.WithAccessId)21 ClassificationSummary (pro.taskana.ClassificationSummary)20 Workbasket (pro.taskana.Workbasket)18 Connection (java.sql.Connection)14 ClassificationNotFoundException (pro.taskana.exceptions.ClassificationNotFoundException)14 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)13 TaskAlreadyExistException (pro.taskana.exceptions.TaskAlreadyExistException)11 ClassificationService (pro.taskana.ClassificationService)10 AttachmentPersistenceException (pro.taskana.exceptions.AttachmentPersistenceException)10 ConcurrencyException (pro.taskana.exceptions.ConcurrencyException)10 InvalidOwnerException (pro.taskana.exceptions.InvalidOwnerException)10 InvalidStateException (pro.taskana.exceptions.InvalidStateException)10 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)10 SystemException (pro.taskana.exceptions.SystemException)10