Search in sources :

Example 1 with TestExecutorCaffeineCacheFactory$

use of org.neo4j.cypher.internal.cache.TestExecutorCaffeineCacheFactory$ in project neo4j by neo4j.

the class SnapshotExecutionEngineTest method setUp.

@BeforeEach
void setUp() throws Exception {
    transactionalContext = mock(TransactionalContext.class, RETURNS_DEEP_STUBS);
    KernelStatement kernelStatement = mock(KernelStatement.class);
    executor = mock(SnapshotExecutionEngine.QueryExecutor.class);
    versionContext = mock(VersionContext.class);
    statistics = mock(QueryStatistics.class);
    executionEngine = new SnapshotExecutionEngine(new GraphDatabaseCypherService(db), config, TestExecutorCaffeineCacheFactory$.MODULE$, NullLogProvider.getInstance(), mock(CompilerFactory.class));
    when(transactionalContext.kernelTransaction().cursorContext()).thenReturn(new CursorContext(NULL, versionContext));
    when(transactionalContext.statement()).thenReturn(kernelStatement);
    var innerExecution = mock(QueryExecution.class);
    when(executor.execute(any())).thenAnswer((Answer<QueryExecution>) invocationOnMock -> {
        MaterialisedResult materialisedResult = invocationOnMock.getArgument(0);
        materialisedResult.onResultCompleted(statistics);
        return innerExecution;
    });
}
Also used : VersionContext(org.neo4j.io.pagecache.context.VersionContext) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) BeforeEach(org.junit.jupiter.api.BeforeEach) TransactionalContext(org.neo4j.kernel.impl.query.TransactionalContext) TestExecutorCaffeineCacheFactory$(org.neo4j.cypher.internal.cache.TestExecutorCaffeineCacheFactory$) CursorContext(org.neo4j.io.pagecache.context.CursorContext) Config(org.neo4j.configuration.Config) QueryExecutionKernelException(org.neo4j.kernel.impl.query.QueryExecutionKernelException) NullLogProvider(org.neo4j.logging.NullLogProvider) Answer(org.mockito.stubbing.Answer) ImpermanentDbmsExtension(org.neo4j.test.extension.ImpermanentDbmsExtension) GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) Inject(org.neo4j.test.extension.Inject) RETURNS_DEEP_STUBS(org.mockito.Mockito.RETURNS_DEEP_STUBS) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) VersionContext(org.neo4j.io.pagecache.context.VersionContext) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) Test(org.junit.jupiter.api.Test) NULL(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer.NULL) CompilerFactory(org.neo4j.cypher.internal.CompilerFactory) KernelStatement(org.neo4j.kernel.impl.api.KernelStatement) QueryStatistics(org.neo4j.graphdb.QueryStatistics) QueryExecution(org.neo4j.kernel.impl.query.QueryExecution) Mockito.mock(org.mockito.Mockito.mock) KernelStatement(org.neo4j.kernel.impl.api.KernelStatement) QueryStatistics(org.neo4j.graphdb.QueryStatistics) TransactionalContext(org.neo4j.kernel.impl.query.TransactionalContext) CursorContext(org.neo4j.io.pagecache.context.CursorContext) QueryExecution(org.neo4j.kernel.impl.query.QueryExecution) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)1 RETURNS_DEEP_STUBS (org.mockito.Mockito.RETURNS_DEEP_STUBS)1 Mockito.mock (org.mockito.Mockito.mock)1 Mockito.times (org.mockito.Mockito.times)1 Mockito.verify (org.mockito.Mockito.verify)1 Mockito.when (org.mockito.Mockito.when)1 Answer (org.mockito.stubbing.Answer)1 Config (org.neo4j.configuration.Config)1 CompilerFactory (org.neo4j.cypher.internal.CompilerFactory)1 TestExecutorCaffeineCacheFactory$ (org.neo4j.cypher.internal.cache.TestExecutorCaffeineCacheFactory$)1 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1 QueryStatistics (org.neo4j.graphdb.QueryStatistics)1 CursorContext (org.neo4j.io.pagecache.context.CursorContext)1 VersionContext (org.neo4j.io.pagecache.context.VersionContext)1 NULL (org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer.NULL)1 KernelStatement (org.neo4j.kernel.impl.api.KernelStatement)1