@Test public void lsTest() throws IOException { int fileIdA = TestUtils.createByteFile(mTfs, "/testRoot/testFileA", WriteType.MUST_CACHE, 10); TachyonFile[] files = new TachyonFile[3]; files[0] = mTfs.getFile(fileIdA); TestUtils.createByteFile(mTfs, "/testRoot/testDir/testFileB", WriteType.MUST_CACHE, 20); files[1] = mTfs.getFile("/testRoot/testDir"); int fileIdC = TestUtils.createByteFile(mTfs, "/testRoot/testFileC", WriteType.THROUGH, 30); files[2] = mTfs.getFile(fileIdC); mFsShell.ls(new String[] { "count", "/testRoot" }); String expected = ""; String format = "%-10s%-25s%-15s%-5s\n"; expected += String.format(format, CommonUtils.getSizeFromBytes(10), CommonUtils.convertMsToDate(files[0].getCreationTimeMs()), "In Memory", "/testRoot/testFileA"); expected += String.format(format, CommonUtils.getSizeFromBytes(0), CommonUtils.convertMsToDate(files[1].getCreationTimeMs()), "", "/testRoot/testDir"); expected += String.format(format, CommonUtils.getSizeFromBytes(30), CommonUtils.convertMsToDate(files[2].getCreationTimeMs()), "Not In Memory", "/testRoot/testFileC"); Assert.assertEquals(expected, mOutput.toString()); }
public int ls(String argv[]) throws IOException { if (argv.length != 2) { System.out.println("Usage: tfs ls <path>"); return -1; } String path = argv[1]; String folder = Utils.getFilePath(path); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(path)); List<ClientFileInfo> files = tachyonClient.listStatus(folder); Collections.sort(files); String format = "%-10s%-25s%-15s%-5s\n"; for (ClientFileInfo file : files) { String inMemory = ""; if (!file.isFolder) { if (100 == file.inMemoryPercentage) { inMemory = "In Memory"; } else { inMemory = "Not In Memory"; } } System.out.format(format, CommonUtils.getSizeFromBytes(file.getLength()), CommonUtils.convertMsToDate(file.getCreationTimeMs()), inMemory, file.getPath()); } return 0; }
TFsShell { public int ls(String argv[]) throws IOException { if (argv.length != 2) { System.out.println("Usage: tfs ls <path>"); return -1; } String path = argv[1]; String folder = Utils.getFilePath(path); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(path)); List<ClientFileInfo> files = tachyonClient.listStatus(folder); Collections.sort(files); String format = "%-10s%-25s%-15s%-5s\n"; for (ClientFileInfo file : files) { String inMemory = ""; if (!file.isFolder) { if (100 == file.inMemoryPercentage) { inMemory = "In Memory"; } else { inMemory = "Not In Memory"; } } System.out.format(format, CommonUtils.getSizeFromBytes(file.getLength()), CommonUtils.convertMsToDate(file.getCreationTimeMs()), inMemory, file.getPath()); } return 0; } }
TFsShell { public int ls(String argv[]) throws IOException { if (argv.length != 2) { System.out.println("Usage: tfs ls <path>"); return -1; } String path = argv[1]; String folder = Utils.getFilePath(path); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(path)); List<ClientFileInfo> files = tachyonClient.listStatus(folder); Collections.sort(files); String format = "%-10s%-25s%-15s%-5s\n"; for (ClientFileInfo file : files) { String inMemory = ""; if (!file.isFolder) { if (100 == file.inMemoryPercentage) { inMemory = "In Memory"; } else { inMemory = "Not In Memory"; } } System.out.format(format, CommonUtils.getSizeFromBytes(file.getLength()), CommonUtils.convertMsToDate(file.getCreationTimeMs()), inMemory, file.getPath()); } return 0; }  }
TFsShell { public int ls(String argv[]) throws IOException { if (argv.length != 2) { System.out.println("Usage: tfs ls <path>"); return -1; } String path = argv[1]; String folder = Utils.getFilePath(path); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(path)); List<ClientFileInfo> files = tachyonClient.listStatus(folder); Collections.sort(files); String format = "%-10s%-25s%-15s%-5s\n"; for (ClientFileInfo file : files) { String inMemory = ""; if (!file.isFolder) { if (100 == file.inMemoryPercentage) { inMemory = "In Memory"; } else { inMemory = "Not In Memory"; } } System.out.format(format, CommonUtils.getSizeFromBytes(file.getLength()), CommonUtils.convertMsToDate(file.getCreationTimeMs()), inMemory, file.getPath()); } return 0; }  static void main(String argv[]); int cat(String argv[]); int copyFromLocal(String argv[]); int copyToLocal(String argv[]); int count(String argv[]); int fileinfo(String argv[]); int location(String argv[]); int ls(String argv[]); int lsr(String argv[]); int mkdir(String argv[]); int pin(String argv[]); int unpin(String argv[]); void printUsage(); int rename(String argv[]); int report(String argv[]); int request(String argv[]); int rm(String argv[]); int run(String argv[]); int tail(String argv[]); int touch(String argv[]); }
TFsShell { public int ls(String argv[]) throws IOException { if (argv.length != 2) { System.out.println("Usage: tfs ls <path>"); return -1; } String path = argv[1]; String folder = Utils.getFilePath(path); TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(path)); List<ClientFileInfo> files = tachyonClient.listStatus(folder); Collections.sort(files); String format = "%-10s%-25s%-15s%-5s\n"; for (ClientFileInfo file : files) { String inMemory = ""; if (!file.isFolder) { if (100 == file.inMemoryPercentage) { inMemory = "In Memory"; } else { inMemory = "Not In Memory"; } } System.out.format(format, CommonUtils.getSizeFromBytes(file.getLength()), CommonUtils.convertMsToDate(file.getCreationTimeMs()), inMemory, file.getPath()); } return 0; }  static void main(String argv[]); int cat(String argv[]); int copyFromLocal(String argv[]); int copyToLocal(String argv[]); int count(String argv[]); int fileinfo(String argv[]); int location(String argv[]); int ls(String argv[]); int lsr(String argv[]); int mkdir(String argv[]); int pin(String argv[]); int unpin(String argv[]); void printUsage(); int rename(String argv[]); int report(String argv[]); int request(String argv[]); int rm(String argv[]); int run(String argv[]); int tail(String argv[]); int touch(String argv[]);  }