use of org.neo4j.causalclustering.core.consensus.RaftMessages.Timeout.Heartbeat in project neo4j by neo4j.
the class OutOfOrderDeliveryTest method shouldReOrder.
@Test
public void shouldReOrder() throws Exception {
// given
ClusterState clusterState = new ClusterState(asSet(member(0)));
clusterState.queues.get(member(0)).add(new Election(member(0)));
clusterState.queues.get(member(0)).add(new Heartbeat(member(0)));
// when
ClusterState reOrdered = new OutOfOrderDelivery(member(0)).advance(clusterState);
// then
assertEquals(new Heartbeat(member(0)), reOrdered.queues.get(member(0)).poll());
assertEquals(new Election(member(0)), reOrdered.queues.get(member(0)).poll());
}
use of org.neo4j.causalclustering.core.consensus.RaftMessages.Timeout.Heartbeat in project neo4j by neo4j.
the class LeaderTest method leaderShouldSendHeartbeatsToAllClusterMembersOnReceiptOfHeartbeatTick.
// TODO: test that shows we don't commit for previous terms
@Test
public void leaderShouldSendHeartbeatsToAllClusterMembersOnReceiptOfHeartbeatTick() throws Exception {
// given
RaftState state = raftState().votingMembers(myself, member1, member2).replicationMembers(myself, member1, member2).build();
Leader leader = new Leader();
// make sure it has quorum.
leader.handle(new RaftMessages.HeartbeatResponse(member1), state, log());
// when
Outcome outcome = leader.handle(new Heartbeat(myself), state, log());
// then
assertTrue(messageFor(outcome, member1) instanceof RaftMessages.Heartbeat);
assertTrue(messageFor(outcome, member2) instanceof RaftMessages.Heartbeat);
}
Aggregations