use of me.retrodaredevil.solarthing.config.databases.implementations.InfluxDbDatabaseSettings in project solarthing by wildmountainfarms.
the class DeserializeTest method testInfluxDb1.
@Test
void testInfluxDb1() throws JsonProcessingException {
ObjectMapper mapper = JacksonUtil.defaultMapper();
String json = "{\n" + " \"type\": \"influxdb\",\n" + " \"config\": {\n" + " \"url\": \"http://localhost:8086\",\n" + " \"username\": \"root\",\n" + " \"password\": \"root\",\n" + " \"database\": \"default_database\",\n" + " \"measurement\": null,\n" + "\n" + " \"status_retention_policies\": [\n" + " {\n" + " \"frequency\": 120,\n" + " \"name\": \"autogen\"\n" + " }\n" + " ],\n" + "\n" + " \"event_retention_policy\": {\n" + " \"name\": \"autogen\"\n" + " }\n" + " }\n" + "}";
mapper.registerSubtypes(DatabaseSettings.class, InfluxDbDatabaseSettings.class);
DatabaseConfig config = mapper.readValue(json, DatabaseConfig.class);
assertTrue(config.getSettings() instanceof InfluxDbDatabaseSettings);
}
Aggregations