ContentSummary extends QuotaUsage implements Writable { public String toSnapshot(boolean hOption) { return String.format(SNAPSHOT_FORMAT, formatSize(snapshotLength, hOption), formatSize(snapshotFileCount, hOption), formatSize(snapshotDirectoryCount, hOption), formatSize(snapshotSpaceConsumed, hOption)); } @Deprecated  ContentSummary(); @Deprecated  ContentSummary(long length, long fileCount, long directoryCount); @Deprecated  ContentSummary(
      long length, long fileCount, long directoryCount, long quota,
      long spaceConsumed, long spaceQuota); private  ContentSummary(Builder builder); long getLength(); long getSnapshotLength(); long getDirectoryCount(); long getSnapshotDirectoryCount(); long getFileCount(); long getSnapshotFileCount(); long getSnapshotSpaceConsumed(); String getErasureCodingPolicy(); @Override @InterfaceAudience.Private void write(DataOutput out); @Override @InterfaceAudience.Private void readFields(DataInput in); @Override boolean equals(Object to); @Override int hashCode(); static String getHeader(boolean qOption); static String getSnapshotHeader(); static String[] getHeaderFields(); static String[] getQuotaHeaderFields(); @Override String toString(); @Override String toString(boolean qOption); String toString(boolean qOption, boolean hOption); String toString(boolean qOption, boolean hOption, boolean xOption); String toString(boolean qOption, boolean hOption,
                         boolean tOption, List<StorageType> types); String toString(boolean qOption, boolean hOption, boolean tOption,
      boolean xOption, List<StorageType> types); String toSnapshot(boolean hOption);  }
@Test public void testToSnapshotHumanReadable() { long snapshotLength = Long.MAX_VALUE; long snapshotFileCount = 222222222; long snapshotDirectoryCount = 33333; long snapshotSpaceConsumed = 222256578; ContentSummary contentSummary = new ContentSummary.Builder() .snapshotLength(snapshotLength).snapshotFileCount(snapshotFileCount) .snapshotDirectoryCount(snapshotDirectoryCount) .snapshotSpaceConsumed(snapshotSpaceConsumed).build(); String expected = " 8.0 E 211.9 M 32.6 K " + " 212.0 M "; assertEquals(expected, contentSummary.toSnapshot(true)); }
@Test public void testToSnapshotNotHumanReadable() { long snapshotLength = 1111; long snapshotFileCount = 2222; long snapshotDirectoryCount = 3333; long snapshotSpaceConsumed = 4444; ContentSummary contentSummary = new ContentSummary.Builder() .snapshotLength(snapshotLength).snapshotFileCount(snapshotFileCount) .snapshotDirectoryCount(snapshotDirectoryCount) .snapshotSpaceConsumed(snapshotSpaceConsumed).build(); String expected = " 1111 2222 3333 " + " 4444 "; assertEquals(expected, contentSummary.toSnapshot(false)); }