use of org.webpki.asn1.ASN1Integer in project ldapsdk by pingidentity.
the class EntryChangeNotificationControlTestCase method testConstructor4AllElements.
/**
* Tests the fourth constructor with a valid control with all elements
* present.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testConstructor4AllElements() throws Exception {
ASN1Element[] elements = { new ASN1Enumerated(PersistentSearchChangeType.MODIFY_DN.intValue()), new ASN1OctetString("ou=People,dc=example,dc=com"), new ASN1Integer(5) };
EntryChangeNotificationControl c = new EntryChangeNotificationControl("2.16.840.1.113730.3.4.7", false, new ASN1OctetString(new ASN1Sequence(elements).encode()));
assertEquals(c.getChangeType().intValue(), 8);
assertNotNull(c.getPreviousDN());
assertEquals(c.getPreviousDN(), "ou=People,dc=example,dc=com");
assertEquals(c.getChangeNumber(), 5);
assertFalse(c.isCritical());
assertNotNull(c.getControlName());
assertNotNull(c.toString());
}
use of org.webpki.asn1.ASN1Integer in project ldapsdk by pingidentity.
the class VirtualListViewResponseControlTestCase method testConstructor3ValueSequenceFirstElementNotInteger.
/**
* Tests the third constructor with a value sequence in which the first
* element cannot be decoded as an integer.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testConstructor3ValueSequenceFirstElementNotInteger() throws Exception {
ASN1Element[] elements = { new ASN1OctetString(), new ASN1Integer(10), new ASN1Enumerated(0) };
new VirtualListViewResponseControl("2.16.840.1.113730.3.4.10", false, new ASN1OctetString(new ASN1Sequence(elements).encode()));
}
use of org.webpki.asn1.ASN1Integer in project ldapsdk by pingidentity.
the class VirtualListViewResponseControlTestCase method testConstructor3ValueSequenceSecondElementNotEnumerated.
/**
* Tests the third constructor with a value sequence in which the third
* element cannot be decoded as an enumerated element.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test(expectedExceptions = { LDAPException.class })
public void testConstructor3ValueSequenceSecondElementNotEnumerated() throws Exception {
ASN1Element[] elements = { new ASN1Integer(5), new ASN1Integer(10), new ASN1OctetString() };
new VirtualListViewResponseControl("2.16.840.1.113730.3.4.10", false, new ASN1OctetString(new ASN1Sequence(elements).encode()));
}
use of org.webpki.asn1.ASN1Integer in project ldapsdk by pingidentity.
the class VirtualListViewResponseControlTestCase method testConstructor3WithoutContextID.
/**
* Tests the third constructor not including a context ID.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testConstructor3WithoutContextID() throws Exception {
ASN1Element[] elements = { new ASN1Integer(10), new ASN1Integer(100), new ASN1Enumerated(0) };
VirtualListViewResponseControl c = new VirtualListViewResponseControl("2.16.840.1.113730.3.4.10", false, new ASN1OctetString(new ASN1Sequence(elements).encode()));
assertEquals(c.getTargetPosition(), 10);
assertEquals(c.getContentCount(), 100);
assertEquals(c.getResultCode(), ResultCode.SUCCESS);
assertNull(c.getContextID());
assertFalse(c.isCritical());
assertNotNull(c.getControlName());
assertNotNull(c.toString());
}
use of org.webpki.asn1.ASN1Integer in project ldapsdk by pingidentity.
the class SimplePagedResultsControlTestCase method testConstructor6EmptyCookie.
/**
* Tests the sixth constructor with a valid size and an empty cookie.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test()
public void testConstructor6EmptyCookie() throws Exception {
ASN1Element[] elements = { new ASN1Integer(10), new ASN1OctetString() };
SimplePagedResultsControl c = new SimplePagedResultsControl("1.2.840.113556.1.4.319", false, new ASN1OctetString(new ASN1Sequence(elements).encode()));
assertEquals(c.getSize(), 10);
assertNotNull(c.getCookie());
assertFalse(c.moreResultsToReturn());
assertFalse(c.isCritical());
assertNotNull(c.getControlName());
assertNotNull(c.toString());
}
Aggregations