use of com.epam.ta.reportportal.core.events.widget.GenerateWidgetViewEvent in project service-api by reportportal.
the class CreatedMaterializedWidgetStateHandler method handleWidgetState.
@Override
public Map<String, Object> handleWidgetState(Widget widget, MultiValueMap<String, String> params) {
widgetRepository.save(new WidgetBuilder(widget).addOption(STATE, WidgetState.RENDERING.getValue()).get());
eventPublisher.publishEvent(new GenerateWidgetViewEvent(widget.getId(), params));
return emptyMap();
}
use of com.epam.ta.reportportal.core.events.widget.GenerateWidgetViewEvent in project service-api by reportportal.
the class ComponentHealthCheckTableEventHandlerTest method shouldGenerate.
@Test
void shouldGenerate() {
Widget widget = getWidget();
when(widgetRepository.findById(anyLong())).thenReturn(Optional.of(widget));
Map<Filter, Sort> filterSortMap = new HashMap<>();
Filter filter = Filter.builder().withTarget(Widget.class).withCondition(FilterCondition.builder().eq("id", "1").build()).build();
Sort sort = Sort.unsorted();
filterSortMap.put(filter, sort);
when(buildFilterStrategy.buildFilter(widget)).thenReturn(filterSortMap);
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.put(REFRESH, Collections.singletonList(Boolean.FALSE.toString()));
GenerateWidgetViewEvent event = new GenerateWidgetViewEvent(1L, params);
generateWidgetViewEventHandler.onApplicationEvent(event);
healthCheckTableExecutor.shutdown();
verify(healthCheckTableGenerator, times(1)).generate(anyBoolean(), anyString(), any(Widget.class), any(Filter.class), any(Sort.class), any(MultiValueMap.class));
}
Aggregations