public QueryExecutionException asUserException() { return new QueryExecutionException( getMessage(), this, status().code().serialize() ); } }
@Test public void failQueryAfterMaxRetriesReached() throws QueryExecutionKernelException { when( versionContext.isDirty() ).thenReturn( true ); try { executionEngine.executeWithRetries( "query", Collections.emptyMap(), transactionalContext, executor ); } catch ( QueryExecutionKernelException e ) { assertEquals( "Unable to get clean data snapshot for query 'query' after 5 attempts.", e.getMessage() ); } verify( executor, times( 5 ) ).execute( any(), anyMap(), any() ); verify( versionContext, times( 5 ) ).initRead(); }
@Test void shouldThrowOnCommitInAutoCommit() throws Exception { QueryExecutionKernelException e = assertThrows( QueryExecutionKernelException.class, () -> TransactionStateMachine.State.AUTO_COMMIT.commitTransaction( mutableState, stateMachineSPI ) ); assertEquals( "No current transaction to commit.", e.getMessage() ); }
@Test void shouldThrowOnBeginInExplicitTransaction() throws Exception { QueryExecutionKernelException e = assertThrows( QueryExecutionKernelException.class, () -> TransactionStateMachine.State.EXPLICIT_TRANSACTION.beginTransaction( mutableState, stateMachineSPI, null, null, null ) ); assertEquals( "Nested transactions are not supported.", e.getMessage() ); }
public QueryExecutionException asUserException() { return new QueryExecutionException( getMessage(), this, status().code().serialize() ); } }
private void handleException( Output out, QueryExecutionKernelException exception, long startTime ) throws RemoteException { out.println( (now() - startTime) + " ms" ); out.println(); out.println( "WARNING: " + exception.getMessage() ); }