Java 类org.apache.hadoop.security.ShellBasedUnixGroupsMapping 实例源码

项目:hadoop-oss    文件:TestGroupsCaching.java   
@Before
public void setup() {
  FakeGroupMapping.resetRequestCount();
  ExceptionalGroupMapping.resetRequestCount();

  conf = new Configuration();
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
    FakeGroupMapping.class,
    ShellBasedUnixGroupsMapping.class);
}
项目:hadoop-oss    文件:TestGroupsCaching.java   
@Test
public void testGroupLookupForStaticUsers() throws Exception {
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class);
  conf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, "me=;user1=group1;user2=group1,group2");
  Groups groups = new Groups(conf);
  List<String> userGroups = groups.getGroups("me");
  assertTrue("non-empty groups for static user", userGroups.isEmpty());
  assertFalse("group lookup done for static user",
      FakeunPrivilegedGroupMapping.invoked);

  List<String> expected = new ArrayList<String>();
  expected.add("group1");

  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user1");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

  expected.add("group2");
  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user2");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

}
项目:hadoop    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hadoop    文件:TestGroupsCaching.java   
@Before
public void setup() {
  FakeGroupMapping.resetRequestCount();
  ExceptionalGroupMapping.resetRequestCount();

  conf = new Configuration();
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
    FakeGroupMapping.class,
    ShellBasedUnixGroupsMapping.class);
}
项目:hadoop    文件:TestGroupsCaching.java   
@Test
public void testGroupLookupForStaticUsers() throws Exception {
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class);
  conf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, "me=;user1=group1;user2=group1,group2");
  Groups groups = new Groups(conf);
  List<String> userGroups = groups.getGroups("me");
  assertTrue("non-empty groups for static user", userGroups.isEmpty());
  assertFalse("group lookup done for static user",
      FakeunPrivilegedGroupMapping.invoked);

  List<String> expected = new ArrayList<String>();
  expected.add("group1");

  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user1");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

  expected.add("group2");
  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user2");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

  Configuration newConf = new Configuration();
  newConf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, "me=;user1=group1;user2=group1,group2;user3=group3");
  groups.refresh(newConf);

  expected.clear();
  expected.add("group3");
  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user3");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);
}
项目:aliyun-oss-hadoop-fs    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:aliyun-oss-hadoop-fs    文件:TestGroupsCaching.java   
@Before
public void setup() {
  FakeGroupMapping.resetRequestCount();
  ExceptionalGroupMapping.resetRequestCount();

  conf = new Configuration();
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
    FakeGroupMapping.class,
    ShellBasedUnixGroupsMapping.class);
}
项目:aliyun-oss-hadoop-fs    文件:TestGroupsCaching.java   
@Test
public void testGroupLookupForStaticUsers() throws Exception {
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class);
  conf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, "me=;user1=group1;user2=group1,group2");
  Groups groups = new Groups(conf);
  List<String> userGroups = groups.getGroups("me");
  assertTrue("non-empty groups for static user", userGroups.isEmpty());
  assertFalse("group lookup done for static user",
      FakeunPrivilegedGroupMapping.invoked);

  List<String> expected = new ArrayList<String>();
  expected.add("group1");

  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user1");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

  expected.add("group2");
  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user2");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

}
项目:big-c    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:big-c    文件:TestGroupsCaching.java   
@Before
public void setup() {
  FakeGroupMapping.resetRequestCount();
  ExceptionalGroupMapping.resetRequestCount();

  conf = new Configuration();
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
    FakeGroupMapping.class,
    ShellBasedUnixGroupsMapping.class);
}
项目:big-c    文件:TestGroupsCaching.java   
@Test
public void testGroupLookupForStaticUsers() throws Exception {
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class);
  conf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, "me=;user1=group1;user2=group1,group2");
  Groups groups = new Groups(conf);
  List<String> userGroups = groups.getGroups("me");
  assertTrue("non-empty groups for static user", userGroups.isEmpty());
  assertFalse("group lookup done for static user",
      FakeunPrivilegedGroupMapping.invoked);

  List<String> expected = new ArrayList<String>();
  expected.add("group1");

  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user1");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

  expected.add("group2");
  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user2");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

}
项目:hadoop-2.6.0-cdh5.4.3    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestGroupsCaching.java   
@Before
public void setup() {
  FakeGroupMapping.resetRequestCount();
  ExceptionalGroupMapping.resetRequestCount();

  conf = new Configuration();
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
    FakeGroupMapping.class,
    ShellBasedUnixGroupsMapping.class);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestGroupsCaching.java   
@Test
public void testGroupLookupForStaticUsers() throws Exception {
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class);
  conf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, "me=;user1=group1;user2=group1,group2");
  Groups groups = new Groups(conf);
  List<String> userGroups = groups.getGroups("me");
  assertTrue("non-empty groups for static user", userGroups.isEmpty());
  assertFalse("group lookup done for static user",
      FakeunPrivilegedGroupMapping.invoked);

  List<String> expected = new ArrayList<String>();
  expected.add("group1");

  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user1");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

  expected.add("group2");
  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user2");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

}
项目:hadoop-plus    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:FlexMap    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hops    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 *
 * @param conf
 * @param map
 *     - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping(Configuration conf,
    Map<String, String[]> map) {
  if (map != null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hops    文件:TestGroupsCaching.java   
@Before
public void setup() throws IOException {
  FakeGroupMapping.clearAll();
  ExceptionalGroupMapping.resetRequestCount();

  conf = new Configuration();
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
    FakeGroupMapping.class,
    ShellBasedUnixGroupsMapping.class);
}
项目:hops    文件:TestGroupsCaching.java   
@Test
public void testGroupLookupForStaticUsers() throws Exception {
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class);
  conf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, "me=;user1=group1;user2=group1,group2");
  Groups groups = new Groups(conf);
  List<String> userGroups = groups.getGroups("me");
  assertTrue("non-empty groups for static user", userGroups.isEmpty());
  assertFalse("group lookup done for static user",
      FakeunPrivilegedGroupMapping.invoked);

  List<String> expected = new ArrayList<String>();
  expected.add("group1");

  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user1");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

  expected.add("group2");
  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user2");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

}
项目:hadoop-TCP    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hadoop-on-lustre    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass("hadoop.security.group.mapping",
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hardfs    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hadoop-on-lustre2    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hadoop-on-lustre2    文件:TestGroupsCaching.java   
@Before
public void setup() {
  conf = new Configuration();
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
    FakeGroupMapping.class,
    ShellBasedUnixGroupsMapping.class);
}
项目:hadoop-on-lustre2    文件:TestGroupsCaching.java   
@Test
public void testGroupLookupForStaticUsers() throws Exception {
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      FakeunPrivilegedGroupMapping.class, ShellBasedUnixGroupsMapping.class);
  conf.set(CommonConfigurationKeys.HADOOP_USER_GROUP_STATIC_OVERRIDES, "me=;user1=group1;user2=group1,group2");
  Groups groups = new Groups(conf);
  List<String> userGroups = groups.getGroups("me");
  assertTrue("non-empty groups for static user", userGroups.isEmpty());
  assertFalse("group lookup done for static user",
      FakeunPrivilegedGroupMapping.invoked);

  List<String> expected = new ArrayList<String>();
  expected.add("group1");

  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user1");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

  expected.add("group2");
  FakeunPrivilegedGroupMapping.invoked = false;
  userGroups = groups.getGroups("user2");
  assertTrue("groups not correct", expected.equals(userGroups));
  assertFalse("group lookup done for unprivileged user",
      FakeunPrivilegedGroupMapping.invoked);

}
项目:cumulus    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass(CommonConfigurationKeys.HADOOP_SECURITY_GROUP_MAPPING,
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hortonworks-extension    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass("hadoop.security.group.mapping",
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}
项目:hortonworks-extension    文件:DFSTestUtil.java   
/**
 * update the configuration with fake class for mapping user to groups
 * @param conf
 * @param map - user to groups mapping
 */
static public void updateConfWithFakeGroupMapping
  (Configuration conf, Map<String, String []> map) {
  if(map!=null) {
    MockUnixGroupsMapping.fakeUser2GroupsMap = map;
  }

  // fake mapping user to groups
  conf.setClass("hadoop.security.group.mapping",
      DFSTestUtil.MockUnixGroupsMapping.class,
      ShellBasedUnixGroupsMapping.class);

}