use of org.neo4j.causalclustering.core.consensus.membership.MemberIdSet in project neo4j by neo4j.
the class RaftContentByteBufferMarshalTest method shouldSerializeMemberSet.
@Test
public void shouldSerializeMemberSet() throws Exception {
// given
CoreReplicatedContentMarshal serializer = new CoreReplicatedContentMarshal();
MemberIdSet in = new MemberIdSet(asSet(new MemberId(UUID.randomUUID()), new MemberId(UUID.randomUUID())));
// when
ByteBuf buf = Unpooled.buffer();
assertMarshalingEquality(serializer, buf, in);
}
use of org.neo4j.causalclustering.core.consensus.membership.MemberIdSet in project neo4j by neo4j.
the class RaftMachineTest method shouldPersistAtSpecifiedLogIndex.
@Test
public void shouldPersistAtSpecifiedLogIndex() throws Exception {
// given
FakeClock fakeClock = Clocks.fakeClock();
ControlledRenewableTimeoutService timeouts = new ControlledRenewableTimeoutService(fakeClock);
RaftMachine raft = new RaftMachineBuilder(myself, 3, RaftTestMemberSetBuilder.INSTANCE).timeoutService(timeouts).clock(fakeClock).raftLog(raftLog).build();
raftLog.append(new RaftLogEntry(0, new MemberIdSet(asSet(myself, member1, member2))));
// when
raft.handle(appendEntriesRequest().from(member1).prevLogIndex(0).prevLogTerm(0).leaderTerm(0).logEntry(new RaftLogEntry(0, data1)).build());
// then
assertEquals(1, raftLog.appendIndex());
assertEquals(data1, readLogEntry(raftLog, 1).content());
}
use of org.neo4j.causalclustering.core.consensus.membership.MemberIdSet in project neo4j by neo4j.
the class RaftTestFixture method bootstrap.
public void bootstrap(MemberId[] members) throws RaftMachine.BootstrapException, IOException {
for (MemberFixture member : members()) {
member.raftLog().append(new RaftLogEntry(0, new MemberIdSet(asSet(members))));
member.raftInstance().installCoreState(new RaftCoreState(new MembershipEntry(0, asSet(members))));
member.raftInstance().startTimers();
}
}
use of org.neo4j.causalclustering.core.consensus.membership.MemberIdSet in project neo4j by neo4j.
the class Fixture method boot.
void boot() throws BootstrapException, TimeoutException, InterruptedException, IOException {
for (RaftFixture raft : rafts) {
raft.raftLog().append(new RaftLogEntry(0, new MemberIdSet(asSet(members))));
raft.raftMachine().installCoreState(new RaftCoreState(new MembershipEntry(0, members)));
raft.raftMachine.startTimers();
}
net.start();
awaitBootstrapped();
}
use of org.neo4j.causalclustering.core.consensus.membership.MemberIdSet in project neo4j by neo4j.
the class CoreReplicatedContentMarshalTest method shouldMarshalMemberSet.
@Test
public void shouldMarshalMemberSet() throws Exception {
ByteBuf buffer = Unpooled.buffer();
ReplicatedContent message = new MemberIdSet(asSet(new MemberId(UUID.randomUUID()), new MemberId(UUID.randomUUID())));
assertMarshalingEquality(buffer, message);
}
Aggregations