@@ -0,0 +1,2365 @@
+/*%0A * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0%0A * (the %22License%22). You may not use this work except in compliance with the License, which is%0A * available at www.apache.org/licenses/LICENSE-2.0%0A *%0A * This software is distributed on an %22AS IS%22 basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,%0A * either express or implied, as more fully set forth in the License.%0A *%0A * See the NOTICE file distributed with this work for information regarding copyright ownership.%0A */%0A%0Apackage alluxio.shell.command;%0A%0Aimport alluxio.AlluxioURI;%0Aimport alluxio.client.FileSystemTestUtils;%0Aimport alluxio.client.WriteType;%0Aimport alluxio.shell.AbstractAlluxioShellTest;%0Aimport alluxio.underfs.UnderFileSystem;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Apublic class CheckConsistencyCommandTest extends AbstractAlluxioShellTest %7B%0A  /**%0A   * Tests the check consistency shell command correctly identifies a consistent subtree.%0A   */%0A  @Test%0A  public void consistent() throws Exception %7B%0A    FileSystemTestUtils%0A        .createByteFile(mFileSystem, %22/testRoot/testFileA%22, WriteType.CACHE_THROUGH, 10);%0A    FileSystemTestUtils.createByteFile(mFileSystem, %22/testRoot/testDir/testFileB%22,%0A        WriteType.CACHE_THROUGH, 20);%0A    mFsShell.run(%22checkConsistency%22, %22/testRoot%22);%0A    String expected = %22/testRoot is consistent with the under storage system.%5Cn%22;%0A    Assert.assertEquals(expected, mOutput.toString());%0A  %7D%0A%0A  /**%0A   * Tests the check consistency shell command correctly identifies inconsistent files in a subtree.%0A   */%0A  @Test%0A  public void inconsistent() throws Exception %7B%0A    FileSystemTestUtils%0A        .createByteFile(mFileSystem, %22/testRoot/testFileA%22, WriteType.CACHE_THROUGH, 10);%0A    FileSystemTestUtils.createByteFile(mFileSystem, %22/testRoot/testDir/testFileB%22,%0A        WriteType.CACHE_THROUGH, 20);%0A    String ufsPath = mFileSystem.getStatus(new AlluxioURI(%22/testRoot/testDir%22)).getUfsPath();%0A    UnderFileSystem ufs = UnderFileSystem.get(ufsPath);%0A    ufs.delete(ufsPath, true);%0A    mFsShell.run(%22checkConsistency%22, %22/testRoot%22);%0A    StringBuilder expected = new StringBuilder();%0A    expected.append(%22The following files are inconsistent:%5Cn%22);%0A    expected.append(%22/testRoot/testDir%5Cn%22);%0A    expected.append(%22/testRoot/testDir/testFileB%5Cn%22);%0A    Assert.assertEquals(expected.toString(), mOutput.toString());%0A  %7D%0A%7D%0A

Add a unit test for the shell command.