use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class DeliverOneTimePasswordExtendedResultTestCase method testDecodeValueMissingDeliveryMechanism.
/**
* Tests the behavior when trying to decode an extended result whose value
* sequence is missing the delivery mechanism.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueMissingDeliveryMechanism() throws Exception {
final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString((byte) 0x81, "uid=test.user,dc=example,dc=com"), new ASN1OctetString((byte) 0x82, "test.user@example.com"), new ASN1OctetString((byte) 0x83, "Delivery message"));
new DeliverOneTimePasswordExtendedResult(new ExtendedResult(1, ResultCode.SUCCESS, null, null, null, "1.3.6.1.4.1.30221.2.6.25", new ASN1OctetString(valueSequence.encode()), null));
}
use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class DeliverPasswordResetTokenExtendedRequestTestCase method testDecodeValueUnrecognizedSequenceElement.
/**
* Tests the behavior when trying to decode a request with a value whose
* sequence contains an element with an unrecognized BER type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueUnrecognizedSequenceElement() throws Exception {
final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString("uid=test.user,ou=People,dc=example,dc=com"), new ASN1OctetString((byte) 0x12, "foo"));
new DeliverPasswordResetTokenExtendedRequest(new ExtendedRequest("1.3.6.1.4.1.30221.2.6.45", new ASN1OctetString(valueSequence.encode())));
}
use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class DeliverPasswordResetTokenExtendedResultTestCase method testDecodeValueUnrecognizedSequenceElement.
/**
* Tests the behavior when trying to decode a result with a value whose
* sequence contains an element with an unrecognized BER type.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueUnrecognizedSequenceElement() throws Exception {
final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString("Email"), new ASN1OctetString((byte) 0x80, "test.user@example.com"), new ASN1OctetString((byte) 0x12, "invalid"));
new DeliverPasswordResetTokenExtendedResult(new ExtendedResult(1, ResultCode.SUCCESS, null, null, null, "1.3.6.1.4.1.30221.2.6.46", new ASN1OctetString(valueSequence.encode()), null));
}
use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class EndInteractiveTransactionExtendedRequestTestCase method testConstructor3ValueEmptySequence.
/**
* Tests the third constructor with an extended request whose value is an
* empty sequence.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testConstructor3ValueEmptySequence() throws Exception {
ASN1OctetString value = new ASN1OctetString(new ASN1Sequence().encode());
ExtendedRequest r = new ExtendedRequest("1.3.6.1.4.1.30221.2.6.4", value);
new EndInteractiveTransactionExtendedRequest(r);
}
use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.
the class UniquenessRequestControlTestCase method testDecodeControlValueSequenceInvalidPostCommitValidationLevel.
/**
* Tests the behavior when trying to decode a control whose value sequence has
* an invalid multiple post-commit validation level value.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeControlValueSequenceInvalidPostCommitValidationLevel() throws Exception {
final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString((byte) 0x80, "uniqueness-id"), new ASN1Set((byte) 0xA1, new ASN1OctetString("uid")), new ASN1Enumerated((byte) 0x87, 12345));
new UniquenessRequestControl(new Control("1.3.6.1.4.1.30221.2.5.52", true, new ASN1OctetString(valueSequence.encode())));
}
Aggregations