Search in sources :

Example 96 with Classification

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

the class CreateClassificationAccTest method testCreateClassificationOfUnknownCategory.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test(expected = InvalidArgumentException.class)
public void testCreateClassificationOfUnknownCategory() throws ClassificationAlreadyExistException, NotAuthorizedException, ClassificationNotFoundException, DomainNotFoundException, InvalidArgumentException {
    Classification classification = classificationService.newClassification("Key4", "DOMAIN_A", "TASK");
    classification.setCategory("UNKNOWN_CATEGORY");
    classification = classificationService.createClassification(classification);
}
Also used : Classification(pro.taskana.Classification) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 97 with Classification

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

the class CreateClassificationAccTest method testCreateClassificationWithRootCopy.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test
public void testCreateClassificationWithRootCopy() throws ClassificationAlreadyExistException, ClassificationNotFoundException, NotAuthorizedException, DomainNotFoundException, InvalidArgumentException {
    long amountOfClassificationsBefore = classificationService.createClassificationQuery().count();
    Classification classification = classificationService.newClassification("Key1", "DOMAIN_A", "TASK");
    classification.setIsValidInDomain(true);
    classification = classificationService.createClassification(classification);
    // Check returning one is the "original"
    Classification createdClassification = classificationService.getClassification(classification.getId());
    assertNotNull(createdClassification.getId());
    assertNotNull(createdClassification.getCreated());
    assertNotNull(createdClassification.getModified());
    assertThat(createdClassification.getIsValidInDomain(), equalTo(true));
    assertThat(createdClassification.getDomain(), equalTo("DOMAIN_A"));
    // Check 2 new created
    long amountOfClassificationsAfter = classificationService.createClassificationQuery().count();
    assertThat(amountOfClassificationsAfter, equalTo(amountOfClassificationsBefore + 2));
    // Check main
    classification = classificationService.getClassification(classification.getId());
    assertNotNull(classification);
    assertNotNull(classification.getCreated());
    assertNotNull(classification.getModified());
    assertNotNull(classification.getId());
    assertThat(classification.getIsValidInDomain(), equalTo(true));
    // Check root-copy
    classification = classificationService.getClassification(classification.getKey(), "");
    assertNotNull(classification);
    assertNotNull(classification.getCreated());
    assertNotNull(classification.getModified());
    assertNotNull(classification.getId());
    assertThat(classification.getIsValidInDomain(), equalTo(false));
}
Also used : Classification(pro.taskana.Classification) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 98 with Classification

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

the class CreateClassificationAccTest method testCreateClassificationWithInvalidValues.

@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test
public void testCreateClassificationWithInvalidValues() throws ClassificationAlreadyExistException, NotAuthorizedException, ClassificationNotFoundException, DomainNotFoundException, InvalidArgumentException {
    long amountOfClassificationsBefore = classificationService.createClassificationQuery().count();
    // Check key NULL
    try {
        Classification classification = classificationService.newClassification(null, "DOMAIN_A", "TASK");
        classification = classificationService.createClassification(classification);
    } catch (InvalidArgumentException e) {
    // nothing to do
    }
    // Check invalid ServiceLevel
    try {
        Classification classification = classificationService.newClassification("Key2", "DOMAIN_B", "TASK");
        classification.setServiceLevel("abc");
        classification = classificationService.createClassification(classification);
    } catch (InvalidArgumentException e) {
    // nothing to do
    }
}
Also used : InvalidArgumentException(pro.taskana.exceptions.InvalidArgumentException) Classification(pro.taskana.Classification) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 99 with Classification

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

the class GetClassificationAccTest method testGetOneClassificationForDomainAndGetClassificationFromRootDomain.

@Test
public void testGetOneClassificationForDomainAndGetClassificationFromRootDomain() throws ClassificationNotFoundException {
    ClassificationService classificationService = taskanaEngine.getClassificationService();
    Classification classification = classificationService.getClassification("L10000", "DOMAIN_B");
    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 100 with Classification

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

the class GetClassificationAccTest method testGetOneClassificationForDomain.

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

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