Search in sources :

Example 51 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugASN1Write1EnabledOnlyASN1.

/**
 * Tests the first {@code debugASN1Write} method with the debugger enabled
 * and a debug type set that includes only the ASN.1 type.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugASN1Write1EnabledOnlyASN1() throws Exception {
    Debug.setEnabled(true, EnumSet.of(DebugType.ASN1));
    testLogHandler.resetMessageCount();
    assertTrue(Debug.debugEnabled(DebugType.ASN1));
    Debug.debugASN1Write(new ASN1Null());
    assertTrue(testLogHandler.getMessageCount() >= 1);
}
Also used : ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Example 52 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugASN1Read2EnabledIncludeASN1.

/**
 * Tests the second {@code debugASN1Read} method with the debugger enabled
 * and a debug type set that includes the ASN.1 type among others.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugASN1Read2EnabledIncludeASN1() throws Exception {
    Debug.setEnabled(true, EnumSet.of(DebugType.ASN1, DebugType.OTHER));
    testLogHandler.resetMessageCount();
    assertTrue(Debug.debugEnabled(DebugType.ASN1));
    Debug.debugASN1Read(Level.FINEST, new ASN1Null());
    assertTrue(testLogHandler.getMessageCount() >= 1);
}
Also used : ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Example 53 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class DebugTestCase method testDebugASN1Read1EnabledAll.

/**
 * Tests the first {@code debugASN1Read} method with the debugger enabled
 * and a debug type set of all types.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testDebugASN1Read1EnabledAll() throws Exception {
    Debug.setEnabled(true);
    testLogHandler.resetMessageCount();
    assertTrue(Debug.debugEnabled(DebugType.ASN1));
    Debug.debugASN1Read(new ASN1Null());
    assertTrue(testLogHandler.getMessageCount() >= 1);
}
Also used : ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Example 54 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class MultiUpdateExtendedRequestTestCase method testDecodeInvalidRequestType.

/**
 * Tests the behavior when trying to decode a multi-update extended request
 * that contains an invalid request element.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testDecodeInvalidRequestType() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1Enumerated(0), new ASN1Sequence(new ASN1Sequence(new ASN1Null(LDAPMessage.PROTOCOL_OP_TYPE_UNBIND_REQUEST))));
    new MultiUpdateExtendedRequest(new ExtendedRequest(MultiUpdateExtendedRequest.MULTI_UPDATE_REQUEST_OID, new ASN1OctetString(valueSequence.encode())));
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) ExtendedRequest(com.unboundid.ldap.sdk.ExtendedRequest) PasswordModifyExtendedRequest(com.unboundid.ldap.sdk.extensions.PasswordModifyExtendedRequest) ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Example 55 with ASN1Null

use of com.unboundid.asn1.ASN1Null in project ldapsdk by pingidentity.

the class X509CertificateTestCase method testDecodeValueSequenceFirstElementNotSequence.

/**
 * Tests the behavior when trying to decode a sequence whose first element
 * cannot itself be parsed as a sequence.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { CertException.class })
public void testDecodeValueSequenceFirstElementNotSequence() throws Exception {
    final ASN1Sequence valueSequence = new ASN1Sequence(new ASN1OctetString("not a sequence"), new ASN1Sequence(new ASN1ObjectIdentifier(new OID("1.2.3.4")), new ASN1Null()), new ASN1BitString(new boolean[1024]));
    new X509Certificate(valueSequence.encode());
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) OID(com.unboundid.util.OID) ASN1ObjectIdentifier(com.unboundid.asn1.ASN1ObjectIdentifier) ASN1BitString(com.unboundid.asn1.ASN1BitString) ASN1Null(com.unboundid.asn1.ASN1Null) Test(org.testng.annotations.Test)

Aggregations

ASN1Null (com.unboundid.asn1.ASN1Null)69 Test (org.testng.annotations.Test)65 ASN1BitString (com.unboundid.asn1.ASN1BitString)36 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)33 DN (com.unboundid.ldap.sdk.DN)33 OID (com.unboundid.util.OID)32 ASN1Sequence (com.unboundid.asn1.ASN1Sequence)28 ASN1ObjectIdentifier (com.unboundid.asn1.ASN1ObjectIdentifier)23 ASN1Integer (com.unboundid.asn1.ASN1Integer)21 ASN1Element (com.unboundid.asn1.ASN1Element)20 ASN1BigInteger (com.unboundid.asn1.ASN1BigInteger)15 ASN1GeneralizedTime (com.unboundid.asn1.ASN1GeneralizedTime)9 ASN1UTCTime (com.unboundid.asn1.ASN1UTCTime)6 ArrayList (java.util.ArrayList)6 ASN1Null (com.github.zhenwei.core.asn1.ASN1Null)5 Date (java.util.Date)5 ASN1ObjectIdentifier (com.github.zhenwei.core.asn1.ASN1ObjectIdentifier)3 ASN1OctetString (com.github.zhenwei.core.asn1.ASN1OctetString)3 AlgorithmParameters (java.security.AlgorithmParameters)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3