use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class RaftMessageProcessingTest method shouldEncodeAndDecodeVoteResponse.
@Test
public void shouldEncodeAndDecodeVoteResponse() {
// given
MemberId member = new MemberId(UUID.randomUUID());
RaftMessages.Vote.Response response = new RaftMessages.Vote.Response(member, 1, true);
// when
channel.writeOutbound(response);
channel.writeInbound(new Object[] { channel.readOutbound() });
// then
assertEquals(response, channel.readInbound());
}
use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class RaftMessageProcessingTest method shouldEncodeAndDecodeNewEntryRequest.
@Test
public void shouldEncodeAndDecodeNewEntryRequest() {
// given
MemberId member = new MemberId(UUID.randomUUID());
RaftMessages.NewEntry.Request request = new RaftMessages.NewEntry.Request(member, ReplicatedInteger.valueOf(12));
// when
channel.writeOutbound(request);
channel.writeInbound(new Object[] { channel.readOutbound() });
// then
assertEquals(request, channel.readInbound());
}
use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class UnknownAddressMonitorTest method shouldResumeLoggingAfterQuietPeriod.
@Test
public void shouldResumeLoggingAfterQuietPeriod() throws Exception {
// given
Log log = mock(Log.class);
FakeClock clock = testClock();
UnknownAddressMonitor logger = new UnknownAddressMonitor(log, clock, 1000);
MemberId to = member(0);
// when
logger.logAttemptToSendToMemberWithNoKnownAddress(to);
clock.forward(20001, MILLISECONDS);
logger.logAttemptToSendToMemberWithNoKnownAddress(to);
clock.forward(80001, MILLISECONDS);
logger.logAttemptToSendToMemberWithNoKnownAddress(to);
// then
verify(log, times(3)).info(format("No address found for %s, probably because the member has been shut " + "down.", to));
}
use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class UnknownAddressMonitorTest method shouldThrottleLogging.
@Test
public void shouldThrottleLogging() throws Exception {
// given
Log log = mock(Log.class);
FakeClock clock = testClock();
UnknownAddressMonitor logger = new UnknownAddressMonitor(log, clock, 1000);
MemberId to = member(0);
// when
logger.logAttemptToSendToMemberWithNoKnownAddress(to);
clock.forward(1, MILLISECONDS);
logger.logAttemptToSendToMemberWithNoKnownAddress(to);
// then
verify(log, times(1)).info(format("No address found for %s, probably because the member has been shut " + "down.", to));
}
use of org.neo4j.causalclustering.identity.MemberId in project neo4j by neo4j.
the class RaftMessageEncodingDecodingTest method shouldSerializeVoteRequest.
@Test
public void shouldSerializeVoteRequest() throws Exception {
MemberId sender = new MemberId(UUID.randomUUID());
RaftMessages.Vote.Request request = new VoteRequestBuilder().candidate(sender).from(sender).lastLogIndex(2).lastLogTerm(1).term(3).build();
serializeReadBackAndVerifyMessage(request);
}
Aggregations