@Test public void copyFromLocalTest() throws IOException { File testDir = new File(mLocalTachyonCluster.getTachyonHome() + "/testDir"); testDir.mkdir(); File testDirInner = new File(mLocalTachyonCluster.getTachyonHome() + "/testDir/testDirInner"); testDirInner.mkdir(); File testFile = generateFileContent("/testDir/testFile", TestUtils.getIncreasingByteArray(10)); generateFileContent("/testDir/testDirInner/testFile2", TestUtils.getIncreasingByteArray(10, 20)); mFsShell.copyFromLocal(new String[] { "copyFromLocal", testFile.getParent(), "/testDir" }); Assert.assertEquals(getCommandOutput(new String[] { "copyFromLocal", testFile.getParent(), "/testDir" }), mOutput.toString()); TachyonFile tFile = mTfs.getFile("/testDir/testFile"); TachyonFile tFile2 = mTfs.getFile("/testDir/testDirInner/testFile2"); Assert.assertNotNull(tFile); Assert.assertNotNull(tFile2); Assert.assertEquals(10, tFile.length()); Assert.assertEquals(20, tFile2.length()); byte[] read = readContent(tFile, 10); Assert.assertTrue(TestUtils.equalIncreasingByteArray(10, read)); read = readContent(tFile2, 20); Assert.assertTrue(TestUtils.equalIncreasingByteArray(10, 20, read)); }
public int copyFromLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyFromLocal <src> <remoteDst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; File src = new File(srcPath); if (!src.exists()) { System.out.println("Local path " + srcPath + " does not exist."); return -1; } TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(dstPath)); String file = Utils.getFilePath(dstPath); int ret = copyPath(src, tachyonClient, file); if (ret == 0) { System.out.println("Copied " + src.getPath() + " to " + dstPath); } return ret; }
TFsShell { public int copyFromLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyFromLocal <src> <remoteDst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; File src = new File(srcPath); if (!src.exists()) { System.out.println("Local path " + srcPath + " does not exist."); return -1; } TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(dstPath)); String file = Utils.getFilePath(dstPath); int ret = copyPath(src, tachyonClient, file); if (ret == 0) { System.out.println("Copied " + src.getPath() + " to " + dstPath); } return ret; } }
TFsShell { public int copyFromLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyFromLocal <src> <remoteDst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; File src = new File(srcPath); if (!src.exists()) { System.out.println("Local path " + srcPath + " does not exist."); return -1; } TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(dstPath)); String file = Utils.getFilePath(dstPath); int ret = copyPath(src, tachyonClient, file); if (ret == 0) { System.out.println("Copied " + src.getPath() + " to " + dstPath); } return ret; }  }
TFsShell { public int copyFromLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyFromLocal <src> <remoteDst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; File src = new File(srcPath); if (!src.exists()) { System.out.println("Local path " + srcPath + " does not exist."); return -1; } TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(dstPath)); String file = Utils.getFilePath(dstPath); int ret = copyPath(src, tachyonClient, file); if (ret == 0) { System.out.println("Copied " + src.getPath() + " to " + dstPath); } return ret; }  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 copyFromLocal(String argv[]) throws IOException { if (argv.length != 3) { System.out.println("Usage: tfs copyFromLocal <src> <remoteDst>"); return -1; } String srcPath = argv[1]; String dstPath = argv[2]; File src = new File(srcPath); if (!src.exists()) { System.out.println("Local path " + srcPath + " does not exist."); return -1; } TachyonFS tachyonClient = TachyonFS.get(Utils.validatePath(dstPath)); String file = Utils.getFilePath(dstPath); int ret = copyPath(src, tachyonClient, file); if (ret == 0) { System.out.println("Copied " + src.getPath() + " to " + dstPath); } return ret; }  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[]);  }