当前位置: 首页>>代码示例>>Java>>正文


Java FsAction.READ_WRITE属性代码示例

本文整理汇总了Java中org.apache.hadoop.fs.permission.FsAction.READ_WRITE属性的典型用法代码示例。如果您正苦于以下问题:Java FsAction.READ_WRITE属性的具体用法?Java FsAction.READ_WRITE怎么用?Java FsAction.READ_WRITE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.fs.permission.FsAction的用法示例。


在下文中一共展示了FsAction.READ_WRITE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSetPermission

@Override
protected void testSetPermission() throws Exception {
  if (Path.WINDOWS) {
    FileSystem fs = FileSystem.get(getProxiedFSConf());
    Path path = new Path(getProxiedFSTestDir(), "foodir");
    fs.mkdirs(path);

    fs = getHttpFSFileSystem();
    FsPermission permission1 = new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE);
    fs.setPermission(path, permission1);
    fs.close();

    fs = FileSystem.get(getProxiedFSConf());
    FileStatus status1 = fs.getFileStatus(path);
    fs.close();
    FsPermission permission2 = status1.getPermission();
    Assert.assertEquals(permission2, permission1);

    // sticky bit not supported on Windows with local file system, so the
    // subclass skips that part of the test
  } else {
    super.testSetPermission();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestHttpFSFileSystemLocalFileSystem.java

示例2: testCreate

private void testCreate(Path path, boolean override) throws Exception {
  FileSystem fs = getHttpFSFileSystem();
  FsPermission permission = new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE);
  OutputStream os = fs.create(new Path(path.toUri().getPath()), permission, override, 1024,
                              (short) 2, 100 * 1024 * 1024, null);
  os.write(1);
  os.close();
  fs.close();

  fs = FileSystem.get(getProxiedFSConf());
  FileStatus status = fs.getFileStatus(path);
  if (!isLocalFS()) {
    Assert.assertEquals(status.getReplication(), 2);
    Assert.assertEquals(status.getBlockSize(), 100 * 1024 * 1024);
  }
  Assert.assertEquals(status.getPermission(), permission);
  InputStream is = fs.open(path);
  Assert.assertEquals(is.read(), 1);
  is.close();
  fs.close();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:BaseTestHttpFSWith.java

示例3: testPermissionMetadata

@SuppressWarnings("deprecation")
@Test
public void testPermissionMetadata() throws Exception {
  FsPermission justMe = new FsPermission(FsAction.READ_WRITE, FsAction.NONE,
      FsAction.NONE);
  Path selfishFile = new Path("/noOneElse");
  fs.create(selfishFile, justMe, true, 4096, fs.getDefaultReplication(),
      fs.getDefaultBlockSize(), null).close();
  HashMap<String, String> metadata = backingStore
      .getMetadata(AzureBlobStorageTestAccount.toMockUri(selfishFile));
  assertNotNull(metadata);
  String storedPermission = metadata.get("hdi_permission");
  assertEquals(getExpectedPermissionString("rw-------"), storedPermission);
  FileStatus retrievedStatus = fs.getFileStatus(selfishFile);
  assertNotNull(retrievedStatus);
  assertEquals(justMe, retrievedStatus.getPermission());
  assertEquals(getExpectedOwner(), retrievedStatus.getOwner());
  assertEquals(NativeAzureFileSystem.AZURE_DEFAULT_GROUP_DEFAULT,
      retrievedStatus.getGroup());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestBlobMetadata.java

示例4: genRandomPermission

/**
 * @return A random FsPermission
 */
private FsPermission genRandomPermission() {
  // randomly select between "rwx" and "rw-"
  FsAction u = random.nextBoolean() ? FsAction.ALL : FsAction.READ_WRITE;
  FsAction g = random.nextBoolean() ? FsAction.ALL : FsAction.READ_WRITE;
  FsAction o = random.nextBoolean() ? FsAction.ALL : FsAction.READ_WRITE;
  return new FsPermission(u, g, o);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TestSnapshot.java

示例5: testOldPermissionMetadata

/**
 * Tests that WASB understands the old-style ASV metadata and changes it when
 * it gets the chance.
 */
@Test
public void testOldPermissionMetadata() throws Exception {
  Path selfishFile = new Path("/noOneElse");
  HashMap<String, String> metadata =
      new HashMap<String, String>();
  metadata.put("asv_permission",
      getExpectedPermissionString("rw-------"));
  backingStore.setContent(
      AzureBlobStorageTestAccount.toMockUri(selfishFile),
      new byte[] { },
      metadata, false, 0);
  FsPermission justMe = new FsPermission(
      FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE);
  FileStatus retrievedStatus = fs.getFileStatus(selfishFile);
  assertNotNull(retrievedStatus);
  assertEquals(justMe, retrievedStatus.getPermission());
  assertEquals(getExpectedOwner(), retrievedStatus.getOwner());
  assertEquals(NativeAzureFileSystem.AZURE_DEFAULT_GROUP_DEFAULT,
      retrievedStatus.getGroup());
  FsPermission meAndYou = new FsPermission(
      FsAction.READ_WRITE, FsAction.READ_WRITE, FsAction.NONE);
  fs.setPermission(selfishFile, meAndYou);
  metadata =
      backingStore.getMetadata(
          AzureBlobStorageTestAccount.toMockUri(selfishFile));
  assertNotNull(metadata);
  String storedPermission = metadata.get("hdi_permission");
  assertEquals(getExpectedPermissionString("rw-rw----"),
      storedPermission);
  assertNull(metadata.get("asv_permission"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:TestBlobMetadata.java


注:本文中的org.apache.hadoop.fs.permission.FsAction.READ_WRITE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。