fail( de.getMessage() );
}
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 filter = searchRequest.getFilter();
AndNode andNode = ( AndNode ) filter;
assertNotNull( andNode );
List<ExprNode> andNodes = andNode.getChildren();
// (& (| (...
assertEquals( 2, andNodes.size() );
OrNode orFilter = ( OrNode ) andNodes.get( 0 );
assertNotNull( orFilter );
// (& (| (objectclass~=top) (...
List<ExprNode> orNodes = orFilter.getChildren();
assertEquals( 2, orNodes.size() );
ApproximateNode<?> approxNode = ( ApproximateNode<?> ) orNodes.get( 0 );
assertNotNull( approxNode );
assertEquals( "objectclass", approxNode.getAttribute() );
assertEquals( "top", approxNode.getValue().getString() );
// (& (| (objectclass~=top) (ou<=contacts) ) (...
LessEqNode<?> lessOrEqualNode = ( LessEqNode<?> ) orNodes.get( 1 );
assertNotNull( lessOrEqualNode );
assertEquals( "ou", lessOrEqualNode.getAttribute() );
assertEquals( "contacts", lessOrEqualNode.getValue().getString() );
// (& (| (objectclass~=top) (ou<=contacts) ) (! ...
NotNode notNode = ( NotNode ) andNodes.get( 1 );
assertNotNull( notNode );
// (& (| (objectclass~=top) (ou<=contacts) ) (! (objectclass>=ttt) ) )
GreaterEqNode<?> greaterOrEqual = ( GreaterEqNode<?> ) notNode.getFirstChild();
assertNotNull( greaterOrEqual );
assertEquals( "objectclass", greaterOrEqual.getAttribute() );
assertEquals( "ttt", greaterOrEqual.getValue().getString() );
// The attributes
List<String> attributes = searchRequest.getAttributes();
for ( String attribute : attributes )
{
assertNotNull( attribute );
}