use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelTransactionImplementationTest method shouldThrowOnTerminationInCommit.
@Test(expected = TransactionTerminatedException.class)
public void shouldThrowOnTerminationInCommit() throws Exception {
KernelTransaction transaction = newTransaction(securityContext());
transactionInitializer.accept(transaction);
transaction.success();
transaction.markForTermination(Status.General.UnknownError);
transaction.close();
}
use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelTransactionImplementationTest method shouldNotDowngradeFailureState.
@Test
public void shouldNotDowngradeFailureState() throws Exception {
try (KernelTransaction transaction = newTransaction(securityContext())) {
// WHEN
transactionInitializer.accept(transaction);
transaction.markForTermination(Status.General.UnknownError);
transaction.failure();
assertEquals(Status.General.UnknownError, transaction.getReasonIfTerminated().get());
}
// THEN
verify(transactionMonitor, times(1)).transactionFinished(false, isWriteTx);
verify(transactionMonitor, times(1)).transactionTerminated(isWriteTx);
verifyExtraInteractionWithTheMonitor(transactionMonitor, isWriteTx);
}
use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelSchemaStateFlushingTest method createConstraint.
private ConstraintDescriptor createConstraint() throws KernelException {
try (KernelTransaction transaction = kernel.newTransaction(KernelTransaction.Type.implicit, AUTH_DISABLED);
Statement statement = transaction.acquireStatement()) {
ConstraintDescriptor descriptor = statement.schemaWriteOperations().uniquePropertyConstraintCreate(SchemaDescriptorFactory.forLabel(1, 1));
transaction.success();
return descriptor;
}
}
use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelSchemaStateFlushingTest method createIndex.
private NewIndexDescriptor createIndex() throws KernelException {
try (KernelTransaction transaction = kernel.newTransaction(KernelTransaction.Type.implicit, AUTH_DISABLED);
Statement statement = transaction.acquireStatement()) {
NewIndexDescriptor descriptor = statement.schemaWriteOperations().indexCreate(SchemaDescriptorFactory.forLabel(1, 1));
transaction.success();
return descriptor;
}
}
use of org.neo4j.kernel.api.KernelTransaction in project neo4j by neo4j.
the class KernelSchemaStateFlushingTest method awaitIndexOnline.
private void awaitIndexOnline(NewIndexDescriptor descriptor, String keyForProbing) throws IndexNotFoundKernelException, TransactionFailureException {
try (KernelTransaction transaction = kernel.newTransaction(KernelTransaction.Type.implicit, AUTH_DISABLED);
Statement statement = transaction.acquireStatement()) {
SchemaIndexTestHelper.awaitIndexOnline(statement.readOperations(), descriptor);
transaction.success();
}
awaitSchemaStateCleared(keyForProbing);
}
Aggregations