use of com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig in project aws-athena-query-federation by awslabs.
the class OracleMuxJdbcRecordHandlerTest method setup.
@Before
public void setup() {
this.oracleRecordHandler = Mockito.mock(OracleRecordHandler.class);
this.recordHandlerMap = Collections.singletonMap("oracle", this.oracleRecordHandler);
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", "oracle", "oracle://jdbc:oracle:thin:${testSecret}@//127.0.0.1:1521/orcl", "testSecret");
this.jdbcRecordHandler = new OracleMuxRecordHandler(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 OracleRecordHandlerTest method setup.
@Before
public void setup() {
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 OracleQueryStringBuilder(ORACLE_QUOTE_CHARACTER);
final DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog", ORACLE_NAME, "oracle://jdbc:oracle:thin:username/password@//127.0.0.1:1521/orcl");
this.oracleRecordHandler = new OracleRecordHandler(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 OracleCompositeHandlerTest method oracleCompositeHandlerTest.
@Test
public void oracleCompositeHandlerTest() {
Exception ex = null;
try {
DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog1", OracleConstants.ORACLE_NAME, "oracle://jdbc:oracle:thin:abc/abc@//hostname:1521/orcl");
PowerMockito.mockStatic(JDBCUtil.class);
JDBCUtil tested = PowerMockito.mock(JDBCUtil.class);
PowerMockito.when(tested.getSingleDatabaseConfigFromEnv(OracleConstants.ORACLE_NAME)).thenReturn(databaseConnectionConfig);
oracleCompositeHandler = new OracleCompositeHandler();
} catch (Exception e) {
ex = e;
}
assertEquals(null, ex);
}
use of com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig in project aws-athena-query-federation by awslabs.
the class SaphanaCompositeHandlerTest method SaphanaCompositeHandlerTest.
@Test
public void SaphanaCompositeHandlerTest() {
Exception ex = null;
try {
DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog", SaphanaConstants.SAPHANA_NAME, "saphana://jdbc:sap://hostname/?${trianz-saphana-athena-jdbc}");
PowerMockito.mockStatic(JDBCUtil.class);
JDBCUtil tested = PowerMockito.mock(JDBCUtil.class);
PowerMockito.when(tested.getSingleDatabaseConfigFromEnv(SaphanaConstants.SAPHANA_NAME)).thenReturn(databaseConnectionConfig);
saphanaCompositeHandler = new SaphanaCompositeHandler();
assertEquals(saphanaCompositeHandler.getClass(), SaphanaCompositeHandler.class);
} catch (Exception e) {
ex = e;
}
assertEquals(null, ex);
}
use of com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig in project aws-athena-query-federation by awslabs.
the class SaphanaMuxJdbcMetadataHandlerTest method setup.
@Before
public void setup() {
// this.allocator = Mockito.mock(BlockAllocator.class);
this.allocator = new BlockAllocatorImpl();
// Mockito.when(this.allocator.createBlock(Mockito.any(Schema.class))).thenReturn(Mockito.mock(Block.class));
this.saphanaMetadataHandler = Mockito.mock(SaphanaMetadataHandler.class);
this.metadataHandlerMap = Collections.singletonMap("fakedatabase", this.saphanaMetadataHandler);
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 SaphanaMuxMetadataHandler(this.secretsManager, this.athena, this.jdbcConnectionFactory, this.metadataHandlerMap, databaseConnectionConfig);
}
Aggregations