Search in sources :

Example 1 with SearchResultEntryImpl

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

the class SearchResultEntryImplTest method testNotEqualDiffObjectName.

/**
 * Tests for inequality when the objectName dn is not the same.
 */
@Test
public void testNotEqualDiffObjectName() throws LdapException {
    SearchResultEntryImpl resp0 = new SearchResultEntryImpl(5);
    resp0.setEntry(getEntry());
    resp0.setObjectName(new Dn("dc=apache,dc=org"));
    SearchResultEntryImpl resp1 = new SearchResultEntryImpl(5);
    resp1.setEntry(getEntry());
    resp1.setObjectName(new Dn("dc=example,dc=com"));
    assertFalse("different object names should not be equal", resp1.equals(resp0));
    assertFalse("different object names should not be equal", resp0.equals(resp1));
}
Also used : SearchResultEntryImpl(org.apache.directory.api.ldap.model.message.SearchResultEntryImpl) Dn(org.apache.directory.api.ldap.model.name.Dn) Test(org.junit.Test)

Example 2 with SearchResultEntryImpl

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

the class SearchResultEntryImplTest method testHashCodeSameObject.

/**
 * Tests for equal hashCode when the same object reference is used.
 */
@Test
public void testHashCodeSameObject() {
    SearchResultEntryImpl resp = new SearchResultEntryImpl(5);
    assertTrue(resp.hashCode() == resp.hashCode());
}
Also used : SearchResultEntryImpl(org.apache.directory.api.ldap.model.message.SearchResultEntryImpl) Test(org.junit.Test)

Example 3 with SearchResultEntryImpl

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

the class InitSearchResultEntry method action.

/**
 * {@inheritDoc}
 */
public void action(LdapMessageContainer<SearchResultEntryDecorator> container) {
    // Now, we can allocate the SearchResultEntry Object
    SearchResultEntryDecorator searchResultEntry = new SearchResultEntryDecorator(container.getLdapCodecService(), new SearchResultEntryImpl(container.getMessageId()));
    container.setMessage(searchResultEntry);
}
Also used : SearchResultEntryImpl(org.apache.directory.api.ldap.model.message.SearchResultEntryImpl) SearchResultEntryDecorator(org.apache.directory.api.ldap.codec.decorators.SearchResultEntryDecorator)

Example 4 with SearchResultEntryImpl

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

the class SearchResultEntryImplTest method testEqualsExactCopy.

/**
 * Tests for equality when an exact copy is compared.
 */
@Test
public void testEqualsExactCopy() throws LdapException {
    SearchResultEntryImpl resp0 = new SearchResultEntryImpl(5);
    resp0.setEntry(getEntry());
    resp0.setObjectName(new Dn("dc=example,dc=com"));
    SearchResultEntryImpl resp1 = new SearchResultEntryImpl(5);
    resp1.setEntry(getEntry());
    resp1.setObjectName(new Dn("dc=example,dc=com"));
    assertTrue("exact copies should be equal", resp0.equals(resp1));
    assertTrue("exact copies should be equal", resp1.equals(resp0));
}
Also used : SearchResultEntryImpl(org.apache.directory.api.ldap.model.message.SearchResultEntryImpl) Dn(org.apache.directory.api.ldap.model.name.Dn) Test(org.junit.Test)

Example 5 with SearchResultEntryImpl

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

the class SearchResultEntryImplTest method testEqualsSameObject.

/**
 * Tests for equality when the same object reference is used.
 */
@Test
public void testEqualsSameObject() {
    SearchResultEntryImpl resp = new SearchResultEntryImpl(5);
    assertTrue("the same object should be equal", resp.equals(resp));
}
Also used : SearchResultEntryImpl(org.apache.directory.api.ldap.model.message.SearchResultEntryImpl) Test(org.junit.Test)

Aggregations

SearchResultEntryImpl (org.apache.directory.api.ldap.model.message.SearchResultEntryImpl)6 Test (org.junit.Test)5 Dn (org.apache.directory.api.ldap.model.name.Dn)3 SearchResultEntryDecorator (org.apache.directory.api.ldap.codec.decorators.SearchResultEntryDecorator)1