Search in sources :

Example 1 with JDBCUtil

use of com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil in project aws-athena-query-federation by awslabs.

the class SnowflakeCompositeHandlerTest method snowflakeCompositeHandlerTest.

@Test
public void snowflakeCompositeHandlerTest() {
    Exception ex = null;
    try {
        DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog1", SnowflakeConstants.SNOWFLAKE_NAME, "snowflake://jdbc:snowflake://hostname/?warehouse=warehousename&db=dbname&schema=schemaname&user=xxx&password=xxx");
        PowerMockito.mockStatic(JDBCUtil.class);
        JDBCUtil tested = PowerMockito.mock(JDBCUtil.class);
        PowerMockito.when(tested.getSingleDatabaseConfigFromEnv(SnowflakeConstants.SNOWFLAKE_NAME)).thenReturn(databaseConnectionConfig);
        snowflakeCompositeHandler = new SnowflakeCompositeHandler();
        assertEquals(snowflakeCompositeHandler.getClass(), SnowflakeCompositeHandler.class);
    } catch (Exception e) {
        ex = e;
    }
    assertEquals(null, ex);
}
Also used : JDBCUtil(com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil) DatabaseConnectionConfig(com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with JDBCUtil

use of com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil in project aws-athena-query-federation by awslabs.

the class TeradataCompositeHandlerTest method teradataCompositeHandlerTest.

@Test
public void teradataCompositeHandlerTest() {
    Exception ex = null;
    try {
        DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog", TeradataConstants.TERADATA_NAME, "teradata://jdbc:teradata://hostname/user=dbc&password=dbc");
        PowerMockito.mockStatic(JDBCUtil.class);
        JDBCUtil tested = PowerMockito.mock(JDBCUtil.class);
        PowerMockito.when(tested.getSingleDatabaseConfigFromEnv(TeradataConstants.TERADATA_NAME)).thenReturn(databaseConnectionConfig);
        teradataCompositeHandler = new TeradataCompositeHandler();
        assertEquals(teradataCompositeHandler.getClass(), TeradataCompositeHandler.class);
    } catch (Exception e) {
        ex = e;
    }
    assertEquals(null, ex);
}
Also used : TeradataCompositeHandler(com.amazonaws.athena.connectors.teradata.TeradataCompositeHandler) JDBCUtil(com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil) DatabaseConnectionConfig(com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 3 with JDBCUtil

use of com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil in project aws-athena-query-federation by awslabs.

the class DataLakeCompositeHandlerTest method dataLakeCompositeHandlerTest.

@Test
public void dataLakeCompositeHandlerTest() {
    Exception ex = null;
    try {
        DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog1", DataLakeGen2Constants.NAME, "datalakegentwo://jdbc:sqlserver://hostname;databaseName=fakedatabase;");
        PowerMockito.mockStatic(JDBCUtil.class);
        JDBCUtil tested = PowerMockito.mock(JDBCUtil.class);
        PowerMockito.when(tested.getSingleDatabaseConfigFromEnv(DataLakeGen2Constants.NAME)).thenReturn(databaseConnectionConfig);
        dataLakeGen2CompositeHandler = new DataLakeGen2CompositeHandler();
        logger.info("dataLakeGen2CompositeHandler: {}", dataLakeGen2CompositeHandler);
    } catch (Exception e) {
        ex = e;
    }
    Assert.assertEquals(null, ex);
}
Also used : JDBCUtil(com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil) DatabaseConnectionConfig(com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 4 with JDBCUtil

use of com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil in project aws-athena-query-federation by awslabs.

the class HiveCompositeHandlerTest method HiveCompositeHandlerTest.

@Test
public void HiveCompositeHandlerTest() {
    Exception ex = null;
    try {
        DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog1", HiveConstants.HIVE_NAME, "hdphive2://jdbc:hive2://54.89.6.2:10000/authena;AuthMech=3;${testSecret}", "testSecret");
        PowerMockito.mockStatic(JDBCUtil.class);
        JDBCUtil tested = PowerMockito.mock(JDBCUtil.class);
        PowerMockito.when(tested.getSingleDatabaseConfigFromEnv(HiveConstants.HIVE_NAME)).thenReturn(databaseConnectionConfig);
        new HiveCompositeHandler();
    } catch (Exception e) {
        ex = e;
    }
    Assert.assertEquals(null, ex);
}
Also used : JDBCUtil(com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil) DatabaseConnectionConfig(com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 5 with JDBCUtil

use of com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil 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);
}
Also used : JDBCUtil(com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil) DatabaseConnectionConfig(com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

DatabaseConnectionConfig (com.amazonaws.athena.connectors.jdbc.connection.DatabaseConnectionConfig)10 JDBCUtil (com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil)10 Test (org.junit.Test)10 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)10 TeradataCompositeHandler (com.amazonaws.athena.connectors.teradata.TeradataCompositeHandler)1