use of com.unboundid.ldap.sdk.AsyncRequestID in project ldapsdk by pingidentity.
the class AccessLogRequestHandlerTestCase method testAbandon.
/**
* Provides test coverage for an abandon.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testAbandon() throws Exception {
logHandler.clear();
final LDAPConnection conn = new LDAPConnection("127.0.0.1", successPort);
// The CONNECT message.
waitForCount(1);
logHandler.clear();
final AsyncRequestID requestID = InternalSDKHelper.createAsyncRequestID(1, conn);
conn.abandon(requestID);
waitForCount(1);
final String[] messages = logHandler.getMessages(true);
final String message = messages[0];
assertTrue(message.contains(" ABANDON REQUEST "), message);
assertTrue(message.contains(" idToAbandon=1"), message);
conn.close();
// The DISCONNECT message.
waitForCount(1);
logHandler.clear();
}
use of com.unboundid.ldap.sdk.AsyncRequestID in project ldapsdk by pingidentity.
the class LDAPConnection method abandon.
/**
* Sends a request to abandon the provided search operation.
*
* @param searchResults The search results object for the search to abandon.
*
* @throws LDAPException If a problem occurs while sending the request.
*/
public void abandon(@NotNull final LDAPSearchResults searchResults) throws LDAPException {
try {
final AsyncRequestID requestID = searchResults.getAsyncRequestID();
if (requestID != null) {
searchResults.setAbandoned();
conn.abandon(requestID);
} else {
// This should never happen.
throw new LDAPException("The search request has not been sent to the server", LDAPException.PARAM_ERROR);
}
} catch (final com.unboundid.ldap.sdk.LDAPException le) {
Debug.debugException(le);
throw new LDAPException(le);
}
}
Aggregations