@@ -0,0 +1,3197 @@
+package com.github.bernd.samsa.executable;%0A%0Aimport com.github.bernd.samsa.BrokerState;%0Aimport com.github.bernd.samsa.FetchDataInfo;%0Aimport com.github.bernd.samsa.Log;%0Aimport com.github.bernd.samsa.LogAppendInfo;%0Aimport com.github.bernd.samsa.LogConfig;%0Aimport com.github.bernd.samsa.LogConfigBuilder;%0Aimport com.github.bernd.samsa.LogManager;%0Aimport com.github.bernd.samsa.TopicAndPartition;%0Aimport com.github.bernd.samsa.cleaner.CleanerConfigBuilder;%0Aimport com.github.bernd.samsa.compression.CompressionCodec;%0Aimport com.github.bernd.samsa.message.ByteBufferMessageSet;%0Aimport com.github.bernd.samsa.message.Message;%0Aimport com.github.bernd.samsa.message.MessageAndOffset;%0Aimport com.github.bernd.samsa.message.MessageSet;%0Aimport com.github.bernd.samsa.utils.SamsaScheduler;%0Aimport com.github.bernd.samsa.utils.SystemTime;%0Aimport com.github.bernd.samsa.utils.Utils;%0Aimport com.google.common.base.Optional;%0Aimport com.google.common.collect.Lists;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport java.io.File;%0Aimport java.util.HashMap;%0Aimport java.util.concurrent.TimeUnit;%0A%0Apublic class WriteReadTest %7B%0A    private static final Logger LOG = LoggerFactory.getLogger(WriteReadTest.class);%0A%0A    public static void main(String%5B%5D args) throws Throwable %7B%0A        final int ioThreads = 2;%0A        final long flushCheckMs = TimeUnit.SECONDS.toMillis(60);%0A        final long flushCheckpointMs = TimeUnit.SECONDS.toMillis(60);%0A        final long retentionCheckMs = TimeUnit.SECONDS.toDays(20);%0A%0A        final LogConfig logConfig = new LogConfigBuilder().build();%0A%0A        final LogManager logManager = new LogManager(Lists.newArrayList(new File(%22/tmp/samsa-test%22)),%0A                new HashMap%3CString, LogConfig%3E(),%0A                logConfig,%0A                new CleanerConfigBuilder().build(),%0A                ioThreads, flushCheckMs, flushCheckpointMs, retentionCheckMs,%0A                new SamsaScheduler(2),%0A                new BrokerState(),%0A                new SystemTime());%0A%0A        final TopicAndPartition topicAndPartition = new TopicAndPartition(%22test%22, 0);%0A        final Optional%3CLog%3E logOptional = logManager.getLog(topicAndPartition);%0A        final Log log;%0A%0A        if (logOptional.isPresent()) %7B%0A            log = logOptional.get();%0A        %7D else %7B%0A            log = logManager.createLog(topicAndPartition, logConfig);%0A        %7D%0A%0A        LOG.info(%22Initialized log at %7B%7D%22, logManager.getLogDirs());%0A%0A        final LogAppendInfo info = log.append(new ByteBufferMessageSet(CompressionCodec.NONE, Lists.newArrayList(new Message(%22hello world%22.getBytes()))));%0A%0A        LOG.info(%22Wrote message firstOffset=%7B%7D lastOffset=%7B%7D validBytes=%7B%7D%22, info.firstOffset, info.lastOffset, info.validBytes);%0A%0A        final FetchDataInfo fetchDataInfo = log.read(info.lastOffset, info.validBytes);%0A        final MessageSet messageSet = fetchDataInfo.getMessageSet();%0A%0A        for (final MessageAndOffset messageAndOffset : messageSet) %7B%0A            final Message message = messageAndOffset.getMessage();%0A            final long offset = messageAndOffset.getOffset();%0A%0A            LOG.info(%22Read message: %5C%22%7B%7D%5C%22 (at %7B%7D)%22, new String(Utils.readBytes(message.payload())), offset);%0A        %7D%0A    %7D%0A%7D%0A

Add WriteReadTest.