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());
}
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);
}
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();
}
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);
}
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());
}
Aggregations