AggregatingRecordReaderTest.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:accumulo-wikisearch 作者:
@Test
public void testPartialXML2() throws Exception {
  File f = createFile(xml3);

  // Create FileSplit
  Path p = new Path(f.toURI().toString());
  WikipediaInputSplit split = new WikipediaInputSplit(new FileSplit(p, 0, f.length(), null), 0);

  // Initialize the RecordReader
  AggregatingRecordReader reader = new AggregatingRecordReader();
  reader.initialize(split, ctx);
  assertTrue(reader.nextKeyValue());
  testXML(reader.getCurrentValue(), "A", "B", "");
  assertTrue(reader.nextKeyValue());
  testXML(reader.getCurrentValue(), "C", "D", "");
  assertTrue(reader.nextKeyValue());
  try {
    testXML(reader.getCurrentValue(), "E", "", "");
    fail("Fragment returned, and it somehow passed XML parsing.");
  } catch (SAXParseException e) {
    // ignore
  }
  assertTrue(!reader.nextKeyValue());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号