use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class DatabaseJoinMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("sql", "rowLimit", "outerJoin", "variableReplace", "databaseMeta", "parameterField", "parameterType");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("parameterField", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5));
attrValidatorMap.put("parameterType", new PrimitiveIntArrayLoadSaveValidator(new NonZeroIntLoadSaveValidator(7), 5));
attrValidatorMap.put("databaseMeta", new DatabaseMetaLoadSaveValidator());
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 GPLoadMetaTest method testRoundTrip.
@Test
public void testRoundTrip() throws KettleException {
List<String> attributes = Arrays.asList("localHosts", "localhostPort", "schemaName", "tableName", "errorTableName", "gploadPath", "controlFile", "dataFile", "logFile", "nullAs", "databaseMeta", "fieldTable", "fieldStream", "matchColumn", "updateColumn", "dateMask", "maxErrors", "loadMethod", "loadAction", "encoding", "eraseFiles", "encloseNumbers", "delimiter", "updateCondition");
Map<String, String> getterMap = new HashMap<>();
Map<String, String> setterMap = new HashMap<>();
for (String attribute : attributes) {
if (attribute.equals("eraseFiles")) {
getterMap.put("eraseFiles", "isEraseFiles");
} else {
getterMap.put(attribute, "get" + attribute.substring(0, 1).toUpperCase() + attribute.substring(1));
}
if (attribute.equals("matchColumn")) {
setterMap.put("matchColumn", "setMatchColumns");
} else {
setterMap.put(attribute, "set" + attribute.substring(0, 1).toUpperCase() + attribute.substring(1));
}
}
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<>();
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorTypeMap = new HashMap<>();
fieldLoadSaveValidatorAttributeMap.put("dateMask", new ArrayLoadSaveValidator<>(new DateMaskLoadSaveValidator(), 10));
fieldLoadSaveValidatorTypeMap.put(DatabaseMeta.class.getCanonicalName(), new DatabaseMetaFieldLoadSaveValidator());
fieldLoadSaveValidatorTypeMap.put(String[].class.getCanonicalName(), new ArrayLoadSaveValidator<>(new StringLoadSaveValidator(), 10));
fieldLoadSaveValidatorTypeMap.put(boolean[].class.getCanonicalName(), new PrimitiveBooleanArrayLoadSaveValidator(new BooleanLoadSaveValidator(), 10));
LoadSaveTester loadSaveTester = new LoadSaveTester(GPLoadMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, fieldLoadSaveValidatorTypeMap);
loadSaveTester.testRepoRoundTrip();
loadSaveTester.testXmlRoundTrip();
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class JobEntryMailLoadSaveTest method createAttributeValidatorsMap.
@Override
protected Map<String, FieldLoadSaveValidator<?>> createAttributeValidatorsMap() {
Map<String, FieldLoadSaveValidator<?>> validators = new HashMap<String, FieldLoadSaveValidator<?>>();
validators.put("fileType", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(ResultFile.fileTypeCode.length)));
int entries = new Random().nextInt(20) + 1;
validators.put("embeddedimages", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), entries));
validators.put("contentids", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), entries));
return validators;
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class JobEntrySetVariablesLoadSaveTest method createAttributeValidatorsMap.
@Override
protected Map<String, FieldLoadSaveValidator<?>> createAttributeValidatorsMap() {
Map<String, FieldLoadSaveValidator<?>> validators = new HashMap<String, FieldLoadSaveValidator<?>>();
validators.put("fileVariableType", new IntLoadSaveValidator(JobEntrySetVariables.variableTypeCode.length));
int count = new Random().nextInt(50) + 1;
validators.put("variableName", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
validators.put("variableValue", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
validators.put("variableType", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(JobEntryPGPEncryptFiles.actionTypeCodes.length), count));
return validators;
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class ValueMapperMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 7);
init(stringArrayLoadSaveValidator, stringArrayLoadSaveValidator);
}
Aggregations