Search in sources :

Example 1 with CarDataBase

use of io.vertigo.dynamo.search_2_4.data.domain.CarDataBase in project vertigo by KleeGroup.

the class SearchManagerStoreTest method doSetUp.

@Override
protected void doSetUp() throws Exception {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    carIndexDefinition = definitionSpace.resolve(IDX_CAR, 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 car(ID BIGINT, MAKE 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) );");
        execCallableStatement(connection, "create sequence SEQ_CAR start with 10001 increment by 1");
    }
    // On supprime tout
    remove("*:*");
    final CarDataBase carDataBase = new CarDataBase();
    carDataBase.loadDatas();
    initialDbCarSize = carDataBase.size();
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        for (final Car car : carDataBase.getAllCars()) {
            car.setId(null);
            storeManager.getDataStore().create(car);
        }
        transaction.commit();
    }
    waitIndexation();
}
Also used : CarDataBase(io.vertigo.dynamo.search_2_4.data.domain.CarDataBase) Car(io.vertigo.dynamo.search_2_4.data.domain.Car) 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 2 with CarDataBase

use of io.vertigo.dynamo.search_2_4.data.domain.CarDataBase in project vertigo by KleeGroup.

the class AbstractSearchManagerTest method init.

/**
 * Initialise l'index.
 * @param indexName Nom de l'index
 */
protected final void init(final String indexName) {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    // On construit la BDD des voitures
    carDataBase = new CarDataBase();
    carDataBase.loadDatas();
    final CarSearchLoader carSearchLoader = getApp().getComponentSpace().resolve(CarSearchLoader.class);
    carSearchLoader.bindDataBase(carDataBase);
    makeFacetDefinition = definitionSpace.resolve("FCT_MAKE_CAR", FacetDefinition.class);
    yearFacetDefinition = definitionSpace.resolve("FCT_YEAR_CAR", FacetDefinition.class);
    carIndexDefinition = definitionSpace.resolve(indexName, SearchIndexDefinition.class);
    carFacetQueryDefinition = definitionSpace.resolve("QRY_CAR_FACET", FacetedQueryDefinition.class);
    clean(carIndexDefinition);
}
Also used : CarDataBase(io.vertigo.dynamo.search_2_4.data.domain.CarDataBase) SearchIndexDefinition(io.vertigo.dynamo.search.metamodel.SearchIndexDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) CarSearchLoader(io.vertigo.dynamo.search_2_4.data.domain.CarSearchLoader) FacetDefinition(io.vertigo.dynamo.collections.metamodel.FacetDefinition) FacetedQueryDefinition(io.vertigo.dynamo.collections.metamodel.FacetedQueryDefinition)

Example 3 with CarDataBase

use of io.vertigo.dynamo.search_2_4.data.domain.CarDataBase in project vertigo by KleeGroup.

the class SearchManagerMultiIndexTest method doSetUp.

/**
 *{@inheritDoc}
 */
@Override
protected void doSetUp() {
    carDataBase = new CarDataBase();
    carDataBase.loadDatas();
}
Also used : CarDataBase(io.vertigo.dynamo.search_2_4.data.domain.CarDataBase)

Aggregations

CarDataBase (io.vertigo.dynamo.search_2_4.data.domain.CarDataBase)3 DefinitionSpace (io.vertigo.core.definition.DefinitionSpace)2 SearchIndexDefinition (io.vertigo.dynamo.search.metamodel.SearchIndexDefinition)2 VTransactionWritable (io.vertigo.commons.transaction.VTransactionWritable)1 SqlConnection (io.vertigo.database.sql.connection.SqlConnection)1 FacetDefinition (io.vertigo.dynamo.collections.metamodel.FacetDefinition)1 FacetedQueryDefinition (io.vertigo.dynamo.collections.metamodel.FacetedQueryDefinition)1 Car (io.vertigo.dynamo.search_2_4.data.domain.Car)1 CarSearchLoader (io.vertigo.dynamo.search_2_4.data.domain.CarSearchLoader)1