verifyNoMoreInteractions(listener);
}
@Test(timeout = 70000)
public void testIndexManagement() throws Exception {
IndexMetaData indexMD = new IndexMetaData("index1", "indexPath", 2);
indexMD.getShards().add(new Shard(AbstractIndexOperation.createShardName(indexMD.getName(), "path1"), "path1"));
Node node = Mocks.mockNode();
assertNull(_protocol.getIndexMD("index1"));
assertEquals(0, _protocol.getIndices().size());
// publish index
_protocol.publishIndex(indexMD);
_protocol.publishShard(node, indexMD.getShards().iterator().next().getName());
assertNotNull(_protocol.getIndexMD("index1"));
assertEquals(1, _protocol.getIndices().size());
assertEquals(indexMD.getReplicationLevel(), _protocol.getIndexMD(indexMD.getName()).getReplicationLevel());
// update index
indexMD.setReplicationLevel(3);
_protocol.updateIndexMD(indexMD);
assertEquals(indexMD.getReplicationLevel(), _protocol.getIndexMD(indexMD.getName()).getReplicationLevel());
_protocol.showStructure(false);
_protocol.unpublishIndex(indexMD.getName());
_protocol.showStructure(false);
assertNull(_protocol.getIndexMD("index1"));
assertEquals(0, _protocol.getIndices().size());
String string = ZkPathUtil.toString(_protocol._zkClient);
Set<Shard> shards = indexMD.getShards();
for (Shard shard : shards) {
assertFalse(string.contains(shard.getName()));
}
}