use of com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig in project aws-athena-query-federation by awslabs.
the class SqlServerMuxMetadataHandlerTest method setup.
@Before
public void setup() {
this.allocator = new BlockAllocatorImpl();
this.sqlServerMetadataHandler = Mockito.mock(SqlServerMetadataHandler.class);
this.metadataHandlerMap = Collections.singletonMap("fakedatabase", this.sqlServerMetadataHandler);
this.secretsManager = Mockito.mock(AWSSecretsManager.class);
this.athena = Mockito.mock(AmazonAthena.class);
this.queryStatusChecker = Mockito.mock(QueryStatusChecker.class);
this.jdbcConnectionFactory = Mockito.mock(JdbcConnectionFactory.class);
DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog", "fakedatabase", "fakedatabase://jdbc:fakedatabase://hostname/${testSecret}", "testSecret");
this.jdbcMetadataHandler = new SqlServerMuxMetadataHandler(this.secretsManager, this.athena, this.jdbcConnectionFactory, this.metadataHandlerMap, databaseConnectionConfig);
}
use of com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig in project aws-athena-query-federation by awslabs.
the class SqlServerRecordHandlerTest method setup.
@Before
public void setup() {
System.setProperty("aws.region", "us-east-1");
this.amazonS3 = Mockito.mock(AmazonS3.class);
this.secretsManager = Mockito.mock(AWSSecretsManager.class);
this.athena = Mockito.mock(AmazonAthena.class);
this.connection = Mockito.mock(Connection.class);
this.jdbcConnectionFactory = Mockito.mock(JdbcConnectionFactory.class);
Mockito.when(this.jdbcConnectionFactory.getConnection(Mockito.mock(JdbcCredentialProvider.class))).thenReturn(this.connection);
jdbcSplitQueryBuilder = new SqlServerQueryStringBuilder("`");
final DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog", SqlServerConstants.NAME, "sqlserver://jdbc:sqlserver://hostname;databaseName=fakedatabase");
this.sqlServerRecordHandler = new SqlServerRecordHandler(databaseConnectionConfig, amazonS3, secretsManager, athena, jdbcConnectionFactory, jdbcSplitQueryBuilder);
}
use of com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig in project aws-athena-query-federation by awslabs.
the class TeradataMuxJdbcRecordHandlerTest method setup.
@Before
public void setup() {
this.teradataRecordHandler = Mockito.mock(TeradataRecordHandler.class);
this.recordHandlerMap = Collections.singletonMap("teradata", this.teradataRecordHandler);
this.amazonS3 = Mockito.mock(AmazonS3.class);
this.secretsManager = Mockito.mock(AWSSecretsManager.class);
this.athena = Mockito.mock(AmazonAthena.class);
this.queryStatusChecker = Mockito.mock(QueryStatusChecker.class);
this.jdbcConnectionFactory = Mockito.mock(JdbcConnectionFactory.class);
DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog", "teradata", "teradata://jdbc:teradata://hostname/${testSecret}", "testSecret");
this.jdbcRecordHandler = new TeradataMuxRecordHandler(this.amazonS3, this.secretsManager, this.athena, this.jdbcConnectionFactory, databaseConnectionConfig, this.recordHandlerMap);
}
use of com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig in project aws-athena-query-federation by awslabs.
the class SnowflakeMuxJdbcRecordHandlerTest method setup.
@Before
public void setup() {
this.snowflakeRecordHandler = Mockito.mock(SnowflakeRecordHandler.class);
this.recordHandlerMap = Collections.singletonMap("snowflake", this.snowflakeRecordHandler);
this.amazonS3 = Mockito.mock(AmazonS3.class);
this.secretsManager = Mockito.mock(AWSSecretsManager.class);
this.athena = Mockito.mock(AmazonAthena.class);
this.queryStatusChecker = Mockito.mock(QueryStatusChecker.class);
this.jdbcConnectionFactory = Mockito.mock(JdbcConnectionFactory.class);
DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog", "snowflake", "snowflake://jdbc:snowflake://hostname/?warehouse=warehousename&db=dbname&schema=schemaname&user=xxx&password=xxx");
this.jdbcRecordHandler = new SnowflakeMuxRecordHandler(this.amazonS3, this.secretsManager, this.athena, this.jdbcConnectionFactory, databaseConnectionConfig, this.recordHandlerMap);
}
use of com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig in project aws-athena-query-federation by awslabs.
the class SqlServerCompositeHandlerTest method sqlserverCompositeHandlerTest.
@Test
public void sqlserverCompositeHandlerTest() {
Exception ex = null;
try {
DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog1", SqlServerConstants.NAME, "sqlserver://jdbc:sqlserver://hostname;databaseName=fakedatabase;");
PowerMockito.mockStatic(JDBCUtil.class);
JDBCUtil tested = PowerMockito.mock(JDBCUtil.class);
PowerMockito.when(tested.getSingleDatabaseConfigFromEnv(SqlServerConstants.NAME)).thenReturn(databaseConnectionConfig);
sqlServerCompositeHandler = new SqlServerCompositeHandler();
logger.info("sqlServerCompositeHandler: {}", sqlServerCompositeHandler);
} catch (Exception e) {
ex = e;
}
Assert.assertEquals(null, ex);
}
Aggregations