Search in sources :

Example 6 with LdapResultImpl

use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.

the class LdapResultImplTest method testHashCodeDefaultCopy.

/**
 * Tests to make sure a default LdapResultImpl has equal hashCode another one just
 * created.
 */
@Test
public void testHashCodeDefaultCopy() {
    LdapResultImpl r0 = new LdapResultImpl();
    LdapResultImpl r1 = new LdapResultImpl();
    assertTrue(r0.hashCode() == r1.hashCode());
}
Also used : LdapResultImpl(org.apache.directory.api.ldap.model.message.LdapResultImpl) Test(org.junit.Test)

Example 7 with LdapResultImpl

use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.

the class LdapResultImplTest method testNotEqualsDiffMatchedDn.

/**
 * Tests for inequality when the matchedDn properties are not the same.
 */
@Test
public void testNotEqualsDiffMatchedDn() throws LdapException {
    LdapResultImpl r0 = new LdapResultImpl();
    LdapResultImpl r1 = new LdapResultImpl();
    r0.setDiagnosticMessage("blah blah blah");
    r1.setDiagnosticMessage("blah blah blah");
    r0.setMatchedDn(new Dn("dc=example,dc=com"));
    r1.setMatchedDn(new Dn("dc=apache,dc=org"));
    r0.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
    r1.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
    Referral refs0 = new ReferralImpl();
    refs0.addLdapUrl("ldap://someserver.com");
    refs0.addLdapUrl("ldap://anotherserver.org");
    Referral refs1 = new ReferralImpl();
    refs1.addLdapUrl("ldap://someserver.com");
    refs1.addLdapUrl("ldap://anotherserver.org");
    assertFalse("results with different matchedDn properties " + "should not be equal", r0.equals(r1));
    assertFalse("results with different matchedDn properties " + "should not be equal", r1.equals(r0));
}
Also used : Referral(org.apache.directory.api.ldap.model.message.Referral) ReferralImpl(org.apache.directory.api.ldap.model.message.ReferralImpl) Dn(org.apache.directory.api.ldap.model.name.Dn) LdapResultImpl(org.apache.directory.api.ldap.model.message.LdapResultImpl) Test(org.junit.Test)

Example 8 with LdapResultImpl

use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.

the class LdapResultImplTest method testEqualsCarbonCopy.

/**
 * Tests two non default carbon copies for equality.
 */
@Test
public void testEqualsCarbonCopy() throws LdapException {
    LdapResultImpl r0 = new LdapResultImpl();
    LdapResultImpl r1 = new LdapResultImpl();
    r0.setDiagnosticMessage("blah blah blah");
    r1.setDiagnosticMessage("blah blah blah");
    r0.setMatchedDn(new Dn("dc=example,dc=com"));
    r1.setMatchedDn(new Dn("dc=example,dc=com"));
    r0.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
    r1.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
    Referral refs0 = new ReferralImpl();
    refs0.addLdapUrl("ldap://someserver.com");
    refs0.addLdapUrl("ldap://anotherserver.org");
    Referral refs1 = new ReferralImpl();
    refs1.addLdapUrl("ldap://someserver.com");
    refs1.addLdapUrl("ldap://anotherserver.org");
    assertTrue("exact copy should be equal", r0.equals(r1));
    assertTrue("exact copy should be equal", r1.equals(r0));
}
Also used : Referral(org.apache.directory.api.ldap.model.message.Referral) ReferralImpl(org.apache.directory.api.ldap.model.message.ReferralImpl) Dn(org.apache.directory.api.ldap.model.name.Dn) LdapResultImpl(org.apache.directory.api.ldap.model.message.LdapResultImpl) Test(org.junit.Test)

Example 9 with LdapResultImpl

use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.

the class LdapResultImplTest method testHashCodeDiffLockableParent.

/**
 * Tests for equal hashCode when the lockable parent is not the same.
 */
@Test
public void testHashCodeDiffLockableParent() {
    LdapResultImpl r0 = new LdapResultImpl();
    LdapResultImpl r1 = new LdapResultImpl();
    assertTrue(r0.hashCode() == r1.hashCode());
}
Also used : LdapResultImpl(org.apache.directory.api.ldap.model.message.LdapResultImpl) Test(org.junit.Test)

Example 10 with LdapResultImpl

use of org.apache.directory.api.ldap.model.message.LdapResultImpl in project directory-ldap-api by apache.

the class LdapResultImplTest method testNotEqualsDiffResultCode.

/**
 * Tests for inequality when the resultCode properties are not the same.
 */
@Test
public void testNotEqualsDiffResultCode() throws LdapException {
    LdapResultImpl r0 = new LdapResultImpl();
    LdapResultImpl r1 = new LdapResultImpl();
    r0.setDiagnosticMessage("blah blah blah");
    r1.setDiagnosticMessage("blah blah blah");
    r0.setMatchedDn(new Dn("dc=example,dc=com"));
    r1.setMatchedDn(new Dn("dc=example,dc=com"));
    r0.setResultCode(ResultCodeEnum.TIME_LIMIT_EXCEEDED);
    r1.setResultCode(ResultCodeEnum.SIZE_LIMIT_EXCEEDED);
    Referral refs0 = new ReferralImpl();
    refs0.addLdapUrl("ldap://someserver.com");
    refs0.addLdapUrl("ldap://anotherserver.org");
    Referral refs1 = new ReferralImpl();
    refs1.addLdapUrl("ldap://someserver.com");
    refs1.addLdapUrl("ldap://anotherserver.org");
    assertFalse("results with different result codes should not be equal", r0.equals(r1));
    assertFalse("results with different result codes should not be equal", r1.equals(r0));
}
Also used : Referral(org.apache.directory.api.ldap.model.message.Referral) ReferralImpl(org.apache.directory.api.ldap.model.message.ReferralImpl) Dn(org.apache.directory.api.ldap.model.name.Dn) LdapResultImpl(org.apache.directory.api.ldap.model.message.LdapResultImpl) Test(org.junit.Test)

Aggregations

LdapResultImpl (org.apache.directory.api.ldap.model.message.LdapResultImpl)15 Test (org.junit.Test)15 Referral (org.apache.directory.api.ldap.model.message.Referral)9 Dn (org.apache.directory.api.ldap.model.name.Dn)9 ReferralImpl (org.apache.directory.api.ldap.model.message.ReferralImpl)8 BindResponseImpl (org.apache.directory.api.ldap.model.message.BindResponseImpl)2 LdapResult (org.apache.directory.api.ldap.model.message.LdapResult)1 ResultCodeEnum (org.apache.directory.api.ldap.model.message.ResultCodeEnum)1