Search in sources :

Example 16 with RotationStrategyConfig

use of org.graylog2.plugin.indexer.rotation.RotationStrategyConfig in project graylog2-server by Graylog2.

the class SizeBasedRotationStrategyConfigTest method testDeserialization.

@Test
public void testDeserialization() throws IOException {
    final ObjectMapper objectMapper = new ObjectMapperProvider().get();
    final String json = "{ \"type\": \"org.graylog2.indexer.rotation.strategies.SizeBasedRotationStrategyConfig\", \"max_size\": 1000 }";
    final RotationStrategyConfig config = objectMapper.readValue(json, RotationStrategyConfig.class);
    assertThat(config).isInstanceOf(SizeBasedRotationStrategyConfig.class);
    assertThat(((SizeBasedRotationStrategyConfig) config).maxSize()).isEqualTo(1000);
}
Also used : RotationStrategyConfig(org.graylog2.plugin.indexer.rotation.RotationStrategyConfig) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ObjectMapperProvider(org.graylog2.shared.bindings.providers.ObjectMapperProvider) Test(org.junit.Test)

Aggregations

RotationStrategyConfig (org.graylog2.plugin.indexer.rotation.RotationStrategyConfig)15 Test (org.junit.Test)13 IndexSetConfig (org.graylog2.indexer.indexset.IndexSetConfig)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 RetentionStrategyConfig (org.graylog2.plugin.indexer.retention.RetentionStrategyConfig)6 ObjectMapperProvider (org.graylog2.shared.bindings.providers.ObjectMapperProvider)6 DeletionRetentionStrategyConfig (org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig)5 MessageCountRotationStrategyConfig (org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategyConfig)5 RotationStrategy (org.graylog2.plugin.indexer.rotation.RotationStrategy)3 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)2 Timed (com.codahale.metrics.annotation.Timed)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 SchemaFactoryWrapper (com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper)1 ApiOperation (io.swagger.annotations.ApiOperation)1 GET (javax.ws.rs.GET)1 NotFoundException (javax.ws.rs.NotFoundException)1 Path (javax.ws.rs.Path)1 DefaultIndexSetConfig (org.graylog2.indexer.indexset.DefaultIndexSetConfig)1 IndexSetCreatedEvent (org.graylog2.indexer.indexset.events.IndexSetCreatedEvent)1 IndexManagementConfig (org.graylog2.indexer.management.IndexManagementConfig)1