use of org.graylog2.indexer.indexset.IndexSetService in project graylog2-server by Graylog2.
the class IndexSetsResourceTest method updateFailsWhenDefaultSetIsSetReadOnly.
@Test
public void updateFailsWhenDefaultSetIsSetReadOnly() throws Exception {
final String defaultIndexSetId = "defaultIndexSet";
final IndexSetConfig defaultIndexSetConfig = IndexSetConfig.create(defaultIndexSetId, "title", "description", true, "prefix", 1, 0, MessageCountRotationStrategy.class.getCanonicalName(), MessageCountRotationStrategyConfig.create(1000), NoopRetentionStrategy.class.getCanonicalName(), NoopRetentionStrategyConfig.create(1), ZonedDateTime.of(2016, 10, 10, 12, 0, 0, 0, ZoneOffset.UTC), "standard", "index-template", 1, false);
when(indexSetService.getDefault()).thenReturn(defaultIndexSetConfig);
when(indexSetService.get(defaultIndexSetId)).thenReturn(Optional.of(defaultIndexSetConfig));
final IndexSetConfig defaultIndexSetConfigSetReadOnly = defaultIndexSetConfig.toBuilder().isWritable(false).build();
expectedException.expect(ClientErrorException.class);
expectedException.expectMessage("Default index set must be writable.");
try {
indexSetsResource.update("defaultIndexSet", IndexSetUpdateRequest.fromIndexSetConfig(defaultIndexSetConfigSetReadOnly));
} finally {
verify(indexSetService, never()).save(any());
}
}
Aggregations