use of org.neo4j.bolt.v1.messaging.BoltMessageRouter in project neo4j by neo4j.
the class ResetFuzzTest method shouldAlwaysReturnToReadyAfterReset.
@Test
public void shouldAlwaysReturnToReadyAfterReset() throws Throwable {
// given
life.start();
BoltWorker boltWorker = sessions.newWorker(CONNECTION_DESCRIPTOR);
boltWorker.enqueue(session -> session.init("ResetFuzzTest/0.0", map(), nullResponseHandler()));
BoltMessageRouter router = new BoltMessageRouter(NullLog.getInstance(), boltWorker, new BoltResponseMessageHandler<IOException>() {
@Override
public void onRecord(Record item) throws IOException {
}
@Override
public void onIgnored() throws IOException {
}
@Override
public void onFailure(Status status, String message) throws IOException {
}
@Override
public void onSuccess(Map metadata) throws IOException {
}
}, () -> {
});
// Test random combinations of messages within a small budget of testing time.
long deadline = System.currentTimeMillis() + 2 * 1000;
// when
while (System.currentTimeMillis() < deadline) {
dispatchRandomSequenceOfMessages(router);
assertWorkerWorks(boltWorker);
}
}
use of org.neo4j.bolt.v1.messaging.BoltMessageRouter in project neo4j by neo4j.
the class ResetFuzzTest method dispatchRandomSequenceOfMessages.
private void dispatchRandomSequenceOfMessages(BoltMessageRouter messageHandler) {
List<RequestMessage> sequence = sequences.get(rand.nextInt(sequences.size()));
for (RequestMessage message : sequence) {
sent.add(message);
message.dispatch(messageHandler);
}
}
Aggregations