InteractionProtocol protocol = new InteractionProtocol(zkClient, _miniCluster.getZkConfiguration());
Master master = new Master(protocol, false);
master.start();
TestUtil.waitUntilBecomeMaster(master);
final IDeployClient deployClient = new DeployClient(_protocol);
WatchedEvent event = new WatchedEvent(new WatcherEvent(EventType.None.getIntValue(), KeeperState.Expired
.getIntValue(), null));
for (int i = 0; i < 25; i++) {
final String indexName = "index" + i;
IIndexDeployFuture deployFuture = deployClient.addIndex(indexName, INDEX_FILE.getAbsolutePath(), 1);
zkClient.getEventLock().lock();
zkClient.process(event);
zkClient.getEventLock().unlock();
IndexState indexState = deployFuture.joinDeployment();
assertEquals("" + deployClient.getIndexMetaData(indexName).getDeployError(), IndexState.DEPLOYED, indexState);
if (indexState == IndexState.ERROR) {
IndexDeployError deployError = protocol.getIndexMD(indexName).getDeployError();
Set<Shard> shards = protocol.getIndexMD(indexName).getShards();
for (Shard shard : shards) {