Search in sources :

Example 6 with JDBCUtil

use of com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil 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);
}
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 7 with JDBCUtil

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

the class SynapseCompositeHandlerTest method synapseCompositeHandlerTest.

@Test
public void synapseCompositeHandlerTest() {
    Exception ex = null;
    try {
        DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog1", SynapseConstants.NAME, "synapse://jdbc:sqlserver://hostname;databaseName=fakedatabase;");
        PowerMockito.mockStatic(JDBCUtil.class);
        JDBCUtil tested = PowerMockito.mock(JDBCUtil.class);
        PowerMockito.when(tested.getSingleDatabaseConfigFromEnv(SynapseConstants.NAME)).thenReturn(databaseConnectionConfig);
        synapseCompositeHandler = new SynapseCompositeHandler();
        logger.info("synapseCompositeHandler: {}", synapseCompositeHandler);
    } 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 8 with JDBCUtil

use of com.amazonaws.athena.connectors.jdbc.manager.JDBCUtil 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);
}
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 9 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 10 with JDBCUtil

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

the class ImpalaCompositeHandlerTest method ImpalaCompositeHandlerTest.

@Test
public void ImpalaCompositeHandlerTest() {
    Exception ex = null;
    try {
        DatabaseConnectionConfig databaseConnectionConfig = new DatabaseConnectionConfig("testCatalog1", ImpalaConstants.IMPALA_NAME, "impala://jdbc:impala://54.89.6.2:10000/authena;AuthMech=3;${testSecret}", "testSecret");
        PowerMockito.mockStatic(JDBCUtil.class);
        JDBCUtil tested = PowerMockito.mock(JDBCUtil.class);
        PowerMockito.when(tested.getSingleDatabaseConfigFromEnv(ImpalaConstants.IMPALA_NAME)).thenReturn(databaseConnectionConfig);
        new ImpalaCompositeHandler();
    } 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)

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