コード例 #1
0
 @Test
 public void createFileTest() throws Exception {
   mFsMaster.createFile(new AlluxioURI("/testFile"), CreateFileOptions.defaults());
   FileInfo fileInfo = mFsMaster.getFileInfo(mFsMaster.getFileId(new AlluxioURI("/testFile")));
   Assert.assertFalse(fileInfo.isFolder());
   Assert.assertEquals("", fileInfo.getUserName());
   Assert.assertEquals(0644, (short) fileInfo.getPermission());
 }
コード例 #2
0
 @Test
 public void createDirectoryTest() throws Exception {
   mFsMaster.createDirectory(new AlluxioURI("/testFolder"), CreateDirectoryOptions.defaults());
   FileInfo fileInfo = mFsMaster.getFileInfo(mFsMaster.getFileId(new AlluxioURI("/testFolder")));
   Assert.assertTrue(fileInfo.isFolder());
   Assert.assertEquals("", fileInfo.getUserName());
   Assert.assertEquals(0755, (short) fileInfo.getPermission());
 }
コード例 #3
0
    public void exec(int depth, int concurrencyDepth, AlluxioURI path) throws Exception {
      if (depth < 1) {
        return;
      } else if (depth == 1) {
        long fileId = mFsMaster.createFile(path, CreateFileOptions.defaults());
        Assert.assertEquals(fileId, mFsMaster.getFileId(path));
        // verify the user permission for file
        FileInfo fileInfo = mFsMaster.getFileInfo(fileId);
        Assert.assertEquals("", fileInfo.getUserName());
        Assert.assertEquals(0644, (short) fileInfo.getPermission());
      } else {
        mFsMaster.createDirectory(path, CreateDirectoryOptions.defaults());
        Assert.assertNotNull(mFsMaster.getFileId(path));
        long dirId = mFsMaster.getFileId(path);
        Assert.assertNotEquals(-1, dirId);
        FileInfo dirInfo = mFsMaster.getFileInfo(dirId);
        Assert.assertEquals("", dirInfo.getUserName());
        Assert.assertEquals(0755, (short) dirInfo.getPermission());
      }

      if (concurrencyDepth > 0) {
        ExecutorService executor = Executors.newCachedThreadPool();
        try {
          ArrayList<Future<Void>> futures = new ArrayList<Future<Void>>(FILES_PER_NODE);
          for (int i = 0; i < FILES_PER_NODE; i++) {
            Callable<Void> call =
                (new ConcurrentCreator(
                    depth - 1, concurrencyDepth - 1, path.join(Integer.toString(i))));
            futures.add(executor.submit(call));
          }
          for (Future<Void> f : futures) {
            f.get();
          }
        } finally {
          executor.shutdown();
        }
      } else {
        for (int i = 0; i < FILES_PER_NODE; i++) {
          exec(depth - 1, concurrencyDepth, path.join(Integer.toString(i)));
        }
      }
    }
コード例 #4
0
 @Test
 public void clientFileInfoEmptyFileTest() throws Exception {
   long fileId = mFsMaster.createFile(new AlluxioURI("/testFile"), CreateFileOptions.defaults());
   FileInfo fileInfo = mFsMaster.getFileInfo(fileId);
   Assert.assertEquals("testFile", fileInfo.getName());
   Assert.assertEquals(fileId, fileInfo.getFileId());
   Assert.assertEquals(0, fileInfo.getLength());
   Assert.assertTrue(fileInfo.isCacheable());
   Assert.assertFalse(fileInfo.isCompleted());
   Assert.assertFalse(fileInfo.isFolder());
   Assert.assertFalse(fileInfo.isPersisted());
   Assert.assertFalse(fileInfo.isPinned());
   Assert.assertEquals(Constants.NO_TTL, fileInfo.getTtl());
   Assert.assertEquals("", fileInfo.getUserName());
   Assert.assertEquals(0644, (short) fileInfo.getPermission());
 }
コード例 #5
0
 @Test
 public void clientFileInfoDirectoryTest() throws Exception {
   AlluxioURI path = new AlluxioURI("/testFolder");
   mFsMaster.createDirectory(path, CreateDirectoryOptions.defaults());
   long fileId = mFsMaster.getFileId(path);
   FileInfo fileInfo = mFsMaster.getFileInfo(fileId);
   Assert.assertEquals("testFolder", fileInfo.getName());
   Assert.assertEquals(1, fileInfo.getFileId());
   Assert.assertEquals(0, fileInfo.getLength());
   Assert.assertFalse(fileInfo.isCacheable());
   Assert.assertTrue(fileInfo.isCompleted());
   Assert.assertTrue(fileInfo.isFolder());
   Assert.assertFalse(fileInfo.isPersisted());
   Assert.assertFalse(fileInfo.isPinned());
   Assert.assertEquals("", fileInfo.getUserName());
   Assert.assertEquals(0755, (short) fileInfo.getPermission());
 }