Search in sources :

Example 11 with MockConnectorPlugin

use of io.trino.connector.MockConnectorPlugin in project trino by trinodb.

the class TestProcedureCall method setUp.

@BeforeClass
public void setUp() {
    DistributedQueryRunner queryRunner = getDistributedQueryRunner();
    tester = queryRunner.getCoordinator().getProcedureTester();
    session = testSessionBuilder().setCatalog(TESTING_CATALOG).setSchema(PROCEDURE_SCHEMA).build();
    queryRunner.installPlugin(new MockConnectorPlugin(MockConnectorFactory.builder().withProcedures(new TestingProcedures(tester).getProcedures(PROCEDURE_SCHEMA)).build()));
    queryRunner.createCatalog(TESTING_CATALOG, "mock");
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) TestingProcedures(io.trino.testing.TestingProcedures) MockConnectorPlugin(io.trino.connector.MockConnectorPlugin) BeforeClass(org.testng.annotations.BeforeClass)

Example 12 with MockConnectorPlugin

use of io.trino.connector.MockConnectorPlugin in project trino by trinodb.

the class TestDistributedEngineOnlyQueries method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() throws Exception {
    DistributedQueryRunner queryRunner = createMemoryQueryRunner(ImmutableMap.of(), TpchTable.getTables());
    queryRunner.getCoordinator().getSessionPropertyManager().addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
    try {
        queryRunner.installPlugin(new MockConnectorPlugin(MockConnectorFactory.builder().withSessionProperties(TEST_CATALOG_PROPERTIES).build()));
        queryRunner.createCatalog(TESTING_CATALOG, "mock");
    } catch (RuntimeException e) {
        throw closeAllSuppress(e, queryRunner);
    }
    return queryRunner;
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) MockConnectorPlugin(io.trino.connector.MockConnectorPlugin)

Example 13 with MockConnectorPlugin

use of io.trino.connector.MockConnectorPlugin in project trino by trinodb.

the class TestDistributedFaultTolerantEngineOnlyQueries method createQueryRunner.

@Override
protected QueryRunner createQueryRunner() throws Exception {
    ImmutableMap<String, String> exchangeManagerProperties = ImmutableMap.<String, String>builder().put("exchange.base-directory", System.getProperty("java.io.tmpdir") + "/trino-local-file-system-exchange-manager").buildOrThrow();
    DistributedQueryRunner queryRunner = MemoryQueryRunner.builder().setExtraProperties(FaultTolerantExecutionConnectorTestHelper.getExtraProperties()).setAdditionalSetup(runner -> {
        runner.installPlugin(new FileSystemExchangePlugin());
        runner.loadExchangeManager("filesystem", exchangeManagerProperties);
    }).setInitialTables(TpchTable.getTables()).build();
    queryRunner.getCoordinator().getSessionPropertyManager().addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
    try {
        queryRunner.installPlugin(new MockConnectorPlugin(MockConnectorFactory.builder().withSessionProperties(TEST_CATALOG_PROPERTIES).build()));
        queryRunner.createCatalog(TESTING_CATALOG, "mock");
    } catch (RuntimeException e) {
        throw closeAllSuppress(e, queryRunner);
    }
    return queryRunner;
}
Also used : DistributedQueryRunner(io.trino.testing.DistributedQueryRunner) FileSystemExchangePlugin(io.trino.plugin.exchange.FileSystemExchangePlugin) MockConnectorPlugin(io.trino.connector.MockConnectorPlugin)

Aggregations

MockConnectorPlugin (io.trino.connector.MockConnectorPlugin)13 DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)12 MockConnectorFactory (io.trino.connector.MockConnectorFactory)9 ImmutableList (com.google.common.collect.ImmutableList)8 Session (io.trino.Session)8 SchemaTableName (io.trino.spi.connector.SchemaTableName)8 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)8 Assertions.assertThatThrownBy (org.assertj.core.api.Assertions.assertThatThrownBy)8 BeforeClass (org.testng.annotations.BeforeClass)8 Test (org.testng.annotations.Test)8 TrinoPrincipal (io.trino.spi.security.TrinoPrincipal)7 MockConnectorTableHandle (io.trino.connector.MockConnectorTableHandle)6 MutableGrants (io.trino.connector.MutableGrants)6 Identity (io.trino.spi.security.Identity)6 USER (io.trino.spi.security.PrincipalType.USER)6 Privilege (io.trino.spi.security.Privilege)6 QueryAssertions (io.trino.sql.query.QueryAssertions)6 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)6 AfterClass (org.testng.annotations.AfterClass)6 ImmutableSet (com.google.common.collect.ImmutableSet)5