@Test public void processPathWithQuotasByMultipleStorageTypesContent() throws Exception { Path path = new Path("mockfs:/test"); when(mockFs.getFileStatus(eq(path))).thenReturn(fileStat); PathData pathData = new PathData(path.toString(), conf); PrintStream out = mock(PrintStream.class); Count count = new Count(); count.out = out; LinkedList<String> options = new LinkedList<String>(); options.add("-q"); options.add("-t"); options.add("SSD,DISK"); options.add("dummy"); count.processOptions(options); count.processPath(pathData); String withStorageType = BYTES + StorageType.SSD.toString() + " " + StorageType.DISK.toString() + " " + pathData.toString(); verify(out).println(withStorageType); verifyNoMoreInteractions(out); }
@Test public void processPathWithQuotasByQTVH() throws Exception { Path path = new Path("mockfs:/test"); when(mockFs.getFileStatus(eq(path))).thenReturn(fileStat); PrintStream out = mock(PrintStream.class); Count count = new Count(); count.out = out; LinkedList<String> options = new LinkedList<String>(); options.add("-q"); options.add("-t"); options.add("-v"); options.add("-h"); options.add("dummy"); count.processOptions(options); String withStorageTypeHeader = // <----13---> <-------17------> " SSD_QUOTA REM_SSD_QUOTA " + " DISK_QUOTA REM_DISK_QUOTA " + "ARCHIVE_QUOTA REM_ARCHIVE_QUOTA " + "PATHNAME"; verify(out).println(withStorageTypeHeader); verifyNoMoreInteractions(out); }
// check the correct header is produced with no quotas (-v) @Test public void processOptionsHeaderNoQuotas() { LinkedList<String> options = new LinkedList<String>(); options.add("-v"); options.add("dummy"); PrintStream out = mock(PrintStream.class); Count count = new Count(); count.out = out; count.processOptions(options); String noQuotasHeader = // <----12----> <----12----> <-------18-------> " DIR_COUNT FILE_COUNT CONTENT_SIZE PATHNAME"; verify(out).println(noQuotasHeader); verifyNoMoreInteractions(out); }
@Test public void processPathNoQuotasHuman() throws Exception { Path path = new Path("mockfs:/test"); when(mockFs.getFileStatus(eq(path))).thenReturn(fileStat); PathData pathData = new PathData(path.toString(), conf); PrintStream out = mock(PrintStream.class); Count count = new Count(); count.out = out; LinkedList<String> options = new LinkedList<String>(); options.add("-h"); options.add("dummy"); count.processOptions(options); count.processPath(pathData); verify(out).println(HUMAN + NO_QUOTAS + path.toString()); }