use of org.apache.druid.metadata.storage.mysql.MySQLMetadataStorageModule in project druid by druid-io.
the class MySQLFirehoseDatabaseConnectorTest method testSerde.
@Test
public void testSerde() throws JsonProcessingException {
ObjectMapper mapper = new DefaultObjectMapper();
mapper.registerModules(new MySQLMetadataStorageModule().getJacksonModules());
mapper.setInjectableValues(new InjectableValues.Std().addValue(JdbcAccessSecurityConfig.class, INJECTED_CONF).addValue(MySQLConnectorDriverConfig.class, mySQLConnectorDriverConfig));
MetadataStorageConnectorConfig connectorConfig = new MetadataStorageConnectorConfig() {
@Override
public String getConnectURI() {
return "jdbc:mysql://localhost:3306/test";
}
};
MySQLFirehoseDatabaseConnector connector = new MySQLFirehoseDatabaseConnector(connectorConfig, null, INJECTED_CONF, mySQLConnectorDriverConfig);
MySQLFirehoseDatabaseConnector andBack = mapper.readValue(mapper.writeValueAsString(connector), MySQLFirehoseDatabaseConnector.class);
Assert.assertEquals(connector, andBack);
// test again with classname
connector = new MySQLFirehoseDatabaseConnector(connectorConfig, "some.class.name.Driver", INJECTED_CONF, mySQLConnectorDriverConfig);
andBack = mapper.readValue(mapper.writeValueAsString(connector), MySQLFirehoseDatabaseConnector.class);
Assert.assertEquals(connector, andBack);
}
Aggregations