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

Jean-Noel Rouvignac
16.03.2014 ef637aaca5572c22abda7d53ac129446dd9cc70a
Converted opendj3 code to use SearchRequest like API


Removed useless calls to SearchRequest.setSizeLimit(Integer.MAX_VALUE) and SearchRequest.setTimeLimit(Integer.MAX_VALUE), as they are no better than leaving the default which is 0.
6 files modified
97 ■■■■■ changed files
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java 6 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowConfigurationTest.java 4 ●●● patch | view | raw | blame | history
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java 5 ●●●● patch | view | raw | blame | history
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/internal/InternalLDAPSocketTestCase.java 75 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java 2 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java 5 ●●●● patch | view | raw | blame | history
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
@@ -339,8 +339,6 @@
  {
    InvocationCounterPlugin.resetAllCounters();
    SearchRequest request = Requests.newSearchRequest(BASE, SearchScope.WHOLE_SUBTREE, "(objectclass=inetorgperson)")
        .setTimeLimit(Integer.MAX_VALUE)
        .setSizeLimit(Integer.MAX_VALUE)
        .setTypesOnly(true);
    Entry resultEntry = getSingleEntry(getRootConnection().processSearch(request));
@@ -751,8 +749,6 @@
    InvocationCounterPlugin.resetAllCounters();
    SearchRequest request = Requests.newSearchRequest(DN.valueOf(BASE), SearchScope.WHOLE_SUBTREE)
        .setSizeLimit(Integer.MAX_VALUE)
        .setTimeLimit(Integer.MAX_VALUE)
        .addControl(new SubentriesControl(true, true));
    InternalSearchOperation searchOperation = getRootConnection().processSearch(request);
    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
@@ -766,8 +762,6 @@
    InvocationCounterPlugin.resetAllCounters();
    SearchRequest request = Requests.newSearchRequest(DN.valueOf(BASE), SearchScope.WHOLE_SUBTREE)
        .setSizeLimit(Integer.MAX_VALUE)
        .setTimeLimit(Integer.MAX_VALUE)
        .addControl(new LDAPControl(OID_LDUP_SUBENTRIES, true));
    InternalSearchOperation searchOperation = getRootConnection().processSearch(request);
    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowConfigurationTest.java
@@ -225,9 +225,7 @@
      ResultCode  expectedResultCode
      ) throws Exception
  {
    SearchRequest request = newSearchRequest(DN.valueOf(baseDN), scope)
        .setSizeLimit(Integer.MAX_VALUE)
        .setTimeLimit(Integer.MAX_VALUE);
    SearchRequest request = newSearchRequest(DN.valueOf(baseDN), scope);
    InternalSearchOperation searchOperation = getRootConnection().processSearch(request);
    assertEquals(searchOperation.getResultCode(), expectedResultCode);
    return searchOperation;
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
@@ -931,10 +931,7 @@
    String filter = "(&(objectclass=Person)"
        + "(isMemberOf=cn=MyDGrp,ou=groups,dc=example,dc=com))";
    SearchRequest request = newSearchRequest("dc=example,dc=com", SearchScope.WHOLE_SUBTREE, filter)
        .setTimeLimit(Integer.MAX_VALUE)
        .setSizeLimit(Integer.MAX_VALUE);
    SearchRequest request = newSearchRequest("dc=example,dc=com", SearchScope.WHOLE_SUBTREE, filter);
    InternalSearchOperation searchOperation = getRootConnection().processSearch(request);
    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
    List<SearchResultEntry> entries = searchOperation.getSearchEntries();
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/internal/InternalLDAPSocketTestCase.java
@@ -42,6 +42,7 @@
import javax.naming.directory.SearchControls;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
@@ -50,7 +51,6 @@
import org.opends.server.tools.LDAPReader;
import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.DN;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.opends.server.types.RawAttribute;
import org.opends.server.types.RawModification;
import org.testng.annotations.BeforeClass;
@@ -63,17 +63,15 @@
 * This class provides a number of tests to cover the internal LDAP socket
 * implementation.
 */
public class InternalLDAPSocketTestCase
       extends InternalTestCase
public class InternalLDAPSocketTestCase extends InternalTestCase
{
  /**
   * Ensures that the Directory Server is running.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @BeforeClass()
  public void startServer()
         throws Exception
  @BeforeClass
  public void startServer() throws Exception
  {
    TestCaseUtils.startServer();
  }
@@ -86,9 +84,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testAddOperation()
         throws Exception
  @Test
  public void testAddOperation() throws Exception
  {
    TestCaseUtils.initializeTestBackend(false);
    assertFalse(DirectoryServer.entryExists(DN.valueOf("o=test")));
@@ -135,9 +132,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testAddOperationThroughJNDI()
         throws Exception
  @Test
  public void testAddOperationThroughJNDI() throws Exception
  {
    TestCaseUtils.initializeTestBackend(false);
    assertFalse(DirectoryServer.entryExists(DN.valueOf("o=test")));
@@ -181,9 +177,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testCompareOperation()
         throws Exception
  @Test
  public void testCompareOperation() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
@@ -226,9 +221,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testCompareOperationThroughJNDI()
         throws Exception
  @Test
  public void testCompareOperationThroughJNDI() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
@@ -267,9 +261,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testDeleteOperation()
         throws Exception
  @Test
  public void testDeleteOperation() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
@@ -312,9 +305,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testDeleteOperationThroughJNDI()
         throws Exception
  @Test
  public void testDeleteOperationThroughJNDI() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
@@ -346,9 +338,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testExtendedOperation()
         throws Exception
  @Test
  public void testExtendedOperation() throws Exception
  {
    InternalLDAPSocket socket = new InternalLDAPSocket();
    LDAPReader reader = new LDAPReader(socket);
@@ -391,9 +382,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testModifyOperation()
         throws Exception
  @Test
  public void testModifyOperation() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
@@ -439,9 +429,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testModifyOperationThroughJNDI()
         throws Exception
  @Test
  public void testModifyOperationThroughJNDI() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
@@ -477,9 +466,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testModifyDNOperation()
         throws Exception
  @Test
  public void testModifyDNOperation() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    TestCaseUtils.addEntry(
@@ -532,9 +520,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testModifyDNOperationThroughJNDI()
         throws Exception
  @Test
  public void testModifyDNOperationThroughJNDI() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    TestCaseUtils.addEntry(
@@ -575,9 +562,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testSearchOperation()
         throws Exception
  @Test
  public void testSearchOperation() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
@@ -629,9 +615,8 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test()
  public void testSearchOperationThroughJNDI()
         throws Exception
  @Test
  public void testSearchOperationThroughJNDI() throws Exception
  {
    TestCaseUtils.initializeTestBackend(true);
    assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
@@ -219,8 +219,6 @@
  public void invalidBinaryAttributeSearchV3() throws Exception
  {
    SearchRequest request = newSearchRequest("o=test", SearchScope.WHOLE_SUBTREE, "(uid=user.1)")
        .setSizeLimit(Integer.MAX_VALUE)
        .setTimeLimit(Integer.MAX_VALUE)
        .addAttribute("cn;binary");
    InternalSearchOperation searchOperation = getRootConnection().processSearch(request);
    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java
@@ -240,11 +240,8 @@
     *It searches for string quebec against the value of sn which is
     * Qu\u00e9bec.
     */
    SearchRequest request = newSearchRequest("uid=user,o=test", SearchScope.WHOLE_SUBTREE, "sn:en.6:=*u*bec")
        .setSizeLimit(Integer.MAX_VALUE)
        .setTimeLimit(Integer.MAX_VALUE);
    SearchRequest request = newSearchRequest("uid=user,o=test", SearchScope.WHOLE_SUBTREE, "sn:en.6:=*u*bec");
    InternalSearchOperation searchOperation = getRootConnection().processSearch(request);
    searchOperation.run();
    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
    List<SearchResultEntry> entries = searchOperation.getSearchEntries();