Search in sources :

Example 86 with ValueMetaInterface

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());
}
Also used : LoggingObject(org.pentaho.di.core.logging.LoggingObject) GreenplumDatabaseMeta(org.pentaho.di.core.database.GreenplumDatabaseMeta) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Example 87 with ValueMetaInterface

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());
}
Also used : TeradataDatabaseMeta(org.pentaho.di.core.database.TeradataDatabaseMeta) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Example 88 with ValueMetaInterface

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);
    }
}
Also used : KettleValueException(org.pentaho.di.core.exception.KettleValueException) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Example 89 with ValueMetaInterface

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());
}
Also used : OracleDatabaseMeta(org.pentaho.di.core.database.OracleDatabaseMeta) LoggingObject(org.pentaho.di.core.logging.LoggingObject) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Example 90 with ValueMetaInterface

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();
}
Also used : RowMeta(org.pentaho.di.core.row.RowMeta) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) Test(org.junit.Test)

Aggregations

ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)908 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)345 KettleException (org.pentaho.di.core.exception.KettleException)269 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)243 RowMeta (org.pentaho.di.core.row.RowMeta)232 Test (org.junit.Test)212 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)146 KettleStepException (org.pentaho.di.core.exception.KettleStepException)120 ArrayList (java.util.ArrayList)111 TableItem (org.eclipse.swt.widgets.TableItem)78 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)76 KettleValueException (org.pentaho.di.core.exception.KettleValueException)58 FileObject (org.apache.commons.vfs2.FileObject)55 Date (java.util.Date)49 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)48 StepMeta (org.pentaho.di.trans.step.StepMeta)47 Database (org.pentaho.di.core.database.Database)46 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)46 ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)44 TableItemInsertListener (org.pentaho.di.ui.trans.step.TableItemInsertListener)43