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 2012/04/30 17:59:27 UTC
svn commit: r1332268 [3/5] - in /directory/apacheds/trunk: ./ all/
core-annotations/
core-annotations/src/main/java/org/apache/directory/server/core/factory/
core-api/
core-api/src/main/java/org/apache/directory/server/core/api/changelog/
core-api/src/...
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ReverseIndexEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ReverseIndexEntry.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ReverseIndexEntry.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ReverseIndexEntry.java Mon Apr 30 15:59:22 2012
@@ -29,13 +29,13 @@ import org.apache.directory.shared.ldap.
* if one has already been loaded.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @param <V> The value stored in the Tuple, associated key for the Entry
+ * @param <K> The key stored in the Tuple, associated key for the Entry
* @param <ID> The ID of the Entry
*/
-public class ReverseIndexEntry<V, ID> extends AbstractIndexEntry<V, ID>
+public class ReverseIndexEntry<K, ID> extends AbstractIndexEntry<K, ID>
{
/** The underlying Tuple */
- private final Tuple<ID, V> tuple = new Tuple<ID, V>();
+ private final Tuple<ID, K> tuple = new Tuple<ID, K>();
/**
@@ -55,7 +55,7 @@ public class ReverseIndexEntry<V, ID> ex
* @param tuple the tuple for the ReverseIndexEntry
* @param obj the resusitated Entry that is indexed if any
*/
- public void setTuple( Tuple<ID, V> tuple, Entry entry )
+ public void setTuple( Tuple<ID, K> tuple, Entry entry )
{
setEntry( entry );
this.tuple.setKey( tuple.getKey() );
@@ -75,7 +75,7 @@ public class ReverseIndexEntry<V, ID> ex
/**
* {@inheritDoc}
*/
- public V getValue()
+ public K getKey()
{
return tuple.getValue();
}
@@ -93,7 +93,7 @@ public class ReverseIndexEntry<V, ID> ex
/**
* {@inheritDoc}
*/
- public void setValue( V key )
+ public void setKey( K key )
{
tuple.setValue( key );
}
@@ -122,11 +122,11 @@ public class ReverseIndexEntry<V, ID> ex
/**
* {@inheritDoc}
*/
- public void copy( IndexEntry<V, ID> entry )
+ public void copy( IndexEntry<K, ID> entry )
{
setEntry( entry.getEntry() );
tuple.setKey( entry.getId() );
- tuple.setValue( entry.getValue() );
+ tuple.setValue( entry.getKey() );
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Store.java Mon Apr 30 15:59:22 2012
@@ -91,7 +91,6 @@ public interface Store<E, ID extends Com
public static final String[] SYS_INDEX_OID_ARRAY =
{
ApacheSchemaConstants.APACHE_PRESENCE_AT_OID,
- ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID,
ApacheSchemaConstants.APACHE_RDN_AT_OID,
ApacheSchemaConstants.APACHE_ALIAS_AT_OID,
ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID,
@@ -179,12 +178,6 @@ public interface Store<E, ID extends Com
/**
- * @return The SubLevel system index
- */
- Index<ID, E, ID> getSubLevelIndex();
-
-
- /**
* @return The Alias system index
*/
Index<String, E, ID> getAliasIndex();
@@ -364,6 +357,17 @@ public interface Store<E, ID extends Com
/**
+ * Get back an entry knowing its ID
+ *
+ * @param id The Entry ID we want to get back
+ * @param dn The entry DN when we have it
+ * @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, Dn dn ) throws Exception;
+
+
+ /**
* Gets the count of immediate children of the given entry ID.
*
* @param id the entry ID
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/SearchEngine.java Mon Apr 30 15:59:22 2012
@@ -24,6 +24,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.filter.ExprNode;
import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.model.message.SearchScope;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.server.xdbm.IndexCursor;
@@ -79,12 +80,12 @@ public interface SearchEngine<E, ID>
* @param base the search base
* @param aliasDerefMode the alias dereferencing mode to use
* @param filter the search filter AST root
- * @param searchCtls the JNDI search controls
+ * @param scope the Scope
* @return enumeration over SearchResults
* @throws Exception if the search fails
*/
IndexCursor<ID, E, ID> cursor( Dn base, AliasDerefMode aliasDerefMode, ExprNode filter,
- SearchControls searchCtls ) throws Exception;
+ SearchScope scope ) throws Exception;
/**
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java Mon Apr 30 15:59:22 2012
@@ -165,7 +165,7 @@ public class AllEntriesCursor<ID extends
// Create the returned IndexEntry, copying what we get from the wrapped cursor
IndexEntry<String, ID> wrappedEntry = wrapped.get();
indexEntry.setId( wrappedEntry.getId() );
- indexEntry.setValue( wrappedEntry.getId() );
+ indexEntry.setKey( wrappedEntry.getId() );
indexEntry.setEntry( wrappedEntry.getEntry() );
return indexEntry;
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ChildrenCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ChildrenCursor.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ChildrenCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ChildrenCursor.java Mon Apr 30 15:59:22 2012
@@ -146,9 +146,9 @@ public class ChildrenCursor<ID extends C
IndexEntry cursorEntry = cursor.get();
IndexEntry<ID, ID> entry = new ForwardIndexEntry();
entry.setId( (ID)cursorEntry.getId() );
- entry.setValue( ((ParentIdAndRdn<ID>)cursorEntry.getTuple().getKey()).getParentId() );
+ entry.setKey( ((ParentIdAndRdn<ID>)cursorEntry.getTuple().getKey()).getParentId() );
- if ( entry.getValue().equals( parentId ) )
+ if ( entry.getKey().equals( parentId ) )
{
prefetched = entry;
return true;
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java Mon Apr 30 15:59:22 2012
@@ -122,7 +122,7 @@ public class DefaultOptimizer<E, ID exte
if ( node instanceof ScopeNode )
{
- count = getScopeScan( ( ScopeNode ) node );
+ count = getScopeScan( ( ScopeNode<ID> ) node );
}
else if ( node instanceof AssertionNode )
{
@@ -210,6 +210,7 @@ public class DefaultOptimizer<E, ID exte
}
node.set( "count", count );
+
return count;
}
@@ -370,9 +371,10 @@ public class DefaultOptimizer<E, ID exte
* @return the scan count for scope
* @throws Exception if any errors result
*/
- private long getScopeScan( ScopeNode node ) throws Exception
+ private long getScopeScan( ScopeNode<ID> node ) throws Exception
{
- ID id = db.getEntryId( node.getBaseDn() );
+ ID id = node.getBaseId();
+
switch ( node.getScope() )
{
case OBJECT:
@@ -388,7 +390,7 @@ public class DefaultOptimizer<E, ID exte
}
else
{
- return db.getSubLevelIndex().count( id );
+ return db.getRdnIndex().reverseLookup( id ).getNbDescendants() + 1;
}
default:
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Mon Apr 30 15:59:22 2012
@@ -20,8 +20,6 @@
package org.apache.directory.server.xdbm.search.impl;
-import javax.naming.directory.SearchControls;
-
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.EmptyIndexCursor;
@@ -100,7 +98,7 @@ public class DefaultSearchEngine<ID exte
* {@inheritDoc}
*/
public IndexCursor<ID, Entry, ID> cursor( Dn base, AliasDerefMode aliasDerefMode, ExprNode filter,
- SearchControls searchCtls ) throws Exception
+ SearchScope scope ) throws Exception
{
Dn effectiveBase;
ID baseId = db.getEntryId( base );
@@ -148,20 +146,33 @@ public class DefaultSearchEngine<ID exte
// --------------------------------------------------------------------
// Specifically Handle Object Level Scope
// --------------------------------------------------------------------
-
- if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE )
+ ID effectiveBaseId = baseId;
+
+ if ( effectiveBase != base )
{
- ID effectiveBaseId = baseId;
-
- if ( effectiveBase != base )
- {
- effectiveBaseId = db.getEntryId( effectiveBase );
- }
+ effectiveBaseId = db.getEntryId( effectiveBase );
+ }
+ if ( scope == SearchScope.OBJECT )
+ {
IndexEntry<ID, ID> indexEntry = new ForwardIndexEntry<ID, ID>();
indexEntry.setId( effectiveBaseId );
optimizer.annotate( filter );
Evaluator<? extends ExprNode, Entry, ID> evaluator = evaluatorBuilder.build( filter );
+
+ // Fetch the entry, as we have only one
+ Entry entry = null;
+
+ if ( effectiveBase != base )
+ {
+ entry = db.lookup( indexEntry.getId() );
+ }
+ else
+ {
+ entry = db.lookup( indexEntry.getId(), effectiveBase );
+ }
+
+ indexEntry.setEntry( entry );
if ( evaluator.evaluate( indexEntry ) )
{
@@ -175,13 +186,13 @@ public class DefaultSearchEngine<ID exte
// Add the scope node using the effective base to the filter
BranchNode root = new AndNode();
- ExprNode node = new ScopeNode( aliasDerefMode, effectiveBase, SearchScope.getSearchScope( searchCtls
- .getSearchScope() ) );
+ ExprNode node = new ScopeNode<ID>( aliasDerefMode, effectiveBase, effectiveBaseId, scope );
root.getChildren().add( node );
root.getChildren().add( filter );
// Annotate the node with the optimizer and return search enumeration.
optimizer.annotate( root );
+
return ( IndexCursor<ID, Entry, ID> ) cursorBuilder.build( root );
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java Mon Apr 30 15:59:22 2012
@@ -91,13 +91,13 @@ public class EvaluatorBuilder<ID extends
return new PresenceEvaluator<ID>( ( PresenceNode ) node, db, schemaManager );
case SCOPE:
- if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL )
+ if ( ( ( ScopeNode<ID> ) node ).getScope() == SearchScope.ONELEVEL )
{
- return new OneLevelScopeEvaluator<Entry, ID>( db, ( ScopeNode ) node );
+ return new OneLevelScopeEvaluator<Entry, ID>( db, ( ScopeNode<ID> ) node );
}
else
{
- return new SubtreeScopeEvaluator<Entry, ID>( db, ( ScopeNode ) node );
+ return new SubtreeScopeEvaluator<Entry, ID>( db, ( ScopeNode<ID> ) node );
}
case SUBSTRING:
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java Mon Apr 30 15:59:22 2012
@@ -199,7 +199,7 @@ public class GreaterEqCursor<V, ID exten
* userIdxCursor before the first element. Otherwise we let the
* underlying userIdx Cursor position the element.
*/
- if ( greaterEqEvaluator.getComparator().compare( element.getValue(),
+ if ( greaterEqEvaluator.getComparator().compare( element.getKey(),
greaterEqEvaluator.getExpression().getValue().getValue() ) <= 0 )
{
beforeFirst();
@@ -225,7 +225,7 @@ public class GreaterEqCursor<V, ID exten
if ( userIdxCursor != null )
{
- int comparedValue = greaterEqEvaluator.getComparator().compare( element.getValue(),
+ int comparedValue = greaterEqEvaluator.getComparator().compare( element.getKey(),
greaterEqEvaluator.getExpression().getValue().getValue() );
/*
@@ -273,7 +273,7 @@ public class GreaterEqCursor<V, ID exten
if ( userIdxCursor != null )
{
IndexEntry<V, ID> advanceTo = new ForwardIndexEntry<V, ID>();
- advanceTo.setValue( ( V ) greaterEqEvaluator.getExpression().getValue().getValue() );
+ advanceTo.setKey( ( V ) greaterEqEvaluator.getExpression().getValue().getValue() );
userIdxCursor.before( advanceTo );
}
else
@@ -347,7 +347,7 @@ public class GreaterEqCursor<V, ID exten
checkNotClosed( "previous()" );
IndexEntry<?, ID> candidate = userIdxCursor.get();
- if ( greaterEqEvaluator.getComparator().compare( candidate.getValue(),
+ if ( greaterEqEvaluator.getComparator().compare( candidate.getKey(),
greaterEqEvaluator.getExpression().getValue().getValue() ) >= 0 )
{
return setAvailable( true );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java Mon Apr 30 15:59:22 2012
@@ -218,7 +218,7 @@ public class GreaterEqEvaluator<T, ID ex
{
if ( indexEntry != null )
{
- indexEntry.setValue( value.getNormValue() );
+ indexEntry.setKey( value.getNormValue() );
}
return true;
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java Mon Apr 30 15:59:22 2012
@@ -170,7 +170,7 @@ public class LessEqCursor<V, ID extends
* If the element's value is smaller, then we delegate to the
* before() method of the userIdxCursor.
*/
- int compareValue = lessEqEvaluator.getComparator().compare( element.getValue(),
+ int compareValue = lessEqEvaluator.getComparator().compare( element.getKey(),
lessEqEvaluator.getExpression().getValue().getValue() );
if ( compareValue > 0 )
@@ -246,7 +246,7 @@ public class LessEqCursor<V, ID extends
if ( userIdxCursor != null )
{
- int comparedValue = lessEqEvaluator.getComparator().compare( element.getValue(),
+ int comparedValue = lessEqEvaluator.getComparator().compare( element.getKey(),
lessEqEvaluator.getExpression().getValue().getValue() );
/*
@@ -301,7 +301,7 @@ public class LessEqCursor<V, ID extends
{
IndexEntry<V, ID> advanceTo = new ForwardIndexEntry<V, ID>();
//noinspection unchecked
- advanceTo.setValue( ( V ) lessEqEvaluator.getExpression().getValue().getValue() );
+ advanceTo.setKey( ( V ) lessEqEvaluator.getExpression().getValue().getValue() );
userIdxCursor.after( advanceTo );
}
else
@@ -377,7 +377,7 @@ public class LessEqCursor<V, ID extends
checkNotClosed( "next()" );
IndexEntry<?, ID> candidate = userIdxCursor.get();
- if ( lessEqEvaluator.getComparator().compare( candidate.getValue(),
+ if ( lessEqEvaluator.getComparator().compare( candidate.getKey(),
lessEqEvaluator.getExpression().getValue().getValue() ) <= 0 )
{
return setAvailable( true );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java Mon Apr 30 15:59:22 2012
@@ -215,7 +215,7 @@ public class LessEqEvaluator<T, ID exten
{
if ( indexEntry != null )
{
- indexEntry.setValue( value.getNormValue() );
+ indexEntry.setKey( value.getNormValue() );
}
return true;
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java Mon Apr 30 15:59:22 2012
@@ -86,7 +86,7 @@ public class OneLevelScopeCursor<ID exte
IndexCursor<ParentIdAndRdn<ID>,Entry, ID> cursor = db.getRdnIndex().forwardCursor();
IndexEntry<ParentIdAndRdn<ID>, ID> startingPos = new ForwardIndexEntry<ParentIdAndRdn<ID>, ID>();
- startingPos.setValue( new ParentIdAndRdn( evaluator.getBaseId(), (Rdn[]) null ) );
+ startingPos.setKey( new ParentIdAndRdn( evaluator.getBaseId(), (Rdn[]) null ) );
cursor.before( startingPos );
scopeCursor = new ChildrenCursor( db, evaluator.getBaseId(), cursor );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java Mon Apr 30 15:59:22 2012
@@ -56,7 +56,7 @@ public class OneLevelScopeEvaluator<E, I
* @param db the database used to evaluate scope node
* @throws Exception on db access failure
*/
- public OneLevelScopeEvaluator( Store<E, ID> db, ScopeNode node ) throws Exception
+ public OneLevelScopeEvaluator( Store<E, ID> db, ScopeNode<ID> node ) throws Exception
{
this.node = node;
@@ -66,7 +66,7 @@ public class OneLevelScopeEvaluator<E, I
}
this.db = db;
- baseId = db.getEntryId( node.getBaseDn() );
+ baseId = node.getBaseId();
dereferencing = node.getDerefAliases().isDerefInSearching() || node.getDerefAliases().isDerefAlways();
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java Mon Apr 30 15:59:22 2012
@@ -46,6 +46,9 @@ public class PresenceCursor<ID extends C
private final IndexCursor<String, Entry, ID> uuidCursor;
private final IndexCursor<String, Entry, ID> presenceCursor;
private final PresenceEvaluator<ID> presenceEvaluator;
+
+ /** The prefetched entry, if it's a valid one */
+ private IndexEntry<String, ID> prefetched;
public PresenceCursor( Store<Entry, ID> store, PresenceEvaluator<ID> presenceEvaluator ) throws Exception
@@ -248,6 +251,7 @@ public class PresenceCursor<ID extends C
public boolean next() throws Exception
{
checkNotClosed( "next()" );
+
if ( presenceCursor != null )
{
return presenceCursor.next();
@@ -256,10 +260,12 @@ public class PresenceCursor<ID extends C
while ( uuidCursor.next() )
{
checkNotClosed( "next()" );
- IndexEntry<?, ID> candidate = uuidCursor.get();
+ IndexEntry<String, ID> candidate = uuidCursor.get();
if ( presenceEvaluator.evaluate( candidate ) )
{
+ prefetched = candidate;
+
return setAvailable( true );
}
}
@@ -284,15 +290,19 @@ public class PresenceCursor<ID extends C
if ( available() )
{
+ if ( prefetched == null )
+ {
+ prefetched = uuidCursor.get();
+ }
+
/*
* The value of NDN indices is the normalized dn and we want the
* value to be the value of the attribute in question. So we will
* set that accordingly here.
*/
- IndexEntry<String, ID> indexEntry = uuidCursor.get();
- indexEntry.setValue( presenceEvaluator.getAttributeType().getOid() );
+ prefetched.setKey( presenceEvaluator.getAttributeType().getOid() );
- return indexEntry;
+ return prefetched;
}
throw new InvalidCursorPositionException( I18n.err( I18n.ERR_708 ) );
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java Mon Apr 30 15:59:22 2012
@@ -88,7 +88,7 @@ public class PresenceEvaluator<ID extend
}
- // TODO - determine if comaparator and index entry should have the Value
+ // TODO - determine if comparator and index entry should have the Value
// wrapper or the raw normalized value
public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
{
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java Mon Apr 30 15:59:22 2012
@@ -96,7 +96,7 @@ public class SubstringCursor<ID extends
if ( evaluator.getExpression().getInitial() != null && hasIndex )
{
ForwardIndexEntry<String, ID> indexEntry = new ForwardIndexEntry<String, ID>();
- indexEntry.setValue( evaluator.getExpression().getInitial() );
+ indexEntry.setKey( evaluator.getExpression().getInitial() );
wrapped.before( indexEntry );
}
else
@@ -113,7 +113,7 @@ public class SubstringCursor<ID extends
setAvailable( false );
indexEntry.setEntry( null );
indexEntry.setId( null );
- indexEntry.setValue( null );
+ indexEntry.setKey( null );
}
@@ -140,7 +140,7 @@ public class SubstringCursor<ID extends
{
if ( hasIndex )
{
- return evaluator.getPattern().matcher( indexEntry.getValue() ).matches();
+ return evaluator.getPattern().matcher( indexEntry.getKey() ).matches();
}
else
{
@@ -167,7 +167,7 @@ public class SubstringCursor<ID extends
{
setAvailable( true );
this.indexEntry.setId( entry.getId() );
- this.indexEntry.setValue( entry.getValue() );
+ this.indexEntry.setKey( entry.getKey() );
this.indexEntry.setEntry( entry.getEntry() );
return true;
}
@@ -189,7 +189,7 @@ public class SubstringCursor<ID extends
{
setAvailable( true );
this.indexEntry.setId( entry.getId() );
- this.indexEntry.setValue( entry.getValue() );
+ this.indexEntry.setKey( entry.getKey() );
this.indexEntry.setEntry( entry.getEntry() );
return true;
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Mon Apr 30 15:59:22 2012
@@ -195,7 +195,7 @@ public class SubstringEvaluator<ID exten
IndexEntry<String, ID> rec = entries.get();
// once match is found cleanup and return true
- if ( regex.matcher( rec.getValue() ).matches() )
+ if ( regex.matcher( rec.getKey() ).matches() )
{
entries.close();
return true;
@@ -231,7 +231,7 @@ public class SubstringEvaluator<ID exten
IndexEntry<String, ID> rec = entries.get();
// once match is found cleanup and return true
- if ( regex.matcher( rec.getValue() ).matches() )
+ if ( regex.matcher( rec.getKey() ).matches() )
{
entries.close();
return true;
@@ -368,7 +368,7 @@ public class SubstringEvaluator<ID exten
if ( regex.matcher( strValue ).matches() )
{
// before returning we set the normalized value
- indexEntry.setValue( strValue );
+ indexEntry.setKey( strValue );
return true;
}
}
@@ -387,7 +387,7 @@ public class SubstringEvaluator<ID exten
if ( check( byteValue ) )
{
// before returning we set the normalized value
- indexEntry.setValue( byteValue );
+ indexEntry.setKey( byteValue );
return true;
}
*/
@@ -430,7 +430,7 @@ public class SubstringEvaluator<ID exten
if ( regex.matcher( strValue ).matches() )
{
// before returning we set the normalized value
- indexEntry.setValue( strValue );
+ indexEntry.setKey( strValue );
return true;
}
}
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java Mon Apr 30 15:59:22 2012
@@ -20,14 +20,21 @@
package org.apache.directory.server.xdbm.search.impl;
+import java.util.List;
+
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.AbstractIndexCursor;
+import org.apache.directory.server.xdbm.ForwardIndexEntry;
import org.apache.directory.server.xdbm.IndexCursor;
import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.xdbm.ParentIdAndRdn;
+import org.apache.directory.server.xdbm.SingletonIndexCursor;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.model.cursor.SingletonCursor;
import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.name.Rdn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,7 +90,19 @@ public class SubtreeScopeCursor<ID exten
}
else
{
- scopeCursor = db.getSubLevelIndex().forwardCursor( evaluator.getBaseId() );
+ // We use the RdnIndex to get all the entries from a starting point
+ // and below up to the number of children
+ ID baseId = evaluator.getBaseId();
+ ParentIdAndRdn<ID> parentIdAndRdn = db.getRdnIndex().reverseLookup( baseId );
+ IndexEntry indexEntry = new ForwardIndexEntry();
+
+ indexEntry.setId( baseId );
+ indexEntry.setKey( parentIdAndRdn );
+
+ IndexCursor<ParentIdAndRdn<ID>,Entry, ID> cursor = new SingletonIndexCursor<ParentIdAndRdn<ID>, ID>( indexEntry );
+ ID parentId = parentIdAndRdn.getParentId();
+
+ scopeCursor = new DescendantCursor( db, baseId, parentId, cursor );
}
if ( evaluator.isDereferencing() )
@@ -246,6 +265,7 @@ public class SubtreeScopeCursor<ID exten
public boolean next() throws Exception
{
checkNotClosed( "next()" );
+
// if the cursor hasn't been set position it before the first element
if ( cursor == null )
{
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java Mon Apr 30 15:59:22 2012
@@ -23,6 +23,7 @@ package org.apache.directory.server.xdbm
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.IndexEntry;
+import org.apache.directory.server.xdbm.ParentIdAndRdn;
import org.apache.directory.server.xdbm.Store;
import org.apache.directory.server.xdbm.search.Evaluator;
import org.apache.directory.shared.ldap.model.filter.ScopeNode;
@@ -69,7 +70,7 @@ public class SubtreeScopeEvaluator<E, ID
* @param db the database used to evaluate scope node
* @throws Exception on db access failure
*/
- public SubtreeScopeEvaluator( Store<E, ID> db, ScopeNode node ) throws Exception
+ public SubtreeScopeEvaluator( Store<E, ID> db, ScopeNode<ID> node ) throws Exception
{
this.db = db;
this.node = node;
@@ -79,7 +80,7 @@ public class SubtreeScopeEvaluator<E, ID
throw new IllegalStateException( I18n.err( I18n.ERR_727 ) );
}
- baseId = db.getEntryId( node.getBaseDn() );
+ baseId = node.getBaseId();
baseIsContextEntry = getContextEntryId() == baseId;
dereferencing = node.getDerefAliases().isDerefInSearching() || node.getDerefAliases().isDerefAlways();
}
@@ -112,6 +113,39 @@ public class SubtreeScopeEvaluator<E, ID
return contextEntryId;
}
+
+ /**
+ * Tells if a candidate is a descendant of the base ID. We have to fetch all
+ * the parentIdAndRdn up to the baseId. If we terminate on the context entry without
+ * having found the baseId, then the candidate is not a descendant.
+ */
+ private boolean isDescendant( ID candidateId ) throws Exception
+ {
+ ID tmp = candidateId;
+
+ while ( true )
+ {
+ ParentIdAndRdn<ID> parentIdAndRdn = db.getRdnIndex().reverseLookup( tmp );
+
+ if ( parentIdAndRdn == null )
+ {
+ return false;
+ }
+
+ tmp = parentIdAndRdn.getParentId();
+
+ if ( tmp.equals( db.getRootId() ) )
+ {
+ return false;
+ }
+
+ if ( tmp.equals( baseId ) )
+ {
+ return true;
+ }
+ }
+ }
+
/**
* Asserts whether or not a candidate has sub level scope while taking
@@ -134,7 +168,7 @@ public class SubtreeScopeEvaluator<E, ID
* to all it's subordinates since that would be the entire set of
* entries in the db.
*/
- boolean isDescendant = baseIsContextEntry || baseId.equals( id ) || db.getSubLevelIndex().forward( baseId, id );
+ boolean isDescendant = baseIsContextEntry || baseId.equals( id ) || isDescendant( id );
/*
* The candidate id could be any entry in the db. If search
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ForwardIndexEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ForwardIndexEntryTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ForwardIndexEntryTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ForwardIndexEntryTest.java Mon Apr 30 15:59:22 2012
@@ -62,10 +62,10 @@ public class ForwardIndexEntryTest
@Test
public void testSetGetValue()
{
- assertNull( indexEntry.getValue() );
+ assertNull( indexEntry.getKey() );
- indexEntry.setValue( "test" );
- assertEquals( "test", indexEntry.getValue() );
+ indexEntry.setKey( "test" );
+ assertEquals( "test", indexEntry.getKey() );
}
@@ -84,7 +84,7 @@ public class ForwardIndexEntryTest
{
assertNotNull( indexEntry.getTuple() );
assertNull( indexEntry.getTuple().getKey() );
- assertNull( indexEntry.getTuple().getValue() );
+ assertNull( indexEntry.getTuple().getKey() );
indexEntry.setTuple( new Tuple<String, Long>( "a", 1L ), new DefaultEntry() );
assertEquals( new Tuple<String, Long>( "a", 1L ), indexEntry.getTuple() );
@@ -99,11 +99,11 @@ public class ForwardIndexEntryTest
indexEntry.clear();
assertNull( indexEntry.getId() );
- assertNull( indexEntry.getValue() );
+ assertNull( indexEntry.getKey() );
assertNull( indexEntry.getEntry() );
assertNotNull( indexEntry.getTuple() );
assertNull( indexEntry.getTuple().getKey() );
- assertNull( indexEntry.getTuple().getValue() );
+ assertNull( indexEntry.getTuple().getKey() );
}
@@ -116,16 +116,16 @@ public class ForwardIndexEntryTest
// create empty index entry and assert empty values
ForwardIndexEntry<String, Long> indexEntry2 = new ForwardIndexEntry<String, Long>();
assertNull( indexEntry2.getId() );
- assertNull( indexEntry2.getValue() );
+ assertNull( indexEntry2.getKey() );
assertNull( indexEntry2.getEntry() );
assertNotNull( indexEntry2.getTuple() );
assertNull( indexEntry2.getTuple().getKey() );
- assertNull( indexEntry2.getTuple().getValue() );
+ assertNull( indexEntry2.getTuple().getKey() );
// copy values and assert non-empty values
indexEntry2.copy( indexEntry );
assertEquals( Long.valueOf( 1L ), indexEntry2.getId() );
- assertEquals( "a", indexEntry2.getValue() );
+ assertEquals( "a", indexEntry2.getKey() );
assertEquals( new DefaultEntry(), indexEntry2.getEntry() );
assertEquals( new Tuple<String, Long>( "a", 1L ), indexEntry2.getTuple() );
}
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java Mon Apr 30 15:59:22 2012
@@ -148,7 +148,6 @@ public class PartitionTest
public void testExampleDataIndices() throws Exception
{
assertEquals( 11, partition.getRdnIndex().count() );
- assertEquals( 19, partition.getSubLevelIndex().count() );
assertEquals( 3, partition.getAliasIndex().count() );
assertEquals( 3, partition.getOneAliasIndex().count() );
assertEquals( 3, partition.getSubAliasIndex().count() );
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ReverseIndexEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ReverseIndexEntryTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ReverseIndexEntryTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/ReverseIndexEntryTest.java Mon Apr 30 15:59:22 2012
@@ -62,10 +62,10 @@ public class ReverseIndexEntryTest
@Test
public void testSetGetValue()
{
- assertNull( indexEntry.getValue() );
+ assertNull( indexEntry.getKey() );
- indexEntry.setValue( "test" );
- assertEquals( "test", indexEntry.getValue() );
+ indexEntry.setKey( "test" );
+ assertEquals( "test", indexEntry.getKey() );
}
@@ -99,7 +99,7 @@ public class ReverseIndexEntryTest
indexEntry.clear();
assertNull( indexEntry.getId() );
- assertNull( indexEntry.getValue() );
+ assertNull( indexEntry.getKey() );
assertNull( indexEntry.getEntry() );
assertNotNull( indexEntry.getTuple() );
assertNull( indexEntry.getTuple().getKey() );
@@ -116,7 +116,7 @@ public class ReverseIndexEntryTest
// create empty index entry and assert empty values
ReverseIndexEntry<String, Long> indexEntry2 = new ReverseIndexEntry<String, Long>();
assertNull( indexEntry2.getId() );
- assertNull( indexEntry2.getValue() );
+ assertNull( indexEntry2.getKey() );
assertNull( indexEntry2.getEntry() );
assertNotNull( indexEntry2.getTuple() );
assertNull( indexEntry2.getTuple().getKey() );
@@ -125,7 +125,7 @@ public class ReverseIndexEntryTest
// copy values and assert non-empty values
indexEntry2.copy( indexEntry );
assertEquals( Long.valueOf( 1L ), indexEntry2.getId() );
- assertEquals( "a", indexEntry2.getValue() );
+ assertEquals( "a", indexEntry2.getKey() );
assertEquals( new DefaultEntry(), indexEntry2.getEntry() );
assertEquals( new Tuple<Long, String>( 1L, "a" ), indexEntry2.getTuple() );
}
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/SingletonIndexCursorTest.java Mon Apr 30 15:59:22 2012
@@ -50,7 +50,7 @@ public class SingletonIndexCursorTest
indexEntry = new ForwardIndexEntry<String, Long>();
indexEntry.setId( 1L );
indexEntry.setEntry( new DefaultEntry() );
- indexEntry.setValue( "test" );
+ indexEntry.setKey( "test" );
indexCursor = new SingletonIndexCursor<String, Long>( indexEntry );
}
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java Mon Apr 30 15:59:22 2012
@@ -172,10 +172,6 @@ public class AvlPartitionTest
avlPartition.addIndex( new AvlIndex<String, Entry>( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID ) );
assertNotNull( avlPartition.getPresenceIndex() );
- assertNull( avlPartition.getSubLevelIndex() );
- avlPartition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) );
- assertNotNull( avlPartition.getSubLevelIndex() );
-
assertNull( avlPartition.getId() );
avlPartition.setId( "foo" );
assertEquals( "foo", avlPartition.getId() );
@@ -242,17 +238,6 @@ public class AvlPartitionTest
{
}
- assertNotNull( partition.getSubLevelIndex() );
-
- try
- {
- partition.addIndex( new AvlIndex<Long, Entry>( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID ) );
- //fail();
- }
- catch ( IllegalStateException e )
- {
- }
-
assertNotNull( partition.getId() );
try
@@ -302,7 +287,7 @@ public class AvlPartitionTest
Iterator<String> systemIndices = partition.getSystemIndices();
- for ( int i = 0; i < 9; i++ )
+ for ( int i = 0; i < 8; i++ )
{
assertTrue( systemIndices.hasNext() );
assertNotNull( systemIndices.next() );
@@ -435,134 +420,6 @@ public class AvlPartitionTest
}
- @Test
- public void testSubLevelIndex() throws Exception
- {
- Index idx = partition.getSubLevelIndex();
-
- assertEquals( 19, idx.count() );
-
- Cursor<IndexEntry<Long, Long>> cursor = idx.forwardCursor( 2L );
-
- assertTrue( cursor.next() );
- assertEquals( 2, ( long ) cursor.get().getId() );
-
- assertTrue( cursor.next() );
- assertEquals( 5, ( long ) cursor.get().getId() );
-
- assertTrue( cursor.next() );
- assertEquals( 6, ( long ) cursor.get().getId() );
-
- assertFalse( cursor.next() );
-
- idx.drop( 5L );
-
- cursor.close();
-
- cursor = idx.forwardCursor( 2L );
-
- assertTrue( cursor.next() );
- assertEquals( 2, ( long ) cursor.get().getId() );
-
- assertTrue( cursor.next() );
- assertEquals( 6, ( long ) cursor.get().getId() );
-
- assertFalse( cursor.next() );
-
- cursor.close();
-
- // dn id 12
- Dn martinDn = new Dn( schemaManager, "cn=Marting King,ou=Sales,o=Good Times Co." );
- DefaultEntry entry = new DefaultEntry( schemaManager, martinDn,
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "ou: Sales",
- "cn: Martin King",
- "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
- "entryUUID", UUID.randomUUID().toString() );
-
- AddOperationContext addContext = new AddOperationContext( null, entry );
- partition.add( addContext );
-
- cursor = idx.forwardCursor( 2L );
- cursor.afterLast();
- assertTrue( cursor.previous() );
- assertEquals( 12, ( long ) cursor.get().getId() );
-
- cursor.close();
-
- Dn newParentDn = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co." );
-
- Dn newDn = newParentDn.add( martinDn.getRdn() );
- partition.move( martinDn, newParentDn, newDn, new ClonedServerEntry( entry ) );
-
- cursor = idx.forwardCursor( 3L );
- cursor.afterLast();
- assertTrue( cursor.previous() );
- assertEquals( 12, ( long ) cursor.get().getId() );
-
- cursor.close();
-
- // dn id 13
- Dn marketingDn = new Dn( schemaManager, "ou=Marketing,ou=Sales,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, marketingDn,
- "objectClass: top",
- "objectClass: organizationalUnit",
- "ou: Marketing",
- "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
- "entryUUID", UUID.randomUUID().toString() );
-
- addContext = new AddOperationContext( null, entry );
- partition.add( addContext );
-
- // dn id 14
- Dn jimmyDn = new Dn( schemaManager, "cn=Jimmy Wales,ou=Marketing, ou=Sales,o=Good Times Co." );
- entry = new DefaultEntry( schemaManager, jimmyDn,
- "objectClass: top",
- "objectClass: person",
- "objectClass: organizationalPerson",
- "ou: Marketing",
- "cn: Jimmy Wales",
- "entryCSN", new CsnFactory( 1 ).newInstance().toString(),
- "entryUUID", UUID.randomUUID().toString() );
-
- addContext = new AddOperationContext( null, entry );
- partition.add( addContext );
-
- newDn = newParentDn.add( marketingDn.getRdn() );
- partition.move( marketingDn, newParentDn, newDn, new ClonedServerEntry( entry ) );
-
- cursor = idx.forwardCursor( 3L );
- cursor.afterLast();
-
- assertTrue( cursor.previous() );
- assertEquals( 14, ( long ) cursor.get().getId() );
-
- assertTrue( cursor.previous() );
- assertEquals( 13, ( long ) cursor.get().getId() );
-
- assertTrue( cursor.previous() );
- assertEquals( 12, ( long ) cursor.get().getId() );
-
- assertTrue( cursor.previous() );
- assertEquals( 10, ( long ) cursor.get().getId() );
-
- assertTrue( cursor.previous() );
- assertEquals( 9, ( long ) cursor.get().getId() );
-
- assertTrue( cursor.previous() );
- assertEquals( 7, ( long ) cursor.get().getId() );
-
- assertTrue( cursor.previous() );
- assertEquals( 3, ( long ) cursor.get().getId() );
-
- assertFalse( cursor.previous() );
-
- cursor.close();
- }
-
-
@Test(expected = LdapNoSuchObjectException.class)
public void testAddWithoutParentId() throws Exception
{
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndexTest.java Mon Apr 30 15:59:22 2012
@@ -291,20 +291,20 @@ public class AvlRdnIndexTest
cursor.next();
IndexEntry<ParentIdAndRdn<Long>, Long> e1 = cursor.get();
assertEquals( 0, ( long ) e1.getId() );
- assertEquals( "cn=key", e1.getValue().getRdns()[0].getName() );
- assertEquals( 0, e1.getValue().getParentId().longValue() );
+ assertEquals( "cn=key", e1.getKey().getRdns()[0].getName() );
+ assertEquals( 0, e1.getKey().getParentId().longValue() );
cursor.next();
IndexEntry<ParentIdAndRdn<Long>, Long> e2 = cursor.get();
assertEquals( 1, ( long ) e2.getId() );
- assertEquals( "cn=key1", e2.getValue().getRdns()[0].getName() );
- assertEquals( 1, e2.getValue().getParentId().longValue() );
+ assertEquals( "cn=key1", e2.getKey().getRdns()[0].getName() );
+ assertEquals( 1, e2.getKey().getParentId().longValue() );
cursor.next();
IndexEntry<ParentIdAndRdn<Long>, Long> e3 = cursor.get();
assertEquals( 2, ( long ) e3.getId() );
- assertEquals( "cn=key2", e3.getValue().getRdns()[0].getName() );
- assertEquals( 2, e3.getValue().getParentId().longValue() );
+ assertEquals( "cn=key2", e3.getKey().getRdns()[0].getName() );
+ assertEquals( 2, e3.getKey().getParentId().longValue() );
cursor.close();
}
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java Mon Apr 30 15:59:22 2012
@@ -182,17 +182,17 @@ public class AndCursorTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
- assertEquals( "jack daniels", cursor.get().getValue() );
+ assertEquals( "jack daniels", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
- assertEquals( "jim bean", cursor.get().getValue() );
+ assertEquals( "jim bean", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
- assertEquals( "johnny walker", cursor.get().getValue() );
+ assertEquals( "johnny walker", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -233,19 +233,19 @@ public class AndCursorTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
- assertEquals( "jack daniels", cursor.get().getValue() );
+ assertEquals( "jack daniels", cursor.get().getKey() );
cursor.first();
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
- assertEquals( "jim bean", cursor.get().getValue() );
+ assertEquals( "jim bean", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
- assertEquals( "johnny walker", cursor.get().getValue() );
+ assertEquals( "johnny walker", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -255,19 +255,19 @@ public class AndCursorTest
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
- assertEquals( "johnny walker", cursor.get().getValue() );
+ assertEquals( "johnny walker", cursor.get().getKey() );
cursor.last();
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
- assertEquals( "jim bean", cursor.get().getValue() );
+ assertEquals( "jim bean", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
- assertEquals( "jack daniels", cursor.get().getValue() );
+ assertEquals( "jack daniels", cursor.get().getKey() );
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java Mon Apr 30 15:59:22 2012
@@ -194,22 +194,22 @@ public class GreaterEqTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 6L, ( long ) cursor.get().getId() );
- assertEquals( "4", cursor.get().getValue() );
+ assertEquals( "4", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 7L, ( long ) cursor.get().getId() );
- assertEquals( "5", cursor.get().getValue() );
+ assertEquals( "5", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8L, ( long ) cursor.get().getId() );
- assertEquals( "6", cursor.get().getValue() );
+ assertEquals( "6", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -224,22 +224,22 @@ public class GreaterEqTest
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 6L, ( long ) cursor.get().getId() );
- assertEquals( "4", cursor.get().getValue() );
+ assertEquals( "4", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 7L, ( long ) cursor.get().getId() );
- assertEquals( "5", cursor.get().getValue() );
+ assertEquals( "5", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8L, ( long ) cursor.get().getId() );
- assertEquals( "6", cursor.get().getValue() );
+ assertEquals( "6", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -256,22 +256,22 @@ public class GreaterEqTest
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 8L, ( long ) cursor.get().getId() );
- assertEquals( "6", cursor.get().getValue() );
+ assertEquals( "6", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 7L, ( long ) cursor.get().getId() );
- assertEquals( "5", cursor.get().getValue() );
+ assertEquals( "5", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 6L, ( long ) cursor.get().getId() );
- assertEquals( "4", cursor.get().getValue() );
+ assertEquals( "4", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
@@ -286,22 +286,22 @@ public class GreaterEqTest
assertTrue( cursor.available() );
assertEquals( 8L, ( long ) cursor.get().getId() );
- assertEquals( "6", cursor.get().getValue() );
+ assertEquals( "6", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 7L, ( long ) cursor.get().getId() );
- assertEquals( "5", cursor.get().getValue() );
+ assertEquals( "5", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 6L, ( long ) cursor.get().getId() );
- assertEquals( "4", cursor.get().getValue() );
+ assertEquals( "4", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
@@ -312,7 +312,7 @@ public class GreaterEqTest
cursor = new GreaterEqCursor( store, evaluator );
ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "5" );
+ indexEntry.setKey( "5" );
assertFalse( cursor.available() );
cursor.before( indexEntry );
@@ -321,12 +321,12 @@ public class GreaterEqTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 7L, ( long ) cursor.get().getId() );
- assertEquals( "5", cursor.get().getValue() );
+ assertEquals( "5", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8L, ( long ) cursor.get().getId() );
- assertEquals( "6", cursor.get().getValue() );
+ assertEquals( "6", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -335,29 +335,29 @@ public class GreaterEqTest
cursor = new GreaterEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "7" );
+ indexEntry.setKey( "7" );
cursor.before( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.previous() );
assertEquals( 8L, ( long ) cursor.get().getId() );
- assertEquals( "6", cursor.get().getValue() );
+ assertEquals( "6", cursor.get().getKey() );
cursor.close();
cursor = new GreaterEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "3" );
+ indexEntry.setKey( "3" );
cursor.before( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.next() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
cursor.close();
// ---------- test after() ----------
cursor = new GreaterEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "4" );
+ indexEntry.setKey( "4" );
assertFalse( cursor.available() );
cursor.after( indexEntry );
@@ -366,12 +366,12 @@ public class GreaterEqTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 7L, ( long ) cursor.get().getId() );
- assertEquals( "5", cursor.get().getValue() );
+ assertEquals( "5", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8L, ( long ) cursor.get().getId() );
- assertEquals( "6", cursor.get().getValue() );
+ assertEquals( "6", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -380,22 +380,22 @@ public class GreaterEqTest
cursor = new GreaterEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "7" );
+ indexEntry.setKey( "7" );
cursor.after( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.previous() );
assertEquals( 8L, ( long ) cursor.get().getId() );
- assertEquals( "6", cursor.get().getValue() );
+ assertEquals( "6", cursor.get().getKey() );
cursor.close();
cursor = new GreaterEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "3" );
+ indexEntry.setKey( "3" );
cursor.after( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.previous() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
cursor.close();
}
@@ -431,7 +431,7 @@ public class GreaterEqTest
while ( cursor.next() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
}
assertEquals( 4, set.size() );
assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
@@ -452,12 +452,12 @@ public class GreaterEqTest
cursor.first();
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
while ( cursor.next() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
}
assertEquals( 4, set.size() );
assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
@@ -481,7 +481,7 @@ public class GreaterEqTest
while ( cursor.previous() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
}
assertEquals( 4, set.size() );
assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
@@ -501,12 +501,12 @@ public class GreaterEqTest
cursor.last();
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
while ( cursor.previous() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
}
assertEquals( 4, set.size() );
assertTrue( set.contains( new Tuple<String, Long>( "3", 5L ) ) );
@@ -523,7 +523,7 @@ public class GreaterEqTest
cursor = new GreaterEqCursor( store, evaluator );
ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "2" );
+ indexEntry.setKey( "2" );
try
{
@@ -540,7 +540,7 @@ public class GreaterEqTest
cursor = new GreaterEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "2" );
+ indexEntry.setKey( "2" );
try
{
cursor.after( indexEntry );
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java Mon Apr 30 15:59:22 2012
@@ -196,27 +196,27 @@ public class LessEqTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 1L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 2L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 3L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 4L, ( long ) cursor.get().getId() );
- assertEquals( "2", cursor.get().getValue() );
+ assertEquals( "2", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -231,27 +231,27 @@ public class LessEqTest
assertTrue( cursor.available() );
assertEquals( 1L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 2L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 3L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 4L, ( long ) cursor.get().getId() );
- assertEquals( "2", cursor.get().getValue() );
+ assertEquals( "2", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -268,27 +268,27 @@ public class LessEqTest
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 4L, ( long ) cursor.get().getId() );
- assertEquals( "2", cursor.get().getValue() );
+ assertEquals( "2", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 3L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 2L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 1L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
@@ -303,27 +303,27 @@ public class LessEqTest
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 4L, ( long ) cursor.get().getId() );
- assertEquals( "2", cursor.get().getValue() );
+ assertEquals( "2", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 3L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 2L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 1L, ( long ) cursor.get().getId() );
- assertEquals( "1", cursor.get().getValue() );
+ assertEquals( "1", cursor.get().getKey() );
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
@@ -334,7 +334,7 @@ public class LessEqTest
cursor = new LessEqCursor( store, evaluator );
ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "2" );
+ indexEntry.setKey( "2" );
assertFalse( cursor.available() );
cursor.before( indexEntry );
@@ -343,12 +343,12 @@ public class LessEqTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 4L, ( long ) cursor.get().getId() );
- assertEquals( "2", cursor.get().getValue() );
+ assertEquals( "2", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -357,29 +357,29 @@ public class LessEqTest
cursor = new LessEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "7" );
+ indexEntry.setKey( "7" );
cursor.before( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.previous() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
cursor.close();
cursor = new LessEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "3" );
+ indexEntry.setKey( "3" );
cursor.before( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.next() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
cursor.close();
// ---------- test after() ----------
cursor = new LessEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "1" );
+ indexEntry.setKey( "1" );
assertFalse( cursor.available() );
cursor.after( indexEntry );
@@ -388,12 +388,12 @@ public class LessEqTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 4L, ( long ) cursor.get().getId() );
- assertEquals( "2", cursor.get().getValue() );
+ assertEquals( "2", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
assertFalse( cursor.next() );
assertFalse( cursor.available() );
@@ -402,22 +402,22 @@ public class LessEqTest
cursor = new LessEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "7" );
+ indexEntry.setKey( "7" );
cursor.after( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.previous() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
cursor.close();
cursor = new LessEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "3" );
+ indexEntry.setKey( "3" );
cursor.after( indexEntry );
assertFalse( cursor.available() );
assertTrue( cursor.previous() );
assertEquals( 5L, ( long ) cursor.get().getId() );
- assertEquals( "3", cursor.get().getValue() );
+ assertEquals( "3", cursor.get().getKey() );
cursor.close();
}
@@ -452,7 +452,7 @@ public class LessEqTest
while ( cursor.next() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
}
assertEquals( 5, set.size() );
@@ -474,12 +474,12 @@ public class LessEqTest
cursor.first();
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
while ( cursor.next() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
}
assertEquals( 5, set.size() );
@@ -504,7 +504,7 @@ public class LessEqTest
while ( cursor.previous() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
}
assertEquals( 5, set.size() );
@@ -526,12 +526,12 @@ public class LessEqTest
cursor.last();
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
while ( cursor.previous() )
{
assertTrue( cursor.available() );
- set.add( new Tuple<String, Long>( cursor.get().getValue(), cursor.get().getId() ) );
+ set.add( new Tuple<String, Long>( cursor.get().getKey(), cursor.get().getId() ) );
}
assertEquals( 5, set.size() );
@@ -550,7 +550,7 @@ public class LessEqTest
cursor = new LessEqCursor( store, evaluator );
ForwardIndexEntry<String, Long> indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "2" );
+ indexEntry.setKey( "2" );
try
{
@@ -567,7 +567,7 @@ public class LessEqTest
cursor = new LessEqCursor( store, evaluator );
indexEntry = new ForwardIndexEntry<String, Long>();
- indexEntry.setValue( "2" );
+ indexEntry.setKey( "2" );
try
{
cursor.after( indexEntry );
Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java?rev=1332268&r1=1332267&r2=1332268&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java Mon Apr 30 15:59:22 2012
@@ -180,17 +180,17 @@ public class NestedFilterTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
- assertEquals( "walker", cursor.get().getValue() );
+ assertEquals( "walker", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 7, ( long ) cursor.get().getId() );
- assertEquals( "apache", cursor.get().getValue() );
+ assertEquals( "apache", cursor.get().getKey() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 9, ( long ) cursor.get().getId() );
- assertEquals( "apache", cursor.get().getValue() );
+ assertEquals( "apache", cursor.get().getKey() );
assertFalse( cursor.next() );
cursor.close();
@@ -210,7 +210,7 @@ public class NestedFilterTest
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
- assertEquals( "walker", cursor.get().getValue() );
+ assertEquals( "walker", cursor.get().getKey() );
assertFalse( cursor.next() );
cursor.close();
@@ -235,7 +235,7 @@ public class NestedFilterTest
{
assertTrue( cursor.available() );
set.add( cursor.get().getId() );
- assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getValue() ) );
+ assertTrue( uuidSynChecker.isValidSyntax( cursor.get().getKey() ) );
}
assertEquals( 2, set.size() );