Search in sources :

Example 46 with TestingConnectorContext

use of io.trino.testing.TestingConnectorContext in project trino by trinodb.

the class TestHivePlugin method testGlueMetastore.

@Test
public void testGlueMetastore() {
    ConnectorFactory factory = getHiveConnectorFactory();
    factory.create("test", ImmutableMap.of("hive.metastore", "glue", "hive.metastore.glue.region", "us-east-2"), new TestingConnectorContext()).shutdown();
    assertThatThrownBy(() -> factory.create("test", ImmutableMap.of("hive.metastore", "glue", "hive.metastore.uri", "thrift://foo:1234"), new TestingConnectorContext())).hasMessageContaining("Error: Configuration property 'hive.metastore.uri' was not used");
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 47 with TestingConnectorContext

use of io.trino.testing.TestingConnectorContext in project trino by trinodb.

the class TestHivePlugin method testS3SecurityMappingAndHiveCachingMutuallyExclusive.

@Test
public void testS3SecurityMappingAndHiveCachingMutuallyExclusive() throws IOException {
    Path mappingConfig = Files.createTempFile(null, null);
    ConnectorFactory connectorFactory = getHiveConnectorFactory();
    assertThatThrownBy(() -> connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.s3.security-mapping.config-file", mappingConfig.toString()).put("hive.cache.enabled", "true").put("hive.metastore.uri", "thrift://foo:1234").put("hive.cache.location", tempDirectory.toString()).buildOrThrow(), new TestingConnectorContext())).hasMessageContaining("S3 security mapping is not compatible with Hive caching");
}
Also used : Path(java.nio.file.Path) ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 48 with TestingConnectorContext

use of io.trino.testing.TestingConnectorContext in project trino by trinodb.

the class TestHivePlugin method testCreateConnectorLegacyName.

@Test
public void testCreateConnectorLegacyName() {
    Plugin plugin = new HivePlugin();
    ConnectorFactory factory = stream(plugin.getConnectorFactories()).filter(x -> x.getName().equals("hive-hadoop2")).collect(toOptional()).orElseThrow();
    // simplest possible configuration
    factory.create("test", ImmutableMap.of("hive.metastore.uri", "thrift://foo:1234"), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Example 49 with TestingConnectorContext

use of io.trino.testing.TestingConnectorContext in project trino by trinodb.

the class TestHivePlugin method testRubixCache.

@Test
public void testRubixCache() {
    ConnectorFactory connectorFactory = getHiveConnectorFactory();
    connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.cache.enabled", "true").put("hive.metastore.uri", "thrift://foo:1234").put("hive.cache.location", tempDirectory.toString()).buildOrThrow(), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 50 with TestingConnectorContext

use of io.trino.testing.TestingConnectorContext in project trino by trinodb.

the class TestHivePlugin method testSystemAccessControl.

@Test
public void testSystemAccessControl() {
    ConnectorFactory connectorFactory = getHiveConnectorFactory();
    Connector connector = connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.metastore.uri", "thrift://foo:1234").put("hive.security", "system").buildOrThrow(), new TestingConnectorContext());
    assertThatThrownBy(connector::getAccessControl).isInstanceOf(UnsupportedOperationException.class);
    connector.shutdown();
}
Also used : Connector(io.trino.spi.connector.Connector) ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Aggregations

TestingConnectorContext (io.trino.testing.TestingConnectorContext)64 ConnectorFactory (io.trino.spi.connector.ConnectorFactory)56 Test (org.testng.annotations.Test)53 Plugin (io.trino.spi.Plugin)22 Connector (io.trino.spi.connector.Connector)14 HdfsEnvironment (io.trino.plugin.hive.HdfsEnvironment)5 TypeManager (io.trino.spi.type.TypeManager)5 File (java.io.File)4 Path (java.nio.file.Path)4 BeforeClass (org.testng.annotations.BeforeClass)4 TransactionLogAccess (io.trino.plugin.deltalake.transactionlog.TransactionLogAccess)3 CheckpointSchemaManager (io.trino.plugin.deltalake.transactionlog.checkpoint.CheckpointSchemaManager)3 FileFormatDataSourceStats (io.trino.plugin.hive.FileFormatDataSourceStats)3 HdfsConfig (io.trino.plugin.hive.HdfsConfig)3 HdfsConfiguration (io.trino.plugin.hive.HdfsConfiguration)3 HdfsConfigurationInitializer (io.trino.plugin.hive.HdfsConfigurationInitializer)3 HiveHdfsConfiguration (io.trino.plugin.hive.HiveHdfsConfiguration)3 NodeVersion (io.trino.plugin.hive.NodeVersion)3 NoHdfsAuthentication (io.trino.plugin.hive.authentication.NoHdfsAuthentication)3 ParquetReaderConfig (io.trino.plugin.hive.parquet.ParquetReaderConfig)3