@Test public void testGetTableSpecificPropsFromState() { SourceState state = new SourceState(); state.setProp(DatasetUtils.DATASET_SPECIFIC_PROPS, "[{\"dataset\":\"Entity1\", \"value\": 1}, {\"dataset\":\"Table2\", \"value\":2}]"); SourceEntity se1 = new SourceEntity("Entity1", "Table2"); SourceEntity se3 = new SourceEntity("Entity3", "Table3"); Set<SourceEntity> entities = ImmutableSet.of(se1, se3); Map<SourceEntity, State> datasetProps = QueryBasedSource.getTableSpecificPropsFromState(entities, state); Assert.assertEquals(datasetProps.size(), 1); Assert.assertTrue(datasetProps.containsKey(se1)); State se1Props = datasetProps.get(se1); Assert.assertEquals(se1Props.getProp("value"), "1"); }
public static Map<SourceEntity, State> getTableSpecificPropsFromState( Iterable<SourceEntity> entities, SourceState state) { Map<String, SourceEntity> sourceEntityByName = new HashMap<>(); for (SourceEntity entity: entities) { sourceEntityByName.put(entity.getDatasetName(), entity); } Map<String, State> datasetProps = DatasetUtils.getDatasetSpecificProps(sourceEntityByName.keySet(), state); Map<SourceEntity, State> res = new HashMap<>(); for (Map.Entry<String, State> entry: datasetProps.entrySet()) { res.put(sourceEntityByName.get(entry.getKey()), entry.getValue()); } return res; }
QueryBasedSource extends AbstractSource<S, D> { public static Map<SourceEntity, State> getTableSpecificPropsFromState( Iterable<SourceEntity> entities, SourceState state) { Map<String, SourceEntity> sourceEntityByName = new HashMap<>(); for (SourceEntity entity: entities) { sourceEntityByName.put(entity.getDatasetName(), entity); } Map<String, State> datasetProps = DatasetUtils.getDatasetSpecificProps(sourceEntityByName.keySet(), state); Map<SourceEntity, State> res = new HashMap<>(); for (Map.Entry<String, State> entry: datasetProps.entrySet()) { res.put(sourceEntityByName.get(entry.getKey()), entry.getValue()); } return res; } }
QueryBasedSource extends AbstractSource<S, D> { public static Map<SourceEntity, State> getTableSpecificPropsFromState( Iterable<SourceEntity> entities, SourceState state) { Map<String, SourceEntity> sourceEntityByName = new HashMap<>(); for (SourceEntity entity: entities) { sourceEntityByName.put(entity.getDatasetName(), entity); } Map<String, State> datasetProps = DatasetUtils.getDatasetSpecificProps(sourceEntityByName.keySet(), state); Map<SourceEntity, State> res = new HashMap<>(); for (Map.Entry<String, State> entry: datasetProps.entrySet()) { res.put(sourceEntityByName.get(entry.getKey()), entry.getValue()); } return res; }  }
QueryBasedSource extends AbstractSource<S, D> { public static Map<SourceEntity, State> getTableSpecificPropsFromState( Iterable<SourceEntity> entities, SourceState state) { Map<String, SourceEntity> sourceEntityByName = new HashMap<>(); for (SourceEntity entity: entities) { sourceEntityByName.put(entity.getDatasetName(), entity); } Map<String, State> datasetProps = DatasetUtils.getDatasetSpecificProps(sourceEntityByName.keySet(), state); Map<SourceEntity, State> res = new HashMap<>(); for (Map.Entry<String, State> entry: datasetProps.entrySet()) { res.put(sourceEntityByName.get(entry.getKey()), entry.getValue()); } return res; }  @Override List<WorkUnit> getWorkunits(SourceState state); static Map<SourceEntity, State> getTableSpecificPropsFromState(
          Iterable<SourceEntity> entities,
          SourceState state); @Override void shutdown(SourceState state); }
QueryBasedSource extends AbstractSource<S, D> { public static Map<SourceEntity, State> getTableSpecificPropsFromState( Iterable<SourceEntity> entities, SourceState state) { Map<String, SourceEntity> sourceEntityByName = new HashMap<>(); for (SourceEntity entity: entities) { sourceEntityByName.put(entity.getDatasetName(), entity); } Map<String, State> datasetProps = DatasetUtils.getDatasetSpecificProps(sourceEntityByName.keySet(), state); Map<SourceEntity, State> res = new HashMap<>(); for (Map.Entry<String, State> entry: datasetProps.entrySet()) { res.put(sourceEntityByName.get(entry.getKey()), entry.getValue()); } return res; }  @Override List<WorkUnit> getWorkunits(SourceState state); static Map<SourceEntity, State> getTableSpecificPropsFromState(
          Iterable<SourceEntity> entities,
          SourceState state); @Override void shutdown(SourceState state); static final String ENTITY_BLACKLIST; static final String ENTITY_WHITELIST; static final String SOURCE_OBTAIN_TABLE_PROPS_FROM_CONFIG_STORE; static final boolean DEFAULT_SOURCE_OBTAIN_TABLE_PROPS_FROM_CONFIG_STORE; static final String WORK_UNIT_STATE_VERSION_KEY; static final Integer CURRENT_WORK_UNIT_STATE_VERSION; }