@Test public void writesToTheSuppliedPersistenceObjectUsingTheSuppliedCodec() throws Exception { OLogEntry entry = makeEntry(seqNum(1), term(2), "data"); context.checking(new Expectations() {{ ignoring(navigator); allowing(persistence).size(); oneOf(codec).encode(with(equalTo(entry))); atLeast(1).of(persistence).append(with(any(ByteBuffer[].class))); }}); log.append(Lists.newArrayList(entry)); }
@Override public void append(List<E> entries) throws IOException { for (E entry : entries) { persistenceNavigator.notifyLogging(entry.getSeqNum(), persistence.size()); persistence.append(codec.encode(entry)); } }
EncodedSequentialLog implements SequentialLog<E> { @Override public void append(List<E> entries) throws IOException { for (E entry : entries) { persistenceNavigator.notifyLogging(entry.getSeqNum(), persistence.size()); persistence.append(codec.encode(entry)); } } }
EncodedSequentialLog implements SequentialLog<E> { @Override public void append(List<E> entries) throws IOException { for (E entry : entries) { persistenceNavigator.notifyLogging(entry.getSeqNum(), persistence.size()); persistence.append(codec.encode(entry)); } } EncodedSequentialLog(BytePersistence persistence,
                              SequentialEntryCodec<E> codec,
                              PersistenceNavigator persistenceNavigator); }
EncodedSequentialLog implements SequentialLog<E> { @Override public void append(List<E> entries) throws IOException { for (E entry : entries) { persistenceNavigator.notifyLogging(entry.getSeqNum(), persistence.size()); persistence.append(codec.encode(entry)); } } EncodedSequentialLog(BytePersistence persistence,
                              SequentialEntryCodec<E> codec,
                              PersistenceNavigator persistenceNavigator); @Override void append(List<E> entries); @Override List<E> subSequence(long start, long end); @Override boolean isEmpty(); @Override E getLastEntry(); @Override SequentialEntryIterator<E> iterator(); @Override void truncate(long seqNum); @Override void sync(); @Override void close(); }
EncodedSequentialLog implements SequentialLog<E> { @Override public void append(List<E> entries) throws IOException { for (E entry : entries) { persistenceNavigator.notifyLogging(entry.getSeqNum(), persistence.size()); persistence.append(codec.encode(entry)); } } EncodedSequentialLog(BytePersistence persistence,
                              SequentialEntryCodec<E> codec,
                              PersistenceNavigator persistenceNavigator); @Override void append(List<E> entries); @Override List<E> subSequence(long start, long end); @Override boolean isEmpty(); @Override E getLastEntry(); @Override SequentialEntryIterator<E> iterator(); @Override void truncate(long seqNum); @Override void sync(); @Override void close();  }