assertEquals(1, masterQueue.size());
}
@Test
public void testBalanceOverreplicatedIndex() throws Exception {
MasterQueue masterQueue = Mocks.publishMaster(_protocol);
// add nodes and index
List<Node> nodes = Mocks.mockNodes(3);
List<NodeQueue> nodeQueues = Mocks.publisNodes(_protocol, nodes);
deployIndex(nodes, nodeQueues);
assertEquals(0, masterQueue.size());
// balance the index does not change anything
CheckIndicesOperation balanceOperation = new CheckIndicesOperation();
balanceOperation.execute(_context, EMPTY_LIST);
assertEquals(0, masterQueue.size());
// decrease the replication count and then balance again
IndexMetaData indexMD = _protocol.getIndexMD(_indexName);
indexMD.setReplicationLevel(2);
_protocol.updateIndexMD(indexMD);
balanceOperation.execute(_context, EMPTY_LIST);
assertEquals(1, masterQueue.size());
}