use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class PassingRateSummaryContentValidatorTest method testValidateWithException.
@Test
public void testValidateWithException() {
Exception exception = assertThrows(ReportPortalException.class, () -> passingRateSummaryContentValidator.validate(Collections.singletonList("test"), new HashMap<>(), new WidgetOptions(), 5));
String expectedMessage = "Filter-Sort mapping should not be empty";
String actualMessage = exception.getMessage();
assertTrue(actualMessage.contains(expectedMessage));
}
use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class LineChartContentLoader method loadContent.
@Override
public Map<String, ?> loadContent(List<String> contentFields, Map<Filter, Sort> filterSortMapping, WidgetOptions widgetOptions, int limit) {
Filter filter = GROUP_FILTERS.apply(filterSortMapping.keySet());
Sort sort = GROUP_SORTS.apply(filterSortMapping.values());
List<ChartStatisticsContent> content = widgetContentRepository.launchStatistics(filter, contentFields, sort, limit);
String timeLineOption = ofNullable(widgetOptions).map(wo -> WidgetOptionUtil.getValueByKey(TIMELINE, wo)).orElse(Strings.EMPTY);
if (StringUtils.isNotBlank(timeLineOption)) {
Optional<Period> period = Period.findByName(timeLineOption);
if (period.isPresent()) {
return CollectionUtils.isEmpty(content) ? emptyMap() : singletonMap(RESULT, groupByDate(content, period.get()));
}
}
return CollectionUtils.isEmpty(content) ? emptyMap() : singletonMap(RESULT, content);
}
use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class MostTimeConsumingContentLoader method buildItemFilter.
private Filter buildItemFilter(Long launchId, WidgetOptions widgetOptions, List<String> contentFields) {
Filter filter = Filter.builder().withTarget(TestItem.class).withCondition(FilterCondition.builder().eq(CRITERIA_LAUNCH_ID, String.valueOf(launchId)).build()).build();
filter = updateFilterWithStatuses(filter, contentFields);
filter = updateFilterWithTestItemTypes(filter, ofNullable(widgetOptions.getOptions().get(INCLUDE_METHODS)).map(v -> BooleanUtils.toBoolean(String.valueOf(v))).orElse(false));
return filter.withCondition(FilterCondition.builder().eq(CRITERIA_HAS_CHILDREN, Boolean.FALSE.toString()).build()).withCondition(FilterCondition.builder().eq(CRITERIA_HAS_STATS, Boolean.TRUE.toString()).build());
}
use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class MostTimeConsumingContentLoader method loadContent.
@Override
public Map<String, ?> loadContent(List<String> contentFields, Map<Filter, Sort> filterSortMap, WidgetOptions widgetOptions, int limit) {
Filter filter = GROUP_FILTERS.apply(filterSortMap.keySet());
String launchName = WidgetOptionUtil.getValueByKey(LAUNCH_NAME_FIELD, widgetOptions);
return launchRepository.findLatestByFilter(filter.withCondition(FilterCondition.builder().eq(CRITERIA_NAME, launchName).build())).map(l -> loadContent(l, widgetOptions, contentFields)).orElseGet(Collections::emptyMap);
}
use of com.epam.ta.reportportal.entity.widget.WidgetOptions in project service-api by reportportal.
the class FlakyCasesTableContentLoader method loadContent.
@Override
public Map<String, ?> loadContent(List<String> contentFields, Map<Filter, Sort> filterSortMapping, WidgetOptions widgetOptions, int limit) {
Filter filter = GROUP_FILTERS.apply(filterSortMapping.keySet());
String launchName = WidgetOptionUtil.getValueByKey(LAUNCH_NAME_FIELD, widgetOptions);
filter.withCondition(new FilterCondition(Condition.EQUALS, false, launchName, CRITERIA_NAME));
return launchRepository.findLatestByFilter(filter).map(l -> loadContent(l, filter, widgetOptions, limit)).orElseGet(Collections::emptyMap);
}
Aggregations