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());
}
Aggregations