IndexScanStrategy extends ScanStrategy { private DataContainer fetch(String tableAlias, IndexBooleanExpression condition, Map<String, String> tableAliases) { String tableName = tableAliases.get(tableAlias); Set<String> ids = getIdsFromIndex(tableName, tableAlias, condition); return fetchContainer(tableName, tableAlias, ids); }  @Override DataContainer process(DataSource dataSource, Map<String, String> tableAliases);  }
@Test public void testFetch() { IndexBooleanExpression expression = new IndexBooleanExpression( new HashMap<String, Set<Object>>() { { put(NAME, new LinkedHashSet<>(Arrays.asList("third", "fifth"))); put(PROJECT_ID, Collections.singleton("2")); } } ); DataSource dataSource = new DataSource(INSTANCES_ALIAS); dataSource.setCondition(expression); DataSourceStrategy strategy = getStrategy(); DataContainer result = strategy.process(dataSource, TWO_TABLE_ALIASES); assertThat(result.getColumnsMap(), equalTo(Collections.singletonMap(INSTANCES_ALIAS, INSTANCES_COLUMNS))); assertThat(result.getRows(), hasSize(2)); assertThat(result.getRows().get(0).getValues(), contains("3", "third", "2")); assertThat(result.getRows().get(1).getValues(), contains("5", "fifth", "2")); }