Esempio n. 1
0
 private void copyToLocalWithBytes(int bytes) throws IOException {
   TachyonFSTestUtils.createByteFile(
       mTfs, "/testFile", TachyonStorageType.STORE, UnderStorageType.NO_PERSIST, bytes);
   mFsShell.copyToLocal(
       new String[] {
         "copyToLocal", "/testFile", mLocalTachyonCluster.getTachyonHome() + "/testFile"
       });
   Assert.assertEquals(
       getCommandOutput(
           new String[] {
             "copyToLocal", "/testFile", mLocalTachyonCluster.getTachyonHome() + "/testFile"
           }),
       mOutput.toString());
   File testFile = new File(mLocalTachyonCluster.getTachyonHome() + "/testFile");
   FileInputStream fis = new FileInputStream(testFile);
   byte[] read = new byte[bytes];
   fis.read(read);
   fis.close();
   Assert.assertTrue(BufferUtils.equalIncreasingByteArray(bytes, read));
 }
Esempio n. 2
0
 @Test
 public void copyToLocalTest() throws IOException {
   TachyonFSTestUtils.createByteFile(mTfs, "/testFile", WriteType.MUST_CACHE, 10);
   mFsShell.copyToLocal(
       new String[] {
         "copyToLocal", "/testFile", mLocalTachyonCluster.getTachyonHome() + "/testFile"
       });
   Assert.assertEquals(
       getCommandOutput(
           new String[] {
             "copyToLocal", "/testFile", mLocalTachyonCluster.getTachyonHome() + "/testFile"
           }),
       mOutput.toString());
   File testFile = new File(mLocalTachyonCluster.getTachyonHome() + "/testFile");
   FileInputStream fis = new FileInputStream(testFile);
   byte[] read = new byte[10];
   fis.read(read);
   fis.close();
   Assert.assertTrue(BufferUtils.equalIncreasingByteArray(10, read));
 }