Search in sources :

Example 36 with Classification

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;
}
Also used : Classification(pro.taskana.Classification)

Example 37 with 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();
}
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 38 with Classification

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();
}
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 39 with Classification

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();
}
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 40 with Classification

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;
}
Also used : Task(pro.taskana.Task) Classification(pro.taskana.Classification) WorkbasketImpl(pro.taskana.impl.WorkbasketImpl)

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