use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlFloatToPentahoNumber.
@Test
public void testMetdataPreviewSqlFloatToPentahoNumber() throws SQLException, KettleDatabaseException {
doReturn(Types.FLOAT).when(resultSet).getInt("DATA_TYPE");
doReturn(3).when(resultSet).getInt("COLUMN_SIZE");
doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS");
doReturn(2).when(resultSet).getInt("DECIMAL_DIGITS");
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isNumber());
assertEquals(2, valueMeta.getPrecision());
assertEquals(3, valueMeta.getLength());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlClobToPentahoString.
@Test
public void testMetdataPreviewSqlClobToPentahoString() throws SQLException, KettleDatabaseException {
doReturn(Types.CLOB).when(resultSet).getInt("DATA_TYPE");
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isString());
assertEquals(DatabaseMeta.CLOB_LENGTH, valueMeta.getLength());
assertTrue(valueMeta.isLargeTextField());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlBinaryToPentahoStringUsingSQLite.
@Test
public void testMetdataPreviewSqlBinaryToPentahoStringUsingSQLite() throws SQLException, KettleDatabaseException {
doReturn(Types.BINARY).when(resultSet).getInt("DATA_TYPE");
doReturn(mock(SQLiteDatabaseMeta.class)).when(dbMetaMock).getDatabaseInterface();
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isString());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlDoubleToPentahoBigNumber.
@Test
public void testMetdataPreviewSqlDoubleToPentahoBigNumber() throws SQLException, KettleDatabaseException {
doReturn(Types.DOUBLE).when(resultSet).getInt("DATA_TYPE");
doReturn(20).when(resultSet).getInt("COLUMN_SIZE");
doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS");
doReturn(15).when(resultSet).getInt("DECIMAL_DIGITS");
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isBigNumber());
assertEquals(15, valueMeta.getPrecision());
assertEquals(20, valueMeta.getLength());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlDoubleWithoutDecimalDigits.
@Test
public void testMetdataPreviewSqlDoubleWithoutDecimalDigits() throws SQLException, KettleDatabaseException {
doReturn(Types.DOUBLE).when(resultSet).getInt("DATA_TYPE");
doReturn(3).when(resultSet).getInt("COLUMN_SIZE");
doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS");
doReturn(0).when(resultSet).getInt("DECIMAL_DIGITS");
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isNumber());
assertEquals(-1, valueMeta.getPrecision());
assertEquals(3, valueMeta.getLength());
}
Aggregations