+ assertEquals("New peer Ids", Set.of(follower), Set.copyOf(context.getPeerIds()));
+ }
+
+ @Test
+ public void testOnSnapshotOfferWithServerConfiguration() {
+ long electionTerm = 2;
+ String electionVotedFor = "member-2";
+ ServerConfigurationPayload serverPayload = new ServerConfigurationPayload(List.of(
+ new ServerInfo(localId, true),
+ new ServerInfo("follower1", true),
+ new ServerInfo("follower2", true)));
+
+ MockSnapshotState snapshotState = new MockSnapshotState(List.of(new MockPayload("1")));
+ Snapshot snapshot = Snapshot.create(snapshotState, List.of(),
+ -1, -1, -1, -1, electionTerm, electionVotedFor, serverPayload);
+
+ SnapshotMetadata metadata = new SnapshotMetadata("test", 6, 12345);
+ SnapshotOffer snapshotOffer = new SnapshotOffer(metadata, snapshot);
+
+ sendMessageToSupport(snapshotOffer);
+
+ assertEquals("Journal log size", 0, context.getReplicatedLog().size());
+ assertEquals("Election term", electionTerm, context.getTermInformation().getCurrentTerm());
+ assertEquals("Election votedFor", electionVotedFor, context.getTermInformation().getVotedFor());
+ assertTrue("Dynamic server configuration", context.isDynamicServerConfigurationInUse());
+ assertEquals("Peer List", Set.of("follower1", "follower2"), Set.copyOf(context.getPeerIds()));