use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class V20161215163900_MoveIndexSetDefaultConfigTest method setUp.
@Before
public void setUp() throws Exception {
this.clusterConfigService = spy(new ClusterConfigServiceImpl(objectMapperProvider, mongodb.mongoConnection(), nodeId, new ChainingClassLoader(getClass().getClassLoader()), new ClusterEventBus()));
this.collection = mongodb.mongoConnection().getMongoDatabase().getCollection("index_sets");
this.migration = new V20161215163900_MoveIndexSetDefaultConfig(mongodb.mongoConnection(), clusterConfigService);
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class EncryptedValueTest method setUp.
@BeforeEach
void setUp(MongoDBTestService mongodb) {
encryptedValueService = new EncryptedValueService("1234567890abcdef");
this.objectMapper = new ObjectMapperProvider(ObjectMapperProvider.class.getClassLoader(), Collections.emptySet(), encryptedValueService, GRNRegistry.createWithBuiltinTypes()).get();
this.dbService = new TestService(mongodb.mongoConnection(), new MongoJackObjectMapperProvider(objectMapper));
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class DBProcessingStatusServiceTest method setUp.
@Before
public void setUp() throws Exception {
when(nodeId.toString()).thenReturn(NODE_ID);
final ObjectMapper objectMapper = new ObjectMapperProvider().get();
final MongoJackObjectMapperProvider mapperProvider = new MongoJackObjectMapperProvider(objectMapper);
clock = spy(new JobSchedulerTestClock(DateTime.parse("2019-01-01T00:00:00.000Z")));
updateThreshold = spy(Duration.minutes(1));
dbService = new DBProcessingStatusService(mongodb.mongoConnection(), nodeId, clock, updateThreshold, 1, mapperProvider, baseConfiguration);
db = JacksonDBCollection.wrap(mongodb.mongoConnection().getDatabase().getCollection(DBProcessingStatusService.COLLECTION_NAME), ProcessingStatusDto.class, ObjectId.class, mapperProvider.get());
}
use of org.graylog2.shared.bindings.providers.ObjectMapperProvider in project graylog2-server by Graylog2.
the class DeletionRetentionStrategyConfigTest method testDeserialization.
@Test
public void testDeserialization() throws IOException {
final ObjectMapper objectMapper = new ObjectMapperProvider().get();
final String json = "{ \"type\": \"org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig\", \"max_number_of_indices\": 23}";
final RetentionStrategyConfig config = objectMapper.readValue(json, RetentionStrategyConfig.class);
assertThat(config).isInstanceOf(DeletionRetentionStrategyConfig.class);
assertThat(((DeletionRetentionStrategyConfig) config).maxNumberOfIndices()).isEqualTo(23);
}
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\", \"max_rotation_period\": \"P99D\" }";
final RotationStrategyConfig config = objectMapper.readValue(json, RotationStrategyConfig.class);
assertThat(config).isInstanceOf(TimeBasedRotationStrategyConfig.class);
assertThat(((TimeBasedRotationStrategyConfig) config).rotationPeriod()).isEqualTo(Period.days(1));
assertThat(((TimeBasedRotationStrategyConfig) config).maxRotationPeriod()).isEqualTo(Period.days(99));
}
Aggregations