directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r737938 - in /directory/apacheds/trunk: core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java
Date Mon, 26 Jan 2009 23:35:58 GMT
Author: elecharny
Date: Mon Jan 26 23:35:58 2009
New Revision: 737938

URL: http://svn.apache.org/viewvc?rev=737938&view=rev
Log:
The TelephoneNumberComparator has been injected into the schema-bootstrap code
Added a test for TelephoneNumber search.

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
    directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.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=737938&r1=737937&r2=737938&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
Mon Jan 26 23:35:58 2009
@@ -130,7 +130,8 @@
         "objectClass: top\n" +
         "objectClass: person\n" +
         "cn: Heather Nova\n" +
-        "sn: Nova\n"
+        "sn: Nova\n" +
+        "telephoneNumber: 1 801 555 1212 \n"
     }
 )
 public class SearchIT
@@ -1633,4 +1634,28 @@
        assertFalse(results.contains("ou=testing04,ou=system"));
        assertTrue(results.contains("ou=testing05,ou=system"));
    }
+
+
+   @Test
+   public void testSearchTelephoneNumber() throws Exception
+   {
+       LdapContext sysRoot = getSystemContext( service );
+       createData( sysRoot );
+
+       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!", 1, map.size()
);
+       assertTrue( map.containsKey( "cn=Heather Nova, ou=system" ) );
+   }
 }

Modified: directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java?rev=737938&r1=737937&r2=737938&view=diff
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java
(original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/java/org/apache/directory/server/schema/bootstrap/SystemComparatorProducer.java
Mon Jan 26 23:35:58 2009
@@ -34,6 +34,7 @@
 import org.apache.directory.shared.ldap.schema.comparators.IntegerOrderingComparator;
 import org.apache.directory.shared.ldap.schema.comparators.NormalizingComparator;
 import org.apache.directory.shared.ldap.schema.comparators.ObjectIdentifierComparator;
+import org.apache.directory.shared.ldap.schema.comparators.TelephoneNumberComparator;
 import org.apache.directory.shared.ldap.schema.normalizers.CachingNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimNormalizer;
 import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
@@ -192,7 +193,7 @@
          ( 2.5.13.20 NAME 'telephoneNumberMatch'
          SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )
          */
-        comparator = new ComparableComparator();
+        comparator = new TelephoneNumberComparator();
         cb.schemaObjectProduced( this, "2.5.13.20", comparator );
 
         /*



Mime
View raw message