use of pro.taskana.Classification 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());
}
use of pro.taskana.Classification 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());
}
use of pro.taskana.Classification in project taskana by Taskana.
the class TaskServiceImplIntAutocommitTest method should_ReturnList_when_BuilderIsUsed.
@Test
public void should_ReturnList_when_BuilderIsUsed() throws SQLException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, SystemException, WorkbasketAlreadyExistException, DomainNotFoundException {
Workbasket wb = workbasketService.newWorkbasket("key", "DOMAIN_A");
wb.setName("workbasket");
wb.setType(WorkbasketType.GROUP);
taskanaEngine.getWorkbasketService().createWorkbasket(wb);
Classification classification = classificationService.newClassification("TEST", "DOMAIN_A", "TASK");
taskanaEngine.getClassificationService().createClassification(classification);
Task task = taskServiceImpl.newTask(wb.getKey(), wb.getDomain());
task.setName("Unit Test Task");
task.setClassificationKey(classification.getKey());
task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
taskServiceImpl.createTask(task);
List<TaskSummary> results = taskServiceImpl.createTaskQuery().nameIn("bla", "test").descriptionLike("test").priorityIn(1, 2, 2).stateIn(TaskState.CLAIMED).workbasketKeyDomainIn(new KeyDomain("asd", "novatec"), new KeyDomain("asdasdasd", "DOMAIN_A")).ownerIn("test", "test2", "bla").customAttributeIn("16", "test").classificationKeyIn("pId1", "pId2").primaryObjectReferenceCompanyIn("first comp", "sonstwo gmbh").primaryObjectReferenceSystemIn("sys").primaryObjectReferenceTypeIn("type1", "type2").primaryObjectReferenceSystemInstanceIn("sysInst1", "sysInst2").primaryObjectReferenceValueIn("val1", "val2", "val3").list();
Assert.assertEquals(0, results.size());
}
use of pro.taskana.Classification in project taskana by Taskana.
the class DeleteClassificationAccTest method testThrowExceptionWhenChildClassificationIsInUseAndRollback.
@WithAccessId(userName = "teamlead_1", groupNames = { "group_1", "businessadmin" })
@Test
public void testThrowExceptionWhenChildClassificationIsInUseAndRollback() throws ClassificationInUseException, NotAuthorizedException, ClassificationNotFoundException {
boolean classificationInUse = false;
try {
classificationService.deleteClassification("L11010", "DOMAIN_A");
} catch (ClassificationInUseException e) {
classificationInUse = true;
}
Classification rollback = classificationService.getClassification("L11010", "DOMAIN_A");
assertTrue(classificationInUse);
assertEquals("DOMAIN_A", rollback.getDomain());
classificationInUse = false;
try {
classificationService.deleteClassification("L11010", "");
} catch (ClassificationInUseException e) {
classificationInUse = true;
}
Classification rollbackMaster = classificationService.getClassification("L11010", "");
Classification rollbackA = classificationService.getClassification("L11010", "DOMAIN_A");
assertTrue(classificationInUse);
assertEquals(rollbackMaster.getKey(), rollbackA.getKey());
assertNotEquals(rollbackMaster.getDomain(), rollbackA.getDomain());
}
use of pro.taskana.Classification in project taskana by Taskana.
the class ClassificationServiceImplIntExplicitTest method testFindWithClassificationMapperServiceLevelNameAndDescription.
@Test
public void testFindWithClassificationMapperServiceLevelNameAndDescription() throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException, ClassificationNotFoundException, DomainNotFoundException, InvalidArgumentException {
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
int all = 0;
Classification classification = this.createNewClassificationWithUniqueKey("", "TASK");
classification.setServiceLevel("P1D");
classification.setName("name1");
classification.setDescription("desc");
classificationService.createClassification(classification);
all++;
Classification classification1 = this.createNewClassificationWithUniqueKey("", "TASK");
classification1.setServiceLevel("P1DT1H");
classification1.setName("name1");
classification1.setDescription("desc");
classificationService.createClassification(classification1);
all++;
Classification classification2 = this.createNewClassificationWithUniqueKey("", "TASK");
classification2.setServiceLevel("P1D");
classification2.setName("name");
classification2.setDescription("desc");
classificationService.createClassification(classification2);
all++;
Classification classification3 = this.createNewClassificationWithUniqueKey("", "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());
connection.commit();
}
Aggregations