Source:
public void iterationWithoutReloadTest() throws IOException { String storeName = "store"; List<CompactionDetails> detailsList = getCompactionDetails(5); assertFalse("Compaction should not be in progress", CompactionLog.isCompactionInProgress(tempDirStr, storeName)); CompactionLog log = new CompactionLog(tempDirStr, storeName, time, detailsList); assertTrue("Compaction should be in progress", CompactionLog.isCompactionInProgress(tempDirStr, storeName)); int currentIdx = 0; for (CompactionDetails details : detailsList) { assertEquals("CurrentIdx not as expected", currentIdx, log.getCurrentIdx()); verifyEquality(details, log.getCompactionDetails()); assertEquals("Should be in the PREPARE phase", CompactionLog.Phase.PREPARE, log.getCompactionPhase()); log.markCopyStart(); assertEquals("Should be in the COPY phase", CompactionLog.Phase.COPY, log.getCompactionPhase()); StoreFindToken safeToken = new StoreFindToken(new MockId("dummy"), new Offset(LogSegmentNameHelper.generateFirstSegmentName(true), 0), new UUID(1, 1), new UUID(1, 1)); log.setSafeToken(safeToken); assertEquals("Returned token not the same as the one that was set", safeToken, log.getSafeToken()); log.markCommitStart(); assertEquals("Should be in the SWITCH phase", CompactionLog.Phase.COMMIT, log.getCompactionPhase()); log.markCleanupStart(); assertEquals("Should be in the CLEANUP phase", CompactionLog.Phase.CLEANUP, log.getCompactionPhase()); log.markCycleComplete(); currentIdx++; } assertEquals("CurrentIdx not as expected", -1, log.getCurrentIdx()); assertEquals("Should be in the DONE phase", CompactionLog.Phase.DONE, log.getCompactionPhase()); log.close(); assertFalse("Compaction should not be in progress", CompactionLog.isCompactionInProgress(tempDirStr, storeName)); }

Target:
public void iterationWithoutReloadTest() throws IOException { String storeName = "store"; List<CompactionDetails> detailsList = getCompactionDetails(5); assertFalse("Compaction should not be in progress", CompactionLog.isCompactionInProgress(tempDirStr, storeName)); CompactionLog cLog = new CompactionLog(tempDirStr, storeName, time, detailsList); assertTrue("Compaction should be in progress", CompactionLog.isCompactionInProgress(tempDirStr, storeName)); int currentIdx = 0; for (CompactionDetails details : detailsList) { assertEquals("CurrentIdx not as expected", currentIdx, cLog.getCurrentIdx()); verifyEquality(details, cLog.getCompactionDetails()); assertEquals("Should be in the PREPARE phase", CompactionLog.Phase.PREPARE, cLog.getCompactionPhase()); cLog.markCopyStart(); assertEquals("Should be in the COPY phase", CompactionLog.Phase.COPY, cLog.getCompactionPhase()); StoreFindToken safeToken = new StoreFindToken(new MockId("dummy"), new Offset(LogSegmentNameHelper.generateFirstSegmentName(true), 0), new UUID(1, 1), new UUID(1, 1)); cLog.setSafeToken(safeToken); assertEquals("Returned token not the same as the one that was set", safeToken, cLog.getSafeToken()); cLog.markCommitStart(); assertEquals("Should be in the SWITCH phase", CompactionLog.Phase.COMMIT, cLog.getCompactionPhase()); cLog.markCleanupStart(); assertEquals("Should be in the CLEANUP phase", CompactionLog.Phase.CLEANUP, cLog.getCompactionPhase()); cLog.markCycleComplete(); currentIdx++; } assertEquals("CurrentIdx not as expected", -1, cLog.getCurrentIdx()); assertEquals("Should be in the DONE phase", CompactionLog.Phase.DONE, cLog.getCompactionPhase()); cLog.close(); assertFalse("Compaction should not be in progress", CompactionLog.isCompactionInProgress(tempDirStr, storeName)); }