use of org.pentaho.di.trans.steps.loadsave.validator.DatabaseMetaLoadSaveValidator in project pentaho-kettle by pentaho.
the class DatabaseLookupMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("schemaName", "tablename", "databaseMeta", "orderByClause", "cached", "cacheSize", "loadingAllDataInCache", "failingOnMultipleResults", "eatingRowOnLookupFailure", "streamKeyField1", "streamKeyField2", "keyCondition", "tableKeyField", "returnValueField", "returnValueNewName", "returnValueDefault", "returnValueDefaultType");
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("streamKeyField1", stringArrayLoadSaveValidator);
attrValidatorMap.put("streamKeyField2", stringArrayLoadSaveValidator);
attrValidatorMap.put("keyCondition", stringArrayLoadSaveValidator);
attrValidatorMap.put("tableKeyField", stringArrayLoadSaveValidator);
attrValidatorMap.put("returnValueField", stringArrayLoadSaveValidator);
attrValidatorMap.put("returnValueNewName", stringArrayLoadSaveValidator);
attrValidatorMap.put("returnValueDefault", stringArrayLoadSaveValidator);
attrValidatorMap.put("returnValueDefaultType", new PrimitiveIntArrayLoadSaveValidator(new NonZeroIntLoadSaveValidator(7), 5));
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.DatabaseMetaLoadSaveValidator 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.DatabaseMetaLoadSaveValidator in project pentaho-kettle by pentaho.
the class PGBulkLoaderMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("schemaName", "tableName", "loadAction", "dbNameOverride", "delimiter", "enclosure", "stopOnError", "fieldTable", "fieldStream", "dateMask", "databaseMeta");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("schemaName", "getSchemaName");
put("tableName", "getTableName");
put("loadAction", "getLoadAction");
put("dbNameOverride", "getDbNameOverride");
put("delimiter", "getDelimiter");
put("enclosure", "getEnclosure");
put("stopOnError", "isStopOnError");
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("loadAction", "setLoadAction");
put("dbNameOverride", "setDbNameOverride");
put("delimiter", "setDelimiter");
put("enclosure", "setEnclosure");
put("stopOnError", "setStopOnError");
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.DatabaseMetaLoadSaveValidator in project pentaho-kettle by pentaho.
the class DimensionLookupMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
List<String> attributes = Arrays.asList("schemaName", "tableName", "update", "dateField", "dateFrom", "dateTo", "keyField", "keyRename", "autoIncrement", "versionField", "commitSize", "useBatchUpdate", "minYear", "maxYear", "techKeyCreation", "cacheSize", "usingStartDateAlternative", "startDateAlternative", "startDateFieldName", "preloadingCache", "keyStream", "keyLookup", "fieldStream", "fieldLookup", "fieldUpdate", "databaseMeta", "sequenceName");
Map<String, String> getterMap = new HashMap<String, String>() {
{
put("useBatchUpdate", "useBatchUpdate");
}
};
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("keyStream", stringArrayLoadSaveValidator);
attrValidatorMap.put("keyLookup", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldStream", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldLookup", stringArrayLoadSaveValidator);
// Note - have to use the non-zero int load/save validator here because if "update"
// is false, code in DimensionLookupMeta replaces "ValueMetaInterface.TYPE_NONE" with
// ValueMetaInterface.TYPE_STRING. This happens about once out of every 3 or so runs of
// the test which made it a bit difficult to track down.
// MB - 5/2016
attrValidatorMap.put("fieldUpdate", new FieldUpdateIntArrayLoadSaveValidator(new NonZeroIntLoadSaveValidator(DimensionLookupMeta.typeDesc.length), 5));
attrValidatorMap.put("databaseMeta", new DatabaseMetaLoadSaveValidator());
attrValidatorMap.put("startDateAlternative", new IntLoadSaveValidator(DimensionLookupMeta.getStartDateAlternativeCodes().length));
attrValidatorMap.put("sequenceName", new SequenceNameLoadSaveValidator());
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.DatabaseMetaLoadSaveValidator in project pentaho-kettle by pentaho.
the class IngresVectorwiseLoaderMetaTest method setUpLoadSave.
@Before
public void setUpLoadSave() throws Exception {
KettleEnvironment.init();
PluginRegistry.init(false);
List<String> attributes = Arrays.asList("tableName", "fifoFileName", "errorFileName", "continueOnError", "sqlPath", "useStandardConversion", "useAuthentication", "encoding", "delimiter", "useSSV", "useDynamicVNode", "escapingSpecialCharacters", "bufferSize", "usingVwload", "maxNrErrors", "truncatingTable", "fieldStream", "fieldDatabase", "databaseMeta");
// Note - "rejectErrors" is not in the above list because although there is a getter/setter for it
// in the meta class, it's not persisted or loaded. So it's not testable, and like others, there's no
// UI for it either.
// MB - 5/2016
// Note - "fieldFormat" is not in the above list because although there is a getter/setter for it
// in the meta class, it's not persisted or loaded. So it's not testable, and like others, there's no
// UI for it either.
// MB - 5/2016
Map<String, String> getterMap = new HashMap<String, String>();
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("fieldStream", stringArrayLoadSaveValidator);
attrValidatorMap.put("fieldDatabase", 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);
}
Aggregations