Search in sources :

Example 1 with IntermediateResponse

use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.

the class GetChangelogBatchIntermediateResponseListenerTestCase method testHandleMalformedMissingChangelogEntries.

/**
 * Provides test coverage for the {@code intermediateResponseReturned} method
 * with a malformed missing changelog entries intermediate response.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testHandleMalformedMissingChangelogEntries() throws Exception {
    final GetChangelogBatchExtendedRequest r = new GetChangelogBatchExtendedRequest(new EndOfChangelogStartingPoint(), 100, 300000L);
    final TestChangelogEntryListener entryListener = new TestChangelogEntryListener();
    assertEquals(entryListener.getEntryCount(), 0);
    assertEquals(entryListener.getMissingChangesCount(), 0);
    assertEquals(entryListener.getOtherCount(), 0);
    final GetChangelogBatchIntermediateResponseListener l = new GetChangelogBatchIntermediateResponseListener(entryListener);
    assertEquals(l.getEntryCount(), 0);
    l.intermediateResponseReturned(new IntermediateResponse(MissingChangelogEntriesIntermediateResponse.MISSING_CHANGELOG_ENTRIES_INTERMEDIATE_RESPONSE_OID, new ASN1OctetString("foo")));
    assertEquals(l.getEntryCount(), 0);
    assertEquals(entryListener.getEntryCount(), 0);
    assertEquals(entryListener.getMissingChangesCount(), 0);
    assertEquals(entryListener.getOtherCount(), 1);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) Test(org.testng.annotations.Test)

Example 2 with IntermediateResponse

use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.

the class GetChangelogBatchIntermediateResponseListenerTestCase method testHandleOtherIntermediateResponseWithOIDAndValue.

/**
 * Provides test coverage for the {@code intermediateResponseReturned} method
 * with an intermediate response message with an OID and value.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testHandleOtherIntermediateResponseWithOIDAndValue() throws Exception {
    final GetChangelogBatchExtendedRequest r = new GetChangelogBatchExtendedRequest(new EndOfChangelogStartingPoint(), 100, 300000L);
    final TestChangelogEntryListener entryListener = new TestChangelogEntryListener();
    assertEquals(entryListener.getEntryCount(), 0);
    assertEquals(entryListener.getMissingChangesCount(), 0);
    assertEquals(entryListener.getOtherCount(), 0);
    final GetChangelogBatchIntermediateResponseListener l = new GetChangelogBatchIntermediateResponseListener(entryListener);
    assertEquals(l.getEntryCount(), 0);
    l.intermediateResponseReturned(new IntermediateResponse("1.2.3.4", new ASN1OctetString("foo")));
    assertEquals(l.getEntryCount(), 0);
    assertEquals(entryListener.getEntryCount(), 0);
    assertEquals(entryListener.getMissingChangesCount(), 0);
    assertEquals(entryListener.getOtherCount(), 1);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) Test(org.testng.annotations.Test)

Example 3 with IntermediateResponse

use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.

the class GetChangelogBatchIntermediateResponseListenerTestCase method testHandleMalformedChangelogEntry.

/**
 * Provides test coverage for the {@code intermediateResponseReturned} method
 * with a malformed changelog entry intermediate response.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testHandleMalformedChangelogEntry() throws Exception {
    final GetChangelogBatchExtendedRequest r = new GetChangelogBatchExtendedRequest(new EndOfChangelogStartingPoint(), 100, 300000L);
    final TestChangelogEntryListener entryListener = new TestChangelogEntryListener();
    assertEquals(entryListener.getEntryCount(), 0);
    assertEquals(entryListener.getMissingChangesCount(), 0);
    assertEquals(entryListener.getOtherCount(), 0);
    final GetChangelogBatchIntermediateResponseListener l = new GetChangelogBatchIntermediateResponseListener(entryListener);
    assertEquals(l.getEntryCount(), 0);
    l.intermediateResponseReturned(new IntermediateResponse(ChangelogEntryIntermediateResponse.CHANGELOG_ENTRY_INTERMEDIATE_RESPONSE_OID, new ASN1OctetString("foo")));
    assertEquals(l.getEntryCount(), 0);
    assertEquals(entryListener.getEntryCount(), 0);
    assertEquals(entryListener.getMissingChangesCount(), 0);
    assertEquals(entryListener.getOtherCount(), 1);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) Test(org.testng.annotations.Test)

Example 4 with IntermediateResponse

use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.

the class ChangelogEntryIntermediateResponseTestCase method testDecodeValueSequenceWithMalformedElements.

/**
 * Tests the behavior when attempting to decode an intermediate response
 * with a value sequence with a value sequence containing malformed elements.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueSequenceWithMalformedElements() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString("foo"), new ASN1OctetString("foo"), new ASN1OctetString("foo"), new ASN1OctetString("foo"));
    new ChangelogEntryIntermediateResponse(new IntermediateResponse(ChangelogEntryIntermediateResponse.CHANGELOG_ENTRY_INTERMEDIATE_RESPONSE_OID, new ASN1OctetString(valueSequence.encode())));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) Test(org.testng.annotations.Test)

Example 5 with IntermediateResponse

use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.

the class ChangelogEntryIntermediateResponseTestCase method testDecodeValueSequenceInvalidElementCount.

/**
 * Tests the behavior when attempting to decode an intermediate response
 * with a value sequence with an unexpected number of elements.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueSequenceInvalidElementCount() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString("foo"));
    new ChangelogEntryIntermediateResponse(new IntermediateResponse(ChangelogEntryIntermediateResponse.CHANGELOG_ENTRY_INTERMEDIATE_RESPONSE_OID, new ASN1OctetString(valueSequence.encode())));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) Test(org.testng.annotations.Test)

Aggregations

IntermediateResponse (com.unboundid.ldap.sdk.IntermediateResponse)56 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)39 Test (org.testng.annotations.Test)37 EnumSet (java.util.EnumSet)19 Set (java.util.Set)19 ExtendedResult (com.unboundid.ldap.sdk.ExtendedResult)18 LDAPException (com.unboundid.ldap.sdk.LDAPException)18 ASN1Sequence (com.unboundid.asn1.ASN1Sequence)12 Control (com.unboundid.ldap.sdk.Control)11 LDAPResult (com.unboundid.ldap.sdk.LDAPResult)6 ASN1Enumerated (com.unboundid.asn1.ASN1Enumerated)5 ASN1Element (com.unboundid.asn1.ASN1Element)2 AddRequest (com.unboundid.ldap.sdk.AddRequest)2 BindResult (com.unboundid.ldap.sdk.BindResult)2 Entry (com.unboundid.ldap.sdk.Entry)2 SearchResultReference (com.unboundid.ldap.sdk.SearchResultReference)2 AddRequestProtocolOp (com.unboundid.ldap.protocol.AddRequestProtocolOp)1 IntermediateResponseProtocolOp (com.unboundid.ldap.protocol.IntermediateResponseProtocolOp)1 CompareRequest (com.unboundid.ldap.sdk.CompareRequest)1 DeleteRequest (com.unboundid.ldap.sdk.DeleteRequest)1