mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
27.28.2013 617b205225d505fc6a17d792b2d3d183aa080321
refs
author Nicolas Capponi <nicolas.capponi@forgerock.com>
Friday, September 27, 2013 16:28 +0200
committer Nicolas Capponi <nicolas.capponi@forgerock.com>
Friday, September 27, 2013 16:28 +0200
commit617b205225d505fc6a17d792b2d3d183aa080321
tree dd32b5af65d63dde5e72b79d20aa3d150c76b38d tree | zip | gz
parent 952f4c2a863432a75118ba5abf3c2377511dda1c view | diff
Fix OPENDJ-972 - OpenDJ should set size limit to 1 when performing single entry searches
Review CR-2378

Main changes in AbstractConnection class:
* where a single entry search / read method constructs a new search request, ensure that it specifies a size limit of 1
* where a single entry search / read method is passed in a search request, check to see if it has a size limit of 1. If not, then duplicate the search request and set the size limit to 1
* detect size limit exceeded errors when processing the results of a single entry search / read : it is then transformed into a client-side error

To implement these changes :
* took into account the server error ResultCode.SIZE_LIMIT_EXCEEDED
* moved behavior for handling errors into SingleEntryHandler
* refactored SingleEntryFuture to use internally a SingleEntryHandler
* simplified searchSingleEntry method to use SingleEntryHandler
* added a new message ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES_NO_COUNT to handle case where there is too many entries but without the actual number of entries
* and for tests
- added several new tests testSingleEntrySearchXXX in AbstractAsynchronousConnectionTestCase to test single entry search behavior
- added support for the client-provided handler in the internal class MockConnection of AbstractAsynchronousConnectionTestCase to better test behavior in test methods.

Also added support code for creating single entry request
* Added 2 new methods Requests#newSingleEntrySearchRequest to create single entry search requests
* Added a new method SearchRequest#isSingleEntrySearch to test if a request correspond to a single entry search
* Added a new test case class for search requests : SearchRequestTestCase



1 files added
9 files modified
504 ■■■■ changed files
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java 154 ●●●●● diff | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java 56 ●●●●● diff | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java 17 ●●●●● diff | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java 7 ●●●● diff | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java 7 ●●●● diff | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/resources/com/forgerock/opendj/ldap/core.properties 2 ●●●●● diff | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/resources/com/forgerock/opendj/ldap/core_fr.properties 4 ●●●● diff | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java 162 ●●●●● diff | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java 13 ●●●●● diff | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/requests/SearchRequestTestCase.java 82 ●●●●● diff | view | raw | blame | history