use of org.neo4j.kernel.impl.transaction.stats.TransactionCounters in project neo4j by neo4j.
the class TransactionMonitorTest method shouldCountTerminatedTransactions.
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
void shouldCountTerminatedTransactions(String name, ThrowingConsumer<Transaction, Exception> txConsumer, boolean isWriteTx) throws Exception {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder().impermanent().build();
GraphDatabaseAPI db = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
try {
TransactionCounters counts = db.getDependencyResolver().resolveDependency(TransactionCounters.class);
TransactionCountersChecker checker = new TransactionCountersChecker(counts);
try (Transaction tx = db.beginTx()) {
txConsumer.accept(tx);
tx.terminate();
}
checker.verifyTerminated(isWriteTx, counts);
} finally {
managementService.shutdown();
}
}
use of org.neo4j.kernel.impl.transaction.stats.TransactionCounters in project neo4j by neo4j.
the class TransactionMonitorTest method shouldCountRolledBackTransactions.
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
void shouldCountRolledBackTransactions(String name, ThrowingConsumer<Transaction, Exception> txConsumer, boolean isWriteTx) throws Exception {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder().impermanent().build();
GraphDatabaseAPI db = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
try {
TransactionCounters counts = db.getDependencyResolver().resolveDependency(TransactionCounters.class);
TransactionCountersChecker checker = new TransactionCountersChecker(counts);
try (Transaction tx = db.beginTx()) {
txConsumer.accept(tx);
tx.rollback();
}
checker.verifyRolledBacked(isWriteTx, counts);
} finally {
managementService.shutdown();
}
}
use of org.neo4j.kernel.impl.transaction.stats.TransactionCounters in project neo4j by neo4j.
the class TransactionMonitorTest method shouldCountCommittedTransactions.
@ParameterizedTest(name = "{0}")
@MethodSource("parameters")
void shouldCountCommittedTransactions(String name, ThrowingConsumer<Transaction, Exception> txConsumer, boolean isWriteTx) throws Exception {
DatabaseManagementService managementService = new TestDatabaseManagementServiceBuilder().impermanent().build();
GraphDatabaseAPI db = (GraphDatabaseAPI) managementService.database(DEFAULT_DATABASE_NAME);
try {
TransactionCounters counts = db.getDependencyResolver().resolveDependency(TransactionCounters.class);
TransactionCountersChecker checker = new TransactionCountersChecker(counts);
try (Transaction tx = db.beginTx()) {
txConsumer.accept(tx);
tx.commit();
}
checker.verifyCommitted(isWriteTx, counts);
} finally {
managementService.shutdown();
}
}
Aggregations