Search in sources :

Example 1 with AppendEntriesRequestBuilder

use of org.neo4j.causalclustering.core.consensus.roles.AppendEntriesRequestBuilder in project neo4j by neo4j.

the class RaftMessageEncodingDecodingTest method shouldSerializeAppendRequestWithMultipleEntries.

@Test
public void shouldSerializeAppendRequestWithMultipleEntries() throws Exception {
    MemberId sender = new MemberId(UUID.randomUUID());
    RaftMessages.AppendEntries.Request request = new AppendEntriesRequestBuilder().from(sender).leaderCommit(2).leaderTerm(4).logEntry(new RaftLogEntry(1, ReplicatedInteger.valueOf(2))).logEntry(new RaftLogEntry(1, ReplicatedInteger.valueOf(3))).logEntry(new RaftLogEntry(1, ReplicatedInteger.valueOf(4))).build();
    serializeReadBackAndVerifyMessage(request);
}
Also used : MemberId(org.neo4j.causalclustering.identity.MemberId) AppendEntriesRequestBuilder(org.neo4j.causalclustering.core.consensus.roles.AppendEntriesRequestBuilder) RaftLogEntry(org.neo4j.causalclustering.core.consensus.log.RaftLogEntry) Test(org.junit.Test)

Example 2 with AppendEntriesRequestBuilder

use of org.neo4j.causalclustering.core.consensus.roles.AppendEntriesRequestBuilder in project neo4j by neo4j.

the class RaftMessageEncodingDecodingTest method shouldSerializeAppendRequestWithNoEntries.

@Test
public void shouldSerializeAppendRequestWithNoEntries() throws Exception {
    MemberId sender = new MemberId(UUID.randomUUID());
    RaftMessages.AppendEntries.Request request = new AppendEntriesRequestBuilder().from(sender).leaderCommit(2).leaderTerm(4).build();
    serializeReadBackAndVerifyMessage(request);
}
Also used : MemberId(org.neo4j.causalclustering.identity.MemberId) AppendEntriesRequestBuilder(org.neo4j.causalclustering.core.consensus.roles.AppendEntriesRequestBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 AppendEntriesRequestBuilder (org.neo4j.causalclustering.core.consensus.roles.AppendEntriesRequestBuilder)2 MemberId (org.neo4j.causalclustering.identity.MemberId)2 RaftLogEntry (org.neo4j.causalclustering.core.consensus.log.RaftLogEntry)1