use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester in project pentaho-kettle by pentaho.
the class FormulaMetaTest method testStepMeta.
@Test
public void testStepMeta() throws KettleException {
List<String> attributes = Arrays.asList("formula");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("formula", "getFormula");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("formula", "setFormula");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
FieldLoadSaveValidator<FormulaMetaFunction[]> formulaMetaFunctionArrayLoadSaveValidator = new ArrayLoadSaveValidator<FormulaMetaFunction>(new FormulaMetaFunctionFieldLoadSaveValidator(), 25);
fieldLoadSaveValidatorAttributeMap.put("formula", formulaMetaFunctionArrayLoadSaveValidator);
LoadSaveTester loadSaveTester = new LoadSaveTester(FormulaMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester 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);
}
use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester 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.LoadSaveTester in project pentaho-kettle by pentaho.
the class UniqueRowsMetaTest method testRoundTrip.
@Test
public void testRoundTrip() throws KettleException {
List<String> attributes = Arrays.asList("count_rows", "count_field", "reject_duplicate_row", "error_description", "name", "case_insensitive");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("count_rows", "isCountRows");
getterMap.put("count_field", "getCountField");
getterMap.put("reject_duplicate_row", "isRejectDuplicateRow");
getterMap.put("error_description", "getErrorDescription");
getterMap.put("name", "getCompareFields");
getterMap.put("case_insensitive", "getCaseInsensitive");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("count_rows", "setCountRows");
setterMap.put("count_field", "setCountField");
setterMap.put("reject_duplicate_row", "setRejectDuplicateRow");
setterMap.put("error_description", "setErrorDescription");
setterMap.put("name", "setCompareFields");
setterMap.put("case_insensitive", "setCaseInsensitive");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
// Arrays need to be consistent length
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25);
FieldLoadSaveValidator<boolean[]> booleanArrayLoadSaveValidator = new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 25);
fieldLoadSaveValidatorAttributeMap.put("name", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("case_insensitive", booleanArrayLoadSaveValidator);
LoadSaveTester loadSaveTester = new LoadSaveTester(UniqueRowsMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester in project pentaho-kettle by pentaho.
the class UnivariateStatsMetaTest method loadSaveRoundTripTest.
@Test
public void loadSaveRoundTripTest() throws KettleException {
List<String> attributes = Arrays.asList("inputFieldMetaFunctions");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorTypeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidatorTypeMap.put(UnivariateStatsMetaFunction[].class.getCanonicalName(), univariateFunctionArrayFieldLoadSaveValidator);
LoadSaveTester loadSaveTester = new LoadSaveTester(UnivariateStatsMeta.class, attributes, new HashMap<String, String>(), new HashMap<String, String>(), new HashMap<String, FieldLoadSaveValidator<?>>(), fieldLoadSaveValidatorTypeMap);
loadSaveTester.testSerialization();
}
Aggregations