You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/02/28 18:26:05 UTC
svn commit: r917212 [2/3] - in /directory/apacheds/trunk/xdbm-search/src:
main/java/org/apache/directory/server/xdbm/search/impl/
test/java/org/apache/directory/server/xdbm/search/impl/
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java Sun Feb 28 17:26:04 2010
@@ -41,23 +41,21 @@
{
private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_725 );
private final boolean hasIndex;
- private final IndexCursor<String,ServerEntry> wrapped;
+ private final IndexCursor<String, ServerEntry> wrapped;
private final SubstringEvaluator evaluator;
- private final ForwardIndexEntry<String,ServerEntry> indexEntry =
- new ForwardIndexEntry<String,ServerEntry>();
+ private final ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
private boolean available = false;
@SuppressWarnings("unchecked")
- public SubstringCursor( Store<ServerEntry> db,
- final SubstringEvaluator substringEvaluator ) throws Exception
+ public SubstringCursor( Store<ServerEntry> db, final SubstringEvaluator substringEvaluator ) throws Exception
{
evaluator = substringEvaluator;
hasIndex = db.hasUserIndexOn( evaluator.getExpression().getAttribute() );
if ( hasIndex )
{
- wrapped = ( ( Index<String,ServerEntry> ) db.getUserIndex( evaluator.getExpression().getAttribute() ) )
+ wrapped = ( ( Index<String, ServerEntry> ) db.getUserIndex( evaluator.getExpression().getAttribute() ) )
.forwardCursor();
}
else
@@ -113,7 +111,7 @@
checkNotClosed( "beforeFirst()" );
if ( evaluator.getExpression().getInitial() != null && hasIndex )
{
- ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setValue( evaluator.getExpression().getInitial() );
wrapped.before( indexEntry );
}
@@ -154,7 +152,7 @@
}
- private boolean evaluateCandidate( IndexEntry<String,ServerEntry> indexEntry ) throws Exception
+ private boolean evaluateCandidate( IndexEntry<String, ServerEntry> indexEntry ) throws Exception
{
if ( hasIndex )
{
@@ -179,7 +177,7 @@
while ( wrapped.previous() )
{
checkNotClosed( "previous()" );
- IndexEntry<String,ServerEntry> entry = wrapped.get();
+ IndexEntry<String, ServerEntry> entry = wrapped.get();
if ( evaluateCandidate( entry ) )
{
available = true;
@@ -200,7 +198,7 @@
while ( wrapped.next() )
{
checkNotClosed( "next()" );
- IndexEntry<String,ServerEntry> entry = wrapped.get();
+ IndexEntry<String, ServerEntry> entry = wrapped.get();
if ( evaluateCandidate( entry ) )
{
available = true;
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Sun Feb 28 17:26:04 2010
@@ -50,7 +50,7 @@
{
/** Database used while evaluating candidates */
private final Store<ServerEntry> db;
-
+
/** Reference to the SchemaManager */
private final SchemaManager schemaManager;
@@ -64,7 +64,7 @@
private final Normalizer normalizer;
- private final Index<String,ServerEntry> idx;
+ private final Index<String, ServerEntry> idx;
/**
@@ -75,7 +75,8 @@
* @param registries the set of registries
* @throws Exception if there are failures accessing resources and the db
*/
- public SubstringEvaluator( SubstringNode node, Store<ServerEntry> db, SchemaManager schemaManager ) throws Exception
+ public SubstringEvaluator( SubstringNode node, Store<ServerEntry> db, SchemaManager schemaManager )
+ throws Exception
{
this.db = db;
this.node = node;
@@ -99,14 +100,14 @@
{
normalizer = new NoOpNormalizer( type.getSyntaxOid() );
}
-
+
// compile the regular expression to search for a matching attribute
regex = node.getRegex( normalizer );
if ( db.hasUserIndexOn( node.getAttribute() ) )
{
//noinspection unchecked
- idx = ( Index<String,ServerEntry> ) db.getUserIndex( node.getAttribute() );
+ idx = ( Index<String, ServerEntry> ) db.getUserIndex( node.getAttribute() );
}
else
{
@@ -115,13 +116,13 @@
}
- public boolean evaluate( IndexEntry<?,ServerEntry> indexEntry ) throws Exception
+ public boolean evaluate( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
{
if ( idx == null )
{
//noinspection unchecked
- return evaluateWithoutIndex( ( IndexEntry<String,ServerEntry> ) indexEntry );
+ return evaluateWithoutIndex( ( IndexEntry<String, ServerEntry> ) indexEntry );
}
else
{
@@ -172,7 +173,7 @@
}
- private boolean evaluateWithIndex( IndexEntry<?,ServerEntry> indexEntry ) throws Exception
+ private boolean evaluateWithIndex( IndexEntry<?, ServerEntry> indexEntry ) throws Exception
{
/*
* Note that this is using the reverse half of the index giving a
@@ -180,7 +181,7 @@
* Otherwise we would have to scan the entire index if there were
* no reverse lookups.
*/
- Cursor<IndexEntry<String,ServerEntry>> entries = idx.reverseCursor( indexEntry.getId() );
+ Cursor<IndexEntry<String, ServerEntry>> entries = idx.reverseCursor( indexEntry.getId() );
// cycle through the attribute values testing for a match
while ( entries.next() )
@@ -214,7 +215,7 @@
* Otherwise we would have to scan the entire index if there were
* no reverse lookups.
*/
- Cursor<IndexEntry<String,ServerEntry>> entries = idx.reverseCursor( id );
+ Cursor<IndexEntry<String, ServerEntry>> entries = idx.reverseCursor( id );
// cycle through the attribute values testing for a match
while ( entries.next() )
@@ -238,7 +239,7 @@
// wrapper or the raw normalized value
private boolean evaluateWithoutIndex( Long id ) throws Exception
{
- return evaluateWithoutIndex ( db.lookup( id ) );
+ return evaluateWithoutIndex( db.lookup( id ) );
}
@@ -281,8 +282,8 @@
// TODO check to see if descendant handling is necessary for the
// index so we can match properly even when for example a name
// attribute is used instead of more specific commonName
- Iterator<AttributeType> descendants =
- schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
+ Iterator<AttributeType> descendants = schemaManager.getAttributeTypeRegistry().descendants(
+ node.getAttribute() );
while ( descendants.hasNext() )
{
@@ -293,7 +294,6 @@
if ( null != attr )
{
-
/*
* Cycle through the attribute values testing normalized version
* obtained from using the substring matching rule's normalizer.
@@ -322,7 +322,7 @@
// TODO - determine if comaparator and index entry should have the Value
// wrapper or the raw normalized value
- private boolean evaluateWithoutIndex( IndexEntry<String,ServerEntry> indexEntry ) throws Exception
+ private boolean evaluateWithoutIndex( IndexEntry<String, ServerEntry> indexEntry ) throws Exception
{
ServerEntry entry = indexEntry.getObject();
@@ -376,8 +376,8 @@
// TODO check to see if descendant handling is necessary for the
// index so we can match properly even when for example a name
// attribute is used instead of more specific commonName
- Iterator<AttributeType> descendants =
- schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
+ Iterator<AttributeType> descendants = schemaManager.getAttributeTypeRegistry().descendants(
+ node.getAttribute() );
while ( descendants.hasNext() )
{
@@ -388,7 +388,6 @@
if ( null != attr )
{
-
/*
* Cycle through the attribute values testing normalized version
* obtained from using the substring matching rule's normalizer.
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java Sun Feb 28 17:26:04 2010
@@ -47,20 +47,20 @@
private final SubtreeScopeEvaluator<ServerEntry> evaluator;
/** A Cursor over the entries in the scope of the search base */
- private final IndexCursor<Long,ServerEntry> scopeCursor;
+ private final IndexCursor<Long, ServerEntry> scopeCursor;
/** A Cursor over entries brought into scope by alias dereferencing */
- private final IndexCursor<Long,ServerEntry> dereferencedCursor;
+ private final IndexCursor<Long, ServerEntry> dereferencedCursor;
/** Currently active Cursor: we switch between two cursors */
- private IndexCursor<Long,ServerEntry> cursor;
+ private IndexCursor<Long, ServerEntry> cursor;
/** Whether or not this Cursor is positioned so an entry is available */
private boolean available = false;
private Long contextEntryId;
-
+
/**
* Creates a Cursor over entries satisfying subtree level scope criteria.
*
@@ -72,7 +72,7 @@
{
this.db = db;
this.evaluator = evaluator;
-
+
if ( evaluator.getBaseId() == getContextEntryId() )
{
scopeCursor = new AllEntriesCursor( db );
@@ -107,16 +107,16 @@
// might not have been created
}
}
-
+
if ( contextEntryId == null )
{
return 1L;
}
-
+
return contextEntryId;
}
-
+
public boolean available()
{
return available;
@@ -232,7 +232,7 @@
* last element.
*/
available = cursor.previous();
- if ( ! available )
+ if ( !available )
{
cursor = scopeCursor;
cursor.afterLast();
@@ -302,7 +302,7 @@
* dereferencedCursor and try a previous call after positioning past
* it's last element.
*/
- if ( ! available )
+ if ( !available )
{
if ( dereferencedCursor != null )
{
@@ -332,7 +332,6 @@
public boolean isElementReused()
{
- return scopeCursor.isElementReused() ||
- ( dereferencedCursor != null && dereferencedCursor.isElementReused() );
+ return scopeCursor.isElementReused() || ( dereferencedCursor != null && dereferencedCursor.isElementReused() );
}
}
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java Sun Feb 28 17:26:04 2010
@@ -35,7 +35,7 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class SubtreeScopeEvaluator<E> implements Evaluator<ScopeNode,E>
+public class SubtreeScopeEvaluator<E> implements Evaluator<ScopeNode, E>
{
/** The ScopeNode containing initial search scope constraints */
private final ScopeNode node;
@@ -52,9 +52,9 @@
* the values for the context entry id to it's subordinates since it would
* have to include all entries. This is a waste of space and lookup time
* since we know all entries will be subordinates in this case.
- */
+ */
private final boolean baseIsContextEntry;
-
+
/** True if the scope requires alias dereferencing while searching */
private final boolean dereferencing;
@@ -81,11 +81,9 @@
baseId = db.getEntryId( node.getBaseDn() );
baseIsContextEntry = getContextEntryId() == baseId;
- dereferencing = node.getDerefAliases().isDerefInSearching() ||
- node.getDerefAliases().isDerefAlways();
+ dereferencing = node.getDerefAliases().isDerefInSearching() || node.getDerefAliases().isDerefAlways();
}
-
private Long contextEntryId;
@@ -103,16 +101,16 @@
// might not have been created
}
}
-
+
if ( contextEntryId == null )
{
return 1L;
}
-
+
return contextEntryId;
}
-
+
/**
* Asserts whether or not a candidate has one level scope while taking
* alias dereferencing into account.
@@ -123,7 +121,7 @@
* @throws Exception if the index lookups fail.
* @see Evaluator#evaluate(org.apache.directory.server.xdbm.IndexEntry)
*/
- public boolean evaluate( IndexEntry<?,E> candidate ) throws Exception
+ public boolean evaluate( IndexEntry<?, E> candidate ) throws Exception
{
/*
* This condition catches situations where the candidate is equal to
@@ -144,7 +142,7 @@
* dereferencing is not enabled then we return the results of the
* descendant test.
*/
- if ( ! isDereferencing() )
+ if ( !isDereferencing() )
{
return isDescendant;
}
@@ -204,7 +202,7 @@
* dereferencing is not enabled then we return the results of the
* descendant test.
*/
- if ( ! isDereferencing() )
+ if ( !isDereferencing() )
{
return isDescendant;
}
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java Sun Feb 28 17:26:04 2010
@@ -75,7 +75,8 @@
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
private static SchemaManager schemaManager;
-
+
+
@BeforeClass
public static void setup() throws Exception
{
@@ -96,20 +97,21 @@
schemaManager = new DefaultSchemaManager( loader );
boolean loaded = schemaManager.loadAllEnabled();
-
+
if ( !loaded )
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
loaded = schemaManager.loadWithDeps( "collective" );
-
+
if ( !loaded )
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
}
+
public AndCursorTest() throws Exception
{
}
@@ -132,18 +134,18 @@
store.setCacheSize( 10 );
store.setWorkingDirectory( wkdir );
store.setSyncOnWrite( false );
-
+
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
StoreUtils.loadExampleData( store, schemaManager );
-
+
evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
-
+
LOG.debug( "Created new store" );
}
-
+
@After
public void destroyStore() throws Exception
{
@@ -161,111 +163,111 @@
wkdir = null;
}
-
+
@Test
public void testAndCursorWithCursorBuilder() throws Exception
{
String filter = "(&(cn=J*)(sn=*))";
ExprNode exprNode = FilterParser.parse( filter );
-
- IndexCursor<?,ServerEntry> cursor = cursorBuilder.build( exprNode );
-
+
+ IndexCursor<?, ServerEntry> cursor = cursorBuilder.build( exprNode );
+
cursor.beforeFirst();
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
assertEquals( "johnny walker", cursor.get().getValue() );
-
+
assertFalse( cursor.next() );
assertFalse( cursor.available() );
-
+
cursor.close();
assertTrue( cursor.isClosed() );
}
-
-
+
+
@Test
public void testAndCursorWithManualFilter() throws Exception
{
AndNode andNode = new AndNode();
-
- List<Evaluator<? extends ExprNode,ServerEntry>> evaluators = new ArrayList<Evaluator<? extends ExprNode,ServerEntry>>();
+
+ List<Evaluator<? extends ExprNode, ServerEntry>> evaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>();
Evaluator<? extends ExprNode, ServerEntry> eval;
-
+
ExprNode exprNode = new SubstringNode( "cn", "J", null );
eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
- IndexCursor<?,ServerEntry> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval );
-
+ IndexCursor<?, ServerEntry> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval );
+
/* adding this results in NPE adding Presence evaluator not
Substring evaluator but adding Substring cursor as wrapped cursor */
// evaluators.add( eval );
-
+
andNode.addNode( exprNode );
-
+
exprNode = new PresenceNode( "sn" );
eval = new PresenceEvaluator( ( PresenceNode ) exprNode, store, schemaManager );
evaluators.add( eval );
-
+
andNode.addNode( exprNode );
-
- IndexCursor<?,ServerEntry> cursor = new AndCursor( wrapped, evaluators ); //cursorBuilder.build( andNode );
-
+
+ IndexCursor<?, ServerEntry> cursor = new AndCursor( wrapped, evaluators ); //cursorBuilder.build( andNode );
+
cursor.beforeFirst();
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
-
+
cursor.first();
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
- assertEquals( "johnny walker", cursor.get().getValue() );
-
+ assertEquals( "johnny walker", cursor.get().getValue() );
+
assertFalse( cursor.next() );
assertFalse( cursor.available() );
cursor.afterLast();
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
assertEquals( "johnny walker", cursor.get().getValue() );
-
+
cursor.last();
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
-
+
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
-
+
assertTrue( cursor.isElementReused() );
try
@@ -273,23 +275,28 @@
cursor.get();
fail( "should fail with InvalidCursorPositionException" );
}
- catch( InvalidCursorPositionException ice ) { }
-
+ catch ( InvalidCursorPositionException ice )
+ {
+ }
+
try
{
cursor.after( new ForwardIndexEntry() );
fail( "should fail with UnsupportedOperationException " );
}
- catch( UnsupportedOperationException uoe ) {}
-
+ catch ( UnsupportedOperationException uoe )
+ {
+ }
+
try
{
cursor.before( new ForwardIndexEntry() );
fail( "should fail with UnsupportedOperationException " );
}
- catch( UnsupportedOperationException uoe ) {}
+ catch ( UnsupportedOperationException uoe )
+ {
+ }
}
-
-
+
}
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java Sun Feb 28 17:26:04 2010
@@ -35,6 +35,7 @@
{
private static final long serialVersionUID = 1L;
+
protected BogusSyntax( int oidVal )
{
super( "1.3.6.1.4.1.18060.0.4.1.1.100000." + oidVal );
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java Sun Feb 28 17:26:04 2010
@@ -73,31 +73,30 @@
/** the global schemaManager used to resolve OIDs for attributeType ids */
private final SchemaManager schemaManager;
-
/**
* Chars which need to be escaped in a filter
* '\0' | '(' | ')' | '*' | '\'
*/
private static final boolean[] FILTER_CHAR =
- {
- true, false, false, false, false, false, false, false, // 00 -> 07 NULL
+ { true, false, false, false, false, false, false, false, // 00 -> 07 NULL
false, false, false, false, false, false, false, false, // 08 -> 0F
false, false, false, false, false, false, false, false, // 10 -> 17
false, false, false, false, false, false, false, false, // 18 -> 1F
false, false, false, false, false, false, false, false, // 20 -> 27
- true, true, true, false, false, false, false, false, // 28 -> 2F '(', ')', '*'
+ true, true, true, false, false, false, false, false, // 28 -> 2F '(', ')', '*'
false, false, false, false, false, false, false, false, // 30 -> 37
false, false, false, false, false, false, false, false, // 38 -> 3F
false, false, false, false, false, false, false, false, // 40 -> 47
false, false, false, false, false, false, false, false, // 48 -> 4F
false, false, false, false, false, false, false, false, // 50 -> 57
- false, false, false, false, true, false, false, false, // 58 -> 5F '\'
+ false, false, false, false, true, false, false, false, // 58 -> 5F '\'
false, false, false, false, false, false, false, false, // 60 -> 67
false, false, false, false, false, false, false, false, // 68 -> 6F
false, false, false, false, false, false, false, false, // 70 -> 77
- false, false, false, false, false, false, false, false // 78 -> 7F
+ false, false, false, false, false, false, false, false // 78 -> 7F
};
-
+
+
/**
* Check if the given char is a filter escaped char
* <filterEscapedChars> ::= '\0' | '(' | ')' | '*' | '\'
@@ -145,13 +144,11 @@
if ( attributeType.getSyntax().isHumanReadable() )
{
- normalized = new ClientStringValue(
- (String) ncn.normalizeByName( attribute, value.getString() ) );
+ normalized = new ClientStringValue( ( String ) ncn.normalizeByName( attribute, value.getString() ) );
}
else
{
- normalized = new ClientBinaryValue(
- (byte[]) ncn.normalizeByName( attribute, value.getBytes() ) );
+ normalized = new ClientBinaryValue( ( byte[] ) ncn.normalizeByName( attribute, value.getBytes() ) );
}
return normalized;
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java Sun Feb 28 17:26:04 2010
@@ -725,7 +725,7 @@
GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
new GreaterEqEvaluator( node, store, schemaManager );
}
- finally
+ finally
{
schemaManager.delete( at );
schemaManager.delete( syntax );
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java Sun Feb 28 17:26:04 2010
@@ -73,11 +73,12 @@
Optimizer optimizer;
static FilterNormalizingVisitor visitor;
+
@BeforeClass
static public void setup() throws Exception
{
// setup the standard registries
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -98,19 +99,19 @@
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
+
loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
-
+
if ( !loaded )
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
+
NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
visitor = new FilterNormalizingVisitor( ncn, schemaManager );
}
-
+
@Before
public void createStore() throws Exception
{
@@ -132,15 +133,15 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
StoreUtils.loadExampleData( store, schemaManager );
-
+
evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
optimizer = new DefaultOptimizer( store );
-
+
LOG.debug( "Created new store" );
}
-
+
@After
public void destryStore() throws Exception
{
@@ -158,7 +159,7 @@
wkdir = null;
}
-
+
@Test
public void testNestedAndnOr() throws Exception
{
@@ -167,18 +168,18 @@
ExprNode exprNode = FilterParser.parse( filter );
exprNode.accept( visitor );
optimizer.annotate( exprNode );
-
- IndexCursor<?,ServerEntry> cursor = cursorBuilder.build( exprNode );
-
+
+ IndexCursor<?, ServerEntry> cursor = cursorBuilder.build( exprNode );
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
assertEquals( "walker", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 7, ( long ) cursor.get().getId() );
- assertEquals( "apache", cursor.get().getValue());
+ assertEquals( "apache", cursor.get().getValue() );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
@@ -187,8 +188,8 @@
assertFalse( cursor.next() );
}
-
-
+
+
@Test
public void testNestedAndnNot() throws Exception
{
@@ -196,8 +197,8 @@
ExprNode exprNode = FilterParser.parse( filter );
optimizer.annotate( exprNode );
-
- IndexCursor<?,ServerEntry> cursor = cursorBuilder.build( exprNode );
+
+ IndexCursor<?, ServerEntry> cursor = cursorBuilder.build( exprNode );
assertTrue( cursor.next() );
assertTrue( cursor.available() );
@@ -206,7 +207,7 @@
assertFalse( cursor.next() );
}
-
+
@Test
public void testNestedNotnOrnAnd() throws Exception
@@ -215,23 +216,23 @@
ExprNode exprNode = FilterParser.parse( filter );
optimizer.annotate( exprNode );
-
- IndexCursor<?,ServerEntry> cursor = cursorBuilder.build( exprNode );
-
+
+ IndexCursor<?, ServerEntry> cursor = cursorBuilder.build( exprNode );
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 7, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=apache,2.5.4.11=board of directors,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.3=jack daniels,2.5.4.11=engineering,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertFalse( cursor.next() );
}
-
+
@Test
public void testNestedOrnNot() throws Exception
{
@@ -239,7 +240,7 @@
ExprNode exprNode = FilterParser.parse( filter );
optimizer.annotate( exprNode );
-
- IndexCursor<?,ServerEntry> cursor = cursorBuilder.build( exprNode );
+
+ IndexCursor<?, ServerEntry> cursor = cursorBuilder.build( exprNode );
}
}
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java Sun Feb 28 17:26:04 2010
@@ -73,11 +73,12 @@
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
+
@BeforeClass
static public void setup() throws Exception
{
// setup the standard registries
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -98,9 +99,9 @@
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
+
loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
-
+
if ( !loaded )
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
@@ -129,14 +130,14 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
StoreUtils.loadExampleData( store, schemaManager );
-
+
evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
-
+
LOG.debug( "Created new store" );
}
-
+
@After
public void destryStore() throws Exception
{
@@ -154,147 +155,154 @@
wkdir = null;
}
-
+
@Test
public void testNotCursor() throws Exception
{
String filter = "(!(cn=J*))";
ExprNode exprNode = FilterParser.parse( filter );
-
+
IndexCursor<?, ServerEntry> cursor = cursorBuilder.build( exprNode );
-
+
assertFalse( cursor.available() );
-
+
cursor.beforeFirst();
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 1, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 7, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=apache,2.5.4.11=board of directors,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 3, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=board of directors,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 4, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=engineering,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 2, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=sales,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertFalse( cursor.next() );
assertFalse( cursor.available() );
-
+
cursor.close();
assertTrue( cursor.isClosed() );
}
-
-
+
+
@Test
public void testNotCursorWithManualFilter() throws Exception
{
NotNode notNode = new NotNode();
-
+
ExprNode exprNode = new SubstringNode( "cn", "J", null );
- Evaluator<? extends ExprNode, ServerEntry> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
+ Evaluator<? extends ExprNode, ServerEntry> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store,
+ schemaManager );
notNode.addNode( exprNode );
-
+
NotCursor cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 1, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.10=good times co.", cursor.get().getValue() );
-
+
cursor.first();
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 7, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=apache,2.5.4.11=board of directors,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 3, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=board of directors,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 4, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=engineering,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 2, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=sales,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertFalse( cursor.next() );
assertFalse( cursor.available() );
cursor.afterLast();
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 2, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=sales,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
cursor.last();
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 4, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=engineering,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 3, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=board of directors,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 7, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.11=apache,2.5.4.11=board of directors,2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 1, ( long ) cursor.get().getId() );
assertEquals( "2.5.4.10=good times co.", cursor.get().getValue() );
-
+
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
-
+
assertTrue( cursor.isElementReused() );
-
- try
+
+ try
{
cursor.get();
fail( "should fail with InvalidCursorPositionException" );
}
- catch( InvalidCursorPositionException ice ) { }
-
+ catch ( InvalidCursorPositionException ice )
+ {
+ }
+
try
{
- cursor.after( new ForwardIndexEntry<Object,ServerEntry>() );
+ cursor.after( new ForwardIndexEntry<Object, ServerEntry>() );
fail( "should fail with UnsupportedOperationException " );
}
- catch( UnsupportedOperationException uoe ) {}
-
+ catch ( UnsupportedOperationException uoe )
+ {
+ }
+
try
{
- cursor.before( new ForwardIndexEntry<Object,ServerEntry>() );
+ cursor.before( new ForwardIndexEntry<Object, ServerEntry>() );
fail( "should fail with UnsupportedOperationException " );
}
- catch( UnsupportedOperationException uoe ) {}
+ catch ( UnsupportedOperationException uoe )
+ {
+ }
}
}
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java Sun Feb 28 17:26:04 2010
@@ -70,7 +70,6 @@
{
public static final Logger LOG = LoggerFactory.getLogger( OneLevelScopeTest.class );
-
File wkdir;
Store<ServerEntry> store;
static SchemaManager schemaManager = null;
@@ -80,7 +79,7 @@
public static void setup() throws Exception
{
// setup the standard registries
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -101,9 +100,9 @@
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
+
loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
-
+
if ( !loaded )
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
@@ -157,15 +156,13 @@
@Test
public void testCursorNoDeref() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES,
- SchemaConstants.OU_AT_OID + "=sales," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=sales,"
+ + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
assertTrue( cursor.isElementReused() );
-
// --------- Test beforeFirst() ---------
cursor.beforeFirst();
@@ -173,7 +170,7 @@
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- IndexEntry<Long,ServerEntry> indexEntry = cursor.get();
+ IndexEntry<Long, ServerEntry> indexEntry = cursor.get();
assertNotNull( indexEntry );
assertEquals( 5L, ( long ) indexEntry.getId() );
assertEquals( 2L, ( long ) indexEntry.getValue() );
@@ -304,15 +301,13 @@
@Test
public void testCursorNoDerefReturnAliases() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES,
- SchemaConstants.OU_AT_OID + "=engineering," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=engineering,"
+ + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
assertTrue( cursor.isElementReused() );
-
// --------- Test beforeFirst() ---------
cursor.beforeFirst();
@@ -320,7 +315,7 @@
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- IndexEntry<Long,ServerEntry> indexEntry = cursor.get();
+ IndexEntry<Long, ServerEntry> indexEntry = cursor.get();
assertNotNull( indexEntry );
assertEquals( 8L, ( long ) indexEntry.getId() );
assertEquals( 4L, ( long ) indexEntry.getValue() );
@@ -451,15 +446,13 @@
@Test
public void testCursorWithDereferencing() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING,
- SchemaConstants.OU_AT_OID + "=board of directors," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, SchemaConstants.OU_AT_OID
+ + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
assertTrue( cursor.isElementReused() );
-
// --------- Test beforeFirst() ---------
cursor.beforeFirst();
@@ -467,7 +460,7 @@
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- IndexEntry<Long,ServerEntry> indexEntry = cursor.get();
+ IndexEntry<Long, ServerEntry> indexEntry = cursor.get();
assertNotNull( indexEntry );
assertEquals( 7L, ( long ) indexEntry.getId() );
assertEquals( 3L, ( long ) indexEntry.getValue() );
@@ -576,16 +569,14 @@
@Test
public void testCursorWithDereferencing2() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING,
- SchemaConstants.OU_AT_OID + "=apache," +
- SchemaConstants.OU_AT_OID + "=board of directors," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, SchemaConstants.OU_AT_OID + "=apache,"
+ + SchemaConstants.OU_AT_OID + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co.",
+ SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
assertTrue( cursor.isElementReused() );
-
// --------- Test beforeFirst() ---------
cursor.beforeFirst();
@@ -593,7 +584,7 @@
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- IndexEntry<Long,ServerEntry> indexEntry = cursor.get();
+ IndexEntry<Long, ServerEntry> indexEntry = cursor.get();
assertNotNull( indexEntry );
assertEquals( 6L, ( long ) indexEntry.getId() );
assertEquals( 7L, ( long ) indexEntry.getValue() );
@@ -667,13 +658,10 @@
@Test
public void testCursorWithDereferencing3() throws Exception
{
- LdapDN dn = new LdapDN(
- SchemaConstants.CN_AT_OID + "=jd," +
- SchemaConstants.OU_AT_OID + "=board of directors," +
- SchemaConstants.O_AT_OID + "=good times co."
- );
+ LdapDN dn = new LdapDN( SchemaConstants.CN_AT_OID + "=jd," + SchemaConstants.OU_AT_OID + "=board of directors,"
+ + SchemaConstants.O_AT_OID + "=good times co." );
dn.normalize( schemaManager.getNormalizerMapping() );
-
+
ServerEntry attrs = new DefaultServerEntry( schemaManager, dn );
attrs.add( "objectClass", "alias", "extensibleObject" );
attrs.add( "cn", "jd" );
@@ -682,13 +670,10 @@
attrs.add( "entryUUID", UUID.randomUUID().toString() );
store.add( attrs );
- dn = new LdapDN(
- SchemaConstants.CN_AT_OID + "=jdoe," +
- SchemaConstants.OU_AT_OID + "=board of directors," +
- SchemaConstants.O_AT_OID + "=good times co."
- );
+ dn = new LdapDN( SchemaConstants.CN_AT_OID + "=jdoe," + SchemaConstants.OU_AT_OID + "=board of directors,"
+ + SchemaConstants.O_AT_OID + "=good times co." );
dn.normalize( schemaManager.getNormalizerMapping() );
-
+
attrs = new DefaultServerEntry( schemaManager, dn );
attrs.add( "objectClass", "person" );
attrs.add( "cn", "jdoe" );
@@ -697,15 +682,13 @@
attrs.add( "entryUUID", UUID.randomUUID().toString() );
store.add( attrs );
- ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING,
- SchemaConstants.OU_AT_OID + "=board of directors," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, SchemaConstants.OU_AT_OID
+ + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
assertTrue( cursor.isElementReused() );
-
// --------- Test beforeFirst() ---------
cursor.beforeFirst();
@@ -713,7 +696,7 @@
assertTrue( cursor.next() );
assertTrue( cursor.available() );
- IndexEntry<Long,ServerEntry> indexEntry = cursor.get();
+ IndexEntry<Long, ServerEntry> indexEntry = cursor.get();
assertNotNull( indexEntry );
assertEquals( 7L, ( long ) indexEntry.getId() );
assertEquals( 3L, ( long ) indexEntry.getValue() );
@@ -928,12 +911,11 @@
@Test
public void testEvaluatorNoDereferencing() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES,
- SchemaConstants.OU_AT_OID + "=sales," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=sales,"
+ + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
- ForwardIndexEntry<Long,ServerEntry> indexEntry = new ForwardIndexEntry<Long,ServerEntry>();
+ ForwardIndexEntry<Long, ServerEntry> indexEntry = new ForwardIndexEntry<Long, ServerEntry>();
indexEntry.setId( 6L );
assertTrue( evaluator.evaluate( indexEntry ) );
}
@@ -942,9 +924,8 @@
@Test
public void testEvaluatorWithDereferencing() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_ALWAYS,
- SchemaConstants.OU_AT_OID + "=engineering," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_ALWAYS, SchemaConstants.OU_AT_OID + "=engineering,"
+ + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
assertEquals( node, evaluator.getExpression() );
@@ -953,74 +934,70 @@
* will not accept an alias candidate because aliases are not returned
* when alias dereferencing while searching is enabled.
*/
- ForwardIndexEntry<Long,ServerEntry> indexEntry = new ForwardIndexEntry<Long,ServerEntry>();
+ ForwardIndexEntry<Long, ServerEntry> indexEntry = new ForwardIndexEntry<Long, ServerEntry>();
indexEntry.setId( 11L );
assertFalse( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<Long,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<Long, ServerEntry>();
indexEntry.setId( 8L );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<Long,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<Long, ServerEntry>();
indexEntry.setId( 5L );
assertTrue( evaluator.evaluate( indexEntry ) );
- indexEntry = new ForwardIndexEntry<Long,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<Long, ServerEntry>();
indexEntry.setId( 6L );
assertFalse( evaluator.evaluate( indexEntry ) );
}
- @Test ( expected = InvalidCursorPositionException.class )
+ @Test(expected = InvalidCursorPositionException.class)
public void testInvalidCursorPositionException() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES,
- SchemaConstants.OU_AT_OID + "=sales," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=sales,"
+ + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
cursor.get();
}
- @Test ( expected = UnsupportedOperationException.class )
+ @Test(expected = UnsupportedOperationException.class)
public void testUnsupportBeforeWithoutIndex() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES,
- SchemaConstants.OU_AT_OID + "=sales," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=sales,"
+ + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
// test before()
- ForwardIndexEntry<Long,ServerEntry> entry = new ForwardIndexEntry<Long,ServerEntry>();
+ ForwardIndexEntry<Long, ServerEntry> entry = new ForwardIndexEntry<Long, ServerEntry>();
entry.setValue( 3L );
cursor.before( entry );
}
- @Test ( expected = UnsupportedOperationException.class )
+ @Test(expected = UnsupportedOperationException.class)
public void testUnsupportAfterWithoutIndex() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES,
- SchemaConstants.OU_AT_OID + "=sales," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
+ ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=sales,"
+ + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.ONELEVEL );
OneLevelScopeEvaluator<ServerEntry> evaluator = new OneLevelScopeEvaluator<ServerEntry>( store, node );
OneLevelScopeCursor cursor = new OneLevelScopeCursor( store, evaluator );
// test after()
- ForwardIndexEntry<Long,ServerEntry> entry = new ForwardIndexEntry<Long,ServerEntry>();
+ ForwardIndexEntry<Long, ServerEntry> entry = new ForwardIndexEntry<Long, ServerEntry>();
entry.setValue( 3L );
cursor.after( entry );
}
- @Test ( expected = IllegalStateException.class )
+ @Test(expected = IllegalStateException.class)
public void testIllegalStateBadScope() throws Exception
{
- ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES,
- SchemaConstants.OU_AT_OID + "=sales," +
- SchemaConstants.O_AT_OID + "=good times co.", SearchScope.SUBTREE );
+ ScopeNode node = new ScopeNode( AliasDerefMode.NEVER_DEREF_ALIASES, SchemaConstants.OU_AT_OID + "=sales,"
+ + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.SUBTREE );
new OneLevelScopeEvaluator<ServerEntry>( store, node );
}
}
\ No newline at end of file
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java Sun Feb 28 17:26:04 2010
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.xdbm.search.impl;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -80,10 +81,11 @@
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
+
@BeforeClass
public static void setup() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -104,9 +106,9 @@
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
+
loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
-
+
if ( !loaded )
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
@@ -135,14 +137,14 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
StoreUtils.loadExampleData( store, schemaManager );
-
+
evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
-
+
LOG.debug( "Created new store" );
}
-
+
@After
public void destryStore() throws Exception
{
@@ -160,15 +162,15 @@
wkdir = null;
}
-
+
@Test
public void testOrCursorUsingCursorBuilder() throws Exception
{
String filter = "(|(cn=J*)(sn=W*))";
ExprNode exprNode = FilterParser.parse( filter );
-
- IndexCursor<?,ServerEntry> cursor = cursorBuilder.build( exprNode );
+
+ IndexCursor<?, ServerEntry> cursor = cursorBuilder.build( exprNode );
cursor.afterLast();
@@ -176,139 +178,141 @@
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
assertEquals( "walker", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 11, ( long ) cursor.get().getId() );
assertEquals( "johnny walker", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 10, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 9, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
-
+
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
-
+
cursor.beforeFirst();
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 9, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 10, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 11, ( long ) cursor.get().getId() );
assertEquals( "johnny walker", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
assertEquals( "walker", cursor.get().getValue() );
-
+
assertFalse( cursor.next() );
assertFalse( cursor.available() );
-
+
cursor.close();
assertTrue( cursor.isClosed() );
}
-
-
- @Test( expected = InvalidCursorPositionException.class )
- @SuppressWarnings( "unchecked" )
+
+
+ @Test(expected = InvalidCursorPositionException.class)
+ @SuppressWarnings("unchecked")
public void testOrCursor() throws Exception
{
- List<Evaluator<? extends ExprNode,ServerEntry>> evaluators = new ArrayList<Evaluator<? extends ExprNode,ServerEntry>>();
- List<Cursor<IndexEntry<?,ServerEntry>>> cursors = new ArrayList<Cursor<IndexEntry<?,ServerEntry>>>();
+ List<Evaluator<? extends ExprNode, ServerEntry>> evaluators = new ArrayList<Evaluator<? extends ExprNode, ServerEntry>>();
+ List<Cursor<IndexEntry<?, ServerEntry>>> cursors = new ArrayList<Cursor<IndexEntry<?, ServerEntry>>>();
Evaluator<? extends ExprNode, ServerEntry> eval;
- Cursor<IndexEntry<?,ServerEntry>> cursor;
-
+ Cursor<IndexEntry<?, ServerEntry>> cursor;
+
OrNode orNode = new OrNode();
ExprNode exprNode = new SubstringNode( "cn", "J", null );
eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
Cursor subStrCursor1 = new SubstringCursor( store, ( SubstringEvaluator ) eval );
cursors.add( subStrCursor1 );
- evaluators.add( eval );
+ evaluators.add( eval );
orNode.addNode( exprNode );
-
+
try
{
new OrCursor( cursors, evaluators );
fail( "should throw IllegalArgumentException" );
}
- catch( IllegalArgumentException ie ){ }
-
+ catch ( IllegalArgumentException ie )
+ {
+ }
+
exprNode = new SubstringNode( "sn", "W", null );
eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
evaluators.add( eval );
Cursor subStrCursor2 = new SubstringCursor( store, ( SubstringEvaluator ) eval );
cursors.add( subStrCursor2 );
-
+
orNode.addNode( exprNode );
-
- cursor = new OrCursor( cursors, evaluators );
-
+
+ cursor = new OrCursor( cursors, evaluators );
+
cursor.beforeFirst();
assertFalse( cursor.available() );
-
+
// from first
assertTrue( cursor.first() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 9, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 10, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
assertEquals( "walker", cursor.get().getValue() );
-
+
assertTrue( cursor.next() );
assertTrue( cursor.available() );
assertEquals( 11, ( long ) cursor.get().getId() );
@@ -320,56 +324,60 @@
// from last
cursor.afterLast();
assertFalse( cursor.available() );
-
+
assertTrue( cursor.last() );
assertTrue( cursor.available() );
assertEquals( 11, ( long ) cursor.get().getId() );
assertEquals( "johnny walker", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 5, ( long ) cursor.get().getId() );
assertEquals( "walker", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 10, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 9, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 6, ( long ) cursor.get().getId() );
assertEquals( "jim bean", cursor.get().getValue() );
-
+
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( 8, ( long ) cursor.get().getId() );
assertEquals( "jack daniels", cursor.get().getValue() );
-
+
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
-
+
assertTrue( cursor.isElementReused() );
-
+
try
{
cursor.after( new ForwardIndexEntry() );
fail( "should fail with UnsupportedOperationException " );
}
- catch( UnsupportedOperationException uoe ) {}
-
+ catch ( UnsupportedOperationException uoe )
+ {
+ }
+
try
{
cursor.before( new ForwardIndexEntry() );
fail( "should fail with UnsupportedOperationException " );
}
- catch( UnsupportedOperationException uoe ) {}
-
+ catch ( UnsupportedOperationException uoe )
+ {
+ }
+
cursor.get();
}
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java Sun Feb 28 17:26:04 2010
@@ -69,7 +69,7 @@
@BeforeClass
public static void setup() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -90,9 +90,9 @@
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
+
loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
-
+
if ( !loaded )
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
@@ -200,7 +200,7 @@
assertEquals( SchemaConstants.CN_AT_OID, cursor.get().getValue() );
// test before()
- ForwardIndexEntry<String,ServerEntry> entry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.CN_AT_OID );
cursor.before( entry );
assertTrue( cursor.next() );
@@ -208,7 +208,7 @@
assertEquals( SchemaConstants.CN_AT_OID, cursor.get().getValue() );
// test after()
- entry = new ForwardIndexEntry<String,ServerEntry>();
+ entry = new ForwardIndexEntry<String, ServerEntry>();
cursor.after( entry );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
@@ -303,18 +303,18 @@
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( SchemaConstants.SN_AT_OID, cursor.get().getValue() );
- assertEquals( 5, (long) cursor.get().getId() );
+ assertEquals( 5, ( long ) cursor.get().getId() );
// keep testing previous
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( SchemaConstants.SN_AT_OID, cursor.get().getValue() );
- assertEquals( 6, (long) cursor.get().getId() );
+ assertEquals( 6, ( long ) cursor.get().getId() );
assertTrue( cursor.previous() );
assertTrue( cursor.available() );
assertEquals( SchemaConstants.SN_AT_OID, cursor.get().getValue() );
- assertEquals( 8, (long) cursor.get().getId() );
+ assertEquals( 8, ( long ) cursor.get().getId() );
assertFalse( cursor.previous() );
assertFalse( cursor.available() );
@@ -345,11 +345,11 @@
{
PresenceNode node = new PresenceNode( SchemaConstants.CN_AT_OID );
PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- ForwardIndexEntry<String,ServerEntry> entry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.CN_AT_OID );
entry.setId( ( long ) 3 );
assertFalse( evaluator.evaluate( entry ) );
- entry = new ForwardIndexEntry<String,ServerEntry>();
+ entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.CN_AT_OID );
entry.setId( ( long ) 5 );
assertTrue( evaluator.evaluate( entry ) );
@@ -361,42 +361,42 @@
{
PresenceNode node = new PresenceNode( SchemaConstants.NAME_AT_OID );
PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
- ForwardIndexEntry<String,ServerEntry> entry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.NAME_AT_OID );
entry.setId( ( long ) 3 );
assertTrue( evaluator.evaluate( entry ) );
- entry = new ForwardIndexEntry<String,ServerEntry>();
+ entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.NAME_AT_OID );
entry.setId( ( long ) 5 );
assertTrue( evaluator.evaluate( entry ) );
node = new PresenceNode( SchemaConstants.SEARCHGUIDE_AT_OID );
evaluator = new PresenceEvaluator( node, store, schemaManager );
- entry = new ForwardIndexEntry<String,ServerEntry>();
+ entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.SEARCHGUIDE_AT_OID );
entry.setId( ( long ) 3 );
assertFalse( evaluator.evaluate( entry ) );
- entry = new ForwardIndexEntry<String,ServerEntry>();
+ entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.SEARCHGUIDE_AT_OID );
entry.setId( ( long ) 5 );
- entry.setObject( store.lookup( ( long ) 5 ));
+ entry.setObject( store.lookup( ( long ) 5 ) );
assertFalse( evaluator.evaluate( entry ) );
node = new PresenceNode( SchemaConstants.ST_AT_OID );
evaluator = new PresenceEvaluator( node, store, schemaManager );
- entry = new ForwardIndexEntry<String,ServerEntry>();
+ entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.ST_AT_OID );
entry.setId( ( long ) 3 );
assertFalse( evaluator.evaluate( entry ) );
- entry = new ForwardIndexEntry<String,ServerEntry>();
+ entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.ST_AT_OID );
entry.setId( ( long ) 5 );
- entry.setObject( store.lookup( ( long ) 5 ));
+ entry.setObject( store.lookup( ( long ) 5 ) );
assertFalse( evaluator.evaluate( entry ) );
}
- @Test ( expected = InvalidCursorPositionException.class )
+ @Test(expected = InvalidCursorPositionException.class)
public void testInvalidCursorPositionException() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.SN_AT_OID );
@@ -406,7 +406,7 @@
}
- @Test ( expected = InvalidCursorPositionException.class )
+ @Test(expected = InvalidCursorPositionException.class)
public void testInvalidCursorPositionException2() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.CN_AT_OID );
@@ -416,7 +416,7 @@
}
- @Test ( expected = UnsupportedOperationException.class )
+ @Test(expected = UnsupportedOperationException.class)
public void testUnsupportBeforeWithoutIndex() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.SN_AT_OID );
@@ -424,13 +424,13 @@
PresenceCursor cursor = new PresenceCursor( store, evaluator );
// test before()
- ForwardIndexEntry<String,ServerEntry> entry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.SN_AT_OID );
cursor.before( entry );
}
- @Test ( expected = UnsupportedOperationException.class )
+ @Test(expected = UnsupportedOperationException.class)
public void testUnsupportAfterWithoutIndex() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.SN_AT_OID );
@@ -438,7 +438,7 @@
PresenceCursor cursor = new PresenceCursor( store, evaluator );
// test before()
- ForwardIndexEntry<String,ServerEntry> entry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.SN_AT_OID );
cursor.after( entry );
}
Modified: directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java?rev=917212&r1=917211&r2=917212&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java Sun Feb 28 17:26:04 2010
@@ -69,7 +69,7 @@
@BeforeClass
public static void setup() throws Exception
{
- String workingDirectory = System.getProperty( "workingDirectory" );
+ String workingDirectory = System.getProperty( "workingDirectory" );
if ( workingDirectory == null )
{
@@ -90,9 +90,9 @@
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
+
loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
-
+
if ( !loaded )
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
@@ -223,7 +223,6 @@
assertFalse( cursor.next() );
assertFalse( cursor.available() );
-
// ---------- test afterLast ----------
cursor = new SubstringCursor( store, evaluator );
@@ -344,7 +343,6 @@
assertFalse( cursor.next() );
assertFalse( cursor.available() );
-
// ---------- test afterLast ----------
cursor = new SubstringCursor( store, evaluator );
@@ -437,7 +435,6 @@
assertFalse( cursor.next() );
assertFalse( cursor.available() );
-
// ---------- test afterLast ----------
cursor = new SubstringCursor( store, evaluator );
@@ -515,7 +512,6 @@
assertFalse( cursor.next() );
assertFalse( cursor.available() );
-
// ---------- test afterLast ----------
cursor = new SubstringCursor( store, evaluator );
@@ -577,7 +573,6 @@
assertFalse( cursor.next() );
assertFalse( cursor.available() );
-
// ---------- test afterLast ----------
cursor = new SubstringCursor( store, evaluator );
@@ -612,7 +607,7 @@
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, "walk", null );
SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
- ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setId( 5L );
assertTrue( evaluator.evaluate( indexEntry ) );
indexEntry.setId( 3L );
@@ -624,35 +619,35 @@
node = new SubstringNode( SchemaConstants.SN_AT_OID, "wa", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
- indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setId( 5L );
indexEntry.setObject( store.lookup( 5L ) );
assertTrue( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( SchemaConstants.SEARCHGUIDE_AT_OID, "j", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
- indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setId( 6L );
indexEntry.setObject( store.lookup( 6L ) );
assertFalse( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( SchemaConstants.ST_AT_OID, "j", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
- indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setId( 6L );
indexEntry.setObject( store.lookup( 6L ) );
assertFalse( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( SchemaConstants.NAME_AT_OID, "j", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
- indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setId( 6L );
indexEntry.setObject( store.lookup( 6L ) );
assertTrue( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( SchemaConstants.NAME_AT_OID, "s", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
- indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setId( 6L );
indexEntry.setObject( store.lookup( 6L ) );
assertTrue( evaluator.evaluate( indexEntry ) );
@@ -664,7 +659,7 @@
{
SubstringNode node = new SubstringNode( SchemaConstants.CN_AT_OID, "jim", null );
SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
- ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setId( 6L );
assertTrue( evaluator.evaluate( indexEntry ) );
indexEntry.setId( 3L );
@@ -673,14 +668,14 @@
node = new SubstringNode( SchemaConstants.CN_AT_OID, "j", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
- indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setId( 6L );
indexEntry.setObject( store.lookup( 6L ) );
assertTrue( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( SchemaConstants.CN_AT_OID, "s", null );
evaluator = new SubstringEvaluator( node, store, schemaManager );
- indexEntry = new ForwardIndexEntry<String,ServerEntry>();
+ indexEntry = new ForwardIndexEntry<String, ServerEntry>();
indexEntry.setId( 6L );
indexEntry.setObject( store.lookup( 6L ) );
assertFalse( evaluator.evaluate( indexEntry ) );
@@ -693,7 +688,7 @@
}
- @Test ( expected = InvalidCursorPositionException.class )
+ @Test(expected = InvalidCursorPositionException.class)
public void testInvalidCursorPositionException() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, "b", null );
@@ -703,7 +698,7 @@
}
- @Test ( expected = InvalidCursorPositionException.class )
+ @Test(expected = InvalidCursorPositionException.class)
public void testInvalidCursorPositionException2() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.CN_AT_OID, "j", null );
@@ -713,7 +708,7 @@
}
- @Test ( expected = UnsupportedOperationException.class )
+ @Test(expected = UnsupportedOperationException.class)
public void testUnsupportBeforeWithoutIndex() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, "j", null );
@@ -721,13 +716,13 @@
SubstringCursor cursor = new SubstringCursor( store, evaluator );
// test before()
- ForwardIndexEntry<String,ServerEntry> entry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.SN_AT_OID );
cursor.before( entry );
}
- @Test ( expected = UnsupportedOperationException.class )
+ @Test(expected = UnsupportedOperationException.class)
public void testUnsupportAfterWithoutIndex() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, "j", null );
@@ -735,7 +730,7 @@
SubstringCursor cursor = new SubstringCursor( store, evaluator );
// test before()
- ForwardIndexEntry<String,ServerEntry> entry = new ForwardIndexEntry<String,ServerEntry>();
+ ForwardIndexEntry<String, ServerEntry> entry = new ForwardIndexEntry<String, ServerEntry>();
entry.setValue( SchemaConstants.SN_AT_OID );
cursor.after( entry );
}