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);
}
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));
}
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
}
}
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());
}
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);
}
Aggregations