public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
    int i;
    for ( i = 0; i < inputFields.length; i++ ) {
      SalesforceInputField field = inputFields[i];

      int type = field.getType();
      if ( type == ValueMetaInterface.TYPE_NONE ) {
        type = ValueMetaInterface.TYPE_STRING;
      }
      try {
        ValueMetaInterface v =
          ValueMetaFactory.createValueMeta( space.environmentSubstitute( field.getName() ), type );
        v.setLength( field.getLength() );
        v.setPrecision( field.getPrecision() );
        v.setOrigin( name );
        v.setConversionMask( field.getFormat() );
        v.setDecimalSymbol( field.getDecimalSymbol() );
        v.setGroupingSymbol( field.getGroupSymbol() );
        v.setCurrencySymbol( field.getCurrencySymbol() );
        r.addValueMeta( v );
      } catch ( Exception e ) {
        throw new KettleStepException( e );
      }
    }

    if ( includeTargetURL && !Utils.isEmpty( targetURLField ) ) {
      ValueMetaInterface v = new ValueMetaString( space.environmentSubstitute( targetURLField ) );
      v.setLength( 250 );
      v.setPrecision( -1 );
      v.setOrigin( name );
      r.addValueMeta( v );
    }
    if ( includeModule && !Utils.isEmpty( moduleField ) ) {
      ValueMetaInterface v = new ValueMetaString( space.environmentSubstitute( moduleField ) );
      v.setLength( 250 );
      v.setPrecision( -1 );
      v.setOrigin( name );
      r.addValueMeta( v );
    }

    if ( includeSQL && !Utils.isEmpty( sqlField ) ) {
      ValueMetaInterface v = new ValueMetaString( space.environmentSubstitute( sqlField ) );
      v.setLength( 250 );
      v.setPrecision( -1 );
      v.setOrigin( name );
      r.addValueMeta( v );
    }
    if ( includeTimestamp && !Utils.isEmpty( timestampField ) ) {
      ValueMetaInterface v = new ValueMetaDate( space.environmentSubstitute( timestampField ) );
      v.setOrigin( name );
      r.addValueMeta( v );
    }

    if ( includeRowNumber && !Utils.isEmpty( rowNumberField ) ) {
      ValueMetaInterface v = new ValueMetaInteger( space.environmentSubstitute( rowNumberField ) );
      v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 );
      v.setOrigin( name );
      r.addValueMeta( v );
    }
    if ( includeDeletionDate && !Utils.isEmpty( deletionDateField ) ) {
      ValueMetaInterface v = new ValueMetaDate( space.environmentSubstitute( deletionDateField ) );
      v.setOrigin( name );
      r.addValueMeta( v );
    }

  }
@Test
  public void testGetFields() throws KettleStepException {
    SalesforceInputMeta meta = new SalesforceInputMeta();
    meta.setDefault();
    RowMetaInterface r = new RowMeta();
    meta.getFields( r, "thisStep", null, null, new Variables(), null, null );
    assertEquals( 0, r.size() );

    meta.setInputFields( new SalesforceInputField[]{ new SalesforceInputField( "field1" ) } );
    r.clear();
    meta.getFields( r, "thisStep", null, null, new Variables(), null, null );
    assertEquals( 1, r.size() );

    meta.setIncludeDeletionDate( true );
    meta.setDeletionDateField( "DeletionDate" );
    meta.setIncludeModule( true );
    meta.setModuleField( "ModuleName" );
    meta.setIncludeRowNumber( true );
    meta.setRowNumberField( "RN" );
    meta.setIncludeSQL( true );
    meta.setSQLField( "sqlField" );
    meta.setIncludeTargetURL( true );
    meta.setTargetURLField( "Target" );
    meta.setIncludeTimestamp( true );
    meta.setTimestampField( "TS" );
    r.clear();
    meta.getFields( r, "thisStep", null, null, new Variables(), null, null );
    assertEquals( 7, r.size() );
    assertTrue( r.indexOfValue( "field1" ) >= 0 );
    assertTrue( r.indexOfValue( "DeletionDate" ) >= 0 );
    assertTrue( r.indexOfValue( "ModuleName" ) >= 0 );
    assertTrue( r.indexOfValue( "RN" ) >= 0 );
    assertTrue( r.indexOfValue( "sqlField" ) >= 0 );
    assertTrue( r.indexOfValue( "Target" ) >= 0 );
    assertTrue( r.indexOfValue( "TS" ) >= 0 );
  }