use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.
the class NormalizerMetaTest method loadSaveTest.
@Test
public void loadSaveTest() throws KettleException {
List<String> attributes = Arrays.asList("normaliserFields");
NormaliserField testField = new NormaliserField();
testField.setName("TEST_NAME");
testField.setValue("TEST_VALUE");
testField.setNorm("TEST");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorTypeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidatorTypeMap.put(NormaliserField[].class.getCanonicalName(), new ArrayLoadSaveValidator<NormaliserField>(new NormaliserFieldLoadSaveValidator(testField), 50));
LoadSaveTester<NormaliserMeta> tester = new LoadSaveTester<NormaliserMeta>(NormaliserMeta.class, attributes, new HashMap<String, String>(), new HashMap<String, String>(), new HashMap<String, FieldLoadSaveValidator<?>>(), fieldLoadSaveValidatorTypeMap);
tester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.
the class NumberRangeMetaTest method testStepMeta.
@Test
public void testStepMeta() throws KettleException {
List<String> attributes = Arrays.asList("inputField", "outputField", "fallBackValue", "rules");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("inputField", "getInputField");
getterMap.put("outputField", "getOutputField");
getterMap.put("fallBackValue", "getFallBackValue");
getterMap.put("rules", "getRules");
Map<String, String> setterMap = new HashMap<String, String>();
setterMap.put("inputField", "setInputField");
setterMap.put("outputField", "setOutputField");
setterMap.put("fallBackValue", "setFallBackValue");
setterMap.put("rules", "setRules");
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidatorAttributeMap.put("rules", new ListLoadSaveValidator<NumberRangeRule>(new NumberRangeRuleFieldLoadSaveValidator(), 25));
LoadSaveTester loadSaveTester = new LoadSaveTester(NumberRangeMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator 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);
}
use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.
the class PGPDecryptStreamMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("gPGLocation", "passphrase", "passphraseFieldName", "passphraseFieldName", "streamField", "resultFieldName");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
loadSaveTester = new LoadSaveTester(testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap);
}
use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.
the class ProcessFilesMetaTest method testSerialization.
@Test
public void testSerialization() throws KettleException {
List<String> attributes = Arrays.asList("DynamicSourceFileNameField", "DynamicTargetFileNameField", "OperationType", "AddTargetFileNameToResult", "OverwriteTargetFile", "CreateParentFolder", "Simulate");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> attributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attributeMap.put("OperationType", new IntLoadSaveValidator(ProcessFilesMeta.operationTypeCode.length));
Map<String, FieldLoadSaveValidator<?>> typeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
LoadSaveTester<ProcessFilesMeta> tester = new LoadSaveTester<ProcessFilesMeta>(ProcessFilesMeta.class, attributes, getterMap, setterMap, attributeMap, typeMap);
tester.testSerialization();
}
Aggregations