Search in sources :

Example 31 with TaskDefinition

use of io.vertigo.dynamo.task.metamodel.TaskDefinition in project vertigo by KleeGroup.

the class TaskManagerTest method testExecuteAdd.

/**
 * Checks the use case of an addition  with several inputs and an output
 */
@Test
public void testExecuteAdd() {
    final TaskDefinition taskDefinition = getTaskDefinition(TaskDefinitionProvider.TK_ADDITION);
    Assert.assertEquals(Integer.valueOf(10), executeTask(taskDefinition, 5, 2, 3));
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Test(org.junit.Test)

Example 32 with TaskDefinition

use of io.vertigo.dynamo.task.metamodel.TaskDefinition in project vertigo by KleeGroup.

the class TaskManagerTest method testExecuteMulti2.

/**
 * Checks the use case of an multiplication with one input and an output
 * the input is composed with a List.
 */
@Test
public void testExecuteMulti2() {
    final TaskDefinition taskDefinition = getTaskDefinition(TaskDefinitionProvider.TK_MULTIPLICATION_2);
    Assert.assertEquals(Integer.valueOf(30), executeTask2(taskDefinition, 5, 2, 3));
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Test(org.junit.Test)

Example 33 with TaskDefinition

use of io.vertigo.dynamo.task.metamodel.TaskDefinition in project vertigo by KleeGroup.

the class TaskManagerTest method testExecuteAdd2.

/**
 * Checks the use case of an addition  with one input and an output
 * the input is composed with a List.
 */
@Test
public void testExecuteAdd2() {
    final TaskDefinition taskDefinition = getTaskDefinition(TaskDefinitionProvider.TK_ADDITION_2);
    Assert.assertEquals(Integer.valueOf(10), executeTask2(taskDefinition, 5, 2, 3));
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Test(org.junit.Test)

Example 34 with TaskDefinition

use of io.vertigo.dynamo.task.metamodel.TaskDefinition in project vertigo by KleeGroup.

the class SuperHeroDataBase method execStatement.

private void execStatement(final String request) {
    final TaskDefinition taskDefinition = TaskDefinition.builder("TK_INIT").withEngine(TaskEngineProc.class).withRequest(request).build();
    final Task task = Task.builder(taskDefinition).build();
    taskManager.execute(task);
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Task(io.vertigo.dynamo.task.model.Task)

Example 35 with TaskDefinition

use of io.vertigo.dynamo.task.metamodel.TaskDefinition in project vertigo by KleeGroup.

the class TaskEngineProcBatchTest method testInsertBatchWithAdditionalParam.

/**
 * Tests batch insertion with a task
 */
@Test
public void testInsertBatchWithAdditionalParam() {
    final String request = new StringBuilder("insert into SUPER_HERO(ID, NAME) values (").append("#").append(DTC_SUPER_HERO_IN + ".ID").append("# , ").append("#").append(OTHER_PARAM_IN).append("# ) ").toString();
    final TaskDefinition taskDefinition = TaskDefinition.builder("TK_TEST_INSERT_BATCH").withEngine(TaskEngineProcBatch.class).addInRequired(DTC_SUPER_HERO_IN, getApp().getDefinitionSpace().resolve(DO_DT_SUPER_HERO_DTC, Domain.class)).addInRequired(OTHER_PARAM_IN, getApp().getDefinitionSpace().resolve(DO_STRING, Domain.class)).withRequest(request).build();
    final DtList<SuperHero> superHeroes = SuperHeroDataBase.getSuperHeroes();
    final Task task = Task.builder(taskDefinition).addValue(DTC_SUPER_HERO_IN, superHeroes).addValue(OTHER_PARAM_IN, "test").build();
    try (final VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        taskManager.execute(task);
        transaction.commit();
    }
    Assert.assertEquals(superHeroes.size(), selectHeroes().size());
}
Also used : SuperHero(io.vertigo.dynamo.task.data.domain.SuperHero) TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Task(io.vertigo.dynamo.task.model.Task) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable) Domain(io.vertigo.dynamo.domain.metamodel.Domain) Test(org.junit.Test)

Aggregations

TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)52 Task (io.vertigo.dynamo.task.model.Task)39 Test (org.junit.Test)26 VTransactionWritable (io.vertigo.commons.transaction.VTransactionWritable)24 SuperHero (io.vertigo.dynamo.task.data.domain.SuperHero)17 Domain (io.vertigo.dynamo.domain.metamodel.Domain)11 TaskEngineSelect (io.vertigo.dynamox.task.TaskEngineSelect)11 DtList (io.vertigo.dynamo.domain.model.DtList)10 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)7 DefinitionSpace (io.vertigo.core.definition.DefinitionSpace)6 TaskEngineProc (io.vertigo.dynamox.task.TaskEngineProc)6 ArrayList (java.util.ArrayList)6 DtField (io.vertigo.dynamo.domain.metamodel.DtField)5 List (java.util.List)5 URI (io.vertigo.dynamo.domain.model.URI)4 VTransactionManager (io.vertigo.commons.transaction.VTransactionManager)3 TaskManager (io.vertigo.dynamo.task.TaskManager)3 TaskResult (io.vertigo.dynamo.task.model.TaskResult)3 Collectors (java.util.stream.Collectors)3 Inject (javax.inject.Inject)3