TimelineDataManager extends AbstractService { public TimelineEntities getEntities( String entityType, NameValuePair primaryFilter, Collection<NameValuePair> secondaryFilter, Long windowStart, Long windowEnd, String fromId, Long fromTs, Long limit, EnumSet<Field> fields, UserGroupInformation callerUGI) throws YarnException, IOException { long startTime = Time.monotonicNow(); metrics.incrGetEntitiesOps(); try { TimelineEntities entities = doGetEntities( entityType, primaryFilter, secondaryFilter, windowStart, windowEnd, fromId, fromTs, limit, fields, callerUGI); metrics.incrGetEntitiesTotal(entities.getEntities().size()); return entities; } finally { metrics.addGetEntitiesTime(Time.monotonicNow() - startTime); } } TimelineDataManager(TimelineStore store,
      TimelineACLsManager timelineACLsManager); TimelineEntities getEntities(
      String entityType,
      NameValuePair primaryFilter,
      Collection<NameValuePair> secondaryFilter,
      Long windowStart,
      Long windowEnd,
      String fromId,
      Long fromTs,
      Long limit,
      EnumSet<Field> fields,
      UserGroupInformation callerUGI); TimelineEntity getEntity(
      String entityType,
      String entityId,
      EnumSet<Field> fields,
      UserGroupInformation callerUGI); TimelineEvents getEvents(
      String entityType,
      SortedSet<String> entityIds,
      SortedSet<String> eventTypes,
      Long windowStart,
      Long windowEnd,
      Long limit,
      UserGroupInformation callerUGI); TimelinePutResponse postEntities(
      TimelineEntities entities,
      UserGroupInformation callerUGI); void putDomain(TimelineDomain domain,
      UserGroupInformation callerUGI); TimelineDomain getDomain(String domainId,
      UserGroupInformation callerUGI); TimelineDomains getDomains(String owner,
      UserGroupInformation callerUGI); @VisibleForTesting
  static final String DEFAULT_DOMAIN_ID; }
@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); } }
@Test public void testGetOldEntitiesWithOutDomainId() throws Exception { TimelineEntities entities = dataManaer.getEntities( "OLD_ENTITY_TYPE_1", null, null, null, null, null, null, null, null, UserGroupInformation.getCurrentUser()); Assert.assertEquals(2, entities.getEntities().size()); Assert.assertEquals("OLD_ENTITY_ID_2", entities.getEntities().get(0).getEntityId()); Assert.assertEquals("OLD_ENTITY_TYPE_1", entities.getEntities().get(0).getEntityType()); Assert.assertEquals(TimelineDataManager.DEFAULT_DOMAIN_ID, entities.getEntities().get(0).getDomainId()); Assert.assertEquals("OLD_ENTITY_ID_1", entities.getEntities().get(1).getEntityId()); Assert.assertEquals("OLD_ENTITY_TYPE_1", entities.getEntities().get(1).getEntityType()); Assert.assertEquals(TimelineDataManager.DEFAULT_DOMAIN_ID, entities.getEntities().get(1).getDomainId()); }