use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlNumericWithUndefinedSizeUsingGreenplum.
@Test
public void testMetdataPreviewSqlNumericWithUndefinedSizeUsingGreenplum() throws SQLException, KettleDatabaseException {
doReturn(Types.NUMERIC).when(resultSet).getInt("DATA_TYPE");
doReturn(0).when(resultSet).getInt("COLUMN_SIZE");
doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS");
doReturn(0).when(resultSet).getInt("DECIMAL_DIGITS");
doReturn(mock(GreenplumDatabaseMeta.class)).when(dbMetaMock).getDatabaseInterface();
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isBigNumber());
assertEquals(-1, valueMeta.getPrecision());
assertEquals(-1, valueMeta.getLength());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlDateToPentahoDateUsingTeradata.
@Test
public void testMetdataPreviewSqlDateToPentahoDateUsingTeradata() throws SQLException, KettleDatabaseException {
doReturn(Types.DATE).when(resultSet).getInt("DATA_TYPE");
doReturn(mock(TeradataDatabaseMeta.class)).when(dbMetaMock).getDatabaseInterface();
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isDate());
assertEquals(1, valueMeta.getPrecision());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testGetNativeDataTypeClass.
@Test
public void testGetNativeDataTypeClass() {
ValueMetaInterface base = new ValueMetaBase();
Class<?> clazz = null;
try {
clazz = base.getNativeDataTypeClass();
fail();
} catch (KettleValueException expected) {
// ValueMetaBase should throw an exception, as all sub-classes should override
assertNull(clazz);
}
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseTest method testMetdataPreviewSqlDoubleWithTooBigLengthAndPrecision.
@Test
public void testMetdataPreviewSqlDoubleWithTooBigLengthAndPrecision() throws SQLException, KettleDatabaseException {
doReturn(Types.DOUBLE).when(resultSet).getInt("DATA_TYPE");
doReturn(128).when(resultSet).getInt("COLUMN_SIZE");
doReturn(mock(Object.class)).when(resultSet).getObject("DECIMAL_DIGITS");
doReturn(127).when(resultSet).getInt("DECIMAL_DIGITS");
doReturn(mock(OracleDatabaseMeta.class)).when(dbMetaMock).getDatabaseInterface();
ValueMetaInterface valueMeta = valueMetaBase.getMetadataPreview(dbMetaMock, resultSet);
assertTrue(valueMeta.isBigNumber());
assertEquals(-1, valueMeta.getPrecision());
assertEquals(-1, valueMeta.getLength());
}
use of org.pentaho.di.core.row.ValueMetaInterface in project pentaho-kettle by pentaho.
the class ValueMetaBaseSetPreparedStmntValueTest method testXMLParsingWithNoDataFormatLocale.
@Test
public void testXMLParsingWithNoDataFormatLocale() throws IOException {
ValueMetaInterface r1 = new ValueMetaString("value");
r1.setDateFormatLocale(null);
RowMetaInterface row = new RowMeta();
row.setValueMetaList(new ArrayList<ValueMetaInterface>(Arrays.asList(r1)));
row.getMetaXML();
}
Aggregations