当前位置: 首页>>代码示例>>Java>>正文


Java FSEditLogTestUtil.assertStreamsAreEquivalent方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.server.namenode.FSEditLogTestUtil.assertStreamsAreEquivalent方法的典型用法代码示例。如果您正苦于以下问题:Java FSEditLogTestUtil.assertStreamsAreEquivalent方法的具体用法?Java FSEditLogTestUtil.assertStreamsAreEquivalent怎么用?Java FSEditLogTestUtil.assertStreamsAreEquivalent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.server.namenode.FSEditLogTestUtil的用法示例。


在下文中一共展示了FSEditLogTestUtil.assertStreamsAreEquivalent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetInputStreamNoValidationNoCheckLastTxId

import org.apache.hadoop.hdfs.server.namenode.FSEditLogTestUtil; //导入方法依赖的package包/类
@Test
public void testGetInputStreamNoValidationNoCheckLastTxId() throws Exception {
  setupTest("test-get-input-stream-no-validation-no-check-last-txid");
  File tempEditsFile = FSEditLogTestUtil.createTempEditsFile(
      "test-get-input-stream-with-validation");
  try {
    EditLogOutputStream bkeos = bkjm.startLogSegment(1);
    EditLogOutputStream elfos =
        new EditLogFileOutputStream(tempEditsFile, null);
    elfos.create();
    FSEditLogTestUtil.populateStreams(1, 100, bkeos, elfos);
    EditLogInputStream bkeis =
        getJournalInputStreamDontCheckLastTxId(bkjm, 1);
    EditLogInputStream elfis = new EditLogFileInputStream(tempEditsFile);
    Map<String, EditLogInputStream> streamByName =
        ImmutableMap.of("BookKeeper", bkeis, "File", elfis);
    FSEditLogTestUtil.assertStreamsAreEquivalent(100, streamByName);
  } finally {
    if (!tempEditsFile.delete()) {
      LOG.warn("Unable to delete edits file: " +
          tempEditsFile.getAbsolutePath());
    }
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:25,代码来源:TestBookKeeperJournalManager.java

示例2: testReadFromClosedLedgerAfterWriteInner

import org.apache.hadoop.hdfs.server.namenode.FSEditLogTestUtil; //导入方法依赖的package包/类
private void testReadFromClosedLedgerAfterWriteInner(int numEdits)
  throws Exception {
  LedgerHandle ledgerOut = createLedger();
  long ledgerId = ledgerOut.getId();
  BookKeeperEditLogOutputStream bkEditsOut =
      new BookKeeperEditLogOutputStream(ledgerOut);
  EditLogFileOutputStream fileEditsOut =
      new EditLogFileOutputStream(tempEditsFile, null);

  FSEditLogTestUtil.createAndPopulateStreams(1,
      numEdits, bkEditsOut, fileEditsOut);

  BookKeeperEditLogInputStream bkEditsIn =
      new BookKeeperEditLogInputStream(ledgerProvider,
          ledgerId,
          0,
          1,
          numEdits,
          false);
  EditLogFileInputStream fileEditsIn =
      new EditLogFileInputStream(tempEditsFile);

  assertEquals("Length in bytes must be equal!",
      bkEditsIn.length(), fileEditsIn.length());

  FSEditLogTestUtil.assertStreamsAreEquivalent(numEdits,
      ImmutableMap.of("BookKeeper", bkEditsIn, "File", fileEditsIn));
  assertNull("BookKeeper edit log must end at txid 100", bkEditsIn.readOp());
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:30,代码来源:TestBookKeeperEditLogInputStream.java

示例3: testGetInputStreamWithValidation

import org.apache.hadoop.hdfs.server.namenode.FSEditLogTestUtil; //导入方法依赖的package包/类
@Test
public void testGetInputStreamWithValidation() throws Exception {
  setupTest("test-get-input-stream-with-validation");
  File tempEditsFile = FSEditLogTestUtil.createTempEditsFile(
      "test-get-input-stream-with-validation");
  try {
    TestBKJMInjectionHandler h = new TestBKJMInjectionHandler();
    InjectionHandler.set(h);
    EditLogOutputStream bkeos = bkjm.startLogSegment(1);
    EditLogOutputStream elfos =
        new EditLogFileOutputStream(tempEditsFile, null);
    elfos.create();
    FSEditLogTestUtil.populateStreams(1, 100, bkeos, elfos);
    EditLogInputStream bkeis =
        FSEditLogTestUtil.getJournalInputStream(bkjm, 1, true);
    EditLogInputStream elfis = new EditLogFileInputStream(tempEditsFile);
    Map<String, EditLogInputStream> streamByName =
        ImmutableMap.of("BookKeeper", bkeis, "File", elfis);
    FSEditLogTestUtil.assertStreamsAreEquivalent(100, streamByName);
    assertNotNull("Log was validated", h.logValidation);
    assertEquals("numTrasactions validated correctly",
        100, h.logValidation.getNumTransactions());
    assertEquals("endTxId validated correctly",
        100, h.logValidation.getEndTxId());
  } finally {
    if (!tempEditsFile.delete()) {
      LOG.warn("Unable to delete edits file: " +
          tempEditsFile.getAbsolutePath());
    }
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:32,代码来源:TestBookKeeperJournalManager.java


注:本文中的org.apache.hadoop.hdfs.server.namenode.FSEditLogTestUtil.assertStreamsAreEquivalent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。