//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 shouldMoveToStreamingOnRun_succ() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldMoveToStreamingOnRunSucc()
        {
            // Given
            BoltStateMachineV3 machine = BoltStateMachineInTxReadyState;

            // When
            BoltResponseRecorder recorder = new BoltResponseRecorder();

            machine.Process(new RunMessage("CREATE (n {k:'k'}) RETURN n.k", EmptyParams), recorder);

            // Then
            RecordedBoltResponse response = recorder.NextResponse();

            assertTrue(response.HasMetadata("fields"));
            assertTrue(response.HasMetadata("t_first"));
            assertThat(machine.State(), instanceOf(typeof(TransactionStreamingState)));
        }
//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)));
        }
示例#4
0
//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)));
        }
示例#5
0
//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)));
        }
示例#6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertSchedulerWorks(org.neo4j.bolt.runtime.BoltConnection connection) throws InterruptedException
        private void AssertSchedulerWorks(BoltConnection connection)
        {
            BoltResponseRecorder recorder = new BoltResponseRecorder();

            connection.Enqueue(_machine => _machine.process(ResetMessage.INSTANCE, recorder));

            try
            {
                RecordedBoltResponse response = recorder.NextResponse();
                assertThat(response.Message(), equalTo(SUCCESS));
                assertThat((( BoltStateMachineV1 )_machine).state(), instanceOf(typeof(ReadyState)));
                assertThat(_liveTransactions.get(), equalTo(0L));
            }
            catch (AssertionError e)
            {
//JAVA TO C# CONVERTER TODO TASK: The following line has a Java format specifier which cannot be directly translated to .NET:
//ORIGINAL LINE: throw new AssertionError(String.format("Expected session to return to good state after RESET, but " + "assertion failed: %s.%n" + "Seed: %s%n" + "Messages sent:%n" + "%s", e.getMessage(), seed, org.neo4j.helpers.collection.Iterables.toString(sent, "\n")), e);
                throw new AssertionError(string.Format("Expected session to return to good state after RESET, but " + "assertion failed: %s.%n" + "Seed: %s%n" + "Messages sent:%n" + "%s", e.Message, _seed, Iterables.ToString(_sent, "\n")), e);
            }
        }