Search in sources :

Example 1 with MetadataStorageConnectorConfig

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));
    });
}
Also used : MetadataStorageTablesConfig(org.apache.druid.metadata.MetadataStorageTablesConfig) MetadataStorageConnectorConfig(org.apache.druid.metadata.MetadataStorageConnectorConfig) QueryableModule(org.apache.druid.guice.QueryableModule) DruidProcessingModule(org.apache.druid.guice.DruidProcessingModule) QueryRunnerFactoryModule(org.apache.druid.guice.QueryRunnerFactoryModule) DruidNode(org.apache.druid.server.DruidNode) Self(org.apache.druid.guice.annotations.Self)

Example 2 with MetadataStorageConnectorConfig

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);
}
Also used : MetadataStorageConnectorConfig(org.apache.druid.metadata.MetadataStorageConnectorConfig) Test(org.junit.Test)

Example 3 with MetadataStorageConnectorConfig

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);
}
Also used : MetadataStorageConnectorConfig(org.apache.druid.metadata.MetadataStorageConnectorConfig) JdbcAccessSecurityConfig(org.apache.druid.server.initialization.JdbcAccessSecurityConfig) Test(org.junit.Test)

Example 4 with MetadataStorageConnectorConfig

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);
}
Also used : MetadataStorageConnectorConfig(org.apache.druid.metadata.MetadataStorageConnectorConfig) JdbcAccessSecurityConfig(org.apache.druid.server.initialization.JdbcAccessSecurityConfig) Test(org.junit.Test)

Example 5 with MetadataStorageConnectorConfig

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);
}
Also used : MetadataStorageConnectorConfig(org.apache.druid.metadata.MetadataStorageConnectorConfig) JdbcAccessSecurityConfig(org.apache.druid.server.initialization.JdbcAccessSecurityConfig) Test(org.junit.Test)

Aggregations

MetadataStorageConnectorConfig (org.apache.druid.metadata.MetadataStorageConnectorConfig)26 Test (org.junit.Test)21 JdbcAccessSecurityConfig (org.apache.druid.server.initialization.JdbcAccessSecurityConfig)17 MetadataStorageTablesConfig (org.apache.druid.metadata.MetadataStorageTablesConfig)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 DruidProcessingModule (org.apache.druid.guice.DruidProcessingModule)2 QueryRunnerFactoryModule (org.apache.druid.guice.QueryRunnerFactoryModule)2 QueryableModule (org.apache.druid.guice.QueryableModule)2 Self (org.apache.druid.guice.annotations.Self)2 MetadataStorageUpdaterJobSpec (org.apache.druid.indexer.updater.MetadataStorageUpdaterJobSpec)2 IndexerSQLMetadataStorageCoordinator (org.apache.druid.metadata.IndexerSQLMetadataStorageCoordinator)2 DruidNode (org.apache.druid.server.DruidNode)2 InjectableValues (com.fasterxml.jackson.databind.InjectableValues)1 TypeLiteral (com.google.inject.TypeLiteral)1 TestUtils (org.apache.druid.indexing.common.TestUtils)1 TaskStorageConfig (org.apache.druid.indexing.common.config.TaskStorageConfig)1 HeapMemoryTaskStorage (org.apache.druid.indexing.overlord.HeapMemoryTaskStorage)1 TaskLockbox (org.apache.druid.indexing.overlord.TaskLockbox)1 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)1 SegmentsMetadataManagerConfig (org.apache.druid.metadata.SegmentsMetadataManagerConfig)1