ContentSummary extends QuotaUsage implements Writable { @Override public String toString() { return toString(true); } @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[] 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);  }
@Test public void testToStringWithQuota() { long length = 11111; long fileCount = 22222; long directoryCount = 33333; long quota = 44444; long spaceConsumed = 55555; long spaceQuota = 66665; ContentSummary contentSummary = new ContentSummary.Builder().length(length). fileCount(fileCount).directoryCount(directoryCount).quota(quota). spaceConsumed(spaceConsumed).spaceQuota(spaceQuota).build(); String expected = " 44444 -11111 66665 11110" + " 33333 22222 11111 "; assertEquals(expected, contentSummary.toString(true)); }
@Test public void testToStringNoQuota() { long length = 11111; long fileCount = 22222; long directoryCount = 33333; ContentSummary contentSummary = new ContentSummary.Builder().length(length). fileCount(fileCount).directoryCount(directoryCount).build(); String expected = " none inf none" + " inf 33333 22222 11111 "; assertEquals(expected, contentSummary.toString(true)); }
@Test public void testToStringNoShowQuota() { long length = 11111; long fileCount = 22222; long directoryCount = 33333; long quota = 44444; long spaceConsumed = 55555; long spaceQuota = 66665; ContentSummary contentSummary = new ContentSummary.Builder().length(length). fileCount(fileCount).directoryCount(directoryCount).quota(quota). spaceConsumed(spaceConsumed).spaceQuota(spaceQuota).build(); String expected = " 33333 22222 11111 "; assertEquals(expected, contentSummary.toString(false)); }
@Test public void testToString() { long length = 11111; long fileCount = 22222; long directoryCount = 33333; long quota = 44444; long spaceConsumed = 55555; long spaceQuota = 66665; ContentSummary contentSummary = new ContentSummary.Builder().length(length). fileCount(fileCount).directoryCount(directoryCount).quota(quota). spaceConsumed(spaceConsumed).spaceQuota(spaceQuota).build(); String expected = " 44444 -11111 66665" + " 11110 33333 22222 11111 "; assertEquals(expected, contentSummary.toString()); }
@Test public void testToStringHumanWithQuota() { long length = Long.MAX_VALUE; long fileCount = 222222222; long directoryCount = 33333; long quota = 222256578; long spaceConsumed = 1073741825; long spaceQuota = 1; ContentSummary contentSummary = new ContentSummary.Builder().length(length). fileCount(fileCount).directoryCount(directoryCount).quota(quota). spaceConsumed(spaceConsumed).spaceQuota(spaceQuota).build(); String expected = " 212.0 M 1023 1 " + " -1 G 32.6 K 211.9 M 8.0 E "; assertEquals(expected, contentSummary.toString(true, true)); }
@Test public void testToStringHumanNoShowQuota() { long length = Long.MAX_VALUE; long fileCount = 222222222; long directoryCount = 33333; long quota = 222256578; long spaceConsumed = 55555; long spaceQuota = Long.MAX_VALUE; ContentSummary contentSummary = new ContentSummary.Builder().length(length). fileCount(fileCount).directoryCount(directoryCount).quota(quota). spaceConsumed(spaceConsumed).spaceQuota(spaceQuota).build(); String expected = " 32.6 K 211.9 M 8.0 E "; assertEquals(expected, contentSummary.toString(false, true)); }