Search in sources :

Example 11 with QueryExecutionKernelException

use of org.neo4j.kernel.impl.query.QueryExecutionKernelException in project neo4j by neo4j.

the class SnapshotExecutionEngineTest method failWriteQueryAfterFirstRetry.

@Test
void failWriteQueryAfterFirstRetry() throws QueryExecutionKernelException {
    when(statistics.containsUpdates()).thenReturn(true);
    when(versionContext.isDirty()).thenReturn(true, true, false);
    QueryExecutionKernelException e = assertThrows(QueryExecutionKernelException.class, () -> executionEngine.executeWithRetries("query", transactionalContext, executor));
    assertEquals("Unable to get clean data snapshot for query 'query' that performs updates.", e.getMessage());
    verify(executor, times(1)).execute(any());
    verify(versionContext, times(1)).initRead();
}
Also used : QueryExecutionKernelException(org.neo4j.kernel.impl.query.QueryExecutionKernelException) Test(org.junit.jupiter.api.Test)

Example 12 with QueryExecutionKernelException

use of org.neo4j.kernel.impl.query.QueryExecutionKernelException in project neo4j by neo4j.

the class TransactionStateMachineTest method shouldThrowOnCommitInAutoCommit.

@Test
void shouldThrowOnCommitInAutoCommit() {
    QueryExecutionKernelException e = assertThrows(QueryExecutionKernelException.class, () -> TransactionStateMachine.State.AUTO_COMMIT.commitTransaction(mutableState, stateMachineSPI));
    assertEquals("No current transaction to commit.", e.getMessage());
}
Also used : QueryExecutionKernelException(org.neo4j.kernel.impl.query.QueryExecutionKernelException) Test(org.junit.jupiter.api.Test)

Example 13 with QueryExecutionKernelException

use of org.neo4j.kernel.impl.query.QueryExecutionKernelException in project neo4j by neo4j.

the class TransactionStateMachineTest method shouldThrowOnBeginInExplicitTransaction.

@Test
void shouldThrowOnBeginInExplicitTransaction() {
    QueryExecutionKernelException e = assertThrows(QueryExecutionKernelException.class, () -> TransactionStateMachine.State.EXPLICIT_TRANSACTION.beginTransaction(mutableState, stateMachineSPI, null, null, AccessMode.WRITE, null));
    assertEquals("Nested transactions are not supported.", e.getMessage());
}
Also used : QueryExecutionKernelException(org.neo4j.kernel.impl.query.QueryExecutionKernelException) Test(org.junit.jupiter.api.Test)

Aggregations

QueryExecutionKernelException (org.neo4j.kernel.impl.query.QueryExecutionKernelException)13 Result (org.neo4j.graphdb.Result)5 TransactionalContext (org.neo4j.kernel.impl.query.TransactionalContext)5 Test (org.junit.jupiter.api.Test)4 VersionContext (org.neo4j.io.pagecache.context.VersionContext)2 GraphDatabaseQueryService (org.neo4j.kernel.GraphDatabaseQueryService)2 KernelException (org.neo4j.kernel.api.exceptions.KernelException)2 QueryExecution (org.neo4j.kernel.impl.query.QueryExecution)2 IOException (java.io.IOException)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 Test (org.junit.Test)1 InOrder (org.mockito.InOrder)1 BoltQueryExecution (org.neo4j.bolt.dbapi.BoltQueryExecution)1 BoltResultHandle (org.neo4j.bolt.v1.runtime.TransactionStateMachine.BoltResultHandle)1 BoltResult (org.neo4j.bolt.v1.runtime.spi.BoltResult)1 Config (org.neo4j.configuration.Config)1 GraphDatabaseInternalSettings (org.neo4j.configuration.GraphDatabaseInternalSettings)1 CypherException (org.neo4j.cypher.CypherException)1 InvalidSemanticsException (org.neo4j.cypher.InvalidSemanticsException)1 SyntaxException (org.neo4j.cypher.SyntaxException)1