Search in sources :

Example 21 with DefinitionSpace

use of io.vertigo.core.definition.DefinitionSpace in project vertigo by KleeGroup.

the class OOMEnvironmentManagerTest method testDtDefinition.

@Test
public void testDtDefinition() {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final DtDefinition dtDefinition = definitionSpace.resolve("DT_FAMILLE", DtDefinition.class);
    Assert.assertEquals("io.vertigo.dynamock.domain.famille.Famille", dtDefinition.getClassCanonicalName());
    Assert.assertTrue(dtDefinition.isPersistent());
    Assert.assertEquals("io.vertigo.dynamock.domain.famille", dtDefinition.getPackageName());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Test(org.junit.Test)

Example 22 with DefinitionSpace

use of io.vertigo.core.definition.DefinitionSpace in project vertigo by KleeGroup.

the class SearchManagerMultiIndexTest method testClean.

/**
 * Test de création nettoyage de l'index.
 * La création s'effectue dans une seule transaction.
 */
@Test
public void testClean() {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final SearchIndexDefinition itemIndexDefinition = definitionSpace.resolve(IDX_ITEM, SearchIndexDefinition.class);
    final SearchIndexDefinition itemDynIndexDefinition = definitionSpace.resolve(IDX_DYNA_ITEM, SearchIndexDefinition.class);
    final ListFilter removeQuery = ListFilter.of("*:*");
    searchManager.removeAll(itemIndexDefinition, removeQuery);
    searchManager.removeAll(itemDynIndexDefinition, removeQuery);
    waitIndexation();
    final long size = query("*:*", itemIndexDefinition);
    Assert.assertEquals(0, size);
    final long sizeDyn = query("*:*", itemDynIndexDefinition);
    Assert.assertEquals(0, sizeDyn);
}
Also used : ListFilter(io.vertigo.dynamo.collections.ListFilter) SearchIndexDefinition(io.vertigo.dynamo.search.metamodel.SearchIndexDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Test(org.junit.Test)

Example 23 with DefinitionSpace

use of io.vertigo.core.definition.DefinitionSpace in project vertigo by KleeGroup.

the class SearchManagerStoreTest method doSetUp.

@Override
protected void doSetUp() throws Exception {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    itemIndexDefinition = definitionSpace.resolve(IDX_ITEM, SearchIndexDefinition.class);
    // A chaque test on recrée la table famille
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final SqlConnection connection = dataBaseManager.getConnectionProvider(SqlDataBaseManager.MAIN_CONNECTION_PROVIDER_NAME).obtainConnection();
        execCallableStatement(connection, "create table item(ID BIGINT, MANUFACTURER varchar(50), MODEL varchar(255), DESCRIPTION varchar(512), YEAR INT, KILO INT, PRICE INT, CONSOMMATION NUMERIC(8,2), MOTOR_TYPE varchar(50), OPTIONAL_NUMBER BIGINT, OPTIONAL_STRING varchar(50), LAST_MODIFIED timestamp );");
        execCallableStatement(connection, "create sequence SEQ_ITEM start with 10001 increment by 1");
    }
    // On supprime tout
    remove("*:*");
    final ItemDataBase itemDataBase = new ItemDataBase();
    initialDbItemSize = itemDataBase.size();
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        for (final Item item : itemDataBase.getAllItems()) {
            item.setId(null);
            storeManager.getDataStore().create(item);
        }
        transaction.commit();
    }
    waitIndexation();
}
Also used : Item(io.vertigo.dynamo.search.data.domain.Item) ItemDataBase(io.vertigo.dynamo.search.data.domain.ItemDataBase) SearchIndexDefinition(io.vertigo.dynamo.search.metamodel.SearchIndexDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable) SqlConnection(io.vertigo.database.sql.connection.SqlConnection)

Example 24 with DefinitionSpace

use of io.vertigo.core.definition.DefinitionSpace in project vertigo by KleeGroup.

the class AbstractStoreManagerTest method nativeInsertCar.

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,MANUFACTURER, MODEL, DESCRIPTION, YEAR, KILO, PRICE, MTY_CD) values " + "(NEXT VALUE FOR SEQ_CAR, #DTO_CAR.FAM_ID#, #DTO_CAR.MANUFACTURER#, #DTO_CAR.MODEL#, #DTO_CAR.DESCRIPTION#, #DTO_CAR.YEAR#, #DTO_CAR.KILO#, #DTO_CAR.PRICE#, #DTO_CAR.MTY_CD#)").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 25 with DefinitionSpace

use of io.vertigo.core.definition.DefinitionSpace in project vertigo by KleeGroup.

the class JavaEnvironmentManagerTest method testCommand.

@Test
public void testCommand() {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final DtDefinition dtDefinition = definitionSpace.resolve("DT_COMMAND", DtDefinition.class);
    Assert.assertTrue(dtDefinition.isPersistent());
    Assert.assertEquals("io.vertigo.dynamo.environment.java.data.domain.Command", dtDefinition.getClassCanonicalName());
    Assert.assertEquals("io.vertigo.dynamo.environment.java.data.domain", dtDefinition.getPackageName());
    Assert.assertEquals("Command", dtDefinition.getClassSimpleName());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Test(org.junit.Test)

Aggregations

DefinitionSpace (io.vertigo.core.definition.DefinitionSpace)29 Test (org.junit.Test)18 SearchIndexDefinition (io.vertigo.dynamo.search.metamodel.SearchIndexDefinition)9 Domain (io.vertigo.dynamo.domain.metamodel.Domain)6 FacetedQueryDefinition (io.vertigo.dynamo.collections.metamodel.FacetedQueryDefinition)4 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)4 TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)4 FormatterDefault (io.vertigo.dynamox.domain.formatter.FormatterDefault)4 ListFilter (io.vertigo.dynamo.collections.ListFilter)3 FacetDefinition (io.vertigo.dynamo.collections.metamodel.FacetDefinition)3 FormatterDefinition (io.vertigo.dynamo.domain.metamodel.FormatterDefinition)3 Task (io.vertigo.dynamo.task.model.Task)3 VTransactionWritable (io.vertigo.commons.transaction.VTransactionWritable)2 SqlConnection (io.vertigo.database.sql.connection.SqlConnection)2 DslDefinition (io.vertigo.dynamo.plugins.environment.dsl.dynamic.DslDefinition)2 Item (io.vertigo.dynamo.search.data.domain.Item)2 ItemDataBase (io.vertigo.dynamo.search.data.domain.ItemDataBase)2 Car (io.vertigo.dynamo.search_2_4.data.domain.Car)2 CarDataBase (io.vertigo.dynamo.search_2_4.data.domain.CarDataBase)2 TaskResult (io.vertigo.dynamo.task.model.TaskResult)2