use of org.apache.druid.metadata.MetadataStorageConnectorConfig in project druid by druid-io.
the class ExportMetadata method getModules.
@Override
protected List<? extends Module> getModules() {
return ImmutableList.of(// See https://github.com/apache/druid/pull/4429#discussion_r123602930
new DruidProcessingModule(), new QueryableModule(), new QueryRunnerFactoryModule(), binder -> {
JsonConfigProvider.bindInstance(binder, Key.get(MetadataStorageConnectorConfig.class), new MetadataStorageConnectorConfig() {
@Override
public String getConnectURI() {
return connectURI;
}
@Override
public String getUser() {
return user;
}
@Override
public String getPassword() {
return password;
}
});
JsonConfigProvider.bindInstance(binder, Key.get(MetadataStorageTablesConfig.class), MetadataStorageTablesConfig.fromBase(base));
JsonConfigProvider.bindInstance(binder, Key.get(DruidNode.class, Self.class), new DruidNode("tools", "localhost", false, -1, null, true, false));
});
}
use of org.apache.druid.metadata.MetadataStorageConnectorConfig in project druid by druid-io.
the class SqlInputSourceTest method testSerde.
@Test
public void testSerde() throws IOException {
mapper.registerSubtypes(TestSerdeFirehoseConnector.class);
final SqlInputSourceTest.TestSerdeFirehoseConnector testSerdeFirehoseConnector = new SqlInputSourceTest.TestSerdeFirehoseConnector(new MetadataStorageConnectorConfig());
final SqlInputSource sqlInputSource = new SqlInputSource(SQLLIST1, true, testSerdeFirehoseConnector, mapper);
final String valueString = mapper.writeValueAsString(sqlInputSource);
final SqlInputSource inputSourceFromJson = mapper.readValue(valueString, SqlInputSource.class);
Assert.assertEquals(sqlInputSource, inputSourceFromJson);
}
use of org.apache.druid.metadata.MetadataStorageConnectorConfig in project druid by druid-io.
the class PostgresqlFirehoseDatabaseConnectorTest method testSuccessWhenAllowlistAndNoProperty.
@Test
public void testSuccessWhenAllowlistAndNoProperty() {
MetadataStorageConnectorConfig connectorConfig = new MetadataStorageConnectorConfig() {
@Override
public String getConnectURI() {
return "jdbc:postgresql://localhost:3306/test";
}
};
JdbcAccessSecurityConfig securityConfig = newSecurityConfigEnforcingAllowList(ImmutableSet.of("user"));
new PostgresqlFirehoseDatabaseConnector(connectorConfig, securityConfig);
}
use of org.apache.druid.metadata.MetadataStorageConnectorConfig in project druid by druid-io.
the class PostgresqlFirehoseDatabaseConnectorTest method testFailValidAndInvalidProperty.
@Test
public void testFailValidAndInvalidProperty() {
MetadataStorageConnectorConfig connectorConfig = new MetadataStorageConnectorConfig() {
@Override
public String getConnectURI() {
return "jdbc:postgresql://localhost:3306/test?user=maytas&password=secret&keyonly";
}
};
JdbcAccessSecurityConfig securityConfig = newSecurityConfigEnforcingAllowList(ImmutableSet.of("user", "nonenone"));
expectedException.expectMessage("is not in the allowed list");
expectedException.expect(IllegalArgumentException.class);
new PostgresqlFirehoseDatabaseConnector(connectorConfig, securityConfig);
}
use of org.apache.druid.metadata.MetadataStorageConnectorConfig in project druid by druid-io.
the class PostgresqlFirehoseDatabaseConnectorTest method testSuccessWhenNoPropertyInUriAndNoAllowlist.
@Test
public void testSuccessWhenNoPropertyInUriAndNoAllowlist() {
MetadataStorageConnectorConfig connectorConfig = new MetadataStorageConnectorConfig() {
@Override
public String getConnectURI() {
return "jdbc:postgresql://localhost:3306/test";
}
};
JdbcAccessSecurityConfig securityConfig = newSecurityConfigEnforcingAllowList(ImmutableSet.of());
new PostgresqlFirehoseDatabaseConnector(connectorConfig, securityConfig);
}
Aggregations