JournalNode implements Tool, Configurable, JournalNodeMXBean { public InetSocketAddress getBoundIpcAddress() { return rpcServer.getAddress(); }  @Override void setConf(Configuration conf); @Override Configuration getConf(); @Override int run(String[] args); void start(); boolean isStarted(); InetSocketAddress getBoundIpcAddress(); @Deprecated InetSocketAddress getBoundHttpAddress(); String getHttpServerURI(); void stop(int rc); void stopAndJoin(int rc); @Override // JournalNodeMXBean String getJournalsStatus(); static void main(String[] args); void discardSegments(String journalId, long startTxId); void doPreUpgrade(String journalId); void doUpgrade(String journalId, StorageInfo sInfo); void doFinalize(String journalId); Boolean canRollBack(String journalId, StorageInfo storage,
      StorageInfo prevStorage, int targetLayoutVersion); void doRollback(String journalId); Long getJournalCTime(String journalId); static final Log LOG; }
@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); }