break;
default:
sizes[i] = 1L;
paths[i] = "/index/small-" + i;
}
splits.add(new LuceneIndexInputSplit(Lists.newArrayList(new Path(paths[i])), sizes[i]));
}
List<InputSplit> combined = lif.combineSplits(splits, 150L, 10L);
assertEquals(12, combined.size());
for (int i = 0; i < 9; i++) {
LuceneIndexInputSplit split = (LuceneIndexInputSplit) combined.get(i);
assertEquals(10L, split.getIndexDirs().size());
assertEquals(10L, split.getLength());
for (Path p : split.getIndexDirs()) {
assertTrue(p.toString().startsWith("/index/small-"));
}
}
LuceneIndexInputSplit split = (LuceneIndexInputSplit) combined.get(9);
assertEquals(8, split.getIndexDirs().size());
assertEquals(107, split.getLength());
for (int i = 0; i < 7; i++) {
assertTrue(split.getIndexDirs().get(i).toString().startsWith("/index/small-"));
}
assertEquals("/index/100", split.getIndexDirs().get(7).toString());
split = (LuceneIndexInputSplit) combined.get(10);
assertEquals(1, split.getIndexDirs().size());
assertEquals(300, split.getLength());
assertEquals("/index/300", split.getIndexDirs().get(0).toString());
split = (LuceneIndexInputSplit) combined.get(11);
assertEquals(1, split.getIndexDirs().size());
assertEquals(500, split.getLength());
assertEquals("/index/500", split.getIndexDirs().get(0).toString());
}