use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlTimestampToPentahoDate.
@Test
public void testMetdataPreviewSqlTimestampToPentahoDate() throws SQLException, KettleDatabaseException {
doReturn(Types.TIMESTAMP).when(resultSet).getInt("DATA_TYPE");
doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS");
doReturn(19).when(resultSet).getInt("DECIMAL_DIGITS");
doReturn(mock(OracleDatabaseMeta.class)).when(dbMetaMock).getDatabaseInterface();
doReturn(true).when(dbMetaMock).supportsTimestampDataType();
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isDate());
assertEquals(-1, valueMeta.getPrecision());
assertEquals(19, valueMeta.getLength());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlBigIntToPentahoInteger.
@Test
public void testMetdataPreviewSqlBigIntToPentahoInteger() throws SQLException, KettleDatabaseException {
doReturn(Types.BIGINT).when(resultSet).getInt("DATA_TYPE");
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isInteger());
assertEquals(0, valueMeta.getPrecision());
assertEquals(15, valueMeta.getLength());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlVarBinaryToPentahoBinary.
@Test
public void testMetdataPreviewSqlVarBinaryToPentahoBinary() throws SQLException, KettleDatabaseException {
doReturn(Types.VARBINARY).when(resultSet).getInt("DATA_TYPE");
doReturn(mock(PostgreSQLDatabaseMeta.class)).when(dbMetaMock).getDatabaseInterface();
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isBinary());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlLongVarBinaryToPentahoBinary.
@Test
public void testMetdataPreviewSqlLongVarBinaryToPentahoBinary() throws SQLException, KettleDatabaseException {
doReturn(Types.LONGVARBINARY).when(resultSet).getInt("DATA_TYPE");
doReturn(mock(PostgreSQLDatabaseMeta.class)).when(dbMetaMock).getDatabaseInterface();
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isBinary());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlNumericWithStrictBigNumberInterpretationUsingOracle.
@Test
public void testMetdataPreviewSqlNumericWithStrictBigNumberInterpretationUsingOracle() throws SQLException, KettleDatabaseException {
doReturn(Types.NUMERIC).when(resultSet).getInt("DATA_TYPE");
doReturn(38).when(resultSet).getInt("COLUMN_SIZE");
doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS");
doReturn(0).when(resultSet).getInt("DECIMAL_DIGITS");
doReturn(mock(OracleDatabaseMeta.class)).when(dbMetaMock).getDatabaseInterface();
when(((OracleDatabaseMeta) dbMetaMock.getDatabaseInterface()).strictBigNumberInterpretation()).thenReturn(true);
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isBigNumber());
}
Aggregations