use of org.apache.directory.api.asn1.util.Asn1Buffer in project directory-ldap-api by apache.
the class ModifyDNResponseTest method testDecodeModifyResponseSuccessWithControls.
/**
* Test the decoding of a ModifyDNResponse with controls
*/
@Test
public void testDecodeModifyResponseSuccessWithControls() throws DecoderException, EncoderException {
ByteBuffer stream = ByteBuffer.allocate(0x32);
stream.put(new byte[] { // LDAPMessage ::=SEQUENCE {
0x30, // LDAPMessage ::=SEQUENCE {
0x30, // messageID MessageID
0x02, // messageID MessageID
0x01, // messageID MessageID
0x01, // CHOICE { ..., modifyDnResponse ModifyDNResponse, ...
0x6D, // CHOICE { ..., modifyDnResponse ModifyDNResponse, ...
0x07, // LDAPResult ::= SEQUENCE {
0x0A, // LDAPResult ::= SEQUENCE {
0x01, // LDAPResult ::= SEQUENCE {
0x00, // matchedDN LDAPDN,
0x04, // matchedDN LDAPDN,
0x00, // errorMessage LDAPString,
0x04, // errorMessage LDAPString,
0x00, // A control
(byte) 0xA0, // A control
0x22, 0x30, 0x20, // EntryChange response control
0x04, // EntryChange response control
0x17, '2', '.', '1', '6', '.', '8', '4', '0', '.', '1', '.', '1', '1', '3', '7', '3', '0', '.', '3', '.', '4', '.', '7', // Control value
0x04, // Control value
0x05, // EntryChangeNotification ::= SEQUENCE {
0x30, // EntryChangeNotification ::= SEQUENCE {
0x03, // changeType ENUMERATED {
0x0A, // changeType ENUMERATED {
0x01, // changeType ENUMERATED {
0x01 // add (1),
});
stream.flip();
// Allocate a LdapMessage Container
LdapMessageContainer<ModifyDnResponse> ldapMessageContainer = new LdapMessageContainer<>(codec);
// Decode the ModifyDNResponse PDU
Asn1Decoder.decode(stream, ldapMessageContainer);
// Check the decoded ModifyDNResponse PDU
ModifyDnResponse modifyDnResponse = ldapMessageContainer.getMessage();
assertEquals(1, modifyDnResponse.getMessageId());
assertEquals(ResultCodeEnum.SUCCESS, modifyDnResponse.getLdapResult().getResultCode());
assertEquals("", modifyDnResponse.getLdapResult().getMatchedDn().getName());
assertEquals("", modifyDnResponse.getLdapResult().getDiagnosticMessage());
// Check the Control
Map<String, Control> controls = modifyDnResponse.getControls();
assertEquals(1, controls.size());
Control control = controls.get("2.16.840.1.113730.3.4.7");
assertEquals("2.16.840.1.113730.3.4.7", control.getOid());
assertTrue(control instanceof EntryChange);
// Check encode reverse
Asn1Buffer buffer = new Asn1Buffer();
LdapEncoder.encodeMessage(buffer, codec, modifyDnResponse);
assertArrayEquals(stream.array(), buffer.getBytes().array());
}
use of org.apache.directory.api.asn1.util.Asn1Buffer in project directory-ldap-api by apache.
the class SearchRequestMatchingRuleAssertionTest method testDecodeSearchRequestExtensibleMatch.
/**
* Tests an search request decode with a simple equality match filter.
*/
@Test
public void testDecodeSearchRequestExtensibleMatch() throws DecoderException, EncoderException, LdapException {
ByteBuffer stream = ByteBuffer.allocate(0x63);
stream.put(new byte[] { // LDAPMessage ::= SEQUENCE {
0x30, // LDAPMessage ::= SEQUENCE {
0x61, // messageID
0x02, // messageID
0x01, // messageID
0x01, // protocolOp CHOICE {
0x63, // protocolOp CHOICE {
0x5C, // "dc=example,dc=com"
0x04, // "dc=example,dc=com"
0x11, 'd', 'c', '=', 'e', 'x', 'a', 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', // baseObject (0), ...
0x0A, // baseObject (0), ...
0x01, // baseObject (0), ...
0x00, // derefFindingBaseObj (2),...
0x0A, // derefFindingBaseObj (2),...
0x01, // derefFindingBaseObj (2),...
0x02, // sizeLimit INTEGER (0 .. maxInt), (2)
0x02, // sizeLimit INTEGER (0 .. maxInt), (2)
0x01, // sizeLimit INTEGER (0 .. maxInt), (2)
0x02, // timeLimit INTEGER (0 .. maxInt), (3)
0x02, // timeLimit INTEGER (0 .. maxInt), (3)
0x01, // timeLimit INTEGER (0 .. maxInt), (3)
0x03, // typesOnly BOOLEAN, (true)
0x01, // typesOnly BOOLEAN, (true)
0x01, // typesOnly BOOLEAN, (true)
(byte) 0xFF, // filter Filter,
(byte) 0xA9, // filter Filter,
0x21, // matchingRule [1] MatchingRuleId OPTIONAL,
(byte) 0x81, // matchingRule [1] MatchingRuleId OPTIONAL,
0x13, '1', '.', '2', '.', '8', '4', '0', '.', '4', '8', '0', '1', '8', '.', '1', '.', '2', '.', '2', // type [2] AttributeDescription OPTIONAL,
(byte) 0x82, // type [2] AttributeDescription OPTIONAL,
0x02, 'c', 'n', // matchValue [3] AssertionValue,
(byte) 0x83, // matchValue [3] AssertionValue,
0x03, 'a', 'o', 'k', // dnAttributes [4] BOOLEAN DEFAULT FALSE }
(byte) 0x84, 0x01, (byte) 0xFF, // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription
0x30, // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription
0x15, 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'0', 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'1', 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'2' });
stream.flip();
// Allocate a BindRequest Container
LdapMessageContainer<SearchRequest> ldapMessageContainer = new LdapMessageContainer<>(codec);
Asn1Decoder.decode(stream, ldapMessageContainer);
SearchRequest searchRequest = ldapMessageContainer.getMessage();
assertEquals(1, searchRequest.getMessageId());
assertEquals("dc=example,dc=com", searchRequest.getBase().toString());
assertEquals(SearchScope.OBJECT, searchRequest.getScope());
assertEquals(AliasDerefMode.DEREF_FINDING_BASE_OBJ, searchRequest.getDerefAliases());
assertEquals(2, searchRequest.getSizeLimit());
assertEquals(3, searchRequest.getTimeLimit());
assertEquals(true, searchRequest.getTypesOnly());
// The attributes
List<String> attributes = searchRequest.getAttributes();
for (String attribute : attributes) {
assertNotNull(attribute);
}
// Check encode reverse
Asn1Buffer buffer = new Asn1Buffer();
LdapEncoder.encodeMessage(buffer, codec, searchRequest);
assertArrayEquals(stream.array(), buffer.getBytes().array());
}
use of org.apache.directory.api.asn1.util.Asn1Buffer in project directory-ldap-api by apache.
the class SearchRequestSubstringTest method testDecodeSearchRequestSubstringFinal.
/**
* Test the decoding of a SearchRequest with a substring filter. Test the
* initial filter : (objectclass=*Amos)
*/
@Test
public void testDecodeSearchRequestSubstringFinal() throws DecoderException, EncoderException, LdapException {
ByteBuffer stream = ByteBuffer.allocate(0x67);
stream.put(new byte[] { // LDAPMessage ::=SEQUENCE {
0x30, // LDAPMessage ::=SEQUENCE {
0x65, // messageID
0x02, // messageID
0x01, // messageID
0x01, // CHOICE { ..., searchRequest SearchRequest, ...
0x63, // CHOICE { ..., searchRequest SearchRequest, ...
0x60, // baseObject LDAPDN,
0x04, // baseObject LDAPDN,
0x1F, 'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a', 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', // scope ENUMERATED {
0x0A, // scope ENUMERATED {
0x01, // scope ENUMERATED {
0x01, // derefAliases ENUMERATED {
0x0A, // derefAliases ENUMERATED {
0x01, // derefAliases ENUMERATED {
0x03, // sizeLimit INTEGER (0 .. maxInt), (1000)
0x02, // sizeLimit INTEGER (0 .. maxInt), (1000)
0x02, // sizeLimit INTEGER (0 .. maxInt), (1000)
0x03, // sizeLimit INTEGER (0 .. maxInt), (1000)
(byte) 0xE8, // timeLimit INTEGER (0 .. maxInt), (1000)
0x02, // timeLimit INTEGER (0 .. maxInt), (1000)
0x02, // timeLimit INTEGER (0 .. maxInt), (1000)
0x03, // timeLimit INTEGER (0 .. maxInt), (1000)
(byte) 0xE8, // typesOnly BOOLEAN, (TRUE) filter Filter,
0x01, // typesOnly BOOLEAN, (TRUE) filter Filter,
0x01, // typesOnly BOOLEAN, (TRUE) filter Filter,
(byte) 0xFF, // Filter ::= CHOICE {
(byte) 0xA4, // Filter ::= CHOICE {
0x15, // SubstringFilter ::= SEQUENCE {
0x04, 0x0B, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 0x30, 0x06, (byte) 0x82, 0x04, 'A', 'm', 'o', 's', // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription
0x30, // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription
0x15, 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'0', 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'1', 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'2' });
stream.flip();
// Allocate a BindRequest Container
LdapMessageContainer<SearchRequest> ldapMessageContainer = new LdapMessageContainer<>(codec);
Asn1Decoder.decode(stream, ldapMessageContainer);
SearchRequest searchRequest = ldapMessageContainer.getMessage();
assertEquals(1, searchRequest.getMessageId());
assertEquals("uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString());
assertEquals(SearchScope.ONELEVEL, searchRequest.getScope());
assertEquals(AliasDerefMode.DEREF_ALWAYS, searchRequest.getDerefAliases());
assertEquals(1000, searchRequest.getSizeLimit());
assertEquals(1000, searchRequest.getTimeLimit());
assertEquals(true, searchRequest.getTypesOnly());
// (objectclass=t*)
ExprNode node = searchRequest.getFilter();
SubstringNode substringNode = (SubstringNode) node;
assertNotNull(substringNode);
assertEquals("objectclass", substringNode.getAttribute());
assertEquals(null, substringNode.getInitial());
assertEquals(0, substringNode.getAny().size());
assertEquals("Amos", substringNode.getFinal());
// The attributes
List<String> attributes = searchRequest.getAttributes();
for (String attribute : attributes) {
assertNotNull(attribute);
}
// Check encode reverse
Asn1Buffer buffer = new Asn1Buffer();
LdapEncoder.encodeMessage(buffer, codec, searchRequest);
assertArrayEquals(stream.array(), buffer.getBytes().array());
}
use of org.apache.directory.api.asn1.util.Asn1Buffer in project directory-ldap-api by apache.
the class SearchRequestSubstringTest method testDecodeSearchRequestSubstringInitialAnyAny.
/**
* Test the decoding of a SearchRequest with a substring filter. Test the
* initial filter : (objectclass=t*)
*/
@Test
public void testDecodeSearchRequestSubstringInitialAnyAny() throws DecoderException, EncoderException, LdapException {
ByteBuffer stream = ByteBuffer.allocate(0x67);
stream.put(new byte[] { // LDAPMessage ::=SEQUENCE {
0x30, // LDAPMessage ::=SEQUENCE {
0x65, // messageID
0x02, // messageID
0x01, // messageID
0x01, // CHOICE { ..., searchRequest SearchRequest, ...
0x63, // CHOICE { ..., searchRequest SearchRequest, ...
0x60, // baseObject LDAPDN,
0x04, // baseObject LDAPDN,
0x1F, 'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a', 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', // scope ENUMERATED {
0x0A, // scope ENUMERATED {
0x01, // scope ENUMERATED {
0x01, // derefAliases ENUMERATED {
0x0A, // derefAliases ENUMERATED {
0x01, // derefAliases ENUMERATED {
0x03, // sizeLimit INTEGER (0 .. maxInt), (1000)
0x02, // sizeLimit INTEGER (0 .. maxInt), (1000)
0x02, // sizeLimit INTEGER (0 .. maxInt), (1000)
0x03, // sizeLimit INTEGER (0 .. maxInt), (1000)
(byte) 0xE8, // timeLimit INTEGER (0 .. maxInt), (1000)
0x02, // timeLimit INTEGER (0 .. maxInt), (1000)
0x02, // timeLimit INTEGER (0 .. maxInt), (1000)
0x03, // timeLimit INTEGER (0 .. maxInt), (1000)
(byte) 0xE8, // typesOnly BOOLEAN, (TRUE) filter Filter,
0x01, // typesOnly BOOLEAN, (TRUE) filter Filter,
0x01, // typesOnly BOOLEAN, (TRUE) filter Filter,
(byte) 0xFF, // Filter ::= CHOICE {
(byte) 0xA4, // Filter ::= CHOICE {
0x15, // SubstringFilter ::= SEQUENCE {
0x04, 0x0B, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', 0x30, 0x06, (byte) 0x80, 0x01, 't', (byte) 0x81, 0x01, '*', // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription
0x30, // AttributeDescriptionList ::= SEQUENCE OF AttributeDescription
0x15, 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'0', 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'1', 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'2' });
stream.flip();
// Allocate a BindRequest Container
LdapMessageContainer<SearchRequest> ldapMessageContainer = new LdapMessageContainer<>(codec);
Asn1Decoder.decode(stream, ldapMessageContainer);
SearchRequest searchRequest = ldapMessageContainer.getMessage();
assertEquals(1, searchRequest.getMessageId());
assertEquals("uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString());
assertEquals(SearchScope.ONELEVEL, searchRequest.getScope());
assertEquals(AliasDerefMode.DEREF_ALWAYS, searchRequest.getDerefAliases());
assertEquals(1000, searchRequest.getSizeLimit());
assertEquals(1000, searchRequest.getTimeLimit());
assertEquals(true, searchRequest.getTypesOnly());
// (objectclass=t*)
ExprNode node = searchRequest.getFilter();
SubstringNode substringNode = (SubstringNode) node;
assertNotNull(substringNode);
assertEquals("objectclass", substringNode.getAttribute());
assertEquals("t", substringNode.getInitial());
assertEquals("*", substringNode.getAny().get(0));
// The attributes
List<String> attributes = searchRequest.getAttributes();
for (String attribute : attributes) {
assertNotNull(attribute);
}
// Check encode reverse
Asn1Buffer buffer = new Asn1Buffer();
LdapEncoder.encodeMessage(buffer, codec, searchRequest);
assertArrayEquals(stream.array(), buffer.getBytes().array());
}
use of org.apache.directory.api.asn1.util.Asn1Buffer in project directory-ldap-api by apache.
the class SearchRequestTest method testDecodeSearchRequestGlobalNoControls.
/**
* Test the decoding of a SearchRequest with no controls. The search filter
* is : (&(|(objectclass=top)(ou=contacts))(!(objectclass=ttt)))
*/
@Test
public void testDecodeSearchRequestGlobalNoControls() throws DecoderException, EncoderException, LdapException {
ByteBuffer stream = ByteBuffer.allocate(0x90);
stream.put(new byte[] { // LDAPMessage ::=SEQUENCE {
0x30, // LDAPMessage ::=SEQUENCE {
(byte) 0x81, // LDAPMessage ::=SEQUENCE {
(byte) 0x8D, // messageID MessageID
0x02, // messageID MessageID
0x01, // messageID MessageID
0x01, // CHOICE { ...,
0x63, // CHOICE { ...,
(byte) 0x81, // CHOICE { ...,
(byte) 0x87, // baseObject LDAPDN,
0x04, // baseObject LDAPDN,
0x1F, 'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a', 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', // scope ENUMERATED {
0x0A, // scope ENUMERATED {
0x01, // scope ENUMERATED {
0x01, // derefAliases ENUMERATED {
0x0A, // derefAliases ENUMERATED {
0x01, // derefAliases ENUMERATED {
0x03, // sizeLimit INTEGER (0 .. maxInt), (1000)
0x02, // sizeLimit INTEGER (0 .. maxInt), (1000)
0x02, // sizeLimit INTEGER (0 .. maxInt), (1000)
0x03, // sizeLimit INTEGER (0 .. maxInt), (1000)
(byte) 0xE8, // timeLimit INTEGER (0 .. maxInt), (1000)
0x02, // timeLimit INTEGER (0 .. maxInt), (1000)
0x02, // timeLimit INTEGER (0 .. maxInt), (1000)
0x03, // timeLimit INTEGER (0 .. maxInt), (1000)
(byte) 0xE8, // typesOnly BOOLEAN, (TRUE)
0x01, // typesOnly BOOLEAN, (TRUE)
0x01, // typesOnly BOOLEAN, (TRUE)
(byte) 0xFF, // Filter ::= CHOICE {
(byte) 0xA0, // Filter ::= CHOICE {
0x3C, // or [1] SET of Filter,
(byte) 0xA1, // or [1] SET of Filter,
0x24, // equalityMatch [3]
(byte) 0xA3, // equalityMatch [3]
0x12, 0x04, 0x0B, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', // assertionValue AssertionValue (OCTET STRING) }
0x04, 0x03, 't', 'o', 'p', // equalityMatch [3] Assertion,
(byte) 0xA3, // equalityMatch [3] Assertion,
0x0E, // Assertion ::= SEQUENCE {
0x04, 0x02, // attributeDesc AttributeDescription (LDAPString),
'o', // attributeDesc AttributeDescription (LDAPString),
'u', // assertionValue AssertionValue (OCTET STRING) }
0x04, 0x08, 'c', 'o', 'n', 't', 'a', 'c', 't', 's', // not [2] Filter,
(byte) 0xA2, // not [2] Filter,
0x14, // equalityMatch [3] Assertion,
(byte) 0xA3, // equalityMatch [3] Assertion,
0x12, 0x04, 0x0B, 'o', 'b', 'j', 'e', 'c', 't', 'c', 'l', 'a', 's', 's', // assertionValue AssertionValue (OCTET STRING) }
0x04, 0x03, 't', 't', 't', // AttributeDescriptionList ::= SEQUENCE OF
0x30, // AttributeDescriptionList ::= SEQUENCE OF
0x15, 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'0', 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'1', 0x04, 0x05, // AttributeDescription ::= LDAPString
'a', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
't', // AttributeDescription ::= LDAPString
'r', // AttributeDescription ::= LDAPString
'2' });
stream.flip();
// Allocate a BindRequest Container
LdapMessageContainer<SearchRequest> ldapMessageContainer = new LdapMessageContainer<>(codec);
Asn1Decoder.decode(stream, ldapMessageContainer);
assertEquals(TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState());
SearchRequest searchRequest = ldapMessageContainer.getMessage();
assertEquals(1, searchRequest.getMessageId());
assertEquals("uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString());
assertEquals(SearchScope.ONELEVEL, searchRequest.getScope());
assertEquals(AliasDerefMode.DEREF_ALWAYS, searchRequest.getDerefAliases());
assertEquals(1000, searchRequest.getSizeLimit());
assertEquals(1000, searchRequest.getTimeLimit());
assertEquals(true, searchRequest.getTypesOnly());
// (& (...
ExprNode node = searchRequest.getFilter();
AndNode andNode = (AndNode) node;
assertNotNull(andNode);
List<ExprNode> andNodes = andNode.getChildren();
// (& (| (...
assertEquals(2, andNodes.size());
OrNode orFilter = (OrNode) andNodes.get(0);
assertNotNull(orFilter);
// (& (| (obectclass=top) (...
List<ExprNode> orNodes = orFilter.getChildren();
assertEquals(2, orNodes.size());
EqualityNode<?> equalityNode = (EqualityNode<?>) orNodes.get(0);
assertNotNull(equalityNode);
assertEquals("objectclass", equalityNode.getAttribute());
assertEquals("top", equalityNode.getValue().getString());
// (& (| (objectclass=top) (ou=contacts) ) (...
equalityNode = (EqualityNode<?>) orNodes.get(1);
assertNotNull(equalityNode);
assertEquals("ou", equalityNode.getAttribute());
assertEquals("contacts", equalityNode.getValue().getString());
// (& (| (objectclass=top) (ou=contacts) ) (! ...
NotNode notNode = (NotNode) andNodes.get(1);
assertNotNull(notNode);
// (& (| (objectclass=top) (ou=contacts) ) (! (objectclass=ttt) ) )
equalityNode = (EqualityNode<?>) notNode.getFirstChild();
assertNotNull(equalityNode);
assertEquals("objectclass", equalityNode.getAttribute());
assertEquals("ttt", equalityNode.getValue().getString());
List<String> attributes = searchRequest.getAttributes();
for (String attribute : attributes) {
assertNotNull(attribute);
}
// Check encode reverse
Asn1Buffer buffer = new Asn1Buffer();
LdapEncoder.encodeMessage(buffer, codec, searchRequest);
assertArrayEquals(stream.array(), buffer.getBytes().array());
}
Aggregations