//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveToInterruptedOnInterrupt() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveToInterruptedOnInterrupt() { // Given BoltStateMachineV3 machine = NewStateMachine(); machine.Process(NewHelloMessage(), nullResponseHandler()); // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(InterruptSignal.INSTANCE, recorder); // Then assertThat(machine.State(), instanceOf(typeof(InterruptedState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldStayInInterruptedOnMoreReset() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldStayInInterruptedOnMoreReset() { // Given BoltStateMachineV3 machine = BoltStateMachineInInterruptedState; machine.Interrupt(); machine.Interrupt(); // need two reset to recover // When & Then machine.Process(ResetMessage.INSTANCE, nullResponseHandler()); assertThat(machine.State(), instanceOf(typeof(InterruptedState))); BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(ResetMessage.INSTANCE, recorder); assertThat(recorder.NextResponse(), succeeded()); assertThat(machine.State(), instanceOf(typeof(ReadyState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveToStreamingOnBegin_succ() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveToStreamingOnBeginSucc() { // Given BoltStateMachineV3 machine = NewStateMachine(); machine.Process(NewHelloMessage(), nullResponseHandler()); // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(new BeginMessage(), recorder); // Then RecordedBoltResponse response = recorder.NextResponse(); assertThat(response, succeeded()); assertThat(machine.State(), instanceOf(typeof(TransactionReadyState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveToFailedStateOnBegin_fail() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveToFailedStateOnBeginFail() { // Given BoltStateMachineV3 machine = NewStateMachine(); machine.Process(NewHelloMessage(), nullResponseHandler()); // When BoltResponseRecorder recorder = new BoltResponseRecorder(); BeginMessage beginMessage = mock(typeof(BeginMessage)); when(beginMessage.Bookmark()).thenThrow(new Exception("Fail")); machine.Process(beginMessage, recorder); // Then assertThat(recorder.NextResponse(), failedWithStatus(Org.Neo4j.Kernel.Api.Exceptions.Status_General.UnknownError)); assertThat(machine.State(), instanceOf(typeof(FailedState))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void shouldThrowExceptionOnIllegalMessagesInStreamingState(org.neo4j.bolt.messaging.RequestMessage message) throws Throwable private void ShouldThrowExceptionOnIllegalMessagesInStreamingState(RequestMessage message) { // Given BoltStateMachineV3 machine = NewStateMachine(); machine.Process(NewHelloMessage(), nullResponseHandler()); machine.Process(new RunMessage("CREATE (n {k:'k'}) RETURN n.k", EmptyParams), nullResponseHandler()); assertThat(machine.State(), instanceOf(typeof(StreamingState))); // when BoltResponseRecorder recorder = new BoltResponseRecorder(); verifyKillsConnection(() => machine.process(message, recorder)); // then assertThat(recorder.NextResponse(), failedWithStatus(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.Invalid)); assertNull(machine.State()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveToStreamingOnRun_succ() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveToStreamingOnRunSucc() { // Given BoltStateMachineV3 machine = NewStateMachine(); machine.Process(NewHelloMessage(), nullResponseHandler()); // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(new RunMessage("CREATE (n {k:'k'}) RETURN n.k", EmptyParams), recorder); // Then RecordedBoltResponse response = recorder.NextResponse(); assertThat(response, succeeded()); assertTrue(response.HasMetadata("fields")); assertTrue(response.HasMetadata("t_first")); assertThat(machine.State(), instanceOf(typeof(StreamingState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveToInterruptedOnInterrupt() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveToInterruptedOnInterrupt() { // Given BoltStateMachineV3 machine = BoltStateMachineInTxReadyState; // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(InterruptSignal.INSTANCE, recorder); // Then assertThat(machine.State(), instanceOf(typeof(InterruptedState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveToReadyOnRollback_succ() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveToReadyOnRollbackSucc() { BoltStateMachineV3 machine = BoltStateMachineInTxReadyState; // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(ROLLBACK_MESSAGE, recorder); // Then assertThat(recorder.NextResponse(), succeeded()); assertThat(machine.State(), instanceOf(typeof(ReadyState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveToFailedOnRun_fail() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveToFailedOnRunFail() { BoltStateMachineV3 machine = BoltStateMachineInTxReadyState; // When BoltResponseHandler handler = mock(typeof(BoltResponseHandler)); doThrow(new Exception("Error!")).when(handler).onRecords(any(), anyBoolean()); machine.Process(new RunMessage("A cypher query"), handler); // Then assertThat(machine.State(), instanceOf(typeof(FailedState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldStayInInterruptedOnInterruptedSignal() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldStayInInterruptedOnInterruptedSignal() { // Given BoltStateMachineV3 machine = BoltStateMachineInInterruptedState; // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(InterruptSignal.INSTANCE, recorder); // Then assertThat(recorder.NextResponse(), succeeded()); assertThat(machine.State(), instanceOf(typeof(InterruptedState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveReadyOnReset_succ() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveReadyOnResetSucc() { // Given BoltStateMachineV3 machine = BoltStateMachineInInterruptedState; // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(ResetMessage.INSTANCE, recorder); // Then assertThat(recorder.NextResponse(), succeeded()); assertThat(machine.State(), instanceOf(typeof(ReadyState))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void shouldCloseConnectionOnIllegalMessages(org.neo4j.bolt.messaging.RequestMessage message) throws InterruptedException, org.neo4j.bolt.runtime.BoltConnectionFatality private void ShouldCloseConnectionOnIllegalMessages(RequestMessage message) { // Given BoltStateMachineV3 machine = BoltStateMachineInInterruptedState; // when BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(message, recorder); // then assertThat(recorder.NextResponse(), wasIgnored()); assertThat(machine.State(), instanceOf(typeof(InterruptedState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ParameterizedTest @MethodSource("pullAllDiscardAllMessages") void shouldMoveFromStreamingStateToFailedStateOnPullAllOrDiscardAll_fail(org.neo4j.bolt.messaging.RequestMessage message) throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveFromStreamingStateToFailedStateOnPullAllOrDiscardAllFail(RequestMessage message) { // Given BoltStateMachineV3 machine = BoltStateMachineInStreamingState; // When BoltResponseHandler handler = mock(typeof(BoltResponseHandler)); doThrow(new Exception("Fail")).when(handler).onRecords(any(), anyBoolean()); machine.Process(message, handler); // Then assertThat(machine.State(), instanceOf(typeof(FailedState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ParameterizedTest @MethodSource("ignoredMessages") void shouldIgnoreMessages(org.neo4j.bolt.messaging.RequestMessage message) throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldIgnoreMessages(RequestMessage message) { // Given BoltStateMachineV3 machine = BoltStateMachineInFailedState; // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(message, recorder); // Then assertThat(recorder.NextResponse(), wasIgnored()); assertThat(machine.State(), instanceOf(typeof(FailedState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandleHelloMessage() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldHandleHelloMessage() { // Given BoltStateMachineV3 machine = NewStateMachine(); BoltResponseRecorder recorder = new BoltResponseRecorder(); // When machine.Process(NewHelloMessage(), recorder); // Then RecordedBoltResponse response = recorder.NextResponse(); assertThat(response, succeededWithMetadata("server", BOLT_SERVER_VERSION_PREFIX + Version.Neo4jVersion)); assertThat(response, succeededWithMetadata("connection_id", "conn-v3-test-boltchannel-id")); assertThat(machine.State(), instanceOf(typeof(ReadyState))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void shouldCloseConnectionOnIllegalMessages(org.neo4j.bolt.messaging.RequestMessage message) throws InterruptedException, org.neo4j.bolt.runtime.BoltConnectionFatality private void ShouldCloseConnectionOnIllegalMessages(RequestMessage message) { // Given BoltStateMachineV3 machine = NewStateMachine(); machine.Process(NewHelloMessage(), nullResponseHandler()); // when BoltResponseRecorder recorder = new BoltResponseRecorder(); verifyKillsConnection(() => machine.process(message, recorder)); // then assertThat(recorder.NextResponse(), failedWithStatus(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.Invalid)); assertNull(machine.State()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveToReadyOnCommit_succ() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveToReadyOnCommitSucc() { BoltStateMachineV3 machine = BoltStateMachineInTxReadyState; // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(COMMIT_MESSAGE, recorder); // Then RecordedBoltResponse response = recorder.NextResponse(); assertThat(response, succeeded()); assertTrue(response.HasMetadata("bookmark")); assertThat(machine.State(), instanceOf(typeof(ReadyState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveFromTxStreamingToTxReadyOnDiscardAll_succ() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveFromTxStreamingToTxReadyOnDiscardAllSucc() { // Given BoltStateMachineV3 machine = BoltStateMachineInTxStreamingState; // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(DiscardAllMessage.INSTANCE, recorder); // Then RecordedBoltResponse response = recorder.NextResponse(); assertThat(response, succeeded()); assertFalse(response.HasMetadata("bookmark")); assertThat(machine.State(), instanceOf(typeof(TransactionReadyState))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldMoveFromStreamingToReadyOnPullAll_succ() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldMoveFromStreamingToReadyOnPullAllSucc() { // Given BoltStateMachineV3 machine = BoltStateMachineInStreamingState; // When BoltResponseRecorder recorder = new BoltResponseRecorder(); machine.Process(PullAllMessage.INSTANCE, recorder); // Then RecordedBoltResponse response = recorder.NextResponse(); assertThat(response, succeeded()); assertTrue(response.HasMetadata("type")); assertTrue(response.HasMetadata("t_last")); assertTrue(response.HasMetadata("bookmark")); assertThat(machine.State(), instanceOf(typeof(ReadyState))); }