Search in sources :

Example 21 with IntermediateResponse

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

the class DebugTestCase method testDebugLDAPResult8EnabledOnlyLDAP.

/**
 * Tests the eighth {@code debugLDAPResult} method with the debugger enabled
 * and a debug type set that includes only the LDAP type.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugLDAPResult8EnabledOnlyLDAP() throws Exception {
    Debug.setEnabled(true, EnumSet.of(DebugType.LDAP));
    testLogHandler.resetMessageCount();
    assertTrue(Debug.debugEnabled(DebugType.LDAP));
    Debug.debugLDAPResult(Level.FINEST, new IntermediateResponse("1.2.3.4", null));
    assertTrue(testLogHandler.getMessageCount() >= 1);
}
Also used : IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) Test(org.testng.annotations.Test)

Example 22 with IntermediateResponse

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

the class StreamProxyValuesIntermediateResponseTestCase method testDecodeInvalidResult.

/**
 * Tests the behavior when trying to decode an intermediate response with an
 * invalid result value.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeInvalidResult() throws Exception {
    ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Enumerated((byte) 0x81, -1));
    ASN1OctetString value = new ASN1OctetString(valueSequence.encode());
    IntermediateResponse r = new IntermediateResponse("1.3.6.1.4.1.30221.2.6.9", value);
    new StreamProxyValuesIntermediateResponse(r);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) Test(org.testng.annotations.Test)

Example 23 with IntermediateResponse

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

the class StreamProxyValuesIntermediateResponseTestCase method testDecodeInvalidElementType.

/**
 * Tests the behavior when trying to decode an intermediate response with an
 * invalid element type.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeInvalidElementType() throws Exception {
    ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Enumerated((byte) 0x81, 0), new ASN1OctetString((byte) 0x8F));
    ASN1OctetString value = new ASN1OctetString(valueSequence.encode());
    IntermediateResponse r = new IntermediateResponse("1.3.6.1.4.1.30221.2.6.9", value);
    new StreamProxyValuesIntermediateResponse(r);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) Test(org.testng.annotations.Test)

Example 24 with IntermediateResponse

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

the class StreamDirectoryValuesIntermediateResponseTestCase method testConstructor2NoValue.

/**
 * Tests the behavior of the second constructor with a response that does not
 * have a value.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testConstructor2NoValue() throws Exception {
    IntermediateResponse r = new IntermediateResponse(StreamDirectoryValuesIntermediateResponse.STREAM_DIRECTORY_VALUES_INTERMEDIATE_RESPONSE_OID, null);
    new StreamDirectoryValuesIntermediateResponse(r);
}
Also used : IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) Test(org.testng.annotations.Test)

Example 25 with IntermediateResponse

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

the class StreamDirectoryValuesIntermediateResponseTestCase method testConstructor2ValueInvalidType.

/**
 * Tests the behavior of the second constructor with a response whose value
 * contains an element with an invalid type.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testConstructor2ValueInvalidType() throws Exception {
    ASN1Element[] elements = { new ASN1Enumerated((byte) 0x81, 0), new ASN1OctetString((byte) 0x85, "foo") };
    IntermediateResponse r = new IntermediateResponse(StreamDirectoryValuesIntermediateResponse.STREAM_DIRECTORY_VALUES_INTERMEDIATE_RESPONSE_OID, new ASN1OctetString(new ASN1Sequence(elements).encode()));
    new StreamDirectoryValuesIntermediateResponse(r);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) IntermediateResponse(com.unboundid.ldap.sdk.IntermediateResponse) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) ASN1Element(com.unboundid.asn1.ASN1Element) 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