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


Java AdminACLsManager类代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.security.AdminACLsManager的典型用法代码示例。如果您正苦于以下问题:Java AdminACLsManager类的具体用法?Java AdminACLsManager怎么用?Java AdminACLsManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setup

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Before
public void setup() throws Exception {
  fsPath = new File("target", this.getClass().getSimpleName() +
      "-tmpDir").getAbsoluteFile();
  fsContext = FileContext.getLocalFSFileContext();
  fsContext.delete(new Path(fsPath.getAbsolutePath()), true);
  Configuration conf = new YarnConfiguration();
  conf.set(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_PATH,
      fsPath.getAbsolutePath());
  conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_TTL_ENABLE, false);
  store = new LeveldbTimelineStore();
  store.init(conf);
  store.start();
  loadTestEntityData();
  loadVerificationEntityData();
  loadTestDomainData();

  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false);
  aclsManager = new TimelineACLsManager(conf);
  dataManaer = new TimelineDataManager(store, aclsManager);
  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
  adminACLsManager = new AdminACLsManager(conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestTimelineDataManager.java

示例2: ErrorsAndWarningsBlock

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Inject
ErrorsAndWarningsBlock(ViewContext ctx, Configuration conf) {
  super(ctx);
  // default is to show all errors and warnings
  cutoffPeriodSeconds = Time.now() / 1000;
  String value = ctx.requestContext().get("cutoff", "");
  try {
    cutoffPeriodSeconds = Integer.parseInt(value);
    if (cutoffPeriodSeconds <= 0) {
      cutoffPeriodSeconds = Time.now() / 1000;
    }
  } catch (NumberFormatException ne) {
    cutoffPeriodSeconds = Time.now() / 1000;
  }
  adminAclsManager = new AdminACLsManager(conf);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:17,代码来源:ErrorsAndWarningsBlock.java

示例3: setup

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Before
public void setup() throws Exception {
  fsPath = new File("target", this.getClass().getSimpleName() +
      "-tmpDir").getAbsoluteFile();
  fsContext = FileContext.getLocalFSFileContext();
  fsContext.delete(new Path(fsPath.getAbsolutePath()), true);
  Configuration conf = new YarnConfiguration();
  conf.set(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_PATH,
      fsPath.getAbsolutePath());
  conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_TTL_ENABLE, false);
  store = new LeveldbTimelineStore();
  store.init(conf);
  store.start();
  loadTestEntityData();
  loadVerificationEntityData();
  loadTestDomainData();

  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false);
  aclsManager = new TimelineACLsManager(conf);
  dataManaer = new TimelineDataManager(store, aclsManager);
  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
  dataManaer.init(conf);
  adminACLsManager = new AdminACLsManager(conf);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:TestTimelineDataManager.java

示例4: setup

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Before
public void setup() throws Exception {
  fsPath = new File("target", this.getClass().getSimpleName() +
      "-tmpDir").getAbsoluteFile();
  fsContext = FileContext.getLocalFSFileContext();
  fsContext.delete(new Path(fsPath.getAbsolutePath()), true);
  Configuration conf = new YarnConfiguration();
  conf.set(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_PATH,
      fsPath.getAbsolutePath());
  conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_TTL_ENABLE, false);
  store = new LeveldbTimelineStore();
  store.init(conf);
  store.start();
  loadTestEntityData();
  loadVerificationEntityData();
  loadTestDomainData();

  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false);
  aclsManager = new TimelineACLsManager(conf);
  aclsManager.setTimelineStore(store);
  dataManaer = new TimelineDataManager(store, aclsManager);
  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
  dataManaer.init(conf);
  adminACLsManager = new AdminACLsManager(conf);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:27,代码来源:TestTimelineDataManager.java

示例5: setAdminACLsManager

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Private
@VisibleForTesting
public AdminACLsManager
    setAdminACLsManager(AdminACLsManager adminAclsManager) {
  AdminACLsManager oldAdminACLsManager = this.adminAclsManager;
  this.adminAclsManager = adminAclsManager;
  return oldAdminACLsManager;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TimelineACLsManager.java

示例6: testGetEntitiesAclEnabled

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Test
public void testGetEntitiesAclEnabled() throws Exception {
  AdminACLsManager oldAdminACLsManager =
    aclsManager.setAdminACLsManager(adminACLsManager);
  try {
    TimelineEntities entities = dataManaer.getEntities(
      "ACL_ENTITY_TYPE_1", null, null, null, null, null, null, 1l, null,
      UserGroupInformation.createUserForTesting("owner_1", new String[] {"group1"}));
    Assert.assertEquals(1, entities.getEntities().size());
    Assert.assertEquals("ACL_ENTITY_ID_11",
      entities.getEntities().get(0).getEntityId());
  } finally {
    aclsManager.setAdminACLsManager(oldAdminACLsManager);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestTimelineDataManager.java

示例7: testPostEntitiesToDefaultDomain

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Test
public void testPostEntitiesToDefaultDomain() throws Exception {
  AdminACLsManager oldAdminACLsManager =
      timelineACLsManager.setAdminACLsManager(adminACLsManager);
  try {
    TimelineEntities entities = new TimelineEntities();
    TimelineEntity entity = new TimelineEntity();
    entity.setEntityId("test id 7");
    entity.setEntityType("test type 7");
    entity.setStartTime(System.currentTimeMillis());
    entities.addEntity(entity);
    WebResource r = resource();
    ClientResponse response = r.path("ws").path("v1").path("timeline")
        .queryParam("user.name", "anybody_1")
        .accept(MediaType.APPLICATION_JSON)
        .type(MediaType.APPLICATION_JSON)
        .post(ClientResponse.class, entities);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    TimelinePutResponse putResposne =
        response.getEntity(TimelinePutResponse.class);
    Assert.assertNotNull(putResposne);
    Assert.assertEquals(0, putResposne.getErrors().size());
    // verify the entity exists in the store
    response = r.path("ws").path("v1").path("timeline")
        .path("test type 7").path("test id 7")
        .queryParam("user.name", "any_body_2")
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    entity = response.getEntity(TimelineEntity.class);
    Assert.assertNotNull(entity);
    Assert.assertEquals("test id 7", entity.getEntityId());
    Assert.assertEquals("test type 7", entity.getEntityType());
    Assert.assertEquals(TimelineDataManager.DEFAULT_DOMAIN_ID,
        entity.getDomainId());
  } finally {
    timelineACLsManager.setAdminACLsManager(oldAdminACLsManager);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:40,代码来源:TestTimelineWebServices.java

示例8: testGetDomainYarnACLsEnabled

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Test
public void testGetDomainYarnACLsEnabled() {
  AdminACLsManager oldAdminACLsManager =
      timelineACLsManager.setAdminACLsManager(adminACLsManager);
  try {
    WebResource r = resource();
    ClientResponse response = r.path("ws").path("v1").path("timeline")
        .path("domain").path("domain_id_1")
        .queryParam("user.name", "owner_1")
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
    Assert.assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    TimelineDomain domain = response.getEntity(TimelineDomain.class);
    verifyDomain(domain, "domain_id_1");

    response = r.path("ws").path("v1").path("timeline")
        .path("domain").path("domain_id_1")
        .queryParam("user.name", "tester")
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
    Assert.assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    Assert.assertEquals(ClientResponse.Status.NOT_FOUND,
        response.getClientResponseStatus());
  } finally {
    timelineACLsManager.setAdminACLsManager(oldAdminACLsManager);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:TestTimelineWebServices.java

示例9: testGetDomainsYarnACLsEnabled

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Test
public void testGetDomainsYarnACLsEnabled() throws Exception {
  AdminACLsManager oldAdminACLsManager =
      timelineACLsManager.setAdminACLsManager(adminACLsManager);
  try {
    WebResource r = resource();
    ClientResponse response = r.path("ws").path("v1").path("timeline")
        .path("domain")
        .queryParam("user.name", "owner_1")
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
    Assert.assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    TimelineDomains domains = response.getEntity(TimelineDomains.class);
    Assert.assertEquals(2, domains.getDomains().size());
    for (int i = 0; i < domains.getDomains().size(); ++i) {
      verifyDomain(domains.getDomains().get(i),
          i == 0 ? "domain_id_4" : "domain_id_1");
    }

    response = r.path("ws").path("v1").path("timeline")
        .path("domain")
        .queryParam("owner", "owner_1")
        .queryParam("user.name", "tester")
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
    Assert.assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    domains = response.getEntity(TimelineDomains.class);
    Assert.assertEquals(0, domains.getDomains().size());
  } finally {
    timelineACLsManager.setAdminACLsManager(oldAdminACLsManager);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:TestTimelineWebServices.java

示例10: testPutDomainYarnACLsEnabled

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Test
public void testPutDomainYarnACLsEnabled() throws Exception {
  AdminACLsManager oldAdminACLsManager =
      timelineACLsManager.setAdminACLsManager(adminACLsManager);
  try {
    TimelineDomain domain = new TimelineDomain();
    domain.setId("test_domain_id_acl");
    WebResource r = resource();
    ClientResponse response = r.path("ws").path("v1")
        .path("timeline").path("domain")
        .queryParam("user.name", "tester")
        .accept(MediaType.APPLICATION_JSON)
        .type(MediaType.APPLICATION_JSON)
        .put(ClientResponse.class, domain);
    assertEquals(Status.OK.getStatusCode(), response.getStatus());

    // Update the domain by another user
    response = r.path("ws").path("v1")
        .path("timeline").path("domain")
        .queryParam("user.name", "other")
        .accept(MediaType.APPLICATION_JSON)
        .type(MediaType.APPLICATION_JSON)
        .put(ClientResponse.class, domain);
    assertEquals(Status.FORBIDDEN.getStatusCode(), response.getStatus());
  } finally {
    timelineACLsManager.setAdminACLsManager(oldAdminACLsManager);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestTimelineWebServices.java

示例11: ApplicationACLsManager

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
public ApplicationACLsManager(Configuration conf) {
  this.conf = conf;
  this.adminAclsManager = new AdminACLsManager(this.conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:ApplicationACLsManager.java

示例12: TimelineACLsManager

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public TimelineACLsManager(Configuration conf) {
  this.adminAclsManager = new AdminACLsManager(conf);
  aclExts = Collections.synchronizedMap(
      new LRUMap(DOMAIN_ACCESS_ENTRY_CACHE_SIZE));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:TimelineACLsManager.java

示例13: testGetEntityWithYarnACLsEnabled

import org.apache.hadoop.yarn.security.AdminACLsManager; //导入依赖的package包/类
@Test
public void testGetEntityWithYarnACLsEnabled() throws Exception {
  AdminACLsManager oldAdminACLsManager =
      timelineACLsManager.setAdminACLsManager(adminACLsManager);
  try {
    TimelineEntities entities = new TimelineEntities();
    TimelineEntity entity = new TimelineEntity();
    entity.setEntityId("test id 3");
    entity.setEntityType("test type 3");
    entity.setStartTime(System.currentTimeMillis());
    entity.setDomainId("domain_id_1");
    entities.addEntity(entity);
    WebResource r = resource();
    ClientResponse response = r.path("ws").path("v1").path("timeline")
        .queryParam("user.name", "writer_user_1")
        .accept(MediaType.APPLICATION_JSON)
        .type(MediaType.APPLICATION_JSON)
        .post(ClientResponse.class, entities);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    TimelinePutResponse putResponse =
        response.getEntity(TimelinePutResponse.class);
    Assert.assertEquals(0, putResponse.getErrors().size());
    // verify the system data will not be exposed
    // 1. No field specification
    response = r.path("ws").path("v1").path("timeline")
        .path("test type 3").path("test id 3")
        .queryParam("user.name", "reader_user_1")
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    entity = response.getEntity(TimelineEntity.class);
    Assert.assertNull(entity.getPrimaryFilters().get(
        TimelineStore.SystemFilter.ENTITY_OWNER.toString()));
    // 2. other field
    response = r.path("ws").path("v1").path("timeline")
        .path("test type 3").path("test id 3")
        .queryParam("fields", "relatedentities")
        .queryParam("user.name", "reader_user_1")
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    entity = response.getEntity(TimelineEntity.class);
    Assert.assertNull(entity.getPrimaryFilters().get(
        TimelineStore.SystemFilter.ENTITY_OWNER.toString()));
    // 3. primaryfilters field
    response = r.path("ws").path("v1").path("timeline")
        .path("test type 3").path("test id 3")
        .queryParam("fields", "primaryfilters")
        .queryParam("user.name", "reader_user_1")
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    entity = response.getEntity(TimelineEntity.class);
    Assert.assertNull(entity.getPrimaryFilters().get(
        TimelineStore.SystemFilter.ENTITY_OWNER.toString()));

    // get entity with other user
    response = r.path("ws").path("v1").path("timeline")
        .path("test type 3").path("test id 3")
        .queryParam("user.name", "reader_user_2")
        .accept(MediaType.APPLICATION_JSON)
        .get(ClientResponse.class);
    assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
    assertEquals(ClientResponse.Status.NOT_FOUND,
        response.getClientResponseStatus());
  } finally {
    timelineACLsManager.setAdminACLsManager(oldAdminACLsManager);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:70,代码来源:TestTimelineWebServices.java


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