Search in sources :

Example 1 with TaskanaEngine

use of pro.taskana.TaskanaEngine in project taskana by Taskana.

the class TaskanaEngineConfigurationTest method testCreateTaskanaEngine.

@Test
public void testCreateTaskanaEngine() throws FileNotFoundException, SQLException, LoginException {
    DataSource ds = getDataSource();
    TaskanaEngineConfiguration taskEngineConfiguration = new TaskanaEngineConfiguration(ds, false);
    TaskanaEngine te = taskEngineConfiguration.buildTaskanaEngine();
    Assert.assertNotNull(te);
}
Also used : TaskanaEngineConfiguration(pro.taskana.configuration.TaskanaEngineConfiguration) TaskanaEngine(pro.taskana.TaskanaEngine) PooledDataSource(org.apache.ibatis.datasource.pooled.PooledDataSource) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Example 2 with TaskanaEngine

use of pro.taskana.TaskanaEngine in project taskana by Taskana.

the class TaskServiceImplIntExplicitTest method testCreateTask.

@WithAccessId(userName = "Elena", groupNames = { "businessadmin" })
@Test
public void testCreateTask() throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
    Connection connection = dataSource.getConnection();
    taskanaEngineImpl.setConnection(connection);
    generateSampleAccessItems();
    Task task = this.generateDummyTask();
    connection.commit();
    WorkbasketAccessItem accessItem = workbasketService.newWorkbasketAccessItem("wb", "Elena");
    accessItem.setPermAppend(true);
    accessItem.setPermRead(true);
    accessItem.setPermOpen(true);
    workbasketService.createWorkbasketAccessItem(accessItem);
    task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
    task = taskServiceImpl.createTask(task);
    // needed so that the change is visible in the other session
    connection.commit();
    TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
    TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
    Task resultTask = taskServiceImpl2.getTask(task.getId());
    Assert.assertNotNull(resultTask);
    connection.commit();
}
Also used : Task(pro.taskana.Task) TaskanaEngine(pro.taskana.TaskanaEngine) WorkbasketAccessItem(pro.taskana.WorkbasketAccessItem) Connection(java.sql.Connection) TaskServiceImpl(pro.taskana.impl.TaskServiceImpl) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 3 with TaskanaEngine

use of pro.taskana.TaskanaEngine in project taskana by Taskana.

the class TaskServiceImplIntExplicitTest method testCreateTaskInTaskanaWithDefaultDb.

@WithAccessId(userName = "Elena", groupNames = { "businessadmin" })
@Test
public void testCreateTaskInTaskanaWithDefaultDb() throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
    DataSource ds = TaskanaEngineConfiguration.createDefaultDataSource();
    DBCleaner cleaner = new DBCleaner();
    cleaner.clearDb(ds, false);
    TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration(ds, false, false);
    TaskanaEngine te = taskanaEngineConfiguration.buildTaskanaEngine();
    Connection connection = ds.getConnection();
    te.setConnection(connection);
    TaskServiceImpl taskServiceImpl = (TaskServiceImpl) te.getTaskService();
    WorkbasketServiceImpl workBasketServiceImpl = (WorkbasketServiceImpl) te.getWorkbasketService();
    ClassificationServiceImpl classificationServiceImpl = (ClassificationServiceImpl) te.getClassificationService();
    Workbasket workbasket = workbasketService.newWorkbasket("K99", "DOMAIN_A");
    workbasket.setName("workbasket");
    workbasket.setName("workbasket99");
    workbasket.setType(WorkbasketType.GROUP);
    workbasket = workBasketServiceImpl.createWorkbasket(workbasket);
    Classification classification = classificationService.newClassification("TEST", "DOMAIN_A", "TASK");
    classification = classificationServiceImpl.createClassification(classification);
    Task task = taskServiceImpl.newTask(workbasket.getId());
    task.setName("Unit Test Task");
    task.setClassificationKey(classification.getKey());
    task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
    task.addAttachment(null);
    task = taskServiceImpl.createTask(task);
    Assert.assertNotNull(task);
    Assert.assertNotNull(task.getId());
    connection.commit();
    te.setConnection(null);
}
Also used : TaskanaEngineConfiguration(pro.taskana.configuration.TaskanaEngineConfiguration) Task(pro.taskana.Task) ClassificationServiceImpl(pro.taskana.impl.ClassificationServiceImpl) TaskanaEngine(pro.taskana.TaskanaEngine) Classification(pro.taskana.Classification) Connection(java.sql.Connection) TaskServiceImpl(pro.taskana.impl.TaskServiceImpl) WorkbasketServiceImpl(pro.taskana.impl.WorkbasketServiceImpl) DBCleaner(pro.taskana.impl.configuration.DBCleaner) Workbasket(pro.taskana.Workbasket) DataSource(javax.sql.DataSource) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 4 with TaskanaEngine

use of pro.taskana.TaskanaEngine in project taskana by Taskana.

the class TaskServiceImplIntAutocommitTest method testStart.

@Test
public void testStart() throws FileNotFoundException, SQLException, TaskNotFoundException, WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
    Workbasket wb = workbasketService.newWorkbasket("workbasket", "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.getId());
    task.setName("Unit Test Task");
    task.setClassificationKey(classification.getKey());
    task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
    task = taskServiceImpl.createTask(task);
    // skanaEngineImpl.getSqlSession().commit(); // needed so that the change is visible in the other session
    TaskanaEngine te2 = taskanaEngineConfiguration.buildTaskanaEngine();
    TaskServiceImpl taskServiceImpl2 = (TaskServiceImpl) te2.getTaskService();
    Task resultTask = taskServiceImpl2.getTask(task.getId());
    Assert.assertNotNull(resultTask);
}
Also used : Task(pro.taskana.Task) TaskanaEngine(pro.taskana.TaskanaEngine) Classification(pro.taskana.Classification) TaskServiceImpl(pro.taskana.impl.TaskServiceImpl) Workbasket(pro.taskana.Workbasket) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Example 5 with TaskanaEngine

use of pro.taskana.TaskanaEngine in project taskana by Taskana.

the class TaskServiceImplIntAutocommitTest method testCreateTaskInTaskanaWithDefaultDb.

@Test
public void testCreateTaskInTaskanaWithDefaultDb() throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, WorkbasketAlreadyExistException, DomainNotFoundException {
    DBCleaner cleaner = new DBCleaner();
    cleaner.clearDb(TaskanaEngineConfiguration.createDefaultDataSource(), false);
    TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration(null, false, false);
    TaskanaEngine te = taskanaEngineConfiguration.buildTaskanaEngine();
    ((TaskanaEngineImpl) te).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
    TaskServiceImpl taskServiceImpl = (TaskServiceImpl) te.getTaskService();
    Workbasket wb = workbasketService.newWorkbasket("workbasket", "DOMAIN_A");
    wb.setName("workbasket");
    wb.setType(WorkbasketType.GROUP);
    te.getWorkbasketService().createWorkbasket(wb);
    Classification classification = te.getClassificationService().newClassification("TEST", "DOMAIN_A", "TASK");
    te.getClassificationService().createClassification(classification);
    Task task = taskServiceImpl.newTask(wb.getId());
    task.setName("Unit Test Task");
    task.setClassificationKey(classification.getKey());
    task.setPrimaryObjRef(JunitHelper.createDefaultObjRef());
    task = taskServiceImpl.createTask(task);
    Assert.assertNotNull(task);
    Assert.assertNotNull(task.getId());
}
Also used : TaskanaEngineConfiguration(pro.taskana.configuration.TaskanaEngineConfiguration) Task(pro.taskana.Task) TaskanaEngine(pro.taskana.TaskanaEngine) Classification(pro.taskana.Classification) TaskanaEngineImpl(pro.taskana.impl.TaskanaEngineImpl) TaskServiceImpl(pro.taskana.impl.TaskServiceImpl) DBCleaner(pro.taskana.impl.configuration.DBCleaner) Workbasket(pro.taskana.Workbasket) TaskanaEngineConfigurationTest(pro.taskana.impl.configuration.TaskanaEngineConfigurationTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 TaskanaEngine (pro.taskana.TaskanaEngine)5 Task (pro.taskana.Task)4 TaskServiceImpl (pro.taskana.impl.TaskServiceImpl)4 TaskanaEngineConfigurationTest (pro.taskana.impl.configuration.TaskanaEngineConfigurationTest)4 Classification (pro.taskana.Classification)3 Workbasket (pro.taskana.Workbasket)3 TaskanaEngineConfiguration (pro.taskana.configuration.TaskanaEngineConfiguration)3 Connection (java.sql.Connection)2 DataSource (javax.sql.DataSource)2 DBCleaner (pro.taskana.impl.configuration.DBCleaner)2 WithAccessId (pro.taskana.security.WithAccessId)2 PooledDataSource (org.apache.ibatis.datasource.pooled.PooledDataSource)1 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)1 ClassificationServiceImpl (pro.taskana.impl.ClassificationServiceImpl)1 TaskanaEngineImpl (pro.taskana.impl.TaskanaEngineImpl)1 WorkbasketServiceImpl (pro.taskana.impl.WorkbasketServiceImpl)1