use of org.neo4j.kernel.impl.coreapi.InternalTransaction in project neo4j by neo4j.
the class ReadTracingIT method tracePageCacheAccessOnNodeCountByLabel.
@Test
void tracePageCacheAccessOnNodeCountByLabel() {
try (InternalTransaction transaction = (InternalTransaction) database.beginTx()) {
var kernelTransaction = transaction.kernelTransaction();
var cursorContext = kernelTransaction.cursorContext();
var dataRead = kernelTransaction.dataRead();
assertZeroCursor(cursorContext);
dataRead.countsForNode(0);
assertOneCursor(cursorContext);
}
}
use of org.neo4j.kernel.impl.coreapi.InternalTransaction in project neo4j by neo4j.
the class ReadTracingIT method tracePageCacheAccessOnRelationshipWithoutTxStateCount.
@Test
void tracePageCacheAccessOnRelationshipWithoutTxStateCount() {
try (InternalTransaction transaction = (InternalTransaction) database.beginTx()) {
var kernelTransaction = transaction.kernelTransaction();
var cursorContext = kernelTransaction.cursorContext();
var dataRead = kernelTransaction.dataRead();
assertZeroCursor(cursorContext);
dataRead.countsForRelationshipWithoutTxState(ANY_LABEL, ANY_RELATIONSHIP_TYPE, ANY_LABEL);
assertOneCursor(cursorContext);
}
}
use of org.neo4j.kernel.impl.coreapi.InternalTransaction in project neo4j by neo4j.
the class Neo4jTransactionalContextTest method shouldBePossibleToCloseAfterTermination.
@Test
void shouldBePossibleToCloseAfterTermination() {
InternalTransaction tx = mock(InternalTransaction.class);
when(tx.transactionType()).thenReturn(KernelTransaction.Type.IMPLICIT);
Neo4jTransactionalContext context = newContext(tx);
context.terminate();
verify(tx).terminate();
verify(tx, never()).close();
context.close();
}
use of org.neo4j.kernel.impl.coreapi.InternalTransaction in project neo4j by neo4j.
the class Neo4jTransactionalContextTest method setUpMocks.
private void setUpMocks() {
queryService = mock(GraphDatabaseQueryService.class);
DependencyResolver resolver = mock(DependencyResolver.class);
statement = mock(KernelStatement.class);
statistics = new ConfiguredExecutionStatistics();
QueryRegistry queryRegistry = mock(QueryRegistry.class);
InternalTransaction internalTransaction = mock(InternalTransaction.class);
when(internalTransaction.terminationReason()).thenReturn(Optional.empty());
when(statement.queryRegistration()).thenReturn(queryRegistry);
when(queryService.getDependencyResolver()).thenReturn(resolver);
when(queryService.beginTransaction(any(), any(), any())).thenReturn(internalTransaction);
KernelTransaction mockTransaction = mockTransaction(statement);
}
use of org.neo4j.kernel.impl.coreapi.InternalTransaction in project neo4j by neo4j.
the class Neo4jTransactionalContextTest method shouldNotCloseTransactionDuringTermination.
@Test
void shouldNotCloseTransactionDuringTermination() {
InternalTransaction tx = mock(InternalTransaction.class);
when(tx.transactionType()).thenReturn(KernelTransaction.Type.IMPLICIT);
Neo4jTransactionalContext context = newContext(tx);
context.terminate();
verify(tx).terminate();
verify(tx, never()).close();
}
Aggregations