Package tachyon

Examples of tachyon.TachyonURI


      Assert.assertTrue(file.isInMemory());
    }

    CommonUtils.sleepMs(null, WORKER_TO_MASTER_HEARTBEAT_INTERVAL_MS);
    for (int k = 0; k < MAX_FILES; k ++) {
      TachyonFile file = mTfs.getFile(new TachyonURI("/file" + k));
      Assert.assertTrue(file.isInMemory());
    }

    for (int k = MAX_FILES; k < MAX_FILES + 1; k ++) {
      int fileId =
          TestUtils.createByteFile(mTfs, "/file" + k, WriteType.MUST_CACHE, USER_QUOTA_UNIT_BYTES);
      TachyonFile file = mTfs.getFile(fileId);
      Assert.assertTrue(file.isInMemory());
    }

    CommonUtils.sleepMs(null, WORKER_TO_MASTER_HEARTBEAT_INTERVAL_MS);
    TachyonFile file = mTfs.getFile(new TachyonURI("/file" + 0));
    Assert.assertFalse(file.isInMemory());

    for (int k = 1; k < MAX_FILES + 1; k ++) {
      file = mTfs.getFile(new TachyonURI("/file" + k));
      Assert.assertTrue(file.isInMemory());
    }
  }
View Full Code Here


   * @throws FileAlreadyExistException
   * @throws IOException
   */
  @Test
  public void isInMemoryTest3() throws InvalidPathException, FileAlreadyExistException, IOException {
    TachyonURI pin = new TachyonURI("/pin");
    mTfs.mkdir(pin);
    mTfs.pinFile(mTfs.getFileId(pin));

    int fileId =
        TestUtils.createByteFile(mTfs, "/pin/file", WriteType.MUST_CACHE, USER_QUOTA_UNIT_BYTES);
    TachyonFile file = mTfs.getFile(fileId);
    Assert.assertTrue(file.isInMemory());

    for (int k = 0; k < MAX_FILES; k ++) {
      fileId =
          TestUtils.createByteFile(mTfs, "/file" + k, WriteType.MUST_CACHE, USER_QUOTA_UNIT_BYTES);
      file = mTfs.getFile(fileId);
      Assert.assertTrue(file.isInMemory());
    }

    CommonUtils.sleepMs(null, WORKER_TO_MASTER_HEARTBEAT_INTERVAL_MS);

    file = mTfs.getFile(new TachyonURI("/pin/file"));
    Assert.assertTrue(file.isInMemory());
    file = mTfs.getFile(new TachyonURI("/file0"));
    Assert.assertFalse(file.isInMemory());
    for (int k = 1; k < MAX_FILES; k ++) {
      file = mTfs.getFile(new TachyonURI("/file" + k));
      Assert.assertTrue(file.isInMemory());
    }
  }
View Full Code Here

    buf.close();
  }

  @Test
  public void writeEmptyFileTest() throws IOException {
    TachyonURI uri = new TachyonURI("/emptyFile");
    Assert.assertEquals(2, mTfs.createFile(uri));
    Assert.assertTrue(mTfs.exist(uri));
    TachyonFile file = mTfs.getFile(uri);
    Assert.assertEquals(0, file.length());
    OutStream os = file.getOutStream(WriteType.CACHE_THROUGH);
View Full Code Here

    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.getFile(new TachyonURI("/testFile"));
    Assert.assertNotNull(tFile);
    Assert.assertEquals(SIZE_BYTES, tFile.length());
    InStream tfis = tFile.getInStream(ReadType.NO_CACHE);
    byte read[] = new byte[SIZE_BYTES];
    tfis.read(read);
View Full Code Here

    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(new TachyonURI("/testDir/testFile"));
    TachyonFile tFile2 = mTfs.getFile(new TachyonURI("/testDir/testDirInner/testFile2"));
    Assert.assertNotNull(tFile);
    Assert.assertNotNull(tFile2);
    Assert.assertEquals(10, tFile.length());
    Assert.assertEquals(20, tFile2.length());
    byte[] read = readContent(tFile, 10);
View Full Code Here

    mFsShell.copyFromLocal(new String[] {"copyFromLocal", testFile.getPath(), tachyonURI});
    String cmdOut =
        getCommandOutput(new String[] {"copyFromLocal", testFile.getPath(), tachyonURI});
    // then
    assertThat(cmdOut, equalTo(mOutput.toString()));
    TachyonFile tFile = mTfs.getFile(new TachyonURI("/destFileURI"));
    assertThat(tFile.length(), equalTo(10L));
    byte[] read = readContent(tFile, 10);
    assertThat(TestUtils.equalIncreasingByteArray(10, read), equalTo(true));
  }
View Full Code Here

  @Test
  public void fileinfoTest() throws IOException {
    int fileId = TestUtils.createByteFile(mTfs, "/testFile", WriteType.MUST_CACHE, 10);
    mFsShell.fileinfo(new String[] {"fileinfo", "/testFile"});
    TachyonFile tFile = mTfs.getFile(new TachyonURI("/testFile"));
    Assert.assertNotNull(tFile);
    List<ClientBlockInfo> blocks = mTfs.getFileBlocks(fileId);
    String[] commandParameters = new String[3 + blocks.size()];
    commandParameters[0] = "fileinfo";
    commandParameters[1] = "/testFile";
View Full Code Here

  @Test
  public void locationTest() throws IOException {
    int fileId = TestUtils.createByteFile(mTfs, "/testFile", WriteType.MUST_CACHE, 10);
    mFsShell.location(new String[] {"location", "/testFile"});
    TachyonFile tFile = mTfs.getFile(new TachyonURI("/testFile"));
    Assert.assertNotNull(tFile);
    List<String> locationsList = tFile.getLocationHosts();
    String[] commandParameters = new String[3 + locationsList.size()];
    commandParameters[0] = "location";
    commandParameters[1] = "/testFile";
View Full Code Here

  public void lsrTest() throws IOException {
    int fileIdA = TestUtils.createByteFile(mTfs, "/testRoot/testFileA", WriteType.MUST_CACHE, 10);
    TachyonFile[] files = new TachyonFile[4];
    files[0] = mTfs.getFile(fileIdA);
    TestUtils.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 = TestUtils.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";
View Full Code Here

  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(new TachyonURI("/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";
View Full Code Here

TOP

Related Classes of tachyon.TachyonURI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.