use of pro.taskana.ClassificationSummary 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.ClassificationSummary 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.ClassificationSummary 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.ClassificationSummary in project taskana by Taskana.
the class UpdateTaskAccTest method testUpdateClassificationOfTask.
@WithAccessId(userName = "user_1_1", groupNames = { "group_1" })
@Test
public void testUpdateClassificationOfTask() throws TaskNotFoundException, WorkbasketNotFoundException, ClassificationNotFoundException, InvalidArgumentException, ConcurrencyException, InvalidWorkbasketException, NotAuthorizedException, AttachmentPersistenceException {
TaskService taskService = taskanaEngine.getTaskService();
Task task = taskService.getTask("TKI:000000000000000000000000000000000000");
ClassificationSummary classificationSummary = task.getClassificationSummary();
task.setClassificationKey("T2100");
Task updatedTask = taskService.updateTask(task);
updatedTask = taskService.getTask(updatedTask.getId());
assertNotNull(updatedTask);
assertEquals("T2100", updatedTask.getClassificationSummary().getKey());
assertThat(updatedTask.getClassificationSummary(), not(equalTo(classificationSummary)));
assertNotEquals(updatedTask.getCreated(), updatedTask.getModified());
assertEquals(task.getPlanned(), updatedTask.getPlanned());
assertEquals(task.getName(), updatedTask.getName());
assertEquals(task.getDescription(), updatedTask.getDescription());
}
use of pro.taskana.ClassificationSummary in project taskana by Taskana.
the class ClassificationQueryImplTest method should_ReturnOneItem_when_BuilderIsUsed.
@Test
public void should_ReturnOneItem_when_BuilderIsUsed() throws NotAuthorizedException, InvalidArgumentException {
when(taskanaEngine.getSqlSession()).thenReturn(sqlSession);
when(sqlSession.selectOne(any(), any())).thenReturn(new ClassificationSummaryImpl());
ClassificationSummary result = classificationQueryImpl.nameIn("test", "asd", "blubber").typeIn("cool", "bla").priorityIn(1, 2).parentIdIn("superId").single();
Assert.assertNotNull(result);
}
Aggregations