use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestHiveConnectorFactory method assertCreateConnector.
private static void assertCreateConnector(String metastoreUri) {
Map<String, String> config = ImmutableMap.<String, String>builder().put("hive.metastore.uri", metastoreUri).buildOrThrow();
Connector connector = new HiveConnectorFactory("hive").create("hive-test", config, new TestingConnectorContext());
ConnectorTransactionHandle transaction = connector.beginTransaction(READ_UNCOMMITTED, true, true);
assertInstanceOf(connector.getMetadata(SESSION, transaction), ClassLoaderSafeConnectorMetadata.class);
assertInstanceOf(connector.getSplitManager(), ClassLoaderSafeConnectorSplitManager.class);
assertInstanceOf(connector.getPageSourceProvider(), ConnectorPageSourceProvider.class);
connector.commit(transaction);
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestHivePlugin method testImmutablePartitionsAndInsertOverwriteMutuallyExclusive.
@Test
public void testImmutablePartitionsAndInsertOverwriteMutuallyExclusive() {
ConnectorFactory connectorFactory = getHiveConnectorFactory();
assertThatThrownBy(() -> connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.insert-existing-partitions-behavior", "APPEND").put("hive.immutable-partitions", "true").put("hive.metastore.uri", "thrift://foo:1234").buildOrThrow(), new TestingConnectorContext())).hasMessageContaining("insert-existing-partitions-behavior cannot be APPEND when immutable-partitions is true");
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestHivePlugin method testCreateConnector.
@Test
public void testCreateConnector() {
ConnectorFactory factory = getHiveConnectorFactory();
// simplest possible configuration
factory.create("test", ImmutableMap.of("hive.metastore.uri", "thrift://foo:1234"), new TestingConnectorContext()).shutdown();
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestHivePlugin method testGcsAccessTokenAndHiveCachingMutuallyExclusive.
@Test
public void testGcsAccessTokenAndHiveCachingMutuallyExclusive() {
ConnectorFactory connectorFactory = getHiveConnectorFactory();
assertThatThrownBy(() -> connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.gcs.use-access-token", "true").put("hive.cache.enabled", "true").put("hive.metastore.uri", "thrift://foo:1234").put("hive.cache.location", tempDirectory.toString()).buildOrThrow(), new TestingConnectorContext())).hasMessageContaining("Use of GCS access token is not compatible with Hive caching");
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestHivePlugin method testFileBasedAccessControl.
@Test
public void testFileBasedAccessControl() throws Exception {
ConnectorFactory connectorFactory = getHiveConnectorFactory();
File tempFile = File.createTempFile("test-hive-plugin-access-control", ".json");
tempFile.deleteOnExit();
Files.write(tempFile.toPath(), "{}".getBytes(UTF_8));
connectorFactory.create("test", ImmutableMap.<String, String>builder().put("hive.metastore.uri", "thrift://foo:1234").put("hive.security", "file").put("security.config-file", tempFile.getAbsolutePath()).buildOrThrow(), new TestingConnectorContext()).shutdown();
}
Aggregations