@Before
 public void setUp() throws Exception {
   StreamService streamService = new InternalStreamService(ImmutableSettings.EMPTY);
   new RaftStreamService(streamService);
   SegmentFileService fileService =
       new SegmentFileService(
           ImmutableSettings.builder().put("work_dir", testFolder.getRoot()).build());
   SegmentDescriptorService descriptorService =
       new SegmentDescriptorService(ImmutableSettings.EMPTY, fileService, streamService);
   SegmentIndexService indexService =
       new SegmentIndexService(ImmutableSettings.EMPTY, fileService);
   SegmentService segmentService =
       new SegmentService(ImmutableSettings.EMPTY, streamService, fileService, indexService);
   segmentManager = new SegmentManager(ImmutableSettings.EMPTY, descriptorService, segmentService);
   segmentManager.start();
   Log log = new Log(ImmutableSettings.EMPTY, segmentManager);
   raftLog = new SegmentRaftLog(ImmutableSettings.EMPTY, log);
 }
 @After
 public void tearDown() throws Exception {
   segmentManager.stop();
   segmentManager.close();
 }