use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester 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", "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.LoadSaveTester in project pentaho-kettle by pentaho.
the class MetaInjectMetaLoadSaveTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(true);
List<String> attributes = Arrays.asList("transName", "fileName", "directoryPath", "sourceStepName", "targetFile", "noExecution", "streamSourceStepname", "streamTargetStepname", "transObjectId", "specificationMethod", "sourceOutputFields");
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("transObjectId", new ObjectIdLoadSaveValidator());
attrValidatorMap.put("specificationMethod", new ObjectLocationSpecificationMethodLoadSaveValidator());
attrValidatorMap.put("sourceOutputFields", new ListLoadSaveValidator<MetaInjectOutputField>(new MetaInjectOutputFieldLoadSaveValidator(), 5));
//
// Note - these seem to be runtime-built and not persisted.
// attrValidatorMap.put( "metaInjectMapping",
// new ListLoadSaveValidator<MetaInjectMapping>( new MetaInjectMappingLoadSaveValidator(), 5 ) );
// attrValidatorMap.put( "targetSourceMapping",
// new MapLoadSaveValidator<TargetStepAttribute, SourceStepField>(
// new TargetStepAttributeLoadSaveValidator(),
// new SourceStepFieldLoadSaveValidator(),
// 5 ) );
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.LoadSaveTester 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.LoadSaveTester in project pentaho-kettle by pentaho.
the class RowsFromResultMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("fieldname", "type", "length", "precision");
Map<String, String> getterMap = new HashMap<String, String>();
Map<String, String> setterMap = new HashMap<String, String>();
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldname", stringArrayLoadSaveValidator);
attrValidatorMap.put("type", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(7), 5));
attrValidatorMap.put("length", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(100), 5));
attrValidatorMap.put("precision", new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(9), 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.LoadSaveTester in project pentaho-kettle by pentaho.
the class RssInputMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("includeRowNumber", "rowNumberField", "includeUrl", "urlField", "rowLimit", "readfrom", "urlInField", "urlFieldname", "url", "inputFields");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("includeRowNumber", "includeRowNumber");
put("rowNumberField", "getRowNumberField");
put("includeUrl", "includeUrl");
put("urlField", "geturlField");
put("rowLimit", "getRowLimit");
put("readfrom", "getReadFrom");
put("urlInField", "urlInField");
put("urlFieldname", "getUrlFieldname");
put("url", "getUrl");
put("inputFields", "getInputFields");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("includeRowNumber", "setIncludeRowNumber");
put("rowNumberField", "setRowNumberField");
put("includeUrl", "setIncludeUrl");
put("urlField", "seturlField");
put("rowLimit", "setRowLimit");
put("readfrom", "setReadFrom");
put("urlInField", "seturlInField");
put("urlFieldname", "setUrlFieldname");
put("url", "setUrl");
put("inputFields", "setInputFields");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
FieldLoadSaveValidator<RssInputField[]> rssInputFieldArrayLoadSaveValidator = new ArrayLoadSaveValidator<RssInputField>(new RssInputFieldLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("url", stringArrayLoadSaveValidator);
attrValidatorMap.put("inputFields", rssInputFieldArrayLoadSaveValidator);
Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
Aggregations