final String LOOSER1 = "localhost:456";
final String LOOSER2 = "localhost:789";
// Create my state
ServerState mySt = new ServerState();
ChangeNumber cn = new ChangeNumber(4L, 0, myId1);
mySt.update(cn);
cn = new ChangeNumber(2L, 0, myId2); // Should not be used inside algo
mySt.update(cn);
cn = new ChangeNumber(3L, 0, myId3); // Should not be used inside algo
mySt.update(cn);
// Create replication servers info list
HashMap<Integer, ReplicationServerInfo> rsInfos =
new HashMap<Integer, ReplicationServerInfo>();
// State for server 1
ServerState aState = new ServerState();
cn = new ChangeNumber(looser1T1, 0, myId1);
aState.update(cn);
cn = new ChangeNumber(looser1T2, 0, myId2);
aState.update(cn);
cn = new ChangeNumber(looser1T3, 0, myId3);
aState.update(cn);
ReplServerStartMsg replServerStartMsg =
new ReplServerStartMsg(11, LOOSER1, null, 0, aState, (short)0, 0L,
false, (byte)1, 0);
rsInfos.put(11, ReplicationServerInfo.newInstance(replServerStartMsg));
if (looser1IsLocal)
ReplicationServer.onlyForTestsAddlocalReplicationServer(LOOSER1);
// State for server 2
aState = new ServerState();
cn = new ChangeNumber(winnerT1, 0, myId1);
aState.update(cn);
cn = new ChangeNumber(winnerT2, 0, myId2);
aState.update(cn);
cn = new ChangeNumber(winnerT3, 0, myId3);
aState.update(cn);
replServerStartMsg =
new ReplServerStartMsg(12, WINNER, null, 0, aState, (short)0, 0L,
false, (byte)1, 0);
rsInfos.put(12, ReplicationServerInfo.newInstance(replServerStartMsg));
if (winnerIsLocal)
ReplicationServer.onlyForTestsAddlocalReplicationServer(WINNER);
// State for server 3
aState = new ServerState();
cn = new ChangeNumber(looser2T1, 0, myId1);
aState.update(cn);
cn = new ChangeNumber(looser2T2, 0, myId2);
aState.update(cn);
cn = new ChangeNumber(looser2T3, 0, myId3);
aState.update(cn);
replServerStartMsg =
new ReplServerStartMsg(13, LOOSER2, null, 0, aState, (short)0, 0L,
false, (byte)1, 0);
rsInfos.put(13, ReplicationServerInfo.newInstance(replServerStartMsg));