Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 54244 invoked from network); 10 May 2008 20:20:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 May 2008 20:20:05 -0000 Received: (qmail 94659 invoked by uid 500); 10 May 2008 20:20:07 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 94591 invoked by uid 500); 10 May 2008 20:20:07 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 94570 invoked by uid 99); 10 May 2008 20:20:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 May 2008 13:20:07 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 May 2008 20:19:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1D81B2388A39; Sat, 10 May 2008 13:19:43 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r655151 [2/3] - in /directory/sandbox/akarasulu/bigbang: apacheds/btree-base/src/main/java/org/apache/directory/server/xdbm/ apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ apacheds/jdbm-store/src/main/java/org/apa... Date: Sat, 10 May 2008 20:19:41 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080510201943.1D81B2388A39@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java Sat May 10 13:19:40 2008 @@ -21,18 +21,17 @@ import org.apache.directory.shared.ldap.filter.LessEqNode; -import org.apache.directory.shared.ldap.util.AttributeUtils; import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.shared.ldap.schema.MatchingRule; import org.apache.directory.shared.ldap.schema.Normalizer; +import org.apache.directory.shared.ldap.entry.Value; import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.Store; import org.apache.directory.server.xdbm.Index; import org.apache.directory.server.schema.registries.Registries; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerAttribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.Attribute; -import javax.naming.NamingEnumeration; import java.util.Iterator; import java.util.Comparator; @@ -44,18 +43,18 @@ * @author Apache Directory Project * @version $Rev$ */ -public class LessEqEvaluator implements Evaluator +public class LessEqEvaluator implements Evaluator { private final LessEqNode node; - private final Store db; + private final Store db; private final Registries registries; private final AttributeType type; private final Normalizer normalizer; private final Comparator comparator; - private final Index idx; + private final Index idx; - public LessEqEvaluator( LessEqNode node, Store db, Registries registries ) + public LessEqEvaluator( LessEqNode node, Store db, Registries registries ) throws Exception { this.db = db; @@ -121,14 +120,14 @@ } - public boolean evaluate( IndexEntry indexEntry ) throws Exception + public boolean evaluate( IndexEntry indexEntry ) throws Exception { if ( idx != null ) { return idx.reverseLessOrEq( indexEntry.getId(), node.getValue() ); } - Attributes entry = indexEntry.getObject(); + ServerEntry entry = indexEntry.getObject(); // resuscitate the entry if it has not been and set entry in IndexEntry if ( null == entry ) @@ -138,10 +137,10 @@ } // get the attribute - Attribute attr = AttributeUtils.getAttribute( entry, type ); + ServerAttribute attr = ( ServerAttribute ) entry.get( type ); // if the attribute does not exist just return false - if ( attr != null && evaluate( ( IndexEntry ) indexEntry, attr ) ) + if ( attr != null && evaluate( ( IndexEntry ) indexEntry, attr ) ) { return true; } @@ -161,9 +160,9 @@ { AttributeType descendant = descendants.next(); - attr = AttributeUtils.getAttribute( entry, descendant ); + attr = ( ServerAttribute ) entry.get( descendant ); - if ( attr != null && evaluate( ( IndexEntry ) indexEntry, attr ) ) + if ( attr != null && evaluate( ( IndexEntry ) indexEntry, attr ) ) { return true; } @@ -175,7 +174,9 @@ } - private boolean evaluate( IndexEntry indexEntry, Attribute attribute ) throws Exception + // TODO - determine if comaparator and index entry should have the Value + // wrapper or the raw normalized value + private boolean evaluate( IndexEntry indexEntry, ServerAttribute attribute ) throws Exception { /* * Cycle through the attribute values testing normalized version @@ -183,18 +184,13 @@ * normalizer. The test uses the comparator obtained from the * appropriate matching rule to perform the check. */ - NamingEnumeration values = attribute.getAll(); - - while ( values.hasMore() ) + for ( Value value : attribute ) { - Object value = normalizer.normalize( values.next() ); + value.normalize( normalizer ); - // Once match is found cleanup and return true - //noinspection unchecked - if ( comparator.compare( value, node.getValue() ) <= 0 ) + if ( comparator.compare( value.getNormalizedValue(), node.getValue().getNormalizedValue() ) <= 0 ) { - indexEntry.setValue( value ); - values.close(); + indexEntry.setValue( value.getNormalizedValue() ); return true; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java Sat May 10 13:19:40 2008 @@ -25,10 +25,9 @@ import org.apache.directory.server.core.cursor.AbstractCursor; import org.apache.directory.server.core.cursor.Cursor; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.shared.ldap.filter.ExprNode; -import javax.naming.directory.Attributes; - /** * A Cursor returning candidates satisfying a logical negation expression. @@ -36,17 +35,17 @@ * @author Apache Directory Project * @version $$Rev$$ */ -public class NotCursor extends AbstractCursor> +public class NotCursor extends AbstractCursor> { private static final String UNSUPPORTED_MSG = "NotCursors are not ordered and do not support positioning by element."; - private final Cursor> ndnCursor; - private final Evaluator childEvaluator; + private final Cursor> ndnCursor; + private final Evaluator childEvaluator; private boolean available = false; - public NotCursor( Store db, - Evaluator childEvaluator ) throws Exception + public NotCursor( Store db, + Evaluator childEvaluator ) throws Exception { this.childEvaluator = childEvaluator; this.ndnCursor = db.getNdnIndex().forwardCursor(); @@ -59,13 +58,13 @@ } - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } @@ -103,7 +102,7 @@ { while ( ndnCursor.previous() ) { - IndexEntry candidate = ndnCursor.get(); + IndexEntry candidate = ndnCursor.get(); if ( ! childEvaluator.evaluate( candidate ) ) { return available = true; @@ -118,7 +117,7 @@ { while ( ndnCursor.next() ) { - IndexEntry candidate = ndnCursor.get(); + IndexEntry candidate = ndnCursor.get(); if ( ! childEvaluator.evaluate( candidate ) ) { return available = true; @@ -129,7 +128,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { if ( available ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java Sat May 10 13:19:40 2008 @@ -23,8 +23,7 @@ import org.apache.directory.shared.ldap.filter.NotNode; import org.apache.directory.shared.ldap.filter.ExprNode; import org.apache.directory.server.xdbm.IndexEntry; - -import javax.naming.directory.Attributes; +import org.apache.directory.server.core.entry.ServerEntry; /** @@ -33,20 +32,20 @@ * @author Apache Directory Project * @version $$Rev$$ */ -public class NotEvaluator implements Evaluator +public class NotEvaluator implements Evaluator { private final NotNode node; - private final Evaluator childEvaluator; + private final Evaluator childEvaluator; - public NotEvaluator( NotNode node, Evaluator childEvaluator ) + public NotEvaluator( NotNode node, Evaluator childEvaluator ) { this.node = node; this.childEvaluator = childEvaluator; } - public boolean evaluate( IndexEntry indexEntry ) throws Exception + public boolean evaluate( IndexEntry indexEntry ) throws Exception { return ! childEvaluator.evaluate( indexEntry ); } Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java Sat May 10 13:19:40 2008 @@ -23,11 +23,10 @@ import org.apache.directory.server.core.cursor.AbstractCursor; import org.apache.directory.server.core.cursor.Cursor; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.Store; -import javax.naming.directory.Attributes; - /** * A Cursor over entries satisfying one level scope constraints with alias @@ -36,26 +35,26 @@ * @author Apache Directory Project * @version $Rev$ */ -public class OneLevelScopeCursor extends AbstractCursor> +public class OneLevelScopeCursor extends AbstractCursor> { /** Error message for unsupported operations */ private static final String UNSUPPORTED_MSG = "Scope Cursors are not ordered and do not support positioning by element."; /** The entry database/store */ - private final Store db; + private final Store db; /** A onelevel ScopeNode Evaluator */ private final OneLevelScopeEvaluator evaluator; /** A Cursor over the entries in the scope of the search base */ - private final Cursor> scopeCursor; + private final Cursor> scopeCursor; /** A Cursor over entries brought into scope by alias dereferencing */ - private final Cursor> dereferencedCursor; + private final Cursor> dereferencedCursor; /** Currently active Cursor: we switch between two cursors */ - private Cursor> cursor; + private Cursor> cursor; /** Whether or not this Cursor is positioned so an entry is available */ private boolean available = false; @@ -68,7 +67,7 @@ * @param evaluator an IndexEntry (candidate) evaluator * @throws Exception on db access failures */ - public OneLevelScopeCursor( Store db, OneLevelScopeEvaluator evaluator ) throws Exception + public OneLevelScopeCursor( Store db, OneLevelScopeEvaluator evaluator ) throws Exception { this.db = db; this.evaluator = evaluator; @@ -91,13 +90,13 @@ } - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } @@ -268,7 +267,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { if ( available ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java Sat May 10 13:19:40 2008 @@ -23,7 +23,9 @@ import org.apache.directory.server.core.cursor.Cursor; import org.apache.directory.server.core.cursor.AbstractCursor; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.xdbm.IndexEntry; +import org.apache.directory.shared.ldap.filter.ExprNode; import java.util.*; @@ -34,19 +36,19 @@ * @author Apache Directory Project * @version $$Rev$$ */ -public class OrCursor extends AbstractCursor> +public class OrCursor extends AbstractCursor> { private static final String UNSUPPORTED_MSG = "OrCursors are not ordered and do not support positioning by element."; - private final List>> cursors; - private final List evaluators; + private final List>> cursors; + private final List> evaluators; private final List> blacklists; private int cursorIndex = -1; private boolean available = false; // TODO - do same evaluator fail fast optimization that we do in AndCursor - public OrCursor( List>> cursors, List evaluators ) + public OrCursor( List>> cursors, List> evaluators ) { if ( cursors.size() <= 1 ) { @@ -72,13 +74,13 @@ } - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } @@ -127,7 +129,7 @@ * @param indexEntry the index entry to blacklist * @throws Exception if there are problems accessing underlying db */ - private void blackListIfDuplicate( IndexEntry indexEntry ) throws Exception + private void blackListIfDuplicate( IndexEntry indexEntry ) throws Exception { for ( int ii = 0; ii < evaluators.size(); ii++ ) { @@ -149,7 +151,7 @@ { while ( cursors.get( cursorIndex ).previous() ) { - IndexEntry candidate = cursors.get( cursorIndex ).get(); + IndexEntry candidate = cursors.get( cursorIndex ).get(); if ( ! isBlackListed( candidate.getId() ) ) { blackListIfDuplicate( candidate ); @@ -164,7 +166,7 @@ while ( cursors.get( cursorIndex ).previous() ) { - IndexEntry candidate = cursors.get( cursorIndex ).get(); + IndexEntry candidate = cursors.get( cursorIndex ).get(); if ( ! isBlackListed( candidate.getId() ) ) { blackListIfDuplicate( candidate ); @@ -181,7 +183,7 @@ { while ( cursors.get( cursorIndex ).next() ) { - IndexEntry candidate = cursors.get( cursorIndex ).get(); + IndexEntry candidate = cursors.get( cursorIndex ).get(); if ( ! isBlackListed( candidate.getId() ) ) { blackListIfDuplicate( candidate ); @@ -196,7 +198,7 @@ while ( cursors.get( cursorIndex ).next() ) { - IndexEntry candidate = cursors.get( cursorIndex ).get(); + IndexEntry candidate = cursors.get( cursorIndex ).get(); if ( ! isBlackListed( candidate.getId() ) ) { blackListIfDuplicate( candidate ); @@ -209,7 +211,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { if ( available ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java Sat May 10 13:19:40 2008 @@ -23,8 +23,8 @@ import org.apache.directory.shared.ldap.filter.OrNode; import org.apache.directory.shared.ldap.filter.ExprNode; import org.apache.directory.server.xdbm.IndexEntry; +import org.apache.directory.server.core.entry.ServerEntry; -import javax.naming.directory.Attributes; import java.util.List; import java.util.ArrayList; import java.util.Collections; @@ -37,14 +37,14 @@ * @author Apache Directory Project * @version $$Rev$$ */ -public class OrEvaluator implements Evaluator +public class OrEvaluator implements Evaluator { - private final List> evaluators; + private final List> evaluators; private final OrNode node; - public OrEvaluator( OrNode node, List> evaluators ) + public OrEvaluator( OrNode node, List> evaluators ) { this.node = node; this.evaluators = optimize( evaluators ); @@ -62,15 +62,15 @@ * @param unoptimized the unoptimized list of Evaluators * @return optimized Evaluator list with decreasing scan count ordering */ - private List> - optimize( List> unoptimized ) + private List> + optimize( List> unoptimized ) { - List> optimized = - new ArrayList>( unoptimized.size() ); + List> optimized = + new ArrayList>( unoptimized.size() ); optimized.addAll( unoptimized ); - Collections.sort( optimized, new Comparator>() + Collections.sort( optimized, new Comparator>() { - public int compare( Evaluator e1, Evaluator e2 ) + public int compare( Evaluator e1, Evaluator e2 ) { int scanCount1 = ( Integer ) e1.getExpression().get( "count" ); int scanCount2 = ( Integer ) e2.getExpression().get( "count" ); @@ -99,9 +99,9 @@ } - public boolean evaluate( IndexEntry indexEntry ) throws Exception + public boolean evaluate( IndexEntry indexEntry ) throws Exception { - for ( Evaluator evaluator : evaluators ) + for ( Evaluator evaluator : evaluators ) { if ( evaluator.evaluate( indexEntry ) ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java Sat May 10 13:19:40 2008 @@ -25,10 +25,9 @@ import org.apache.directory.server.core.cursor.AbstractCursor; import org.apache.directory.server.core.cursor.Cursor; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.shared.ldap.schema.AttributeType; -import javax.naming.directory.Attributes; - /** * A returning candidates satisfying an attribute presence expression. @@ -36,17 +35,17 @@ * @author Apache Directory Project * @version $$Rev$$ */ -public class PresenceCursor extends AbstractCursor> +public class PresenceCursor extends AbstractCursor> { private static final String UNSUPPORTED_MSG = "PresenceCursors do not support positioning by element without a user index on the presence attribute."; - private final Cursor> ndnCursor; - private final Cursor> presenceCursor; + private final Cursor> ndnCursor; + private final Cursor> presenceCursor; private final PresenceEvaluator presenceEvaluator; private boolean available = false; - public PresenceCursor( Store db, PresenceEvaluator presenceEvaluator ) throws Exception + public PresenceCursor( Store db, PresenceEvaluator presenceEvaluator ) throws Exception { this.presenceEvaluator = presenceEvaluator; AttributeType type = presenceEvaluator.getAttributeType(); @@ -75,12 +74,12 @@ } - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { if ( presenceCursor != null ) { //noinspection unchecked - presenceCursor.before( ( IndexEntry ) element ); + presenceCursor.before( ( IndexEntry ) element ); return; } @@ -88,12 +87,12 @@ } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { if ( presenceCursor != null ) { //noinspection unchecked - presenceCursor.after( ( IndexEntry ) element ); + presenceCursor.after( ( IndexEntry ) element ); return; } @@ -160,7 +159,7 @@ while ( ndnCursor.previous() ) { - IndexEntry candidate = ndnCursor.get(); + IndexEntry candidate = ndnCursor.get(); if ( presenceEvaluator.evaluate( candidate ) ) { return available = true; @@ -180,7 +179,7 @@ while ( ndnCursor.next() ) { - IndexEntry candidate = ndnCursor.get(); + IndexEntry candidate = ndnCursor.get(); if ( presenceEvaluator.evaluate( candidate ) ) { return available = true; @@ -191,7 +190,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { if ( presenceCursor != null ) { @@ -210,7 +209,7 @@ * value to be the value of the attribute in question. So we will * set that accordingly here. */ - IndexEntry indexEntry = ndnCursor.get(); + IndexEntry indexEntry = ndnCursor.get(); indexEntry.setValue( presenceEvaluator.getAttributeType().getOid() ); return indexEntry; } Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java Sat May 10 13:19:40 2008 @@ -21,15 +21,14 @@ import org.apache.directory.shared.ldap.filter.PresenceNode; -import org.apache.directory.shared.ldap.util.AttributeUtils; import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.Store; import org.apache.directory.server.xdbm.Index; import org.apache.directory.server.schema.registries.Registries; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerAttribute; -import javax.naming.directory.Attributes; -import javax.naming.directory.Attribute; import java.util.Iterator; @@ -40,16 +39,16 @@ * @author Apache Directory Project * @version $Rev$ */ -public class PresenceEvaluator implements Evaluator +public class PresenceEvaluator implements Evaluator { private final PresenceNode node; - private final Store db; + private final Store db; private final Registries registries; private final AttributeType type; - private final Index idx; + private final Index idx; - public PresenceEvaluator( PresenceNode node, Store db, Registries registries ) + public PresenceEvaluator( PresenceNode node, Store db, Registries registries ) throws Exception { this.db = db; @@ -80,14 +79,16 @@ } - public boolean evaluate( IndexEntry indexEntry ) throws Exception + // TODO - determine if comaparator and index entry should have the Value + // wrapper or the raw normalized value + public boolean evaluate( IndexEntry indexEntry ) throws Exception { if ( idx != null ) { return idx.forward( type.getOid(), indexEntry.getId() ); } - Attributes entry = indexEntry.getObject(); + ServerEntry entry = indexEntry.getObject(); // resuscitate the entry if it has not been and set entry in IndexEntry if ( null == entry ) @@ -97,7 +98,7 @@ } // get the attribute - Attribute attr = AttributeUtils.getAttribute( entry, type ); + ServerAttribute attr = ( ServerAttribute ) entry.get( type ); // if the attribute exists just return true if ( attr != null ) @@ -120,7 +121,7 @@ { AttributeType descendant = descendants.next(); - attr = AttributeUtils.getAttribute( entry, descendant ); + attr = ( ServerAttribute ) entry.get( descendant ); if ( attr != null ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java Sat May 10 13:19:40 2008 @@ -23,12 +23,11 @@ import org.apache.directory.server.core.cursor.AbstractCursor; import org.apache.directory.server.core.cursor.Cursor; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.Store; import org.apache.directory.server.xdbm.ForwardIndexEntry; -import javax.naming.directory.Attributes; - /** * A Cursor traversing candidates matching a Substring assertion expression. @@ -36,19 +35,19 @@ * @author Apache Directory Project * @version $Rev$ */ -public class SubstringCursor extends AbstractCursor> +public class SubstringCursor extends AbstractCursor> { private static final String UNSUPPORTED_MSG = "SubstringCursors may not be ordered and do not support positioning by element."; private final boolean hasIndex; - private final Cursor> wrapped; + private final Cursor> wrapped; private final SubstringEvaluator evaluator; - private final ForwardIndexEntry indexEntry = - new ForwardIndexEntry(); + private final ForwardIndexEntry indexEntry = + new ForwardIndexEntry(); private boolean available = false; - public SubstringCursor( Store db, + public SubstringCursor( Store db, final SubstringEvaluator substringEvaluator ) throws Exception { evaluator = substringEvaluator; @@ -83,13 +82,13 @@ } - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } @@ -99,7 +98,7 @@ { if ( evaluator.getExpression().getInitial() != null && hasIndex ) { - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); indexEntry.setValue( evaluator.getExpression().getInitial() ); wrapped.before( indexEntry ); } @@ -138,7 +137,7 @@ } - private boolean evaluateCandidate( IndexEntry indexEntry ) throws Exception + private boolean evaluateCandidate( IndexEntry indexEntry ) throws Exception { if ( hasIndex ) { @@ -162,7 +161,7 @@ { while ( wrapped.previous() ) { - IndexEntry entry = wrapped.get(); + IndexEntry entry = wrapped.get(); if ( evaluateCandidate( entry ) ) { available = true; @@ -182,7 +181,7 @@ { while ( wrapped.next() ) { - IndexEntry entry = wrapped.get(); + IndexEntry entry = wrapped.get(); if ( evaluateCandidate( entry ) ) { available = true; @@ -198,7 +197,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { if ( available ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Sat May 10 13:19:40 2008 @@ -23,21 +23,19 @@ import java.util.Iterator; import java.util.regex.Pattern; -import javax.naming.NamingEnumeration; -import javax.naming.directory.Attribute; -import javax.naming.directory.Attributes; - import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.server.xdbm.Index; import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.Store; import org.apache.directory.server.core.cursor.Cursor; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerAttribute; import org.apache.directory.shared.ldap.filter.SubstringNode; import org.apache.directory.shared.ldap.schema.AttributeType; import org.apache.directory.shared.ldap.schema.MatchingRule; import org.apache.directory.shared.ldap.schema.Normalizer; import org.apache.directory.shared.ldap.schema.NoOpNormalizer; -import org.apache.directory.shared.ldap.util.AttributeUtils; +import org.apache.directory.shared.ldap.entry.Value; /** @@ -46,10 +44,10 @@ * @author Apache Directory Project * @version $Rev$ */ -public class SubstringEvaluator implements Evaluator +public class SubstringEvaluator implements Evaluator { /** Database used while evaluating candidates */ - private final Store db; + private final Store db; /** Oid Registry used to translate attributeIds to OIDs */ private final Registries registries; @@ -64,7 +62,7 @@ private final Normalizer normalizer; - private final Index idx; + private final Index idx; /** @@ -75,7 +73,7 @@ * @param registries the set of registries * @throws Exception if there are failures accessing resources and the db */ - public SubstringEvaluator( SubstringNode node, Store db, Registries registries ) throws Exception + public SubstringEvaluator( SubstringNode node, Store db, Registries registries ) throws Exception { this.db = db; this.node = node; @@ -115,16 +113,13 @@ } - /** - * @see Evaluator#evaluate(IndexEntry) - */ - public boolean evaluate( IndexEntry indexEntry ) throws Exception + public boolean evaluate( IndexEntry indexEntry ) throws Exception { if ( idx == null ) { //noinspection unchecked - return evaluateWithoutIndex( ( IndexEntry ) indexEntry ); + return evaluateWithoutIndex( ( IndexEntry ) indexEntry ); } else { @@ -145,7 +140,7 @@ } - private boolean evaluateWithIndex( IndexEntry indexEntry ) throws Exception + private boolean evaluateWithIndex( IndexEntry indexEntry ) throws Exception { /* * Note that this is using the reverse half of the index giving a @@ -153,7 +148,7 @@ * Otherwise we would have to scan the entire index if there were * no reverse lookups. */ - Cursor> entries = idx.reverseCursor( indexEntry.getId() ); + Cursor> entries = idx.reverseCursor( indexEntry.getId() ); // cycle through the attribute values testing for a match while ( entries.next() ) @@ -173,9 +168,11 @@ } - private boolean evaluateWithoutIndex( IndexEntry indexEntry ) throws Exception + // TODO - determine if comaparator and index entry should have the Value + // wrapper or the raw normalized value + private boolean evaluateWithoutIndex( IndexEntry indexEntry ) throws Exception { - Attributes entry = indexEntry.getObject(); + ServerEntry entry = indexEntry.getObject(); // resuscitate the entry if it has not been and set entry in IndexEntry if ( null == entry ) @@ -185,31 +182,27 @@ } // get the attribute - Attribute attr = AttributeUtils.getAttribute( entry, type ); + ServerAttribute attr = ( ServerAttribute ) entry.get( type ); - // if the attribute does not exist just return false + // if the attribute exists and the pattern matches return true if ( attr != null ) { - /* * Cycle through the attribute values testing normalized version * obtained from using the substring matching rule's normalizer. * The test uses the comparator obtained from the appropriate * substring matching rule. */ - NamingEnumeration values = attr.getAll(); - - while ( values.hasMore() ) + for ( Value value : attr ) { - String value = ( String ) normalizer.normalize( values.next() ); + value.normalize( normalizer ); + String strValue = ( String ) value.getNormalizedValue(); // Once match is found cleanup and return true - if ( regex.matcher( value ).matches() ) + if ( regex.matcher( strValue ).matches() ) { // before returning we set the normalized value - indexEntry.setValue( value ); - - values.close(); + indexEntry.setValue( strValue ); return true; } } @@ -232,26 +225,28 @@ { AttributeType descendant = descendants.next(); - attr = AttributeUtils.getAttribute( entry, descendant ); + attr = ( ServerAttribute ) entry.get( descendant ); if ( null != attr ) { + + /* * Cycle through the attribute values testing normalized version * obtained from using the substring matching rule's normalizer. * The test uses the comparator obtained from the appropriate * substring matching rule. */ - NamingEnumeration values = attr.getAll(); - - while ( values.hasMore() ) + for ( Value value : attr ) { - String value = ( String ) normalizer.normalize( values.next() ); + value.normalize( normalizer ); + String strValue = ( String ) value.getNormalizedValue(); // Once match is found cleanup and return true - if ( regex.matcher( value ).matches() ) + if ( regex.matcher( strValue ).matches() ) { - values.close(); + // before returning we set the normalized value + indexEntry.setValue( strValue ); return true; } } Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java Sat May 10 13:19:40 2008 @@ -23,11 +23,10 @@ import org.apache.directory.server.core.cursor.AbstractCursor; import org.apache.directory.server.core.cursor.Cursor; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.Store; -import javax.naming.directory.Attributes; - /** * A Cursor over entries satisfying scope constraints with alias dereferencing @@ -36,25 +35,25 @@ * @author Apache Directory Project * @version $Rev$ */ -public class SubtreeScopeCursor extends AbstractCursor> +public class SubtreeScopeCursor extends AbstractCursor> { private static final String UNSUPPORTED_MSG = "Scope Cursors are not ordered and do not support positioning by element."; /** The Entry database/store */ - private final Store db; + private final Store db; /** A ScopeNode Evaluator */ private final SubtreeScopeEvaluator evaluator; /** A Cursor over the entries in the scope of the search base */ - private final Cursor> scopeCursor; + private final Cursor> scopeCursor; /** A Cursor over entries brought into scope by alias dereferencing */ - private final Cursor> dereferencedCursor; + private final Cursor> dereferencedCursor; /** Currently active Cursor: we switch between two cursors */ - private Cursor> cursor; + private Cursor> cursor; /** Whether or not this Cursor is positioned so an entry is available */ private boolean available = false; @@ -67,7 +66,7 @@ * @param evaluator an IndexEntry (candidate) evaluator * @throws Exception on db access failures */ - public SubtreeScopeCursor( Store db, SubtreeScopeEvaluator evaluator ) throws Exception + public SubtreeScopeCursor( Store db, SubtreeScopeEvaluator evaluator ) throws Exception { this.db = db; this.evaluator = evaluator; @@ -90,13 +89,13 @@ } - public void before( IndexEntry element ) throws Exception + public void before( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } - public void after( IndexEntry element ) throws Exception + public void after( IndexEntry element ) throws Exception { throw new UnsupportedOperationException( UNSUPPORTED_MSG ); } @@ -266,7 +265,7 @@ } - public IndexEntry get() throws Exception + public IndexEntry get() throws Exception { if ( available ) { Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java Sat May 10 13:19:40 2008 @@ -19,21 +19,21 @@ */ package org.apache.directory.server.xdbm.search.impl; + import static org.junit.Assert.*; import java.io.File; -import java.util.ArrayList; import java.util.HashSet; -import java.util.List; import java.util.Set; - -import javax.naming.directory.Attributes; +import java.util.List; +import java.util.ArrayList; import org.apache.commons.io.FileUtils; -import org.apache.directory.server.core.cursor.Cursor; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; +import org.apache.directory.server.core.cursor.Cursor; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.schema.SerializableComparator; import org.apache.directory.server.schema.bootstrap.ApacheSchema; import org.apache.directory.server.schema.bootstrap.ApachemetaSchema; @@ -48,8 +48,8 @@ import org.apache.directory.server.schema.registries.OidRegistry; import org.apache.directory.server.schema.registries.Registries; import org.apache.directory.server.xdbm.ForwardIndexEntry; -import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.Store; +import org.apache.directory.server.xdbm.IndexEntry; import org.apache.directory.server.xdbm.tools.StoreUtils; import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.filter.AndNode; @@ -61,6 +61,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; + /** * * Test class for AndCursor. @@ -73,7 +74,7 @@ private static final Logger LOG = LoggerFactory.getLogger( AndCursorTest.class.getSimpleName() ); File wkdir; - Store store; + Store store; Registries registries = null; AttributeTypeRegistry attributeRegistry; EvaluatorBuilder evaluatorBuilder; @@ -111,7 +112,7 @@ wkdir.mkdirs(); // initialize the store - store = new JdbmStore(); + store = new JdbmStore(); store.setName( "example" ); store.setCacheSize( 10 ); store.setWorkingDirectory( wkdir ); @@ -153,7 +154,7 @@ ExprNode exprNode = FilterParser.parse( filter ); - Cursor> cursor = cursorBuilder.build( exprNode ); + Cursor> cursor = cursorBuilder.build( exprNode ); cursor.beforeFirst(); @@ -185,12 +186,12 @@ { AndNode andNode = new AndNode(); - List> evaluators = new ArrayList>(); - Evaluator eval; + List> evaluators = new ArrayList>(); + Evaluator eval; ExprNode exprNode = new SubstringNode( "cn", "J*", null ); eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, registries ); - Cursor> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval ); + Cursor> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval ); /* adding this results in NPE adding Presence evaluator not Substring evaluator but adding Substring cursor as wrapped cursor */ @@ -204,7 +205,7 @@ andNode.addNode( exprNode ); - Cursor> cursor = ( Cursor> ) new AndCursor( wrapped, evaluators ); //cursorBuilder.build( andNode ); + Cursor> cursor = new AndCursor( wrapped, evaluators ); //cursorBuilder.build( andNode ); cursor.beforeFirst(); Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java Sat May 10 13:19:40 2008 @@ -31,10 +31,12 @@ import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.ServerStringValue; +import org.apache.directory.server.core.entry.DefaultServerEntry; import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.filter.GreaterEqNode; import org.apache.directory.shared.ldap.schema.*; -import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.commons.io.FileUtils; import org.junit.Before; @@ -44,7 +46,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; -import javax.naming.directory.Attributes; import javax.naming.NamingException; import java.io.File; import java.util.Set; @@ -66,7 +67,7 @@ File wkdir; - Store store; + Store store; Registries registries = null; AttributeTypeRegistry attributeRegistry; @@ -103,7 +104,7 @@ wkdir.mkdirs(); // initialize the store - store = new JdbmStore(); + store = new JdbmStore(); store.setName( "example" ); store.setCacheSize( 10 ); store.setWorkingDirectory( wkdir ); @@ -139,7 +140,8 @@ @Test public void testCursorIndexed() throws Exception { - GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTALCODE_AT_OID, "3" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID ); + GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) ); GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries ); GreaterEqCursor cursor = new GreaterEqCursor( store, evaluator ); assertNotNull( cursor ); @@ -277,7 +279,7 @@ // ---------- test before() ---------- cursor = new GreaterEqCursor( store, evaluator ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "5" ); assertFalse( cursor.available() ); @@ -300,7 +302,7 @@ assertTrue( cursor.isClosed() ); cursor = new GreaterEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "7" ); cursor.before( indexEntry ); assertFalse( cursor.available() ); @@ -310,7 +312,7 @@ cursor.close(); cursor = new GreaterEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "3" ); cursor.before( indexEntry ); assertFalse( cursor.available() ); @@ -322,7 +324,7 @@ // ---------- test after() ---------- cursor = new GreaterEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "4" ); assertFalse( cursor.available() ); @@ -345,7 +347,7 @@ assertTrue( cursor.isClosed() ); cursor = new GreaterEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "7" ); cursor.after( indexEntry ); assertFalse( cursor.available() ); @@ -355,7 +357,7 @@ cursor.close(); cursor = new GreaterEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "3" ); cursor.after( indexEntry ); assertFalse( cursor.available() ); @@ -369,7 +371,8 @@ @Test public void testCursorNotIndexed() throws Exception { - GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, "3" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID ); + GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) ); GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries ); GreaterEqCursor cursor = new GreaterEqCursor( store, evaluator ); assertNotNull( cursor ); @@ -502,7 +505,7 @@ // ---------- test before() ---------- cursor = new GreaterEqCursor( store, evaluator ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "2" ); try { cursor.before( indexEntry ); fail( "Should never get here." );} catch ( UnsupportedOperationException e ) {} @@ -510,7 +513,7 @@ // ---------- test after() ---------- cursor = new GreaterEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "2" ); try { cursor.after( indexEntry ); fail( "Should never get here." );} catch ( UnsupportedOperationException e ) {} @@ -525,9 +528,10 @@ @Test public void testEvaluatorIndexed() throws Exception { - GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTALCODE_AT_OID, "3" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID ); + GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) ); GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); assertEquals( node, evaluator.getExpression() ); assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() ); assertNotNull( evaluator.getNormalizer() ); @@ -536,31 +540,31 @@ indexEntry.setId( 1L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 4L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 5L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 6L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 7L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 8L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 9L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 10L ); assertFalse( evaluator.evaluate( indexEntry ) ); } @@ -569,9 +573,10 @@ @Test public void testEvaluatorWithDescendantValue() throws Exception { - GreaterEqNode node = new GreaterEqNode( SchemaConstants.STREET_AT_OID, "2" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.STREET_AT_OID ); + GreaterEqNode node = new GreaterEqNode( SchemaConstants.STREET_AT_OID, new ServerStringValue( at, "2" ) ); GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); assertEquals( node, evaluator.getExpression() ); assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() ); assertNotNull( evaluator.getNormalizer() ); @@ -579,10 +584,11 @@ LdapDN dn = new LdapDN( "cn=jane doe,o=good times co." ); dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() ); - AttributesImpl attrs = new AttributesImpl( "objectClass", "person", true ); - attrs.put( "c-street", "3" ); - attrs.put( "cn", "jane doe" ); - attrs.put( "sn", "doe" ); + ServerEntry attrs = new DefaultServerEntry( registries, dn ); + attrs.add( "objectClass", "person" ); + attrs.add( "c-street", "3" ); + attrs.add( "cn", "jane doe" ); + attrs.add( "sn", "doe" ); store.add( dn, attrs ); indexEntry.setId( 12L ); @@ -593,9 +599,11 @@ @Test public void testEvaluatorWithoutDescendants() throws Exception { - GreaterEqNode node = new GreaterEqNode( SchemaConstants.C_POSTALCODE_AT_OID, "2" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.C_POSTALCODE_AT_OID ); + GreaterEqNode node = new GreaterEqNode( SchemaConstants.C_POSTALCODE_AT_OID, new ServerStringValue( at, "2" ) ); + GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); assertEquals( node, evaluator.getExpression() ); assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() ); assertNotNull( evaluator.getNormalizer() ); @@ -609,9 +617,11 @@ @Test public void testEvaluatorNotIndexed() throws Exception { - GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, "3" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID ); + GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) ); + GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); assertEquals( node, evaluator.getExpression() ); assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() ); assertNotNull( evaluator.getNormalizer() ); @@ -620,31 +630,31 @@ indexEntry.setId( 1L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 4L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 5L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 6L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 7L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 8L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 9L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 10L ); assertFalse( evaluator.evaluate( indexEntry ) ); } @@ -769,7 +779,8 @@ } }; registries.getAttributeTypeRegistry().register( at ); - GreaterEqNode node = new GreaterEqNode( at.getOid(), "3" ); + + GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) ); new GreaterEqEvaluator( node, store, registries ); registries.getAttributeTypeRegistry().unregister( at.getOid() ); } @@ -954,7 +965,8 @@ } }; registries.getAttributeTypeRegistry().register( at ); - GreaterEqNode node = new GreaterEqNode( at.getOid(), "3" ); + + GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) ); new GreaterEqEvaluator( node, store, registries ); registries.getAttributeTypeRegistry().unregister( at.getOid() ); } Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java Sat May 10 13:19:40 2008 @@ -31,10 +31,12 @@ import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; +import org.apache.directory.server.core.entry.ServerEntry; +import org.apache.directory.server.core.entry.DefaultServerEntry; +import org.apache.directory.server.core.entry.ServerStringValue; import org.apache.directory.shared.ldap.constants.SchemaConstants; import org.apache.directory.shared.ldap.filter.LessEqNode; import org.apache.directory.shared.ldap.schema.*; -import org.apache.directory.shared.ldap.message.AttributesImpl; import org.apache.directory.shared.ldap.name.LdapDN; import org.apache.commons.io.FileUtils; import org.junit.Before; @@ -44,8 +46,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; -import javax.naming.directory.Attributes; -import javax.naming.NamingException; import java.io.File; import java.util.Set; import java.util.HashSet; @@ -53,6 +53,8 @@ import jdbm.helper.StringComparator; +import javax.naming.NamingException; + /** * Tests the LessEqEvaluator and LessEqCursor classes for correct operation. @@ -66,7 +68,7 @@ File wkdir; - Store store; + Store store; Registries registries = null; AttributeTypeRegistry attributeRegistry; @@ -103,7 +105,7 @@ wkdir.mkdirs(); // initialize the store - store = new JdbmStore(); + store = new JdbmStore(); store.setName( "example" ); store.setCacheSize( 10 ); store.setWorkingDirectory( wkdir ); @@ -139,7 +141,8 @@ @Test public void testCursorIndexed() throws Exception { - LessEqNode node = new LessEqNode( SchemaConstants.POSTALCODE_AT_OID, "3" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID ); + LessEqNode node = new LessEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) ); LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries ); LessEqCursor cursor = new LessEqCursor( store, evaluator ); assertNotNull( cursor ); @@ -297,7 +300,7 @@ // ---------- test before() ---------- cursor = new LessEqCursor( store, evaluator ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "2" ); assertFalse( cursor.available() ); @@ -320,7 +323,7 @@ assertTrue( cursor.isClosed() ); cursor = new LessEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "7" ); cursor.before( indexEntry ); assertFalse( cursor.available() ); @@ -330,7 +333,7 @@ cursor.close(); cursor = new LessEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "3" ); cursor.before( indexEntry ); assertFalse( cursor.available() ); @@ -342,7 +345,7 @@ // ---------- test after() ---------- cursor = new LessEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "1" ); assertFalse( cursor.available() ); @@ -365,7 +368,7 @@ assertTrue( cursor.isClosed() ); cursor = new LessEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "7" ); cursor.after( indexEntry ); assertFalse( cursor.available() ); @@ -375,7 +378,7 @@ cursor.close(); cursor = new LessEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "3" ); cursor.after( indexEntry ); assertFalse( cursor.available() ); @@ -389,7 +392,8 @@ @Test public void testCursorNotIndexed() throws Exception { - LessEqNode node = new LessEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, "3" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID ); + LessEqNode node = new LessEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) ); LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries ); LessEqCursor cursor = new LessEqCursor( store, evaluator ); assertNotNull( cursor ); @@ -542,7 +546,7 @@ // ---------- test before() ---------- cursor = new LessEqCursor( store, evaluator ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "2" ); try { cursor.before( indexEntry ); fail( "Should never get here." );} catch ( UnsupportedOperationException e ) {} @@ -550,7 +554,7 @@ // ---------- test after() ---------- cursor = new LessEqCursor( store, evaluator ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setValue( "2" ); try { cursor.after( indexEntry ); fail( "Should never get here." );} catch ( UnsupportedOperationException e ) {} @@ -565,9 +569,11 @@ @Test public void testEvaluatorIndexed() throws Exception { - LessEqNode node = new LessEqNode( SchemaConstants.POSTALCODE_AT_OID, "3" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID ); + LessEqNode node = new LessEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) ); + LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); assertEquals( node, evaluator.getExpression() ); assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() ); assertNotNull( evaluator.getNormalizer() ); @@ -576,31 +582,31 @@ indexEntry.setId( 1L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 4L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 5L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 6L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 7L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 8L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 9L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 10L ); assertFalse( evaluator.evaluate( indexEntry ) ); } @@ -609,9 +615,11 @@ @Test public void testEvaluatorWithDescendantValue() throws Exception { - LessEqNode node = new LessEqNode( SchemaConstants.STREET_AT_OID, "2" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.STREET_AT_OID ); + LessEqNode node = new LessEqNode( SchemaConstants.STREET_AT_OID, new ServerStringValue( at, "2" ) ); + LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); assertEquals( node, evaluator.getExpression() ); assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() ); assertNotNull( evaluator.getNormalizer() ); @@ -619,10 +627,11 @@ LdapDN dn = new LdapDN( "cn=jane doe,o=good times co." ); dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() ); - AttributesImpl attrs = new AttributesImpl( "objectClass", "person", true ); - attrs.put( "c-street", "1" ); - attrs.put( "cn", "jane doe" ); - attrs.put( "sn", "doe" ); + ServerEntry attrs = new DefaultServerEntry( registries, dn ); + attrs.add( "objectClass", "person" ); + attrs.add( "c-street", "1" ); + attrs.add( "cn", "jane doe" ); + attrs.add( "sn", "doe" ); store.add( dn, attrs ); indexEntry.setId( 12L ); @@ -633,9 +642,11 @@ @Test public void testEvaluatorWithoutDescendants() throws Exception { - LessEqNode node = new LessEqNode( SchemaConstants.C_POSTALCODE_AT_OID, "2" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.C_POSTALCODE_AT_OID ); + LessEqNode node = new LessEqNode( SchemaConstants.C_POSTALCODE_AT_OID, new ServerStringValue( at, "2" ) ); + LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); assertEquals( node, evaluator.getExpression() ); assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() ); assertNotNull( evaluator.getNormalizer() ); @@ -649,9 +660,11 @@ @Test public void testEvaluatorNotIndexed() throws Exception { - LessEqNode node = new LessEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, "3" ); + AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID ); + LessEqNode node = new LessEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) ); + LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries ); - ForwardIndexEntry indexEntry = new ForwardIndexEntry(); + ForwardIndexEntry indexEntry = new ForwardIndexEntry(); assertEquals( node, evaluator.getExpression() ); assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() ); assertNotNull( evaluator.getNormalizer() ); @@ -660,31 +673,31 @@ indexEntry.setId( 1L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 4L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 5L ); assertTrue( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 6L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 7L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 8L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 9L ); assertFalse( evaluator.evaluate( indexEntry ) ); - indexEntry = new ForwardIndexEntry(); + indexEntry = new ForwardIndexEntry(); indexEntry.setId( 10L ); assertFalse( evaluator.evaluate( indexEntry ) ); } @@ -809,7 +822,9 @@ } }; registries.getAttributeTypeRegistry().register( at ); - LessEqNode node = new LessEqNode( at.getOid(), "3" ); + + LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) ); + new LessEqEvaluator( node, store, registries ); registries.getAttributeTypeRegistry().unregister( at.getOid() ); } @@ -994,7 +1009,8 @@ } }; registries.getAttributeTypeRegistry().register( at ); - LessEqNode node = new LessEqNode( at.getOid(), "3" ); + + LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) ); new LessEqEvaluator( node, store, registries ); registries.getAttributeTypeRegistry().unregister( at.getOid() ); } Modified: directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java?rev=655151&r1=655150&r2=655151&view=diff ============================================================================== --- directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java (original) +++ directory/sandbox/akarasulu/bigbang/apacheds/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java Sat May 10 13:19:40 2008 @@ -19,19 +19,19 @@ */ package org.apache.directory.server.xdbm.search.impl; + import static org.junit.Assert.*; import java.io.File; import java.util.HashSet; import java.util.Set; -import javax.naming.directory.Attributes; - import org.apache.commons.io.FileUtils; import org.apache.directory.server.core.cursor.Cursor; import org.apache.directory.server.core.cursor.InvalidCursorPositionException; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore; +import org.apache.directory.server.core.entry.ServerEntry; import org.apache.directory.server.schema.SerializableComparator; import org.apache.directory.server.schema.bootstrap.ApacheSchema; import org.apache.directory.server.schema.bootstrap.ApachemetaSchema; @@ -54,11 +54,11 @@ import org.apache.directory.shared.ldap.filter.FilterParser; import org.apache.directory.shared.ldap.filter.NotNode; import org.apache.directory.shared.ldap.filter.SubstringNode; -import org.apache.directory.shared.ldap.name.LdapDN; import org.junit.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + /** * * Test cases for NotCursor. @@ -71,7 +71,7 @@ private static final Logger LOG = LoggerFactory.getLogger( NotCursorTest.class.getSimpleName() ); File wkdir; - Store store; + Store store; Registries registries = null; AttributeTypeRegistry attributeRegistry; EvaluatorBuilder evaluatorBuilder; @@ -109,7 +109,7 @@ wkdir.mkdirs(); // initialize the store - store = new JdbmStore(); + store = new JdbmStore(); store.setName( "example" ); store.setCacheSize( 10 ); store.setWorkingDirectory( wkdir ); @@ -151,7 +151,7 @@ ExprNode exprNode = FilterParser.parse( filter ); - Cursor> cursor = cursorBuilder.build( exprNode ); + Cursor> cursor = cursorBuilder.build( exprNode ); assertFalse( cursor.available() ); @@ -196,10 +196,10 @@ NotNode notNode = new NotNode(); ExprNode exprNode = new SubstringNode( "cn", "J", null ); - Evaluator eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, registries ); + Evaluator eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, registries ); notNode.addNode( exprNode ); - Cursor> cursor = ( Cursor> ) new NotCursor( store, eval ); //cursorBuilder.build( andNode ); + Cursor> cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode ); assertTrue( cursor.next() ); assertTrue( cursor.available() );