Search in sources :

Example 16 with ClassificationSummary

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();
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) Classification(pro.taskana.Classification) Connection(java.sql.Connection) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 17 with ClassificationSummary

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();
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) Classification(pro.taskana.Classification) Connection(java.sql.Connection) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 18 with ClassificationSummary

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();
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) Classification(pro.taskana.Classification) Connection(java.sql.Connection) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 19 with ClassificationSummary

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());
}
Also used : Task(pro.taskana.Task) ClassificationSummary(pro.taskana.ClassificationSummary) TaskService(pro.taskana.TaskService) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 20 with ClassificationSummary

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);
}
Also used : ClassificationSummary(pro.taskana.ClassificationSummary) Test(org.junit.Test)

Aggregations

ClassificationSummary (pro.taskana.ClassificationSummary)51 Test (org.junit.Test)38 AbstractAccTest (acceptance.AbstractAccTest)21 Classification (pro.taskana.Classification)20 ClassificationService (pro.taskana.ClassificationService)20 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)14 Connection (java.sql.Connection)7 Attachment (pro.taskana.Attachment)7 Duration (java.time.Duration)5 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)5 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 Task (pro.taskana.Task)4 ClassificationNotFoundException (pro.taskana.exceptions.ClassificationNotFoundException)4 SystemException (pro.taskana.exceptions.SystemException)4 WithAccessId (pro.taskana.security.WithAccessId)4 PersistenceException (org.apache.ibatis.exceptions.PersistenceException)3 SQLException (java.sql.SQLException)2