public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep,
                         VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
    // We don't have any input fields here in "r" as they are all info fields.
    // So we just merge in the info fields.
    //
    if ( info != null ) {
      for ( int i = 0; i < info.length; i++ ) {
        if ( info[i] != null ) {
          r.mergeRowMeta( info[i], name );
        }
      }
    }

    for ( int i = 0; i < r.size(); i++ ) {
      ValueMetaInterface vmi = r.getValueMeta( i );
      if ( vmi != null && Utils.isEmpty( vmi.getName() ) ) {
        vmi.setOrigin( name );
      }
    }
    return;
  }
@Test
  public void testGetFieldsEmptyInput() throws Exception {
    RowMeta outputRowMeta = new RowMeta();
    MergeJoinMeta meta = new MergeJoinMeta();

    RowMeta inputRow1 = new RowMeta();
    ValueMetaInteger field1_row1 = new ValueMetaInteger( "field1" );
    field1_row1.setOrigin( "inputStep1" );
    inputRow1.addValueMeta( field1_row1 );
    ValueMetaString field2_row1 = new ValueMetaString( "field2" );
    field2_row1.setOrigin( "inputStep1" );
    inputRow1.addValueMeta( field2_row1 );

    RowMeta inputRow2 = new RowMeta();
    ValueMetaString field1_row2 = new ValueMetaString( "field1" );
    field1_row2.setOrigin( "inputStep2" );
    inputRow2.addValueMeta( field1_row2 );
    ValueMetaString field3_row2 = new ValueMetaString( "field3" );
    field3_row2.setOrigin( "inputStep2" );
    inputRow2.addValueMeta( field3_row2 );

    StepMeta stepMeta = new StepMeta( "Merge", meta );

    meta.getFields( outputRowMeta, "Merge Join",
      new RowMetaInterface[]{ inputRow1, inputRow2 }, stepMeta, new Variables(), null, null );

    assertNotNull( outputRowMeta );
    assertFalse( outputRowMeta.isEmpty() );
    assertEquals( 4, outputRowMeta.size() );
    List<ValueMetaInterface> vmi = outputRowMeta.getValueMetaList();
    assertNotNull( vmi );
    // Proceed in order
    ValueMetaInterface field1 = outputRowMeta.getValueMeta( 0 );
    assertNotNull( field1 );
    assertEquals( "field1", field1.getName() );
    assertTrue( field1 instanceof ValueMetaInteger );
    assertEquals( "inputStep1", field1.getOrigin() );

    ValueMetaInterface field2 = outputRowMeta.getValueMeta( 1 );
    assertNotNull( field2 );
    assertEquals( "field2", field2.getName() );
    assertTrue( field2 instanceof ValueMetaString );
    assertEquals( "inputStep1", field2.getOrigin() );

    ValueMetaInterface field1_1 = outputRowMeta.getValueMeta( 2 );
    assertNotNull( field1_1 );
    assertEquals( "field1_1", field1_1.getName() );
    assertTrue( field1_1 instanceof ValueMetaString );
    assertEquals( "Merge Join", field1_1.getOrigin() );

    ValueMetaInterface field3 = outputRowMeta.getValueMeta( 3 );
    assertNotNull( field3 );
    assertEquals( "field3", field3.getName() );
    assertTrue( field3 instanceof ValueMetaString );
    assertEquals( "inputStep2", field3.getOrigin() );

  }