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 TimeBasedRotationStrategyConfigTest method testDeserialization.
@Test
public void testDeserialization() throws IOException {
final ObjectMapper objectMapper = new ObjectMapperProvider().get();
final String json = "{ \"type\": \"org.graylog2.indexer.rotation.strategies.TimeBasedRotationStrategyConfig\", \"rotation_period\": \"P1D\" }";
final RotationStrategyConfig config = objectMapper.readValue(json, RotationStrategyConfig.class);
assertThat(config).isInstanceOf(TimeBasedRotationStrategyConfig.class);
assertThat(((TimeBasedRotationStrategyConfig) config).rotationPeriod()).isEqualTo(Period.days(1));
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class HTTPAlarmCallbackTest method setUp.
@Before
public void setUp() throws Exception {
httpClient = new OkHttpClient();
objectMapper = new ObjectMapperProvider().get();
alarmCallback = new HTTPAlarmCallback(httpClient, objectMapper);
server = new MockWebServer();
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class BundleServiceTest method setUp.
@Before
public void setUp() throws Exception {
final ObjectMapper objectMapper = new ObjectMapperProvider().get();
bundleService = new BundleService(new MongoJackObjectMapperProvider(objectMapper), mongoRule.getMongoConnection(), bundleImporterProvider, bundleExporterProvider);
}
Aggregations