Search in sources :

Example 1 with MockConnectorFactory

use of com.facebook.presto.connector.MockConnectorFactory in project presto by prestodb.

the class TestMetadataManager method setUp.

@BeforeClass
public void setUp() throws Exception {
    queryRunner = TpchQueryRunnerBuilder.builder().build();
    queryRunner.installPlugin(new Plugin() {

        @Override
        public Iterable<ConnectorFactory> getConnectorFactories() {
            MockConnectorFactory connectorFactory = MockConnectorFactory.builder().withListSchemaNames(session -> ImmutableList.of("UPPER_CASE_SCHEMA")).withListTables((session, schemaNameOrNull) -> {
                throw new UnsupportedOperationException();
            }).withGetViews((session, prefix) -> ImmutableMap.of()).withGetColumnHandles((session, tableHandle) -> {
                throw new UnsupportedOperationException();
            }).withGetTableStatistics(() -> {
                throw new UnsupportedOperationException();
            }).build();
            return ImmutableList.of(connectorFactory);
        }
    });
    queryRunner.createCatalog("upper_case_schema_catalog", "mock");
    metadataManager = (MetadataManager) queryRunner.getMetadata();
}
Also used : MockConnectorFactory(com.facebook.presto.connector.MockConnectorFactory) MetadataManager(com.facebook.presto.metadata.MetadataManager) TableStatistics(com.facebook.presto.spi.statistics.TableStatistics) Assert.assertEquals(org.testng.Assert.assertEquals) ConnectorTableHandle(com.facebook.presto.spi.ConnectorTableHandle) Test(org.testng.annotations.Test) TEST_SESSION(com.facebook.presto.SessionTestUtils.TEST_SESSION) ImmutableList(com.google.common.collect.ImmutableList) IGNORE_STATS_CALCULATOR_FAILURES(com.facebook.presto.SystemSessionProperties.IGNORE_STATS_CALCULATOR_FAILURES) FAILED(com.facebook.presto.execution.QueryState.FAILED) TableHandle(com.facebook.presto.spi.TableHandle) BasicQueryInfo(com.facebook.presto.server.BasicQueryInfo) TpchQueryRunnerBuilder(com.facebook.presto.tests.tpch.TpchQueryRunnerBuilder) TransactionBuilder(com.facebook.presto.transaction.TransactionBuilder) AfterClass(org.testng.annotations.AfterClass) RUNNING(com.facebook.presto.execution.QueryState.RUNNING) ImmutableMap(com.google.common.collect.ImmutableMap) Language(org.intellij.lang.annotations.Language) Session(com.facebook.presto.Session) TestingSessionContext(com.facebook.presto.execution.TestingSessionContext) BeforeClass(org.testng.annotations.BeforeClass) Assert.fail(org.testng.Assert.fail) Constraint.alwaysTrue(com.facebook.presto.spi.Constraint.alwaysTrue) DispatchManager(com.facebook.presto.dispatcher.DispatchManager) TestingTransactionHandle(com.facebook.presto.testing.TestingTransactionHandle) TestingSession.testSessionBuilder(com.facebook.presto.testing.TestingSession.testSessionBuilder) ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) Plugin(com.facebook.presto.spi.Plugin) List(java.util.List) QueryId(com.facebook.presto.spi.QueryId) Optional(java.util.Optional) ConnectorId(com.facebook.presto.spi.ConnectorId) MockConnectorFactory(com.facebook.presto.connector.MockConnectorFactory) Plugin(com.facebook.presto.spi.Plugin) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

Session (com.facebook.presto.Session)1 TEST_SESSION (com.facebook.presto.SessionTestUtils.TEST_SESSION)1 IGNORE_STATS_CALCULATOR_FAILURES (com.facebook.presto.SystemSessionProperties.IGNORE_STATS_CALCULATOR_FAILURES)1 MockConnectorFactory (com.facebook.presto.connector.MockConnectorFactory)1 DispatchManager (com.facebook.presto.dispatcher.DispatchManager)1 FAILED (com.facebook.presto.execution.QueryState.FAILED)1 RUNNING (com.facebook.presto.execution.QueryState.RUNNING)1 TestingSessionContext (com.facebook.presto.execution.TestingSessionContext)1 MetadataManager (com.facebook.presto.metadata.MetadataManager)1 BasicQueryInfo (com.facebook.presto.server.BasicQueryInfo)1 ConnectorId (com.facebook.presto.spi.ConnectorId)1 ConnectorTableHandle (com.facebook.presto.spi.ConnectorTableHandle)1 Constraint.alwaysTrue (com.facebook.presto.spi.Constraint.alwaysTrue)1 Plugin (com.facebook.presto.spi.Plugin)1 QueryId (com.facebook.presto.spi.QueryId)1 TableHandle (com.facebook.presto.spi.TableHandle)1 ConnectorFactory (com.facebook.presto.spi.connector.ConnectorFactory)1 TableStatistics (com.facebook.presto.spi.statistics.TableStatistics)1 TestingSession.testSessionBuilder (com.facebook.presto.testing.TestingSession.testSessionBuilder)1 TestingTransactionHandle (com.facebook.presto.testing.TestingTransactionHandle)1