SearchResponse extends AbstractResult { @Override public boolean equals(final Object o) { if (o == this) { return true; } if (o instanceof SearchResponse && super.equals(o)) { final SearchResponse v = (SearchResponse) o; return LdapUtils.areEqual(resultEntries, v.resultEntries) && LdapUtils.areEqual(resultReferences, v.resultReferences); } return false; } SearchResponse();  SearchResponse(final DERBuffer buffer); void initialize(final SearchResponse result); Collection<LdapEntry> getEntries(); LdapEntry getEntry(); LdapEntry getEntry(final String dn); Set<String> getEntryDns(); void addEntries(final LdapEntry... entry); void addEntries(final Collection<LdapEntry> entries); int entrySize(); Collection<SearchResultReference> getReferences(); SearchResultReference getReference(); void addReferences(final SearchResultReference... reference); void addReferences(final Collection<SearchResultReference> references); int referenceSize(); SearchResponse subResult(final int fromIndex, final int toIndex); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); static SearchResponse sort(final SearchResponse sr); static SearchResponse merge(final SearchResponse result); static Builder builder(); static final int PROTOCOL_OP; }
@Test public void testEquals() { final SearchResponse sr1 = SearchResponse.builder().build(); Assert.assertEquals(sr1, sr1); Assert.assertEquals(SearchResponse.builder().build(), SearchResponse.builder().build()); Assert.assertEquals( SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); Assert.assertNotEquals( SearchResponse.builder() .messageID(2) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); Assert.assertNotEquals( SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.NO_SUCH_OBJECT) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); Assert.assertNotEquals( SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=2") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); Assert.assertNotEquals( SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message 2") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); Assert.assertNotEquals( SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); Assert.assertNotEquals( SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=2,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); Assert.assertNotEquals( SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uuid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); Assert.assertNotEquals( SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("2").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); Assert.assertNotEquals( SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build(), SearchResponse.builder() .messageID(1) .controls(new PasswordPolicyControl()) .resultCode(ResultCode.SUCCESS) .matchedDN("uid=1") .diagnosticMessage("sample message") .referralURLs("ldap: .entry(LdapEntry.builder() .dn("uid=1,dc=ldaptive,dc=org") .attributes(LdapAttribute.builder().name("uid").values("1").build()) .build()) .reference(SearchResultReference.builder().uris("ldap: .build()); }