use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester in project pentaho-kettle by pentaho.
the class UpdateMetaTest method setUp.
@Before
public void setUp() throws KettleException {
KettleEnvironment.init();
PluginRegistry.init(false);
TransMeta transMeta = new TransMeta();
transMeta.setName("delete1");
Map<String, String> vars = new HashMap<String, String>();
vars.put("max.sz", "10");
transMeta.injectVariables(vars);
umi = new UpdateMeta();
ud = new UpdateData();
PluginRegistry plugReg = PluginRegistry.getInstance();
String deletePid = plugReg.getPluginId(StepPluginType.class, umi);
stepMeta = new StepMeta(deletePid, "delete", umi);
Trans trans = new Trans(transMeta);
transMeta.addStep(stepMeta);
mockHelper = new StepMockHelper<>("Update", UpdateMeta.class, UpdateData.class);
Mockito.when(mockHelper.logChannelInterfaceFactory.create(Mockito.any(), Mockito.any(LoggingObjectInterface.class))).thenReturn(mockHelper.logChannelInterface);
upd = new Update(stepMeta, ud, 1, transMeta, trans);
upd.copyVariablesFrom(transMeta);
List<String> attributes = Arrays.asList("schemaName", "tableName", "commitSize", "errorIgnored", "ignoreFlagField", "skipLookup", "useBatchUpdate", "keyStream", "keyLookup", "keyCondition", "keyStream2", "updateLookup", "updateStream", "databaseMeta");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("schemaName", "getSchemaName");
put("tableName", "getTableName");
put("commitSize", "getCommitSizeVar");
put("errorIgnored", "isErrorIgnored");
put("ignoreFlagField", "getIgnoreFlagField");
put("skipLookup", "isSkipLookup");
put("useBatchUpdate", "useBatchUpdate");
put("keyStream", "getKeyStream");
put("keyLookup", "getKeyLookup");
put("keyCondition", "getKeyCondition");
put("keyStream2", "getKeyStream2");
put("updateLookup", "getUpdateLookup");
put("updateStream", "getUpdateStream");
put("databaseMeta", "getDatabaseMeta");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("schemaName", "setSchemaName");
put("tableName", "setTableName");
put("commitSize", "setCommitSize");
put("errorIgnored", "setErrorIgnored");
put("ignoreFlagField", "setIgnoreFlagField");
put("skipLookup", "setSkipLookup");
put("useBatchUpdate", "setUseBatchUpdate");
put("keyStream", "setKeyStream");
put("keyLookup", "setKeyLookup");
put("keyCondition", "setKeyCondition");
put("keyStream2", "setKeyStream2");
put("updateLookup", "setUpdateLookup");
put("updateStream", "setUpdateStream");
put("databaseMeta", "setDatabaseMeta");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("keyStream", stringArrayLoadSaveValidator);
attrValidatorMap.put("keyLookup", stringArrayLoadSaveValidator);
attrValidatorMap.put("keyCondition", stringArrayLoadSaveValidator);
attrValidatorMap.put("keyStream2", stringArrayLoadSaveValidator);
attrValidatorMap.put("updateLookup", stringArrayLoadSaveValidator);
attrValidatorMap.put("updateStream", 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.LoadSaveTester in project pentaho-kettle by pentaho.
the class WebServiceAvailableMetaTest method testLoadSave.
@Test
public void testLoadSave() throws KettleException {
List<String> attributes = Arrays.asList("URLField", "ConnectTimeOut", "ReadTimeOut", "ResultFieldName");
LoadSaveTester loadSaveTester = new LoadSaveTester(WebServiceAvailableMeta.class, attributes);
loadSaveTester.testSerialization();
}
use of org.pentaho.di.trans.steps.loadsave.LoadSaveTester in project pentaho-kettle by pentaho.
the class WriteToLogMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("displayHeader", "limitRows", "limitRowsNumber", "logmessage", "loglevel", "fieldName");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("displayHeader", "isdisplayHeader");
put("limitRows", "isLimitRows");
put("limitRowsNumber", "getLimitRowsNumber");
put("logmessage", "getLogMessage");
put("loglevel", "getLogLevelString");
put("fieldName", "getFieldName");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("displayHeader", "setdisplayHeader");
put("limitRows", "setLimitRows");
put("limitRowsNumber", "setLimitRowsNumber");
put("logmessage", "setLogMessage");
put("loglevel", "setLogLevelString");
put("fieldName", "setFieldName");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fieldName", stringArrayLoadSaveValidator);
attrValidatorMap.put("loglevel", new LogLevelLoadSaveValidator());
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 XBaseInputMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("dbfFileName", "rowLimit", "rowNrAdded", "rowNrField", "acceptingFilenames", "acceptingField", "acceptingStepName", "includeFilename", "filenameField", "charactersetName");
Map<String, String> getterMap = new HashMap<String, String>();
getterMap.put("includeFilename", "includeFilename");
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.LoadSaveTester in project pentaho-kettle by pentaho.
the class YamlInputMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("includeFilename", "filenameField", "includeRowNumber", "rowNumberField", "rowLimit", "encoding", "yamlField", "inFields", "IsAFile", "addResultFile", "validating", "IsIgnoreEmptyFile", "doNotFailIfNoFile", "fileName", "fileMask", "fileRequired", "includeSubFolders", "inputFields");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("includeFilename", "includeFilename");
put("filenameField", "getFilenameField");
put("includeRowNumber", "includeRowNumber");
put("rowNumberField", "getRowNumberField");
put("rowLimit", "getRowLimit");
put("encoding", "getEncoding");
put("yamlField", "getYamlField");
put("inFields", "isInFields");
put("IsAFile", "getIsAFile");
put("addResultFile", "addResultFile");
put("validating", "isValidating");
put("IsIgnoreEmptyFile", "isIgnoreEmptyFile");
put("doNotFailIfNoFile", "isdoNotFailIfNoFile");
put("fileName", "getFileName");
put("fileMask", "getFileMask");
put("fileRequired", "getFileRequired");
put("includeSubFolders", "getIncludeSubFolders");
put("inputFields", "getInputFields");
}
};
Map<String, String> setterMap = new HashMap<String, String>() {
{
put("includeFilename", "setIncludeFilename");
put("filenameField", "setFilenameField");
put("includeRowNumber", "setIncludeRowNumber");
put("rowNumberField", "setRowNumberField");
put("rowLimit", "setRowLimit");
put("encoding", "setEncoding");
put("yamlField", "setYamlField");
put("inFields", "setInFields");
put("IsAFile", "setIsAFile");
put("addResultFile", "setAddResultFile");
put("validating", "setValidating");
put("IsIgnoreEmptyFile", "setIgnoreEmptyFile");
put("doNotFailIfNoFile", "setdoNotFailIfNoFile");
put("fileName", "setFileName");
put("fileMask", "setFileMask");
put("fileRequired", "setFileRequired");
put("includeSubFolders", "setIncludeSubFolders");
put("inputFields", "setInputFields");
}
};
FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
FieldLoadSaveValidator<YamlInputField[]> yamlInputFieldArrayLoadSaveValidator = new ArrayLoadSaveValidator<YamlInputField>(new YamlInputFieldLoadSaveValidator(), 5);
Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
attrValidatorMap.put("fileName", stringArrayLoadSaveValidator);
attrValidatorMap.put("fileRequired", stringArrayLoadSaveValidator);
attrValidatorMap.put("fileMask", stringArrayLoadSaveValidator);
attrValidatorMap.put("includeSubFolders", stringArrayLoadSaveValidator);
attrValidatorMap.put("inputFields", yamlInputFieldArrayLoadSaveValidator);
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