Search in sources :

Example 96 with ASN1Sequence

use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.

the class MatchingEntryCountResponseControlTestCase method testDecodeNegativeZeroUpperBound.

/**
 * Tests the behavior when trying to decode a control whose value sequence
 * contains an upper bound value of zero.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeNegativeZeroUpperBound() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Integer((byte) 0x82, -1));
    new MatchingEntryCountResponseControl("1.3.6.1.4.1.30221.2.5.37", false, new ASN1OctetString(valueSequence.encode()));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Integer(com.unboundid.asn1.ASN1Integer) Test(org.testng.annotations.Test)

Example 97 with ASN1Sequence

use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.

the class MatchingEntryCountResponseControlTestCase method testDecodeValueInvalidCountType.

/**
 * Tests the behavior when trying to decode a control whose value sequence
 * contains an invalid count type.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueInvalidCountType() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Integer((byte) 0x84, 12345));
    new MatchingEntryCountResponseControl("1.3.6.1.4.1.30221.2.5.37", false, new ASN1OctetString(valueSequence.encode()));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Integer(com.unboundid.asn1.ASN1Integer) Test(org.testng.annotations.Test)

Example 98 with ASN1Sequence

use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.

the class UndeleteRequestControlTestCase method testDecodeValueSequenceBadElement.

/**
 * Tests the behavior when attempting to decode a control whose value has an
 * invalid sequence element.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeValueSequenceBadElement() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Integer((byte) 0x82, -1), new ASN1OctetString((byte) 0x83, "unexpected type"));
    new UndeleteRequestControl(new Control(UndeleteRequestControl.UNDELETE_REQUEST_OID, true, new ASN1OctetString(valueSequence.encode())));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) Control(com.unboundid.ldap.sdk.Control) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Integer(com.unboundid.asn1.ASN1Integer) Test(org.testng.annotations.Test)

Example 99 with ASN1Sequence

use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.

the class OverrideSearchLimitsRequestControlTestCase method testDecodeControlEmptyPropertyValue.

/**
 * Tests the behavior when trying to decode a control whose value sequence
 * contains a property with an empty value.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeControlEmptyPropertyValue() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Sequence(new ASN1OctetString("name"), new ASN1OctetString("")));
    final Control c = new Control("1.3.6.1.4.1.30221.2.5.56", false, new ASN1OctetString(valueSequence.encode()));
    new OverrideSearchLimitsRequestControl(c);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) Control(com.unboundid.ldap.sdk.Control) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) Test(org.testng.annotations.Test)

Example 100 with ASN1Sequence

use of com.github.zhenwei.core.asn1.ASN1Sequence in project ldapsdk by pingidentity.

the class OverrideSearchLimitsRequestControlTestCase method testDecodeControlDuplicatePropertyName.

/**
 * Tests the behavior when trying to decode a control whose value sequence
 * contains multiple properties with the same name.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeControlDuplicatePropertyName() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Sequence(new ASN1OctetString("name1"), new ASN1OctetString("value1")), new ASN1Sequence(new ASN1OctetString("name2"), new ASN1OctetString("value2")), new ASN1Sequence(new ASN1OctetString("name1"), new ASN1OctetString("value3")));
    final Control c = new Control("1.3.6.1.4.1.30221.2.5.56", false, new ASN1OctetString(valueSequence.encode()));
    new OverrideSearchLimitsRequestControl(c);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) Control(com.unboundid.ldap.sdk.Control) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) Test(org.testng.annotations.Test)

Aggregations

ASN1Sequence (com.unboundid.asn1.ASN1Sequence)455 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)397 Test (org.testng.annotations.Test)311 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)297 ASN1Element (com.unboundid.asn1.ASN1Element)231 ArrayList (java.util.ArrayList)184 IOException (java.io.IOException)141 NotNull (com.unboundid.util.NotNull)116 ASN1Enumerated (com.unboundid.asn1.ASN1Enumerated)95 ASN1Integer (com.unboundid.asn1.ASN1Integer)94 ASN1Sequence (com.github.zhenwei.core.asn1.ASN1Sequence)85 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)76 ASN1InputStream (org.bouncycastle.asn1.ASN1InputStream)73 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)69 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)64 ASN1Primitive (org.bouncycastle.asn1.ASN1Primitive)57 Enumeration (java.util.Enumeration)54 ASN1Boolean (com.unboundid.asn1.ASN1Boolean)53 X509Certificate (java.security.cert.X509Certificate)53 BigInteger (java.math.BigInteger)50