Search in sources :

Example 36 with ValueMetaNumber

use of org.pentaho.di.core.row.value.ValueMetaNumber in project pentaho-kettle by pentaho.

the class DetectLastRowStepIT method createRowMetaInterface.

public RowMetaInterface createRowMetaInterface() {
    RowMetaInterface rm = new RowMeta();
    ValueMetaInterface[] valuesMeta = { new ValueMetaString("field1"), new ValueMetaInteger("field2"), new ValueMetaNumber("field3"), new ValueMetaBoolean("field5"), new ValueMetaBigNumber("field6") };
    for (int i = 0; i < valuesMeta.length; i++) {
        rm.addValueMeta(valuesMeta[i]);
    }
    return rm;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaBigNumber(org.pentaho.di.core.row.value.ValueMetaBigNumber) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 37 with ValueMetaNumber

use of org.pentaho.di.core.row.value.ValueMetaNumber in project pentaho-kettle by pentaho.

the class DetectLastRowStepIT method createResultRowMetaInterface.

public RowMetaInterface createResultRowMetaInterface() {
    RowMetaInterface rm = new RowMeta();
    ValueMetaInterface[] valuesMeta = { new ValueMetaString("field1"), new ValueMetaInteger("field2"), new ValueMetaNumber("field3"), new ValueMetaBoolean("field5"), new ValueMetaBigNumber("field6"), new ValueMetaBoolean("result") };
    for (int i = 0; i < valuesMeta.length; i++) {
        rm.addValueMeta(valuesMeta[i]);
    }
    return rm;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaBigNumber(org.pentaho.di.core.row.value.ValueMetaBigNumber) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 38 with ValueMetaNumber

use of org.pentaho.di.core.row.value.ValueMetaNumber in project pentaho-kettle by pentaho.

the class Formula2IT method testIsBlank_EmptyStringIsNotNull.

@Test
public void testIsBlank_EmptyStringIsNotNull() throws KettleException {
    FieldAccessorUtl.ensureEmptyStringIsNotNull(true);
    final String fIsBlank = "ISBLANK([" + KEY_ARG + "])";
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "1" }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "a" }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { null }, true);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "" }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "   " }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { 1 }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { 0 }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { -1.0 }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { null }, true);
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) Test(org.junit.Test)

Example 39 with ValueMetaNumber

use of org.pentaho.di.core.row.value.ValueMetaNumber in project pentaho-kettle by pentaho.

the class Formula2IT method testIsBlank_EmptyStringIsNull.

@Test
public void testIsBlank_EmptyStringIsNull() throws KettleException {
    FieldAccessorUtl.ensureEmptyStringIsNotNull(false);
    final String fIsBlank = "ISBLANK([" + KEY_ARG + "])";
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "1" }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "a" }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { null }, true);
    // assertBooleanFormula( fIsBlank, buildRowMeta( new ValueMetaString( KEY_ARG ) ), new Object[] { "" }, true ); //
    // TODO: Is it correct?
    // 
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "" }, false);
    // TODO: Is it correct?
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "   " }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { 1 }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { 0 }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { -1.0 }, false);
    assertBooleanFormula(fIsBlank, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { null }, true);
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) Test(org.junit.Test)

Example 40 with ValueMetaNumber

use of org.pentaho.di.core.row.value.ValueMetaNumber in project pentaho-kettle by pentaho.

the class Formula2IT method testIsText_EmptyStringIsNull.

@Test
public void testIsText_EmptyStringIsNull() throws KettleException {
    FieldAccessorUtl.ensureEmptyStringIsNotNull(false);
    final String fIsText = "ISTEXT([" + KEY_ARG + "])";
    assertBooleanFormula(fIsText, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "1" }, true);
    assertBooleanFormula(fIsText, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "a" }, true);
    assertBooleanFormula(fIsText, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { null }, false);
    // assertBooleanFormula( fIsText, buildRowMeta( new ValueMetaString( KEY_ARG ) ), new Object[] { "" }, false ); //
    // TODO: Is it correct?
    // 
    assertBooleanFormula(fIsText, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "" }, true);
    // TODO: Is it correct?
    assertBooleanFormula(fIsText, buildRowMeta(new ValueMetaString(KEY_ARG)), new Object[] { "   " }, true);
    assertBooleanFormula(fIsText, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { 1 }, false);
    assertBooleanFormula(fIsText, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { 0 }, false);
    assertBooleanFormula(fIsText, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { -1.0 }, false);
    assertBooleanFormula(fIsText, buildRowMeta(new ValueMetaNumber(KEY_ARG)), new Object[] { null }, false);
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) Test(org.junit.Test)

Aggregations

ValueMetaNumber (org.pentaho.di.core.row.value.ValueMetaNumber)95 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)75 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)52 Test (org.junit.Test)51 RowMeta (org.pentaho.di.core.row.RowMeta)39 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)34 ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)34 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)32 ValueMetaBigNumber (org.pentaho.di.core.row.value.ValueMetaBigNumber)30 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)25 ValueMetaBinary (org.pentaho.di.core.row.value.ValueMetaBinary)20 ValueMetaTimestamp (org.pentaho.di.core.row.value.ValueMetaTimestamp)16 ValueMetaInternetAddress (org.pentaho.di.core.row.value.ValueMetaInternetAddress)15 KettleException (org.pentaho.di.core.exception.KettleException)12 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)11 KettleStepException (org.pentaho.di.core.exception.KettleStepException)7 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 RowSet (org.pentaho.di.core.RowSet)6 RowAdapter (org.pentaho.di.trans.step.RowAdapter)6