use of org.apache.directory.api.ldap.model.name.Dn in project directory-ldap-api by apache.
the class BindRequestImplTest method testNotEqualDiffId.
/**
* Test for inequality when only the IDs are different.
*/
@Test
public void testNotEqualDiffId() throws LdapException {
BindRequestImpl req0 = new BindRequestImpl();
req0.setMessageId(7);
req0.setCredentials(PASSWORD);
req0.setDn(new Dn("cn=admin,dc=example,dc=com"));
req0.setSimple(true);
req0.setVersion3(true);
BindRequestImpl req1 = new BindRequestImpl();
req1.setMessageId(5);
req1.setCredentials(PASSWORD);
req1.setDn(new Dn("cn=admin,dc=example,dc=com"));
req1.setSimple(true);
req1.setVersion3(true);
assertFalse(req0.equals(req1));
}
use of org.apache.directory.api.ldap.model.name.Dn in project directory-ldap-api by apache.
the class BindResponseImplTest method testEqualsWithTheWorks.
/**
* Tests for equality of two fully loaded identical BindResponse PDUs.
*/
@Test
public void testEqualsWithTheWorks() 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");
BindResponseImpl resp0 = new BindResponseImpl(1);
BindResponseImpl resp1 = new BindResponseImpl(1);
resp0.setServerSaslCreds(PASSWORD);
resp1.setServerSaslCreds(PASSWORD);
assertTrue("loaded carbon copies should be equal", resp0.equals(resp1));
assertTrue("loaded carbon copies should be equal", resp1.equals(resp0));
}
use of org.apache.directory.api.ldap.model.name.Dn in project directory-ldap-api by apache.
the class CompareRequestImplTest method testNotEqualDiffAttributeIds.
/**
* Test for inequality when only the attributeIds are different.
*/
@Test
public void testNotEqualDiffAttributeIds() throws LdapException {
CompareRequestImpl req0 = new CompareRequestImpl();
req0.setMessageId(5);
req0.setName(new Dn("cn=admin,dc=apache,dc=org"));
req0.setAttributeId("dc");
req0.setAssertionValue("apache.org");
CompareRequestImpl req1 = new CompareRequestImpl();
req1.setMessageId(5);
req1.setName(new Dn("cn=admin,dc=apache,dc=org"));
req1.setAttributeId("nisDomain");
req1.setAssertionValue("apache.org");
assertFalse(req0.equals(req1));
assertFalse(req1.equals(req0));
}
use of org.apache.directory.api.ldap.model.name.Dn in project directory-ldap-api by apache.
the class CompareRequestImplTest method testNotEqualDiffValue.
/**
* Test for inequality when only the Assertion values are different.
*/
@Test
public void testNotEqualDiffValue() throws LdapException {
CompareRequestImpl req0 = new CompareRequestImpl();
req0.setMessageId(5);
req0.setName(new Dn("cn=admin,dc=apache,dc=org"));
req0.setAttributeId("dc");
req0.setAssertionValue("apache.org");
CompareRequestImpl req1 = new CompareRequestImpl();
req1.setMessageId(5);
req1.setName(new Dn("cn=admin,dc=apache,dc=org"));
req1.setAttributeId("dc");
req1.setAssertionValue("nagoya.apache.org");
assertFalse(req0.equals(req1));
assertFalse(req1.equals(req0));
}
use of org.apache.directory.api.ldap.model.name.Dn in project directory-ldap-api by apache.
the class CompareRequestImplTest method testEqualsExactCopy.
/**
* Tests for equality using exact copies.
*/
@Test
public void testEqualsExactCopy() throws LdapException {
CompareRequestImpl req0 = new CompareRequestImpl();
req0.setMessageId(5);
req0.setName(new Dn("cn=admin,dc=example,dc=com"));
req0.setAttributeId("objectClass");
req0.setAssertionValue("top");
CompareRequestImpl req1 = new CompareRequestImpl();
req1.setMessageId(5);
req1.setName(new Dn("cn=admin,dc=example,dc=com"));
req1.setAttributeId("objectClass");
req1.setAssertionValue("top");
assertTrue(req0.equals(req1));
assertTrue(req1.equals(req0));
}
Aggregations