Search in sources :

Example 36 with BoltResponseRecorder

use of org.neo4j.bolt.testing.BoltResponseRecorder in project neo4j by neo4j.

the class BoltStateMachineTest method shouldBeAbleToKillMessagesAheadInLineWithAnInterrupt.

@Test
public void shouldBeAbleToKillMessagesAheadInLineWithAnInterrupt() throws Throwable {
    // Given
    final BoltStateMachine machine = newMachine(READY);
    // When
    machine.interrupt();
    // ...and
    BoltResponseRecorder recorder = new BoltResponseRecorder();
    machine.run("RETURN 1", EMPTY_PARAMS, recorder);
    machine.reset(recorder);
    machine.run("RETURN 1", EMPTY_PARAMS, recorder);
    // Then
    assertThat(recorder.nextResponse(), wasIgnored());
    assertThat(recorder.nextResponse(), succeeded());
    assertThat(recorder.nextResponse(), succeeded());
}
Also used : BoltResponseRecorder(org.neo4j.bolt.testing.BoltResponseRecorder) Test(org.junit.Test)

Aggregations

BoltResponseRecorder (org.neo4j.bolt.testing.BoltResponseRecorder)36 Test (org.junit.Test)34 BoltStateMachine (org.neo4j.bolt.v1.runtime.BoltStateMachine)30 InetSocketAddress (java.net.InetSocketAddress)2 RecordedBoltResponse (org.neo4j.bolt.testing.RecordedBoltResponse)2 BoltConnectionDescriptor (org.neo4j.bolt.v1.runtime.BoltConnectionDescriptor)2 HashMap (java.util.HashMap)1 BoltConnectionFatality (org.neo4j.bolt.v1.runtime.BoltConnectionFatality)1 BoltResult (org.neo4j.bolt.v1.runtime.spi.BoltResult)1 BinaryLatch (org.neo4j.concurrent.BinaryLatch)1 Node (org.neo4j.graphdb.Node)1 Transaction (org.neo4j.graphdb.Transaction)1