Search in sources :

Example 6 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestHivePlugin method testHdfsImpersonationAndHiveCachingMutuallyExclusive.

@Test
public void testHdfsImpersonationAndHiveCachingMutuallyExclusive() {
    ConnectorFactory connectorFactory = getHiveConnectorFactory();
    assertThatThrownBy(() -> connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.hdfs.impersonation.enabled", "true").put("hive.cache.enabled", "true").put("hive.metastore.uri", "thrift://foo:1234").put("hive.cache.location", tempDirectory.toString()).buildOrThrow(), new TestingConnectorContext())).hasMessageContaining("HDFS impersonation is not compatible with Hive caching");
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 7 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestHivePlugin method testReadOnlyAllAccessControl.

@Test
public void testReadOnlyAllAccessControl() {
    ConnectorFactory connectorFactory = getHiveConnectorFactory();
    connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.metastore.uri", "thrift://foo:1234").put("hive.security", "read-only").buildOrThrow(), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 8 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestHivePlugin method testAllowAllAccessControl.

@Test
public void testAllowAllAccessControl() {
    ConnectorFactory connectorFactory = getHiveConnectorFactory();
    connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.metastore.uri", "thrift://foo:1234").put("hive.security", "allow-all").buildOrThrow(), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 9 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestHivePlugin method testRubixCacheWithNonExistingCacheDirectory.

@Test
public void testRubixCacheWithNonExistingCacheDirectory() {
    ConnectorFactory connectorFactory = getHiveConnectorFactory();
    assertThatThrownBy(() -> connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.cache.enabled", "true").put("hive.cache.start-server-on-coordinator", "true").put("hive.metastore.uri", "thrift://foo:1234").put("hive.cache.location", "/tmp/non/existing/directory").buildOrThrow(), new TestingConnectorContext())).hasRootCauseMessage("None of the cache parent directories exists");
    assertThatThrownBy(() -> connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.cache.enabled", "true").put("hive.cache.start-server-on-coordinator", "true").put("hive.metastore.uri", "thrift://foo:1234").buildOrThrow(), new TestingConnectorContext())).hasRootCauseMessage("caching directories were not provided");
    // cache directories should not be required when cache is not explicitly started on coordinator
    connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.cache.enabled", "true").put("hive.metastore.uri", "thrift://foo:1234").buildOrThrow(), new TestingConnectorContext()).shutdown();
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) Test(org.testng.annotations.Test)

Example 10 with ConnectorFactory

use of io.trino.spi.connector.ConnectorFactory in project trino by trinodb.

the class TestDeltaLakePlugin method testThriftMetastore.

@Test
public void testThriftMetastore() {
    Plugin plugin = new TestingDeltaLakePlugin();
    ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
    factory.create("test", ImmutableMap.of("hive.metastore", "thrift", "hive.metastore.uri", "thrift://foo:1234"), new TestingConnectorContext()).shutdown();
    assertThatThrownBy(() -> factory.create("test", ImmutableMap.of("hive.metastore", "thrift", "hive.metastore.uri", "thrift://foo:1234", "delta.hide-non-delta-lake-tables", "true"), new TestingConnectorContext())).isInstanceOf(ApplicationConfigurationException.class).hasMessageContaining("Error: Configuration property 'delta.hide-non-delta-lake-tables' was not used");
}
Also used : ConnectorFactory(io.trino.spi.connector.ConnectorFactory) TestingConnectorContext(io.trino.testing.TestingConnectorContext) ApplicationConfigurationException(io.airlift.bootstrap.ApplicationConfigurationException) Plugin(io.trino.spi.Plugin) Test(org.testng.annotations.Test)

Aggregations

ConnectorFactory (io.trino.spi.connector.ConnectorFactory)66 Test (org.testng.annotations.Test)61 TestingConnectorContext (io.trino.testing.TestingConnectorContext)56 Plugin (io.trino.spi.Plugin)29 Connector (io.trino.spi.connector.Connector)13 ImmutableList (com.google.common.collect.ImmutableList)7 ImmutableMap (com.google.common.collect.ImmutableMap)7 Session (io.trino.Session)7 DistributedQueryRunner (io.trino.testing.DistributedQueryRunner)7 MockConnectorFactory (io.trino.connector.MockConnectorFactory)6 TestingSession.testSessionBuilder (io.trino.testing.TestingSession.testSessionBuilder)6 SchemaTableName (io.trino.spi.connector.SchemaTableName)5 AbstractTestQueryFramework (io.trino.testing.AbstractTestQueryFramework)5 List (java.util.List)5 Optional (java.util.Optional)5 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)5 QueryRunner (io.trino.testing.QueryRunner)4 Path (java.nio.file.Path)4 ResourceGroupManagerPlugin (io.trino.plugin.resourcegroups.ResourceGroupManagerPlugin)3 ColumnMetadata (io.trino.spi.connector.ColumnMetadata)3