### Question:
ZKLogSegmentMetadataStore implements LogSegmentMetadataStore, Watcher, Children2Callback { @Override public void storeMaxLogSegmentSequenceNumber(Transaction<Object> txn, LogMetadata logMetadata, Versioned<Long> lssn, Transaction.OpListener<Version> listener) { Version version = lssn.getVersion(); assert(version instanceof LongVersion); LongVersion zkVersion = (LongVersion) version; byte[] data = DLUtils.serializeLogSegmentSequenceNumber(lssn.getValue()); Op setDataOp = Op.setData(logMetadata.getLogSegmentsPath(), data, (int) zkVersion.getLongVersion()); ZKOp zkOp = new ZKVersionedSetOp(setDataOp, listener); txn.addOp(zkOp); } ZKLogSegmentMetadataStore(DistributedLogConfiguration conf,
                                     ZooKeeperClient zkc,
                                     OrderedScheduler scheduler); @Override void storeMaxLogSegmentSequenceNumber(Transaction<Object> txn,
                                                 LogMetadata logMetadata,
                                                 Versioned<Long> lssn,
                                                 Transaction.OpListener<Version> listener); @Override void storeMaxTxnId(Transaction<Object> txn,
                              LogMetadataForWriter logMetadata,
                              Versioned<Long> transactionId,
                              Transaction.OpListener<Version> listener); @Override Transaction<Object> transaction(); @Override void createLogSegment(Transaction<Object> txn,
                                 LogSegmentMetadata segment,
                                 OpListener<Void> listener); @Override void deleteLogSegment(Transaction<Object> txn,
                                 final LogSegmentMetadata segment,
                                 final OpListener<Void> listener); @Override void updateLogSegment(Transaction<Object> txn, LogSegmentMetadata segment); @Override void process(WatchedEvent event); @Override CompletableFuture<LogSegmentMetadata> getLogSegment(String logSegmentPath); @Override @SuppressWarnings("unchecked") void processResult(int rc, String path, Object ctx, List<String> children, Stat stat); @Override CompletableFuture<Versioned<List<String>>> getLogSegmentNames(String logSegmentsPath,
                                                              LogSegmentNamesListener listener); @Override void unregisterLogSegmentListener(String logSegmentsPath,
                                             LogSegmentNamesListener listener); @Override void close();  }### Answer:
@Test(timeout = 60000) public void testStoreMaxLogSegmentSequenceNumber() throws Exception { Transaction<Object> updateTxn = lsmStore.transaction(); Versioned<Long> value = new Versioned<Long>(999L, new LongVersion(0)); final CompletableFuture<Version> result = new CompletableFuture<Version>(); LogMetadata metadata = mock(LogMetadata.class); when(metadata.getLogSegmentsPath()).thenReturn(rootZkPath); lsmStore.storeMaxLogSegmentSequenceNumber(updateTxn, metadata, value, new Transaction.OpListener<Version>() { @Override public void onCommit(Version r) { result.complete(r); } @Override public void onAbort(Throwable t) { result.completeExceptionally(t); } }); Utils.ioResult(updateTxn.execute()); assertEquals(1L, ((LongVersion) Utils.ioResult(result)).getLongVersion()); Stat stat = new Stat(); byte[] data = zkc.get().getData(rootZkPath, false, stat); assertEquals(999L, DLUtils.deserializeLogSegmentSequenceNumber(data)); assertEquals(1, stat.getVersion()); }