use of io.trino.testing.TestingConnectorContext in project TiBigData by tidb-incubator.
the class ConnectorsPluginTest method testCreateConnector.
@Test
public void testCreateConnector() {
Plugin plugin = new ConnectorsPlugin();
ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
factory.create("tidb", ConfigUtils.getProperties(), new TestingConnectorContext());
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestJmxStats method testJmxStatsExposure.
@Test
public void testJmxStatsExposure() throws Exception {
Plugin plugin = new JdbcPlugin("base-jdbc", new TestingH2JdbcModule());
ConnectorFactory factory = getOnlyElement(plugin.getConnectorFactories());
factory.create("test", ImmutableMap.of("connection-url", "jdbc:driver:"), new TestingConnectorContext());
MBeanServer mbeanServer = getPlatformMBeanServer();
Set<ObjectName> objectNames = mbeanServer.queryNames(new ObjectName("io.trino.plugin.jdbc:*"), null);
assertTrue(objectNames.containsAll(ImmutableSet.of(new ObjectName("io.trino.plugin.jdbc:type=ConnectionFactory,name=test"), new ObjectName("io.trino.plugin.jdbc:type=JdbcClient,name=test"))));
for (ObjectName objectName : objectNames) {
MBeanInfo mbeanInfo = mbeanServer.getMBeanInfo(objectName);
assertNotEquals(mbeanInfo.getAttributes().length, 0, format("Object %s doesn't expose JMX stats", objectName.getCanonicalName()));
}
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class AbstractTestDeltaLakeCreateTableStatistics method getAddFileEntries.
protected List<AddFileEntry> getAddFileEntries(String tableName) throws IOException {
TestingConnectorContext context = new TestingConnectorContext();
HdfsConfig hdfsConfig = new HdfsConfig();
HdfsConfiguration hdfsConfiguration = new HiveHdfsConfiguration(new HdfsConfigurationInitializer(hdfsConfig), ImmutableSet.of());
HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(hdfsConfiguration, hdfsConfig, new NoHdfsAuthentication());
TransactionLogAccess transactionLogAccess = new TransactionLogAccess(context.getTypeManager(), new CheckpointSchemaManager(context.getTypeManager()), new DeltaLakeConfig(), new FileFormatDataSourceStats(), hdfsEnvironment, new ParquetReaderConfig(), new DeltaLakeConfig());
return transactionLogAccess.getActiveFiles(transactionLogAccess.loadSnapshot(new SchemaTableName(SCHEMA, tableName), new Path(format("s3://%s/%s", bucketName, tableName)), SESSION), SESSION);
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestCassandraConnector method setup.
@BeforeClass
public void setup() throws Exception {
this.server = new CassandraServer();
String keyspace = "test_connector";
createTestTables(server.getSession(), keyspace, DATE);
CassandraConnectorFactory connectorFactory = new CassandraConnectorFactory();
Connector connector = connectorFactory.create("test", ImmutableMap.of("cassandra.contact-points", server.getHost(), "cassandra.native-protocol-port", Integer.toString(server.getPort())), new TestingConnectorContext());
metadata = connector.getMetadata(SESSION, CassandraTransactionHandle.INSTANCE);
assertInstanceOf(metadata, CassandraMetadata.class);
splitManager = connector.getSplitManager();
assertInstanceOf(splitManager, CassandraSplitManager.class);
recordSetProvider = connector.getRecordSetProvider();
assertInstanceOf(recordSetProvider, CassandraRecordSetProvider.class);
database = keyspace;
table = new SchemaTableName(database, TABLE_ALL_TYPES.toLowerCase(ENGLISH));
tableForDelete = new SchemaTableName(database, TABLE_DELETE_DATA.toLowerCase(ENGLISH));
tableTuple = new SchemaTableName(database, TABLE_TUPLE_TYPE.toLowerCase(ENGLISH));
tableUdt = new SchemaTableName(database, TABLE_USER_DEFINED_TYPE.toLowerCase(ENGLISH));
}
use of io.trino.testing.TestingConnectorContext in project trino by trinodb.
the class TestIcebergPlugin method testSystemAccessControl.
@Test
public void testSystemAccessControl() {
ConnectorFactory connectorFactory = getConnectorFactory();
Connector connector = connectorFactory.create("test", ImmutableMap.<String, String>builder().put("iceberg.catalog.type", "HIVE_METASTORE").put("hive.metastore.uri", "thrift://foo:1234").put("iceberg.security", "system").buildOrThrow(), new TestingConnectorContext());
assertThatThrownBy(connector::getAccessControl).isInstanceOf(UnsupportedOperationException.class);
connector.shutdown();
}
Aggregations