use of org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class UniqueRowsByHashSetMetaTest method testRoundTrip.
@Test
public void testRoundTrip() throws KettleException {
List<String> attributes = Arrays.asList("store_values", "reject_duplicate_row", "error_description", "name");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("store_values", "getStoreValues");
getterMap.put("reject_duplicate_row", "isRejectDuplicateRow");
getterMap.put("error_description", "getErrorDescription");
getterMap.put("name", "getCompareFields");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("store_values", "setStoreValues");
setterMap.put("reject_duplicate_row", "setRejectDuplicateRow");
setterMap.put("error_description", "setErrorDescription");
setterMap.put("name", "setCompareFields");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
// Arrays need to be consistent length
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25);
fieldLoadSaveValidatorAttributeMap.put("name", stringArrayLoadSaveValidator);
LoadSaveTester loadSaveTester = new LoadSaveTester(UniqueRowsByHashSetMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class ValueMapperMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 7);
init(stringArrayLoadSaveValidator, stringArrayLoadSaveValidator);
}
use of org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class GetVariableMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
List<String> attributes = Arrays.asList("fieldDefinitions");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("fieldDefinitions", "getFieldDefinitions");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("fieldDefinitions", "setFieldDefinitions");
FieldDefinition fieldDefinition = new FieldDefinition();
fieldDefinition.setFieldName("fieldName");
fieldDefinition.setFieldLength(4);
fieldDefinition.setCurrency(null);
fieldDefinition.setFieldPrecision(5);
fieldDefinition.setFieldType(ValueMetaInterface.TYPE_NUMBER);
fieldDefinition.setGroup("group");
fieldDefinition.setVariableString("variableString");
FieldLoadSaveValidator<FieldDefinition[]> fieldDefinitionLoadSaveValidator = new ArrayLoadSaveValidator<FieldDefinition>(new FieldDefinitionLoadSaveValidator(fieldDefinition), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldName", fieldDefinitionLoadSaveValidator);
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
typeValidatorMap.put(FieldDefinition[].class.getCanonicalName(), fieldDefinitionLoadSaveValidator);
loadSaveTester = new LoadSaveTester<>(testMetaClass, attributes, Collections.emptyList(), Collections.emptyList(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
use of org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class HTTPMetaLoadSaveTest method testLoadSaveRoundTrip.
@Before
public void testLoadSaveRoundTrip() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("url", "urlInField", "urlField", "encoding", "httpLogin", "httpPassword", "proxyHost", "proxyPort", "socketTimeout", "connectionTimeout", "closeIdleConnectionsTime", "argumentField", "argumentParameter", "headerField", "headerParameter", "fieldName", "resultCodeFieldName", "responseTimeFieldName", "responseHeaderFieldName");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
// Arrays need to be consistent length
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25);
fieldLoadSaveValidatorAttributeMap.put("argumentField", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("argumentParameter", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("headerField", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("headerParameter", stringArrayLoadSaveValidator);
loadSaveTester = new LoadSaveTester(HTTPMeta.class, attributes, new HashMap<String, String>(), new HashMap<String, String>(), fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
}
use of org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class IfNullMetaTest method setUp.
@Before
public void setUp() throws Exception {
List<String> attributes = Arrays.asList("fields", "valueTypes", "selectFields", "selectValuesType", "replaceAllByValue", "replaceAllMask", "setEmptyStringAll");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("fields", "getFields");
put("valueTypes", "getValueTypes");
put("selectFields", "isSelectFields");
put("selectValuesType", "isSelectValuesType");
put("replaceAllByValue", "getReplaceAllByValue");
put("replaceAllMask", "getReplaceAllMask");
put("setEmptyStringAll", "isSetEmptyStringAll");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("fields", "setFields");
put("valueTypes", "setValueTypes");
put("selectFields", "setSelectFields");
put("selectValuesType", "setSelectValuesType");
put("replaceAllByValue", "setReplaceAllByValue");
put("replaceAllMask", "setReplaceAllMask");
put("setEmptyStringAll", "setEmptyStringAll");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 3);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldName", stringArrayLoadSaveValidator);
attrValidatorMap.put("replaceValue", stringArrayLoadSaveValidator);
attrValidatorMap.put("typeName", stringArrayLoadSaveValidator);
attrValidatorMap.put("typereplaceValue", stringArrayLoadSaveValidator);
attrValidatorMap.put("typereplaceMask", stringArrayLoadSaveValidator);
attrValidatorMap.put("replaceMask", stringArrayLoadSaveValidator);
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
typeValidatorMap.put(boolean[].class.getCanonicalName(), new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 3));
Fields field = new Fields();
field.setFieldName("fieldName");
field.setReplaceValue("replaceValue");
field.setReplaceMask("replaceMask");
field.setEmptyString(true);
typeValidatorMap.put(Fields[].class.getCanonicalName(), new ArrayLoadSaveValidator<Fields>(new FieldsLoadSaveValidator(field), 3));
ValueTypes type = new ValueTypes();
type.setTypeName("typeName");
type.setTypereplaceValue("typereplaceValue");
type.setTypereplaceMask("typereplaceMask");
type.setTypeEmptyString(true);
typeValidatorMap.put(ValueTypes[].class.getCanonicalName(), new ArrayLoadSaveValidator<ValueTypes>(new ValueTypesLoadSaveValidator(type), 3));
loadSaveTester = new LoadSaveTester(IfNullMeta.class, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap);
}
Aggregations