public void setConnectorSteps( StepInterface[] sourceSteps, List<MappingValueRename> valueRenames,
      String mappingStepname ) {

    if ( sourceSteps == null ) {
      throw new IllegalArgumentException( BaseMessages
          .getString( PKG, "MappingInput.Exception.IllegalArgumentSourceStep" ) );
    }

    if ( valueRenames == null ) {
      throw new IllegalArgumentException( BaseMessages
          .getString( PKG, "MappingInput.Exception.IllegalArgumentValueRename" ) );
    }

    if ( sourceSteps.length != 0 ) {
      if ( mappingStepname == null ) {
        throw new IllegalArgumentException( BaseMessages
          .getString( PKG, "MappingInput.Exception.IllegalArgumentStepName" ) );
      }
    }

    for ( StepInterface sourceStep : sourceSteps ) {

      // We don't want to add the mapping-to-mapping rowset
      //
      if ( !sourceStep.isMapping() ) {
        // OK, before we leave, make sure there is a rowset that covers the path to this target step.
        // We need to create a new RowSet and add it to the Input RowSets of the target step
        //
        BlockingRowSet rowSet = new BlockingRowSet( getTransMeta().getSizeRowset() );

        // This is always a single copy, both for source and target...
        //
        rowSet.setThreadNameFromToCopy( sourceStep.getStepname(), 0, mappingStepname, 0 );

        // Make sure to connect it to both sides...
        //
        sourceStep.addRowSetToOutputRowSets( rowSet );
        sourceStep.identifyErrorOutput();
        addRowSetToInputRowSets( rowSet );
      }
    }
    data.valueRenames = valueRenames;

    data.sourceSteps = sourceSteps;
  }
@Test
  public void testSetConnectorSteps() {

    when( stepMockHelper.transMeta.getSizeRowset() ).thenReturn( 1 );
    MappingInputData mappingInputData = new MappingInputData();
    MappingInput mappingInput =
      new MappingInput( stepMockHelper.stepMeta, mappingInputData,
        0, stepMockHelper.transMeta, stepMockHelper.trans );
    mappingInput.init( stepMockHelper.initStepMetaInterface, mappingInputData );
    ValidatorData validatorData = new ValidatorData();
    Validator previousStep =
      new Validator( stepMockHelper.stepMeta, validatorData, 0, stepMockHelper.transMeta, stepMockHelper.trans );
    when( stepMockHelper.stepMeta.isDoingErrorHandling() ).thenReturn( true );
    StepErrorMeta stepErrorMeta = mock( StepErrorMeta.class );
    when( stepErrorMeta.getTargetStep() ).thenReturn( stepMockHelper.stepMeta );
    when( stepMockHelper.stepMeta.getName() ).thenReturn( stepName );
    when( stepMockHelper.stepMeta.getStepErrorMeta() ).thenReturn( stepErrorMeta );

    StepInterface[] si = new StepInterface[] { previousStep };
    mappingInput.setConnectorSteps( si, Collections.emptyList(), stepName );
    assertEquals( previousStep.getOutputRowSets().size(), 0 );

  }