From ef637aaca5572c22abda7d53ac129446dd9cc70a Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 16 Oct 2014 14:03:12 +0000
Subject: [PATCH] Converted opendj3 code to use SearchRequest like API
---
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/internal/InternalLDAPSocketTestCase.java | 75 +++++++++++++++----------------------
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java | 5 --
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java | 6 ---
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java | 2 -
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowConfigurationTest.java | 4 -
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java | 5 --
6 files changed, 33 insertions(+), 64 deletions(-)
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
index 2af2dcd..0d0cef1 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
+++ b/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);
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowConfigurationTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowConfigurationTest.java
index 4083ae2..11f9cab 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowConfigurationTest.java
+++ b/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;
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
index 0a7946c..ca70ec3 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
+++ b/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();
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/internal/InternalLDAPSocketTestCase.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/internal/InternalLDAPSocketTestCase.java
index 439a5b7..86f23a1 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/internal/InternalLDAPSocketTestCase.java
+++ b/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")));
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
index 2e8d5c6..e36fede 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
+++ b/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);
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java
index 106b459..8cff5db 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java
+++ b/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();
--
Gitblit v1.10.0