Example usage for org.apache.hadoop.security Groups getUserToGroupsMappingServiceWithLoadedConfiguration

List of usage examples for org.apache.hadoop.security Groups getUserToGroupsMappingServiceWithLoadedConfiguration

Introduction

In this page you can find the example usage for org.apache.hadoop.security Groups getUserToGroupsMappingServiceWithLoadedConfiguration.

Prototype

@Private
public static synchronized Groups getUserToGroupsMappingServiceWithLoadedConfiguration(Configuration conf) 

Source Link

Document

Create new groups used to map user-to-groups with loaded configuration.

Usage

From source file:org.apache.sentry.tests.e2e.hive.fs.MiniDFS.java

License:Apache License

private void createMiniDFSCluster(File baseDir, String serverType, boolean enableHDFSAcls) throws Exception {
    Configuration conf = new Configuration();
    if (HiveServer2Type.InternalMetastore.name().equalsIgnoreCase(serverType)) {
        // set the test group mapping that maps user to a group of same name
        conf.set("hadoop.security.group.mapping",
                "org.apache.sentry.tests.e2e.hive.fs.MiniDFS$PseudoGroupMappingService");
        // set umask for metastore test client can create tables in the warehouse dir
        conf.set("fs.permissions.umask-mode", "000");
        Groups.getUserToGroupsMappingServiceWithLoadedConfiguration(conf);
    }//  www .j av  a 2 s  .  c o  m
    File dfsDir = assertCreateDir(new File(baseDir, "dfs"));
    conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, dfsDir.getPath());
    conf.set("hadoop.security.group.mapping", MiniDFS.PseudoGroupMappingService.class.getName());
    if (enableHDFSAcls) {
        conf.set("dfs.namenode.acls.enabled", "true");
    }
    Configuration.addDefaultResource("test.xml");
    dfsCluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build();
    fileSystem = dfsCluster.getFileSystem();
    String policyDir = System.getProperty("sentry.e2etest.hive.policy.location", "/user/hive/sentry");
    sentryDir = super.assertCreateDfsDir(new Path(fileSystem.getUri() + policyDir));
    dfsBaseDir = assertCreateDfsDir(new Path(new Path(fileSystem.getUri()), "/base"));
}