directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r957232 [1/2] - in /directory: apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/ apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/ apacheds/trunk/core/src/main/java/or...
Date Wed, 23 Jun 2010 14:58:04 GMT
Author: elecharny
Date: Wed Jun 23 14:58:04 2010
New Revision: 957232

URL: http://svn.apache.org/viewvc?rev=957232&view=rev
Log:
applied back http://svn.apache.org/viewvc?rev=956033&view=rev

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/ImmutableAttributeTypeRegistry.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java?rev=957232&r1=957231&r2=957232&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java Wed Jun 23 14:58:04 2010
@@ -73,92 +73,34 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+
 /**
  * Tests the search() methods of the provider.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkRunner.class )
-@CreateDS( name="SearchDS" )
+@RunWith(FrameworkRunner.class)
+@CreateDS(name = "SearchDS")
 @ApplyLdifs(
-    {
-        "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema",
-        "objectclass: metaAttributeType",
-        "objectclass: metaTop",
-        "objectclass: top",
-        "m-oid: 2.2.0",
-        "m-name: integerAttribute",
-        "m-description: the precursor for all integer attributes",
-        "m-equality: integerMatch",
-        "m-ordering: integerOrderingMatch",
-        "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27",
-        "m-length: 0",
-        "",
-        "dn: ou=testing00,ou=system",
-        "objectClass: top",
-        "objectClass: organizationalUnit",
-        "objectClass: extensibleObject",
-        "ou: testing00",
-        "integerAttribute: 0",
-        "",
-        "dn: ou=testing01,ou=system",
-        "objectClass: top",
-        "objectClass: organizationalUnit",
-        "objectClass: extensibleObject",
-        "ou: testing01",
-        "integerAttribute: 1",
-        "",
-        "dn: ou=testing02,ou=system",
-        "objectClass: top",
-        "objectClass: organizationalUnit",
-        "objectClass: extensibleObject",
-        "ou: testing02",
-        "integerAttribute: 2",
-        "",
-        "dn: ou=testing03,ou=system",
-        "objectClass: top",
-        "objectClass: organizationalUnit",
-        "objectClass: extensibleObject",
-        "ou: testing03",
-        "integerAttribute: 3",
-        "",
-        "dn: ou=testing04,ou=system",
-        "objectClass: top",
-        "objectClass: organizationalUnit",
-        "objectClass: extensibleObject",
-        "ou: testing04",
-        "integerAttribute: 4",
-        "",
-        "dn: ou=testing05,ou=system",
-        "objectClass: top",
-        "objectClass: organizationalUnit",
-        "objectClass: extensibleObject",
-        "ou: testing05",
-        "integerAttribute: 5",
-        "",
-        "dn: ou=subtest,ou=testing01,ou=system",
-        "objectClass: top",
-        "objectClass: organizationalUnit",
-        "ou: subtest",
-        "",
-        "dn: cn=Heather Nova, ou=system",
-        "objectClass: top",
-        "objectClass: person",
-        "cn: Heather Nova",
-        "sn: Nova",
-        "telephoneNumber: 1 801 555 1212 ",
-        "",
-        "dn: cn=with-dn, ou=system",
-        "objectClass: top",
-        "objectClass: person",
-        "objectClass: organizationalPerson",
-        "objectClass: inetorgPerson",
-        "cn: singer",
-        "sn: manager",
-        "telephoneNumber: 1 801 555 1212 ",
-        "manager: cn=Heather Nova, ou=system"
-    }
-)
+    { "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema", "objectclass: metaAttributeType",
+        "objectclass: metaTop", "objectclass: top", "m-oid: 2.2.0", "m-name: integerAttribute",
+        "m-description: the precursor for all integer attributes", "m-equality: integerMatch",
+        "m-ordering: integerOrderingMatch", "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27", "m-length: 0", "",
+        "dn: ou=testing00,ou=system", "objectClass: top", "objectClass: organizationalUnit",
+        "objectClass: extensibleObject", "ou: testing00", "integerAttribute: 0", "", "dn: ou=testing01,ou=system",
+        "objectClass: top", "objectClass: organizationalUnit", "objectClass: extensibleObject", "ou: testing01",
+        "integerAttribute: 1", "", "dn: ou=testing02,ou=system", "objectClass: top", "objectClass: organizationalUnit",
+        "objectClass: extensibleObject", "ou: testing02", "integerAttribute: 2", "", "dn: ou=testing03,ou=system",
+        "objectClass: top", "objectClass: organizationalUnit", "objectClass: extensibleObject", "ou: testing03",
+        "integerAttribute: 3", "", "dn: ou=testing04,ou=system", "objectClass: top", "objectClass: organizationalUnit",
+        "objectClass: extensibleObject", "ou: testing04", "integerAttribute: 4", "", "dn: ou=testing05,ou=system",
+        "objectClass: top", "objectClass: organizationalUnit", "objectClass: extensibleObject", "ou: testing05",
+        "integerAttribute: 5", "", "dn: ou=subtest,ou=testing01,ou=system", "objectClass: top",
+        "objectClass: organizationalUnit", "ou: subtest", "", "dn: cn=Heather Nova, ou=system", "objectClass: top",
+        "objectClass: person", "cn: Heather Nova", "sn: Nova", "telephoneNumber: 1 801 555 1212 ", "",
+        "dn: cn=with-dn, ou=system", "objectClass: top", "objectClass: person", "objectClass: organizationalPerson",
+        "objectClass: inetorgPerson", "cn: singer", "sn: manager", "telephoneNumber: 1 801 555 1212 ",
+        "manager: cn=Heather Nova, ou=system" })
 public class SearchIT extends AbstractLdapTestUnit
 {
     private static final String RDN = "cn=Heather Nova";
@@ -166,6 +108,7 @@ public class SearchIT extends AbstractLd
 
     public static LdapContext sysRoot;
 
+
     /**
      * @param sysRoot the system root to add entries to
      * @throws NamingException on errors
@@ -175,8 +118,8 @@ public class SearchIT extends AbstractLd
     {
         service.getSchemaManager().enable( "nis" );
 
-        sysRoot = getSystemContext( service ); 
-            
+        sysRoot = getSystemContext( service );
+
         /*
          * Check ou=testing00,ou=system
          */
@@ -239,7 +182,6 @@ public class SearchIT extends AbstractLd
         ctx = ( DirContext ) sysRoot.lookup( RDN );
         assertNotNull( ctx );
 
-
         // -------------------------------------------------------------------
         // Enable the nis schema
         // -------------------------------------------------------------------
@@ -248,7 +190,7 @@ public class SearchIT extends AbstractLd
         LdapContext schemaRoot = getSchemaContext( service );
         Attributes nisAttrs = schemaRoot.getAttributes( "cn=nis" );
         boolean isNisDisabled = false;
-        
+
         if ( nisAttrs.get( "m-disabled" ) != null )
         {
             isNisDisabled = ( ( String ) nisAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase( "TRUE" );
@@ -258,8 +200,8 @@ public class SearchIT extends AbstractLd
         if ( isNisDisabled )
         {
             Attribute disabled = new BasicAttribute( "m-disabled" );
-            ModificationItem[] mods = new ModificationItem[] {
-                new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
+            ModificationItem[] mods = new ModificationItem[]
+                { new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
             schemaRoot.modifyAttributes( "cn=nis", mods );
         }
 
@@ -279,13 +221,10 @@ public class SearchIT extends AbstractLd
      */
     private static DirContext addNisPosixGroup( String name, int gid ) throws Exception
     {
-        Attributes attrs = LdifUtils.createAttributes( 
-            "objectClass: top", 
-            "objectClass: posixGroup",
-            "cn", name,
+        Attributes attrs = LdifUtils.createAttributes( "objectClass: top", "objectClass: posixGroup", "cn", name,
             "gidNumber", String.valueOf( gid ) );
-        
-        return getSystemContext( service ).createSubcontext( "cn="+name+",ou=groups", attrs );
+
+        return getSystemContext( service ).createSubcontext( "cn=" + name + ",ou=groups", attrs );
     }
 
 
@@ -295,12 +234,12 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-        HashMap<String,Attributes> map = new HashMap<String,Attributes>();
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=*)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -320,12 +259,12 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
 
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=*)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -347,14 +286,15 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setDerefLinkFlag( false );
-        controls.setReturningAttributes( new String[]{ "1.1" } );
-        
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        controls.setReturningAttributes( new String[]
+            { "1.1" } );
+
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
 
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing02)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -374,12 +314,12 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
 
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(objectClass=organ*)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -417,15 +357,15 @@ public class SearchIT extends AbstractLd
         SearchControls cons = new SearchControls();
         NamingEnumeration<SearchResult> e = sysRoot.search( "", "(bogusAttribute=abc123)", cons );
         assertNotNull( e );
-        
+
         e = sysRoot.search( "", "(!(bogusAttribute=abc123))", cons );
         assertNotNull( e );
         assertFalse( e.hasMore() );
-        
+
         e = sysRoot.search( "", "(|(bogusAttribute=abc123)(bogusAttribute=abc123))", cons );
         assertNotNull( e );
         assertFalse( e.hasMore() );
-        
+
         e = sysRoot.search( "", "(|(bogusAttribute=abc123)(ou=abc123))", cons );
         assertNotNull( e );
         assertFalse( e.hasMore() );
@@ -436,7 +376,7 @@ public class SearchIT extends AbstractLd
 
         e = sysRoot.search( "", "(objectclass=*)", cons );
         assertNotNull( e );
-        
+
         service.setAllowAnonymousAccess( oldSetAllowAnnonymousAccess );
     }
 
@@ -447,13 +387,13 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(|(ou={0})(ou={1}))", new Object[]
             { "testing00", "testing01" }, controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -472,22 +412,22 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-        
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(name=testing00)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
             map.put( result.getName(), result.getAttributes() );
         }
-        
+
         assertEquals( "size of results", 1, map.size() );
-        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); 
+        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) );
     }
-    
+
 
     @Test
     public void testFilterExpansion1() throws Exception
@@ -495,56 +435,60 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-        
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(name=*)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
             map.put( result.getName(), result.getAttributes() );
         }
-        
+
         assertEquals( "size of results", 23, map.size() );
-        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); 
-        assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) ); 
-        assertTrue( "contains ou=testing02,ou=system", map.containsKey( "ou=testing01,ou=system" ) ); 
-        assertTrue( "contains ou=configuration,ou=system", map.containsKey( "ou=configuration,ou=system" ) ); 
-        assertTrue( "contains ou=groups,ou=system", map.containsKey( "ou=groups,ou=system" ) ); 
-        assertTrue( "contains ou=interceptors,ou=configuration,ou=system", map.containsKey( "ou=interceptors,ou=configuration,ou=system" ) ); 
-        assertTrue( "contains ou=partitions,ou=configuration,ou=system", map.containsKey( "ou=partitions,ou=configuration,ou=system" ) ); 
-        assertTrue( "contains ou=services,ou=configuration,ou=system", map.containsKey( "ou=services,ou=configuration,ou=system" ) ); 
-        assertTrue( "contains ou=subtest,ou=testing01,ou=system", map.containsKey( "ou=subtest,ou=testing01,ou=system" ) ); 
-        assertTrue( "contains ou=system", map.containsKey( "ou=system" ) ); 
-        assertTrue( "contains ou=users,ou=system", map.containsKey( "ou=users,ou=system" ) ); 
-        assertTrue( "contains uid=admin,ou=system", map.containsKey( "uid=admin,ou=system" ) ); 
-        assertTrue( "contains cn=administrators,ou=groups,ou=system", map.containsKey( "cn=Administrators,ou=groups,ou=system" ) ); 
+        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) );
+        assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) );
+        assertTrue( "contains ou=testing02,ou=system", map.containsKey( "ou=testing01,ou=system" ) );
+        assertTrue( "contains ou=configuration,ou=system", map.containsKey( "ou=configuration,ou=system" ) );
+        assertTrue( "contains ou=groups,ou=system", map.containsKey( "ou=groups,ou=system" ) );
+        assertTrue( "contains ou=interceptors,ou=configuration,ou=system", map
+            .containsKey( "ou=interceptors,ou=configuration,ou=system" ) );
+        assertTrue( "contains ou=partitions,ou=configuration,ou=system", map
+            .containsKey( "ou=partitions,ou=configuration,ou=system" ) );
+        assertTrue( "contains ou=services,ou=configuration,ou=system", map
+            .containsKey( "ou=services,ou=configuration,ou=system" ) );
+        assertTrue( "contains ou=subtest,ou=testing01,ou=system", map.containsKey( "ou=subtest,ou=testing01,ou=system" ) );
+        assertTrue( "contains ou=system", map.containsKey( "ou=system" ) );
+        assertTrue( "contains ou=users,ou=system", map.containsKey( "ou=users,ou=system" ) );
+        assertTrue( "contains uid=admin,ou=system", map.containsKey( "uid=admin,ou=system" ) );
+        assertTrue( "contains cn=administrators,ou=groups,ou=system", map
+            .containsKey( "cn=Administrators,ou=groups,ou=system" ) );
     }
-    
-    
+
+
     @Test
     public void testFilterExpansion2() throws Exception
     {
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-        
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(|(name=testing00)(name=testing01))", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
             map.put( result.getName(), result.getAttributes() );
         }
-        
+
         assertEquals( "size of results", 2, map.size() );
-        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); 
-        assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) ); 
+        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) );
+        assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) );
     }
 
 
@@ -554,25 +498,25 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-        
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(name=testing*)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
             map.put( result.getName(), result.getAttributes() );
         }
-        
+
         assertEquals( "size of results", 6, map.size() );
-        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); 
-        assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) ); 
-        assertTrue( "contains ou=testing02,ou=system", map.containsKey( "ou=testing02,ou=system" ) ); 
-        assertTrue( "contains ou=testing03,ou=system", map.containsKey( "ou=testing03,ou=system" ) ); 
-        assertTrue( "contains ou=testing04,ou=system", map.containsKey( "ou=testing04,ou=system" ) ); 
-        assertTrue( "contains ou=testing05,ou=system", map.containsKey( "ou=testing05,ou=system" ) ); 
+        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) );
+        assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) );
+        assertTrue( "contains ou=testing02,ou=system", map.containsKey( "ou=testing02,ou=system" ) );
+        assertTrue( "contains ou=testing03,ou=system", map.containsKey( "ou=testing03,ou=system" ) );
+        assertTrue( "contains ou=testing04,ou=system", map.containsKey( "ou=testing04,ou=system" ) );
+        assertTrue( "contains ou=testing05,ou=system", map.containsKey( "ou=testing05,ou=system" ) );
     }
 
 
@@ -582,32 +526,32 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-        
-        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-        String filter = "(|(2.5.4.11.1=testing*)(2.5.4.54=testing*)(2.5.4.10=testing*)" +
-            "(2.5.4.6=testing*)(2.5.4.43=testing*)(2.5.4.7.1=testing*)(2.5.4.10.1=testing*)" +
-            "(2.5.4.44=testing*)(2.5.4.11=testing*)(2.5.4.4=testing*)(2.5.4.8.1=testing*)" +
-            "(2.5.4.12=testing*)(1.3.6.1.4.1.18060.0.4.1.2.3=testing*)" +
-            "(2.5.4.7=testing*)(2.5.4.3=testing*)(2.5.4.8=testing*)(2.5.4.42=testing*))";
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+        String filter = "(|(2.5.4.11.1=testing*)(2.5.4.54=testing*)(2.5.4.10=testing*)"
+            + "(2.5.4.6=testing*)(2.5.4.43=testing*)(2.5.4.7.1=testing*)(2.5.4.10.1=testing*)"
+            + "(2.5.4.44=testing*)(2.5.4.11=testing*)(2.5.4.4=testing*)(2.5.4.8.1=testing*)"
+            + "(2.5.4.12=testing*)(1.3.6.1.4.1.18060.0.4.1.2.3=testing*)"
+            + "(2.5.4.7=testing*)(2.5.4.3=testing*)(2.5.4.8=testing*)(2.5.4.42=testing*))";
         NamingEnumeration<SearchResult> list = sysRoot.search( "", filter, controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
             map.put( result.getName(), result.getAttributes() );
         }
-        
+
         assertEquals( "size of results", 6, map.size() );
-        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) ); 
-        assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) ); 
-        assertTrue( "contains ou=testing02,ou=system", map.containsKey( "ou=testing02,ou=system" ) ); 
-        assertTrue( "contains ou=testing03,ou=system", map.containsKey( "ou=testing03,ou=system" ) ); 
-        assertTrue( "contains ou=testing04,ou=system", map.containsKey( "ou=testing04,ou=system" ) ); 
-        assertTrue( "contains ou=testing05,ou=system", map.containsKey( "ou=testing05,ou=system" ) ); 
+        assertTrue( "contains ou=testing00,ou=system", map.containsKey( "ou=testing00,ou=system" ) );
+        assertTrue( "contains ou=testing01,ou=system", map.containsKey( "ou=testing01,ou=system" ) );
+        assertTrue( "contains ou=testing02,ou=system", map.containsKey( "ou=testing02,ou=system" ) );
+        assertTrue( "contains ou=testing03,ou=system", map.containsKey( "ou=testing03,ou=system" ) );
+        assertTrue( "contains ou=testing04,ou=system", map.containsKey( "ou=testing04,ou=system" ) );
+        assertTrue( "contains ou=testing05,ou=system", map.containsKey( "ou=testing05,ou=system" ) );
     }
-    
+
 
     @Test
     public void testOpAttrDenormalizationOff() throws Exception
@@ -615,13 +559,14 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        controls.setReturningAttributes( new String[] { "creatorsName" } );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        controls.setReturningAttributes( new String[]
+            { "creatorsName" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing00)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -631,8 +576,8 @@ public class SearchIT extends AbstractLd
         assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
         assertTrue( map.containsKey( "ou=testing00,ou=system" ) );
         Attributes attrs = map.get( "ou=testing00,ou=system" );
-        assertEquals( "normalized creator's name", "0.9.2342.19200300.100.1.1=admin,2.5.4.11=system", 
-            attrs.get( "creatorsName" ).get() );
+        assertEquals( "normalized creator's name", "0.9.2342.19200300.100.1.1=admin,2.5.4.11=system", attrs.get(
+            "creatorsName" ).get() );
     }
 
 
@@ -643,13 +588,14 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        controls.setReturningAttributes( new String[] { "creatorsName" } );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        controls.setReturningAttributes( new String[]
+            { "creatorsName" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing00)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -659,11 +605,10 @@ public class SearchIT extends AbstractLd
         assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
         assertTrue( map.containsKey( "ou=testing00,ou=system" ) );
         Attributes attrs = map.get( "ou=testing00,ou=system" );
-        assertEquals( "normalized creator's name", "uid=admin,ou=system", 
-            attrs.get( "creatorsName" ).get() );
+        assertEquals( "normalized creator's name", "uid=admin,ou=system", attrs.get( "creatorsName" ).get() );
     }
 
-    
+
     /**
      * Creation of required attributes of a person entry.
      *
@@ -673,12 +618,8 @@ public class SearchIT extends AbstractLd
      */
     protected Attributes getPersonAttributes( String sn, String cn ) throws LdapException
     {
-        Attributes attributes = LdifUtils.createAttributes( 
-            "objectClass: top",
-            "objectClass: top",
-            "objectClass: person",
-            "cn", cn,
-            "sn", sn );
+        Attributes attributes = LdifUtils.createAttributes( "objectClass: top", "objectClass: top",
+            "objectClass: person", "cn", cn, "sn", sn );
 
         return attributes;
     }
@@ -687,8 +628,9 @@ public class SearchIT extends AbstractLd
     @Test
     public void testBinaryAttributesInFilter() throws Exception
     {
-        byte[] certData = new byte[] { 0x34, 0x56, 0x4e, 0x5f };
-        
+        byte[] certData = new byte[]
+            { 0x34, 0x56, 0x4e, 0x5f };
+
         // First let's add a some binary data representing a userCertificate
         Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
         attrs.put( "userCertificate", certData );
@@ -723,13 +665,14 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        controls.setReturningAttributes( new String[] { "+" } );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        controls.setReturningAttributes( new String[]
+            { "+" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -753,13 +696,14 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        controls.setReturningAttributes( new String[] { "*" } );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        controls.setReturningAttributes( new String[]
+            { "*" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -783,13 +727,14 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        controls.setReturningAttributes( new String[] { "*", "creatorsName" } );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        controls.setReturningAttributes( new String[]
+            { "*", "creatorsName" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -813,13 +758,14 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        controls.setReturningAttributes( new String[] { "1.1", "ou" } );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        controls.setReturningAttributes( new String[]
+            { "1.1", "ou" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -843,13 +789,14 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        controls.setReturningAttributes( new String[] { "1.1" } );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        controls.setReturningAttributes( new String[]
+            { "1.1" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
-        
+
         while ( list.hasMore() )
         {
             SearchResult result = list.next();
@@ -873,13 +820,13 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         controls.setDerefLinkFlag( false );
-        controls.setReturningAttributes( new String[] { "+", "*" } );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
+        controls.setReturningAttributes( new String[]
+            { "+", "*" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
-        
 
         while ( list.hasMore() )
         {
@@ -966,38 +913,36 @@ public class SearchIT extends AbstractLd
 
 
     // this one is failing because it returns the admin user twice: count = 15
-//    public void testFilterExpansion3() throws Exception
-//    {
-//        SearchControls controls = new SearchControls();
-//        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-//        controls.setDerefLinkFlag( false );
-//        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES );
-//        
-//        List map = new ArrayList();
-//        NamingEnumeration list = sysRoot.search( "", "(name=*)", controls );
-//        while ( list.hasMore() )
-//        {
-//            SearchResult result = ( SearchResult ) list.next();
-//            map.add( result.getName() );
-//        }
-//        assertEquals( "size of results", 14, map.size() );
-//        assertTrue( "contains ou=testing00,ou=system", map.contains( "ou=testing00,ou=system" ) ); 
-//        assertTrue( "contains ou=testing01,ou=system", map.contains( "ou=testing01,ou=system" ) ); 
-//        assertTrue( "contains ou=testing02,ou=system", map.contains( "ou=testing01,ou=system" ) ); 
-//        assertTrue( "contains uid=akarasulu,ou=users,ou=system", map.contains( "uid=akarasulu,ou=users,ou=system" ) ); 
-//        assertTrue( "contains ou=configuration,ou=system", map.contains( "ou=configuration,ou=system" ) ); 
-//        assertTrue( "contains ou=groups,ou=system", map.contains( "ou=groups,ou=system" ) ); 
-//        assertTrue( "contains ou=interceptors,ou=configuration,ou=system", map.contains( "ou=interceptors,ou=configuration,ou=system" ) ); 
-//        assertTrue( "contains ou=partitions,ou=configuration,ou=system", map.contains( "ou=partitions,ou=configuration,ou=system" ) ); 
-//        assertTrue( "contains ou=services,ou=configuration,ou=system", map.contains( "ou=services,ou=configuration,ou=system" ) ); 
-//        assertTrue( "contains ou=subtest,ou=testing01,ou=system", map.contains( "ou=subtest,ou=testing01,ou=system" ) ); 
-//        assertTrue( "contains ou=system", map.contains( "ou=system" ) ); 
-//        assertTrue( "contains ou=users,ou=system", map.contains( "ou=users,ou=system" ) ); 
-//        assertTrue( "contains uid=admin,ou=system", map.contains( "uid=admin,ou=system" ) ); 
-//        assertTrue( "contains cn=administrators,ou=groups,ou=system", map.contains( "cn=administrators,ou=groups,ou=system" ) ); 
-//    }
-
-
+    //    public void testFilterExpansion3() throws Exception
+    //    {
+    //        SearchControls controls = new SearchControls();
+    //        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+    //        controls.setDerefLinkFlag( false );
+    //        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES );
+    //        
+    //        List map = new ArrayList();
+    //        NamingEnumeration list = sysRoot.search( "", "(name=*)", controls );
+    //        while ( list.hasMore() )
+    //        {
+    //            SearchResult result = ( SearchResult ) list.next();
+    //            map.add( result.getName() );
+    //        }
+    //        assertEquals( "size of results", 14, map.size() );
+    //        assertTrue( "contains ou=testing00,ou=system", map.contains( "ou=testing00,ou=system" ) ); 
+    //        assertTrue( "contains ou=testing01,ou=system", map.contains( "ou=testing01,ou=system" ) ); 
+    //        assertTrue( "contains ou=testing02,ou=system", map.contains( "ou=testing01,ou=system" ) ); 
+    //        assertTrue( "contains uid=akarasulu,ou=users,ou=system", map.contains( "uid=akarasulu,ou=users,ou=system" ) ); 
+    //        assertTrue( "contains ou=configuration,ou=system", map.contains( "ou=configuration,ou=system" ) ); 
+    //        assertTrue( "contains ou=groups,ou=system", map.contains( "ou=groups,ou=system" ) ); 
+    //        assertTrue( "contains ou=interceptors,ou=configuration,ou=system", map.contains( "ou=interceptors,ou=configuration,ou=system" ) ); 
+    //        assertTrue( "contains ou=partitions,ou=configuration,ou=system", map.contains( "ou=partitions,ou=configuration,ou=system" ) ); 
+    //        assertTrue( "contains ou=services,ou=configuration,ou=system", map.contains( "ou=services,ou=configuration,ou=system" ) ); 
+    //        assertTrue( "contains ou=subtest,ou=testing01,ou=system", map.contains( "ou=subtest,ou=testing01,ou=system" ) ); 
+    //        assertTrue( "contains ou=system", map.contains( "ou=system" ) ); 
+    //        assertTrue( "contains ou=users,ou=system", map.contains( "ou=users,ou=system" ) ); 
+    //        assertTrue( "contains uid=admin,ou=system", map.contains( "uid=admin,ou=system" ) ); 
+    //        assertTrue( "contains cn=administrators,ou=groups,ou=system", map.contains( "cn=administrators,ou=groups,ou=system" ) ); 
+    //    }
 
     /**
      *  Convenience method that performs a one level search using the
@@ -1018,7 +963,7 @@ public class SearchIT extends AbstractLd
         Set<String> results = new HashSet<String>();
         NamingEnumeration<SearchResult> list = getSystemContext( service ).search( "ou=groups", filter, controls );
 
-        while( list.hasMore() )
+        while ( list.hasMore() )
         {
             SearchResult result = list.next();
             results.add( result.getName() );
@@ -1057,7 +1002,7 @@ public class SearchIT extends AbstractLd
         Set<String> results = new HashSet<String>();
         NamingEnumeration<SearchResult> list = getSystemContext( service ).search( "", filter, controls );
 
-        while( list.hasMore() )
+        while ( list.hasMore() )
         {
             SearchResult result = list.next();
             results.add( result.getName() );
@@ -1066,7 +1011,7 @@ public class SearchIT extends AbstractLd
         return results;
     }
 
-    
+
     /**
      *  Convenience method that performs a one level search using the
      *  specified filter returning their DNs as Strings in a set.
@@ -1082,11 +1027,11 @@ public class SearchIT extends AbstractLd
         {
             controls = new SearchControls();
         }
-     
+
         Set<String> results = new HashSet<String>();
         NamingEnumeration<SearchResult> list = getSystemContext( service ).search( "", filter, controls );
 
-        while( list.hasMore() )
+        while ( list.hasMore() )
         {
             SearchResult result = list.next();
             results.add( result.getName() );
@@ -1224,21 +1169,17 @@ public class SearchIT extends AbstractLd
     public void testSearchWithEscapedCharsInFilter() throws Exception
     {
         // Create entry cn=Sid Vicious, ou=system
-        Attributes vicious = LdifUtils.createAttributes( 
-            "objectClass: top",
-            "objectClass: person",
-            "cn", "Sid Vicious",
-            "sn", "Vicious",
-            "description", "(sex*pis\\tols)" );
+        Attributes vicious = LdifUtils.createAttributes( "objectClass: top", "objectClass: person", "cn",
+            "Sid Vicious", "sn", "Vicious", "description", "(sex*pis\\tols)" );
 
         DirContext ctx = sysRoot.createSubcontext( "cn=Sid Vicious", vicious );
         assertNotNull( ctx );
 
         ctx = ( DirContext ) sysRoot.lookup( "cn=Sid Vicious" );
         assertNotNull( ctx );
-        
+
         Attributes attributes = ctx.getAttributes( "" );
-        
+
         assertEquals( "(sex*pis\\tols)", attributes.get( "description" ).get() );
 
         // Now, search for the description
@@ -1247,9 +1188,9 @@ public class SearchIT extends AbstractLd
         controls.setDerefLinkFlag( false );
 
         controls.setReturningAttributes( new String[]
-                    { "*" } );
+            { "*" } );
         sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
-                     .getJndiValue() );
+            .getJndiValue() );
         HashMap<String, Attributes> map = new HashMap<String, Attributes>();
 
         NamingEnumeration<SearchResult> list = sysRoot
@@ -1268,18 +1209,14 @@ public class SearchIT extends AbstractLd
         assertNotNull( attrs.get( "objectClass" ) );
         assertNotNull( attrs.get( "cn" ) );
     }
-    
-    
+
+
     @Test
     public void testSubstringSearchWithEscapedCharsInFilter() throws Exception
     {
         // Create entry cn=Sid Vicious, ou=system
-        Attributes vicious = LdifUtils.createAttributes( 
-            "objectClass: top",
-            "objectClass: person",
-            "cn", "Sid Vicious",
-            "sn", "Vicious",
-            "description", "(sex*pis\\tols)" );
+        Attributes vicious = LdifUtils.createAttributes( "objectClass: top", "objectClass: person", "cn",
+            "Sid Vicious", "sn", "Vicious", "description", "(sex*pis\\tols)" );
 
         DirContext ctx = sysRoot.createSubcontext( "cn=Sid Vicious", vicious );
         assertNotNull( ctx );
@@ -1326,12 +1263,8 @@ public class SearchIT extends AbstractLd
     @Test
     public void testSubstringSearchWithEscapedAsterisksInFilter_DIRSERVER_1181() throws Exception
     {
-        Attributes vicious = LdifUtils.createAttributes( 
-            "objectClass: top",
-            "objectClass: person",
-            "cn", "x*y*z*",
-            "sn", "x*y*z*",
-            "description", "(sex*pis\\tols)" );
+        Attributes vicious = LdifUtils.createAttributes( "objectClass: top", "objectClass: person", "cn", "x*y*z*",
+            "sn", "x*y*z*", "description", "(sex*pis\\tols)" );
 
         sysRoot.createSubcontext( "cn=x*y*z*", vicious );
 
@@ -1363,9 +1296,9 @@ public class SearchIT extends AbstractLd
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setDerefLinkFlag( false );
-        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-                AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-        
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+
         try
         {
             sysRoot.search( "", "(|(name=testing00)(name=testing01)", controls );
@@ -1415,8 +1348,7 @@ public class SearchIT extends AbstractLd
         }
     }
     */
-    
-    
+
     /**
     * Added to test correct comparison of integer attribute types when searching.
     * testGreaterThanSearch and testLesserThanSearch fail to detect the problem using values less than 10.
@@ -1424,464 +1356,494 @@ public class SearchIT extends AbstractLd
     * 
     * @throws Exception
     */
-   @Test
-   public void testIntegerComparison() throws Exception {
-       Set<String> results = searchUnits("(&(objectClass=organizationalUnit)(integerAttribute<=2))",null);
-       assertTrue(results.contains("ou=testing00,ou=system"));
-       assertTrue(results.contains("ou=testing01,ou=system"));
-       assertTrue(results.contains("ou=testing02,ou=system"));
-       assertFalse(results.contains("ou=testing03,ou=system"));
-       assertFalse(results.contains("ou=testing04,ou=system"));
-       assertFalse(results.contains("ou=testing05,ou=system"));
-   }
-   
-   
-   /**
-    * Added to test correct comparison of integer attribute types when searching.
-    * testGreaterThanSearch and testLesserThanSearch fail to detect the problem using values less than 10.
-    * Ref. DIRSERVER-1296
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testIntegerComparison2() throws Exception {
-       Set<String> results = searchUnits("(&(objectClass=organizationalUnit)(integerAttribute>=3))",null);
-       assertFalse(results.contains("ou=testing00,ou=system"));
-       assertFalse(results.contains("ou=testing01,ou=system"));
-       assertFalse(results.contains("ou=testing02,ou=system"));
-       assertTrue(results.contains("ou=testing03,ou=system"));
-       assertTrue(results.contains("ou=testing04,ou=system"));
-       assertTrue(results.contains("ou=testing05,ou=system"));
-   }
-   
-   
-   /**
-    * Added to test correct comparison of integer attribute types when searching.
-    * testGreaterThanSearch and testLesserThanSearch fail to detect the problem using values less than 10.
-    * Ref. DIRSERVER-1296
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testIntegerComparison3() throws Exception {
-       Set<String> results = searchUnits("(&(objectClass=organizationalUnit)(integerAttribute<=42))",null);
-       assertTrue(results.contains("ou=testing00,ou=system"));
-       assertTrue(results.contains("ou=testing01,ou=system"));
-       assertTrue(results.contains("ou=testing02,ou=system"));
-       assertTrue(results.contains("ou=testing03,ou=system"));
-       assertTrue(results.contains("ou=testing04,ou=system"));
-       assertTrue(results.contains("ou=testing05,ou=system"));
-   }
-   
-   /**
-    * Added to test correct comparison of integer attribute types when searching.
-    * testGreaterThanSearch and testLesserThanSearch fail to detect the problem using values less than 10.
-    * Ref. DIRSERVER-1296
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testIntegerComparison4() throws Exception {
-       Set<String> results = searchUnits("(&(objectClass=organizationalUnit)(|(integerAttribute<=1)(integerAttribute>=5)))",null);
-       assertTrue(results.contains("ou=testing00,ou=system"));
-       assertTrue(results.contains("ou=testing01,ou=system"));
-       assertFalse(results.contains("ou=testing02,ou=system"));
-       assertFalse(results.contains("ou=testing03,ou=system"));
-       assertFalse(results.contains("ou=testing04,ou=system"));
-       assertTrue(results.contains("ou=testing05,ou=system"));
-   }
-
-
-   @Test
-   public void testSearchTelephoneNumber() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-
-       NamingEnumeration<SearchResult> list = sysRoot.search( "", "(telephoneNumber=18015551212)", controls );
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-
-       assertEquals( "Expected number of results returned was incorrect!", 2, map.size() );
-       assertTrue( map.containsKey( "cn=Heather Nova, ou=system" ) || map.containsKey( "cn=Heather Nova,ou=system" ) );
-   }
-
-
-   @Test
-   public void testSearchDN() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-       controls.setDerefLinkFlag( false );
-       sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-               AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-    
-       NamingEnumeration<SearchResult> list = sysRoot.search( "", "(manager=cn=Heather Nova, ou=system)", controls );
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-
-       assertEquals( "Expected number of results returned was incorrect", 1, map.size() );
-       assertTrue( map.containsKey( "cn=with-dn, ou=system" ) || map.containsKey( "cn=with-dn,ou=system" ) );
-   }
-
-
-   @Test
-   public void testComplexFilter() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-       controls.setDerefLinkFlag( false );
-       sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-               AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-       
-       // Create an entry which does not match
-       Attributes attrs = LdifUtils.createAttributes( 
-           "objectClass: top",
-           "objectClass: groupOfUniqueNames",
-           "cn", "testGroup3",
-           "uniqueMember", "uid=admin,ou=system" );
-
-       getSystemContext( service ).createSubcontext( "cn=testGroup3,ou=groups", attrs );
-       
-       
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-       String filter = "(|(&(|(2.5.4.0=posixgroup)(2.5.4.0=groupofuniquenames)(2.5.4.0=groupofnames)(2.5.4.0=group))(!(|(2.5.4.50=uid=admin,ou=system)(2.5.4.31=0.9.2342.19200300.100.1.1=admin,2.5.4.11=system))))(objectClass=referral))";
-       NamingEnumeration<SearchResult> list = sysRoot.search( "", filter, controls );
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-       
-       assertEquals( "size of results", 5, map.size() );
-       assertTrue( map.containsKey( "cn=testGroup0,ou=groups,ou=system" ) ); 
-       assertTrue( map.containsKey( "cn=testGroup1,ou=groups,ou=system" ) ); 
-       assertTrue( map.containsKey( "cn=testGroup2,ou=groups,ou=system" ) ); 
-       assertTrue( map.containsKey( "cn=testGroup4,ou=groups,ou=system" ) ); 
-       assertTrue( map.containsKey( "cn=testGroup5,ou=groups,ou=system" ) ); 
-       assertFalse( map.containsKey( "cn=testGroup3,ou=groups,ou=system" ) ); 
-   }
-   
-   
-   /**
-    *  NO attributes should be returned
-    */
-   @Test
-   public void testSearchTypesOnlyAndNoAttr() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-       controls.setDerefLinkFlag( false );
-       controls.setReturningAttributes( new String[] { "1.1"  } );
-       sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-               AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-       sysRoot.addToEnvironment( "java.naming.ldap.typesOnly", "true");
-       
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-
-       NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-
-       assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
-
-       Attributes attrs = map.get( "ou=testing01,ou=system" );
-
-       assertEquals( 0, attrs.size() );
-   }
-
-   
-   /**
-    * operational attributes with no values must be returned
-    */
-   @Test
-   public void testSearchTypesOnlyWithNoAttrAndOperationalAttr() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-       controls.setDerefLinkFlag( false );
-       controls.setReturningAttributes( new String[] { "1.1", "+"  } );
-       sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-               AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-       sysRoot.addToEnvironment( "java.naming.ldap.typesOnly", "true");
-       
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-
-       NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-
-       assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
-
-       Attributes attrs = map.get( "ou=testing01,ou=system" );
-
-       assertNotNull( attrs.get( SchemaConstants.ENTRY_UUID_AT ) );
-       assertNotNull( attrs.get( SchemaConstants.CREATORS_NAME_AT ) );
-       
-       assertEquals( 0, attrs.get( SchemaConstants.ENTRY_UUID_AT ).size() );
-       assertEquals( 0, attrs.get( SchemaConstants.CREATORS_NAME_AT ).size() );
-   }
-
-   
-   /**
-    * all user attributes with no values must be returned
-    */
-   @Test
-   public void testSearchTypesOnlyWithNullReturnAttr() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-       controls.setDerefLinkFlag( false );
-       sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-               AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-       sysRoot.addToEnvironment( "java.naming.ldap.typesOnly", "true");
-       
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-
-       NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-
-       assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
-
-       Attributes attrs = map.get( "ou=testing01,ou=system" );
-
-       
-       assertNotNull( attrs.get( SchemaConstants.OU_AT ) );
-       assertNotNull( attrs.get( "integerAttribute" ) );
-
-       assertEquals( 0, attrs.get( SchemaConstants.OU_AT ).size() );
-       assertEquals( 0, attrs.get( "integerAttribute" ).size() );
-       
-       assertNull( attrs.get( SchemaConstants.ENTRY_UUID_AT ) );
-       assertNull( attrs.get( SchemaConstants.CREATORS_NAME_AT ) );
-   }
-
-   
-   @Test
-   public void testSearchEmptyDNWithOneLevelScope() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-       controls.setDerefLinkFlag( false );
-       
-       LdapContext nullRootCtx = getRootContext( service );
-       
-       NamingEnumeration<SearchResult> list = nullRootCtx.search( "", "(objectClass=*)", controls );
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-       
-       assertEquals( 2, map.size() );
-       
-       assertTrue( map.containsKey( "ou=system" ) );
-       assertTrue( map.containsKey( "ou=schema" ) );
-   }
-   
-   
-   @Test
-   public void testSearchEmptyDNWithSubLevelScope() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-       controls.setDerefLinkFlag( false );
-       
-       LdapContext nullRootCtx = getRootContext( service );
-       
-       NamingEnumeration<SearchResult> list = nullRootCtx.search( "", "(objectClass=organizationalUnit)", controls );
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-
-       assertTrue( map.size() > 2 );
-
-       assertTrue( map.containsKey( "ou=system" ) );
-       assertTrue( map.containsKey( "ou=schema" ) );
-   }
-   
-   
-   @Test
-   public void testSearchEmptyDNWithObjectScopeAndNoObjectClassPresenceFilter() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-       controls.setDerefLinkFlag( false );
-       
-       LdapContext nullRootCtx = getRootContext( service );
-       
-       NamingEnumeration<SearchResult> list = nullRootCtx.search( "", "(objectClass=domain)", controls );
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-       
-       assertEquals( 0, map.size() );
-       
-       assertFalse( map.containsKey( "ou=system" ) );
-       assertFalse( map.containsKey( "ou=schema" ) );
-   }
-   
-   
-   @Test
-   public void testSearchEmptyDNWithOneLevelScopeAndNoObjectClassPresenceFilter() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-       controls.setDerefLinkFlag( false );
-       
-       LdapContext nullRootCtx = getRootContext( service );
-       
-       NamingEnumeration<SearchResult> list = nullRootCtx.search( "", "(cn=*)", controls );
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-       
-       assertEquals( 0, map.size() );
-       
-       assertFalse( map.containsKey( "ou=system" ) );
-       assertFalse( map.containsKey( "ou=schema" ) );
-   }
-   
-   
-   @Test
-   public void testCsnLessEqualitySearch() throws Exception
-   {
-       LdapConnection connection = IntegrationUtils.getAdminConnection( service );
-
-       DN dn = new DN( "cn=testLowerCsnAdd,ou=system" );
-       Entry entry = new DefaultEntry( dn );
-       entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
-       entry.add( SchemaConstants.CN_AT, "testLowerCsnAdd_cn" );
-       entry.add( SchemaConstants.SN_AT, "testLowerCsnAdd_sn" );
-
-       connection.add( entry );
-
-       // add an entry to have a entry with higher CSN value
-       DN dn2 = new DN( "cn=testHigherCsnAdd,ou=system" );
-       Entry entry2 = new DefaultEntry( dn2 );
-       entry2.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
-       entry2.add( SchemaConstants.CN_AT, "testHigherCsnAdd_cn" );
-       entry2.add( SchemaConstants.SN_AT, "testHigherCsnAdd_sn" );
-
-       connection.add( entry2 );
-
-       entry = ( ( SearchResultEntry ) connection.lookup( dn.getName(), "+" ) ).getEntry();
-       entry2 = ( ( SearchResultEntry ) connection.lookup( dn2.getName(), "+" ) ).getEntry();
-       
-       String lowerCsn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString();
-       String higherCsn = entry2.get( SchemaConstants.ENTRY_CSN_AT ).getString();
-       
-       // usecases
-       // 1.1 Less than or Equal ( with the lower csn value)
-       testUseCases( lowerCsn, new String[]{lowerCsn}, connection, 1 );
-       
-       // 1.2 Less than or equals with a highest csn value
-       testUseCases( higherCsn, new String[]{higherCsn, lowerCsn}, connection, 1 );
-       
-       // 2.1 Greater than or Equal ( with the highest csn value )
-       testUseCases( higherCsn, new String[]{higherCsn}, connection, 2 );
-       
-       // 2.2 Greater than or Equal ( with lower csn value )
-       testUseCases( lowerCsn, new String[]{higherCsn, lowerCsn}, connection, 2 );
-   }
-
-
-   private void testUseCases( String filterCsnVal, String[] expectedCsns, LdapConnection connection, int useCaseNum ) throws Exception
-   {
-       Value val = new StringValue( filterCsnVal );
-
-       ExprNode filter = null;
-       
-       if( useCaseNum == 1 )
-       {
-           filter = new LessEqNode( SchemaConstants.ENTRY_CSN_AT, val );
-       }
-       else if( useCaseNum == 2 )
-       {
-           filter = new GreaterEqNode( SchemaConstants.ENTRY_CSN_AT, val );
-       }
-       
-       Entry loadedEntry = null;
-       
-       Set<String> csnSet = new HashSet<String>( expectedCsns.length );
-       Cursor<SearchResponse> cursor = connection.search( "ou=system", filter.toString(), SearchScope.ONELEVEL, "*",
-           "+" );
-       while ( cursor.next() )
-       {
-           loadedEntry = ( ( SearchResultEntry ) cursor.get() ).getEntry();
-           csnSet.add( loadedEntry.get( SchemaConstants.ENTRY_CSN_AT ).getString() );
-       }
-       cursor.close();
-
-       assertTrue( csnSet.size() >= expectedCsns.length );
-       
-       for( String csn : expectedCsns )
-       {
-           assertTrue( csnSet.contains( csn )  );
-       }
-   }
-
-
-   @Test
-   public void testSearchFilterBadAttributeType() throws Exception
-   {
-       SearchControls controls = new SearchControls();
-       controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-       controls.setDerefLinkFlag( false );
-       sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES,
-               AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
-       HashMap<String, Attributes> map = new HashMap<String, Attributes>();
-
-       NamingEnumeration<SearchResult> list = sysRoot.search( "", "(|(badAttr={0})(ou={1}))", new Object[]
-           { "testing00", "testing01" }, controls );
-       
-       while ( list.hasMore() )
-       {
-           SearchResult result = list.next();
-           map.put( result.getName(), result.getAttributes() );
-       }
-
-       assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
-       assertTrue( map.containsKey( "ou=testing01,ou=system" ) );
-   }
+    @Test
+    public void testIntegerComparison() throws Exception
+    {
+        Set<String> results = searchUnits( "(&(objectClass=organizationalUnit)(integerAttribute<=2))", null );
+        assertTrue( results.contains( "ou=testing00,ou=system" ) );
+        assertTrue( results.contains( "ou=testing01,ou=system" ) );
+        assertTrue( results.contains( "ou=testing02,ou=system" ) );
+        assertFalse( results.contains( "ou=testing03,ou=system" ) );
+        assertFalse( results.contains( "ou=testing04,ou=system" ) );
+        assertFalse( results.contains( "ou=testing05,ou=system" ) );
+    }
+
+
+    /**
+     * Added to test correct comparison of integer attribute types when searching.
+     * testGreaterThanSearch and testLesserThanSearch fail to detect the problem using values less than 10.
+     * Ref. DIRSERVER-1296
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testIntegerComparison2() throws Exception
+    {
+        Set<String> results = searchUnits( "(&(objectClass=organizationalUnit)(integerAttribute>=3))", null );
+        assertFalse( results.contains( "ou=testing00,ou=system" ) );
+        assertFalse( results.contains( "ou=testing01,ou=system" ) );
+        assertFalse( results.contains( "ou=testing02,ou=system" ) );
+        assertTrue( results.contains( "ou=testing03,ou=system" ) );
+        assertTrue( results.contains( "ou=testing04,ou=system" ) );
+        assertTrue( results.contains( "ou=testing05,ou=system" ) );
+    }
+
+
+    /**
+     * Added to test correct comparison of integer attribute types when searching.
+     * testGreaterThanSearch and testLesserThanSearch fail to detect the problem using values less than 10.
+     * Ref. DIRSERVER-1296
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testIntegerComparison3() throws Exception
+    {
+        Set<String> results = searchUnits( "(&(objectClass=organizationalUnit)(integerAttribute<=42))", null );
+        assertTrue( results.contains( "ou=testing00,ou=system" ) );
+        assertTrue( results.contains( "ou=testing01,ou=system" ) );
+        assertTrue( results.contains( "ou=testing02,ou=system" ) );
+        assertTrue( results.contains( "ou=testing03,ou=system" ) );
+        assertTrue( results.contains( "ou=testing04,ou=system" ) );
+        assertTrue( results.contains( "ou=testing05,ou=system" ) );
+    }
+
+
+    /**
+     * Added to test correct comparison of integer attribute types when searching.
+     * testGreaterThanSearch and testLesserThanSearch fail to detect the problem using values less than 10.
+     * Ref. DIRSERVER-1296
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testIntegerComparison4() throws Exception
+    {
+        Set<String> results = searchUnits(
+            "(&(objectClass=organizationalUnit)(|(integerAttribute<=1)(integerAttribute>=5)))", null );
+        assertTrue( results.contains( "ou=testing00,ou=system" ) );
+        assertTrue( results.contains( "ou=testing01,ou=system" ) );
+        assertFalse( results.contains( "ou=testing02,ou=system" ) );
+        assertFalse( results.contains( "ou=testing03,ou=system" ) );
+        assertFalse( results.contains( "ou=testing04,ou=system" ) );
+        assertTrue( results.contains( "ou=testing05,ou=system" ) );
+    }
+
+
+    @Test
+    public void testSearchTelephoneNumber() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        NamingEnumeration<SearchResult> list = sysRoot.search( "", "(telephoneNumber=18015551212)", controls );
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( "Expected number of results returned was incorrect!", 2, map.size() );
+        assertTrue( map.containsKey( "cn=Heather Nova, ou=system" ) || map.containsKey( "cn=Heather Nova,ou=system" ) );
+    }
+
+
+    @Test
+    public void testSearchDN() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+        controls.setDerefLinkFlag( false );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        NamingEnumeration<SearchResult> list = sysRoot.search( "", "(manager=cn=Heather Nova, ou=system)", controls );
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( "Expected number of results returned was incorrect", 1, map.size() );
+        assertTrue( map.containsKey( "cn=with-dn, ou=system" ) || map.containsKey( "cn=with-dn,ou=system" ) );
+    }
+
+
+    @Test
+    public void testComplexFilter() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+        controls.setDerefLinkFlag( false );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+
+        // Create an entry which does not match
+        Attributes attrs = LdifUtils.createAttributes( "objectClass: top", "objectClass: groupOfUniqueNames", "cn",
+            "testGroup3", "uniqueMember", "uid=admin,ou=system" );
+
+        getSystemContext( service ).createSubcontext( "cn=testGroup3,ou=groups", attrs );
+
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+        String filter = "(|(&(|(2.5.4.0=posixgroup)(2.5.4.0=groupofuniquenames)(2.5.4.0=groupofnames)(2.5.4.0=group))(!(|(2.5.4.50=uid=admin,ou=system)(2.5.4.31=0.9.2342.19200300.100.1.1=admin,2.5.4.11=system))))(objectClass=referral))";
+        NamingEnumeration<SearchResult> list = sysRoot.search( "", filter, controls );
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( "size of results", 5, map.size() );
+        assertTrue( map.containsKey( "cn=testGroup0,ou=groups,ou=system" ) );
+        assertTrue( map.containsKey( "cn=testGroup1,ou=groups,ou=system" ) );
+        assertTrue( map.containsKey( "cn=testGroup2,ou=groups,ou=system" ) );
+        assertTrue( map.containsKey( "cn=testGroup4,ou=groups,ou=system" ) );
+        assertTrue( map.containsKey( "cn=testGroup5,ou=groups,ou=system" ) );
+        assertFalse( map.containsKey( "cn=testGroup3,ou=groups,ou=system" ) );
+    }
+
+
+    /**
+     *  NO attributes should be returned
+     */
+    @Test
+    public void testSearchTypesOnlyAndNoAttr() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+        controls.setDerefLinkFlag( false );
+        controls.setReturningAttributes( new String[]
+            { "1.1" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+        sysRoot.addToEnvironment( "java.naming.ldap.typesOnly", "true" );
+
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
+
+        Attributes attrs = map.get( "ou=testing01,ou=system" );
+
+        assertEquals( 0, attrs.size() );
+    }
+
+
+    /**
+     * operational attributes with no values must be returned
+     */
+    @Test
+    public void testSearchTypesOnlyWithNoAttrAndOperationalAttr() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+        controls.setDerefLinkFlag( false );
+        controls.setReturningAttributes( new String[]
+            { "1.1", "+" } );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+        sysRoot.addToEnvironment( "java.naming.ldap.typesOnly", "true" );
+
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
+
+        Attributes attrs = map.get( "ou=testing01,ou=system" );
+
+        assertNotNull( attrs.get( SchemaConstants.ENTRY_UUID_AT ) );
+        assertNotNull( attrs.get( SchemaConstants.CREATORS_NAME_AT ) );
+
+        assertEquals( 0, attrs.get( SchemaConstants.ENTRY_UUID_AT ).size() );
+        assertEquals( 0, attrs.get( SchemaConstants.CREATORS_NAME_AT ).size() );
+    }
+
+
+    /**
+     * all user attributes with no values must be returned
+     */
+    @Test
+    public void testSearchTypesOnlyWithNullReturnAttr() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+        controls.setDerefLinkFlag( false );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+        sysRoot.addToEnvironment( "java.naming.ldap.typesOnly", "true" );
+
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        NamingEnumeration<SearchResult> list = sysRoot.search( "", "(ou=testing01)", controls );
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
+
+        Attributes attrs = map.get( "ou=testing01,ou=system" );
+
+        assertNotNull( attrs.get( SchemaConstants.OU_AT ) );
+        assertNotNull( attrs.get( "integerAttribute" ) );
+
+        assertEquals( 0, attrs.get( SchemaConstants.OU_AT ).size() );
+        assertEquals( 0, attrs.get( "integerAttribute" ).size() );
+
+        assertNull( attrs.get( SchemaConstants.ENTRY_UUID_AT ) );
+        assertNull( attrs.get( SchemaConstants.CREATORS_NAME_AT ) );
+    }
+
+
+    @Test
+    public void testSearchEmptyDNWithOneLevelScope() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+        controls.setDerefLinkFlag( false );
+
+        LdapContext nullRootCtx = getRootContext( service );
+
+        NamingEnumeration<SearchResult> list = nullRootCtx.search( "", "(objectClass=*)", controls );
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( 2, map.size() );
+
+        assertTrue( map.containsKey( "ou=system" ) );
+        assertTrue( map.containsKey( "ou=schema" ) );
+    }
+
+
+    @Test
+    public void testSearchEmptyDNWithSubLevelScope() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+        controls.setDerefLinkFlag( false );
+
+        LdapContext nullRootCtx = getRootContext( service );
+
+        NamingEnumeration<SearchResult> list = nullRootCtx.search( "", "(objectClass=organizationalUnit)", controls );
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertTrue( map.size() > 2 );
+
+        assertTrue( map.containsKey( "ou=system" ) );
+        assertTrue( map.containsKey( "ou=schema" ) );
+    }
+
+
+    @Test
+    public void testSearchEmptyDNWithObjectScopeAndNoObjectClassPresenceFilter() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        controls.setDerefLinkFlag( false );
+
+        LdapContext nullRootCtx = getRootContext( service );
+
+        NamingEnumeration<SearchResult> list = nullRootCtx.search( "", "(objectClass=domain)", controls );
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( 0, map.size() );
+
+        assertFalse( map.containsKey( "ou=system" ) );
+        assertFalse( map.containsKey( "ou=schema" ) );
+    }
+
+
+    @Test
+    public void testSearchEmptyDNWithOneLevelScopeAndNoObjectClassPresenceFilter() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+        controls.setDerefLinkFlag( false );
+
+        LdapContext nullRootCtx = getRootContext( service );
+
+        NamingEnumeration<SearchResult> list = nullRootCtx.search( "", "(cn=*)", controls );
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( 0, map.size() );
+
+        assertFalse( map.containsKey( "ou=system" ) );
+        assertFalse( map.containsKey( "ou=schema" ) );
+    }
+
+
+    @Test
+    public void testCsnLessEqualitySearch() throws Exception
+    {
+        LdapConnection connection = IntegrationUtils.getAdminConnection( service );
+
+        DN dn = new DN( "cn=testLowerCsnAdd,ou=system" );
+        Entry entry = new DefaultEntry( dn );
+        entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
+        entry.add( SchemaConstants.CN_AT, "testLowerCsnAdd_cn" );
+        entry.add( SchemaConstants.SN_AT, "testLowerCsnAdd_sn" );
+
+        connection.add( entry );
+
+        // add an entry to have a entry with higher CSN value
+        DN dn2 = new DN( "cn=testHigherCsnAdd,ou=system" );
+        Entry entry2 = new DefaultEntry( dn2 );
+        entry2.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC );
+        entry2.add( SchemaConstants.CN_AT, "testHigherCsnAdd_cn" );
+        entry2.add( SchemaConstants.SN_AT, "testHigherCsnAdd_sn" );
+
+        connection.add( entry2 );
+
+        entry = ( ( SearchResultEntry ) connection.lookup( dn.getName(), "+" ) ).getEntry();
+        entry2 = ( ( SearchResultEntry ) connection.lookup( dn2.getName(), "+" ) ).getEntry();
+
+        String lowerCsn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString();
+        String higherCsn = entry2.get( SchemaConstants.ENTRY_CSN_AT ).getString();
+
+        // usecases
+        // 1.1 Less than or Equal ( with the lower csn value)
+        testUseCases( lowerCsn, new String[]
+            { lowerCsn }, connection, 1 );
+
+        // 1.2 Less than or equals with a highest csn value
+        testUseCases( higherCsn, new String[]
+            { higherCsn, lowerCsn }, connection, 1 );
+
+        // 2.1 Greater than or Equal ( with the highest csn value )
+        testUseCases( higherCsn, new String[]
+            { higherCsn }, connection, 2 );
+
+        // 2.2 Greater than or Equal ( with lower csn value )
+        testUseCases( lowerCsn, new String[]
+            { higherCsn, lowerCsn }, connection, 2 );
+    }
+
+
+    private void testUseCases( String filterCsnVal, String[] expectedCsns, LdapConnection connection, int useCaseNum )
+        throws Exception
+    {
+        Value val = new StringValue( filterCsnVal );
+
+        ExprNode filter = null;
+
+        if ( useCaseNum == 1 )
+        {
+            filter = new LessEqNode( SchemaConstants.ENTRY_CSN_AT, val );
+        }
+        else if ( useCaseNum == 2 )
+        {
+            filter = new GreaterEqNode( SchemaConstants.ENTRY_CSN_AT, val );
+        }
+
+        Entry loadedEntry = null;
+
+        Set<String> csnSet = new HashSet<String>( expectedCsns.length );
+        Cursor<SearchResponse> cursor = connection.search( "ou=system", filter.toString(), SearchScope.ONELEVEL, "*",
+            "+" );
+        while ( cursor.next() )
+        {
+            loadedEntry = ( ( SearchResultEntry ) cursor.get() ).getEntry();
+            csnSet.add( loadedEntry.get( SchemaConstants.ENTRY_CSN_AT ).getString() );
+        }
+        cursor.close();
+
+        assertTrue( csnSet.size() >= expectedCsns.length );
+
+        for ( String csn : expectedCsns )
+        {
+            assertTrue( csnSet.contains( csn ) );
+        }
+    }
+
+
+    @Test
+    public void testSearchFilterWithBadAttributeType() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+        controls.setDerefLinkFlag( false );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        NamingEnumeration<SearchResult> list = sysRoot.search( "", "(|(badAttr={0})(ou={1}))", new Object[]
+            { "testing00", "testing01" }, controls );
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( "Expected number of results returned was incorrect!", 1, map.size() );
+        assertTrue( map.containsKey( "ou=testing01,ou=system" ) );
+    }
+
+
+    @Test
+    public void testSearchFilterBadAttributeType() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+        controls.setDerefLinkFlag( false );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        NamingEnumeration<SearchResult> list = sysRoot.search( "", "(badAttr=*)", controls );
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        assertEquals( "Expected number of results returned was incorrect!", 0, map.size() );
+    }
 }

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java?rev=957232&r1=957231&r2=957232&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java Wed Jun 23 14:58:04 2010
@@ -90,6 +90,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schema.syntaxCheckers.OctetStringSyntaxChecker;
 import org.apache.directory.shared.ldap.util.Base64;
 import org.apache.directory.shared.ldap.util.DateUtils;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -1859,7 +1860,7 @@ public class SubschemaSubentryIT extends
      * @throws NamingException on error
      */
     @Test
-    // @TODO as we can't modify a schema element, the end of this test has been commented
+    @Ignore // @TODO as we can't modify a schema element, the end of this test has been commented
     public void testTimestampAndModifierUpdates() throws Exception, InterruptedException
     {
         TimeZone tz = TimeZone.getTimeZone( "GMT" );



Mime
View raw message