public static List<MongoInputSplit> getSplits() { Path path = new Path(NamespaceIndexTest.DB_FILE); FileSystem fs = NamespaceIndexTest.getFilesystem(); MongoInputFormat.setCollection("testcoll1"); MongoInputFormat.setDatabase("deepmr_test"); MongoInputFormat.setMongoDirectory(new Path("src/test")); MongoInputFormat inputFormat = new MongoInputFormat(); return inputFormat.getSplitsFromFile(fs, path); }
@Test public void getSplitsTest() { List<MongoInputSplit> splits = getSplits(); assertTrue(splits.size() == 7); FileSystem fs = NamespaceIndexTest.getFilesystem(); for (MongoInputSplit split : splits) { for (Iterator<Record> i = split.getExtent().iterator(fs); i.hasNext(); ) { Record r = i.next(); assertTrue(r.getId(fs) != null); } } }