コード例 #1
0
  @Test
  public void testRoundTrip() throws KettleException {
    List<String> attributes = Arrays.asList("field_name", "target");

    Map<String, String> getterMap = new HashMap<String, String>();
    getterMap.put("field_name", "getFieldName");
    getterMap.put("target", "getTargetField");

    Map<String, String> setterMap = new HashMap<String, String>();
    setterMap.put("field_name", "setFieldName");
    setterMap.put("target", "setTargetField");

    LoadSaveTester loadSaveTester =
        new LoadSaveTester(FlattenerMeta.class, attributes, getterMap, setterMap);

    loadSaveTester.testRepoRoundTrip();
    loadSaveTester.testXmlRoundTrip();
  }
コード例 #2
0
  @Test
  public void testRoundTrip() throws KettleException {
    List<String> attributes =
        Arrays.asList(
            "filterfiletype",
            "doNotFailIfNoFile",
            "rownum",
            "isaddresult",
            "filefield",
            "rownum_field",
            "filename_Field",
            "wildcard_Field",
            "exclude_wildcard_Field",
            "dynamic_include_subfolders",
            "limit",
            "name",
            "filemask",
            "exclude_filemask",
            "file_required",
            "include_subfolders");

    Map<String, String> getterMap = new HashMap<String, String>();
    getterMap.put("filterfiletype", "getFileTypeFilter");
    getterMap.put("doNotFailIfNoFile", "isdoNotFailIfNoFile");
    getterMap.put("rownum", "includeRowNumber");
    getterMap.put("isaddresult", "isAddResultFile");
    getterMap.put("filefield", "isFileField");
    getterMap.put("rownum_field", "getRowNumberField");
    getterMap.put("filename_Field", "getDynamicFilenameField");
    getterMap.put("wildcard_Field", "getDynamicWildcardField");
    getterMap.put("exclude_wildcard_Field", "getDynamicExcludeWildcardField");
    getterMap.put("dynamic_include_subfolders", "isDynamicIncludeSubFolders");
    getterMap.put("limit", "getRowLimit");
    getterMap.put("name", "getFileName");
    getterMap.put("filemask", "getFileMask");
    getterMap.put("exclude_filemask", "getExludeFileMask");
    getterMap.put("file_required", "getFileRequired");
    getterMap.put("include_subfolders", "getIncludeSubFolders");

    Map<String, String> setterMap = new HashMap<String, String>();
    setterMap.put("filterfiletype", "setFilterFileType");
    setterMap.put("doNotFailIfNoFile", "setdoNotFailIfNoFile");
    setterMap.put("rownum", "setIncludeRowNumber");
    setterMap.put("isaddresult", "setAddResultFile");
    setterMap.put("filefield", "setFileField");
    setterMap.put("rownum_field", "setRowNumberField");
    setterMap.put("filename_Field", "setDynamicFilenameField");
    setterMap.put("wildcard_Field", "setDynamicWildcardField");
    setterMap.put("exclude_wildcard_Field", "setDynamicExcludeWildcardField");
    setterMap.put("dynamic_include_subfolders", "setDynamicIncludeSubFolders");
    setterMap.put("limit", "setRowLimit");
    setterMap.put("name", "setFileName");
    setterMap.put("filemask", "setFileMask");
    setterMap.put("exclude_filemask", "setExcludeFileMask");
    setterMap.put("file_required", "setFileRequired");
    setterMap.put("include_subfolders", "setIncludeSubFolders");

    Map<String, FieldLoadSaveValidator<?>> fieldLoadSaveValidatorAttributeMap =
        new HashMap<String, FieldLoadSaveValidator<?>>();

    // Arrays need to be consistent length
    FieldLoadSaveValidator<String[]> stringArrayLoadSaveValidator =
        new ArrayLoadSaveValidator<String>(new StringLoadSaveValidator(), 25);
    FieldLoadSaveValidator<String[]> fileRequiredArrayLoadSaveValidator =
        new ArrayLoadSaveValidator<String>(new FileRequiredLoadSaveValidator(), 25);

    fieldLoadSaveValidatorAttributeMap.put("filterfiletype", new FileTypeFilterLoadSaveValidator());
    fieldLoadSaveValidatorAttributeMap.put("name", stringArrayLoadSaveValidator);
    fieldLoadSaveValidatorAttributeMap.put("filemask", stringArrayLoadSaveValidator);
    fieldLoadSaveValidatorAttributeMap.put("name", stringArrayLoadSaveValidator);
    fieldLoadSaveValidatorAttributeMap.put("exclude_filemask", stringArrayLoadSaveValidator);
    fieldLoadSaveValidatorAttributeMap.put("file_required", fileRequiredArrayLoadSaveValidator);
    fieldLoadSaveValidatorAttributeMap.put("include_subfolders", stringArrayLoadSaveValidator);

    LoadSaveTester loadSaveTester =
        new LoadSaveTester(
            GetFileNamesMeta.class,
            attributes,
            getterMap,
            setterMap,
            fieldLoadSaveValidatorAttributeMap,
            new HashMap<String, FieldLoadSaveValidator<?>>());

    loadSaveTester.testRepoRoundTrip();
    loadSaveTester.testXmlRoundTrip();
  }