use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class JobEntryPGPEncryptFilesLoadSaveTest method createAttributeValidatorsMap.
@Override
protected Map<String, FieldLoadSaveValidator<?>> createAttributeValidatorsMap() {
Map<String, FieldLoadSaveValidator<?>> validators = new HashMap<String, FieldLoadSaveValidator<?>>();
int count = new Random().nextInt(50) + 1;
validators.put("action_type", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(JobEntryPGPEncryptFiles.actionTypeCodes.length), count));
validators.put("source_filefolder", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
validators.put("userid", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
validators.put("destination_filefolder", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
validators.put("wildcard", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), count));
return validators;
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class CombinationLookupMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
List<String> attributes = Arrays.asList("schemaName", "tableName", "databaseMeta", "replaceFields", "keyField", "keyLookup", "useHash", "hashField", "technicalKeyField", "sequenceFrom", "commitSize", "preloadCache", "cacheSize", "useAutoinc", "techKeyCreation", "lastUpdateField");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("replaceFields", "replaceFields");
put("useHash", "useHash");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("tableName", "setTablename");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("keyField", stringArrayLoadSaveValidator);
attrValidatorMap.put("keyLookup", stringArrayLoadSaveValidator);
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 CheckSumMetaTest method testSerialization.
@Test
public void testSerialization() throws KettleException {
List<String> attributes = Arrays.asList("FieldName", "ResultFieldName", "CheckSumType", "CompatibilityMode", "ResultType", "oldChecksumBehaviour", "fieldSeparatorString", "evaluationMethod");
Map<String, String> getterMap = new HashMap<>();
Map<String, String> setterMap = new HashMap<>();
getterMap.put("CheckSumType", "getTypeByDesc");
getterMap.put("evaluationMethod", "getEvaluationMethod");
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<>();
attrValidatorMap.put("FieldName", stringArrayLoadSaveValidator);
attrValidatorMap.put("CheckSumType", new IntLoadSaveValidator(CheckSumMeta.checksumtypeCodes.length));
attrValidatorMap.put("ResultType", new IntLoadSaveValidator(CheckSumMeta.resultTypeCode.length));
attrValidatorMap.put("evaluationMethod", new IntLoadSaveValidator(CheckSumMeta.EVALUATION_METHOD_CODES.length));
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<>();
LoadSaveTester<CheckSumMeta> loadSaveTester = new LoadSaveTester<>(CheckSumMeta.class, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class AnalyticQueryMetaTest method testRoundTrip.
@Test
public void testRoundTrip() throws KettleException {
List<String> attributes = Arrays.asList("groupField", "aggregateField", "subjectField", "aggregateType", "valueField");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> typeValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
Map<String, FieldLoadSaveValidator<?>> fieldValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldValidators.put("aggregateField", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldValidators.put("subjectField", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldValidators.put("aggregateType", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(AnalyticQueryMeta.typeGroupCode.length), 50));
fieldValidators.put("valueField", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 50));
LoadSaveTester loadSaveTester = new LoadSaveTester(AnalyticQueryMeta.class, attributes, getterMap, setterMap, fieldValidators, typeValidators);
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class OraBulkLoaderMetaTest method setUp.
@Before
public void setUp() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("schemaName", "tableName", "sqlldr", "controlFile", "dataFile", "logFile", "badFile", "discardFile", "commitSize", "bindSize", "readSize", "maxErrors", "loadMethod", "loadAction", "encoding", "characterSetName", "directPath", "eraseFiles", "dbNameOverride", "failOnWarning", "failOnError", "parallel", "altRecordTerm", "fieldTable", "fieldStream", "dateMask", "databaseMeta");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("schemaName", "getSchemaName");
put("tableName", "getTableName");
put("sqlldr", "getSqlldr");
put("controlFile", "getControlFile");
put("dataFile", "getDataFile");
put("logFile", "getLogFile");
put("badFile", "getBadFile");
put("discardFile", "getDiscardFile");
put("commitSize", "getCommitSize");
put("bindSize", "getBindSize");
put("readSize", "getReadSize");
put("maxErrors", "getMaxErrors");
put("loadMethod", "getLoadMethod");
put("loadAction", "getLoadAction");
put("encoding", "getEncoding");
put("characterSetName", "getCharacterSetName");
put("directPath", "isDirectPath");
put("eraseFiles", "isEraseFiles");
put("dbNameOverride", "getDbNameOverride");
put("failOnWarning", "isFailOnWarning");
put("failOnError", "isFailOnError");
put("parallel", "isParallel");
put("altRecordTerm", "getAltRecordTerm");
put("fieldTable", "getFieldTable");
put("fieldStream", "getFieldStream");
put("dateMask", "getDateMask");
put("databaseMeta", "getDatabaseMeta");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("schemaName", "setSchemaName");
put("tableName", "setTableName");
put("sqlldr", "setSqlldr");
put("controlFile", "setControlFile");
put("dataFile", "setDataFile");
put("logFile", "setLogFile");
put("badFile", "setBadFile");
put("discardFile", "setDiscardFile");
put("commitSize", "setCommitSize");
put("bindSize", "setBindSize");
put("readSize", "setReadSize");
put("maxErrors", "setMaxErrors");
put("loadMethod", "setLoadMethod");
put("loadAction", "setLoadAction");
put("encoding", "setEncoding");
put("characterSetName", "setCharacterSetName");
put("directPath", "setDirectPath");
put("eraseFiles", "setEraseFiles");
put("dbNameOverride", "setDbNameOverride");
put("failOnWarning", "setFailOnWarning");
put("failOnError", "setFailOnError");
put("parallel", "setParallel");
put("altRecordTerm", "setAltRecordTerm");
put("fieldTable", "setFieldTable");
put("fieldStream", "setFieldStream");
put("dateMask", "setDateMask");
put("databaseMeta", "setDatabaseMeta");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
FieldLoadSaveValidator<String[]> datemaskArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new DateMaskLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldTable", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldStream", stringArrayLoadSaveValidator);
attrValidatorMap.put("dateMask", datemaskArrayLoadSaveValidator);
attrValidatorMap.put("databaseMeta", new DatabaseMetaLoadSaveValidator());
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
// typeValidatorMap.put( int[].class.getCanonicalName(), new PrimitiveIntArrayLoadSaveValidator( new IntLoadSaveValidator(), 1 ) );
loadSaveTester = new LoadSaveTester(testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap);
}
Aggregations