Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldMoveToFailedStateOnRun_fail() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldMoveToFailedStateOnRunFail()
        {
            // Given
            BoltStateMachineV3 machine = NewStateMachine();

            machine.Process(NewHelloMessage(), nullResponseHandler());

            // When
            BoltResponseRecorder recorder   = new BoltResponseRecorder();
            RunMessage           runMessage = mock(typeof(RunMessage));

            when(runMessage.Statement()).thenThrow(new Exception("Fail"));
            machine.Process(runMessage, recorder);

            // Then
            assertThat(recorder.NextResponse(), failedWithStatus(Org.Neo4j.Kernel.Api.Exceptions.Status_General.UnknownError));
            assertThat(machine.State(), instanceOf(typeof(FailedState)));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static org.neo4j.bolt.runtime.StatementMetadata processRunMessage(org.neo4j.bolt.v1.messaging.request.RunMessage message, org.neo4j.bolt.runtime.StatementProcessor statementProcessor) throws Exception
        private static StatementMetadata ProcessRunMessage(RunMessage message, StatementProcessor statementProcessor)
        {
            if (isBegin(message))
            {
                Bookmark bookmark = Bookmark.fromParamsOrNull(message.Params());
                statementProcessor.BeginTransaction(bookmark);
                return(StatementMetadata.EMPTY);
            }
            else if (isCommit(message))
            {
                statementProcessor.CommitTransaction();
                return(StatementMetadata.EMPTY);
            }
            else if (isRollback(message))
            {
                statementProcessor.RollbackTransaction();
                return(StatementMetadata.EMPTY);
            }
            else
            {
                return(statementProcessor.Run(message.Statement(), message.Params()));
            }
        }