Search in sources :

Example 86 with FieldLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator 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);
}
Also used : ArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator) HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) DatabaseMetaLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.DatabaseMetaLoadSaveValidator) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) Before(org.junit.Before)

Example 87 with FieldLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.

the class PGPEncryptStreamMetaTest method setUpLoadSave.

@Before
public void setUpLoadSave() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("gPGLocation", "keynameFieldName", "streamField", "resultFieldName", "keynameInField", "keynameFieldName");
    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);
}
Also used : HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) Before(org.junit.Before)

Example 88 with FieldLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.

the class PrioritizeStreamsMetaTest method setUp.

@Before
public void setUp() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("stepName");
    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("stepName", stringArrayLoadSaveValidator);
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    loadSaveTester = new LoadSaveTester(testMetaClass, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap);
}
Also used : ArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator) HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) Before(org.junit.Before)

Example 89 with FieldLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.

the class PropertyInputMetaTest method setUp.

@Before
public void setUp() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("encoding", "fileType", "includeFilename", "resetRowNumber", "resolvevaluevariable", "filenameField", "includeRowNumber", "rowNumberField", "rowLimit", "filefield", "isaddresult", "dynamicFilenameField", "includeIniSection", "iniSectionField", "section", "shortFileFieldName", "pathFieldName", "hiddenFieldName", "lastModificationTimeFieldName", "uriNameFieldName", "rootUriNameFieldName", "extensionFieldName", "sizeFieldName", "fileName", "fileMask", "excludeFileMask", "fileRequired", "includeSubFolders", "inputFields");
    Map<String, String> getterMap = new HashMap<String, String>() {

        {
            put("encoding", "getEncoding");
            put("fileType", "getFileType");
            put("includeFilename", "includeFilename");
            put("resetRowNumber", "resetRowNumber");
            put("resolvevaluevariable", "isResolveValueVariable");
            put("filenameField", "getFilenameField");
            put("includeRowNumber", "includeRowNumber");
            put("rowNumberField", "getRowNumberField");
            put("rowLimit", "getRowLimit");
            put("filefield", "isFileField");
            put("isaddresult", "isAddResultFile");
            put("dynamicFilenameField", "getDynamicFilenameField");
            put("includeIniSection", "includeIniSection");
            put("iniSectionField", "getINISectionField");
            put("section", "getSection");
            put("shortFileFieldName", "getShortFileNameField");
            put("pathFieldName", "getPathField");
            put("hiddenFieldName", "isHiddenField");
            put("lastModificationTimeFieldName", "getLastModificationDateField");
            put("uriNameFieldName", "getUriField");
            put("rootUriNameFieldName", "getRootUriField");
            put("extensionFieldName", "getExtensionField");
            put("sizeFieldName", "getSizeField");
            put("fileName", "getFileName");
            put("fileMask", "getFileMask");
            put("excludeFileMask", "getExcludeFileMask");
            put("fileRequired", "getFileRequired");
            put("includeSubFolders", "getIncludeSubFolders");
            put("inputFields", "getInputFields");
        }
    };
    Map<String, String> setterMap = new HashMap<String, String>() {

        {
            put("encoding", "setEncoding");
            put("fileType", "setFileType");
            put("includeFilename", "setIncludeFilename");
            put("resetRowNumber", "setResetRowNumber");
            put("resolvevaluevariable", "setResolveValueVariable");
            put("filenameField", "setFilenameField");
            put("includeRowNumber", "setIncludeRowNumber");
            put("rowNumberField", "setRowNumberField");
            put("rowLimit", "setRowLimit");
            put("filefield", "setFileField");
            put("isaddresult", "setAddResultFile");
            put("dynamicFilenameField", "setDynamicFilenameField");
            put("includeIniSection", "setIncludeIniSection");
            put("iniSectionField", "setINISectionField");
            put("section", "setSection");
            put("shortFileFieldName", "setShortFileNameField");
            put("pathFieldName", "setPathField");
            put("hiddenFieldName", "setIsHiddenField");
            put("lastModificationTimeFieldName", "setLastModificationDateField");
            put("uriNameFieldName", "setUriField");
            put("rootUriNameFieldName", "setRootUriField");
            put("extensionFieldName", "setExtensionField");
            put("sizeFieldName", "setSizeField");
            put("fileName", "setFileName");
            put("fileMask", "setFileMask");
            put("excludeFileMask", "setExcludeFileMask");
            put("fileRequired", "setFileRequired");
            put("includeSubFolders", "setIncludeSubFolders");
            put("inputFields", "setInputFields");
        }
    };
    FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 5);
    FieldLoadSaveValidator<PropertyInputField[]> pifArrayLoadSaveValidator = new ArrayLoadSaveValidator<PropertyInputField>(new PropertyInputFieldLoadSaveValidator(), 5);
    Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    attrValidatorMap.put("fileName", stringArrayLoadSaveValidator);
    attrValidatorMap.put("fileMask", stringArrayLoadSaveValidator);
    attrValidatorMap.put("excludeFileMask", stringArrayLoadSaveValidator);
    attrValidatorMap.put("fileRequired", stringArrayLoadSaveValidator);
    attrValidatorMap.put("includeSubFolders", stringArrayLoadSaveValidator);
    attrValidatorMap.put("inputFields", pifArrayLoadSaveValidator);
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    // typeValidatorMap.put( int[].class.getCanonicalName(), new PrimitiveIntArrayLoadSaveValidator( new IntLoadSaveValidator(), 1 ) );
    loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
Also used : ArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator) HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) ArrayList(java.util.ArrayList) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) Before(org.junit.Before)

Example 90 with FieldLoadSaveValidator

use of org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator in project pentaho-kettle by pentaho.

the class RandomCCNumberGeneratorMetaTest method testStepMeta.

@Test
public void testStepMeta() throws KettleException {
    List<String> attributes = Arrays.asList("cardNumberFieldName", "cardLengthFieldName", "cardTypeFieldName", "cctype", "cclen", "ccsize");
    Map<String, String> getterMap = new HashMap<String, String>();
    getterMap.put("cardNumberFieldName", "getCardNumberFieldName");
    getterMap.put("cardLengthFieldName", "getCardLengthFieldName");
    getterMap.put("cardTypeFieldName", "getCardTypeFieldName");
    getterMap.put("cctype", "getFieldCCType");
    getterMap.put("cclen", "getFieldCCLength");
    getterMap.put("ccsize", "getFieldCCSize");
    Map<String, String> setterMap = new HashMap<String, String>();
    setterMap.put("cardNumberFieldName", "setCardNumberFieldName");
    setterMap.put("cardLengthFieldName", "setCardLengthFieldName");
    setterMap.put("cardTypeFieldName", "setCardTypeFieldName");
    setterMap.put("cctype", "setFieldCCType");
    setterMap.put("cclen", "setFieldCCLength");
    setterMap.put("ccsize", "setFieldCCSize");
    Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    fieldLoadSaveValidatorAttributeMap.put("cctype", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25));
    fieldLoadSaveValidatorAttributeMap.put("cclen", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25));
    fieldLoadSaveValidatorAttributeMap.put("ccsize", new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25));
    LoadSaveTester loadSaveTester = new LoadSaveTester(RandomCCNumberGeneratorMeta.class, attributes, getterMap, setterMap, fieldLoadSaveValidatorAttributeMap, new HashMap<String, FieldLoadSaveValidator<?>>());
    loadSaveTester.testSerialization();
}
Also used : HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) Test(org.junit.Test)

Aggregations

FieldLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator)154 HashMap (java.util.HashMap)147 LoadSaveTester (org.pentaho.di.trans.steps.loadsave.LoadSaveTester)128 StringLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator)90 Before (org.junit.Before)89 ArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator)72 ArrayList (java.util.ArrayList)59 IntLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator)47 Test (org.junit.Test)44 PrimitiveIntArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator)31 BooleanLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator)22 PrimitiveBooleanArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.PrimitiveBooleanArrayLoadSaveValidator)16 DatabaseMetaLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.DatabaseMetaLoadSaveValidator)14 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)9 Random (java.util.Random)6 SalesforceMetaTest (org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 InputStream (java.io.InputStream)4 Repository (org.pentaho.di.repository.Repository)4 NonZeroIntLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.NonZeroIntLoadSaveValidator)4