Search in sources :

Example 1 with WidgetUpdatedEvent

use of org.graylog2.dashboards.widgets.events.WidgetUpdatedEvent in project graylog2-server by Graylog2.

the class WidgetEventsListenerTest method invalidateWidgetResultCacheForWidgetUpdatedMustInvalidateWidgetResultCacheForWidgetId.

@Test
public void invalidateWidgetResultCacheForWidgetUpdatedMustInvalidateWidgetResultCacheForWidgetId() throws Exception {
    final String widgetId = "mockedId";
    final WidgetUpdatedEvent widgetUpdatedEvent = WidgetUpdatedEvent.create(widgetId);
    widgetEventsListener.invalidateWidgetResultCacheForWidgetUpdated(widgetUpdatedEvent);
    final ArgumentCaptor<String> widgetIdCaptor = ArgumentCaptor.forClass(String.class);
    verify(widgetResultCache).invalidate(widgetIdCaptor.capture());
    assertThat(widgetIdCaptor.getValue()).isEqualTo(widgetId);
}
Also used : WidgetUpdatedEvent(org.graylog2.dashboards.widgets.events.WidgetUpdatedEvent) Test(org.junit.Test)

Example 2 with WidgetUpdatedEvent

use of org.graylog2.dashboards.widgets.events.WidgetUpdatedEvent in project graylog2-server by Graylog2.

the class DashboardWidgetsResourceTest method verifyWidgetUpdatedEvent.

private void verifyWidgetUpdatedEvent(String widgetId) {
    final ArgumentCaptor<WidgetUpdatedEvent> widgetUpdatedEventCaptor = ArgumentCaptor.forClass(WidgetUpdatedEvent.class);
    verify(clusterEventBus).post(widgetUpdatedEventCaptor.capture());
    final WidgetUpdatedEvent capturedEvent = widgetUpdatedEventCaptor.getValue();
    assert (capturedEvent.widgetId()).equals(widgetId);
}
Also used : WidgetUpdatedEvent(org.graylog2.dashboards.widgets.events.WidgetUpdatedEvent)

Aggregations

WidgetUpdatedEvent (org.graylog2.dashboards.widgets.events.WidgetUpdatedEvent)2 Test (org.junit.Test)1