* non-success result code.
*/
@Test
public void testOnReferral() throws Exception
{
LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
LDAPConstraints constraints = new LDAPConstraints();
constraints.setReferrals( false );
conn.setConstraints( constraints );
// referrals failure
LDAPAttributeSet attrSet = new LDAPAttributeSet();
attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );
LDAPResponseListener listener = null;
LDAPResponse response = null;
listener = conn.add( entry, null, constraints );
response = listener.getResponse();
assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
assertEquals( "ldap://localhost:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response
.getReferrals()[0] );
assertEquals( "ldap://foo:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
assertEquals( "ldap://bar:10389/ou=UnderReferral,uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
conn.disconnect();
}