use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class SystemDataMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("fieldName", "fieldType");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("fieldName", "getFieldName");
put("fieldType", "getFieldType");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("fieldName", "setFieldName");
put("fieldType", "setFieldType");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
FieldLoadSaveValidator<SystemDataTypes[]> sdtArrayLoadSaveValidator = new ArrayLoadSaveValidator<SystemDataTypes>(new SystemDataTypesLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldName", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldType", sdtArrayLoadSaveValidator);
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class SortedMergeMetaTest method testRoundTrips.
@Test
public void testRoundTrips() throws KettleException {
List<String> attributes = Arrays.asList("name", "ascending");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("name", "getFieldName");
getterMap.put("ascending", "getAscending");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("name", "setFieldName");
setterMap.put("ascending", "setAscending");
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);
fieldLoadSaveValidatorAttributeMap.put("name", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("ascending", booleanArrayLoadSaveValidator);
LoadSaveTester loadSaveTester = new LoadSaveTester(SortedMergeMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class FieldSplitterMetaTest method testRoundTrip.
@Test
public void testRoundTrip() throws KettleException {
List<String> attributes = Arrays.asList("splitfield", "delimiter", "enclosure", "name", "id", "idrem", "type", "format", "group", "decimal", "currency", "length", "precision", "nullif", "ifnull", "trimtype");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("splitfield", "getSplitField");
getterMap.put("delimiter", "getDelimiter");
getterMap.put("enclosure", "getEnclosure");
getterMap.put("name", "getFieldName");
getterMap.put("id", "getFieldID");
getterMap.put("idrem", "getFieldRemoveID");
getterMap.put("type", "getFieldType");
getterMap.put("format", "getFieldFormat");
getterMap.put("group", "getFieldGroup");
getterMap.put("decimal", "getFieldDecimal");
getterMap.put("currency", "getFieldCurrency");
getterMap.put("length", "getFieldLength");
getterMap.put("precision", "getFieldPrecision");
getterMap.put("nullif", "getFieldNullIf");
getterMap.put("ifnull", "getFieldIfNull");
getterMap.put("trimtype", "getFieldTrimType");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("splitfield", "setSplitField");
setterMap.put("delimiter", "setDelimiter");
setterMap.put("enclosure", "setEnclosure");
setterMap.put("name", "setFieldName");
setterMap.put("id", "setFieldID");
setterMap.put("idrem", "setFieldRemoveID");
setterMap.put("type", "setFieldType");
setterMap.put("format", "setFieldFormat");
setterMap.put("group", "setFieldGroup");
setterMap.put("decimal", "setFieldDecimal");
setterMap.put("currency", "setFieldCurrency");
setterMap.put("length", "setFieldLength");
setterMap.put("precision", "setFieldPrecision");
setterMap.put("nullif", "setFieldNullIf");
setterMap.put("ifnull", "setFieldIfNull");
setterMap.put("trimtype", "setFieldTrimType");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidatorAttributeMap.put("name", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("id", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("idrem", new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("type", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(ValueMetaFactory.getAllValueMetaNames().length), 5));
fieldLoadSaveValidatorAttributeMap.put("format", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("group", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("decimal", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("currency", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("length", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("precision", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("nullif", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("ifnull", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
fieldLoadSaveValidatorAttributeMap.put("trimtype", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(ValueMetaBase.getTrimTypeCodes().length), 5));
LoadSaveTester loadSaveTester = new LoadSaveTester(FieldSplitterMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class GetFilesRowsCountMetaTest method setUp.
@Before
public void setUp() throws Exception {
List<String> attributes = Arrays.asList("fileName", "fileMask", "excludeFileMask", "includeFilesCount", "filesCountFieldName", "rowsCountFieldName", "RowSeparator_format", "RowSeparator", "filefield", "isaddresult", "outputFilenameField", "fileRequired", "includeSubFolders", "smartCount");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("fileName", "getFileName");
put("fileMask", "getFileMask");
put("excludeFileMask", "getExcludeFileMask");
put("includeFilesCount", "includeCountFiles");
put("filesCountFieldName", "getFilesCountFieldName");
put("rowsCountFieldName", "getRowsCountFieldName");
put("RowSeparator_format", "getRowSeparatorFormat");
put("RowSeparator", "getRowSeparator");
put("filefield", "isFileField");
put("isaddresult", "isAddResultFile");
put("outputFilenameField", "getOutputFilenameField");
put("fileRequired", "getFileRequired");
put("includeSubFolders", "getIncludeSubFolders");
put("smartCount", "isSmartCount");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("fileName", "setFileName");
put("fileMask", "setFileMask");
put("excludeFileMask", "setExcludeFileMask");
put("includeFilesCount", "setIncludeCountFiles");
put("filesCountFieldName", "setFilesCountFieldName");
put("rowsCountFieldName", "setRowsCountFieldName");
put("RowSeparator_format", "setRowSeparatorFormat");
put("RowSeparator", "setRowSeparator");
put("filefield", "setFileField");
put("isaddresult", "setAddResultFile");
put("outputFilenameField", "setOutputFilenameField");
put("fileRequired", "setFileRequired");
put("includeSubFolders", "setIncludeSubFolders");
put("smartCount", "setSmartCount");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
FieldLoadSaveValidator<String[]> ynArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new YNLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fileName", stringArrayLoadSaveValidator);
attrValidatorMap.put("fileMask", stringArrayLoadSaveValidator);
attrValidatorMap.put("fileRequired", ynArrayLoadSaveValidator);
attrValidatorMap.put("includeSubFolders", ynArrayLoadSaveValidator);
attrValidatorMap.put("excludeFileMask", stringArrayLoadSaveValidator);
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
loadSaveTester = new LoadSaveTester(GetFilesRowsCountMeta.class, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class FuzzyMatchMetaTest method setUp.
@Before
public void setUp() throws Exception {
List<String> attributes = Arrays.asList("value", "valueName", "algorithm", "lookupfield", "mainstreamfield", "outputmatchfield", "outputvaluefield", "caseSensitive", "minimalValue", "maximalValue", "separator", "closervalue");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("value", "getValue");
put("valueName", "getValueName");
put("algorithm", "getAlgorithmType");
put("lookupfield", "getLookupField");
put("mainstreamfield", "getMainStreamField");
put("outputmatchfield", "getOutputMatchField");
put("outputvaluefield", "getOutputValueField");
put("caseSensitive", "isCaseSensitive");
put("minimalValue", "getMinimalValue");
put("maximalValue", "getMaximalValue");
put("separator", "getSeparator");
put("closervalue", "isGetCloserValue");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("value", "setValue");
put("valueName", "setValueName");
put("algorithm", "setAlgorithmType");
put("lookupfield", "setLookupField");
put("mainstreamfield", "setMainStreamField");
put("outputmatchfield", "setOutputMatchField");
put("outputvaluefield", "setOutputValueField");
put("caseSensitive", "setCaseSensitive");
put("minimalValue", "setMinimalValue");
put("maximalValue", "setMaximalValue");
put("separator", "setSeparator");
put("closervalue", "setGetCloserValue");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 3);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("value", stringArrayLoadSaveValidator);
attrValidatorMap.put("valueName", stringArrayLoadSaveValidator);
attrValidatorMap.put("algorithm", new AlgorithmLoadSaveValidator());
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
// typeValidatorMap.put( int[].class.getCanonicalName(), new PrimitiveIntArrayLoadSaveValidator( new IntLoadSaveValidator(), 3 ) );
loadSaveTester = new LoadSaveTester(FuzzyMatchMeta.class, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap);
}
Aggregations