use of siena.base.test.model.TransactionAccountFrom in project siena by mandubian.
the class GaeTest method testTransactionSaveFailure.
public void testTransactionSaveFailure() {
TransactionAccountFrom accFrom = new TransactionAccountFrom(1000L);
pm.insert(accFrom);
try {
pm.beginTransaction(Connection.TRANSACTION_READ_COMMITTED);
accFrom.amount -= 100L;
pm.save(accFrom);
throw new SienaException("test");
} catch (SienaException e) {
pm.rollbackTransaction();
} finally {
pm.closeConnection();
}
TransactionAccountFrom accFromAfter = pm.getByKey(TransactionAccountFrom.class, accFrom.id);
assertTrue(1000L == accFromAfter.amount);
}
use of siena.base.test.model.TransactionAccountFrom in project siena by mandubian.
the class GaeTest method testTransactionInsertBatchFailure.
public void testTransactionInsertBatchFailure() {
TransactionAccountFrom accFrom = new TransactionAccountFrom(1000L);
try {
pm.beginTransaction(Connection.TRANSACTION_READ_COMMITTED);
accFrom.amount = 1000L;
pm.insert(accFrom);
throw new SienaException("test");
} catch (SienaException e) {
pm.rollbackTransaction();
} finally {
pm.closeConnection();
}
TransactionAccountFrom accFromAfter = pm.getByKey(TransactionAccountFrom.class, accFrom.id);
assertNull(accFromAfter);
}
Aggregations