public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
    meta = (LDAPInputMeta) smi;
    data = (LDAPInputData) sdi;

    if ( super.init( smi, sdi ) ) {
      data.rownr = 1L;
      // Get multi valued field separator
      data.multi_valuedFieldSeparator = environmentSubstitute( meta.getMultiValuedSeparator() );
      data.nrfields = meta.getInputFields().length;
      // Set the filter string
      data.staticFilter = environmentSubstitute( meta.getFilterString() );
      // Set the search base
      data.staticSearchBase = environmentSubstitute( meta.getSearchBase() );

      data.dynamic = ( meta.isDynamicSearch() || meta.isDynamicFilter() );
      try {
        // Try to connect to LDAP server
        connectServerLdap();

        return true;

      } catch ( Exception e ) {
        logError( BaseMessages.getString( PKG, "LDAPInput.ErrorInit", e.toString() ) );
        stopAll();
        setErrors( 1 );
      }
    }
    return false;
  }
@Test
  public void testRowProcessing() throws Exception {
    //Setup step
    LDAPInput ldapInput = new LDAPInput(
      stepMockHelper.stepMeta, stepMockHelper.stepDataInterface,
      0, stepMockHelper.transMeta, stepMockHelper.trans );
    LDAPInputData data = new LDAPInputData();
    LDAPInputMeta meta = mockMeta();

    //Mock fields
    LDAPInputField[] fields = new LDAPInputField[] {
      new LDAPInputField( "dn" ),
      new LDAPInputField( "cn" ),
      new LDAPInputField( "role" )
    };
    int sortedField = 1;
    fields[sortedField].setSortedKey( true );
    when( meta.getInputFields() ).thenReturn( fields );

    //Mock LDAP Connection
    when( meta.getProtocol() ).thenReturn( LdapMockProtocol.getName() );
    when( meta.getHost() ).thenReturn( "host.mock" );
    when( meta.getDerefAliases() ).thenReturn( "never" );
    when( meta.getReferrals() ).thenReturn( "ignore" );
    LdapMockProtocol.setup();

    try {
      //Run Initialization
      assertTrue( "Input Initialization Failed", ldapInput.init( meta, data ) );

      //Verify
      assertEquals( "Field not marked as sorted", 1, data.connection.getSortingAttributes().size() );
      assertEquals( "Field not marked as sorted", data.attrReturned[sortedField], data.connection.getSortingAttributes().get( 0 ) );
      assertNotNull( data.attrReturned[sortedField] );
    } finally {
      LdapMockProtocol.cleanup();
    }
  }