use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class GetChangelogBatchExtendedResultTestCase method testDecodeMissingResumeToken.
/**
* Tests the behavior when attempting to decode an instance of the extended
* result with a value sequence that is missing a resume token.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testDecodeMissingResumeToken() throws Exception {
final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Boolean((byte) 0x81, true));
final GetChangelogBatchExtendedResult r = new GetChangelogBatchExtendedResult(new ExtendedResult(1, ResultCode.SUCCESS, null, null, null, null, new ASN1OctetString(valueSequence.encode()), null), -1);
assertTrue(r.hasValue());
assertNotNull(r.getValue());
assertNull(r.getResumeToken());
assertTrue(r.moreChangesAvailable());
assertFalse(r.changesAlreadyPurged());
assertNull(r.getAdditionalInfo());
assertEquals(r.getEntryCount(), -1);
assertNull(r.getChangelogEntries());
assertNotNull(r.getExtendedResultName());
assertNotNull(r.toString());
}
use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class GetSubtreeAccessibilityExtendedResultTestCase method testGetAccessibilityValueSequenceMissingBaseDN.
/**
* Tests the behavior when trying to decode a result whose value sequence is
* missing a base DN element.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testGetAccessibilityValueSequenceMissingBaseDN() throws Exception {
final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Enumerated((byte) 0x81, 1), new ASN1OctetString((byte) 0x82, "uid=bypass,dc=example,dc=com"), new ASN1OctetString((byte) 0x83, "20120101012345.678Z"));
new GetSubtreeAccessibilityExtendedResult(new ExtendedResult(1234, ResultCode.OTHER, null, null, null, GetSubtreeAccessibilityExtendedResult.GET_SUBTREE_ACCESSIBILITY_RESULT_OID, new ASN1OctetString(new ASN1Sequence(valueSequence).encode()), null));
}
use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class GetSubtreeAccessibilityExtendedResultTestCase method testGetAccessibilityValueSequenceInvalidElementType.
/**
* Tests the behavior when trying to decode a result whose value sequence has
* an invalid element type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testGetAccessibilityValueSequenceInvalidElementType() throws Exception {
final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString("invalid type"));
new GetSubtreeAccessibilityExtendedResult(new ExtendedResult(1234, ResultCode.OTHER, null, null, null, GetSubtreeAccessibilityExtendedResult.GET_SUBTREE_ACCESSIBILITY_RESULT_OID, new ASN1OctetString(new ASN1Sequence(valueSequence).encode()), null));
}
use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class GetSupportedOTPDeliveryMechanismsExtendedResultTestCase method testDecodeMalformedDeliveryMechanismInfo.
/**
* Tests the behavior when trying to decode an extended result whose
* value contains a malformed delivery mechanism info object.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeMalformedDeliveryMechanismInfo() throws Exception {
final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Sequence(new ASN1OctetString((byte) 0x80, "foo"), new ASN1OctetString((byte) 0x12, "bar"), new ASN1OctetString((byte) 0x56, "baz")));
new GetSupportedOTPDeliveryMechanismsExtendedResult(new ExtendedResult(1234, ResultCode.SUCCESS, null, null, null, "1.3.6.1.4.1.30221.2.6.48", new ASN1OctetString(valueSequence.encode()), null));
}
use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class IdentifyBackupCompatibilityProblemsExtendedResultTestCase method testDecodeValueSequenceUnexpectedType.
/**
* Tests the behavior when trying to decode an extended result in which the
* value sequence has an element with an unexpected type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueSequenceUnexpectedType() throws Exception {
final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString((byte) 123, "foo"));
final ExtendedResult r = new ExtendedResult(-1, ResultCode.SUCCESS, null, null, null, "1.3.6.1.4.1.30221.2.6.31", new ASN1OctetString(valueSequence.encode()), null);
new IdentifyBackupCompatibilityProblemsExtendedResult(r);
}
Aggregations