本文整理汇总了Java中org.apache.hadoop.test.HadoopUsersConfTestHelper.getHadoopUserGroups方法的典型用法代码示例。如果您正苦于以下问题:Java HadoopUsersConfTestHelper.getHadoopUserGroups方法的具体用法?Java HadoopUsersConfTestHelper.getHadoopUserGroups怎么用?Java HadoopUsersConfTestHelper.getHadoopUserGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.test.HadoopUsersConfTestHelper
的用法示例。
在下文中一共展示了HadoopUsersConfTestHelper.getHadoopUserGroups方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSetOwner
import org.apache.hadoop.test.HadoopUsersConfTestHelper; //导入方法依赖的package包/类
private void testSetOwner() throws Exception {
if (!isLocalFS()) {
FileSystem fs = FileSystem.get(getProxiedFSConf());
fs.mkdirs(getProxiedFSTestDir());
Path path = new Path(getProxiedFSTestDir(), "foo.txt");
OutputStream os = fs.create(path);
os.write(1);
os.close();
fs.close();
fs = getHttpFSFileSystem();
String user = HadoopUsersConfTestHelper.getHadoopUsers()[1];
String group = HadoopUsersConfTestHelper.getHadoopUserGroups(user)[0];
fs.setOwner(path, user, group);
fs.close();
fs = FileSystem.get(getProxiedFSConf());
FileStatus status1 = fs.getFileStatus(path);
fs.close();
Assert.assertEquals(status1.getOwner(), user);
Assert.assertEquals(status1.getGroup(), group);
}
}
示例2: getGroups
import org.apache.hadoop.test.HadoopUsersConfTestHelper; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public List<String> getGroups(String user) throws IOException {
if (user.equals("root")) {
return Arrays.asList("admin");
}
else if (user.equals("nobody")) {
return Arrays.asList("nobody");
} else {
String[] groups = HadoopUsersConfTestHelper.getHadoopUserGroups(user);
return (groups != null) ? Arrays.asList(groups) : Collections.EMPTY_LIST;
}
}
示例3: getGroups
import org.apache.hadoop.test.HadoopUsersConfTestHelper; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public List<String> getGroups(String user) throws IOException {
if (user.equals("root")) {
return Arrays.asList("admin");
} else if (user.equals("nobody")) {
return Arrays.asList("nobody");
} else {
String[] groups = HadoopUsersConfTestHelper.getHadoopUserGroups(user);
return (groups != null) ? Arrays.asList(groups) : Collections.EMPTY_LIST;
}
}