@Test(timeout=100000)
public void testJournal() throws Exception {

  MetricsRecordBuilder metrics = MetricsAsserts.getMetrics(
      journal.getMetricsForTests().getName());
  MetricsAsserts.assertCounter("BatchesWritten", 0L, metrics);
  MetricsAsserts.assertCounter("BatchesWrittenWhileLagging", 0L, metrics);
  MetricsAsserts.assertGauge("CurrentLagTxns", 0L, metrics);
  IPCLoggerChannel ch = new IPCLoggerChannel(
      conf, FAKE_NSINFO, journalId, jn.getBoundIpcAddress());
  ch.newEpoch(1).get();
  ch.setEpoch(1);
  ch.startLogSegment(1, NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION).get();
  ch.sendEdits(1L, 1, 1, "hello".getBytes(Charsets.UTF_8)).get();
  
  metrics = MetricsAsserts.getMetrics(
      journal.getMetricsForTests().getName());
  MetricsAsserts.assertCounter("BatchesWritten", 1L, metrics);
  MetricsAsserts.assertCounter("BatchesWrittenWhileLagging", 0L, metrics);
  MetricsAsserts.assertGauge("CurrentLagTxns", 0L, metrics);
  ch.setCommittedTxId(100L);
  ch.sendEdits(1L, 2, 1, "goodbye".getBytes(Charsets.UTF_8)).get();
  metrics = MetricsAsserts.getMetrics(
      journal.getMetricsForTests().getName());
  MetricsAsserts.assertCounter("BatchesWritten", 2L, metrics);
  MetricsAsserts.assertCounter("BatchesWrittenWhileLagging", 1L, metrics);
  MetricsAsserts.assertGauge("CurrentLagTxns", 98L, metrics);
}