use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.
the class StreamProxyValuesIntermediateResponseTestCase method testDecodeMalformedResult.
/**
* Tests the behavior when trying to decode an intermediate response with a
* malformed result element.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeMalformedResult() throws Exception {
ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString((byte) 0x81));
ASN1OctetString value = new ASN1OctetString(valueSequence.encode());
IntermediateResponse r = new IntermediateResponse("1.3.6.1.4.1.30221.2.6.9", value);
new StreamProxyValuesIntermediateResponse(r);
}
use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.
the class StreamProxyValuesIntermediateResponseTestCase method testFailureAttributeNotIndexed.
/**
* Provides test coverage for an error response with an "attribute not
* indexed" result.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testFailureAttributeNotIndexed() throws Exception {
StreamProxyValuesIntermediateResponse r = new StreamProxyValuesIntermediateResponse("unindexed", StreamProxyValuesIntermediateResponse.RESULT_ATTRIBUTE_NOT_INDEXED, "Attribute unindexed is not indexed", null, new Control("1.2.3.4"), new Control("1.2.3.5"));
r = new StreamProxyValuesIntermediateResponse(new IntermediateResponse(r.getOID(), r.getValue(), r.getControls()));
assertNotNull(r);
assertNotNull(r.getAttributeName());
assertEquals(r.getAttributeName(), "unindexed");
assertEquals(r.getResult(), StreamProxyValuesIntermediateResponse.RESULT_ATTRIBUTE_NOT_INDEXED);
assertNotNull(r.getDiagnosticMessage());
assertEquals(r.getDiagnosticMessage(), "Attribute unindexed is not indexed");
assertNotNull(r.getValues());
assertTrue(r.getValues().isEmpty());
assertNotNull(r.getControls());
assertEquals(r.getControls().length, 2);
assertNotNull(r.getIntermediateResponseName());
assertNotNull(r.valueToString());
assertNotNull(r.toString());
}
use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.
the class DebugTestCase method testDebugLDAPResult7EnabledWithoutLDAP.
/**
* Tests the seventh {@code debugLDAPResult} method with the debugger enabled
* and a debug type set that does not include the LDAP type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testDebugLDAPResult7EnabledWithoutLDAP() throws Exception {
Debug.setEnabled(true, EnumSet.of(DebugType.OTHER));
testLogHandler.resetMessageCount();
assertFalse(Debug.debugEnabled(DebugType.LDAP));
Debug.debugLDAPResult(new IntermediateResponse("1.2.3.4", null));
assertTrue(testLogHandler.getMessageCount() >= 0);
}
use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.
the class DebugTestCase method testDebugLDAPResult7EnabledAll.
/**
* Tests the seventh {@code debugLDAPResult} method with the debugger enabled
* and a debug type set of all types.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testDebugLDAPResult7EnabledAll() throws Exception {
Debug.setEnabled(true);
testLogHandler.resetMessageCount();
assertTrue(Debug.debugEnabled(DebugType.LDAP));
Debug.debugLDAPResult(new IntermediateResponse("1.2.3.4", null));
assertTrue(testLogHandler.getMessageCount() >= 1);
}
use of com.unboundid.ldap.sdk.IntermediateResponse in project ldapsdk by pingidentity.
the class DebugTestCase method testDebugLDAPResult8EnabledAll.
/**
* Tests the eighth {@code debugLDAPResult} method with the debugger enabled
* and a debug type set of all types.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testDebugLDAPResult8EnabledAll() throws Exception {
Debug.setEnabled(true);
testLogHandler.resetMessageCount();
assertTrue(Debug.debugEnabled(DebugType.LDAP));
Debug.debugLDAPResult(Level.FINEST, new IntermediateResponse("1.2.3.4", null));
assertTrue(testLogHandler.getMessageCount() >= 1);
}
Aggregations