use of org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntegerArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class ReplaceStringMetaTest method testRoundTrips.
@Test
public void testRoundTrips() throws KettleException {
List<String> attributes = Arrays.asList("in_stream_name", "out_stream_name", "use_regex", "replace_string", "replace_by_string", "set_empty_string", "replace_field_by_string", "whole_word", "case_sensitive", "is_unicode");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("in_stream_name", "getFieldInStream");
getterMap.put("out_stream_name", "getFieldOutStream");
getterMap.put("use_regex", "getUseRegEx");
getterMap.put("replace_string", "getReplaceString");
getterMap.put("replace_by_string", "getReplaceByString");
getterMap.put("set_empty_string", "isSetEmptyString");
getterMap.put("replace_field_by_string", "getFieldReplaceByString");
getterMap.put("whole_word", "getWholeWord");
getterMap.put("case_sensitive", "getCaseSensitive");
getterMap.put("is_unicode", "isUnicode");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("in_stream_name", "setFieldInStream");
setterMap.put("out_stream_name", "setFieldOutStream");
setterMap.put("use_regex", "setUseRegEx");
setterMap.put("replace_string", "setReplaceString");
setterMap.put("replace_by_string", "setReplaceByString");
setterMap.put("set_empty_string", "setEmptyString");
setterMap.put("replace_field_by_string", "setFieldReplaceByString");
setterMap.put("whole_word", "setWholeWord");
setterMap.put("case_sensitive", "setCaseSensitive");
setterMap.put("is_unicode", "setIsUnicode");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25);
FieldLoadSaveValidator<boolean[]> booleanArrayLoadSaveValidator = new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 25);
FieldLoadSaveValidator<int[]> useRegExArrayLoadSaveValidator = new PrimitiveIntegerArrayLoadSaveValidator(new IntLoadSaveValidator(ReplaceStringMeta.useRegExCode.length), 25);
FieldLoadSaveValidator<int[]> wholeWordArrayLoadSaveValidator = new PrimitiveIntegerArrayLoadSaveValidator(new IntLoadSaveValidator(ReplaceStringMeta.wholeWordCode.length), 25);
FieldLoadSaveValidator<int[]> caseSensitiveArrayLoadSaveValidator = new PrimitiveIntegerArrayLoadSaveValidator(new IntLoadSaveValidator(ReplaceStringMeta.caseSensitiveCode.length), 25);
FieldLoadSaveValidator<int[]> isUnicodeArrayLoadSaveValidator = new PrimitiveIntegerArrayLoadSaveValidator(new IntLoadSaveValidator(ReplaceStringMeta.isUnicodeCode.length), 25);
fieldLoadSaveValidatorAttributeMap.put("in_stream_name", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("out_stream_name", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("use_regex", useRegExArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("replace_string", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("replace_by_string", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("set_empty_string", booleanArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("replace_field_by_string", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("whole_word", wholeWordArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("case_sensitive", caseSensitiveArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("is_unicode", isUnicodeArrayLoadSaveValidator);
LoadSaveTester loadSaveTester = new LoadSaveTester(ReplaceStringMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testSerialization();
}
Aggregations