@Test public void returnsTheLastQuorumConfigurationAndItsSeqNum() throws Exception { havingLogged( entries() .term(999) .seqNums(5) .configurationAndSeqNum(firstConfig, 6) .seqNums(7, 8, 9)); assertThat(oracle.getLastQuorumConfig(), is(equalTo(configurationAndSeqNum(firstConfig, 6)))); havingLogged( entries() .term(999) .configurationAndSeqNum(secondConfig, 10)); assertThat(oracle.getLastQuorumConfig(), is(equalTo(configurationAndSeqNum(secondConfig, 10)))); }
@Override public QuorumConfigurationWithSeqNum getLastQuorumConfig() { if (configMap.isEmpty()) { return new QuorumConfigurationWithSeqNum(QuorumConfiguration.EMPTY, 0); } else { final Map.Entry<Long, QuorumConfiguration> lastEntry = configMap.lastEntry(); return new QuorumConfigurationWithSeqNum(lastEntry.getValue(), lastEntry.getKey()); } }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public QuorumConfigurationWithSeqNum getLastQuorumConfig() { if (configMap.isEmpty()) { return new QuorumConfigurationWithSeqNum(QuorumConfiguration.EMPTY, 0); } else { final Map.Entry<Long, QuorumConfiguration> lastEntry = configMap.lastEntry(); return new QuorumConfigurationWithSeqNum(lastEntry.getValue(), lastEntry.getKey()); } } }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public QuorumConfigurationWithSeqNum getLastQuorumConfig() { if (configMap.isEmpty()) { return new QuorumConfigurationWithSeqNum(QuorumConfiguration.EMPTY, 0); } else { final Map.Entry<Long, QuorumConfiguration> lastEntry = configMap.lastEntry(); return new QuorumConfigurationWithSeqNum(lastEntry.getValue(), lastEntry.getKey()); } }  }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public QuorumConfigurationWithSeqNum getLastQuorumConfig() { if (configMap.isEmpty()) { return new QuorumConfigurationWithSeqNum(QuorumConfiguration.EMPTY, 0); } else { final Map.Entry<Long, QuorumConfiguration> lastEntry = configMap.lastEntry(); return new QuorumConfigurationWithSeqNum(lastEntry.getValue(), lastEntry.getKey()); } }  @Override void notifyLogging(OLogEntry entry); @Override void notifyTruncation(long seqNum); @Override long getGreatestSeqNum(); @Override long getLastTerm(); @Override long getTermAtSeqNum(long seqNum); @Override QuorumConfigurationWithSeqNum getLastQuorumConfig(); }
NavigableMapOLogEntryOracle implements OLogEntryOracle { @Override public QuorumConfigurationWithSeqNum getLastQuorumConfig() { if (configMap.isEmpty()) { return new QuorumConfigurationWithSeqNum(QuorumConfiguration.EMPTY, 0); } else { final Map.Entry<Long, QuorumConfiguration> lastEntry = configMap.lastEntry(); return new QuorumConfigurationWithSeqNum(lastEntry.getValue(), lastEntry.getKey()); } }  @Override void notifyLogging(OLogEntry entry); @Override void notifyTruncation(long seqNum); @Override long getGreatestSeqNum(); @Override long getLastTerm(); @Override long getTermAtSeqNum(long seqNum); @Override QuorumConfigurationWithSeqNum getLastQuorumConfig();  }