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