Search in sources :

Example 1 with Field

use of org.pentaho.di.trans.steps.nullif.NullIfMeta.Field in project pentaho-kettle by pentaho.

the class NullIfMetaTest method setFieldValueTest.

@Test
public void setFieldValueTest() {
    Field field = new Field();
    System.setProperty(Const.KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL, "N");
    field.setFieldValue("theValue");
    assertEquals("theValue", field.getFieldValue());
}
Also used : Field(org.pentaho.di.trans.steps.nullif.NullIfMeta.Field) Test(org.junit.Test)

Example 2 with Field

use of org.pentaho.di.trans.steps.nullif.NullIfMeta.Field in project pentaho-kettle by pentaho.

the class NullIfMetaTest method setFieldValueNullTest.

@Test
public void setFieldValueNullTest() {
    Field field = new Field();
    System.setProperty(Const.KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL, "N");
    field.setFieldValue(null);
    assertEquals(null, field.getFieldValue());
}
Also used : Field(org.pentaho.di.trans.steps.nullif.NullIfMeta.Field) Test(org.junit.Test)

Example 3 with Field

use of org.pentaho.di.trans.steps.nullif.NullIfMeta.Field in project pentaho-kettle by pentaho.

the class NullIfTest method createArrayWithOneField.

private static Field[] createArrayWithOneField(String fieldName, String fieldValue) {
    Field field = new Field();
    field.setFieldName(fieldName);
    field.setFieldValue(fieldValue);
    return new Field[] { field };
}
Also used : Field(org.pentaho.di.trans.steps.nullif.NullIfMeta.Field)

Example 4 with Field

use of org.pentaho.di.trans.steps.nullif.NullIfMeta.Field in project pentaho-kettle by pentaho.

the class NullIfMetaTest method setFieldValueNullWithEmptyStringsDiffersFromNullTest.

@Test
public void setFieldValueNullWithEmptyStringsDiffersFromNullTest() {
    Field field = new Field();
    System.setProperty(Const.KETTLE_EMPTY_STRING_DIFFERS_FROM_NULL, "Y");
    field.setFieldValue(null);
    assertEquals("", field.getFieldValue());
}
Also used : Field(org.pentaho.di.trans.steps.nullif.NullIfMeta.Field) Test(org.junit.Test)

Example 5 with Field

use of org.pentaho.di.trans.steps.nullif.NullIfMeta.Field in project pentaho-kettle by pentaho.

the class NullIfMetaTest method setUp.

@Before
public void setUp() throws Exception {
    List<String> attributes = Arrays.asList("fields");
    Map<String, String> getterMap = new HashMap<String, String>() {

        {
            put("fields", "getFields");
        }
    };
    Map<String, String> setterMap = new HashMap<String, String>() {

        {
            put("fields", "setFields");
        }
    };
    Field field = new Field();
    field.setFieldName("fieldName");
    field.setFieldValue("fieldValue");
    FieldLoadSaveValidator<Field[]> fieldArrayLoadSaveValidator = new ArrayLoadSaveValidator<Field>(new NullIfFieldLoadSaveValidator(field), 5);
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    typeValidatorMap.put(Field[].class.getCanonicalName(), fieldArrayLoadSaveValidator);
    Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    attrValidatorMap.put("fields", fieldArrayLoadSaveValidator);
    loadSaveTester = new LoadSaveTester(NullIfMeta.class, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap);
}
Also used : Field(org.pentaho.di.trans.steps.nullif.NullIfMeta.Field) ArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator) HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) Before(org.junit.Before)

Aggregations

Field (org.pentaho.di.trans.steps.nullif.NullIfMeta.Field)6 Test (org.junit.Test)3 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)1 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 RowProducer (org.pentaho.di.trans.RowProducer)1 RowStepCollector (org.pentaho.di.trans.RowStepCollector)1 Trans (org.pentaho.di.trans.Trans)1 TransHopMeta (org.pentaho.di.trans.TransHopMeta)1 TransMeta (org.pentaho.di.trans.TransMeta)1 StepInterface (org.pentaho.di.trans.step.StepInterface)1 StepMeta (org.pentaho.di.trans.step.StepMeta)1 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)1 InjectorMeta (org.pentaho.di.trans.steps.injector.InjectorMeta)1 LoadSaveTester (org.pentaho.di.trans.steps.loadsave.LoadSaveTester)1 ArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator)1 FieldLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator)1