SearchServiceImpl implements SearchService { @Override public Map<String, FieldType> getColumnMetadata(List<String> indices) throws RestException { try { if (indices == null || indices.isEmpty()) { indices = getDefaultIndices(); indices.add(METAALERT_TYPE); LOG.debug(String.format("No indices provided for getColumnMetadata. Using default indices: %s", String.join(",", indices))); } return dao.getColumnMetadata(indices); } catch(IOException ioe) { throw new RestException(ioe.getMessage(), ioe); } } @Autowired  SearchServiceImpl(IndexDao dao,
      Environment environment,
      SensorIndexingConfigService sensorIndexingConfigService,
      GlobalConfigService globalConfigService,
      AlertsUIService alertsUIService); @Override SearchResponse search(SearchRequest searchRequest); @Override GroupResponse group(GroupRequest groupRequest); @Override Optional<Map<String, Object>> getLatest(GetRequest request); @Override Map<String, FieldType> getColumnMetadata(List<String> indices); @SuppressWarnings("unchecked") List<String> getDefaultFacetFields();  }
@Test public void getColumnMetadataShouldProperlyGetDefaultIndices() throws Exception { when(environment.getProperty(INDEX_WRITER_NAME)).thenReturn("elasticsearch"); when(sensorIndexingConfigService.getAllIndices("elasticsearch")).thenReturn(Arrays.asList("bro", "snort", "error")); searchService.getColumnMetadata(new ArrayList<>()); verify(dao).getColumnMetadata(eq(Arrays.asList("bro", "snort", "metaalert"))); verifyNoMoreInteractions(dao); }