Esempio n. 1
0
 @Test
 public void rmNotExistingDirTest() throws IOException {
   StringBuilder toCompare = new StringBuilder();
   mFsShell.mkdir(new String[] {"mkdir", "/testFolder"});
   toCompare.append(getCommandOutput(new String[] {"mkdir", "/testFolder"}));
   mFsShell.rm(new String[] {"rm", "/testFolder"});
   toCompare.append("rm: cannot remove a directory, please try rmr <path>\n");
   Assert.assertEquals(toCompare.toString(), mOutput.toString());
 }
Esempio n. 2
0
 @Test
 public void rmTest() throws IOException {
   StringBuilder toCompare = new StringBuilder();
   mFsShell.mkdir(new String[] {"mkdir", "/testFolder1/testFolder2"});
   toCompare.append(getCommandOutput(new String[] {"mkdir", "/testFolder1/testFolder2"}));
   mFsShell.touch(new String[] {"touch", "/testFolder1/testFolder2/testFile2"});
   toCompare.append(
       getCommandOutput(new String[] {"touch", "/testFolder1/testFolder2/testFile2"}));
   TachyonURI testFolder1 = new TachyonURI("/testFolder1");
   TachyonURI testFolder2 = new TachyonURI("/testFolder1/testFolder2");
   TachyonURI testFile2 = new TachyonURI("/testFolder1/testFolder2/testFile2");
   Assert.assertNotNull(mTfs.getFile(testFolder1));
   Assert.assertNotNull(mTfs.getFile(testFolder2));
   Assert.assertNotNull(mTfs.getFile(testFile2));
   mFsShell.rm(new String[] {"rm", "/testFolder1/testFolder2/testFile2"});
   toCompare.append(getCommandOutput(new String[] {"rm", "/testFolder1/testFolder2/testFile2"}));
   Assert.assertEquals(toCompare.toString(), mOutput.toString());
   Assert.assertNotNull(mTfs.getFile(testFolder1));
   Assert.assertNotNull(mTfs.getFile(testFolder2));
   Assert.assertNull(mTfs.getFile(testFile2));
 }
Esempio n. 3
0
 @Test
 public void rmNotExistingFileTest() throws IOException {
   mFsShell.rm(new String[] {"rm", "/testFile"});
   String expected = "rm: cannot remove '/testFile': No such file or directory\n";
   Assert.assertEquals(expected, mOutput.toString());
 }