@Test public void testGetFilteredSourceEntities() { { SourceState state = new SourceState(); state.setProp(QueryBasedSource.ENTITY_BLACKLIST, "Table1,BadTable.*"); state.setProp(ConfigurationKeys.SOURCE_ENTITIES, "Table1,Table2,BadTable1,Table3"); state.setProp(ConfigurationKeys.EXTRACT_TABLE_NAME_KEY, "PropShouldBeIgnored"); Set<SourceEntity> res = getFilteredEntities(state); Assert.assertEquals(res.size(), 2); Assert.assertTrue(res.contains(SourceEntity.fromSourceEntityName("Table2")), "Missing Table2 in " + res); Assert.assertTrue(res.contains(SourceEntity.fromSourceEntityName("Table3")), "Missing Table3 in " + res); } { SourceState state = new SourceState(); state.setProp(QueryBasedSource.ENTITY_BLACKLIST, "Table1,BadTable.*"); state.setProp(QueryBasedSource.ENTITY_WHITELIST, "Table3"); state.setProp(ConfigurationKeys.SOURCE_ENTITIES, "Table1,Table2,BadTable1,Table3"); state.setProp(ConfigurationKeys.EXTRACT_TABLE_NAME_KEY, "PropShouldBeIgnored"); Set<SourceEntity> res = getFilteredEntities(state); Assert.assertEquals(res.size(), 1); Assert.assertTrue(res.contains(SourceEntity.fromSourceEntityName("Table3")), "Missing Table3 in " + res); } { SourceState state = new SourceState(); state.setProp(QueryBasedSource.ENTITY_BLACKLIST, "Table1,BadTable.*"); state.setProp(QueryBasedSource.ENTITY_WHITELIST, "Table3"); state.setProp(ConfigurationKeys.SOURCE_ENTITY, "Table3"); state.setProp(ConfigurationKeys.EXTRACT_TABLE_NAME_KEY, "PropShouldNotBeIgnored"); Set<SourceEntity> res = getFilteredEntities(state); SourceEntity expected = new SourceEntity("Table3", "PropShouldNotBeIgnored"); Assert.assertEquals(res.size(), 1); Assert.assertTrue(res.contains(expected), "Missing Table3 in " + res); } { SourceState state = new SourceState(); state.setProp(QueryBasedSource.ENTITY_BLACKLIST, "Table1,BadTable.*"); state.setProp(QueryBasedSource.ENTITY_WHITELIST, "Table5"); state.setProp(ConfigurationKeys.SOURCE_ENTITY, "Table3"); state.setProp(ConfigurationKeys.EXTRACT_TABLE_NAME_KEY, "PropShouldNotBeIgnored"); Set<SourceEntity> res = getFilteredEntities(state); Assert.assertEquals(res.size(), 0); } }
protected Set<SourceEntity> getFilteredSourceEntities(SourceState state) { Set<SourceEntity> unfilteredEntities = getSourceEntities(state); return getFilteredSourceEntitiesHelper(state, unfilteredEntities); }
QueryBasedSource extends AbstractSource<S, D> { protected Set<SourceEntity> getFilteredSourceEntities(SourceState state) { Set<SourceEntity> unfilteredEntities = getSourceEntities(state); return getFilteredSourceEntitiesHelper(state, unfilteredEntities); } }
QueryBasedSource extends AbstractSource<S, D> { protected Set<SourceEntity> getFilteredSourceEntities(SourceState state) { Set<SourceEntity> unfilteredEntities = getSourceEntities(state); return getFilteredSourceEntitiesHelper(state, unfilteredEntities); }  }
QueryBasedSource extends AbstractSource<S, D> { protected Set<SourceEntity> getFilteredSourceEntities(SourceState state) { Set<SourceEntity> unfilteredEntities = getSourceEntities(state); return getFilteredSourceEntitiesHelper(state, unfilteredEntities); }  @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> { protected Set<SourceEntity> getFilteredSourceEntities(SourceState state) { Set<SourceEntity> unfilteredEntities = getSourceEntities(state); return getFilteredSourceEntitiesHelper(state, unfilteredEntities); }  @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; }