Search in sources :

Example 11 with TaskDefinition

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

the class AbstractStoreManagerTest method nativeLoadCarList.

protected final DtList<Car> nativeLoadCarList() {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final Domain doCarList = definitionSpace.resolve("DO_DT_CAR_DTC", Domain.class);
    final TaskDefinition taskDefinition = TaskDefinition.builder("TK_LOAD_ALL_CARS").withEngine(TaskEngineSelect.class).withRequest("select * from CAR").withOutRequired("dtc", doCarList).build();
    final Task task = Task.builder(taskDefinition).build();
    return taskManager.execute(task).getResult();
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Task(io.vertigo.dynamo.task.model.Task) TaskEngineSelect(io.vertigo.dynamox.task.TaskEngineSelect) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Domain(io.vertigo.dynamo.domain.metamodel.Domain)

Example 12 with TaskDefinition

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

the class OracleSqlStoreManagerTest method nativeInsertCar.

@Override
protected void nativeInsertCar(final Car car) {
    Assertion.checkArgument(car.getId() == null, "L'id n'est pas null {0}", car.getId());
    // -----
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final Domain doCar = definitionSpace.resolve("DO_DT_CAR_DTO", Domain.class);
    final TaskDefinition taskDefinition = TaskDefinition.builder("TK_INSERT_CAR").withEngine(TaskEngineProc.class).withRequest("insert into CAR (ID, FAM_ID,MAKE, MODEL, DESCRIPTION, YEAR, KILO, PRICE, MOTOR_TYPE) values " + "(SEQ_CAR.nextval, #DTO_CAR.FAM_ID#, #DTO_CAR.MAKE#, #DTO_CAR.MODEL#, #DTO_CAR.DESCRIPTION#, #DTO_CAR.YEAR#, #DTO_CAR.KILO#, #DTO_CAR.PRICE#, #DTO_CAR.MOTOR_TYPE#)").addInRequired("DTO_CAR", doCar).build();
    final Task task = Task.builder(taskDefinition).addValue("DTO_CAR", car).build();
    final TaskResult taskResult = taskManager.execute(task);
    nop(taskResult);
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Task(io.vertigo.dynamo.task.model.Task) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) TaskEngineProc(io.vertigo.dynamox.task.TaskEngineProc) TaskResult(io.vertigo.dynamo.task.model.TaskResult) Domain(io.vertigo.dynamo.domain.metamodel.Domain)

Example 13 with TaskDefinition

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

the class ItemSearchLoader method loadItems.

private DtList<Item> loadItems(final SearchChunk<Item> searchChunk) {
    final TaskDefinition taskDefinition = getTaskDefinition(searchChunk);
    final Task task = Task.builder(taskDefinition).build();
    return getTaskManager().execute(task).getResult();
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Task(io.vertigo.dynamo.task.model.Task)

Example 14 with TaskDefinition

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

the class TaskManagerTest method testExecuteMulti.

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

Example 15 with TaskDefinition

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

the class TaskManagerTest method testExecuteNull.

/**
 * Checks that an exception is thrown
 * when a null is given to a required task
 */
@Test(expected = NullPointerException.class)
public void testExecuteNull() {
    final TaskDefinition taskDefinition = getTaskDefinition(TaskDefinitionProvider.TK_MULTIPLICATION);
    // on vérifie que le passage d'un paramètre null déclenche une assertion
    executeTask(taskDefinition, null, 2, 3);
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) 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