Ejemplo n.º 1
0
 @Test
 public void rmrTest() throws IOException {
   StringBuilder toCompare = new StringBuilder();
   mFsShell.run(new String[] {"mkdir", "/testFolder1/testFolder2"});
   toCompare.append(getCommandOutput(new String[] {"mkdir", "/testFolder1/testFolder2"}));
   mFsShell.run(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.assertTrue(isFileExist(testFolder1));
   Assert.assertTrue(isFileExist(testFolder2));
   Assert.assertTrue(isFileExist(testFile2));
   mFsShell.run(new String[] {"rmr", "/testFolder1/testFolder2/testFile2"});
   toCompare.append(getCommandOutput(new String[] {"rm", "/testFolder1/testFolder2/testFile2"}));
   Assert.assertEquals(toCompare.toString(), mOutput.toString());
   Assert.assertTrue(isFileExist(testFolder1));
   Assert.assertTrue(isFileExist(testFolder2));
   Assert.assertFalse(isFileExist(testFile2));
   mFsShell.run(new String[] {"rmr", "/testFolder1"});
   toCompare.append(getCommandOutput(new String[] {"rmr", "/testFolder1"}));
   Assert.assertEquals(toCompare.toString(), mOutput.toString());
   Assert.assertFalse(isFileExist(testFolder1));
   Assert.assertFalse(isFileExist(testFolder2));
   Assert.assertFalse(isFileExist(testFile2));
 }
Ejemplo n.º 2
0
  @Test
  public void duTest() throws IOException {
    TachyonFSTestUtils.createByteFile(
        mTfs, "/testRoot/testFileA", TachyonStorageType.STORE, UnderStorageType.NO_PERSIST, 10);
    TachyonFSTestUtils.createByteFile(
        mTfs,
        "/testRoot/testDir/testFileB",
        TachyonStorageType.STORE,
        UnderStorageType.NO_PERSIST,
        20);
    TachyonFSTestUtils.createByteFile(
        mTfs,
        "/testRoot/testDir/testDir/testFileC",
        TachyonStorageType.STORE,
        UnderStorageType.NO_PERSIST,
        30);

    String expected = "";
    // du a non-existing file
    mFsShell.run(new String[] {"du", "/testRoot/noneExisting"});
    expected += "Could not find path: /testRoot/noneExisting\n";
    // du a file
    mFsShell.run(new String[] {"du", "/testRoot/testFileA"});
    expected += "/testRoot/testFileA is 10 bytes\n";
    // du a folder
    mFsShell.run(new String[] {"du", "/testRoot/testDir"});
    expected += "/testRoot/testDir is 50 bytes\n";

    Assert.assertEquals(expected, mOutput.toString());
  }
Ejemplo n.º 3
0
 @Test
 public void rmNotExistingDirTest() throws IOException {
   StringBuilder toCompare = new StringBuilder();
   mFsShell.run(new String[] {"mkdir", "/testFolder"});
   toCompare.append(getCommandOutput(new String[] {"mkdir", "/testFolder"}));
   mFsShell.run(new String[] {"rm", "/testFolder"});
   toCompare.append("rm: cannot remove a directory, please try rmr <path>\n");
   Assert.assertEquals(toCompare.toString(), mOutput.toString());
 }
Ejemplo n.º 4
0
 @Test
 public void renameToExistingFileTest() throws IOException {
   StringBuilder toCompare = new StringBuilder();
   mFsShell.run(new String[] {"mkdir", "/testFolder"});
   toCompare.append(getCommandOutput(new String[] {"mkdir", "/testFolder"}));
   mFsShell.run(new String[] {"mkdir", "/testFolder1"});
   toCompare.append(getCommandOutput(new String[] {"mkdir", "/testFolder1"}));
   Assert.assertEquals(
       -1, mFsShell.rename(new String[] {"rename", "/testFolder1", "/testFolder"}));
 }
Ejemplo n.º 5
0
 @Test
 public void catDirectoryTest() throws IOException {
   String[] command = new String[] {"mkdir", "/testDir"};
   mFsShell.run(command);
   int ret = mFsShell.run(new String[] {"cat", "/testDir"});
   Assert.assertEquals(-1, ret);
   String expected = getCommandOutput(command);
   expected += "/testDir is not a file.\n";
   Assert.assertEquals(expected, mOutput.toString());
 }
Ejemplo n.º 6
0
 @Test
 public void renameTest() throws IOException {
   StringBuilder toCompare = new StringBuilder();
   mFsShell.run(new String[] {"mkdir", "/testFolder1"});
   toCompare.append(getCommandOutput(new String[] {"mkdir", "/testFolder1"}));
   Assert.assertTrue(isFileExist(new TachyonURI("/testFolder1")));
   mFsShell.rename(new String[] {"rename", "/testFolder1", "/testFolder"});
   toCompare.append(getCommandOutput(new String[] {"mv", "/testFolder1", "/testFolder"}));
   Assert.assertEquals(toCompare.toString(), mOutput.toString());
   Assert.assertTrue(isFileExist(new TachyonURI("/testFolder")));
   Assert.assertFalse(isFileExist(new TachyonURI("/testFolder1")));
 }
Ejemplo n.º 7
0
 @Test
 public void renameParentDirectoryTest() throws IOException {
   StringBuilder toCompare = new StringBuilder();
   mFsShell.mkdir(new String[] {"mkdir", "/test/File1"});
   toCompare.append(getCommandOutput(new String[] {"mkdir", "/test/File1"}));
   mFsShell.rename(new String[] {"rename", "/test", "/test2"});
   toCompare.append(getCommandOutput(new String[] {"mv", "/test", "/test2"}));
   Assert.assertNotNull(mTfs.getFile(new TachyonURI("/test2/File1")));
   Assert.assertNull(mTfs.getFile(new TachyonURI("/test")));
   Assert.assertNull(mTfs.getFile(new TachyonURI("/test/File1")));
   Assert.assertEquals(toCompare.toString(), mOutput.toString());
 }
Ejemplo n.º 8
0
  /*
   * @Test public void locationTest() throws IOException { TachyonFile file =
   * TachyonFSTestUtils.createByteFile(mTfs, "/testFile", CacheType.STORE,
   * UnderStorageType.NO_PERSIST, 10); mFsShell.run(new String[] {"location", "/testFile"});
   *
   * FileInfo fileInfo = mTfs.getInfo(file); Assert.assertNotNull(fileInfo); List<String>
   * locationsList = tFile.getLocationHosts(); String[] commandParameters = new String[3 +
   * locationsList.size()]; commandParameters[0] = "location"; commandParameters[1] = "/testFile";
   * commandParameters[2] = String.valueOf(file.getFileId()); Iterator<String> iter =
   * locationsList.iterator(); int i = 3; while (iter.hasNext()) { commandParameters[i ++] =
   * iter.next(); } Assert.assertEquals(getCommandOutput(commandParameters), mOutput.toString()); }
   */
  @Test
  public void lsrTest() throws IOException, TException {
    FileInfo[] files = new FileInfo[4];

    TachyonFile fileA =
        TachyonFSTestUtils.createByteFile(
            mTfs, "/testRoot/testFileA", TachyonStorageType.STORE, UnderStorageType.NO_PERSIST, 10);
    files[0] = mTfs.getInfo(fileA);
    TachyonFSTestUtils.createByteFile(
        mTfs,
        "/testRoot/testDir/testFileB",
        TachyonStorageType.STORE,
        UnderStorageType.NO_PERSIST,
        20);
    files[1] = mTfs.getInfo(mTfs.open(new TachyonURI("/testRoot/testDir")));
    files[2] = mTfs.getInfo(mTfs.open(new TachyonURI("/testRoot/testDir/testFileB")));
    TachyonFile fileC =
        TachyonFSTestUtils.createByteFile(
            mTfs, "/testRoot/testFileC", TachyonStorageType.NO_STORE, UnderStorageType.PERSIST, 30);
    files[3] = mTfs.getInfo(fileC);
    mFsShell.run(new String[] {"lsr", "/testRoot"});
    String expected = "";
    String format = "%-10s%-25s%-15s%-5s\n";
    expected +=
        String.format(
            format,
            FormatUtils.getSizeFromBytes(10),
            TFsShell.convertMsToDate(files[0].getCreationTimeMs()),
            "In Memory",
            "/testRoot/testFileA");
    expected +=
        String.format(
            format,
            FormatUtils.getSizeFromBytes(0),
            TFsShell.convertMsToDate(files[1].getCreationTimeMs()),
            "",
            "/testRoot/testDir");
    expected +=
        String.format(
            format,
            FormatUtils.getSizeFromBytes(20),
            TFsShell.convertMsToDate(files[2].getCreationTimeMs()),
            "In Memory",
            "/testRoot/testDir/testFileB");
    expected +=
        String.format(
            format,
            FormatUtils.getSizeFromBytes(30),
            TFsShell.convertMsToDate(files[3].getCreationTimeMs()),
            "Not In Memory",
            "/testRoot/testFileC");
    Assert.assertEquals(expected, mOutput.toString());
  }
Ejemplo n.º 9
0
  @Test
  public void copyFromLocalFileToDstPathTest() throws IOException {
    String dataString = "copyFromLocalFileToDstPathTest";
    byte[] data = dataString.getBytes();
    File localDir = new File(mLocalTachyonCluster.getTachyonHome() + "/localDir");
    localDir.mkdir();
    File localFile = generateFileContent("/localDir/testFile", data);
    mFsShell.mkdir(new String[] {"mkdir", "/dstDir"});
    mFsShell.copyFromLocal(new String[] {"copyFromLocal", localFile.getPath(), "/dstDir"});

    TachyonFile tFile = mTfs.getFile(new TachyonURI("/dstDir/testFile"));
    Assert.assertNotNull(tFile);
    byte[] read = readContent(tFile, data.length);
    Assert.assertEquals(new String(read), dataString);
  }
Ejemplo n.º 10
0
 @Test
 public void copyFromLocalTest() throws IOException, TException {
   File testDir = new File(mLocalTachyonCluster.getTachyonHome() + "/testDir");
   testDir.mkdir();
   File testDirInner = new File(mLocalTachyonCluster.getTachyonHome() + "/testDir/testDirInner");
   testDirInner.mkdir();
   File testFile =
       generateFileContent("/testDir/testFile", BufferUtils.getIncreasingByteArray(10));
   generateFileContent(
       "/testDir/testDirInner/testFile2", BufferUtils.getIncreasingByteArray(10, 20));
   mFsShell.copyFromLocal(new String[] {"copyFromLocal", testFile.getParent(), "/testDir"});
   Assert.assertEquals(
       getCommandOutput(new String[] {"copyFromLocal", testFile.getParent(), "/testDir"}),
       mOutput.toString());
   TachyonFile file1 = mTfs.open(new TachyonURI("/testDir/testFile"));
   TachyonFile file2 = mTfs.open(new TachyonURI("/testDir/testDirInner/testFile2"));
   FileInfo fileInfo1 = mTfs.getInfo(file1);
   FileInfo fileInfo2 = mTfs.getInfo(file2);
   Assert.assertNotNull(fileInfo1);
   Assert.assertNotNull(fileInfo2);
   Assert.assertEquals(10, fileInfo1.length);
   Assert.assertEquals(20, fileInfo2.length);
   byte[] read = readContent(file1, 10);
   Assert.assertTrue(BufferUtils.equalIncreasingByteArray(10, read));
   read = readContent(file2, 20);
   Assert.assertTrue(BufferUtils.equalIncreasingByteArray(10, 20, read));
 }
Ejemplo n.º 11
0
  @Test
  public void copyFromLocalLargeTest() throws IOException, TException {
    File testFile = new File(mLocalTachyonCluster.getTachyonHome() + "/testFile");
    testFile.createNewFile();
    FileOutputStream fos = new FileOutputStream(testFile);
    byte[] toWrite = BufferUtils.getIncreasingByteArray(SIZE_BYTES);
    fos.write(toWrite);
    fos.close();
    mFsShell.copyFromLocal(new String[] {"copyFromLocal", testFile.getAbsolutePath(), "/testFile"});
    Assert.assertEquals(
        getCommandOutput(new String[] {"copyFromLocal", testFile.getAbsolutePath(), "/testFile"}),
        mOutput.toString());
    TachyonFile tFile = mTfs.open(new TachyonURI("/testFile"));
    FileInfo fileInfo = mTfs.getInfo(tFile);
    Assert.assertNotNull(fileInfo);
    Assert.assertEquals(SIZE_BYTES, fileInfo.length);

    ClientOptions options =
        new ClientOptions.Builder(new TachyonConf())
            .setTachyonStoreType(TachyonStorageType.NO_STORE)
            .build();
    FileInStream tfis = mTfs.getInStream(tFile, options);
    byte[] read = new byte[SIZE_BYTES];
    tfis.read(read);
    Assert.assertTrue(BufferUtils.equalIncreasingByteArray(SIZE_BYTES, read));
  }
Ejemplo n.º 12
0
 @Test
 public void tailEmptyFileTest() throws IOException {
   TachyonFSTestUtils.createByteFile(
       mTfs, "/emptyFile", TachyonStorageType.STORE, UnderStorageType.NO_PERSIST, 0);
   int ret = mFsShell.run(new String[] {"tail", "/emptyFile"});
   Assert.assertEquals(0, ret);
 }
Ejemplo n.º 13
0
 @Test
 public void catTest() throws IOException {
   TachyonFSTestUtils.createByteFile(mTfs, "/testFile", WriteType.MUST_CACHE, 10);
   mFsShell.cat(new String[] {"cat", "/testFile"});
   byte[] expect = BufferUtils.getIncreasingByteArray(10);
   Assert.assertArrayEquals(expect, mOutput.toByteArray());
 }
Ejemplo n.º 14
0
 @Test
 public void catTest() throws IOException {
   TachyonFSTestUtils.createByteFile(
       mTfs, "/testFile", TachyonStorageType.STORE, UnderStorageType.NO_PERSIST, 10);
   mFsShell.run(new String[] {"cat", "/testFile"});
   byte[] expect = BufferUtils.getIncreasingByteArray(10);
   Assert.assertArrayEquals(expect, mOutput.toByteArray());
 }
Ejemplo n.º 15
0
 @Test
 public void freeTest() throws IOException {
   TachyonFSTestUtils.createByteFile(mTfs, "/testFile", WriteType.MUST_CACHE, 10);
   mFsShell.free(new String[] {"free", "/testFile"});
   TachyonConf tachyonConf = mLocalTachyonCluster.getMasterTachyonConf();
   CommonUtils.sleepMs(null, CommonUtils.getToMasterHeartBeatIntervalMs(tachyonConf) * 2 + 10);
   Assert.assertFalse(mTfs.getFile(new TachyonURI("/testFile")).isInMemory());
 }
Ejemplo n.º 16
0
 @Test
 public void mkdirShortPathTest() throws IOException {
   mFsShell.mkdir(new String[] {"mkdir", "/root/testFile1"});
   TachyonFile tFile = mTfs.getFile(new TachyonURI("/root/testFile1"));
   Assert.assertNotNull(tFile);
   Assert.assertEquals(
       getCommandOutput(new String[] {"mkdir", "/root/testFile1"}), mOutput.toString());
   Assert.assertTrue(tFile.isDirectory());
 }
Ejemplo n.º 17
0
 @Test
 public void touchTest() throws IOException {
   String[] argv = new String[] {"touch", "/testFile"};
   mFsShell.touch(argv);
   TachyonFile tFile = mTfs.getFile(new TachyonURI("/testFile"));
   Assert.assertNotNull(tFile);
   Assert.assertEquals(getCommandOutput(argv), mOutput.toString());
   Assert.assertTrue(tFile.isFile());
 }
Ejemplo n.º 18
0
 @Test
 public void mkdirComplexPathTest() throws IOException {
   mFsShell.mkdir(new String[] {"mkdir", "/Complex!@#$%^&*()-_=+[]{};\"'<>,.?/File"});
   TachyonFile tFile = mTfs.getFile(new TachyonURI("/Complex!@#$%^&*()-_=+[]{};\"'<>,.?/File"));
   Assert.assertNotNull(tFile);
   Assert.assertEquals(
       getCommandOutput(new String[] {"mkdir", "/Complex!@#$%^&*()-_=+[]{};\"'<>,.?/File"}),
       mOutput.toString());
   Assert.assertTrue(tFile.isDirectory());
 }
Ejemplo n.º 19
0
 @Test
 public void freeTest() throws IOException, TException {
   TachyonFile file =
       TachyonFSTestUtils.createByteFile(
           mTfs, "/testFile", TachyonStorageType.STORE, UnderStorageType.NO_PERSIST, 10);
   mFsShell.run(new String[] {"free", "/testFile"});
   TachyonConf tachyonConf = mLocalTachyonCluster.getMasterTachyonConf();
   CommonUtils.sleepMs(tachyonConf.getInt(Constants.WORKER_TO_MASTER_HEARTBEAT_INTERVAL_MS));
   Assert.assertFalse(mTfs.getInfo(file).getInMemoryPercentage() == 100);
 }
Ejemplo n.º 20
0
 @Test
 public void touchTest() throws IOException, TException {
   String[] argv = new String[] {"touch", "/testFile"};
   mFsShell.run(argv);
   TachyonFile tFile = mTfs.open(new TachyonURI("/testFile"));
   FileInfo fileInfo = mTfs.getInfo(tFile);
   Assert.assertNotNull(fileInfo);
   Assert.assertEquals(getCommandOutput(argv), mOutput.toString());
   Assert.assertFalse(fileInfo.isFolder);
 }
Ejemplo n.º 21
0
 @Test
 public void mkdirShortPathTest() throws IOException, TException {
   mFsShell.run(new String[] {"mkdir", "/root/testFile1"});
   TachyonFile tFile = mTfs.open(new TachyonURI("/root/testFile1"));
   FileInfo fileInfo = mTfs.getInfo(tFile);
   Assert.assertNotNull(fileInfo);
   Assert.assertEquals(
       getCommandOutput(new String[] {"mkdir", "/root/testFile1"}), mOutput.toString());
   Assert.assertTrue(fileInfo.isIsFolder());
 }
Ejemplo n.º 22
0
 @Test
 public void mkdirComplexPathTest() throws IOException, TException {
   mFsShell.run(new String[] {"mkdir", "/Complex!@#$%^&*()-_=+[]{};\"'<>,.?/File"});
   TachyonFile tFile = mTfs.open(new TachyonURI("/Complex!@#$%^&*()-_=+[]{};\"'<>,.?/File"));
   FileInfo fileInfo = mTfs.getInfo(tFile);
   Assert.assertNotNull(fileInfo);
   Assert.assertEquals(
       getCommandOutput(new String[] {"mkdir", "/Complex!@#$%^&*()-_=+[]{};\"'<>,.?/File"}),
       mOutput.toString());
   Assert.assertTrue(fileInfo.isIsFolder());
 }
Ejemplo n.º 23
0
 @Test
 public void loadFileTest() throws IOException, TException {
   TachyonFile file =
       TachyonFSTestUtils.createByteFile(
           mTfs, "/testFile", TachyonStorageType.NO_STORE, UnderStorageType.PERSIST, 10);
   FileInfo fileInfo = mTfs.getInfo(file);
   Assert.assertFalse(fileInfo.getInMemoryPercentage() == 100);
   // Testing loading of a single file
   mFsShell.run(new String[] {"load", "/testFile"});
   fileInfo = mTfs.getInfo(file);
   Assert.assertTrue(fileInfo.getInMemoryPercentage() == 100);
 }
Ejemplo n.º 24
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));
 }
Ejemplo n.º 25
0
  @Test
  public void duTest() throws IOException {
    TachyonFSTestUtils.createByteFile(mTfs, "/testRoot/testFileA", WriteType.MUST_CACHE, 10);
    TachyonFSTestUtils.createByteFile(
        mTfs, "/testRoot/testDir/testFileB", WriteType.MUST_CACHE, 20);
    TachyonFSTestUtils.createByteFile(
        mTfs, "/testRoot/testDir/testDir/testFileC", WriteType.MUST_CACHE, 30);

    String expected = "";
    // du a non-existing file
    mFsShell.du(new String[] {"du", "/testRoot/noneExisting"});
    expected += "/testRoot/noneExisting does not exist\n";
    // du a file
    mFsShell.du(new String[] {"du", "/testRoot/testFileA"});
    expected += "/testRoot/testFileA is 10 bytes\n";
    // du a folder
    mFsShell.du(new String[] {"du", "/testRoot/testDir"});
    expected += "/testRoot/testDir is 50 bytes\n";

    Assert.assertEquals(expected, mOutput.toString());
  }
Ejemplo n.º 26
0
 @Test
 public void lsrTest() throws IOException {
   int fileIdA =
       TachyonFSTestUtils.createByteFile(mTfs, "/testRoot/testFileA", WriteType.MUST_CACHE, 10);
   TachyonFile[] files = new TachyonFile[4];
   files[0] = mTfs.getFile(fileIdA);
   TachyonFSTestUtils.createByteFile(
       mTfs, "/testRoot/testDir/testFileB", WriteType.MUST_CACHE, 20);
   files[1] = mTfs.getFile(new TachyonURI("/testRoot/testDir"));
   files[2] = mTfs.getFile(new TachyonURI("/testRoot/testDir/testFileB"));
   int fileIdC =
       TachyonFSTestUtils.createByteFile(mTfs, "/testRoot/testFileC", WriteType.THROUGH, 30);
   files[3] = mTfs.getFile(fileIdC);
   mFsShell.ls(new String[] {"count", "/testRoot"});
   String expected = "";
   String format = "%-10s%-25s%-15s%-5s\n";
   expected +=
       String.format(
           format,
           FormatUtils.getSizeFromBytes(10),
           TFsShell.convertMsToDate(files[0].getCreationTimeMs()),
           "In Memory",
           "/testRoot/testFileA");
   expected +=
       String.format(
           format,
           FormatUtils.getSizeFromBytes(0),
           TFsShell.convertMsToDate(files[1].getCreationTimeMs()),
           "",
           "/testRoot/testDir");
   expected +=
       String.format(
           format,
           FormatUtils.getSizeFromBytes(30),
           TFsShell.convertMsToDate(files[3].getCreationTimeMs()),
           "Not In Memory",
           "/testRoot/testFileC");
   Assert.assertEquals(expected, mOutput.toString());
 }
Ejemplo n.º 27
0
 @Test
 public void countTest() throws IOException {
   TachyonFSTestUtils.createByteFile(mTfs, "/testRoot/testFileA", WriteType.MUST_CACHE, 10);
   TachyonFSTestUtils.createByteFile(
       mTfs, "/testRoot/testDir/testFileB", WriteType.MUST_CACHE, 20);
   TachyonFSTestUtils.createByteFile(mTfs, "/testRoot/testFileB", WriteType.MUST_CACHE, 30);
   mFsShell.count(new String[] {"count", "/testRoot"});
   String expected = "";
   String format = "%-25s%-25s%-15s\n";
   expected += String.format(format, "File Count", "Folder Count", "Total Bytes");
   expected += String.format(format, 3, 2, 60);
   Assert.assertEquals(expected, mOutput.toString());
 }
Ejemplo n.º 28
0
 @Test
 public void mkdirTest() throws IOException {
   String qualifiedPath =
       "tachyon://"
           + NetworkAddressUtils.getLocalHostName(Constants.DEFAULT_HOST_RESOLUTION_TIMEOUT_MS)
           + ":"
           + mLocalTachyonCluster.getMasterPort()
           + "/root/testFile1";
   mFsShell.mkdir(new String[] {"mkdir", qualifiedPath});
   TachyonFile tFile = mTfs.getFile(new TachyonURI("/root/testFile1"));
   Assert.assertNotNull(tFile);
   Assert.assertEquals(
       getCommandOutput(new String[] {"mkdir", qualifiedPath}), mOutput.toString());
   Assert.assertTrue(tFile.isDirectory());
 }
Ejemplo n.º 29
0
 @Test
 public void mkdirTest() throws IOException, TException {
   String qualifiedPath =
       "tachyon://"
           + mLocalTachyonCluster.getMasterHostname()
           + ":"
           + mLocalTachyonCluster.getMasterPort()
           + "/root/testFile1";
   mFsShell.run(new String[] {"mkdir", qualifiedPath});
   TachyonFile tFile = mTfs.open(new TachyonURI("/root/testFile1"));
   FileInfo fileInfo = mTfs.getInfo(tFile);
   Assert.assertNotNull(fileInfo);
   Assert.assertEquals(
       getCommandOutput(new String[] {"mkdir", qualifiedPath}), mOutput.toString());
   Assert.assertTrue(fileInfo.isIsFolder());
 }
Ejemplo n.º 30
0
 @Test
 public void touchTestWithFullURI() throws IOException {
   String tachyonURI =
       "tachyon://"
           + mLocalTachyonCluster.getMasterHostname()
           + ":"
           + mLocalTachyonCluster.getMasterPort()
           + "/destFileURI";
   // when
   String[] argv = new String[] {"touch", tachyonURI};
   mFsShell.touch(argv);
   // then
   TachyonFile tFile = mTfs.getFile(new TachyonURI("/destFileURI"));
   Assert.assertThat(tFile, CoreMatchers.notNullValue());
   Assert.assertThat(getCommandOutput(argv), CoreMatchers.equalTo(mOutput.toString()));
   Assert.assertThat(tFile.isFile(), CoreMatchers.equalTo(true));
 }