EntityGroupFSTimelineStore extends CompositeService implements TimelineStore { @Override public TimelineEntity getEntity(String entityId, String entityType, EnumSet<Field> fieldsToRetrieve) throws IOException { LOG.debug("getEntity type={} id={}", entityType, entityId); List<EntityCacheItem> relatedCacheItems = new ArrayList<>(); List<TimelineStore> stores = getTimelineStoresForRead(entityId, entityType, relatedCacheItems); for (TimelineStore store : stores) { LOG.debug("Try timeline store {}:{} for the request", store.getName(), store.toString()); TimelineEntity e = store.getEntity(entityId, entityType, fieldsToRetrieve); if (e != null) { return e; } } LOG.debug("getEntity: Found nothing"); return null; } EntityGroupFSTimelineStore(); @Override TimelineEntities getEntities(String entityType, Long limit,
      Long windowStart, Long windowEnd, String fromId, Long fromTs,
      NameValuePair primaryFilter, Collection<NameValuePair> secondaryFilters,
      EnumSet<Field> fieldsToRetrieve, CheckAcl checkAcl); @Override TimelineEntity getEntity(String entityId, String entityType,
      EnumSet<Field> fieldsToRetrieve); @Override TimelineEvents getEntityTimelines(String entityType,
      SortedSet<String> entityIds, Long limit, Long windowStart,
      Long windowEnd, Set<String> eventTypes); @Override TimelineDomain getDomain(String domainId); @Override TimelineDomains getDomains(String owner); @Override TimelinePutResponse put(TimelineEntities data); @Override void put(TimelineDomain domain);  }
@Test public void testGetEntityPluginRead() throws Exception { EntityGroupFSTimelineStore store = null; ApplicationId appId = ApplicationId.fromString("application_1501509265053_0001"); String user = UserGroupInformation.getCurrentUser().getShortUserName(); Path userBase = new Path(testActiveDirPath, user); Path userAppRoot = new Path(userBase, appId.toString()); Path attemotDirPath = new Path(userAppRoot, getAttemptDirName(appId)); try { store = createAndStartTimelineStore(AppState.ACTIVE); String logFileName = EntityGroupFSTimelineStore.ENTITY_LOG_PREFIX + EntityGroupPlugInForTest.getStandardTimelineGroupId(appId); createTestFiles(appId, attemotDirPath, logFileName); TimelineEntity entity = store.getEntity(entityNew.getEntityId(), entityNew.getEntityType(), EnumSet.allOf(Field.class)); assertNotNull(entity); assertEquals(entityNew.getEntityId(), entity.getEntityId()); assertEquals(entityNew.getEntityType(), entity.getEntityType()); } finally { if (store != null) { store.stop(); } fs.delete(userBase, true); } }