Search in sources :

Example 46 with LoadSaveTester

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

the class MailInputMetaTest method setUpLoadSave.

@Before
public void setUpLoadSave() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("conditionReceivedDate", "valueimaplist", "serverName", "userName", "password", "useSSL", "port", "firstMails", "retrievemails", "delete", "protocol", "firstIMAPMails", "IMAPFolder", "senderSearchTerm", "notTermSenderSearch", "recipientSearch", "subjectSearch", "receivedDate1", "receivedDate2", "notTermSubjectSearch", "notTermRecipientSearch", "notTermReceivedDateSearch", "includeSubFolders", "useProxy", "proxyUsername", "folderField", "dynamicFolder", "rowLimit", "useBatch", "start", "end", "batchSize", "stopOnError", "inputFields");
    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("inputFields", new ArrayLoadSaveValidator<MailInputField>(new MailInputFieldLoadSaveValidator(), 5));
    attrValidatorMap.put("batchSize", new IntLoadSaveValidator(1000));
    attrValidatorMap.put("conditionReceivedDate", new IntLoadSaveValidator(MailConnectionMeta.conditionDateCode.length));
    attrValidatorMap.put("valueimaplist", new IntLoadSaveValidator(MailConnectionMeta.valueIMAPListCode.length));
    attrValidatorMap.put("port", new StringIntLoadSaveValidator(65534));
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
Also used : IntLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator) 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) Before(org.junit.Before)

Example 47 with LoadSaveTester

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

the class MappingMetaTest method setUpLoadSave.

@Before
public void setUpLoadSave() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("transName", "fileName", "directoryPath", "allowingMultipleInputs", "allowingMultipleOutputs", "specificationMethod", "transObjectId", "inputMappings", "outputMappings", "mappingParameters");
    Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    attrValidatorMap.put("specificationMethod", new ObjectLocationSpecificationMethodLoadSaveValidator());
    attrValidatorMap.put("transObjectId", new ObjectIdLoadSaveValidator());
    attrValidatorMap.put("inputMappings", new ListLoadSaveValidator<MappingIODefinition>(new MappingIODefinitionLoadSaveValidator(), 5));
    attrValidatorMap.put("outputMappings", new ListLoadSaveValidator<MappingIODefinition>(new MappingIODefinitionLoadSaveValidator(), 5));
    attrValidatorMap.put("mappingParameters", new MappingParametersLoadSaveValidator());
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new HashMap<String, String>(), new HashMap<String, String>(), attrValidatorMap, typeValidatorMap);
}
Also used : MappingParametersLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.MappingParametersLoadSaveValidator) ObjectLocationSpecificationMethodLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ObjectLocationSpecificationMethodLoadSaveValidator) HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) MappingIODefinitionLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.MappingIODefinitionLoadSaveValidator) ObjectIdLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ObjectIdLoadSaveValidator) Before(org.junit.Before)

Example 48 with LoadSaveTester

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

the class DynamicSQLRowMetaTest method setUpLoadSave.

@Before
public void setUpLoadSave() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("sql", "SQLFieldName", "rowLimit", "outerJoin", "variableReplace", "databaseMeta");
    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("databaseMeta", new DatabaseMetaLoadSaveValidator());
    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) DatabaseMetaLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.DatabaseMetaLoadSaveValidator) Before(org.junit.Before)

Example 49 with LoadSaveTester

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

the class ExcelInputMetaTest method testRepoRoundTripWithNullAttr.

@Test
public void testRepoRoundTripWithNullAttr() throws KettleException {
    List<String> attributes = Arrays.asList("fileName", "fileMask", "excludeFileMask", "fileRequired", "includeSubFolders", "field", "sheetName", "startRow", "startColumn", "spreadSheetType", "fileField", "sheetField", "sheetRowNumberField", "rowNumberField", "shortFileFieldName", "extensionFieldName", "pathFieldName", "sizeFieldName", "hiddenFieldName", "lastModificationTimeFieldName", "uriNameFieldName", "rootUriNameFieldName");
    Map<String, String> getterMap = new HashMap<String, String>() {

        {
            put("excludeFileMask", "getExludeFileMask");
            put("shortFileFieldName", "getShortFileNameField");
            put("extensionFieldName", "getExtensionField");
            put("pathFieldName", "getPathField");
            put("sizeFieldName", "getSizeField");
            put("hiddenFieldName", "isHiddenField");
            put("lastModificationTimeFieldName", "getLastModificationDateField");
            put("uriNameFieldName", "getUriField");
            put("rootUriNameFieldName", "getRootUriField");
        }
    };
    Map<String, String> setterMap = new HashMap<String, String>() {

        {
            put("shortFileFieldName", "setShortFileNameField");
            put("extensionFieldName", "setExtensionField");
            put("pathFieldName", "setPathField");
            put("sizeFieldName", "setSizeField");
            put("hiddenFieldName", "setIsHiddenField");
            put("lastModificationTimeFieldName", "setLastModificationDateField");
            put("uriNameFieldName", "setUriField");
            put("rootUriNameFieldName", "setRootUriField");
        }
    };
    FieldLoadSaveValidator<String[]> nullStringArrayLoadSaveValidator = new NullStringArrayLoadSaveValidator();
    FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator = new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 1);
    NullNameExcelInputArrayFieldLoadSaveValidator nullNameExcelInputArrayFieldLoadSaveValidator = new NullNameExcelInputArrayFieldLoadSaveValidator();
    Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    attrValidatorMap.put("fileName", nullStringArrayLoadSaveValidator);
    attrValidatorMap.put("fileMask", stringArrayLoadSaveValidator);
    attrValidatorMap.put("excludeFileMask", stringArrayLoadSaveValidator);
    attrValidatorMap.put("fileRequired", stringArrayLoadSaveValidator);
    attrValidatorMap.put("includeSubFolders", stringArrayLoadSaveValidator);
    attrValidatorMap.put("sheetName", nullStringArrayLoadSaveValidator);
    attrValidatorMap.put("field", nullNameExcelInputArrayFieldLoadSaveValidator);
    attrValidatorMap.put("spreadSheetType", new SpreadSheetTypeFieldLoadSaveValidator());
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    typeValidatorMap.put(int[].class.getCanonicalName(), new PrimitiveIntArrayLoadSaveValidator(new IntLoadSaveValidator(), 1));
    loadSaveTester = new LoadSaveTester(ExcelInputMeta.class, attributes, getterMap, setterMap, attrValidatorMap, typeValidatorMap);
    loadSaveTester.testRepoRoundTrip();
}
Also used : PrimitiveIntArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator) ArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator) IntLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator) HashMap(java.util.HashMap) LoadSaveTester(org.pentaho.di.trans.steps.loadsave.LoadSaveTester) FieldLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator) PrimitiveIntArrayLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator) StringLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator) Test(org.junit.Test)

Example 50 with LoadSaveTester

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

the class ExcelOutputMetaTest method setUpLoadSave.

@Before
public void setUpLoadSave() throws Exception {
    KettleEnvironment.init();
    PluginRegistry.init(false);
    List<String> attributes = Arrays.asList("headerFontName", "headerFontSize", "headerFontBold", "headerFontItalic", "headerFontUnderline", "headerFontOrientation", "headerFontColor", "headerBackGroundColor", "headerRowHeight", "headerAlignment", "headerImage", "rowFontName", "rowFontSize", "rowFontColor", "rowBackGroundColor", "fileName", "extension", "password", "headerEnabled", "footerEnabled", "splitEvery", "stepNrInFilename", "dateInFilename", "addToResultFiles", "sheetProtected", "timeInFilename", "templateEnabled", "templateFileName", "templateAppend", "sheetname", "useTempFiles", "tempDirectory", "encoding", "append", "doNotOpenNewFileInit", "createParentFolder", "specifyFormat", "dateTimeFormat", "autoSizeColumns", "nullBlank", "outputFields");
    // Note - newline (get/set) doesn't appear to be used or persisted. So, it's not included in the load/save tester.
    Map<String, String> getterMap = new HashMap<String, String>();
    Map<String, String> setterMap = new HashMap<String, String>() {

        {
            put("sheetProtected", "setProtectSheet");
            put("nullBlank", "setNullIsBlank");
        }
    };
    Map<String, FieldLoadSaveValidator<?>> attrValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    attrValidatorMap.put("outputFields", new ArrayLoadSaveValidator<ExcelField>(new ExcelFieldLoadSaveValidator(), 5));
    attrValidatorMap.put("headerFontName", new IntLoadSaveValidator(ExcelOutputMeta.font_name_code.length));
    attrValidatorMap.put("headerFontUnderline", new IntLoadSaveValidator(ExcelOutputMeta.font_underline_code.length));
    attrValidatorMap.put("headerFontOrientation", new IntLoadSaveValidator(ExcelOutputMeta.font_orientation_code.length));
    attrValidatorMap.put("headerFontColor", new IntLoadSaveValidator(ExcelOutputMeta.font_color_code.length));
    attrValidatorMap.put("headerBackGroundColor", new IntLoadSaveValidator(ExcelOutputMeta.font_color_code.length));
    attrValidatorMap.put("headerAlignment", new IntLoadSaveValidator(ExcelOutputMeta.font_alignment_code.length));
    attrValidatorMap.put("rowBackGroundColor", new IntLoadSaveValidator(ExcelOutputMeta.font_color_code.length));
    attrValidatorMap.put("rowFontName", new IntLoadSaveValidator(ExcelOutputMeta.font_name_code.length));
    attrValidatorMap.put("rowFontColor", new IntLoadSaveValidator(ExcelOutputMeta.font_color_code.length));
    Map<String, FieldLoadSaveValidator<?>> typeValidatorMap = new HashMap<String, FieldLoadSaveValidator<?>>();
    loadSaveTester = new LoadSaveTester(testMetaClass, attributes, new ArrayList<String>(), new ArrayList<String>(), getterMap, setterMap, attrValidatorMap, typeValidatorMap, this);
}
Also used : IntLoadSaveValidator(org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator) 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) Before(org.junit.Before)

Aggregations

LoadSaveTester (org.pentaho.di.trans.steps.loadsave.LoadSaveTester)149 HashMap (java.util.HashMap)144 FieldLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.FieldLoadSaveValidator)128 Before (org.junit.Before)86 StringLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.StringLoadSaveValidator)81 ArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.ArrayLoadSaveValidator)67 Test (org.junit.Test)62 ArrayList (java.util.ArrayList)56 IntLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.IntLoadSaveValidator)34 PrimitiveIntArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.PrimitiveIntArrayLoadSaveValidator)24 BooleanLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.BooleanLoadSaveValidator)21 PrimitiveBooleanArrayLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.PrimitiveBooleanArrayLoadSaveValidator)15 DatabaseMetaLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.DatabaseMetaLoadSaveValidator)12 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)7 SalesforceMetaTest (org.pentaho.di.trans.steps.salesforce.SalesforceMetaTest)5 ObjectIdLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.ObjectIdLoadSaveValidator)4 ObjectLocationSpecificationMethodLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.ObjectLocationSpecificationMethodLoadSaveValidator)4 Matchers.anyString (org.mockito.Matchers.anyString)3 NonZeroIntLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.NonZeroIntLoadSaveValidator)3 YNLoadSaveValidator (org.pentaho.di.trans.steps.loadsave.validator.YNLoadSaveValidator)3