use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class CsvInputMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("BufferSize", "Delimiter", "Enclosure", "Encoding", "Filename", "FilenameField", "InputFields", "RowNumField", "AddResultFile", "HeaderPresent", "IncludingFilename", "LazyConversionActive", "NewlinePossibleInFields", "RunningInParallel");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("hasHeader", "hasHeader");
put("includeFilename", "includeFilename");
put("includeRowNumber", "includeRowNumber");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("includeFilename", "includeFilename");
put("includeRowNumber", "includeRowNumber");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("InputFields", new ArrayLoadSaveValidator<TextFileInputField>(new TextFileInputFieldValidator(), 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.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class JsonInputMetaLoadSaveTest method testLoadSave.
@Test
public void testLoadSave() throws KettleException {
List<String> attributes = Arrays.asList("includeFilename", "filenameField", "includeRowNumber", "addResultFile", "ReadUrl", "removeSourceField", "IgnoreEmptyFile", "doNotFailIfNoFile", "ignoreMissingPath", "defaultPathLeafToNull", "rowNumberField", "FileName", "FileMask", "ExcludeFileMask", "FileRequired", "IncludeSubFolders", "InputFields", "rowLimit", "inFields", "isAFile", "FieldValue", "ShortFileNameField", "PathField", "HiddenField", "LastModificationDateField", "UriField", "UriField", "ExtensionField", "SizeField");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
getterMap.put("includeFilename", "includeFilename");
getterMap.put("includeRowNumber", "includeRowNumber");
getterMap.put("addResultFile", "addResultFile");
setterMap.put("HiddenField", "setIsHiddenField");
Map<String, FieldLoadSaveValidator<?>> attributesMap = new HashMap<String, FieldLoadSaveValidator<?>>();
FieldLoadSaveValidator<?> fileStringArrayValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), FILE_COUNT);
attributesMap.put("FileName", fileStringArrayValidator);
attributesMap.put("FileMask", fileStringArrayValidator);
attributesMap.put("ExcludeFileMask", fileStringArrayValidator);
attributesMap.put("FileRequired", fileStringArrayValidator);
attributesMap.put("IncludeSubFolders", fileStringArrayValidator);
Map<String, FieldLoadSaveValidator<?>> typeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
typeMap.put(JsonInputField.class.getCanonicalName(), new ArrayLoadSaveValidator<JsonInputField>(new JsonInputFieldValidator()));
typeMap.put(JsonInputField[].class.getCanonicalName(), new ArrayLoadSaveValidator<JsonInputField>(new JsonInputFieldValidator()));
LoadSaveTester tester = new LoadSaveTester(JsonInputMeta.class, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attributesMap, typeMap, this);
tester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class AccessInputMetaTest method testRoundTrip.
@Test
public void testRoundTrip() throws KettleException {
List<String> attributes = Arrays.asList("includeFilename", "filenameField", "includeTablename", "dynamicFilenameField", "tablenameField", "includeRowNumber", "addResultFile", "fileField", "rowNumberField", "resetRowNumber", "tableName", "fileName", "fileMask", "excludeFileMask", "fileRequired", "includeSubFolders", "inputFields", "rowLimit", "shortFileNameField", "pathField", "hiddenField", "lastModificationDateField", "uriField", "rootUriField", "extensionField", "sizeField");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
FieldLoadSaveValidator<?> stringArrayValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50);
FieldLoadSaveValidator<?> fileRequiredArrayValidator = new ArrayLoadSaveValidator<String>(new FileRequiredLoadSaveValidator(), 50);
FieldLoadSaveValidator<?> inputFieldArrayValidator = new ArrayLoadSaveValidator<AccessInputField>(new AccessInputFieldLoadSaveValidator(), 100);
Map<String, FieldLoadSaveValidator<?>> typeValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
Map<String, FieldLoadSaveValidator<?>> fieldValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldValidators.put("fileName", stringArrayValidator);
fieldValidators.put("fileMask", stringArrayValidator);
fieldValidators.put("excludeFileMask", stringArrayValidator);
fieldValidators.put("fileRequired", fileRequiredArrayValidator);
fieldValidators.put("includeSubFolders", stringArrayValidator);
fieldValidators.put("inputFields", inputFieldArrayValidator);
LoadSaveTester<AccessInputMeta> loadSaveTester = new LoadSaveTester<AccessInputMeta>(AccessInputMeta.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 SalesforceDeleteMetaTest method testLoadSave.
@Test
public void testLoadSave() throws KettleException {
List<String> attributes = new ArrayList<String>();
attributes.addAll(SalesforceMetaTest.getDefaultAttributes());
attributes.addAll(Arrays.asList("deleteField", "batchSize", "rollbackAllChangesOnError"));
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidators.put("updateLookup", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("updateStream", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("useExternalId", new ArrayLoadSaveValidator<Boolean>(new BooleanLoadSaveValidator(), 50));
LoadSaveTester loadSaveTester = new LoadSaveTester(SalesforceDeleteMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidators, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testRepoRoundTrip();
loadSaveTester.testXmlRoundTrip();
}
use of org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator in project pentaho-kettle by pentaho.
the class SalesforceUpdateMetaTest method testSalesforceUpdateMeta.
@Test
public void testSalesforceUpdateMeta() throws KettleException {
List<String> attributes = new ArrayList<String>();
attributes.addAll(SalesforceMetaTest.getDefaultAttributes());
attributes.addAll(Arrays.asList("batchSize", "updateLookup", "updateStream", "useExternalId", "rollbackAllChangesOnError"));
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidators = new HashMap<String, FieldLoadSaveValidator<?>>();
fieldLoadSaveValidators.put("updateLookup", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("updateStream", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 50));
fieldLoadSaveValidators.put("useExternalId", new ArrayLoadSaveValidator<Boolean>(new BooleanLoadSaveValidator(), 50));
LoadSaveTester loadSaveTester = new LoadSaveTester(SalesforceUpdateMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidators, new HashMap<String, FieldLoadSaveValidator<?>>());
loadSaveTester.testRepoRoundTrip();
loadSaveTester.testXmlRoundTrip();
}
Aggregations