You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2009/11/07 08:57:42 UTC
svn commit: r833647 [14/17] - in /directory:
apacheds/branches/apacheds-schema/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/
apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/pa...
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java Sat Nov 7 07:57:34 2009
@@ -20,17 +20,17 @@
package org.apache.directory.server.xdbm.search.impl;
-import org.apache.directory.shared.ldap.filter.PresenceNode;
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import java.util.Iterator;
+
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+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.xdbm.Index;
import org.apache.directory.server.xdbm.search.Evaluator;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
-
-import java.util.Iterator;
+import org.apache.directory.shared.ldap.filter.PresenceNode;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
/**
@@ -44,18 +44,18 @@
{
private final PresenceNode node;
private final Store<ServerEntry> db;
- private final Registries registries;
private final AttributeType type;
+ private final SchemaManager schemaManager;
private final Index<String,ServerEntry> idx;
- public PresenceEvaluator( PresenceNode node, Store<ServerEntry> db, Registries registries )
+ public PresenceEvaluator( PresenceNode node, Store<ServerEntry> db, SchemaManager schemaManager )
throws Exception
{
this.db = db;
this.node = node;
- this.registries = registries;
- this.type = registries.getAttributeTypeRegistry().lookup( node.getAttribute() );
+ this.schemaManager = schemaManager;
+ this.type = schemaManager.lookupAttributeTypeRegistry( node.getAttribute() );
if ( db.hasUserIndexOn( node.getAttribute() ) )
{
@@ -131,13 +131,13 @@
// If we do not have the attribute, loop through the sub classes of
// the attributeType. Perhaps the entry has an attribute value of a
// subtype (descendant) that will produce a match
- if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+ if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
{
// 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 =
- registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+ schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
do
{
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Sat Nov 7 07:57:34 2009
@@ -23,20 +23,20 @@
import java.util.Iterator;
import java.util.regex.Pattern;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
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.xdbm.search.Evaluator;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.shared.ldap.cursor.Cursor;
+import org.apache.directory.shared.ldap.entry.Value;
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.SchemaManager;
import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
-import org.apache.directory.shared.ldap.cursor.Cursor;
-import org.apache.directory.shared.ldap.entry.Value;
/**
@@ -50,8 +50,8 @@
/** Database used while evaluating candidates */
private final Store<ServerEntry> db;
- /** Oid Registry used to translate attributeIds to OIDs */
- private final Registries registries;
+ /** Reference to the SchemaManager */
+ private final SchemaManager schemaManager;
/** The Substring expression */
private final SubstringNode node;
@@ -74,14 +74,14 @@
* @param registries the set of registries
* @throws Exception if there are failures accessing resources and the db
*/
- public SubstringEvaluator( SubstringNode node, Store<ServerEntry> db, Registries registries ) throws Exception
+ public SubstringEvaluator( SubstringNode node, Store<ServerEntry> db, SchemaManager schemaManager ) throws Exception
{
this.db = db;
this.node = node;
- this.registries = registries;
+ this.schemaManager = schemaManager;
- String oid = registries.getAttributeTypeRegistry().getOidByName( node.getAttribute() );
- type = registries.getAttributeTypeRegistry().lookup( oid );
+ String oid = schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() );
+ type = schemaManager.lookupAttributeTypeRegistry( oid );
MatchingRule rule = type.getSubstring();
@@ -276,13 +276,13 @@
// If we do not have the attribute, loop through the descendant
// May be the node Attribute has descendant ?
- if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+ if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
{
// 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 =
- registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+ schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
while ( descendants.hasNext() )
{
@@ -371,13 +371,13 @@
// If we do not have the attribute, loop through the descendant
// May be the node Attribute has descendant ?
- if ( registries.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
+ if ( schemaManager.getAttributeTypeRegistry().hasDescendants( node.getAttribute() ) )
{
// 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 =
- registries.getAttributeTypeRegistry().descendants( node.getAttribute() );
+ schemaManager.getAttributeTypeRegistry().descendants( node.getAttribute() );
while ( descendants.hasNext() )
{
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java Sat Nov 7 07:57:34 2009
@@ -46,10 +46,7 @@
import org.apache.directory.shared.ldap.filter.PresenceNode;
import org.apache.directory.shared.ldap.filter.SubstringNode;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -74,10 +71,9 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
+ private static SchemaManager schemaManager;
@BeforeClass
public static void setup() throws Exception
@@ -96,26 +92,21 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( "collective" );
- registries = sm.getRegistries();
+ loaded = schemaManager.loadWithDeps( "collective" );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
- SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
- attributeRegistry = registries.getAttributeTypeRegistry();
}
public AndCursorTest() throws Exception
@@ -126,7 +117,7 @@
@Before
public void createStore() throws Exception
{
- destryStore();
+ destroyStore();
// setup the working directory for the store
wkdir = File.createTempFile( getClass().getSimpleName(), "db" );
@@ -140,12 +131,12 @@
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, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
- evaluatorBuilder = new EvaluatorBuilder( store, registries );
+ evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
LOG.debug( "Created new store" );
@@ -153,7 +144,7 @@
@After
- public void destryStore() throws Exception
+ public void destroyStore() throws Exception
{
if ( store != null )
{
@@ -213,7 +204,7 @@
Evaluator<? extends ExprNode, ServerEntry> eval;
ExprNode exprNode = new SubstringNode( "cn", "J", null );
- eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, registries );
+ eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
IndexCursor<?,ServerEntry> wrapped = new SubstringCursor( store, ( SubstringEvaluator ) eval );
/* adding this results in NPE adding Presence evaluator not
@@ -223,7 +214,7 @@
andNode.addNode( exprNode );
exprNode = new PresenceNode( "sn" );
- eval = new PresenceEvaluator( ( PresenceNode ) exprNode, store, registries );
+ eval = new PresenceEvaluator( ( PresenceNode ) exprNode, store, schemaManager );
evaluators.add( eval );
andNode.addNode( exprNode );
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/FilterNormalizingVisitor.java Sat Nov 7 07:57:34 2009
@@ -40,7 +40,7 @@
import org.apache.directory.shared.ldap.filter.SubstringNode;
import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,8 +70,8 @@
/** the name component normalizer used by this visitor */
private final NameComponentNormalizer ncn;
- /** the global registries used to resolve OIDs for attributeType ids */
- private final Registries registries;
+ /** the global schemaManager used to resolve OIDs for attributeType ids */
+ private final SchemaManager schemaManager;
/**
@@ -118,10 +118,10 @@
* @param ncn The name component normalizer to use
* @param registries The global registries
*/
- public FilterNormalizingVisitor( NameComponentNormalizer ncn, Registries registries )
+ public FilterNormalizingVisitor( NameComponentNormalizer ncn, SchemaManager schemaManager )
{
this.ncn = ncn;
- this.registries = registries;
+ this.schemaManager = schemaManager;
}
@@ -141,7 +141,7 @@
{
Value<?> normalized = null;
- AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( attribute );
+ AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( attribute );
if ( attributeType.getSyntax().isHumanReadable() )
{
@@ -175,7 +175,7 @@
{
try
{
- node.setAttribute( registries.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
+ node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
return node;
}
catch ( NamingException ne )
@@ -215,7 +215,7 @@
try
{
- node.setAttribute( registries.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
+ node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
node.setValue( normalized );
return node;
}
@@ -293,7 +293,7 @@
try
{
- node.setAttribute( registries.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
+ node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
if ( normInitial != null )
{
@@ -338,7 +338,7 @@
{
try
{
- node.setAttribute( registries.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
+ node.setAttribute( schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) );
return node;
}
catch ( NamingException ne )
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java Sat Nov 7 07:57:34 2009
@@ -49,12 +49,9 @@
import org.apache.directory.shared.ldap.schema.MatchingRule;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.SchemaUtils;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -79,8 +76,7 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
+ static SchemaManager schemaManager = null;
@BeforeClass
@@ -100,27 +96,21 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( loader.getSchema( "collective" ) );
+ loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
- registries = sm.getRegistries();
-
- SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
- attributeRegistry = registries.getAttributeTypeRegistry();
}
@@ -146,7 +136,7 @@
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.POSTALCODE_AT_OID ) );
- StoreUtils.loadExampleData( store, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
LOG.debug( "Created new store" );
}
@@ -172,9 +162,9 @@
@Test
public void testCursorIndexed() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
GreaterEqCursor cursor = new GreaterEqCursor( store, evaluator );
assertNotNull( cursor );
assertFalse( cursor.available() );
@@ -403,9 +393,9 @@
@Test
public void testCursorNotIndexed() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
GreaterEqCursor cursor = new GreaterEqCursor( store, evaluator );
assertNotNull( cursor );
assertFalse( cursor.available() );
@@ -560,9 +550,9 @@
@Test
public void testEvaluatorIndexed() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
@@ -605,9 +595,9 @@
@Test
public void testEvaluatorWithDescendantValue() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.STREET_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.STREET_AT_OID );
GreaterEqNode node = new GreaterEqNode( SchemaConstants.STREET_AT_OID, new ServerStringValue( at, "2" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() );
@@ -615,8 +605,8 @@
assertNotNull( evaluator.getComparator() );
LdapDN dn = new LdapDN( "cn=jane doe,o=good times co." );
- dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
- ServerEntry attrs = new DefaultServerEntry( registries, dn );
+ dn.normalize( schemaManager.getNormalizerMapping() );
+ ServerEntry attrs = new DefaultServerEntry( schemaManager, dn );
attrs.add( "objectClass", "person" );
attrs.add( "c-street", "3" );
attrs.add( "cn", "jane doe" );
@@ -633,10 +623,10 @@
@Test
public void testEvaluatorWithoutDescendants() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.C_POSTALCODE_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( 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 );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
@@ -651,10 +641,10 @@
@Test
public void testEvaluatorNotIndexed() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
GreaterEqNode node = new GreaterEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) );
- GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, registries );
+ GreaterEqEvaluator evaluator = new GreaterEqEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String, ServerEntry>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() );
@@ -702,8 +692,8 @@
at.setSchemaName( "other" );
at.setSyntax( new BogusSyntax( 1 ) );
- registries.getAttributeTypeRegistry().register( at );
- registries.getLdapSyntaxRegistry().register( at.getSyntax() );
+ schemaManager.register( at );
+ schemaManager.register( at.getSyntax() );
SyntaxCheckerDescription desc = new SyntaxCheckerDescription( at.getSyntax().getOid() );
desc.setDescription( "bogus" );
desc.setFqcn( BogusSyntax.class.getName() );
@@ -711,11 +701,11 @@
names.add( "bogus" );
desc.setNames( names );
desc.setObsolete( false );
- registries.getSyntaxCheckerRegistry().register( at.getSyntax().getSyntaxChecker() );
+ schemaManager.register( at.getSyntax().getSyntaxChecker() );
GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
- new GreaterEqEvaluator( node, store, registries );
- registries.getAttributeTypeRegistry().unregister( at.getOid() );
+ new GreaterEqEvaluator( node, store, schemaManager );
+ schemaManager.unregister( at );
}
@@ -732,8 +722,8 @@
at.setSyntax( new BogusSyntax( 2 ) );
at.setOrdering( mr );
- registries.getAttributeTypeRegistry().register( at );
- registries.getLdapSyntaxRegistry().register( at.getSyntax() );
+ schemaManager.register( at );
+ schemaManager.register( at.getSyntax() );
SyntaxCheckerDescription desc = new SyntaxCheckerDescription( at.getSyntax().getOid() );
desc.setDescription( "bogus" );
desc.setFqcn( BogusSyntax.class.getName() );
@@ -741,10 +731,10 @@
names.add( "bogus" );
desc.setNames( names );
desc.setObsolete( false );
- registries.getSyntaxCheckerRegistry().register( at.getSyntax().getSyntaxChecker() );
+ schemaManager.register( at.getSyntax().getSyntaxChecker() );
GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
- new GreaterEqEvaluator( node, store, registries );
- registries.getAttributeTypeRegistry().unregister( at.getOid() );
+ new GreaterEqEvaluator( node, store, schemaManager );
+ schemaManager.unregister( at );
}
}
\ No newline at end of file
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java Sat Nov 7 07:57:34 2009
@@ -49,12 +49,9 @@
import org.apache.directory.shared.ldap.schema.MatchingRule;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.SchemaUtils;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -79,8 +76,7 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
+ static SchemaManager schemaManager = null;
@BeforeClass
@@ -100,27 +96,21 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( loader.getSchema( "collective" ) );
+ loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
- registries = sm.getRegistries();
-
- SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
- attributeRegistry = registries.getAttributeTypeRegistry();
}
@@ -146,7 +136,7 @@
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.POSTALCODE_AT_OID ) );
- StoreUtils.loadExampleData( store, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
LOG.debug( "Created new store" );
}
@@ -172,9 +162,9 @@
@Test
public void testCursorIndexed() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
LessEqNode node = new LessEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
LessEqCursor cursor = new LessEqCursor( store, evaluator );
assertNotNull( cursor );
assertFalse( cursor.available() );
@@ -423,9 +413,9 @@
@Test
public void testCursorNotIndexed() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
LessEqNode node = new LessEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
LessEqCursor cursor = new LessEqCursor( store, evaluator );
assertNotNull( cursor );
assertFalse( cursor.available() );
@@ -600,10 +590,10 @@
@Test
public void testEvaluatorIndexed() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTALCODE_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTALCODE_AT_OID );
LessEqNode node = new LessEqNode( SchemaConstants.POSTALCODE_AT_OID, new ServerStringValue( at, "3" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
@@ -646,10 +636,10 @@
@Test
public void testEvaluatorWithDescendantValue() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.STREET_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.STREET_AT_OID );
LessEqNode node = new LessEqNode( SchemaConstants.STREET_AT_OID, new ServerStringValue( at, "2" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.STREET_AT_OID, evaluator.getAttributeType().getOid() );
@@ -657,8 +647,8 @@
assertNotNull( evaluator.getLdapComparator() );
LdapDN dn = new LdapDN( "cn=jane doe,o=good times co." );
- dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
- ServerEntry attrs = new DefaultServerEntry( registries, dn );
+ dn.normalize( schemaManager.getNormalizerMapping() );
+ ServerEntry attrs = new DefaultServerEntry( schemaManager, dn );
attrs.add( "objectClass", "person" );
attrs.add( "c-street", "1" );
attrs.add( "cn", "jane doe" );
@@ -675,10 +665,10 @@
@Test
public void testEvaluatorWithoutDescendants() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.C_POSTALCODE_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( 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 );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.C_POSTALCODE_AT_OID, evaluator.getAttributeType().getOid() );
@@ -693,10 +683,10 @@
@Test
public void testEvaluatorNotIndexed() throws Exception
{
- AttributeType at = attributeRegistry.lookup( SchemaConstants.POSTOFFICEBOX_AT_OID );
+ AttributeType at = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.POSTOFFICEBOX_AT_OID );
LessEqNode node = new LessEqNode( SchemaConstants.POSTOFFICEBOX_AT_OID, new ServerStringValue( at, "3" ) );
- LessEqEvaluator evaluator = new LessEqEvaluator( node, store, registries );
+ LessEqEvaluator evaluator = new LessEqEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
assertEquals( node, evaluator.getExpression() );
assertEquals( SchemaConstants.POSTOFFICEBOX_AT_OID, evaluator.getAttributeType().getOid() );
@@ -744,12 +734,12 @@
at.setSchemaName( "other" );
at.setSyntax( new BogusSyntax( 1 ) );
- registries.getAttributeTypeRegistry().register( at );
+ schemaManager.register( at );
LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
- new LessEqEvaluator( node, store, registries );
- registries.getAttributeTypeRegistry().unregister( at.getOid() );
+ new LessEqEvaluator( node, store, schemaManager );
+ schemaManager.unregister( at );
}
@@ -766,8 +756,8 @@
at.setSyntax( new BogusSyntax(3) );
at.setOrdering( mr );
- registries.getAttributeTypeRegistry().register( at );
- registries.getLdapSyntaxRegistry().register( at.getSyntax() );
+ schemaManager.register( at );
+ schemaManager.register( at.getSyntax() );
SyntaxCheckerDescription desc = new SyntaxCheckerDescription( at.getSyntax().getOid() );
desc.setDescription( "bogus" );
desc.setFqcn( BogusSyntax.class.getName() );
@@ -775,10 +765,10 @@
names.add( "bogus" );
desc.setNames( names );
desc.setObsolete( false );
- registries.getSyntaxCheckerRegistry().register( at.getSyntax().getSyntaxChecker() );
+ schemaManager.register( at.getSyntax().getSyntaxChecker() );
LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
- new LessEqEvaluator( node, store, registries );
- registries.getAttributeTypeRegistry().unregister( at.getOid() );
+ new LessEqEvaluator( node, store, schemaManager );
+ schemaManager.unregister( at );
}
}
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java Sat Nov 7 07:57:34 2009
@@ -40,11 +40,8 @@
import org.apache.directory.shared.ldap.filter.FilterParser;
import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
import org.apache.directory.shared.ldap.schema.normalizers.ConcreteNameComponentNormalizer;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -69,8 +66,7 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
+ static SchemaManager schemaManager = null;
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
Optimizer optimizer;
@@ -93,30 +89,24 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( loader.getSchema( "collective" ) );
+ loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- registries = sm.getRegistries();
-
- SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
- attributeRegistry = registries.getAttributeTypeRegistry();
-
- NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry );
- visitor = new FilterNormalizingVisitor( ncn, registries );
+ NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
+ visitor = new FilterNormalizingVisitor( ncn, schemaManager );
}
@@ -140,9 +130,9 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
- StoreUtils.loadExampleData( store, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
- evaluatorBuilder = new EvaluatorBuilder( store, registries );
+ evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
optimizer = new DefaultOptimizer( store );
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java Sat Nov 7 07:57:34 2009
@@ -43,10 +43,7 @@
import org.apache.directory.shared.ldap.filter.NotNode;
import org.apache.directory.shared.ldap.filter.SubstringNode;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -71,8 +68,7 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
+ static SchemaManager schemaManager = null;
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
@@ -93,27 +89,21 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( loader.getSchema( "collective" ) );
+ loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
- registries = sm.getRegistries();
-
- SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
- attributeRegistry = registries.getAttributeTypeRegistry();
}
@@ -137,9 +127,9 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
- StoreUtils.loadExampleData( store, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
- evaluatorBuilder = new EvaluatorBuilder( store, registries );
+ evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
LOG.debug( "Created new store" );
@@ -216,7 +206,7 @@
NotNode notNode = new NotNode();
ExprNode exprNode = new SubstringNode( "cn", "J", null );
- Evaluator<? extends ExprNode, ServerEntry> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, registries );
+ Evaluator<? extends ExprNode, ServerEntry> eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
notNode.addNode( exprNode );
NotCursor cursor = new NotCursor( store, eval ); //cursorBuilder.build( andNode );
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java Sat Nov 7 07:57:34 2009
@@ -47,10 +47,7 @@
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.SchemaUtils;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -75,8 +72,7 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
+ static SchemaManager schemaManager = null;
@BeforeClass
@@ -96,27 +92,21 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( loader.getSchema( "collective" ) );
+ loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
- registries = sm.getRegistries();
-
- SerializableComparator.setRegistry( sm.getRegistries().getComparatorRegistry() );
-
- attributeRegistry = registries.getAttributeTypeRegistry();
}
@@ -140,7 +130,7 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
- StoreUtils.loadExampleData( store, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
LOG.debug( "Created new store" );
}
@@ -681,9 +671,9 @@
SchemaConstants.OU_AT_OID + "=board of directors," +
SchemaConstants.O_AT_OID + "=good times co."
);
- dn.normalize( attributeRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
- ServerEntry attrs = new DefaultServerEntry( registries, dn );
+ ServerEntry attrs = new DefaultServerEntry( schemaManager, dn );
attrs.add( "objectClass", "alias", "extensibleObject" );
attrs.add( "cn", "jd" );
attrs.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
@@ -696,9 +686,9 @@
SchemaConstants.OU_AT_OID + "=board of directors," +
SchemaConstants.O_AT_OID + "=good times co."
);
- dn.normalize( attributeRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
- attrs = new DefaultServerEntry( registries, dn );
+ attrs = new DefaultServerEntry( schemaManager, dn );
attrs.add( "objectClass", "person" );
attrs.add( "cn", "jdoe" );
attrs.add( "sn", "doe" );
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java Sat Nov 7 07:57:34 2009
@@ -46,10 +46,7 @@
import org.apache.directory.shared.ldap.filter.OrNode;
import org.apache.directory.shared.ldap.filter.SubstringNode;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -78,8 +75,7 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
+ static SchemaManager schemaManager = null;
EvaluatorBuilder evaluatorBuilder;
CursorBuilder cursorBuilder;
@@ -99,27 +95,21 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( loader.getSchema( "collective" ) );
+ loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
- registries = sm.getRegistries();
-
- SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
- attributeRegistry = registries.getAttributeTypeRegistry();
}
@@ -143,9 +133,9 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
- StoreUtils.loadExampleData( store, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
- evaluatorBuilder = new EvaluatorBuilder( store, registries );
+ evaluatorBuilder = new EvaluatorBuilder( store, schemaManager );
cursorBuilder = new CursorBuilder( store, evaluatorBuilder );
LOG.debug( "Created new store" );
@@ -267,7 +257,7 @@
OrNode orNode = new OrNode();
ExprNode exprNode = new SubstringNode( "cn", "J", null );
- eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, registries );
+ eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
Cursor subStrCursor1 = new SubstringCursor( store, ( SubstringEvaluator ) eval );
cursors.add( subStrCursor1 );
evaluators.add( eval );
@@ -281,7 +271,7 @@
catch( IllegalArgumentException ie ){ }
exprNode = new SubstringNode( "sn", "W", null );
- eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, registries );
+ eval = new SubstringEvaluator( ( SubstringNode ) exprNode, store, schemaManager );
evaluators.add( eval );
Cursor subStrCursor2 = new SubstringCursor( store, ( SubstringEvaluator ) eval );
cursors.add( subStrCursor2 );
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java Sat Nov 7 07:57:34 2009
@@ -38,10 +38,7 @@
import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
import org.apache.directory.shared.ldap.filter.PresenceNode;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -65,8 +62,7 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
+ static SchemaManager schemaManager = null;
@BeforeClass
@@ -85,27 +81,21 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( loader.getSchema( "collective" ) );
+ loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
- registries = sm.getRegistries();
-
- SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
- attributeRegistry = registries.getAttributeTypeRegistry();
}
@@ -129,7 +119,7 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
- StoreUtils.loadExampleData( store, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
LOG.debug( "Created new store" );
}
@@ -156,7 +146,7 @@
public void testIndexedServerEntry() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.CN_AT_OID );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, registries );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
PresenceCursor cursor = new PresenceCursor( store, evaluator );
assertEquals( node, evaluator.getExpression() );
@@ -224,7 +214,7 @@
assertEquals( SchemaConstants.CN_AT_OID, cursor.get().getValue() );
node = new PresenceNode( SchemaConstants.OU_AT_OID );
- evaluator = new PresenceEvaluator( node, store, registries );
+ evaluator = new PresenceEvaluator( node, store, schemaManager );
cursor = new PresenceCursor( store, evaluator );
assertTrue( cursor.isElementReused() );
@@ -270,7 +260,7 @@
public void testNonIndexedServerEntry() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.SN_AT_OID );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, registries );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
PresenceCursor cursor = new PresenceCursor( store, evaluator );
assertEquals( node, evaluator.getExpression() );
@@ -331,7 +321,7 @@
// ----------- organizationName attribute
node = new PresenceNode( SchemaConstants.O_AT_OID );
- evaluator = new PresenceEvaluator( node, store, registries );
+ evaluator = new PresenceEvaluator( node, store, schemaManager );
cursor = new PresenceCursor( store, evaluator );
assertTrue( cursor.isElementReused() );
@@ -353,7 +343,7 @@
public void testEvaluatorIndexed() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.CN_AT_OID );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, registries );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> entry = new ForwardIndexEntry<String,ServerEntry>();
entry.setValue( SchemaConstants.CN_AT_OID );
entry.setId( ( long ) 3 );
@@ -369,7 +359,7 @@
public void testEvaluatorNotIndexed() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.NAME_AT_OID );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, registries );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> entry = new ForwardIndexEntry<String,ServerEntry>();
entry.setValue( SchemaConstants.NAME_AT_OID );
entry.setId( ( long ) 3 );
@@ -380,7 +370,7 @@
assertTrue( evaluator.evaluate( entry ) );
node = new PresenceNode( SchemaConstants.SEARCHGUIDE_AT_OID );
- evaluator = new PresenceEvaluator( node, store, registries );
+ evaluator = new PresenceEvaluator( node, store, schemaManager );
entry = new ForwardIndexEntry<String,ServerEntry>();
entry.setValue( SchemaConstants.SEARCHGUIDE_AT_OID );
entry.setId( ( long ) 3 );
@@ -392,7 +382,7 @@
assertFalse( evaluator.evaluate( entry ) );
node = new PresenceNode( SchemaConstants.ST_AT_OID );
- evaluator = new PresenceEvaluator( node, store, registries );
+ evaluator = new PresenceEvaluator( node, store, schemaManager );
entry = new ForwardIndexEntry<String,ServerEntry>();
entry.setValue( SchemaConstants.ST_AT_OID );
entry.setId( ( long ) 3 );
@@ -409,7 +399,7 @@
public void testInvalidCursorPositionException() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.SN_AT_OID );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, registries );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
PresenceCursor cursor = new PresenceCursor( store, evaluator );
cursor.get();
}
@@ -419,7 +409,7 @@
public void testInvalidCursorPositionException2() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.CN_AT_OID );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, registries );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
PresenceCursor cursor = new PresenceCursor( store, evaluator );
cursor.get();
}
@@ -429,7 +419,7 @@
public void testUnsupportBeforeWithoutIndex() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.SN_AT_OID );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, registries );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
PresenceCursor cursor = new PresenceCursor( store, evaluator );
// test before()
@@ -443,7 +433,7 @@
public void testUnsupportAfterWithoutIndex() throws Exception
{
PresenceNode node = new PresenceNode( SchemaConstants.SN_AT_OID );
- PresenceEvaluator evaluator = new PresenceEvaluator( node, store, registries );
+ PresenceEvaluator evaluator = new PresenceEvaluator( node, store, schemaManager );
PresenceCursor cursor = new PresenceCursor( store, evaluator );
// test before()
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java Sat Nov 7 07:57:34 2009
@@ -38,10 +38,7 @@
import org.apache.directory.shared.ldap.cursor.InvalidCursorPositionException;
import org.apache.directory.shared.ldap.filter.SubstringNode;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -65,8 +62,7 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
+ static SchemaManager schemaManager = null;
@BeforeClass
@@ -85,27 +81,21 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( loader.getSchema( "collective" ) );
+ loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
- registries = sm.getRegistries();
-
- SerializableComparator.setRegistry( registries.getComparatorRegistry() );
-
- attributeRegistry = registries.getAttributeTypeRegistry();
}
@@ -129,7 +119,7 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
- StoreUtils.loadExampleData( store, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
LOG.debug( "Created new store" );
}
@@ -156,7 +146,7 @@
public void testIndexedCnStartsWithJ() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.CN_AT_OID, "j", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
SubstringCursor cursor = new SubstringCursor( store, evaluator );
assertEquals( node, evaluator.getExpression() );
@@ -309,7 +299,7 @@
public void testIndexedCnStartsWithJim() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.CN_AT_OID, "jim", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
SubstringCursor cursor = new SubstringCursor( store, evaluator );
assertEquals( node, evaluator.getExpression() );
@@ -402,7 +392,7 @@
public void testIndexedCnEndsWithBean() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.CN_AT_OID, null, "bean" );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
SubstringCursor cursor = new SubstringCursor( store, evaluator );
assertEquals( node, evaluator.getExpression() );
@@ -495,7 +485,7 @@
public void testNonIndexedSnStartsWithB() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, "b", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
SubstringCursor cursor = new SubstringCursor( store, evaluator );
assertEquals( node, evaluator.getExpression() );
@@ -558,7 +548,7 @@
public void testIndexedSnEndsWithEr() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, null, "er" );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
SubstringCursor cursor = new SubstringCursor( store, evaluator );
assertEquals( node, evaluator.getExpression() );
@@ -620,7 +610,7 @@
public void testNonIndexedAttributes() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, "walk", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
indexEntry.setId( 5L );
assertTrue( evaluator.evaluate( indexEntry ) );
@@ -632,35 +622,35 @@
assertFalse( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( SchemaConstants.SN_AT_OID, "wa", null );
- evaluator = new SubstringEvaluator( node, store, registries );
+ evaluator = new SubstringEvaluator( node, store, schemaManager );
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, registries );
+ evaluator = new SubstringEvaluator( node, store, schemaManager );
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, registries );
+ evaluator = new SubstringEvaluator( node, store, schemaManager );
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, registries );
+ evaluator = new SubstringEvaluator( node, store, schemaManager );
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, registries );
+ evaluator = new SubstringEvaluator( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String,ServerEntry>();
indexEntry.setId( 6L );
indexEntry.setObject( store.lookup( 6L ) );
@@ -672,7 +662,7 @@
public void testEvaluatorIndexed() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.CN_AT_OID, "jim", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
ForwardIndexEntry<String,ServerEntry> indexEntry = new ForwardIndexEntry<String,ServerEntry>();
indexEntry.setId( 6L );
assertTrue( evaluator.evaluate( indexEntry ) );
@@ -681,14 +671,14 @@
assertFalse( evaluator.evaluate( indexEntry ) );
node = new SubstringNode( SchemaConstants.CN_AT_OID, "j", null );
- evaluator = new SubstringEvaluator( node, store, registries );
+ evaluator = new SubstringEvaluator( node, store, schemaManager );
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, registries );
+ evaluator = new SubstringEvaluator( node, store, schemaManager );
indexEntry = new ForwardIndexEntry<String,ServerEntry>();
indexEntry.setId( 6L );
indexEntry.setObject( store.lookup( 6L ) );
@@ -706,7 +696,7 @@
public void testInvalidCursorPositionException() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, "b", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
SubstringCursor cursor = new SubstringCursor( store, evaluator );
cursor.get();
}
@@ -716,7 +706,7 @@
public void testInvalidCursorPositionException2() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.CN_AT_OID, "j", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
SubstringCursor cursor = new SubstringCursor( store, evaluator );
cursor.get();
}
@@ -726,7 +716,7 @@
public void testUnsupportBeforeWithoutIndex() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, "j", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
SubstringCursor cursor = new SubstringCursor( store, evaluator );
// test before()
@@ -740,7 +730,7 @@
public void testUnsupportAfterWithoutIndex() throws Exception
{
SubstringNode node = new SubstringNode( SchemaConstants.SN_AT_OID, "j", null );
- SubstringEvaluator evaluator = new SubstringEvaluator( node, store, registries );
+ SubstringEvaluator evaluator = new SubstringEvaluator( node, store, schemaManager );
SubstringCursor cursor = new SubstringCursor( store, evaluator );
// test before()
Modified: directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java Sat Nov 7 07:57:34 2009
@@ -49,8 +49,6 @@
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.SchemaUtils;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.schema.DefaultSchemaManager;
import org.apache.directory.shared.schema.loader.ldif.LdifSchemaLoader;
@@ -75,8 +73,7 @@
File wkdir;
Store<ServerEntry> store;
- static Registries registries = null;
- static AttributeTypeRegistry attributeRegistry;
+ static SchemaManager schemaManager = null;
@BeforeClass
@@ -95,25 +92,21 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
LdifSchemaLoader loader = new LdifSchemaLoader( schemaRepository );
- SchemaManager sm = new DefaultSchemaManager( loader );
+ schemaManager = new DefaultSchemaManager( loader );
- boolean loaded = sm.loadAllEnabled();
+ boolean loaded = schemaManager.loadAllEnabled();
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
- loaded = sm.loadWithDeps( loader.getSchema( "collective" ) );
+ loaded = schemaManager.loadWithDeps( loader.getSchema( "collective" ) );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
-
- registries = sm.getRegistries();
-
- attributeRegistry = registries.getAttributeTypeRegistry();
}
@@ -137,7 +130,7 @@
store.addIndex( new JdbmIndex( SchemaConstants.OU_AT_OID ) );
store.addIndex( new JdbmIndex( SchemaConstants.CN_AT_OID ) );
- StoreUtils.loadExampleData( store, registries );
+ StoreUtils.loadExampleData( store, schemaManager );
LOG.debug( "Created new store" );
}
@@ -645,9 +638,9 @@
SchemaConstants.OU_AT_OID + "=board of directors," +
SchemaConstants.O_AT_OID + "=good times co."
);
- dn.normalize( attributeRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
- ServerEntry attrs = new DefaultServerEntry( registries, dn );
+ ServerEntry attrs = new DefaultServerEntry( schemaManager, dn );
attrs.add( "objectClass", "alias", "extensibleObject" );
attrs.add( "cn", "jd" );
attrs.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
@@ -660,9 +653,9 @@
SchemaConstants.OU_AT_OID + "=board of directors," +
SchemaConstants.O_AT_OID + "=good times co."
);
- dn.normalize( attributeRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
- attrs = new DefaultServerEntry( registries, dn );
+ attrs = new DefaultServerEntry( schemaManager, dn );
attrs.add( "objectClass", "person" );
attrs.add( "cn", "jdoe" );
attrs.add( "sn", "doe" );