Search in sources :

Example 56 with IntermediateResponse

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

the class CollectSupportDataIRListenerTestCase method testOtherResponse.

/**
 * Tests the behavior for some other type of intermediate response.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testOtherResponse() throws Exception {
    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    final ByteArrayOutputStream err = new ByteArrayOutputStream();
    final CollectSupportData tool = new CollectSupportData(out, err);
    final File outputFile = createTempFile();
    assertTrue(outputFile.delete());
    final CollectSupportDataIRListener listener = new CollectSupportDataIRListener(tool, outputFile);
    listener.handleOtherIntermediateResponse(new IntermediateResponse("1.2.3.4", new ASN1OctetString("foo")));
    assertEquals(out.size(), 0);
    assertTrue(err.size() > 0);
    assertFalse(outputFile.exists());
    assertNull(listener.getOutputStreamReference().get());
    assertNull(listener.getFirstIOExceptionReference().get());
    err.reset();
    assertEquals(out.size(), 0);
    listener.close();
    assertEquals(out.size(), 0);
    assertEquals(err.size(), 0);
    assertFalse(outputFile.exists());
    assertNull(listener.getOutputStreamReference().get());
    assertNull(listener.getFirstIOExceptionReference().get());
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) CollectSupportDataArchiveFragmentIntermediateResponse(com.unboundid.ldap.sdk.unboundidds.extensions.CollectSupportDataArchiveFragmentIntermediateResponse) CollectSupportDataOutputIntermediateResponse(com.unboundid.ldap.sdk.unboundidds.extensions.CollectSupportDataOutputIntermediateResponse) ByteArrayOutputStream(java.io.ByteArrayOutputStream) File(java.io.File) 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