* Check if user and operational attributes are present, if both "*" and "+" are requested.
*/
@Test
public void testSearchOperationalAndUserAttributes() throws Exception
{
LdapContext ctx = ( LdapContext ) getWiredContext( getLdapServer() ).lookup( BASE );
SearchControls ctls = new SearchControls();
ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
ctls.setReturningAttributes( new String[]
{ "+", "*" } );
String[] userAttrNames =
{ "objectClass", "sn", "cn" };
String[] opAttrNames =
{ "creatorsName", "createTimestamp" };
NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER, ctls );
if ( result.hasMore() )
{
SearchResult entry = result.next();
Attributes attrs = entry.getAttributes();
assertNotNull( attrs );
checkForAttributes( attrs, userAttrNames );
checkForAttributes( attrs, opAttrNames );
}
else
{
fail( "entry " + HEATHER_RDN + " not found" );
}
result.close();
ctls.setReturningAttributes( new String[]
{ "*", "+" } );
result = ctx.search( HEATHER_RDN, FILTER, ctls );
if ( result.hasMore() )
{
SearchResult entry = result.next();
Attributes attrs = entry.getAttributes();