super(2);
}
@Test(timeout = 20000)
public void testDeployAndUndeployIndex() throws Exception {
final InteractionProtocol protocol = _miniCluster.getProtocol();
IndexDeployOperation deployOperation = new IndexDeployOperation(INDEX_NAME, "file://"
+ INDEX_FILE.getAbsolutePath(), getNodeCount());
protocol.addMasterOperation(deployOperation);
TestUtil.waitUntilIndexDeployed(protocol, INDEX_NAME);
assertEquals(1, protocol.getIndices().size());
IndexMetaData indexMD = protocol.getIndexMD(INDEX_NAME);
assertEquals(null, indexMD.getDeployError());
assertEquals(SHARD_COUNT, indexMD.getShards().size());
Set<Shard> shards = indexMD.getShards();
for (Shard shard : shards) {
assertEquals(getNodeCount(), protocol.getShardNodes(shard.getName()).size());
assertEquals(1, shard.getMetaDataMap().size());
}
// undeploy
IndexUndeployOperation undeployOperation = new IndexUndeployOperation(INDEX_NAME);
protocol.addMasterOperation(undeployOperation);
TestUtil.waitUntilShardsUndeployed(protocol, indexMD);
assertEquals(0, protocol.getIndices().size());
assertEquals(null, protocol.getIndexMD(INDEX_NAME));
for (Shard shard : shards) {
assertEquals(0, protocol.getShardNodes(shard.getName()).size());
}
assertEquals(0, protocol.getZkClient().getChildren(getZkConfiguration().getZkPath(PathDef.SHARD_TO_NODES)).size());
}