Author: frm
Date: Tue Nov 27 17:22:28 2018
New Revision: 1847567

URL: http://svn.apache.org/viewvc?rev=1847567&view=rev
Log:
OAK-7918 - Remove ConsistencyChecker

ConsistencyChecker acted as a middleman between the Check command and
ConsistencyCheckerTemplate. It didn't provide any useful functionality outside
of the context of the Check command. This commit merges ConsistencyChcker in
the Check command and removes. Additionally, this commit moves the tests for
the Check command into the o.a.j.o.segment.tool package.

Added:
    
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckInvalidRepositoryTest.java
      - copied, changed from r1847566, 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckInvalidRepositoryTest.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckRepositoryTestBase.java
      - copied, changed from r1847566, 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckRepositoryTestBase.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckValidRepositoryTest.java
      - copied, changed from r1847566, 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckValidRepositoryTest.java
Removed:
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyChecker.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckInvalidRepositoryTest.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckRepositoryTestBase.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckValidRepositoryTest.java
Modified:
    jackrabbit/oak/trunk/oak-benchmarks/src/main/resources/logback.xml
    jackrabbit/oak/trunk/oak-run/src/main/resources/logback.xml
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyCheckerTemplate.java
    
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Check.java

Modified: jackrabbit/oak/trunk/oak-benchmarks/src/main/resources/logback.xml
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-benchmarks/src/main/resources/logback.xml?rev=1847567&r1=1847566&r2=1847567&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-benchmarks/src/main/resources/logback.xml 
(original)
+++ jackrabbit/oak/trunk/oak-benchmarks/src/main/resources/logback.xml Tue Nov 
27 17:22:28 2018
@@ -44,9 +44,6 @@
   <!-- Display information messages from oak-run check (oak-segment) -->
   <logger 
name="org.apache.jackrabbit.oak.plugins.segment.file.tooling.ConsistencyChecker"
 level="DEBUG"/>
 
-  <!-- Display information messages from oak-run check (oak-segment-tar) -->
-  <logger 
name="org.apache.jackrabbit.oak.segment.file.tooling.ConsistencyChecker" 
level="DEBUG"/>
-
   <root level="warn">
     <appender-ref ref="STDERR" />
   </root>

Modified: jackrabbit/oak/trunk/oak-run/src/main/resources/logback.xml
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/resources/logback.xml?rev=1847567&r1=1847566&r2=1847567&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/resources/logback.xml (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/resources/logback.xml Tue Nov 27 
17:22:28 2018
@@ -51,9 +51,6 @@
   <!-- Display information messages from oak-run check (oak-segment) -->
   <logger 
name="org.apache.jackrabbit.oak.plugins.segment.file.tooling.ConsistencyChecker"
 level="DEBUG"/>
 
-  <!-- Display information messages from oak-run check (oak-segment-tar) -->
-  <logger 
name="org.apache.jackrabbit.oak.segment.file.tooling.ConsistencyChecker" 
level="DEBUG"/>
-
   <!-- Display information messages from oak-run composite-prepare -->
   <logger name="org.apache.jackrabbit.oak.run.CompositePrepareCommand" 
level="INFO"/>
 

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyCheckerTemplate.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyCheckerTemplate.java?rev=1847567&r1=1847566&r2=1847567&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyCheckerTemplate.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tooling/ConsistencyCheckerTemplate.java
 Tue Nov 27 17:22:28 2018
@@ -48,7 +48,7 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateUtils;
 
-abstract class ConsistencyCheckerTemplate {
+public abstract class ConsistencyCheckerTemplate {
 
     private static NodeState getDescendantOrNull(NodeState root, String path) {
         NodeState descendant = NodeStateUtils.getNode(root, path);
@@ -99,63 +99,63 @@ abstract class ConsistencyCheckerTemplat
         }
     }
 
-    void onCheckRevision(String revision) {
+    protected void onCheckRevision(String revision) {
         // Do nothing.
     }
 
-    void onCheckHead() {
+    protected void onCheckHead() {
         // Do nothing.
     }
 
-    void onCheckChekpoints() {
+    protected  void onCheckChekpoints() {
         // Do nothing.
     }
 
-    void onCheckCheckpoint(String checkpoint) {
+    protected  void onCheckCheckpoint(String checkpoint) {
         // Do nothing.
     }
 
-    void onCheckpointNotFoundInRevision(String checkpoint) {
+    protected void onCheckpointNotFoundInRevision(String checkpoint) {
         // Do nothing.
     }
 
-    void onCheckRevisionError(String revision, Exception e) {
+    protected void onCheckRevisionError(String revision, Exception e) {
         // Do nothing.
     }
 
-    void onConsistentPath(String path) {
+    protected void onConsistentPath(String path) {
         // Do nothing.
     }
 
-    void onPathNotFound(String path) {
+    protected void onPathNotFound(String path) {
         // Do nothing.
     }
 
-    void onCheckTree(String path) {
+    protected void onCheckTree(String path) {
         // Do nothing.
     }
 
-    void onCheckTreeEnd() {
+    protected void onCheckTreeEnd() {
         // Do nothing.
     }
 
-    void onCheckNode(String path) {
+    protected void onCheckNode(String path) {
         // Do nothing.
     }
 
-    void onCheckProperty() {
+    protected void onCheckProperty() {
         // Do nothing.
     }
 
-    void onCheckPropertyEnd(String path, PropertyState property) {
+    protected void onCheckPropertyEnd(String path, PropertyState property) {
         // Do nothing.
     }
 
-    void onCheckNodeError(String path, Exception e) {
+    protected void onCheckNodeError(String path, Exception e) {
         // Do nothing.
     }
 
-    void onCheckTreeError(String path, Exception e) {
+    protected void onCheckTreeError(String path, Exception e) {
         // Do nothing.
     }
 

Modified: 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Check.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Check.java?rev=1847567&r1=1847566&r2=1847567&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Check.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/tool/Check.java
 Tue Nov 27 17:22:28 2018
@@ -19,12 +19,32 @@ package org.apache.jackrabbit.oak.segmen
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
+import static java.text.DateFormat.getDateTimeInstance;
+import static org.apache.jackrabbit.oak.commons.IOUtils.humanReadableByteCount;
+import static 
org.apache.jackrabbit.oak.segment.file.FileStoreBuilder.fileStoreBuilder;
 
 import java.io.File;
 import java.io.PrintWriter;
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Optional;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
 
-import org.apache.jackrabbit.oak.segment.file.tooling.ConsistencyChecker;
+import com.google.common.base.Strings;
+import com.google.common.collect.Sets;
+import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
+import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
+import org.apache.jackrabbit.oak.segment.file.JournalReader;
+import org.apache.jackrabbit.oak.segment.file.ReadOnlyFileStore;
+import org.apache.jackrabbit.oak.segment.file.tar.LocalJournalFile;
+import 
org.apache.jackrabbit.oak.segment.file.tooling.ConsistencyCheckerTemplate;
+import 
org.apache.jackrabbit.oak.segment.file.tooling.ConsistencyCheckerTemplate.ConsistencyCheckResult;
+import 
org.apache.jackrabbit.oak.segment.file.tooling.ConsistencyCheckerTemplate.Revision;
+import org.apache.jackrabbit.oak.segment.spi.monitor.IOMonitorAdapter;
 
 /**
  * Perform a consistency check on an existing segment store.
@@ -205,6 +225,23 @@ public class Check {
 
     }
 
+    private static class StatisticsIOMonitor extends IOMonitorAdapter {
+
+        AtomicLong ops = new AtomicLong(0);
+
+        AtomicLong bytes = new AtomicLong(0);
+
+        AtomicLong time = new AtomicLong(0);
+
+        @Override
+        public void afterSegmentRead(File file, long msb, long lsb, int 
length, long elapsed) {
+            ops.incrementAndGet();
+            bytes.addAndGet(length);
+            time.addAndGet(elapsed);
+        }
+
+    }
+
     private final File path;
 
     private final String journal;
@@ -214,16 +251,22 @@ public class Check {
     private final boolean checkBinaries;
     
     private final boolean checkHead;
-    
-    private final Set<String> checkpoints;
+
+    private final Set<String> requestedCheckpoints;
     
     private final Set<String> filterPaths;
 
     private final boolean ioStatistics;
-    
-    private final PrintWriter outWriter;
-    
-    private final PrintWriter errWriter;
+
+    private final PrintWriter out;
+
+    private final PrintWriter err;
+
+    private int nodeCount;
+
+    private int propertyCount;
+
+    private long lastDebugEvent;
 
     private Check(Builder builder) {
         this.path = builder.path;
@@ -231,29 +274,239 @@ public class Check {
         this.debugInterval = builder.debugInterval;
         this.checkHead = builder.checkHead;
         this.checkBinaries = builder.checkBinaries;
-        this.checkpoints = builder.checkpoints;
+        this.requestedCheckpoints = builder.checkpoints;
         this.filterPaths = builder.filterPaths;
         this.ioStatistics = builder.ioStatistics;
-        this.outWriter = builder.outWriter;
-        this.errWriter = builder.errWriter;
+        this.out = builder.outWriter;
+        this.err = builder.errWriter;
     }
 
     public int run() {
-        try (ConsistencyChecker checker = new ConsistencyChecker(path, 
debugInterval, ioStatistics, outWriter, errWriter)) {
-            checker.checkConsistency(
-                path,
-                journal,
-                checkBinaries,
-                checkHead,
-                checkpoints,
-                filterPaths,
-                ioStatistics
-            );
+        StatisticsIOMonitor ioMonitor = new StatisticsIOMonitor();
+
+        FileStoreBuilder builder = fileStoreBuilder(path);
+
+        if (ioStatistics) {
+            builder.withIOMonitor(ioMonitor);
+        }
+
+        try (
+            ReadOnlyFileStore store = builder.buildReadOnly();
+            JournalReader journal = new JournalReader(new 
LocalJournalFile(path, this.journal))
+        ) {
+            run(store, journal);
+
+            if (ioStatistics) {
+                print("[I/O] Segment read: Number of operations: {0}", 
ioMonitor.ops.get());
+                print("[I/O] Segment read: Total size: {0} ({1} bytes)", 
humanReadableByteCount(ioMonitor.bytes.get()), ioMonitor.bytes.get());
+                print("[I/O] Segment read: Total time: {0} ns", 
ioMonitor.time.get());
+            }
+
             return 0;
         } catch (Exception e) {
-            e.printStackTrace(errWriter);
+            e.printStackTrace(err);
             return 1;
         }
     }
 
+    private void run(ReadOnlyFileStore store, JournalReader journal) {
+        ConsistencyCheckerTemplate template = new ConsistencyCheckerTemplate() 
{
+
+            @Override
+            protected void onCheckRevision(String revision) {
+                print("\nChecking revision {0}", revision);
+            }
+
+            @Override
+            protected void onCheckHead() {
+                print("\nChecking head\n");
+            }
+
+            @Override
+            protected void onCheckChekpoints() {
+                print("\nChecking checkpoints");
+            }
+
+            @Override
+            protected void onCheckCheckpoint(String checkpoint) {
+                print("\nChecking checkpoint {0}", checkpoint);
+            }
+
+            @Override
+            protected void onCheckpointNotFoundInRevision(String checkpoint) {
+                printError("Checkpoint {0} not found in this revision!", 
checkpoint);
+            }
+
+            @Override
+            protected void onCheckRevisionError(String revision, Exception e) {
+                printError("Skipping invalid record id {0}: {1}", revision, e);
+            }
+
+            @Override
+            protected void onConsistentPath(String path) {
+                print("Path {0} is consistent", path);
+            }
+
+            @Override
+            protected void onPathNotFound(String path) {
+                printError("Path {0} not found", path);
+            }
+
+            @Override
+            protected void onCheckTree(String path) {
+                nodeCount = 0;
+                propertyCount = 0;
+                print("Checking {0}", path);
+            }
+
+            @Override
+            protected void onCheckTreeEnd() {
+                print("Checked {0} nodes and {1} properties", nodeCount, 
propertyCount);
+            }
+
+            @Override
+            protected void onCheckNode(String path) {
+                debug("Traversing {0}", path);
+                nodeCount++;
+            }
+
+            @Override
+            protected void onCheckProperty() {
+                propertyCount++;
+            }
+
+            @Override
+            protected void onCheckPropertyEnd(String path, PropertyState 
property) {
+                debug("Checked {0}/{1}", path, property);
+            }
+
+            @Override
+            protected void onCheckNodeError(String path, Exception e) {
+                printError("Error while traversing {0}: {1}", path, e);
+            }
+
+            @Override
+            protected void onCheckTreeError(String path, Exception e) {
+                printError("Error while traversing {0}: {1}", path, 
e.getMessage());
+            }
+
+        };
+
+        Set<String> checkpoints = requestedCheckpoints;
+
+        if (requestedCheckpoints.contains("all")) {
+            checkpoints = 
Sets.newLinkedHashSet(SegmentNodeStoreBuilders.builder(store).build().checkpoints());
+        }
+
+        ConsistencyCheckResult result = template.checkConsistency(
+            store,
+            journal,
+            checkHead,
+            checkpoints,
+            filterPaths,
+            checkBinaries
+        );
+
+        print("\nSearched through {0} revisions and {1} checkpoints", 
result.getCheckedRevisionsCount(), checkpoints.size());
+
+        if (hasAnyRevision(result)) {
+            if (checkHead) {
+                print("\nHead");
+                for (Entry<String, Revision> e : 
result.getHeadRevisions().entrySet()) {
+                    printRevision(0, e.getKey(), e.getValue());
+                }
+            }
+            if (checkpoints.size() > 0) {
+                print("\nCheckpoints");
+                for (String checkpoint : 
result.getCheckpointRevisions().keySet()) {
+                    print("- {0}", checkpoint);
+                    for (Entry<String, Revision> e : 
result.getCheckpointRevisions().get(checkpoint).entrySet()) {
+                        printRevision(2, e.getKey(), e.getValue());
+                    }
+
+                }
+            }
+            print("\nOverall");
+            printOverallRevision(result.getOverallRevision());
+        } else {
+            print("No good revision found");
+        }
+    }
+
+    private void print(String format, Object... arguments) {
+        out.println(MessageFormat.format(format, arguments));
+    }
+
+    private void printError(String format, Object... args) {
+        err.println(MessageFormat.format(format, args));
+    }
+
+    private void debug(String format, Object... arg) {
+        if (debug()) {
+            print(format, arg);
+        }
+    }
+
+    private boolean debug() {
+        // Avoid calling System.currentTimeMillis(), which is slow on some 
systems.
+        if (debugInterval == Long.MAX_VALUE) {
+            return false;
+        }
+
+        if (debugInterval == 0) {
+            return true;
+        }
+
+        long t = System.currentTimeMillis();
+        if ((t - this.lastDebugEvent) / 1000 > debugInterval) {
+            this.lastDebugEvent = t;
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private static boolean hasAnyRevision(ConsistencyCheckResult result) {
+        return hasAnyHeadRevision(result) || hasAnyCheckpointRevision(result);
+    }
+
+    private static boolean hasAnyHeadRevision(ConsistencyCheckResult result) {
+        return result.getHeadRevisions()
+            .values()
+            .stream()
+            .anyMatch(Objects::nonNull);
+    }
+
+    private static boolean hasAnyCheckpointRevision(ConsistencyCheckResult 
result) {
+        return result.getCheckpointRevisions()
+            .values()
+            .stream()
+            .flatMap(m -> m.values().stream())
+            .anyMatch(Objects::nonNull);
+    }
+
+    private void printRevision(int indent, String path, Revision revision) {
+        Optional<Revision> r = Optional.ofNullable(revision);
+        print(
+            "{0}Latest good revision for path {1} is {2} from {3}",
+            Strings.repeat(" ", indent),
+            path,
+            r.map(Revision::getRevision).orElse("none"),
+            
r.map(Revision::getTimestamp).map(Check::timestampToString).orElse("unknown 
time")
+        );
+    }
+
+    private void printOverallRevision(Revision revision) {
+        Optional<Revision> r = Optional.ofNullable(revision);
+        print(
+            "Latest good revision for paths and checkpoints checked is {0} 
from {1}",
+            r.map(Revision::getRevision).orElse("none"),
+            
r.map(Revision::getTimestamp).map(Check::timestampToString).orElse("unknown 
time")
+        );
+    }
+
+    private static String timestampToString(long timestamp) {
+        return getDateTimeInstance().format(new Date(timestamp));
+    }
+
 }

Copied: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckInvalidRepositoryTest.java
 (from r1847566, 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckInvalidRepositoryTest.java)
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckInvalidRepositoryTest.java?p2=jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckInvalidRepositoryTest.java&p1=jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckInvalidRepositoryTest.java&r1=1847566&r2=1847567&rev=1847567&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckInvalidRepositoryTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckInvalidRepositoryTest.java
 Tue Nov 27 17:22:28 2018
@@ -16,7 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.segment.file.tooling;
+
+package org.apache.jackrabbit.oak.segment.tool;
 
 import java.io.File;
 import java.io.IOException;
@@ -32,12 +33,11 @@ import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.oak.segment.file.JournalEntry;
 import org.apache.jackrabbit.oak.segment.file.JournalReader;
 import org.apache.jackrabbit.oak.segment.file.tar.LocalJournalFile;
-import org.apache.jackrabbit.oak.segment.tool.Check;
 import org.junit.Before;
 import org.junit.Test;
 
 /**
- * Tests for {@link CheckCommand} assuming an invalid repository.
+ * Tests for {@link Check} assuming an invalid repository.
  */
 public class CheckInvalidRepositoryTest extends CheckRepositoryTestBase {
 
@@ -51,170 +51,170 @@ public class CheckInvalidRepositoryTest
     public void testInvalidRevisionFallbackOnValid() {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckHead(true)
-        .withCheckpoints(checkpoints)
-        .withCheckBinaries(true)
-        .withFilterPaths(filterPaths)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
-        outWriter.close();
-        errWriter.close();
-        
-        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checked 7 
nodes and 21 properties", "Path / is consistent", 
-                 "Searched through 2 revisions"));
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckHead(true)
+            .withCheckpoints(checkpoints)
+            .withCheckBinaries(true)
+            .withFilterPaths(filterPaths)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
+        outWriter.close();
+        errWriter.close();
+
+        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checked 7 
nodes and 21 properties", "Path / is consistent",
+            "Searched through 2 revisions"));
+
         // not sure whether first traversal will fail because of "/a" or "/z" 
         assertExpectedOutput(strErr.toString(), Lists.newArrayList("Error 
while traversing /"));
     }
-    
+
     @Test
     public void testPartialBrokenPathWithoutValidRevision() {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/z");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckBinaries(true)
-        .withCheckHead(true)
-        .withCheckpoints(checkpoints)
-        .withFilterPaths(filterPaths)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withCheckpoints(checkpoints)
+            .withFilterPaths(filterPaths)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
+
         assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Checking checkpoints", "No good revision found"));
         assertExpectedOutput(strErr.toString(),
-                Lists.newArrayList(
-                        "Error while traversing /z: 
java.lang.IllegalArgumentException: Segment reference out of bounds",
-                        "Path /z not found"));
+            Lists.newArrayList(
+                "Error while traversing /z: 
java.lang.IllegalArgumentException: Segment reference out of bounds",
+                "Path /z not found"));
     }
-    
+
     @Test
     public void testPartialBrokenPathWithValidRevision() {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/a");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckBinaries(true)
-        .withCheckHead(true)
-        .withCheckpoints(new HashSet<String>())
-        .withFilterPaths(filterPaths)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
-        outWriter.close();
-        errWriter.close();
-        
-        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checked 1 
nodes and 1 properties", "Path /a is consistent", 
-                "Searched through 2 revisions"));
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withCheckpoints(new HashSet<String>())
+            .withFilterPaths(filterPaths)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
+        outWriter.close();
+        errWriter.close();
+
+        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checked 1 
nodes and 1 properties", "Path /a is consistent",
+            "Searched through 2 revisions"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList(
-                "Error while traversing /a: 
java.lang.IllegalArgumentException: Segment reference out of bounds"));
+            "Error while traversing /a: java.lang.IllegalArgumentException: 
Segment reference out of bounds"));
     }
-    
+
     @Test
     public void testCorruptHeadWithValidCheckpoints() {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckBinaries(true)
-        .withCheckHead(true)
-        .withCheckpoints(checkpoints)
-        .withFilterPaths(filterPaths)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withCheckpoints(checkpoints)
+            .withFilterPaths(filterPaths)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
+
         assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Checking checkpoints",
-                "Checked 7 nodes and 21 properties", "Path / is consistent", 
"Searched through 2 revisions and 2 checkpoints"));
+            "Checked 7 nodes and 21 properties", "Path / is consistent", 
"Searched through 2 revisions and 2 checkpoints"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList(
-                "Error while traversing /a: 
java.lang.IllegalArgumentException: Segment reference out of bounds"));
+            "Error while traversing /a: java.lang.IllegalArgumentException: 
Segment reference out of bounds"));
     }
-    
+
     @Test
     public void testCorruptPathInCp1NoValidRevision() throws Exception {
         corruptPathFromCheckpoint();
-        
+
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/b");
-        
+
         Set<String> cps = new HashSet<>();
         cps.add(checkpoints.iterator().next());
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckBinaries(true)
-        .withCheckpoints(cps)
-        .withFilterPaths(filterPaths)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckBinaries(true)
+            .withCheckpoints(cps)
+            .withFilterPaths(filterPaths)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
+
         assertExpectedOutput(strOut.toString(), Lists.newArrayList("Searched 
through 2 revisions and 1 checkpoints", "No good revision found"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList(
-                "Error while traversing /b: 
java.lang.IllegalArgumentException: Segment reference out of bounds"));
+            "Error while traversing /b: java.lang.IllegalArgumentException: 
Segment reference out of bounds"));
     }
 
     @Test
@@ -239,17 +239,17 @@ public class CheckInvalidRepositoryTest
         }
 
         Check.builder()
-                .withPath(segmentStoreFolder)
-                .withJournal("journal.log.large")
-                .withDebugInterval(Long.MAX_VALUE)
-                .withCheckBinaries(true)
-                .withCheckHead(true)
-                .withFilterPaths(ImmutableSet.of("/"))
-                .withCheckpoints(checkpoints)
-                .withOutWriter(outWriter)
-                .withErrWriter(errWriter)
-                .build()
-                .run();
+            .withPath(segmentStoreFolder)
+            .withJournal("journal.log.large")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withFilterPaths(ImmutableSet.of("/"))
+            .withCheckpoints(checkpoints)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
 
         outWriter.close();
         errWriter.close();

Copied: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckRepositoryTestBase.java
 (from r1847566, 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckRepositoryTestBase.java)
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckRepositoryTestBase.java?p2=jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckRepositoryTestBase.java&p1=jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckRepositoryTestBase.java&r1=1847566&r2=1847567&rev=1847567&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckRepositoryTestBase.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckRepositoryTestBase.java
 Tue Nov 27 17:22:28 2018
@@ -16,7 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.segment.file.tooling;
+
+package org.apache.jackrabbit.oak.segment.tool;
 
 import static com.google.common.base.Charsets.UTF_8;
 
@@ -54,6 +55,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class CheckRepositoryTestBase {
+
     private static final int HEADER_SIZE = 512;
 
     private static final int MAX_SEGMENT_SIZE = 262144;
@@ -62,7 +64,7 @@ public class CheckRepositoryTestBase {
 
     @Rule
     public final TemporaryFolder temporaryFolder = new TemporaryFolder(new 
File("target"));
-    
+
     protected Set<String> checkpoints = new LinkedHashSet<>();
 
     @Before
@@ -72,8 +74,8 @@ public class CheckRepositoryTestBase {
 
     protected void addValidRevision() throws InvalidFileStoreVersionException, 
IOException, CommitFailedException {
         FileStore fileStore = 
FileStoreBuilder.fileStoreBuilder(temporaryFolder.getRoot()).withMaxFileSize(256)
-                .withSegmentCacheSize(64).build();
-        
+            .withSegmentCacheSize(64).build();
+
         SegmentNodeStore nodeStore = 
SegmentNodeStoreBuilders.builder(fileStore).build();
         NodeBuilder builder = nodeStore.getRoot().builder();
 
@@ -86,26 +88,26 @@ public class CheckRepositoryTestBase {
         addChildWithProperties(nodeStore, builder, "f", 6);
 
         nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
-        
+
         // add checkpoints
         String cp1 = nodeStore.checkpoint(10_000);
         String cp2 = nodeStore.checkpoint(10_000);
         checkpoints.add(cp1);
         checkpoints.add(cp2);
-        
+
         fileStore.close();
     }
 
     protected void addInvalidRevision() throws 
InvalidFileStoreVersionException, IOException, CommitFailedException {
         FileStore fileStore = 
FileStoreBuilder.fileStoreBuilder(temporaryFolder.getRoot()).withMaxFileSize(256)
-                .withSegmentCacheSize(64).build();
+            .withSegmentCacheSize(64).build();
 
         SegmentNodeStore nodeStore = 
SegmentNodeStoreBuilders.builder(fileStore).build();
         NodeBuilder builder = nodeStore.getRoot().builder();
 
         // add a new child "z"
         addChildWithBlobProperties(nodeStore, builder, "z", 5);
-        
+
         // add a new property value to existing child "a"
         addChildWithBlobProperties(nodeStore, builder, "a", 1);
 
@@ -114,38 +116,38 @@ public class CheckRepositoryTestBase {
         // get record number to corrupt (NODE record for "z")
         SegmentNodeState child = (SegmentNodeState) after.getChildNode("z");
         RecordId zRecordId = child.getRecordId();
-        
+
         // get record number to corrupt (NODE record for "a")
         child = (SegmentNodeState) after.getChildNode("a");
         RecordId aRecordId = child.getRecordId();
-        
+
         fileStore.close();
 
         corruptRecord(zRecordId, "data00001a.tar");
         corruptRecord(aRecordId, "data00001a.tar");
     }
-    
+
     protected void corruptPathFromCheckpoint() throws 
InvalidFileStoreVersionException, IOException {
         FileStore fileStore = 
FileStoreBuilder.fileStoreBuilder(temporaryFolder.getRoot()).withMaxFileSize(256)
-                .withSegmentCacheSize(64).build();
+            .withSegmentCacheSize(64).build();
 
         SegmentNodeStore nodeStore = 
SegmentNodeStoreBuilders.builder(fileStore).build();
         SegmentNodeState cp1 = (SegmentNodeState) 
nodeStore.retrieve(checkpoints.iterator().next());
         RecordId bRecordId = ((SegmentNodeState) 
cp1.getChildNode("b")).getRecordId();
         fileStore.close();
-        
+
         corruptRecord(bRecordId, "data00000a.tar");
     }
-    
+
     private void corruptRecord(RecordId recordId, String tarFileName) throws 
FileNotFoundException, IOException {
         RandomAccessFile file = new RandomAccessFile(new 
File(temporaryFolder.getRoot(), tarFileName), "rw");
-        
+
         String segmentName = recordId.getSegmentId().toString();
         String crtEntryName = "";
         int entrySize = 0;
         long filePointer = 0;
-        
-        while(!crtEntryName.equals(segmentName)) {
+
+        while (!crtEntryName.equals(segmentName)) {
             filePointer = file.getFilePointer();
             // read entry header
             ByteBuffer entryHeader = ByteBuffer.allocate(HEADER_SIZE);
@@ -165,8 +167,9 @@ public class CheckRepositoryTestBase {
                 file.skipBytes(entrySize);
                 file.skipBytes(HEADER_SIZE - (entrySize % HEADER_SIZE));
             }
-        };
-        
+        }
+        ;
+
         // read actual segment
         ByteBuffer segmentBytes = ByteBuffer.allocate(entrySize);
         file.readFully(segmentBytes.array());
@@ -181,22 +184,22 @@ public class CheckRepositoryTestBase {
 
         Assert.assertEquals(recordId.getRecordNumber(), number);
         Assert.assertEquals(RecordType.NODE.ordinal(), type);
-        
+
         // read the offset of previous record to derive length of our record
         int prevSkip = 32 + segmentRefs * 16 + (recordId.getRecordNumber() - 
1) * 9;
         int prevOffset = segmentBytes.getInt(prevSkip + 4 + 1);
-        
+
         int length = prevOffset - offset;
-        
+
         int realOffset = entrySize - (MAX_SEGMENT_SIZE - offset);
-        
+
         // write random bytes inside the NODE record to corrupt it
         Random r = new Random(10);
         byte[] bogusData = new byte[length];
         r.nextBytes(bogusData);
         file.seek(filePointer + HEADER_SIZE + realOffset);
         file.write(bogusData);
-        
+
         file.close();
     }
 
@@ -210,7 +213,7 @@ public class CheckRepositoryTestBase {
     }
 
     protected static void addChildWithBlobProperties(SegmentNodeStore 
nodeStore, NodeBuilder builder, String childName,
-            int propCount) throws IOException {
+        int propCount) throws IOException {
         NodeBuilder child = builder.child(childName);
         for (int i = 0; i < propCount; i++) {
             child.setProperty(childName + i, 
nodeStore.createBlob(randomStream(i, 2000)));
@@ -218,7 +221,7 @@ public class CheckRepositoryTestBase {
     }
 
     protected static void addChildWithProperties(SegmentNodeStore nodeStore, 
NodeBuilder builder, String childName,
-            int propCount) throws IOException {
+        int propCount) throws IOException {
         NodeBuilder child = builder.child(childName);
         for (int i = 0; i < propCount; i++) {
             child.setProperty(childName + i, childName + i);

Copied: 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckValidRepositoryTest.java
 (from r1847566, 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckValidRepositoryTest.java)
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckValidRepositoryTest.java?p2=jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckValidRepositoryTest.java&p1=jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckValidRepositoryTest.java&r1=1847566&r2=1847567&rev=1847567&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/tooling/CheckValidRepositoryTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/tool/CheckValidRepositoryTest.java
 Tue Nov 27 17:22:28 2018
@@ -16,7 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.jackrabbit.oak.segment.file.tooling;
+
+package org.apache.jackrabbit.oak.segment.tool;
 
 import java.io.File;
 import java.io.PrintWriter;
@@ -26,11 +27,10 @@ import java.util.LinkedHashSet;
 import java.util.Set;
 
 import com.google.common.collect.Lists;
-import org.apache.jackrabbit.oak.segment.tool.Check;
 import org.junit.Test;
 
 /**
- * Tests for {@link CheckCommand} assuming a consistent repository.
+ * Tests for {@link Check} assuming a consistent repository.
  */
 public class CheckValidRepositoryTest extends CheckRepositoryTestBase {
 
@@ -38,43 +38,43 @@ public class CheckValidRepositoryTest ex
     public void testSuccessfulFullCheckWithBinaryTraversal() throws Exception {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckBinaries(true)
-        .withCheckHead(true)
-        .withCheckpoints(new HashSet<String>())
-        .withFilterPaths(filterPaths)
-        .withIOStatistics(true)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withCheckpoints(new HashSet<String>())
+            .withFilterPaths(filterPaths)
+            .withIOStatistics(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
-        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints", 
-                "Checked 7 nodes and 21 properties", "Path / is consistent"));
+
+        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints",
+            "Checked 7 nodes and 21 properties", "Path / is consistent"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList(""));
     }
-    
+
     @Test
     public void 
testSuccessfulOnlyRootKidsCheckWithBinaryTraversalAndFilterPaths() throws 
Exception {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/a");
         filterPaths.add("/b");
@@ -82,268 +82,268 @@ public class CheckValidRepositoryTest ex
         filterPaths.add("/d");
         filterPaths.add("/e");
         filterPaths.add("/f");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckBinaries(true)
-        .withCheckHead(true)
-        .withCheckpoints(new HashSet<String>())
-        .withFilterPaths(filterPaths)
-        .withIOStatistics(true)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withCheckpoints(new HashSet<String>())
+            .withFilterPaths(filterPaths)
+            .withIOStatistics(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
+
         assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints",
-                "Checked 1 nodes and 1 properties", "Checked 1 nodes and 2 
properties", "Checked 1 nodes and 3 properties",
-                "Path /a is consistent", "Path /b is consistent", "Path /c is 
consistent", "Path /d is consistent", "Path /e is consistent",
-                "Path /f is consistent"));
+            "Checked 1 nodes and 1 properties", "Checked 1 nodes and 2 
properties", "Checked 1 nodes and 3 properties",
+            "Path /a is consistent", "Path /b is consistent", "Path /c is 
consistent", "Path /d is consistent", "Path /e is consistent",
+            "Path /f is consistent"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList(""));
     }
-    
+
     @Test
     public void testSuccessfulFullCheckWithoutBinaryTraversal() throws 
Exception {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckHead(true)
-        .withCheckpoints(new HashSet<String>())
-        .withFilterPaths(filterPaths)
-        .withIOStatistics(true)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckHead(true)
+            .withCheckpoints(new HashSet<String>())
+            .withFilterPaths(filterPaths)
+            .withIOStatistics(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
-        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints", 
-                "Checked 7 nodes and 15 properties", "Path / is consistent"));
+
+        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints",
+            "Checked 7 nodes and 15 properties", "Path / is consistent"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList(""));
     }
-    
+
     @Test
     public void testSuccessfulPartialCheckWithoutBinaryTraversal() throws 
Exception {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/a");
         filterPaths.add("/b");
         filterPaths.add("/d");
         filterPaths.add("/e");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckHead(true)
-        .withCheckpoints(new HashSet<String>())
-        .withFilterPaths(filterPaths)
-        .withIOStatistics(true)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckHead(true)
+            .withCheckpoints(new HashSet<String>())
+            .withFilterPaths(filterPaths)
+            .withIOStatistics(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
-        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints", 
-                "Checked 1 nodes and 0 properties", "Checked 1 nodes and 4 
properties", "Checked 1 nodes and 5 properties",
-                "Path /a is consistent", "Path /b is consistent", "Path /d is 
consistent", "Path /e is consistent"));
+
+        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints",
+            "Checked 1 nodes and 0 properties", "Checked 1 nodes and 4 
properties", "Checked 1 nodes and 5 properties",
+            "Path /a is consistent", "Path /b is consistent", "Path /d is 
consistent", "Path /e is consistent"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList(""));
     }
-    
+
     @Test
     public void testUnsuccessfulPartialCheckWithoutBinaryTraversal() throws 
Exception {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/g");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withCheckHead(true)
-        .withCheckpoints(new HashSet<String>())
-        .withFilterPaths(filterPaths)
-        .withIOStatistics(true)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withCheckHead(true)
+            .withCheckpoints(new HashSet<String>())
+            .withFilterPaths(filterPaths)
+            .withIOStatistics(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
-        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints", 
-                "No good revision found"));
+
+        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints",
+            "No good revision found"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList("Path /g 
not found"));
     }
-    
+
     @Test
     public void testUnsuccessfulPartialCheckWithBinaryTraversal() throws 
Exception {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/a");
         filterPaths.add("/f");
         filterPaths.add("/g");
         filterPaths.add("/d");
         filterPaths.add("/e");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withFilterPaths(filterPaths)
-        .withCheckBinaries(true)
-        .withCheckHead(true)
-        .withCheckpoints(new HashSet<String>())
-        .withIOStatistics(true)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withFilterPaths(filterPaths)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withCheckpoints(new HashSet<String>())
+            .withIOStatistics(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
-        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints", 
-                "Checked 1 nodes and 1 properties", "Checked 1 nodes and 6 
properties", "Checked 1 nodes and 4 properties", 
-                "Checked 1 nodes and 5 properties",
-                "Path /a is consistent", "Path /f is consistent", "Path /d is 
consistent", "Path /e is consistent"));
+
+        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Searched through 1 revisions and 0 checkpoints",
+            "Checked 1 nodes and 1 properties", "Checked 1 nodes and 6 
properties", "Checked 1 nodes and 4 properties",
+            "Checked 1 nodes and 5 properties",
+            "Path /a is consistent", "Path /f is consistent", "Path /d is 
consistent", "Path /e is consistent"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList("Path /g 
not found"));
     }
-    
+
     @Test
     public void testSuccessfulCheckOfHeadAndCheckpointsWithoutFilterPaths() 
throws Exception {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withFilterPaths(filterPaths)
-        .withCheckBinaries(true)
-        .withCheckHead(true)
-        .withCheckpoints(checkpoints)
-        .withIOStatistics(true)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withFilterPaths(filterPaths)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withCheckpoints(checkpoints)
+            .withIOStatistics(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
+
         assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Checking checkpoints",
-                "Searched through 1 revisions and 2 checkpoints", "Checked 7 
nodes and 21 properties", "Path / is consistent"));
+            "Searched through 1 revisions and 2 checkpoints", "Checked 7 nodes 
and 21 properties", "Path / is consistent"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList(""));
     }
-    
+
     @Test
     public void testSuccessfulCheckOfHeadAndCheckpointsWithFilterPaths() 
throws Exception {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/f");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withFilterPaths(filterPaths)
-        .withCheckBinaries(true)
-        .withCheckHead(true)
-        .withCheckpoints(checkpoints)
-        .withIOStatistics(true)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withFilterPaths(filterPaths)
+            .withCheckBinaries(true)
+            .withCheckHead(true)
+            .withCheckpoints(checkpoints)
+            .withIOStatistics(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
-        
+
         assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
head", "Checking checkpoints",
-                "Searched through 1 revisions and 2 checkpoints", "Checked 1 
nodes and 6 properties", "Path /f is consistent"));
+            "Searched through 1 revisions and 2 checkpoints", "Checked 1 nodes 
and 6 properties", "Path /f is consistent"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList(""));
     }
-    
+
     @Test
     public void testMissingCheckpointCheck() throws Exception {
         StringWriter strOut = new StringWriter();
         StringWriter strErr = new StringWriter();
-        
+
         PrintWriter outWriter = new PrintWriter(strOut, true);
         PrintWriter errWriter = new PrintWriter(strErr, true);
-        
+
         Set<String> filterPaths = new LinkedHashSet<>();
         filterPaths.add("/");
-        
+
         HashSet<String> checkpoints = new HashSet<String>();
         checkpoints.add("bogus-checkpoint");
-        
+
         Check.builder()
-        .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
-        .withJournal("journal.log")
-        .withDebugInterval(Long.MAX_VALUE)
-        .withFilterPaths(filterPaths)
-        .withCheckBinaries(true)
-        .withCheckpoints(checkpoints)
-        .withIOStatistics(true)
-        .withOutWriter(outWriter)
-        .withErrWriter(errWriter)
-        .build()
-        .run();
-        
+            .withPath(new File(temporaryFolder.getRoot().getAbsolutePath()))
+            .withJournal("journal.log")
+            .withDebugInterval(Long.MAX_VALUE)
+            .withFilterPaths(filterPaths)
+            .withCheckBinaries(true)
+            .withCheckpoints(checkpoints)
+            .withIOStatistics(true)
+            .withOutWriter(outWriter)
+            .withErrWriter(errWriter)
+            .build()
+            .run();
+
         outWriter.close();
         errWriter.close();
 
-        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
checkpoints", "Searched through 1 revisions and 1 checkpoints", 
-                "No good revision found"));
+        assertExpectedOutput(strOut.toString(), Lists.newArrayList("Checking 
checkpoints", "Searched through 1 revisions and 1 checkpoints",
+            "No good revision found"));
         assertExpectedOutput(strErr.toString(), Lists.newArrayList("Checkpoint 
bogus-checkpoint not found in this revision!"));
     }
 }


Reply via email to