use of org.neo4j.ogm.session.transaction.DefaultTransactionManager in project neo4j-ogm by neo4j.
the class ClosedTransactionTest method init.
@Before
public void init() {
Session session = sessionFactory.openSession();
// The session actually has it's own transaction manager, which is btw tied to thread locally to the driver.
// We could force get the sessions transaction manager or just create a new one here and tie it to the driver.
// Both feel broken, this here a little less painfull, though.
transactionManager = new DefaultTransactionManager(session, getDriver().getTransactionFactorySupplier());
}
use of org.neo4j.ogm.session.transaction.DefaultTransactionManager in project neo4j-ogm by neo4j.
the class TransactionManagerTest method shouldRollbackManagedTransaction.
@Test
public void shouldRollbackManagedTransaction() {
DefaultTransactionManager transactionManager = new DefaultTransactionManager(session, getDriver().getTransactionFactorySupplier());
assertThat(session.getLastBookmark()).isNull();
try (Transaction tx = transactionManager.openTransaction()) {
assertThat(tx.status()).isEqualTo(Transaction.Status.OPEN);
tx.rollback();
assertThat(tx.status()).isEqualTo(Transaction.Status.ROLLEDBACK);
}
}
use of org.neo4j.ogm.session.transaction.DefaultTransactionManager in project neo4j-ogm by neo4j.
the class TransactionManagerTest method shouldBeAbleToCreateManagedTransaction.
@Test
public void shouldBeAbleToCreateManagedTransaction() {
DefaultTransactionManager transactionManager = new DefaultTransactionManager(session, getDriver().getTransactionFactorySupplier());
assertThat(session.getLastBookmark()).isNull();
try (Transaction tx = transactionManager.openTransaction()) {
assertThat(tx.status()).isEqualTo(Transaction.Status.OPEN);
}
}
Aggregations