Ejemplo n.º 1
0
  @Test
  public void testEmptySerializeToConf() {
    DAGAccessControls dagAccessControls = new DAGAccessControls();

    Configuration conf = new Configuration(false);
    dagAccessControls.serializeToConfiguration(conf);
    Assert.assertNotNull(conf.get(TezConstants.TEZ_DAG_VIEW_ACLS));
    Assert.assertNotNull(conf.get(TezConstants.TEZ_DAG_MODIFY_ACLS));

    Assert.assertEquals(" ", conf.get(TezConstants.TEZ_DAG_VIEW_ACLS));
    Assert.assertEquals(" ", conf.get(TezConstants.TEZ_DAG_MODIFY_ACLS));
  }
Ejemplo n.º 2
0
  @Test
  public void testGroupsOnlySerializeToConf() {
    DAGAccessControls dagAccessControls = new DAGAccessControls();
    dagAccessControls
        .setGroupsWithViewACLs(Arrays.asList("g1"))
        .setGroupsWithModifyACLs(Arrays.asList("g2"));

    Configuration conf = new Configuration(false);
    dagAccessControls.serializeToConfiguration(conf);
    Assert.assertNotNull(conf.get(TezConstants.TEZ_DAG_VIEW_ACLS));
    Assert.assertNotNull(conf.get(TezConstants.TEZ_DAG_MODIFY_ACLS));

    Assert.assertEquals(" g1", conf.get(TezConstants.TEZ_DAG_VIEW_ACLS));
    Assert.assertEquals(" g2", conf.get(TezConstants.TEZ_DAG_MODIFY_ACLS));
  }
Ejemplo n.º 3
0
  @Test
  public void testStringBasedConstructor() {
    DAGAccessControls dagAccessControls = new DAGAccessControls("u1 g1", "u2 g2");

    Assert.assertEquals(1, dagAccessControls.getUsersWithViewACLs().size());
    Assert.assertEquals(1, dagAccessControls.getUsersWithModifyACLs().size());
    Assert.assertEquals(1, dagAccessControls.getGroupsWithViewACLs().size());
    Assert.assertEquals(1, dagAccessControls.getGroupsWithModifyACLs().size());

    Assert.assertTrue(dagAccessControls.getUsersWithViewACLs().contains("u1"));
    Assert.assertTrue(dagAccessControls.getUsersWithModifyACLs().contains("u2"));
    Assert.assertTrue(dagAccessControls.getGroupsWithViewACLs().contains("g1"));
    Assert.assertTrue(dagAccessControls.getGroupsWithModifyACLs().contains("g2"));
  }