public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step )
    throws KettleException {
    try {
      rep.saveStepAttribute( id_transformation, id_step, TAG_INCLUDE, includeFilename );
      rep.saveStepAttribute( id_transformation, id_step, TAG_INCLUDE_FIELD, filenameField );
      rep.saveStepAttribute( id_transformation, id_step, TAG_ADD_RESULT_FILE, addResultFile );
      rep.saveStepAttribute( id_transformation, id_step, TAG_NAME_SPACE_AWARE, nameSpaceAware );
      rep.saveStepAttribute( id_transformation, id_step, TAG_IGNORE_COMMENTS, ignorecomments );
      rep.saveStepAttribute( id_transformation, id_step, TAG_READ_URL, readurl );

      rep.saveStepAttribute( id_transformation, id_step, TAG_VALIDATING, validating );
      rep.saveStepAttribute( id_transformation, id_step, TAG_USE_TOKEN, usetoken );
      rep.saveStepAttribute( id_transformation, id_step, TAG_IS_IGNORE_EMPTY_FILE, IsIgnoreEmptyFile );
      rep.saveStepAttribute( id_transformation, id_step, TAG_DO_NOT_FAIL_IF_NO_FILE, doNotFailIfNoFile );

      rep.saveStepAttribute( id_transformation, id_step, TAG_ROW_NUM, includeRowNumber );
      rep.saveStepAttribute( id_transformation, id_step, TAG_ROW_NUM_FIELD, rowNumberField );
      rep.saveStepAttribute( id_transformation, id_step, TAG_LIMIT, rowLimit );
      rep.saveStepAttribute( id_transformation, id_step, TAG_LOOPXPATH, loopxpath );
      rep.saveStepAttribute( id_transformation, id_step, TAG_ENCODING, encoding );

      for ( int i = 0; i < fileName.length; i++ ) {
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FILE_NAME, fileName[i] );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FILE_MASK, fileMask[i] );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_EXCLUDE_FILE_MASK, excludeFileMask[i] );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FILE_REQUIRED, fileRequired[i] );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_INCLUDE_SUBFOLDERS, includeSubFolders[i] );
      }

      for ( int i = 0; i < inputFields.length; i++ ) {
        GetXMLDataField field = inputFields[i];

        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_NAME, field.getName() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_XPATH, field.getXPath() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_ELEMENT_TYPE, field.getElementTypeCode() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_RESULT_TYPE, field.getResultTypeCode() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_TYPE, field.getTypeDesc() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_FORMAT, field.getFormat() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_CURRENCY, field.getCurrencySymbol() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_DECIMAL, field.getDecimalSymbol() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_GROUP, field.getGroupSymbol() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_LENGTH, field.getLength() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_PRECISION, field.getPrecision() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_TRIM_TYPE, field.getTrimTypeCode() );
        rep.saveStepAttribute( id_transformation, id_step, i, TAG_FIELD_REPEAT, field.isRepeated() );
      }
      rep.saveStepAttribute( id_transformation, id_step, TAG_IS_IN_FIELDS, inFields );
      rep.saveStepAttribute( id_transformation, id_step, TAG_IS_A_FILE, IsAFile );

      rep.saveStepAttribute( id_transformation, id_step, TAG_XML_FIELD, xmlField );
      rep.saveStepAttribute( id_transformation, id_step, TAG_PRUNE_PATH, prunePath );
      rep.saveStepAttribute( id_transformation, id_step, TAG_SHORT_FILE_FIELD_NAME, shortFileFieldName );
      rep.saveStepAttribute( id_transformation, id_step, TAG_EXTENSION_FIELD_NAME, extensionFieldName );
      rep.saveStepAttribute( id_transformation, id_step, TAG_PATH_FIELD_NAME, pathFieldName );
      rep.saveStepAttribute( id_transformation, id_step, TAG_SIZE_FIELD_NAME, sizeFieldName );
      rep.saveStepAttribute( id_transformation, id_step, TAG_HIDDEN_FIELD_NAME, hiddenFieldName );
      rep.saveStepAttribute( id_transformation, id_step, TAG_LAST_MODIFICATION_TIME_FIELD_NAME, lastModificationTimeFieldName );
      rep.saveStepAttribute( id_transformation, id_step, TAG_URI_NAME_FIELD_NAME, uriNameFieldName );
      rep.saveStepAttribute( id_transformation, id_step, TAG_ROOT_URI_NAME_FIELD_NAME, rootUriNameFieldName );
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString( PKG, "GetXMLDataMeta.Exception.ErrorSavingToRepository", ""
          + id_step ), e );
    }
  }
@Test
  public void testSaveRepOfAdditionalOutputFields() throws KettleException {
    GetXMLDataMeta getXMLDataMeta = new GetXMLDataMeta();
    String[] fileName = new String[] {};
    GetXMLDataField[] inputFields = new GetXMLDataField[] {};
    ReflectionTestUtils.setField( getXMLDataMeta, "fileName", fileName );
    ReflectionTestUtils.setField( getXMLDataMeta, "inputFields", inputFields );

    Repository rep = mock( Repository.class );
    IMetaStore metaStore = mock( IMetaStore.class );
    ObjectId idTransformation = mock( ObjectId.class );
    ObjectId idStep = mock( ObjectId.class );

    String shortFileFieldName = UUID.randomUUID().toString();
    ReflectionTestUtils.setField( getXMLDataMeta, "shortFileFieldName", shortFileFieldName );
    String extensionFieldName = UUID.randomUUID().toString();
    ReflectionTestUtils.setField( getXMLDataMeta, "extensionFieldName", extensionFieldName );
    String pathFieldName = UUID.randomUUID().toString();
    ReflectionTestUtils.setField( getXMLDataMeta, "pathFieldName", pathFieldName );
    String sizeFieldName = UUID.randomUUID().toString();
    ReflectionTestUtils.setField( getXMLDataMeta, "sizeFieldName", sizeFieldName );
    String hiddenFieldName = UUID.randomUUID().toString();
    ReflectionTestUtils.setField( getXMLDataMeta, "hiddenFieldName", hiddenFieldName );
    String lastModificationTimeFieldName = UUID.randomUUID().toString();
    ReflectionTestUtils.setField( getXMLDataMeta, "lastModificationTimeFieldName", lastModificationTimeFieldName );
    String uriNameFieldName = UUID.randomUUID().toString();
    ReflectionTestUtils.setField( getXMLDataMeta, "uriNameFieldName", uriNameFieldName );
    String rootUriNameFieldName = UUID.randomUUID().toString();
    ReflectionTestUtils.setField( getXMLDataMeta, "rootUriNameFieldName", rootUriNameFieldName );

    getXMLDataMeta.saveRep( rep, metaStore, idTransformation, idStep );

    verify( rep, times( 1 ) ).saveStepAttribute( idTransformation,
      idStep, "shortFileFieldName", shortFileFieldName );
    verify( rep, times( 1 ) ).saveStepAttribute( idTransformation,
      idStep, "extensionFieldName", extensionFieldName );
    verify( rep, times( 1 ) ).saveStepAttribute( idTransformation,
      idStep, "pathFieldName", pathFieldName );
    verify( rep, times( 1 ) ).saveStepAttribute( idTransformation,
      idStep, "sizeFieldName", sizeFieldName );
    verify( rep, times( 1 ) ).saveStepAttribute( idTransformation,
      idStep, "hiddenFieldName", hiddenFieldName );
    verify( rep, times( 1 ) ).saveStepAttribute( idTransformation,
      idStep, "lastModificationTimeFieldName", lastModificationTimeFieldName );
    verify( rep, times( 1 ) ).saveStepAttribute( idTransformation,
      idStep, "uriNameFieldName", uriNameFieldName );
    verify( rep, times( 1 ) ).saveStepAttribute( idTransformation,
      idStep, "rootUriNameFieldName", rootUriNameFieldName );

  }