List<String> joiningServers = new ArrayList<String>();
// assert remotePeerBean.1 of ReplicatedServer_2
int changingIndex = 1;
int replica2 = 2;
QuorumPeer peer2 = qu.getPeer(replica2).peer;
QuorumServer changingQS2 = peer2.getView().get(new Long(changingIndex));
String remotePeerBean2 = CommonNames.DOMAIN
+ ":name0=ReplicatedServer_id" + replica2 + ",name1=replica."
+ changingIndex;
assertRemotePeerMXBeanAttributes(changingQS2, remotePeerBean2);
// assert remotePeerBean.1 of ReplicatedServer_3
int replica3 = 3;
QuorumPeer peer3 = qu.getPeer(replica3).peer;
QuorumServer changingQS3 = peer3.getView().get(new Long(changingIndex));
String remotePeerBean3 = CommonNames.DOMAIN
+ ":name0=ReplicatedServer_id" + replica3 + ",name1=replica."
+ changingIndex;
assertRemotePeerMXBeanAttributes(changingQS3, remotePeerBean3);
String newRole = "observer";
ZooKeeper zk = zkArr[changingIndex];
// exactly as it is now, except for role change
joiningServers.add("server." + changingIndex + "=127.0.0.1:"
+ qu.getPeer(changingIndex).peer.getQuorumAddress().getPort()
+ ":"
+ qu.getPeer(changingIndex).peer.getElectionAddress().getPort()
+ ":" + newRole + ";127.0.0.1:"
+ qu.getPeer(changingIndex).peer.getClientPort());
reconfig(zk, joiningServers, null, null, -1);
testNormalOperation(zkArr[changingIndex], zk);
Assert.assertTrue(qu.getPeer(changingIndex).peer.observer != null
&& qu.getPeer(changingIndex).peer.follower == null
&& qu.getPeer(changingIndex).peer.leader == null);
Assert.assertTrue(qu.getPeer(changingIndex).peer.getPeerState() == ServerState.OBSERVING);
QuorumPeer qp = qu.getPeer(changingIndex).peer;
String localPeerBeanName = CommonNames.DOMAIN
+ ":name0=ReplicatedServer_id" + changingIndex
+ ",name1=replica." + changingIndex;
// localPeerBean.1 of ReplicatedServer_1