use of org.apache.druid.server.initialization.JdbcAccessSecurityConfig 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.server.initialization.JdbcAccessSecurityConfig 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.server.initialization.JdbcAccessSecurityConfig 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);
}
use of org.apache.druid.server.initialization.JdbcAccessSecurityConfig in project druid by druid-io.
the class JdbcExtractionNamespaceTest method ensureEntry.
private CacheScheduler.Entry ensureEntry() throws InterruptedException {
final JdbcExtractionNamespace extractionNamespace = new JdbcExtractionNamespace(derbyConnectorRule.getMetadataConnectorConfig(), TABLE_NAME, KEY_NAME, VAL_NAME, tsColumn, null, new Period(10), null, new JdbcAccessSecurityConfig());
CacheScheduler.Entry entry = scheduler.schedule(extractionNamespace);
waitForUpdates(1_000L, 2L);
Assert.assertEquals("sanity check not correct", "bar", entry.getCache().get("foo"));
return entry;
}
use of org.apache.druid.server.initialization.JdbcAccessSecurityConfig in project druid by druid-io.
the class JdbcExtractionNamespaceTest method testSerde.
@Test
public void testSerde() throws IOException {
final JdbcAccessSecurityConfig securityConfig = new JdbcAccessSecurityConfig();
final JdbcExtractionNamespace extractionNamespace = new JdbcExtractionNamespace(derbyConnectorRule.getMetadataConnectorConfig(), TABLE_NAME, KEY_NAME, VAL_NAME, tsColumn, "some filter", new Period(10), null, securityConfig);
final ObjectMapper mapper = new DefaultObjectMapper();
mapper.setInjectableValues(new Std().addValue(JdbcAccessSecurityConfig.class, securityConfig));
final ExtractionNamespace extractionNamespace2 = mapper.readValue(mapper.writeValueAsBytes(extractionNamespace), ExtractionNamespace.class);
Assert.assertEquals(extractionNamespace, extractionNamespace2);
}
Aggregations