use of org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator 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.PrimitiveIntArrayLoadSaveValidator 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.PrimitiveIntArrayLoadSaveValidator 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);
}
use of org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class JobEntryCheckDbConnectionsLoadSaveTest method createAttributeValidatorsMap.
@Override
protected Map<String, FieldLoadSaveValidator<?>> createAttributeValidatorsMap() {
Map<String, FieldLoadSaveValidator<?>> validators = new HashMap<String, FieldLoadSaveValidator<?>>();
int entries = new Random().nextInt(10) + 1;
validators.put("connections", new ArrayLoadSaveValidator<DatabaseMeta>(new DatabaseMetaLoadSaveValidator(), entries));
validators.put("waitfors", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), entries));
validators.put("waittimes", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(JobEntryCheckDbConnections.unitTimeCode.length), entries));
return validators;
}
use of org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator in project pentaho-kettle by pentaho.
the class ConstantMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("currency", "decimal", "group", "value", "fieldName", "fieldType", "fieldFormat", "fieldLength", "fieldPrecision", "setEmptyString");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("setEmptyString", "isSetEmptyString");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("setEmptyString", "setEmptyString");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
PrimitiveIntArrayLoadSaveValidator intArrayLoadSaveValidator = new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 5);
PrimitiveBooleanArrayLoadSaveValidator booleanArrayLoadSaveValidator = new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("currency", stringArrayLoadSaveValidator);
attrValidatorMap.put("decimal", stringArrayLoadSaveValidator);
attrValidatorMap.put("group", stringArrayLoadSaveValidator);
attrValidatorMap.put("value", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldName", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldType", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldFormat", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldLength", intArrayLoadSaveValidator);
attrValidatorMap.put("fieldPrecision", intArrayLoadSaveValidator);
attrValidatorMap.put("setEmptyString", booleanArrayLoadSaveValidator);
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
loadSaveTester = new LoadSaveTester<ConstantMeta>(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
Aggregations