use of org.graylog2.events.ClusterEventBus in project graylog2-server by Graylog2.
the class ClusterEventPeriodicalTest method publishClusterEventHandlesAutoValueCorrectly.
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void publishClusterEventHandlesAutoValueCorrectly() throws Exception {
DBCollection collection = mongoConnection.getDatabase().getCollection(ClusterEventPeriodical.COLLECTION_NAME);
DebugEvent event = DebugEvent.create("Node ID", "Test");
assertThat(collection.count()).isEqualTo(0L);
clusterEventPeriodical.publishClusterEvent(event);
verify(clusterEventBus, never()).post(any());
assertThat(collection.count()).isEqualTo(1L);
DBObject dbObject = collection.findOne();
assertThat((String) dbObject.get("producer")).isEqualTo(nodeId.toString());
assertThat((String) dbObject.get("event_class")).isEqualTo(DebugEvent.class.getCanonicalName());
}
use of org.graylog2.events.ClusterEventBus in project graylog2-server by Graylog2.
the class ClusterEventPeriodicalTest method setUpService.
@Before
public void setUpService() throws Exception {
DateTimeUtils.setCurrentMillisFixed(TIME.getMillis());
this.mongoConnection = mongoRule.getMongoConnection();
MongoJackObjectMapperProvider provider = new MongoJackObjectMapperProvider(objectMapper);
when(nodeId.toString()).thenReturn("ID");
this.clusterEventPeriodical = new ClusterEventPeriodical(provider, mongoRule.getMongoConnection(), nodeId, new ChainingClassLoader(getClass().getClassLoader()), serverEventBus, clusterEventBus);
}
use of org.graylog2.events.ClusterEventBus in project graylog2-server by Graylog2.
the class ClusterConfigServiceImplTest method setUpService.
@Before
public void setUpService() throws Exception {
DateTimeUtils.setCurrentMillisFixed(TIME.getMillis());
this.mongoConnection = mongoRule.getMongoConnection();
MongoJackObjectMapperProvider provider = new MongoJackObjectMapperProvider(objectMapper);
when(nodeId.toString()).thenReturn("ID");
this.clusterConfigService = new ClusterConfigServiceImpl(provider, mongoRule.getMongoConnection(), nodeId, new ChainingClassLoader(getClass().getClassLoader()), clusterEventBus);
}
use of org.graylog2.events.ClusterEventBus 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);
}
use of org.graylog2.events.ClusterEventBus in project graylog2-server by Graylog2.
the class GrokResourceTest method setUp.
@Before
public void setUp() {
final ClusterEventBus clusterBus = new ClusterEventBus();
subscriber = new GrokPatternsChangedEventSubscriber();
clusterBus.registerClusterEventSubscriber(subscriber);
grokResource = new PermittedTestResource(grokPatternService, clusterBus);
}
Aggregations