use of org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class SetValueFieldMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("fieldName", "replaceByFieldValue");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("fieldName", "getFieldName");
put("replaceByFieldValue", "getReplaceByFieldValue");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("fieldName", "setFieldName");
put("replaceByFieldValue", "setReplaceByFieldValue");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldName", stringArrayLoadSaveValidator);
attrValidatorMap.put("replaceByFieldValue", stringArrayLoadSaveValidator);
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.ArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class SetVariableMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("fieldName", "variableName", "variableType", "defaultValue", "usingFormatting");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("fieldName", "getFieldName");
put("variableName", "getVariableName");
put("variableType", "getVariableType");
put("defaultValue", "getDefaultValue");
put("usingFormatting", "isUsingFormatting");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("fieldName", "setFieldName");
put("variableName", "setVariableName");
put("variableType", "setVariableType");
put("defaultValue", "setDefaultValue");
put("usingFormatting", "setUsingFormatting");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldName", stringArrayLoadSaveValidator);
attrValidatorMap.put("variableName", stringArrayLoadSaveValidator);
attrValidatorMap.put("defaultValue", stringArrayLoadSaveValidator);
// 4 variable types
attrValidatorMap.put("variableType", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(4), 5));
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.ArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class SortRowsMetaTest method testRoundTrips.
/**
* Replaced previous testRep with load/save tester. Should cover http://jira.pentaho.com/browse/BACKLOG-377
* @throws KettleException
*/
@Test
public void testRoundTrips() throws KettleException {
List<String> attributes = Arrays.asList("Directory", "Prefix", "SortSize", "FreeMemoryLimit", "CompressFiles", "CompressFilesVariable", "OnlyPassingUniqueRows", "FieldName", "Ascending", "CaseSensitive", "CollatorEnabled", "CollatorStrength", "PreSortedField");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
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[]> intArrayLoadSaveValidator = new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 25);
fieldLoadSaveValidatorAttributeMap.put("FieldName", stringArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("Ascending", booleanArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("CaseSensitive", booleanArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("CollatorEnabled", booleanArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("CollatorStrength", intArrayLoadSaveValidator);
fieldLoadSaveValidatorAttributeMap.put("PreSortedField", booleanArrayLoadSaveValidator);
LoadSaveTester<SortRowsMeta> loadSaveTester = new LoadSaveTester<>(SortRowsMeta.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 ExecSQLMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("databaseMeta", "sql", "executedEachInputRow", "updateField", "insertField", "deleteField", "readField", "singleStatement", "replaceVariables", "quoteString", "params", "arguments");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("replaceVariables", "setVariableReplacementActive");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("arguments", stringArrayLoadSaveValidator);
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.ArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class StringOperationsMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("padLen", "padChar", "fieldInStream", "fieldOutStream", "trimType", "lowerUpper", "initCap", "maskXML", "digits", "removeSpecialCharacters", "paddingType");
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("padLen", stringArrayLoadSaveValidator);
attrValidatorMap.put("padChar", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldInStream", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldOutStream", stringArrayLoadSaveValidator);
attrValidatorMap.put("trimType", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(4), 5));
attrValidatorMap.put("lowerUpper", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(StringOperationsMeta.lowerUpperCode.length), 5));
attrValidatorMap.put("initCap", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(StringOperationsMeta.initCapCode.length), 5));
attrValidatorMap.put("maskXML", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(StringOperationsMeta.maskXMLCode.length), 5));
attrValidatorMap.put("digits", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(StringOperationsMeta.digitsCode.length), 5));
attrValidatorMap.put("removeSpecialCharacters", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(StringOperationsMeta.removeSpecialCharactersCode.length), 5));
attrValidatorMap.put("paddingType", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(StringOperationsMeta.paddingCode.length), 5));
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), new HashMap<String, String>(), new HashMap<String, String>(), attrValidatorMap, typeValidatorMap, this);
}
Aggregations