Search in sources :

Example 11 with SuperHero

use of io.vertigo.dynamo.task.data.domain.SuperHero in project vertigo by KleeGroup.

the class TaskEngineSelectDynamicTest method testWhereInEmpty.

/**
 * Test exécution d'une tache.
 */
@Test
public void testWhereInEmpty() {
    try (final VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final TaskDefinition taskDefinition = registerTaskList("TK_WHERE_ID_TEST", "select * from SUPER_HERO where ID in (#DTC_SUPER_HERO_IN.ROWNUM.ID#)");
        final DtList<SuperHero> ids = new DtList<>(SuperHero.class);
        final Task task = Task.builder(taskDefinition).addValue(DTC_SUPER_HERO_IN, ids).build();
        final DtList<SuperHero> resultList = taskManager.execute(task).getResult();
        Assert.assertEquals(0, resultList.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) DtList(io.vertigo.dynamo.domain.model.DtList) Test(org.junit.Test)

Example 12 with SuperHero

use of io.vertigo.dynamo.task.data.domain.SuperHero in project vertigo by KleeGroup.

the class TaskEngineSelectDynamicTest method testWhereIn.

/**
 * Test exécution d'une tache.
 */
@Test
public void testWhereIn() {
    try (final VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final TaskDefinition taskDefinition = registerTaskList("TK_WHERE_ID_TEST", "select * from SUPER_HERO  where ID in (#DTC_SUPER_HERO_IN.ROWNUM.ID#)");
        final DtList<SuperHero> ids = DtList.of(createSuperHero(10001L + 1), createSuperHero(10001L + 3));
        final Task task = Task.builder(taskDefinition).addValue(DTC_SUPER_HERO_IN, ids).build();
        final DtList<SuperHero> resultList = taskManager.execute(task).getResult();
        Assert.assertEquals(2, resultList.size());
        Assert.assertEquals(10001L + 1, resultList.get(0).getId().longValue());
        Assert.assertEquals(10001L + 3, resultList.get(1).getId().longValue());
    }
}
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) Test(org.junit.Test)

Example 13 with SuperHero

use of io.vertigo.dynamo.task.data.domain.SuperHero in project vertigo by KleeGroup.

the class TaskEngineSelectDynamicTest method testWhereInParenthesis.

/**
 * Test exécution d'une tache.
 */
@Test
public void testWhereInParenthesis() {
    try (final VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final TaskDefinition taskDefinition = registerTaskList("TK_WHERE_ID_TEST", "select * from SUPER_HERO  where\t(ID in\t(#DTC_SUPER_HERO_IN.ROWNUM.ID#))");
        final DtList<SuperHero> ids = DtList.of(createSuperHero(10001L + 1), createSuperHero(10001L + 3));
        final Task task = Task.builder(taskDefinition).addValue(DTC_SUPER_HERO_IN, ids).build();
        final DtList<SuperHero> resultList = taskManager.execute(task).getResult();
        Assert.assertEquals(2, resultList.size());
        Assert.assertEquals(10001L + 1, resultList.get(0).getId().longValue());
        Assert.assertEquals(10001L + 3, resultList.get(1).getId().longValue());
    }
}
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) Test(org.junit.Test)

Example 14 with SuperHero

use of io.vertigo.dynamo.task.data.domain.SuperHero in project vertigo by KleeGroup.

the class TaskEngineSelectDynamicTest method createSuperHero.

private static SuperHero createSuperHero(final long id) {
    final SuperHero superHero = new SuperHero();
    superHero.setId(id);
    return superHero;
}
Also used : SuperHero(io.vertigo.dynamo.task.data.domain.SuperHero)

Example 15 with SuperHero

use of io.vertigo.dynamo.task.data.domain.SuperHero in project vertigo by KleeGroup.

the class TaskEngineSelectDynamicTest method testWhereInPrimitive.

/**
 * Test exécution d'une tache.
 */
@Test
public void testWhereInPrimitive() {
    try (final VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final TaskDefinition taskDefinition = registerTaskListPrimitive("TK_WHERE_IN_PRIMITIVE_TEST", "select * from SUPER_HERO  where ID in (#SUPER_HERO_ID_LIST.ROWNUM#)");
        final List<Long> ids = Arrays.asList(10001L + 1, 10001L + 3);
        final Task task = Task.builder(taskDefinition).addValue(SUPER_HERO_ID_LIST, ids).build();
        final DtList<SuperHero> resultList = taskManager.execute(task).getResult();
        Assert.assertEquals(2, resultList.size());
        Assert.assertEquals(10001L + 1, resultList.get(0).getId().longValue());
        Assert.assertEquals(10001L + 3, resultList.get(1).getId().longValue());
    }
}
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) Test(org.junit.Test)

Aggregations

SuperHero (io.vertigo.dynamo.task.data.domain.SuperHero)20 VTransactionWritable (io.vertigo.commons.transaction.VTransactionWritable)18 TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)17 Task (io.vertigo.dynamo.task.model.Task)17 Test (org.junit.Test)17 DtList (io.vertigo.dynamo.domain.model.DtList)7 Domain (io.vertigo.dynamo.domain.metamodel.Domain)3 TaskEngineProcBatch (io.vertigo.dynamox.task.TaskEngineProcBatch)2 AbstractTestCaseJU4 (io.vertigo.AbstractTestCaseJU4)1 VTransactionManager (io.vertigo.commons.transaction.VTransactionManager)1 TaskManager (io.vertigo.dynamo.task.TaskManager)1 TaskEngineSelect (io.vertigo.dynamox.task.TaskEngineSelect)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Inject (javax.inject.Inject)1 Assert (org.junit.Assert)1