use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class MongoInputStatusServiceTest method setUp.
@Before
public void setUp() {
final ObjectMapper objectMapper = new ObjectMapperProvider().get();
final MongoJackObjectMapperProvider mapperProvider = new MongoJackObjectMapperProvider(objectMapper);
cut = new MongoInputStatusService(mongodb.mongoConnection(), mapperProvider, inputService, mockEventBus);
db = JacksonDBCollection.wrap(mongodb.mongoConnection().getDatabase().getCollection(MongoInputStatusService.COLLECTION_NAME), InputStatusRecord.class, ObjectId.class, mapperProvider.get());
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class OutputServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
final ObjectMapper objectMapper = new ObjectMapperProvider().get();
final MongoJackObjectMapperProvider mapperProvider = new MongoJackObjectMapperProvider(objectMapper);
outputService = new OutputServiceImpl(mongodb.mongoConnection(), mapperProvider, streamService, outputRegistry);
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class ContentPackResourceTest method setUp.
@Before
public void setUp() {
objectMapper = new ObjectMapperProvider().get();
objectMapper.setSubtypeResolver(new AutoValueSubtypeResolver());
contentPackResource = new PermittedTestResource(contentPackService, contentPackPersistenceService, contentPackInstallationPersistenceService);
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class ClosingRetentionStrategyConfigTest method testDeserialization.
@Test
public void testDeserialization() throws IOException {
final ObjectMapper objectMapper = new ObjectMapperProvider().get();
final String json = "{ \"type\": \"org.graylog2.indexer.retention.strategies.ClosingRetentionStrategyConfig\", \"max_number_of_indices\": 25}";
final RetentionStrategyConfig config = objectMapper.readValue(json, RetentionStrategyConfig.class);
assertThat(config).isInstanceOf(ClosingRetentionStrategyConfig.class);
assertThat(((ClosingRetentionStrategyConfig) config).maxNumberOfIndices()).isEqualTo(25);
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class ClosingRetentionStrategyConfigTest method testSerialization.
@Test
public void testSerialization() throws JsonProcessingException {
final ClosingRetentionStrategyConfig config = ClosingRetentionStrategyConfig.create(20);
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.retention.strategies.ClosingRetentionStrategyConfig");
assertThat((Integer) JsonPath.read(document, "$.max_number_of_indices")).isEqualTo(20);
}
Aggregations