Search in sources :

Example 31 with Classification

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

Example 32 with Classification

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

Example 33 with Classification

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());
}
Also used : Task(pro.taskana.Task) Classification(pro.taskana.Classification) TaskSummary(pro.taskana.TaskSummary) Workbasket(pro.taskana.Workbasket) KeyDomain(pro.taskana.KeyDomain) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 34 with Classification

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

Example 35 with Classification

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

Aggregations

Classification (pro.taskana.Classification)102 Test (org.junit.Test)88 Task (pro.taskana.Task)32 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)29 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)28 AbstractAccTest (acceptance.AbstractAccTest)23 WithAccessId (pro.taskana.security.WithAccessId)21 ClassificationSummary (pro.taskana.ClassificationSummary)20 Workbasket (pro.taskana.Workbasket)18 Connection (java.sql.Connection)14 ClassificationNotFoundException (pro.taskana.exceptions.ClassificationNotFoundException)14 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)13 TaskAlreadyExistException (pro.taskana.exceptions.TaskAlreadyExistException)11 ClassificationService (pro.taskana.ClassificationService)10 AttachmentPersistenceException (pro.taskana.exceptions.AttachmentPersistenceException)10 ConcurrencyException (pro.taskana.exceptions.ConcurrencyException)10 InvalidOwnerException (pro.taskana.exceptions.InvalidOwnerException)10 InvalidStateException (pro.taskana.exceptions.InvalidStateException)10 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)10 SystemException (pro.taskana.exceptions.SystemException)10