use of pro.taskana.Classification in project taskana by Taskana.
the class ClassificationServiceImplIntExplicitTest method createNewClassificationWithUniqueKey.
private Classification createNewClassificationWithUniqueKey(String domain, String type) throws NotAuthorizedException {
Classification classification = classificationService.newClassification("TEST" + counter, domain, type);
counter++;
return classification;
}
use of pro.taskana.Classification in project taskana by Taskana.
the class ClassificationServiceImplIntExplicitTest method testUpdateAndClassificationQuery.
@Test
public void testUpdateAndClassificationQuery() throws NotAuthorizedException, SQLException, ClassificationAlreadyExistException, ClassificationNotFoundException, ConcurrencyException, DomainNotFoundException, InvalidArgumentException {
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
Classification classification = this.createNewClassificationWithUniqueKey("DOMAIN_A", "TASK");
classification.setDescription("");
classification = classificationService.createClassification(classification);
classification.setDescription("description");
classification = classificationService.updateClassification(classification);
List<ClassificationSummary> list = classificationService.createClassificationQuery().list();
Assert.assertEquals(2, list.size());
list = classificationService.createClassificationQuery().validInDomainEquals(true).list();
Assert.assertEquals(1, list.size());
classification = classificationService.getClassification(classification.getKey(), classification.getDomain());
assertThat(classification.getDescription(), equalTo("description"));
classification = classificationService.updateClassification(classification);
list = classificationService.createClassificationQuery().list();
Assert.assertEquals(2, list.size());
List<ClassificationSummary> allClassifications = classificationService.createClassificationQuery().list();
Assert.assertEquals(2, allClassifications.size());
connection.commit();
}
use of pro.taskana.Classification in project taskana by Taskana.
the class ClassificationServiceImplIntExplicitTest method testFindWithClassificationMapperCustomAndCategory.
@Test
public void testFindWithClassificationMapperCustomAndCategory() throws SQLException, ClassificationAlreadyExistException, NotAuthorizedException, ClassificationNotFoundException, DomainNotFoundException, InvalidArgumentException {
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
Classification classification1 = this.createNewClassificationWithUniqueKey("", "TASK");
classification1.setDescription("DESC1");
classification1.setCategory("EXTERNAL");
classificationService.createClassification(classification1);
Classification classification2 = this.createNewClassificationWithUniqueKey("", "TASK");
classification2.setDescription("DESC1");
classification2.setCustom1("custom1");
classification2.setCategory("EXTERNAL");
classificationService.createClassification(classification2);
Classification classification3 = this.createNewClassificationWithUniqueKey("", "TASK");
classification3.setCustom1("custom2");
classification3.setCustom2("custom1");
classification3.setCategory("MANUAL");
classificationService.createClassification(classification3);
Classification classification4 = this.createNewClassificationWithUniqueKey("", "TASK");
classification4.setDescription("description2");
classification4.setCustom8("custom2");
classification4.setCategory("EXTERNAL");
classificationService.createClassification(classification4);
List<ClassificationSummary> list = classificationService.createClassificationQuery().descriptionLike("DESC1").custom1In("custom1").list();
Assert.assertEquals(1, list.size());
list = classificationService.createClassificationQuery().custom1In("custom2").list();
Assert.assertEquals(1, list.size());
list = classificationService.createClassificationQuery().descriptionLike("DESC1").categoryIn("EXTERNAL").list();
Assert.assertEquals(2, list.size());
connection.commit();
}
use of pro.taskana.Classification in project taskana by Taskana.
the class ClassificationServiceImplIntExplicitTest method testFindWithClassificationMapperDomainAndCategory.
@Test
public void testFindWithClassificationMapperDomainAndCategory() throws SQLException, ClassificationAlreadyExistException, NotAuthorizedException, ClassificationNotFoundException, DomainNotFoundException, InvalidArgumentException {
Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection);
Classification classification1 = this.createNewClassificationWithUniqueKey("DOMAIN_A", "TASK");
classification1.setCategory("EXTERNAL");
classificationService.createClassification(classification1);
Classification classification2 = this.createNewClassificationWithUniqueKey("DOMAIN_B", "TASK");
classification2.setCategory("EXTERNAL");
classificationService.createClassification(classification2);
Classification classification3 = this.createNewClassificationWithUniqueKey("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", "domain3").list();
Assert.assertEquals(2, list.size());
connection.commit();
}
use of pro.taskana.Classification in project taskana by Taskana.
the class TaskServiceImplIntExplicitTest method generateDummyTask.
private Task generateDummyTask() throws ClassificationAlreadyExistException, ClassificationNotFoundException, WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException, WorkbasketAlreadyExistException, DomainNotFoundException, InvalidArgumentException {
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket("wb", "DOMAIN_A");
workbasket.setName("wb");
// set id manually for authorization tests
workbasket.setId("1");
workbasket.setType(WorkbasketType.GROUP);
taskanaEngine.getWorkbasketService().createWorkbasket(workbasket);
Classification classification = classificationService.newClassification("TEST", "DOMAIN_A", "TASK");
taskanaEngine.getClassificationService().createClassification(classification);
Task task = taskServiceImpl.newTask(workbasket.getId());
task.setClassificationKey(classification.getKey());
return task;
}
Aggregations