use of org.graylog2.streams.StreamService in project graylog2-server by Graylog2.
the class V20161125161400_AlertReceiversMigrationTest method setUp.
@Before
public void setUp() throws Exception {
final MongoConnection mongoConnection = mock(MongoConnection.class);
final DB database = mock(DB.class);
when(mongoConnection.getDatabase()).thenReturn(database);
when(database.getCollection(eq("streams"))).thenReturn(dbCollection);
this.alertReceiversMigration = new V20161125161400_AlertReceiversMigration(clusterConfigService, streamService, alarmCallbackConfigurationService, mongoConnection);
}
use of org.graylog2.streams.StreamService in project graylog2-server by Graylog2.
the class V20161116172200_CreateDefaultStreamMigrationTest method upgrade.
@Test
public void upgrade() throws Exception {
final ArgumentCaptor<Stream> streamArgumentCaptor = ArgumentCaptor.forClass(Stream.class);
when(streamService.load("000000000000000000000001")).thenThrow(NotFoundException.class);
when(indexSetRegistry.getDefault()).thenReturn(indexSet);
migration.upgrade();
verify(streamService).save(streamArgumentCaptor.capture());
final Stream stream = streamArgumentCaptor.getValue();
assertThat(stream.getTitle()).isEqualTo("All messages");
assertThat(stream.getDisabled()).isFalse();
assertThat(stream.getMatchingType()).isEqualTo(StreamImpl.MatchingType.DEFAULT);
}
use of org.graylog2.streams.StreamService in project graylog2-server by Graylog2.
the class V20161122174500_AssignIndexSetsToStreamsMigrationTest method upgradeWhenAlreadyCompleted.
@Test
public void upgradeWhenAlreadyCompleted() throws Exception {
final IndexSetConfig indexSetConfig = mock(IndexSetConfig.class);
when(indexSetService.findAll()).thenReturn(Collections.singletonList(indexSetConfig));
when(indexSetConfig.id()).thenReturn("abc123");
when(clusterConfigService.get(V20161122174500_AssignIndexSetsToStreamsMigration.MigrationCompleted.class)).thenReturn(V20161122174500_AssignIndexSetsToStreamsMigration.MigrationCompleted.create("1", Collections.emptySet(), Collections.emptySet()));
migration.upgrade();
verify(streamService, never()).save(any(Stream.class));
verify(clusterConfigService, never()).write(any(V20161122174500_AssignIndexSetsToStreamsMigration.MigrationCompleted.class));
verify(clusterEventBus, never()).post(any(StreamsChangedEvent.class));
}
use of org.graylog2.streams.StreamService in project graylog2-server by Graylog2.
the class MongoIndexSetServiceTest method setUp.
@Before
public void setUp() throws Exception {
clusterEventBus = new ClusterEventBus();
clusterConfigService = new ClusterConfigServiceImpl(objectMapperProvider, mongoRule.getMongoConnection(), nodeId, new ChainingClassLoader(getClass().getClassLoader()), clusterEventBus);
indexSetService = new MongoIndexSetService(mongoRule.getMongoConnection(), objectMapperProvider, streamService, clusterConfigService, clusterEventBus);
}
Aggregations