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 2011/06/30 17:05:06 UTC
svn commit: r1141562 - in
/directory/apacheds/branches/apacheds-no-reverse-index:
core-api/src/main/java/org/apache/directory/server/core/interceptor/context/
core-api/src/main/java/org/apache/directory/server/core/partition/
core-api/src/main/java/org...
Author: elecharny
Date: Thu Jun 30 15:05:05 2011
New Revision: 1141562
URL: http://svn.apache.org/viewvc?rev=1141562&view=rev
Log:
o Some fixes for the Add and Delete methods
o Reworked the lookup method
Modified:
directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java
directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java
directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
directory/apacheds/branches/apacheds-no-reverse-index/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
directory/apacheds/branches/apacheds-no-reverse-index/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ParentIdAndRdn.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
Modified: directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveAndRenameOperationContext.java Thu Jun 30 15:05:05 2011
@@ -96,7 +96,7 @@ public class MoveAndRenameOperationConte
try
{
- newDn = new Dn( session.getDirectoryService().getSchemaManager(), newSuperiorDn.add(newRdn) );
+ newDn = newSuperiorDn.add( newRdn ).apply( session.getDirectoryService().getSchemaManager() );
}
catch ( LdapInvalidDnException lide )
{
Modified: directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Thu Jun 30 15:05:05 2011
@@ -158,14 +158,6 @@ public abstract class AbstractPartition
/**
- * This method calls {@link Partition#lookup(LookupOperationContext)}
- * with null <tt>attributeIds</tt> by default. Please override
- * this method if there is more effective way for your implementation.
- */
- public abstract Entry lookup( LookupOperationContext lookupContext ) throws LdapException;
-
-
- /**
* {@inheritDoc}
*/
public void setSchemaManager( SchemaManager schemaManager )
Modified: directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/partition/NullPartition.java Thu Jun 30 15:05:05 2011
@@ -376,7 +376,6 @@ public class NullPartition extends Abstr
}
- @Override
public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
return null;
Modified: directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java Thu Jun 30 15:05:05 2011
@@ -56,6 +56,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.SchemaUtils;
import org.apache.directory.shared.util.DateUtils;
+import org.apache.directory.shared.util.exception.NotImplementedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -442,6 +443,17 @@ public final class SchemaPartition exten
/**
+ * {@inheritDoc}
+ */
+ public Entry lookup( Long id ) throws LdapException
+ {
+ // TODO not implemented until we can use id to figure out the partition using
+ // the partition ID component of the 64 bit Long identifier
+ throw new NotImplementedException();
+ }
+
+
+ /**
* Updates the schemaModifiersName and schemaModifyTimestamp attributes of
* the schemaModificationAttributes entry for the global schema at
* ou=schema,cn=schemaModifications. This entry is hardcoded at that
Modified: directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java Thu Jun 30 15:05:05 2011
@@ -507,9 +507,8 @@ public class SchemaPartitionDaoImpl impl
public Dn findDn( String entityName ) throws Exception
{
Entry sr = find( entityName );
- Dn dn = new Dn( schemaManager, sr.getDn() );
- return dn;
+ return sr.getDn();
}
Modified: directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java Thu Jun 30 15:05:05 2011
@@ -330,7 +330,7 @@ public abstract class AbstractRegistrySy
for ( Entry result : results )
{
- Dn dn = new Dn( schemaManager, result.getDn() );
+ Dn dn = result.getDn();
oids.add( dn.getRdn().getNormValue().getString() );
}
Modified: directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java Thu Jun 30 15:05:05 2011
@@ -159,7 +159,7 @@ public class SchemaSynchronizer implemen
public void add( Entry entry ) throws LdapException
{
Dn dn = entry.getDn();
- Dn parentDn = new Dn( schemaManager, dn.getParent() );
+ Dn parentDn = dn.getParent();
if ( !parentDn.equals(ouSchemaDn) )
{
Modified: directory/apacheds/branches/apacheds-no-reverse-index/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Thu Jun 30 15:05:05 2011
@@ -649,7 +649,7 @@ public class DefaultPartitionNexus exten
/* (non-Javadoc)
* @see org.apache.directory.server.core.partition.PartitionNexus#lookup(java.lang.Long)
*/
- public ClonedServerEntry lookup( Long id ) throws LdapException
+ public Entry lookup( Long id ) throws LdapException
{
// TODO not implemented until we can use id to figure out the partition using
// the partition ID component of the 64 bit Long identifier
Modified: directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Thu Jun 30 15:05:05 2011
@@ -492,7 +492,7 @@ public class JdbmStoreTest
assertNull( store.getParentId( 0L ) );
// should NOW be allowed
- store.delete( 1L );
+ store.delete( StoreUtils.DN1 );
}
@@ -509,7 +509,7 @@ public class JdbmStoreTest
assertTrue( cursor.next() );
assertEquals( 3, store.getChildCount( 1L ) );
- store.delete( 2L );
+ store.delete( StoreUtils.DN2 );
assertEquals( 2, store.getChildCount( 1L ) );
assertEquals( 10, store.count() );
@@ -524,8 +524,7 @@ public class JdbmStoreTest
entry.add( "entryUUID", UUID.randomUUID().toString() );
store.add( entry );
- store.delete( 12L ); // drops the alias indices
-
+ store.delete( dn ); // drops the alias indices
}
Modified: directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java Thu Jun 30 15:05:05 2011
@@ -146,16 +146,6 @@ public abstract class AbstractLdifPartit
* {@inheritDoc}
*/
@Override
- public Dn getEntryDn( Long id ) throws Exception
- {
- return wrappedPartition.getEntryDn( id );
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
public Long getEntryId( Dn dn ) throws LdapException
{
return wrappedPartition.getEntryId( dn );
@@ -286,9 +276,19 @@ public abstract class AbstractLdifPartit
* {@inheritDoc}
*/
@Override
- public IndexCursor<Long, Entry, Long> list( Long id ) throws LdapException
+ public IndexCursor<Long, Entry, Long> list( Dn entryDn ) throws LdapException
+ {
+ return wrappedPartition.list( entryDn );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Entry lookup( Dn entryDn ) throws LdapException
{
- return wrappedPartition.list( id );
+ return wrappedPartition.lookup( entryDn );
}
@@ -296,7 +296,7 @@ public abstract class AbstractLdifPartit
* {@inheritDoc}
*/
@Override
- public ClonedServerEntry lookup( Long id ) throws LdapException
+ public Entry lookup( Long id ) throws LdapException
{
return wrappedPartition.lookup( id );
}
Modified: directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java Thu Jun 30 15:05:05 2011
@@ -231,10 +231,20 @@ public class LdifPartition extends Abstr
* {@inheritDoc}
*/
@Override
- public void add( AddOperationContext addContext ) throws LdapException
+ public void add( Entry entry ) throws LdapException
{
- wrappedPartition.add( addContext );
- add( addContext.getEntry() );
+ wrappedPartition.add( entry );
+
+ try
+ {
+ FileWriter fw = new FileWriter( getFile( entry.getDn(), CREATE ) );
+ fw.write( LdifUtils.convertToLdif( entry ) );
+ fw.close();
+ }
+ catch ( IOException ioe )
+ {
+ throw new LdapOperationException( ioe.getMessage(), ioe );
+ }
}
@@ -251,11 +261,11 @@ public class LdifPartition extends Abstr
* {@inheritDoc}
*/
@Override
- public void delete( Long id ) throws LdapException
+ public void delete( Dn entryDn ) throws LdapException
{
- Entry entry = lookup( id );
+ Entry entry = lookup( entryDn );
- wrappedPartition.delete( id );
+ wrappedPartition.delete( entryDn );
if ( entry != null )
{
@@ -274,9 +284,7 @@ public class LdifPartition extends Abstr
LOG.debug( "deleted file {} {}", parentFile.getAbsoluteFile(), deleted );
}
-
}
-
}
@@ -291,7 +299,7 @@ public class LdifPartition extends Abstr
wrappedPartition.modify( modifyContext.getDn(), modifyContext.getModItems() );
// Get the modified entry and store it in the context for post usage
- ClonedServerEntry modifiedEntry = lookup( id );
+ Entry modifiedEntry = lookup( modifyContext.getDn() );
modifyContext.setAlteredEntry( modifiedEntry );
// just overwrite the existing file
@@ -323,7 +331,7 @@ public class LdifPartition extends Abstr
wrappedPartition.move( moveContext );
// Get the modified entry
- ClonedServerEntry modifiedEntry = lookup( id );
+ Entry modifiedEntry = lookup( oldDn );
entryMoved( oldDn, modifiedEntry, id );
}
@@ -341,7 +349,7 @@ public class LdifPartition extends Abstr
wrappedPartition.moveAndRename( moveAndRenameContext );
// Get the modified entry and store it in the context for post usage
- ClonedServerEntry modifiedEntry = lookup( id );
+ Entry modifiedEntry = lookup( oldDn );
moveAndRenameContext.setModifiedEntry( modifiedEntry );
entryMoved( oldDn, modifiedEntry, id );
@@ -361,7 +369,7 @@ public class LdifPartition extends Abstr
wrappedPartition.rename( renameContext );
// Get the modified entry and store it in the context for post usage
- ClonedServerEntry modifiedEntry = lookup( id );
+ Entry modifiedEntry = lookup( oldDn );
renameContext.setModifiedEntry( modifiedEntry );
// Now move the potential children for the old entry
@@ -397,7 +405,7 @@ public class LdifPartition extends Abstr
// except the parent entry add the rest of entries
if ( entry.getId() != entryIdOld )
{
- add( wrappedPartition.lookup( entry.getId() ) );
+ add( wrappedPartition.lookup( entry.getObject().getDn() ) );
}
}
@@ -701,25 +709,6 @@ public class LdifPartition extends Abstr
/**
- * Write the new entry on disk. It does not exist, as this ha sbeen checked
- * by the ExceptionInterceptor.
- */
- private void add( Entry entry ) throws LdapException
- {
- try
- {
- FileWriter fw = new FileWriter( getFile( entry.getDn(), CREATE ) );
- fw.write( LdifUtils.convertToLdif( entry ) );
- fw.close();
- }
- catch ( IOException ioe )
- {
- throw new LdapOperationException( ioe.getMessage(), ioe );
- }
- }
-
-
- /**
* Recursively delete an entry and all of its children. If the entry is a directory,
* then get into it, call the same method on each of the contained files,
* and delete the directory.
Modified: directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java Thu Jun 30 15:05:05 2011
@@ -50,6 +50,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.ldif.LdifEntry;
import org.apache.directory.shared.ldap.model.ldif.LdifReader;
import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.util.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -183,16 +184,14 @@ public class SingleFileLdifPartition ext
@Override
- public void add( AddOperationContext addContext ) throws LdapException
+ public void add( Entry entry ) throws LdapException
{
synchronized ( lock )
{
- wrappedPartition.add( addContext );
+ wrappedPartition.add( entry );
if ( contextEntry == null )
{
- Entry entry = addContext.getEntry();
-
if ( entry.getDn().equals( suffix ) )
{
contextEntry = entry;
@@ -254,11 +253,11 @@ public class SingleFileLdifPartition ext
@Override
- public void delete( Long id ) throws LdapException
+ public void delete( Dn entryDn ) throws LdapException
{
synchronized ( lock )
{
- wrappedPartition.delete( id );
+ wrappedPartition.delete( entryDn );
dirty = true;
rewritePartitionData();
}
@@ -294,14 +293,13 @@ public class SingleFileLdifPartition ext
IndexCursor<Long, Entry, Long> cursor = wrappedPartition.getOneLevelIndex().forwardCursor( suffixId );
-
- appendLdif( wrappedPartition.lookup( suffixId ) );
+ appendLdif( wrappedPartition.lookup( suffix ) );
while ( cursor.next() )
{
Long childId = cursor.get().getId();
- Entry entry = wrappedPartition.lookup( childId );
+ Entry entry = wrappedPartition.lookup( cursor.get().getObject().getDn() );
appendLdif( entry );
@@ -336,6 +334,7 @@ public class SingleFileLdifPartition ext
{
IndexCursor<Long, Entry, Long> cursor = null;
+
if ( cursorMap == null )
{
cursorMap = new HashMap<Long, IndexCursor<Long, Entry, Long>>();
@@ -360,7 +359,7 @@ public class SingleFileLdifPartition ext
do
{
IndexEntry<Long, Entry, Long> idxEntry = cursor.get();
- Entry entry = wrappedPartition.lookup( idxEntry.getId() );
+ Entry entry = wrappedPartition.lookup( idxEntry.getObject().getDn() );
Long childId = wrappedPartition.getEntryId( entry.getDn() );
Modified: directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/LdifPartitionTest.java Thu Jun 30 15:05:05 2011
@@ -429,8 +429,8 @@ public class LdifPartitionTest
{
CoreSession session = injectEntries();
- ClonedServerEntry childEntry1 = partition.lookup( partition.getEntryId( new Dn( schemaManager, "dc=child1,ou=test,ou=system" ) ) );
- ClonedServerEntry childEntry2 = partition.lookup( partition.getEntryId( new Dn( schemaManager, "dc=child2,ou=test,ou=system" ) ) );
+ Entry childEntry1 = partition.lookup( new Dn( schemaManager, "dc=child1,ou=test,ou=system" ) );
+ Entry childEntry2 = partition.lookup( new Dn( schemaManager, "dc=child2,ou=test,ou=system" ) );
MoveOperationContext moveOpCtx = new MoveOperationContext( session, childEntry1.getDn(), childEntry2.getDn() );
partition.move( moveOpCtx );
Modified: directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/ldif-partition/src/test/java/org/apache/directory/server/core/partition/SingleFileLdifPartitionTest.java Thu Jun 30 15:05:05 2011
@@ -276,9 +276,7 @@ public class SingleFileLdifPartitionTest
partition.add( addCtx );
- Long id = partition.getEntryId( contextEntry.getDn() );
- assertNotNull( id );
- assertEquals( contextEntry, partition.lookup( id ) );
+ assertEquals( contextEntry, partition.lookup( contextEntry.getDn() ) );
RandomAccessFile file = new RandomAccessFile( new File( partition.getPartitionPath() ), "r" );
@@ -684,8 +682,8 @@ public class SingleFileLdifPartitionTest
{
SingleFileLdifPartition partition = injectEntries();
- ClonedServerEntry childEntry1 = partition.lookup( partition.getEntryId( new Dn( schemaManager, "dc=child1,ou=test,ou=system" ) ) );
- ClonedServerEntry childEntry2 = partition.lookup( partition.getEntryId( new Dn( schemaManager, "dc=child2,ou=test,ou=system" ) ) );
+ Entry childEntry1 = partition.lookup( new Dn( schemaManager, "dc=child1,ou=test,ou=system" ) );
+ Entry childEntry2 = partition.lookup( new Dn( schemaManager, "dc=child2,ou=test,ou=system" ) );
MoveOperationContext moveOpCtx = new MoveOperationContext( mockSession, childEntry1.getDn(),
childEntry2.getDn() );
@@ -707,8 +705,8 @@ public class SingleFileLdifPartitionTest
{
SingleFileLdifPartition partition = injectEntries();
- ClonedServerEntry childEntry1 = partition.lookup( partition.getEntryId( new Dn( schemaManager, "dc=grandChild11,dc=child1,ou=test,ou=system" ) ) );
- ClonedServerEntry childEntry2 = partition.lookup( partition.getEntryId( new Dn( schemaManager, "dc=child2,ou=test,ou=system" ) ) );
+ Entry childEntry1 = partition.lookup( new Dn( schemaManager, "dc=grandChild11,dc=child1,ou=test,ou=system" ) );
+ Entry childEntry2 = partition.lookup( new Dn( schemaManager, "dc=child2,ou=test,ou=system" ) );
MoveOperationContext moveOpCtx = new MoveOperationContext( mockSession, childEntry1.getDn(),
childEntry2.getDn() );
@@ -838,9 +836,7 @@ public class SingleFileLdifPartitionTest
partition.add( addCtx );
// search works fine
- Long id = partition.getEntryId( contextEntry.getDn() );
- assertNotNull( id );
- assertEquals( contextEntry, partition.lookup( id ) );
+ assertEquals( contextEntry, partition.lookup( contextEntry.getDn() ) );
RandomAccessFile file = new RandomAccessFile( new File( partition.getPartitionPath() ), "r" );
Modified: directory/apacheds/branches/apacheds-no-reverse-index/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java Thu Jun 30 15:05:05 2011
@@ -174,7 +174,8 @@ public class ReadOnlyConfigurationPartit
/**
* {@inheritDoc}
*/
- public void add( AddOperationContext arg0 ) throws LdapException
+ @Override
+ public void add( Entry entry ) throws LdapException
{
// Not implemented (Read-Only)
}
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/BTreePartition.java Thu Jun 30 15:05:05 2011
@@ -226,26 +226,17 @@ public abstract class BTreePartition<ID>
{
Dn dn = deleteContext.getDn();
- ID id = getEntryId( dn );
-
- // don't continue if id is null
- if ( id == null )
- {
- throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_699, dn ) );
- }
-
- if ( getChildCount( id ) > 0 )
- {
- LdapContextNotEmptyException cnee = new LdapContextNotEmptyException( I18n.err( I18n.ERR_700, dn ) );
- //cnee.setRemainingName( dn );
- throw cnee;
- }
+ delete( dn );
+ }
- delete( id );
+
+ public void add( AddOperationContext addContext ) throws LdapException
+ {
+ add( addContext.getEntry() );
}
- public abstract void add( AddOperationContext addContext ) throws LdapException;
+ public abstract void add( Entry entry ) throws LdapException;
public abstract void modify( ModifyOperationContext modifyContext ) throws LdapException;
@@ -253,8 +244,9 @@ public abstract class BTreePartition<ID>
public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
{
- return new BaseEntryFilteringCursor( new ServerEntryCursorAdaptor<ID>( this, list( getEntryId( listContext
- .getDn() ) ) ), listContext );
+ return new BaseEntryFilteringCursor(
+ new ServerEntryCursorAdaptor<ID>( this,
+ list( listContext.getDn() ) ), listContext );
}
@@ -270,7 +262,8 @@ public abstract class BTreePartition<ID>
underlying = searchEngine.cursor( dn, derefMode, filter, searchCtls );
- return new BaseEntryFilteringCursor( new ServerEntryCursorAdaptor<ID>( this, underlying ), searchContext );
+ return new BaseEntryFilteringCursor(
+ new ServerEntryCursorAdaptor<ID>( this, underlying ), searchContext );
}
catch ( LdapException le )
{
@@ -284,17 +277,15 @@ public abstract class BTreePartition<ID>
}
- public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws LdapException
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
- ID id = getEntryId( lookupContext.getDn() );
+ Entry entry = lookup( lookupContext.getDn() );
- if ( id == null )
+ if ( entry == null )
{
return null;
}
- ClonedServerEntry entry = lookup( id );
-
// Remove all the attributes if the NO_ATTRIBUTE flag is set
if ( lookupContext.hasNoAttribute() )
{
@@ -311,7 +302,7 @@ public abstract class BTreePartition<ID>
}
else
{
- for ( AttributeType attributeType : ( entry.getOriginalEntry() ).getAttributeTypes() )
+ for ( AttributeType attributeType : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributeTypes() )
{
String oid = attributeType.getOid();
@@ -329,7 +320,7 @@ public abstract class BTreePartition<ID>
{
if ( lookupContext.hasAllOperational() )
{
- for ( AttributeType attributeType : ( entry.getOriginalEntry() ).getAttributeTypes() )
+ for ( AttributeType attributeType : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributeTypes() )
{
if ( attributeType.getUsage() == UsageEnum.USER_APPLICATIONS )
{
@@ -341,7 +332,7 @@ public abstract class BTreePartition<ID>
{
if ( lookupContext.getAttrsId().size() == 0 )
{
- for ( AttributeType attributeType : ( entry.getOriginalEntry() ).getAttributeTypes() )
+ for ( AttributeType attributeType : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributeTypes() )
{
if ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS )
{
@@ -351,7 +342,7 @@ public abstract class BTreePartition<ID>
}
else
{
- for ( AttributeType attributeType : ( entry.getOriginalEntry() ).getAttributeTypes() )
+ for ( AttributeType attributeType : ( ((ClonedServerEntry)entry).getOriginalEntry() ).getAttributeTypes() )
{
String oid = attributeType.getOid();
@@ -484,16 +475,16 @@ public abstract class BTreePartition<ID>
public abstract ID getEntryId( Dn dn ) throws LdapException;
- public abstract Dn getEntryDn( ID id ) throws Exception;
-
+ public abstract Entry lookup( ID id ) throws LdapException;
- public abstract ClonedServerEntry lookup( ID id ) throws LdapException;
+
+ public abstract Entry lookup( Dn dn ) throws LdapException;
- public abstract void delete( ID id ) throws LdapException;
+ public abstract void delete( Dn dn ) throws LdapException;
- public abstract IndexCursor<ID, Entry, ID> list( ID id ) throws LdapException;
+ public abstract IndexCursor<ID, Entry, ID> list( Dn entryDn ) throws LdapException;
public abstract int getChildCount( ID id ) throws LdapException;
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/ServerEntryCursorAdaptor.java Thu Jun 30 15:05:05 2011
@@ -134,11 +134,6 @@ public class ServerEntryCursorAdaptor<ID
{
IndexEntry<ID, Entry, ID> indexEntry = indexCursor.get();
- if ( indexEntry.getObject() == null )
- {
- indexEntry.setObject( db.lookup( indexEntry.getId() ) );
- }
-
return indexEntry.getObject();
}
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java Thu Jun 30 15:05:05 2011
@@ -262,11 +262,12 @@ public abstract class AbstractXdbmPartit
/**
* {@inheritDoc}
*/
- public final void add( AddOperationContext addContext ) throws LdapException
+ @Override
+ public final void add( Entry entry ) throws LdapException
{
try
{
- store.add( ( Entry ) ( ( ClonedServerEntry ) addContext.getEntry() ).getClonedEntry() );
+ store.add( entry );
}
catch ( Exception e )
{
@@ -278,7 +279,23 @@ public abstract class AbstractXdbmPartit
/**
* {@inheritDoc}
*/
- public final ClonedServerEntry lookup( ID id ) throws LdapException
+ public final Entry lookup( Dn entryDn ) throws LdapException
+ {
+ try
+ {
+ return new ClonedServerEntry( store.lookup( entryDn ) );
+ }
+ catch ( Exception e )
+ {
+ throw new LdapOperationErrorException( e.getMessage(), e );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public final Entry lookup( ID id ) throws LdapException
{
try
{
@@ -294,11 +311,11 @@ public abstract class AbstractXdbmPartit
/**
* {@inheritDoc}
*/
- public final void delete( ID id ) throws LdapException
+ public final void delete( Dn dn ) throws LdapException
{
try
{
- store.delete( id );
+ store.delete( dn );
}
catch ( Exception e )
{
@@ -310,11 +327,11 @@ public abstract class AbstractXdbmPartit
/**
* {@inheritDoc}
*/
- public final IndexCursor<ID, Entry, ID> list( ID id ) throws LdapException
+ public final IndexCursor<ID, Entry, ID> list( Dn entryDn ) throws LdapException
{
try
{
- return store.list( id );
+ return store.list( entryDn );
}
catch ( Exception e )
{
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java Thu Jun 30 15:05:05 2011
@@ -43,6 +43,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.entry.Value;
import org.apache.directory.shared.ldap.model.exception.LdapAliasDereferencingException;
import org.apache.directory.shared.ldap.model.exception.LdapAliasException;
+import org.apache.directory.shared.ldap.model.exception.LdapContextNotEmptyException;
import org.apache.directory.shared.ldap.model.exception.LdapEntryAlreadyExistsException;
import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.exception.LdapNoSuchObjectException;
@@ -807,6 +808,12 @@ public abstract class AbstractStore<E, I
// Check into the Rdn index
ID curEntryId = rdnIdx.forwardLookup( currentRdn );
+
+ if ( curEntryId == null )
+ {
+ return result;
+ }
+
result.add( curEntryId );
while ( i < dnSize )
@@ -841,32 +848,35 @@ public abstract class AbstractStore<E, I
/**
* {@inheritDoc}
*/
- public Dn getEntryDn( ID id ) throws Exception
+ private boolean hasChildren( ID id ) throws Exception
{
- return buildEntryDn( id );
+ // Check into the sublevel index
+ return subLevelIdx.count( id ) > 1;
}
+ //------------------------------------------------------------------------
+ // Operations
+ //------------------------------------------------------------------------
/**
* {@inheritDoc}
- *
- public ID getParentId( ID childId ) throws Exception
+ */
+ public Entry lookup( Dn entryDn ) throws Exception
{
- ParentIdAndRdn<ID> key = rdnIdx.reverseLookup( childId );
+ ID id = getEntryId( entryDn );
+ Entry entry = master.get( id );
- if ( key == null )
+ if ( entry != null )
{
- return null;
+ entry.setDn( entryDn );
+
+ return entry;
}
- return key.getParentId();
+ return null;
}
-
-
- //------------------------------------------------------------------------
- // Operations
- //------------------------------------------------------------------------
-
+
+
/**
* {@inheritDoc}
*/
@@ -878,6 +888,7 @@ public abstract class AbstractStore<E, I
{
Dn dn = buildEntryDn( id );
entry.setDn( dn );
+
return entry;
}
@@ -888,8 +899,9 @@ public abstract class AbstractStore<E, I
/**
* {@inheritDoc}
*/
- public IndexCursor<ID, E, ID> list( ID id ) throws Exception
+ public IndexCursor<ID, E, ID> list( Dn entryDn ) throws Exception
{
+ ID id = getEntryId( entryDn );
IndexCursor<ID, E, ID> cursor = oneLevelIdx.forwardCursor( id );
cursor.beforeValue( id, null );
@@ -1144,31 +1156,65 @@ public abstract class AbstractStore<E, I
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public synchronized void delete( ID id ) throws Exception
+ public synchronized void delete( Dn entryDn ) throws Exception
{
- Entry entry = master.get( id );
+ ID id = getEntryId( entryDn );
- Attribute objectClass = entry.get( OBJECT_CLASS_AT );
+ // don't continue if id is null
+ if ( id == null )
+ {
+ throw new LdapNoSuchObjectException( I18n.err( I18n.ERR_699, entryDn ) );
+ }
- if ( objectClass.contains( SchemaConstants.ALIAS_OC ) )
+ // Don't continue if we have children
+ if ( hasChildren( id ) )
{
- dropAliasIndices( id );
+ LdapContextNotEmptyException cnee = new LdapContextNotEmptyException( I18n.err( I18n.ERR_700, entryDn ) );
+ throw cnee;
}
+
+ Entry entry = master.get( id );
+
+ // Drop OC
+ Attribute objectClass = entry.get( OBJECT_CLASS_AT );
for ( Value<?> value : objectClass )
{
objectClassIdx.drop( value.getString(), id );
}
-
- ParentIdAndRdn<ID> key = new ParentIdAndRdn<ID>( getParentId( id ), entry.getDn().getRdn() );
+ // Compute some ID references
+ ID rootId = getRootId();
+ List<ID> parentIds = getParentIds( entryDn );
+ ID parentId = parentIds.get( parentIds.size() - 1 );
+
+ // Drop the RDN
+ ParentIdAndRdn<ID> key = new ParentIdAndRdn<ID>( parentId, entry.getDn().getRdn() );
rdnIdx.drop( key, id );
- oneLevelIdx.drop( id );
- subLevelIdx.drop( id );
+
+ // Drop the OneLevel index
+ oneLevelIdx.drop( parentId, id );
+
+ // Drop the subLevel index
+
+ for ( ID ancestor : parentIds )
+ {
+ if ( ancestor.equals( rootId ) )
+ {
+ continue;
+ }
+
+ subLevelIdx.drop( ancestor, id );
+ }
+
+ // Drop the encryCSN index
entryCsnIdx.drop( entry.get( SchemaConstants.ENTRY_CSN_AT ).getString(), id );
+
+ // Drop the encryUUID index
entryUuidIdx.drop( entry.get( SchemaConstants.ENTRY_UUID_AT ).getString(), id );
+ // Now drop the user indexes
for ( Attribute attribute : entry )
{
String attributeOid = attribute.getAttributeType().getOid();
@@ -1557,7 +1603,7 @@ public abstract class AbstractStore<E, I
* @throws Exception if index alteration or attribute addition fails
*/
@SuppressWarnings("unchecked")
- protected void add( ID id, Entry entry, Attribute mods ) throws Exception
+ private void add( ID id, Entry entry, Attribute mods ) throws Exception
{
if ( entry instanceof ClonedServerEntry )
{
@@ -1618,7 +1664,7 @@ public abstract class AbstractStore<E, I
* fails.
*/
@SuppressWarnings("unchecked")
- protected void replace( ID id, Entry entry, Attribute mods ) throws Exception
+ private void replace( ID id, Entry entry, Attribute mods ) throws Exception
{
if ( entry instanceof ClonedServerEntry )
{
@@ -1709,7 +1755,7 @@ public abstract class AbstractStore<E, I
* @throws Exception if index alteration or attribute modification fails.
*/
@SuppressWarnings("unchecked")
- protected void remove( ID id, Entry entry, Attribute mods ) throws Exception
+ private void remove( ID id, Entry entry, Attribute mods ) throws Exception
{
if ( entry instanceof ClonedServerEntry )
{
@@ -1871,7 +1917,7 @@ public abstract class AbstractStore<E, I
* to another alias as its target in the aliasedObjectName attribute,
* then we have a situation where an alias chain is being created.
* Alias chaining is not allowed so we throw and exception.
- */
+ *
if ( null != aliasIdx.reverseLookup( targetId ) )
{
String msg = I18n.err( I18n.ERR_227 );
@@ -1882,6 +1928,7 @@ public abstract class AbstractStore<E, I
// Add the alias to the simple alias index
aliasIdx.add( normalizedAliasTargetDn.getNormName(), aliasId );
+ */
/*
* Handle One Level Scope Alias Index
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ParentIdAndRdn.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ParentIdAndRdn.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ParentIdAndRdn.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ParentIdAndRdn.java Thu Jun 30 15:05:05 2011
@@ -242,7 +242,7 @@ public class ParentIdAndRdn<ID extends C
StringBuilder sb = new StringBuilder();
sb.append( "ParentIdAndRdn<" );
- sb.append( parentId ).append( "[" );
+ sb.append( parentId ).append( ", '" );
boolean isFirst = true;
@@ -260,7 +260,7 @@ public class ParentIdAndRdn<ID extends C
sb.append( rdn );
}
- sb.append( "]" );
+ sb.append( "'>" );
return sb.toString();
}
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java Thu Jun 30 15:05:05 2011
@@ -497,7 +497,17 @@ public interface Store<E, ID extends Com
* @param id The Entry ID we want to get back
* @return The found Entry, or null if not found
* @throws Exception If the lookup failed for any reason (except a not found entry)
+ */
+ Entry lookup( Dn entryDn ) throws Exception;
+
+
+ /**
+ * Get back an entry knowing its ID
*
+ * @param id The Entry ID we want to get back
+ * @return The found Entry, or null if not found
+ * @throws Exception If the lookup failed for any reason (except a not found entry)
+ */
Entry lookup( ID id ) throws Exception;
@@ -506,7 +516,7 @@ public interface Store<E, ID extends Com
* @param id The id of the entry to delete
* @throws Exception If the deletion failed
*/
- void delete( ID id ) throws Exception;
+ void delete( Dn entryDn ) throws Exception;
/**
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/AbstractStoreTest.java Thu Jun 30 15:05:05 2011
@@ -182,7 +182,7 @@ public class AbstractStoreTest
mods.add( add );
Long entryId = store.getEntryId( dn );
- Entry lookedup = store.lookup( entryId );
+ Entry lookedup = store.lookup( dn );
// before modification: no "uidObject" tuple in objectClass index
assertFalse( store.getObjectClassIndex().forward( "uidObject", entryId ) );
@@ -214,7 +214,7 @@ public class AbstractStoreTest
mods.add( add );
Long entryId = store.getEntryId( dn );
- Entry lookedup = store.lookup( entryId );
+ Entry lookedup = store.lookup( dn );
// before modification: expect "sales" tuple in ou index
Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) store.getUserIndex( OU_AT );
@@ -245,7 +245,7 @@ public class AbstractStoreTest
mods.add( add );
Long entryId = store.getEntryId( dn );
- Entry lookedup = store.lookup( entryId );
+ Entry lookedup = store.lookup( dn );
// before modification: expect "sales" tuple in ou index
Index<String, Entry, Long> ouIndex = ( Index<String, Entry, Long> ) store.getUserIndex( OU_AT );
@@ -281,7 +281,7 @@ public class AbstractStoreTest
mods.add( add );
Long entryId = store.getEntryId( dn );
- Entry lookedup = store.lookup( entryId );
+ Entry lookedup = store.lookup( dn );
// before modification: expect "person" tuple in objectClass index
assertTrue( store.getObjectClassIndex().forward( "person", entryId ) );
@@ -311,7 +311,7 @@ public class AbstractStoreTest
mods.add( add );
Long entryId = store.getEntryId( dn );
- Entry lookedup = store.lookup( entryId );
+ Entry lookedup = store.lookup( dn );
// before modification: expect "person" tuple in objectClass index
assertTrue( store.getObjectClassIndex().forward( "person", entryId ) );
@@ -342,7 +342,7 @@ public class AbstractStoreTest
mods.add( add );
Long entryId = store.getEntryId( dn );
- Entry lookedup = store.lookup( entryId );
+ Entry lookedup = store.lookup( dn );
assertNotSame( csn, lookedup.get( csnAt ).getString() );
@@ -397,7 +397,7 @@ public class AbstractStoreTest
private Entry verifyParentId( Dn dn ) throws Exception
{
Long entryId = store.getEntryId( dn );
- Entry entry = store.lookup( entryId );
+ Entry entry = store.lookup( dn );
Long parentId = store.getParentId( entryId );
Attribute parentIdAt = entry.get( SchemaConstants.ENTRY_PARENT_ID_AT );
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/StoreUtils.java Thu Jun 30 15:05:05 2011
@@ -24,11 +24,8 @@ import java.util.UUID;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.csn.CsnFactory;
-import org.apache.directory.shared.ldap.model.cursor.Cursor;
import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
-import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -42,8 +39,19 @@ public class StoreUtils
{
/** CSN factory instance */
private static final CsnFactory CSN_FACTORY = new CsnFactory( 0 );
-
-
+
+ public static Dn DN1;
+ public static Dn DN2;
+ public static Dn DN3;
+ public static Dn DN4;
+ public static Dn DN5;
+ public static Dn DN6;
+ public static Dn DN7;
+ public static Dn DN8;
+ public static Dn DN9;
+ public static Dn DN10;
+ public static Dn DN11;
+
/**
* Initializes and loads a store with the example data shown in
* <a href="http://cwiki.apache.org/confluence/display/DIRxSRVx11/Structure+and+Organization">
@@ -60,13 +68,24 @@ public class StoreUtils
@SuppressWarnings("PMD.AvoidUsingHardCodedIP")
public static void loadExampleData( Store<Entry, Long> store, SchemaManager schemaManager ) throws Exception
{
- Dn suffixDn = new Dn( schemaManager, "o=Good Times Co." );
- store.setSuffixDn( suffixDn );
+ DN1 = new Dn( schemaManager, "o=Good Times Co." );
+ DN2 = new Dn( schemaManager, "ou=Sales,o=Good Times Co." );
+ DN3 = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co." );
+ DN4 = new Dn( schemaManager, "ou=Engineering,o=Good Times Co." );
+ DN5 = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
+ DN6 = new Dn( schemaManager, "cn=JIM BEAN,ou=Sales,o=Good Times Co." );
+ DN7 = new Dn( schemaManager, "ou=Apache,ou=Board of Directors,o=Good Times Co." );
+ DN8 = new Dn( schemaManager, "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
+ DN9 = new Dn( schemaManager, "commonName=Jim Bean,ou=Apache,ou=Board of Directors,o=Good Times Co." );
+ DN10 = new Dn( schemaManager, "commonName=Jim Bean,ou=Board of Directors,o=Good Times Co." );
+ DN11 = new Dn( schemaManager, "2.5.4.3=Johnny Walker,ou=Engineering,o=Good Times Co." );
+
+ store.setSuffixDn( DN1 );
store.init( schemaManager );
// Entry #1
- DefaultEntry entry = new DefaultEntry( schemaManager, suffixDn );
+ DefaultEntry entry = new DefaultEntry( schemaManager, DN1 );
entry.add( "objectClass", "organization" );
entry.add( "o", "Good Times Co." );
entry.add( "postalCode", "1" );
@@ -74,8 +93,7 @@ public class StoreUtils
injectEntryInStore( store, entry );
// Entry #2
- Dn dn = new Dn( schemaManager, "ou=Sales,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN2 );
entry.add( "objectClass", "top", "organizationalUnit" );
entry.add( "ou", "Sales" );
entry.add( "postalCode", "1" );
@@ -83,8 +101,7 @@ public class StoreUtils
injectEntryInStore( store, entry );
// Entry #3
- dn = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN3 );
entry.add( "objectClass", "top", "organizationalUnit" );
entry.add( "ou", "Board of Directors" );
entry.add( "postalCode", "1" );
@@ -92,8 +109,7 @@ public class StoreUtils
injectEntryInStore( store, entry );
// Entry #4
- dn = new Dn( schemaManager, "ou=Engineering,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN4 );
entry.add( "objectClass", "top", "organizationalUnit" );
entry.add( "ou", "Engineering" );
entry.add( "postalCode", "2" );
@@ -101,8 +117,7 @@ public class StoreUtils
injectEntryInStore( store, entry );
// Entry #5
- dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN5 );
entry.add( "objectClass", "top", "person", "organizationalPerson" );
entry.add( "ou", "Sales" );
entry.add( "cn", "JOhnny WAlkeR" );
@@ -112,8 +127,7 @@ public class StoreUtils
injectEntryInStore( store, entry );
// Entry #6
- dn = new Dn( schemaManager, "cn=JIM BEAN,ou=Sales,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN6 );
entry.add( "objectClass", "top", "person", "organizationalPerson" );
entry.add( "ou", "Sales" );
entry.add( "cn", "JIM BEAN" );
@@ -123,8 +137,7 @@ public class StoreUtils
injectEntryInStore( store, entry );
// Entry #7
- dn = new Dn( schemaManager, "ou=Apache,ou=Board of Directors,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN7 );
entry.add( "objectClass", "top", "organizationalUnit" );
entry.add( "ou", "Apache" );
entry.add( "postalCode", "5" );
@@ -132,8 +145,7 @@ public class StoreUtils
injectEntryInStore( store, entry );
// Entry #8
- dn = new Dn( schemaManager, "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN8 );
entry.add( "objectClass", "top", "person", "organizationalPerson" );
entry.add( "ou", "Engineering" );
entry.add( "cn", "Jack Daniels" );
@@ -145,8 +157,7 @@ public class StoreUtils
// aliases -------------
// Entry #9
- dn = new Dn( schemaManager, "commonName=Jim Bean,ou=Apache,ou=Board of Directors,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN9 );
entry.add( "objectClass", "top", "alias", "extensibleObject" );
entry.add( "ou", "Apache" );
entry.add( "commonName", "Jim Bean" );
@@ -154,16 +165,14 @@ public class StoreUtils
injectEntryInStore( store, entry );
// Entry #10
- dn = new Dn( schemaManager, "commonName=Jim Bean,ou=Board of Directors,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN10 );
entry.add( "objectClass", "top", "alias", "extensibleObject" );
entry.add( "commonName", "Jim Bean" );
entry.add( "aliasedObjectName", "cn=Jim Bean,ou=Sales,o=Good Times Co." );
injectEntryInStore( store, entry );
// Entry #11
- dn = new Dn( schemaManager, "2.5.4.3=Johnny Walker,ou=Engineering,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, dn );
+ entry = new DefaultEntry( schemaManager, DN11 );
entry.add( "objectClass", "top", "alias", "extensibleObject" );
entry.add( "ou", "Engineering" );
entry.add( "2.5.4.3", "Johnny Walker" );
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlStoreTest.java Thu Jun 30 15:05:05 2011
@@ -82,7 +82,6 @@ public class AvlStoreTest
{
private static final Logger LOG = LoggerFactory.getLogger( AvlStoreTest.class.getSimpleName() );
- private static File wkdir;
private static AvlStore<Entry> store;
private static SchemaManager schemaManager = null;
private static Dn EXAMPLE_COM;
@@ -402,7 +401,7 @@ public class AvlStoreTest
assertNull( store.getParentId( 0L ) );
// should NOW be allowed
- store.delete( 1L );
+ store.delete( dn );
}
@@ -419,7 +418,7 @@ public class AvlStoreTest
assertTrue( cursor.next() );
assertEquals( 3, store.getChildCount( 1L ) );
- store.delete( 2L );
+ store.delete( StoreUtils.DN2 );
assertEquals( 2, store.getChildCount( 1L ) );
assertEquals( 10, store.count() );
@@ -434,7 +433,7 @@ public class AvlStoreTest
entry.add( "entryUUID", UUID.randomUUID().toString() );
store.add( entry );
- store.delete( 12L ); // drops the alias indices
+ store.delete( new Dn( "commonName=Jack Daniels,ou=Apache,ou=Board of Directors,o=Good Times Co." ) ); // drops the alias indices
}
@@ -639,7 +638,7 @@ public class AvlStoreTest
Dn dn2 = new Dn( schemaManager, "sn=Ja\\+es,ou=Engineering,o=Good Times Co." );
Long id = store.getEntryId( dn2 );
assertNotNull( id );
- Entry entry2 = store.lookup( id );
+ Entry entry2 = store.lookup( dn2 );
assertEquals( "ja+es", entry2.get( "sn" ).getString() );
}
@@ -692,7 +691,7 @@ public class AvlStoreTest
Modification add = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
mods.add( add );
- Entry lookedup = store.lookup( store.getEntryId( dn ) );
+ Entry lookedup = store.lookup( dn );
store.modify( dn, mods );
assertTrue( lookedup.get( "sn" ).contains( attribVal ) );
@@ -703,7 +702,7 @@ public class AvlStoreTest
entry.add( "telephoneNumber", attribVal );
store.modify( dn, ModificationOperation.ADD_ATTRIBUTE, entry );
- lookedup = store.lookup( store.getEntryId( dn ) );
+ lookedup = store.lookup( dn );
assertTrue( lookedup.get( "telephoneNumber" ).contains( attribVal ) );
}
@@ -723,7 +722,7 @@ public class AvlStoreTest
Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
mods.add( add );
- Entry lookedup = store.lookup( store.getEntryId( dn ) );
+ Entry lookedup = store.lookup( dn );
assertEquals( "WAlkeR", lookedup.get( "sn" ).get().getString() ); // before replacing
@@ -752,7 +751,7 @@ public class AvlStoreTest
Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
mods.add( add );
- Entry lookedup = store.lookup( store.getEntryId( dn ) );
+ Entry lookedup = store.lookup( dn );
assertNotNull( lookedup.get( "sn" ).get() );
@@ -793,7 +792,7 @@ public class AvlStoreTest
Modification add = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
mods.add( add );
- Entry lookedup = store.lookup( store.getEntryId( dn ) );
+ Entry lookedup = store.lookup( dn );
assertNull( lookedup.get( "ou" ) ); // before replacing
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java Thu Jun 30 15:05:05 2011
@@ -433,7 +433,7 @@ public class PresenceTest
entry = new ForwardIndexEntry<String, Entry, Long>();
entry.setValue( SchemaConstants.SEARCHGUIDE_AT_OID );
entry.setId( ( long ) 5 );
- entry.setObject( store.lookup( ( long ) 5 ) );
+ entry.setObject( store.lookup( StoreUtils.DN5 ) );
assertFalse( evaluator.evaluate( entry ) );
node = new PresenceNode( schemaManager.getAttributeType( "st" ) );
@@ -445,7 +445,7 @@ public class PresenceTest
entry = new ForwardIndexEntry<String, Entry, Long>();
entry.setValue( SchemaConstants.ST_AT_OID );
entry.setId( ( long ) 5 );
- entry.setObject( store.lookup( ( long ) 5 ) );
+ entry.setObject( store.lookup( StoreUtils.DN5 ) );
assertFalse( evaluator.evaluate( entry ) );
}
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java Thu Jun 30 15:05:05 2011
@@ -615,35 +615,35 @@ public class SubstringTest
evaluator = new SubstringEvaluator<Long>( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String, Entry, Long>();
indexEntry.setId( 5L );
- indexEntry.setObject( store.lookup( 5L ) );
+ indexEntry.setObject( store.lookup( StoreUtils.DN5 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "searchGuide" ), "j", null );
evaluator = new SubstringEvaluator<Long>( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String, Entry, Long>();
indexEntry.setId( 6L );
- indexEntry.setObject( store.lookup( 6L ) );
+ indexEntry.setObject( store.lookup( StoreUtils.DN6 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "st" ), "j", null );
evaluator = new SubstringEvaluator<Long>( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String, Entry, Long>();
indexEntry.setId( 6L );
- indexEntry.setObject( store.lookup( 6L ) );
+ indexEntry.setObject( store.lookup( StoreUtils.DN6 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "name" ), "j", null );
evaluator = new SubstringEvaluator<Long>( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String, Entry, Long>();
indexEntry.setId( 6L );
- indexEntry.setObject( store.lookup( 6L ) );
+ indexEntry.setObject( store.lookup( StoreUtils.DN6 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "name" ), "s", null );
evaluator = new SubstringEvaluator<Long>( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String, Entry, Long>();
indexEntry.setId( 6L );
- indexEntry.setObject( store.lookup( 6L ) );
+ indexEntry.setObject( store.lookup( StoreUtils.DN6 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
}
@@ -664,14 +664,14 @@ public class SubstringTest
evaluator = new SubstringEvaluator<Long>( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String, Entry, Long>();
indexEntry.setId( 6L );
- indexEntry.setObject( store.lookup( 6L ) );
+ indexEntry.setObject( store.lookup( StoreUtils.DN6 ) );
assertTrue( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( schemaManager.getAttributeType( "cn" ), "s", null );
evaluator = new SubstringEvaluator<Long>( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String, Entry, Long>();
indexEntry.setId( 6L );
- indexEntry.setObject( store.lookup( 6L ) );
+ indexEntry.setObject( store.lookup( StoreUtils.DN6 ) );
assertFalse( evaluator.evaluate( indexEntry ) );
}
Modified: directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java?rev=1141562&r1=1141561&r2=1141562&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java (original)
+++ directory/apacheds/branches/apacheds-no-reverse-index/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java Thu Jun 30 15:05:05 2011
@@ -310,8 +310,10 @@ public class SubtreeScopeTest
@Test
public void testCursorWithDereferencing() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, new Dn( SchemaConstants.OU_AT_OID
- + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co." ), SearchScope.SUBTREE );
+ ScopeNode node = new ScopeNode(
+ AliasDerefMode.DEREF_IN_SEARCHING,
+ new Dn( "2.5.4.11=board of directors,2.5.4.10=good times co." ),
+ SearchScope.SUBTREE );
SubtreeScopeEvaluator<Entry, Long> evaluator = new SubtreeScopeEvaluator<Entry, Long>( store, node );
SubtreeScopeCursor<Long> cursor = new SubtreeScopeCursor<Long>( store, evaluator );