Search in sources :

Example 1 with SumAggregation

use of io.searchbox.core.search.aggregation.SumAggregation in project herd by FINRAOS.

the class ElasticSearchHelperTest method testGetNestedTagTagIndexSearchResponseDtoSearchResultParameter.

@Test
public void testGetNestedTagTagIndexSearchResponseDtoSearchResultParameter() {
    SearchResult searchResult = mock(SearchResult.class);
    MetricAggregation metricAggregation = mock(MetricAggregation.class);
    SumAggregation tagFacetAggregation = mock(SumAggregation.class);
    TermsAggregation tagTypeCodesAggregation = mock(TermsAggregation.class);
    when(searchResult.getAggregations()).thenReturn(metricAggregation);
    when(metricAggregation.getSumAggregation(TAG_FACET_AGGS)).thenReturn(tagFacetAggregation);
    when(tagFacetAggregation.getTermsAggregation(TAGTYPE_CODE_AGGREGATION)).thenReturn(tagTypeCodesAggregation);
    List<TagTypeIndexSearchResponseDto> result = elasticsearchHelper.getNestedTagTagIndexSearchResponseDto(searchResult);
    assertThat("Result is null.", result, is(notNullValue()));
}
Also used : TermsAggregation(io.searchbox.core.search.aggregation.TermsAggregation) MetricAggregation(io.searchbox.core.search.aggregation.MetricAggregation) SumAggregation(io.searchbox.core.search.aggregation.SumAggregation) TagTypeIndexSearchResponseDto(org.finra.herd.model.dto.TagTypeIndexSearchResponseDto) SearchResult(io.searchbox.core.SearchResult) Test(org.junit.Test) AbstractDaoTest(org.finra.herd.dao.AbstractDaoTest)

Aggregations

SearchResult (io.searchbox.core.SearchResult)1 MetricAggregation (io.searchbox.core.search.aggregation.MetricAggregation)1 SumAggregation (io.searchbox.core.search.aggregation.SumAggregation)1 TermsAggregation (io.searchbox.core.search.aggregation.TermsAggregation)1 AbstractDaoTest (org.finra.herd.dao.AbstractDaoTest)1 TagTypeIndexSearchResponseDto (org.finra.herd.model.dto.TagTypeIndexSearchResponseDto)1 Test (org.junit.Test)1