use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class MessageCountRotationStrategyConfigTest method testDeserialization.
@Test
public void testDeserialization() throws IOException {
final ObjectMapper objectMapper = new ObjectMapperProvider().get();
final String json = "{ \"type\": \"org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategyConfig\", \"max_docs_per_index\": 1000 }";
final RotationStrategyConfig config = objectMapper.readValue(json, RotationStrategyConfig.class);
assertThat(config).isInstanceOf(MessageCountRotationStrategyConfig.class);
assertThat(((MessageCountRotationStrategyConfig) config).maxDocsPerIndex()).isEqualTo(1000);
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class MessageCountRotationStrategyConfigTest method testSerialization.
@Test
public void testSerialization() throws JsonProcessingException {
final RotationStrategyConfig config = MessageCountRotationStrategyConfig.create(1000);
final ObjectMapper objectMapper = new ObjectMapperProvider().get();
final String json = objectMapper.writeValueAsString(config);
final Object document = Configuration.defaultConfiguration().jsonProvider().parse(json);
assertThat((String) JsonPath.read(document, "$.type")).isEqualTo("org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategyConfig");
assertThat((Integer) JsonPath.read(document, "$.max_docs_per_index")).isEqualTo(1000);
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class EntityTest method setUp.
@Before
public void setUp() throws Exception {
objectMapper = new ObjectMapperProvider().get();
objectMapper.setSubtypeResolver(new AutoValueSubtypeResolver());
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class PaginatedDbServiceTest method setUp.
@Before
public void setUp() throws Exception {
final MongoJackObjectMapperProvider objectMapperProvider = new MongoJackObjectMapperProvider(new ObjectMapper());
this.dbService = new TestDbService(mongodb.mongoConnection(), objectMapperProvider);
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class MongoFieldTypeLookupTest method setUp.
@Before
public void setUp() throws Exception {
final MongoJackObjectMapperProvider objectMapperProvider = new MongoJackObjectMapperProvider(new ObjectMapper());
final StreamService streamService = mock(StreamService.class);
this.dbService = new IndexFieldTypesService(mongodb.mongoConnection(), streamService, objectMapperProvider);
this.lookup = new MongoFieldTypeLookup(dbService, new FieldTypeMapper());
}
Aggregations