You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/08/31 00:26:55 UTC
svn commit: r809430 - in
/directory/apacheds/branches/apacheds-schema/jdbm-store/src:
main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
Author: elecharny
Date: Sun Aug 30 22:26:55 2009
New Revision: 809430
URL: http://svn.apache.org/viewvc?rev=809430&view=rev
Log:
o Merged last modifications
o Fixed some methods due to the changes in shared
Modified:
directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java
directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java
directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java
directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java
Modified: directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=809430&r1=809429&r2=809430&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Sun Aug 30 22:26:55 2009
@@ -222,7 +222,7 @@
* is single valued according to its specification based on a schema
* then duplicate keys should not be allowed within the reverse table.
*/
- if ( attribute.isSingleValue() )
+ if ( attribute.isSingleValued() )
{
reverse = new JdbmTable<Long,K>(
attribute.getName() + REVERSE_BTREE,
Modified: directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=809430&r1=809429&r2=809430&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Sun Aug 30 22:26:55 2009
@@ -306,7 +306,7 @@
for ( Index<?,E> index : systemIndices.values() )
{
- String oid = atRegistry.getOid( index.getAttributeId() );
+ String oid = atRegistry.getOidByName( index.getAttributeId() );
tmp.put( oid, index );
( ( JdbmIndex ) index ).init( atRegistry.lookup( oid ), workingDirectory );
}
@@ -412,7 +412,7 @@
for ( Index<?,E> index : userIndices.values() )
{
- String oid = atRegistry.getOid( index.getAttributeId() );
+ String oid = atRegistry.getOidByName( index.getAttributeId() );
if ( systemIndices.containsKey( oid ) )
{
@@ -840,19 +840,27 @@
public boolean hasUserIndexOn( String id ) throws NamingException
{
- return userIndices.containsKey( atRegistry.getOid( id ) );
+ return userIndices.containsKey( atRegistry.getOidByName( id ) );
}
public boolean hasSystemIndexOn( String id ) throws NamingException
{
- return systemIndices.containsKey( atRegistry.getOid( id ) );
+ return systemIndices.containsKey( atRegistry.getOidByName( id ) );
}
public Index<?,E> getUserIndex( String id ) throws IndexNotFoundException
{
- id = atRegistry.getOid( id );
+ try
+ {
+ id = atRegistry.getOidByName( id );
+ }
+ catch ( NamingException e )
+ {
+ LOG.error( "Failed to identify OID for: " + id, e );
+ throw new IndexNotFoundException( "Failed to identify OID for: " + id, id, e );
+ }
if ( userIndices.containsKey( id ) )
{
@@ -866,7 +874,15 @@
public Index<?,E> getSystemIndex( String id ) throws IndexNotFoundException
{
- id = atRegistry.getOid( id );
+ try
+ {
+ id = atRegistry.getOidByName( id );
+ }
+ catch ( NamingException e )
+ {
+ LOG.error( "Failed to identify OID for: " + id, e );
+ throw new IndexNotFoundException( "Failed to identify OID for: " + id, id, e );
+ }
if ( systemIndices.containsKey( id ) )
{
@@ -1412,7 +1428,7 @@
throw new Exception( "Cannot store a ClonedServerEntry" );
}
- String modsOid = atRegistry.getOid( mods.getId() );
+ String modsOid = atRegistry.getOidByName( mods.getId() );
// Special case for the ObjectClass index
if ( modsOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
@@ -1475,7 +1491,7 @@
throw new Exception( "Cannot store a ClonedServerEntry" );
}
- String modsOid = atRegistry.getOid( mods.getId() );
+ String modsOid = atRegistry.getOidByName( mods.getId() );
// Special case for the ObjectClass index
if ( modsOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
@@ -1569,7 +1585,7 @@
throw new Exception( "Cannot store a ClonedServerEntry" );
}
- String modsOid = atRegistry.getOid( mods.getId() );
+ String modsOid = atRegistry.getOidByName( mods.getId() );
// Special case for the ObjectClass index
if ( modsOid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
@@ -1612,7 +1628,7 @@
}
}
- String aliasAttributeOid = atRegistry.getOid( SchemaConstants.ALIASED_OBJECT_NAME_AT );
+ String aliasAttributeOid = atRegistry.getOidByName( SchemaConstants.ALIASED_OBJECT_NAME_AT );
if ( modsOid.equals( aliasAttributeOid ) )
{
Modified: directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java?rev=809430&r1=809429&r2=809430&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java Sun Aug 30 22:26:55 2009
@@ -28,6 +28,7 @@
import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription;
import org.apache.directory.shared.ldap.schema.registries.ComparatorRegistry;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
@@ -38,14 +39,11 @@
import static org.junit.Assert.assertEquals;
import java.io.File;
-import java.util.Iterator;
import jdbm.RecordManager;
import jdbm.helper.IntegerSerializer;
import jdbm.recman.BaseRecordManager;
-import javax.naming.NamingException;
-
/**
* Tests the DupsContainerCursor.
@@ -80,7 +78,9 @@
recman = new BaseRecordManager( dbFile.getAbsolutePath() );
// gosh this is a terrible use of a global static variable
- SerializableComparator.setRegistry( new MockComparatorRegistry() );
+ SerializableComparator.setRegistry(
+ new MockComparatorRegistry(
+ new OidRegistry() ) );
table = new JdbmTable<Integer,Integer>( "test", SIZE, recman,
new SerializableComparator<Integer>( "" ),
@@ -112,7 +112,9 @@
recman = new BaseRecordManager( dbFile.getAbsolutePath() );
// gosh this is a terrible use of a global static variable
- SerializableComparator.setRegistry( new MockComparatorRegistry() );
+ SerializableComparator.setRegistry(
+ new MockComparatorRegistry(
+ new OidRegistry() ) );
table = new JdbmTable<Integer,Integer>( "test", recman, new SerializableComparator<Integer>( "" ), null, null );
Cursor<Tuple<Integer,DupsContainer<Integer>>> cursor =
@@ -220,76 +222,4 @@
public void testMiscellaneous() throws Exception
{
}
-
-
- private class MockComparatorRegistry implements ComparatorRegistry
- {
- private LdapComparator<Integer> comparator = new LdapComparator<Integer>( "1.1.1" )
- {
- public int compare( Integer i1, Integer i2 )
- {
- return i1.compareTo( i2 );
- }
- };
-
- public String getSchemaName( String oid ) throws NamingException
- {
- return null;
- }
-
-
- public void register( LdapComparatorDescription description, LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public void register(LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public LdapComparator<?> lookup( String oid ) throws NamingException
- {
- return comparator;
- }
-
-
- public boolean contains( String oid )
- {
- return true;
- }
-
-
- public Iterator<LdapComparator<?>> iterator()
- {
- return null;
- }
-
-
- public Iterator<String> oidsIterator()
- {
- return null;
- }
-
-
- public Iterator<LdapComparatorDescription> ldapComparatorDescriptionIterator()
- {
- return null;
- }
-
-
- public void unregister( String oid ) throws NamingException
- {
- }
-
-
- public void unregisterSchemaElements( String schemaName )
- {
- }
-
-
- public void renameSchema( String originalSchemaName, String newSchemaName )
- {
- }
- }
}
\ No newline at end of file
Modified: directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java?rev=809430&r1=809429&r2=809430&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursorTest.java Sun Aug 30 22:26:55 2009
@@ -25,6 +25,7 @@
import org.apache.directory.server.xdbm.Tuple;
import org.apache.directory.shared.ldap.cursor.Cursor;
import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.junit.Before;
import org.junit.After;
@@ -74,7 +75,9 @@
recman = new BaseRecordManager( dbFile.getAbsolutePath() );
// gosh this is a terrible use of a global static variable
- SerializableComparator.setRegistry( new MockComparatorRegistry() );
+ SerializableComparator.setRegistry(
+ new MockComparatorRegistry(
+ new OidRegistry() ) );
table = new JdbmTable<Integer,Integer>( "test", SIZE, recman,
new SerializableComparator<Integer>( "" ),
Modified: directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java?rev=809430&r1=809429&r2=809430&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableNoDuplicatesTest.java Sun Aug 30 22:26:55 2009
@@ -32,19 +32,17 @@
import static org.junit.Assert.fail;
import org.apache.directory.server.xdbm.Table;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.schema.LdapComparator;
import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription;
import org.apache.directory.shared.ldap.schema.registries.ComparatorRegistry;
import java.io.File;
-import java.util.Iterator;
import jdbm.RecordManager;
import jdbm.recman.BaseRecordManager;
-import javax.naming.NamingException;
-
/**
* Document me!
@@ -76,7 +74,7 @@
recman = new BaseRecordManager( dbFile.getAbsolutePath() );
// gosh this is a terrible use of a global static variable
- SerializableComparator.setRegistry( new MockComparatorRegistry() );
+ SerializableComparator.setRegistry( new MockComparatorRegistry( new OidRegistry() ) );
table = new JdbmTable<Integer,Integer>( "test", recman, new SerializableComparator<Integer>( "" ), null, null );
LOG.debug( "Created new table and populated it with data" );
}
@@ -339,77 +337,4 @@
assertNotNull( e );
}
}
-
-
- private class MockComparatorRegistry implements ComparatorRegistry
- {
- private LdapComparator<?> comparator = new LdapComparator<Integer>( "1.1.1" )
- {
- public int compare( Integer i1, Integer i2 )
- {
- return i1.compareTo( i2 );
- }
- };
-
-
- public String getSchemaName( String oid ) throws NamingException
- {
- return null;
- }
-
-
- public void register( LdapComparatorDescription description, LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public LdapComparator<?> lookup( String oid ) throws NamingException
- {
- return comparator;
- }
-
-
- public boolean contains( String oid )
- {
- return true;
- }
-
-
- public Iterator<LdapComparator<?>> iterator()
- {
- return null;
- }
-
-
- public Iterator<String> oidsIterator()
- {
- return null;
- }
-
-
- public void register(LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public Iterator<LdapComparatorDescription> ldapComparatorDescriptionIterator()
- {
- return null;
- }
-
-
- public void unregister( String oid ) throws NamingException
- {
- }
-
-
- public void unregisterSchemaElements( String schemaName )
- {
- }
-
-
- public void renameSchema( String originalSchemaName, String newSchemaName )
- {
- }
- }
}
Modified: directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java?rev=809430&r1=809429&r2=809430&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTableWithDuplicatesTest.java Sun Aug 30 22:26:55 2009
@@ -34,20 +34,18 @@
import org.apache.directory.server.xdbm.Table;
import org.apache.directory.server.xdbm.Tuple;
import org.apache.directory.shared.ldap.cursor.Cursor;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.schema.LdapComparator;
import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription;
import org.apache.directory.shared.ldap.schema.registries.ComparatorRegistry;
import java.io.File;
-import java.util.Iterator;
import jdbm.RecordManager;
import jdbm.helper.IntegerSerializer;
import jdbm.recman.BaseRecordManager;
-import javax.naming.NamingException;
-
/**
* Tests JdbmTable operations with duplicates. Does not test Cursor capabilities.
@@ -80,7 +78,9 @@
recman = new BaseRecordManager( dbFile.getAbsolutePath() );
// gosh this is a terrible use of a global static variable
- SerializableComparator.setRegistry( new MockComparatorRegistry() );
+ SerializableComparator.setRegistry(
+ new MockComparatorRegistry(
+ new OidRegistry() ) );
table = new JdbmTable<Integer,Integer>( "test", SIZE, recman,
new SerializableComparator<Integer>( "" ),
@@ -572,76 +572,4 @@
assertEquals( 0, table.count( 1 ) );
assertFalse( table.has( 1 ) );
}
-
-
- private class MockComparatorRegistry implements ComparatorRegistry
- {
- private LdapComparator<Integer> comparator = new LdapComparator<Integer>( "1.1.1" )
- {
- public int compare( Integer i1, Integer i2 )
- {
- return i1.compareTo( i2 );
- }
- };
-
- public String getSchemaName( String oid ) throws NamingException
- {
- return null;
- }
-
-
- public void register( LdapComparatorDescription description, LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public LdapComparator<?> lookup( String oid ) throws NamingException
- {
- return comparator;
- }
-
-
- public boolean contains( String oid )
- {
- return true;
- }
-
-
- public void register(LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public Iterator<LdapComparator<?>> iterator()
- {
- return null;
- }
-
-
- public Iterator<String> oidsIterator()
- {
- return null;
- }
-
-
- public Iterator<LdapComparatorDescription> ldapComparatorDescriptionIterator()
- {
- return null;
- }
-
-
- public void unregister( String oid ) throws NamingException
- {
- }
-
-
- public void unregisterSchemaElements( String schemaName )
- {
- }
-
-
- public void renameSchema( String originalSchemaName, String newSchemaName )
- {
- }
- }
}
Modified: directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java?rev=809430&r1=809429&r2=809430&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursorTest.java Sun Aug 30 22:26:55 2009
@@ -25,9 +25,6 @@
import java.io.File;
import java.util.Comparator;
-import java.util.Iterator;
-
-import javax.naming.NamingException;
import jdbm.RecordManager;
import jdbm.btree.BTree;
@@ -36,6 +33,7 @@
import org.apache.directory.server.xdbm.Tuple;
import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.schema.LdapComparator;
import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription;
@@ -85,7 +83,9 @@
dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
recman = new BaseRecordManager( dbFile.getAbsolutePath() );
- SerializableComparator.setRegistry( new MockComparatorRegistry() );
+ SerializableComparator.setRegistry(
+ new MockComparatorRegistry(
+ new OidRegistry() ) );
table = new JdbmTable<Integer,Integer>( "test", 6, recman,
new SerializableComparator<Integer>( "" ),
@@ -184,75 +184,4 @@
return table.getBTree( values.getBTreeRedirect() );
}
-
- private class MockComparatorRegistry implements ComparatorRegistry
- {
- private LdapComparator<Integer> comparator = new LdapComparator<Integer>( "1.1.1" )
- {
- public int compare( Integer i1, Integer i2 )
- {
- return i1.compareTo( i2 );
- }
- };
-
- public String getSchemaName( String oid ) throws NamingException
- {
- return null;
- }
-
-
- public void register( LdapComparatorDescription description, LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public LdapComparator<?> lookup( String oid ) throws NamingException
- {
- return comparator;
- }
-
-
- public boolean contains( String oid )
- {
- return true;
- }
-
-
- public void register(LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public Iterator<LdapComparator<?>> iterator()
- {
- return null;
- }
-
-
- public Iterator<String> oidsIterator()
- {
- return null;
- }
-
-
- public Iterator<LdapComparatorDescription> ldapComparatorDescriptionIterator()
- {
- return null;
- }
-
-
- public void unregister( String oid ) throws NamingException
- {
- }
-
-
- public void unregisterSchemaElements( String schemaName )
- {
- }
-
-
- public void renameSchema( String originalSchemaName, String newSchemaName )
- {
- }
- }
}
Modified: directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java?rev=809430&r1=809429&r2=809430&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursorTest.java Sun Aug 30 22:26:55 2009
@@ -25,6 +25,7 @@
import org.apache.directory.server.xdbm.Tuple;
import org.apache.directory.shared.ldap.cursor.Cursor;
import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.schema.LdapComparator;
import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.parsers.LdapComparatorDescription;
@@ -40,13 +41,10 @@
import java.io.File;
-import java.util.Iterator;
import jdbm.RecordManager;
import jdbm.recman.BaseRecordManager;
-import javax.naming.NamingException;
-
/**
* Tests the Cursor functionality of a JdbmTable when duplicate keys are not
@@ -78,7 +76,9 @@
recman = new BaseRecordManager( dbFile.getAbsolutePath() );
// gosh this is a terrible use of a global static variable
- SerializableComparator.setRegistry( new MockComparatorRegistry() );
+ SerializableComparator.setRegistry(
+ new MockComparatorRegistry(
+ new OidRegistry() ) );
table = new JdbmTable<Integer,Integer>( "test", recman, new SerializableComparator<Integer>( "" ), null, null );
LOG.debug( "Created new table and populated it with data" );
}
@@ -256,76 +256,4 @@
public void testMiscellaneous() throws Exception
{
}
-
-
- private class MockComparatorRegistry implements ComparatorRegistry
- {
- private LdapComparator<Integer> comparator = new LdapComparator<Integer>( "1.1.1" )
- {
- public int compare( Integer i1, Integer i2 )
- {
- return i1.compareTo( i2 );
- }
- };
-
- public String getSchemaName( String oid ) throws NamingException
- {
- return null;
- }
-
-
- public void register( LdapComparatorDescription description, LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public void register(LdapComparator<?> comparator ) throws NamingException
- {
- }
-
-
- public LdapComparator<?> lookup( String oid ) throws NamingException
- {
- return comparator;
- }
-
-
- public boolean contains( String oid )
- {
- return true;
- }
-
-
- public Iterator<LdapComparator<?>> iterator()
- {
- return null;
- }
-
-
- public Iterator<String> oidsIterator()
- {
- return null;
- }
-
-
- public Iterator<LdapComparatorDescription> ldapComparatorDescriptionIterator()
- {
- return null;
- }
-
-
- public void unregister( String oid ) throws NamingException
- {
- }
-
-
- public void unregisterSchemaElements( String schemaName )
- {
- }
-
-
- public void renameSchema( String originalSchemaName, String newSchemaName )
- {
- }
- }
}