use of org.apache.directory.api.ldap.model.message.controls.EntryChange in project directory-ldap-api by apache.
the class EntryChangeControlTest method testDecodeEntryChangeControlSuccess.
/**
* Test the decoding of a EntryChangeControl
*/
@Test
public void testDecodeEntryChangeControlSuccess() throws Exception {
ByteBuffer bb = ByteBuffer.allocate(0x0D);
bb.put(new byte[] { // EntryChangeNotification ::= SEQUENCE {
0x30, // EntryChangeNotification ::= SEQUENCE {
0x0B, 0x0A, 0x01, // changeType ENUMERATED {
0x08, // }
0x04, 0x03, 'a', '=', // previousDN LDAPDN OPTIONAL, -- modifyDN ops. only
'b', 0x02, 0x01, // changeNumber INTEGER OPTIONAL } -- if supported
0x10 });
bb.flip();
EntryChangeDecorator decorator = new EntryChangeDecorator(codec);
EntryChange entryChange = (EntryChange) decorator.decode(bb.array());
assertEquals(ChangeType.MODDN, entryChange.getChangeType());
assertEquals("a=b", entryChange.getPreviousDn().toString());
assertEquals(16, entryChange.getChangeNumber());
}
Aggregations