use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelTransactionsTest method disposeAllMarksAllTransactionsForTermination.
@Test
public void disposeAllMarksAllTransactionsForTermination() throws Throwable {
KernelTransactions kernelTransactions = newKernelTransactions();
KernelTransaction tx1 = getKernelTransaction(kernelTransactions);
KernelTransaction tx2 = getKernelTransaction(kernelTransactions);
KernelTransaction tx3 = getKernelTransaction(kernelTransactions);
kernelTransactions.disposeAll();
assertEquals(Status.General.DatabaseUnavailable, tx1.getReasonIfTerminated().get());
assertEquals(Status.General.DatabaseUnavailable, tx2.getReasonIfTerminated().get());
assertEquals(Status.General.DatabaseUnavailable, tx3.getReasonIfTerminated().get());
}
use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelTransactionsTest method shouldIncludeRandomBytesInAdditionalHeader.
@Test
public void shouldIncludeRandomBytesInAdditionalHeader() throws Throwable {
// Given
TransactionRepresentation[] transactionRepresentation = new TransactionRepresentation[1];
KernelTransactions registry = newKernelTransactions(newRememberingCommitProcess(transactionRepresentation));
// When
try (KernelTransaction transaction = getKernelTransaction(registry)) {
// Just pick anything that can flag that changes have been made to this transaction
((KernelTransactionImplementation) transaction).txState().nodeDoCreate(0);
transaction.success();
}
// Then
byte[] additionalHeader = transactionRepresentation[0].additionalHeader();
assertNotNull(additionalHeader);
assertTrue(additionalHeader.length > 0);
}
use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelTransactionsTest method shouldReuseClosedTransactionObjects.
@Test
public void shouldReuseClosedTransactionObjects() throws Throwable {
// GIVEN
KernelTransactions transactions = newKernelTransactions();
KernelTransaction a = getKernelTransaction(transactions);
// WHEN
a.close();
KernelTransaction b = getKernelTransaction(transactions);
// THEN
assertSame(a, b);
}
use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelTransactionsTest method transactionCloseRemovesTxFromActiveTransactions.
@Test
public void transactionCloseRemovesTxFromActiveTransactions() throws Throwable {
KernelTransactions kernelTransactions = newTestKernelTransactions();
KernelTransaction tx1 = getKernelTransaction(kernelTransactions);
KernelTransaction tx2 = getKernelTransaction(kernelTransactions);
KernelTransaction tx3 = getKernelTransaction(kernelTransactions);
tx1.close();
tx3.close();
assertEquals(asSet(newHandle(tx2)), kernelTransactions.activeTransactions());
}
use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelTransactionImplementationTest method shouldIgnoreTerminateAfterCommit.
@Test
public void shouldIgnoreTerminateAfterCommit() throws Exception {
KernelTransaction transaction = newTransaction(securityContext());
transactionInitializer.accept(transaction);
transaction.success();
transaction.close();
transaction.markForTermination(Status.General.UnknownError);
// THEN
verify(transactionMonitor, times(1)).transactionFinished(true, isWriteTx);
verifyExtraInteractionWithTheMonitor(transactionMonitor, isWriteTx);
}
Aggregations