Search in sources :

Example 16 with VTransactionWritable

use of io.vertigo.commons.transaction.VTransactionWritable in project vertigo by KleeGroup.

the class AbstractStoreManagerTest method testGetFamille.

/**
 * On vérifie que la liste est vide.
 */
@Test
public void testGetFamille() {
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final DtListURI allFamilles = new DtListURIForCriteria<>(dtDefinitionFamille, null, null);
        final DtList<Famille> dtc = storeManager.getDataStore().findAll(allFamilles);
        Assert.assertNotNull(dtc);
        Assert.assertTrue("La liste des famille est vide", dtc.isEmpty());
        transaction.commit();
    }
}
Also used : Famille(io.vertigo.dynamo.store.data.domain.famille.Famille) DtListURI(io.vertigo.dynamo.domain.model.DtListURI) DtListURIForCriteria(io.vertigo.dynamo.domain.model.DtListURIForCriteria) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable) Test(org.junit.Test)

Example 17 with VTransactionWritable

use of io.vertigo.commons.transaction.VTransactionWritable in project vertigo by KleeGroup.

the class AbstractStoreManagerTest method testTxCrudInsertDeleteCommit.

@Test
public void testTxCrudInsertDeleteCommit() {
    final Car car = createNewCar();
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final Car createdCar = storeManager.getDataStore().create(car);
        // Check cars count
        checkCrudCarsCount(1);
        storeManager.getDataStore().delete(createdCar.getURI());
        // car is cacheable : list was'nt flush here
        checkCrudCarsCount(1);
        transaction.commit();
    }
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        // car is cacheable : must wait commit to see delete
        checkCrudCarsCount(0);
    }
}
Also used : Car(io.vertigo.dynamo.store.data.domain.car.Car) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable) Test(org.junit.Test)

Example 18 with VTransactionWritable

use of io.vertigo.commons.transaction.VTransactionWritable in project vertigo by KleeGroup.

the class AbstractStoreManagerTest method testTxCrudInsertRollbackCrudSelectRollback.

@Test
public void testTxCrudInsertRollbackCrudSelectRollback() {
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final Car car = createNewCar();
        storeManager.getDataStore().create(car);
    }
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        // on récupère la liste des voitures
        checkCrudCarsCount(0);
    }
}
Also used : Car(io.vertigo.dynamo.store.data.domain.car.Car) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable) Test(org.junit.Test)

Example 19 with VTransactionWritable

use of io.vertigo.commons.transaction.VTransactionWritable in project vertigo by KleeGroup.

the class AbstractStoreManagerTest method testTxNativeInsertRollbackNativeSelectRollback.

@Test
public void testTxNativeInsertRollbackNativeSelectRollback() {
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        final Car car = createNewCar();
        nativeInsertCar(car);
    }
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        checkNativeCarsCount(0);
    }
}
Also used : Car(io.vertigo.dynamo.store.data.domain.car.Car) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable) Test(org.junit.Test)

Example 20 with VTransactionWritable

use of io.vertigo.commons.transaction.VTransactionWritable in project vertigo by KleeGroup.

the class AbstractStoreManagerTest method initMainStore.

protected void initMainStore() {
    // A chaque test on recrée la table famille
    SqlUtil.execRequests(transactionManager, taskManager, getCreateMainStoreRequests(), "TK_INIT_MAIN", Optional.empty());
    try (VTransactionWritable transaction = transactionManager.createCurrentTransaction()) {
        for (final Car car : carDataBase.getAllCars()) {
            car.setId(null);
            storeManager.getDataStore().create(car);
        }
        transaction.commit();
    }
}
Also used : Car(io.vertigo.dynamo.store.data.domain.car.Car) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable)

Aggregations

VTransactionWritable (io.vertigo.commons.transaction.VTransactionWritable)80 Test (org.junit.Test)63 Car (io.vertigo.dynamo.store.data.domain.car.Car)22 TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)22 Task (io.vertigo.dynamo.task.model.Task)22 SuperHero (io.vertigo.dynamo.task.data.domain.SuperHero)18 DtList (io.vertigo.dynamo.domain.model.DtList)7 Flower (io.vertigo.dynamo.kvstore.data.Flower)6 Famille (io.vertigo.dynamo.store.data.domain.famille.Famille)6 SqlConnection (io.vertigo.database.sql.connection.SqlConnection)5 DtListURI (io.vertigo.dynamo.domain.model.DtListURI)5 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)4 DtListURIForCriteria (io.vertigo.dynamo.domain.model.DtListURIForCriteria)4 URI (io.vertigo.dynamo.domain.model.URI)4 Item (io.vertigo.dynamo.search.data.domain.Item)4 SearchIndexDefinition (io.vertigo.dynamo.search.metamodel.SearchIndexDefinition)4 Car (io.vertigo.dynamo.search_2_4.data.domain.Car)4 TaskEngineSelect (io.vertigo.dynamox.task.TaskEngineSelect)4 ArrayList (java.util.ArrayList)4 Domain (io.vertigo.dynamo.domain.metamodel.Domain)3