//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 private void ShouldCloseConnectionOnIllegalMessages(RequestMessage message) { // Given BoltStateMachineV3 machine = NewStateMachine(); // 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 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: @Test public void shouldCloseConnectionAfterAuthenticationFailure() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCloseConnectionAfterAuthenticationFailure() { // Given BoltStateMachine machine = Env.newMachine(_boltChannel); // When... then InitMessage init = new InitMessage(USER_AGENT, newBasicAuthToken("neo4j", "j4oen")); BoltResponseRecorder recorder = new BoltResponseRecorder(); verifyKillsConnection(() => machine.process(init, recorder)); // ...and assertThat(recorder.NextResponse(), failedWithStatus(Org.Neo4j.Kernel.Api.Exceptions.Status_Security.Unauthorized)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToActOnSessionWhenUpdatingCredentials() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToActOnSessionWhenUpdatingCredentials() { BoltStateMachine machine = Env.newMachine(_boltChannel); BoltResponseRecorder recorder = new BoltResponseRecorder(); // when InitMessage message = new InitMessage(USER_AGENT, map("scheme", "basic", "principal", "neo4j", "credentials", UTF8.encode("neo4j"), "new_credentials", UTF8.encode("secret"))); machine.Process(message, recorder); machine.Process(new RunMessage("CREATE ()", EMPTY_MAP), recorder); // then assertThat(recorder.NextResponse(), succeeded()); assertThat(recorder.NextResponse(), succeeded()); }
//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 TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGiveKernelVersionOnInit() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGiveKernelVersionOnInit() { // Given it is important for client applications to programmatically // identify expired credentials as the cause of not being authenticated BoltStateMachine machine = Env.newMachine(_boltChannel); BoltResponseRecorder recorder = new BoltResponseRecorder(); string version = "Neo4j/" + Version.Neo4jVersion; // When InitMessage init = new InitMessage(USER_AGENT, newBasicAuthToken("neo4j", "neo4j")); machine.Process(init, recorder); machine.Process(new RunMessage("CREATE ()", EMPTY_MAP), recorder); // Then assertThat(recorder.NextResponse(), succeededWithMetadata("server", stringValue(version))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGiveCredentialsExpiredStatusOnExpiredCredentials() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGiveCredentialsExpiredStatusOnExpiredCredentials() { // Given it is important for client applications to programmatically // identify expired credentials as the cause of not being authenticated BoltStateMachine machine = Env.newMachine(_boltChannel); BoltResponseRecorder recorder = new BoltResponseRecorder(); // When InitMessage init = new InitMessage(USER_AGENT, newBasicAuthToken("neo4j", "neo4j")); machine.Process(init, recorder); machine.Process(new RunMessage("CREATE ()", EMPTY_MAP), recorder); // Then assertThat(recorder.NextResponse(), succeededWithMetadata("credentials_expired", TRUE)); assertThat(recorder.NextResponse(), failedWithStatus(Org.Neo4j.Kernel.Api.Exceptions.Status_Security.CredentialsExpired)); }
//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))); }