Search in sources :

Example 1 with NetezzaDatabaseMeta

use of org.pentaho.di.core.database.NetezzaDatabaseMeta in project pentaho-kettle by pentaho.

the class ValueMetaBaseTest method testGetValueFromSqlTypeNetezza.

/**
 * PDI-10877 Table input step returns no data when pulling a timestamp column from IBM Netezza
 *
 * @throws Exception
 */
@Test
public void testGetValueFromSqlTypeNetezza() throws Exception {
    ValueMetaBase obj = new ValueMetaBase();
    DatabaseInterface databaseInterface = new NetezzaDatabaseMeta();
    ResultSet resultSet = Mockito.mock(ResultSet.class);
    ResultSetMetaData metaData = Mockito.mock(ResultSetMetaData.class);
    Mockito.when(resultSet.getMetaData()).thenReturn(metaData);
    Mockito.when(metaData.getColumnType(1)).thenReturn(Types.DATE);
    Mockito.when(metaData.getColumnType(2)).thenReturn(Types.TIME);
    obj.type = ValueMetaInterface.TYPE_DATE;
    // call to testing method
    obj.getValueFromResultSet(databaseInterface, resultSet, 0);
    // for jdbc Date type getDate method called
    Mockito.verify(resultSet, Mockito.times(1)).getDate(Mockito.anyInt());
    obj.getValueFromResultSet(databaseInterface, resultSet, 1);
    // for jdbc Time type getTime method called
    Mockito.verify(resultSet, Mockito.times(1)).getTime(Mockito.anyInt());
}
Also used : ResultSetMetaData(java.sql.ResultSetMetaData) DatabaseInterface(org.pentaho.di.core.database.DatabaseInterface) ResultSet(java.sql.ResultSet) NetezzaDatabaseMeta(org.pentaho.di.core.database.NetezzaDatabaseMeta) Test(org.junit.Test)

Aggregations

ResultSet (java.sql.ResultSet)1 ResultSetMetaData (java.sql.ResultSetMetaData)1 Test (org.junit.Test)1 DatabaseInterface (org.pentaho.di.core.database.DatabaseInterface)1 NetezzaDatabaseMeta (org.pentaho.di.core.database.NetezzaDatabaseMeta)1