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 [9/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/par...
Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java Sat Nov 7 07:57:34 2009
@@ -20,6 +20,13 @@
package org.apache.directory.server.core.sp;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.entry.ClonedServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
@@ -34,13 +41,6 @@
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
-import javax.naming.NamingException;
-import javax.naming.directory.SearchControls;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
/**
* A Factory type class which holds a registry of supported {@link StoredProcEngineConfig}s. A container reference
@@ -87,7 +87,7 @@
String spUnitName = StoredProcUtils.extractStoredProcUnitName( fullSPName );
AttributeType at = session.getDirectoryService()
- .getRegistries().getAttributeTypeRegistry().lookup( "storedProcUnitName" );
+ .getSchemaManager().lookupAttributeTypeRegistry( "storedProcUnitName" );
ExprNode filter = new EqualityNode<String>( "storedProcUnitName", new ServerStringValue( at, spUnitName ) );
LdapDN dn = new LdapDN( storedProcContainer );
EntryFilteringCursor results = session.search( dn, SearchScope.SUBTREE, filter,
Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Sat Nov 7 07:57:34 2009
@@ -77,10 +77,9 @@
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser;
import org.slf4j.Logger;
@@ -126,10 +125,7 @@
private PartitionNexus nexus;
/** The global registries */
- private Registries registries;
-
- /** The AttributeType registry */
- private AttributeTypeRegistry atRegistry;
+ private SchemaManager schemaManager;
/** The OID registry */
private OidRegistry oidRegistry;
@@ -141,21 +137,20 @@
{
super.init( directoryService );
nexus = directoryService.getPartitionNexus();
- registries = directoryService.getRegistries();
- atRegistry = registries.getAttributeTypeRegistry();
- oidRegistry = registries.getOidRegistry();
+ schemaManager = directoryService.getSchemaManager();
+ oidRegistry = schemaManager.getOidRegistry();
// setup various attribute type values
- objectClassType = atRegistry.lookup( atRegistry.getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
+ objectClassType = schemaManager.lookupAttributeTypeRegistry( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
ssParser = new SubtreeSpecificationParser( new NormalizerMappingResolver()
{
public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
{
- return atRegistry.getNormalizerMapping();
+ return schemaManager.getNormalizerMapping();
}
- }, atRegistry.getNormalizerMapping() );
- evaluator = new SubtreeEvaluator( oidRegistry, atRegistry );
+ }, schemaManager.getNormalizerMapping() );
+ evaluator = new SubtreeEvaluator( oidRegistry, schemaManager );
// prepare to find all subentries in all namingContexts
Set<String> suffixes = this.nexus.listSuffixes( null );
@@ -170,10 +165,10 @@
for ( String suffix:suffixes )
{
LdapDN suffixDn = new LdapDN( suffix );
- suffixDn.normalize( atRegistry.getNormalizerMapping() );
+ suffixDn.normalize( schemaManager.getNormalizerMapping() );
LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
- adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ adminDn.normalize( schemaManager.getNormalizerMapping() );
CoreSession adminSession = new DefaultCoreSession(
new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
@@ -198,7 +193,7 @@
continue;
}
- dnName.normalize( atRegistry.getNormalizerMapping() );
+ dnName.normalize( schemaManager.getNormalizerMapping() );
subentryCache.setSubentry( dnName.toString(), ss, getSubentryTypes( subentry ) );
}
}
@@ -327,7 +322,7 @@
*/
public ServerEntry getSubentryAttributes( LdapDN dn, ServerEntry entryAttrs ) throws Exception
{
- ServerEntry subentryAttrs = new DefaultServerEntry( registries, dn );
+ ServerEntry subentryAttrs = new DefaultServerEntry( schemaManager, dn );
Iterator<String> list = subentryCache.nameIterator();
while ( list.hasNext() )
@@ -350,7 +345,7 @@
if ( operational == null )
{
operational = new DefaultServerAttribute( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
+ schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
subentryAttrs.put( operational );
}
@@ -362,8 +357,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, atRegistry
- .lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
subentryAttrs.put( operational );
}
@@ -376,7 +371,7 @@
if ( operational == null )
{
operational = new DefaultServerAttribute( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
+ schemaManager.lookupAttributeTypeRegistry( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
subentryAttrs.put( operational );
}
@@ -389,7 +384,7 @@
if ( operational == null )
{
operational = new DefaultServerAttribute( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
+ schemaManager.lookupAttributeTypeRegistry( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
subentryAttrs.put( operational );
}
@@ -487,7 +482,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
@@ -523,8 +518,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( atRegistry
- .lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
entry.put( operational );
}
@@ -537,8 +532,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( atRegistry
- .lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
+ operational = new DefaultServerAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
entry.put( operational );
}
@@ -551,8 +546,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( atRegistry
- .lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
entry.put( operational );
}
@@ -565,8 +560,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( atRegistry
- .lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
entry.put( operational );
}
@@ -612,7 +607,7 @@
LdapDN baseDn = ( LdapDN ) apName.clone();
baseDn.addAll( ss.getBase() );
- ExprNode filter = new PresenceNode( atRegistry.getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
+ ExprNode filter = new PresenceNode( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
@@ -625,7 +620,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = new LdapDN( candidate.getDn() );
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
@@ -734,8 +729,8 @@
for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
- ServerAttribute opAttr = new DefaultServerAttribute( aSUBENTRY_OPATTRS, atRegistry
- .lookup( aSUBENTRY_OPATTRS ) );
+ ServerAttribute opAttr = new DefaultServerAttribute( aSUBENTRY_OPATTRS, schemaManager
+ .lookupAttributeTypeRegistry( aSUBENTRY_OPATTRS ) );
opAttr.add( subentryDn );
modList.add( new ServerModification( op, opAttr ) );
}
@@ -773,7 +768,7 @@
next.rename( opContext );
subentry = subentryCache.getSubentry( newNormName );
- ExprNode filter = new PresenceNode( atRegistry.getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
+ ExprNode filter = new PresenceNode( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
@@ -785,7 +780,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
@@ -848,7 +843,7 @@
subentry = subentryCache.getSubentry( newNormName );
- ExprNode filter = new PresenceNode( atRegistry.getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
+ ExprNode filter = new PresenceNode( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
@@ -860,7 +855,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
@@ -884,7 +879,7 @@
// attributes contained within this regular entry with name changes
LdapDN newName = ( LdapDN ) parent.clone();
newName.add( opContext.getNewRdn() );
- newName.normalize( atRegistry.getNormalizerMapping() );
+ newName.normalize( schemaManager.getNormalizerMapping() );
List<Modification> mods = getModsOnEntryRdnChange( oriChildName, newName, entry );
if ( mods.size() > 0 )
@@ -934,7 +929,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
@@ -1005,7 +1000,7 @@
}
}
- ServerEntry attrs = new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN );
+ ServerEntry attrs = new DefaultServerEntry( schemaManager, LdapDN.EMPTY_LDAPDN );
attrs.put( ocFinalState );
return getSubentryTypes( attrs );
}
@@ -1056,7 +1051,7 @@
apName.remove( apName.size() - 1 );
LdapDN oldBaseDn = ( LdapDN ) apName.clone();
oldBaseDn.addAll( ssOld.getBase() );
- ExprNode filter = new PresenceNode( atRegistry.getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
+ ExprNode filter = new PresenceNode( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
@@ -1068,7 +1063,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ssOld, apName, dn, candidate ) )
{
@@ -1089,7 +1084,7 @@
{
ServerEntry candidate = subentries.get();
LdapDN dn = candidate.getDn();
- dn.normalize( atRegistry.getNormalizerMapping() );
+ dn.normalize( schemaManager.getNormalizerMapping() );
if ( evaluator.evaluate( ssNew, apName, dn, candidate ) )
{
@@ -1134,8 +1129,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT, atRegistry
- .lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT, schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1153,8 +1148,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, atRegistry
- .lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
operational.add( newName.toString() );
}
else
@@ -1173,7 +1168,7 @@
if ( operational == null )
{
operational = new DefaultServerAttribute( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
+ schemaManager.lookupAttributeTypeRegistry( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1191,8 +1186,8 @@
if ( operational == null )
{
- operational = new DefaultServerAttribute( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT, atRegistry
- .lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT, schemaManager
+ .lookupAttributeTypeRegistry( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1218,7 +1213,7 @@
*/
private ServerEntry getSubentryOperatationalAttributes( LdapDN name, Subentry subentry ) throws Exception
{
- ServerEntry operational = new DefaultServerEntry( registries, name );
+ ServerEntry operational = new DefaultServerEntry( schemaManager, name );
if ( subentry.isAccessControlSubentry() )
{
@@ -1294,7 +1289,7 @@
if ( ( opAttr != null ) && opAttr.contains( dn ) )
{
- AttributeType attributeType = atRegistry.lookup( opAttrId );
+ AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( opAttrId );
ServerAttribute attr = new DefaultServerAttribute( opAttrId, attributeType, dn );
modList.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attr ) );
}
@@ -1379,7 +1374,7 @@
}
LdapDN ndn = new LdapDN( dn );
- ndn.normalize( atRegistry.getNormalizerMapping() );
+ ndn.normalize( schemaManager.getNormalizerMapping() );
String normalizedDn = ndn.toString();
return !subentryCache.hasSubentry( normalizedDn );
}
@@ -1411,7 +1406,7 @@
}
LdapDN ndn = new LdapDN( dn );
- ndn.normalize( atRegistry.getNormalizerMapping() );
+ ndn.normalize( schemaManager.getNormalizerMapping() );
return subentryCache.hasSubentry( ndn.toNormName() );
}
}
@@ -1466,7 +1461,7 @@
for ( String attribute : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
- AttributeType type = atRegistry.lookup( attribute );
+ AttributeType type = schemaManager.lookupAttributeTypeRegistry( attribute );
ServerAttribute opAttr = new DefaultServerAttribute( attribute, type );
opAttr.add( subentryDn );
modList.add( new ServerModification( op, opAttr ) );
Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java Sat Nov 7 07:57:34 2009
@@ -29,7 +29,7 @@
import org.apache.directory.server.core.event.Evaluator;
import org.apache.directory.server.core.event.ExpressionEvaluator;
import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
import org.apache.directory.shared.ldap.util.NamespaceTools;
@@ -56,9 +56,9 @@
* @param attrRegistry registry to be looked up
* @throws NamingException
*/
- public SubtreeEvaluator( OidRegistry oidRegistry, AttributeTypeRegistry attrRegistry )
+ public SubtreeEvaluator( OidRegistry oidRegistry, SchemaManager schemaManager )
{
- evaluator = new ExpressionEvaluator(oidRegistry, attrRegistry );
+ evaluator = new ExpressionEvaluator( oidRegistry, schemaManager );
}
Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Sat Nov 7 07:57:34 2009
@@ -54,8 +54,8 @@
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.trigger.ActionTime;
import org.apache.directory.shared.ldap.trigger.LdapOperation;
import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
@@ -229,13 +229,14 @@
super.init( directoryService );
triggerSpecCache = new TriggerSpecCache( directoryService );
- final AttributeTypeRegistry attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
+ final SchemaManager schemaManager = directoryService.getSchemaManager();
+
triggerParser = new TriggerSpecificationParser
( new NormalizerMappingResolver()
{
public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
{
- return attrRegistry.getNormalizerMapping();
+ return schemaManager.getNormalizerMapping();
}
}
);
Modified: directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Sat Nov 7 07:57:34 2009
@@ -54,8 +54,8 @@
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
import org.slf4j.Logger;
@@ -95,12 +95,13 @@
public TriggerSpecCache( DirectoryService directoryService ) throws Exception
{
this.nexus = directoryService.getPartitionNexus();
- final AttributeTypeRegistry registry = directoryService.getRegistries().getAttributeTypeRegistry();
+ final SchemaManager schemaManager = directoryService.getSchemaManager();
+
triggerSpecParser = new TriggerSpecificationParser( new NormalizerMappingResolver()
{
public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
{
- return registry.getNormalizerMapping();
+ return schemaManager.getNormalizerMapping();
}
});
initialize( directoryService );
@@ -123,7 +124,7 @@
ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
- adminDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+ adminDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
CoreSession adminSession = new DefaultCoreSession(
new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
EntryFilteringCursor results = nexus.search( new SearchOperationContext(
@@ -141,8 +142,8 @@
continue;
}
- LdapDN normSubentryName = subentryDn.normalize( directoryService.getRegistries()
- .getAttributeTypeRegistry().getNormalizerMapping() );
+ LdapDN normSubentryName = subentryDn.normalize( directoryService.getSchemaManager()
+ .getNormalizerMapping() );
subentryAdded( normSubentryName, resultEntry );
}
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java Sat Nov 7 07:57:34 2009
@@ -27,14 +27,15 @@
import javax.naming.NamingException;
-import org.apache.directory.server.core.authz.support.ACITupleFilter;
import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.LdapSyntax;
import org.apache.directory.shared.ldap.schema.MatchingRule;
import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.schema.LdapSyntax;
+import org.apache.directory.shared.ldap.schema.SchemaObjectType;
import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimToLowerNormalizer;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.schema.registries.DefaultSchemaObjectRegistry;
import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
@@ -45,14 +46,14 @@
* @version $Rev$, $Date$
*
*/
-public class DummyAttributeTypeRegistry extends AttributeTypeRegistry
+public class DummyAttributeTypeRegistry extends DefaultSchemaObjectRegistry<AttributeType> implements AttributeTypeRegistry, Cloneable
{
private final boolean returnOperational;
public DummyAttributeTypeRegistry(boolean returnOperational)
{
- super( new OidRegistry() );
+ super( SchemaObjectType.ATTRIBUTE_TYPE, new OidRegistry() );
this.returnOperational = returnOperational;
}
@@ -144,4 +145,21 @@
{
return null;
}
-}
+
+
+ public void unregisterDescendants( AttributeType attributeType, AttributeType ancestor )
+ throws NamingException
+ {
+ }
+
+
+ public void registerDescendants( AttributeType attributeType, AttributeType ancestor )
+ throws NamingException
+ {
+ }
+
+
+ public void addMappingFor( AttributeType attributeType ) throws NamingException
+ {
+ }
+}
\ No newline at end of file
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java Sat Nov 7 07:57:34 2009
@@ -20,6 +20,23 @@
package org.apache.directory.server.core.authz.support;
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.Control;
+import javax.naming.ldap.LdapContext;
+
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DefaultCoreSession;
import org.apache.directory.server.core.DefaultDirectoryService;
@@ -33,8 +50,8 @@
import org.apache.directory.server.core.entry.DefaultServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.event.EventService;
-import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.filtering.BaseEntryFilteringCursor;
+import org.apache.directory.server.core.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.interceptor.Interceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -56,8 +73,8 @@
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
import org.apache.directory.server.core.journal.Journal;
-import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.DefaultPartitionNexus;
+import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.replication.ReplicationConfiguration;
import org.apache.directory.server.core.schema.SchemaService;
import org.apache.directory.shared.ldap.NotImplementedException;
@@ -73,25 +90,10 @@
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.ldif.LdifEntry;
import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.registries.Registries;
-
-import javax.naming.NamingException;
-import javax.naming.ldap.Control;
-import javax.naming.ldap.LdapContext;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import org.junit.Test;
import org.junit.BeforeClass;
-import static org.junit.Assert.assertEquals;
+import org.junit.Test;
/**
@@ -123,7 +125,7 @@
ENTRY_NAME = new LdapDN( "ou=test, ou=system" );
PROTECTED_ITEMS.add( new ProtectedItem.MaxImmSub( 2 ) );
- ENTRY = new DefaultServerEntry( service.getRegistries(), ENTRY_NAME );
+ ENTRY = new DefaultServerEntry( service.getSchemaManager(), ENTRY_NAME );
}
@@ -518,7 +520,7 @@
}
- public Registries getRegistries()
+ public SchemaManager getSchemaManager()
{
return null;
}
@@ -874,6 +876,12 @@
// TODO Auto-generated method stub
return null;
}
+
+ public void setSchemaManager( SchemaManager schemaManager )
+ {
+ // TODO Auto-generated method stub
+
+ }
}
@@ -1043,7 +1051,7 @@
public ServerEntry get() throws Exception
{
- return new DefaultServerEntry( service.getRegistries() );
+ return new DefaultServerEntry( service.getSchemaManager() );
}
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/MaxValueCountFilterTest.java Sat Nov 7 07:57:34 2009
@@ -41,7 +41,6 @@
import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-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.JarLdifSchemaLoader;
@@ -76,31 +75,29 @@
}
- /** A reference to the registries */
- private static Registries registries;
+ /** A reference to the schemaManager */
+ private static SchemaManager schemaManager;
@BeforeClass public static void init() throws Exception
{
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
- 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() ) );
}
-
- registries = sm.getRegistries();
}
@Before public void setup() throws NamingException
{
LdapDN entryName = new LdapDN( "ou=test, ou=system" );
- ENTRY = new DefaultServerEntry( registries, entryName );
- FULL_ENTRY = new DefaultServerEntry( registries, entryName );
+ ENTRY = new DefaultServerEntry( schemaManager, entryName );
+ FULL_ENTRY = new DefaultServerEntry( schemaManager, entryName );
ENTRY.put( "cn", "1" );
FULL_ENTRY.put( "cn", "1", "2", "3" );
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilterTest.java Sat Nov 7 07:57:34 2009
@@ -50,9 +50,7 @@
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
-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.JarLdifSchemaLoader;
@@ -77,9 +75,9 @@
private static Set<LdapDN> USER_NAMES = new HashSet<LdapDN>();
private static Set<LdapDN> GROUP_NAMES = new HashSet<LdapDN>();
- private static Registries registries;
- private static AttributeTypeRegistry atRegistryA;
- private static AttributeTypeRegistry atRegistryB;
+ private static SchemaManager schemaManager;
+ //private static AttributeTypeRegistry atRegistryA;
+ //private static AttributeTypeRegistry atRegistryB;
private static OidRegistry OID_REGISTRY;
private static RelatedProtectedItemFilter filterA;
@@ -93,34 +91,29 @@
{
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
- 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() ) );
}
- registries = sm.getRegistries();
-
- OID_REGISTRY = registries.getOidRegistry();
+ OID_REGISTRY = schemaManager.getOidRegistry();
GROUP_NAME = new LdapDN( "ou=test,ou=groups,ou=system" );
USER_NAME = new LdapDN( "ou=test, ou=users, ou=system" );
- atRegistryA = registries.getAttributeTypeRegistry();
- atRegistryB = registries.getAttributeTypeRegistry();
-
filterA = new RelatedProtectedItemFilter( new RefinementEvaluator( new RefinementLeafEvaluator(
- OID_REGISTRY ) ), new ExpressionEvaluator( OID_REGISTRY, atRegistryA ), OID_REGISTRY, atRegistryA );
+ OID_REGISTRY ) ), new ExpressionEvaluator( OID_REGISTRY, schemaManager ), OID_REGISTRY, schemaManager );
filterB = new RelatedProtectedItemFilter( new RefinementEvaluator( new RefinementLeafEvaluator(
- OID_REGISTRY ) ), new ExpressionEvaluator( OID_REGISTRY, atRegistryB ), OID_REGISTRY, atRegistryB );
+ OID_REGISTRY ) ), new ExpressionEvaluator( OID_REGISTRY, schemaManager ), OID_REGISTRY, schemaManager );
USER_NAMES.add( USER_NAME );
GROUP_NAMES.add( GROUP_NAME );
- CN_AT = registries.getAttributeTypeRegistry().lookup( "cn" );
+ CN_AT = schemaManager.lookupAttributeTypeRegistry( "cn" );
}
@@ -338,7 +331,7 @@
attrTypes.add( "cn" );
Collection<ACITuple> tuples = getTuples( new ProtectedItem.SelfValue( attrTypes ) );
- ServerEntry entry = new DefaultServerEntry( registries, USER_NAME );
+ ServerEntry entry = new DefaultServerEntry( schemaManager, USER_NAME );
entry.put( "cn", USER_NAME.toNormName() );
// Test wrong scope
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilterTest.java Sat Nov 7 07:57:34 2009
@@ -37,6 +37,8 @@
import org.apache.directory.shared.ldap.aci.UserClass;
import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.schema.DefaultSchemaManager;
+import org.junit.BeforeClass;
import org.junit.Test;
@@ -53,18 +55,19 @@
private static final Set<MicroOperation> EMPTY_MICRO_OPERATION_SET = Collections.unmodifiableSet( new HashSet<MicroOperation>() );
- private static final LdapDN GROUP_NAME;
- private static final LdapDN USER_NAME;
+ private static LdapDN GROUP_NAME;
+ private static LdapDN USER_NAME;
private static final Set<LdapDN> USER_NAMES = new HashSet<LdapDN>();
private static final Set<LdapDN> GROUP_NAMES = new HashSet<LdapDN>();
- private static final SubtreeEvaluator SUBTREE_EVALUATOR;
+ private static SubtreeEvaluator SUBTREE_EVALUATOR;
- private static final RelatedUserClassFilter filter;
+ private static RelatedUserClassFilter filter;
- static
+ @BeforeClass
+ public static void init() throws Exception
{
- SUBTREE_EVALUATOR = new SubtreeEvaluator( new DummyOidRegistry(), new DummyAttributeTypeRegistry(true) );
+ SUBTREE_EVALUATOR = new SubtreeEvaluator( new DummyOidRegistry(), new DefaultSchemaManager( null ) );
filter = new RelatedUserClassFilter( SUBTREE_EVALUATOR );
try
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/authz/support/RestrictedByFilterTest.java Sat Nov 7 07:57:34 2009
@@ -40,7 +40,6 @@
import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.SchemaManager;
-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.JarLdifSchemaLoader;
@@ -72,28 +71,26 @@
}
- /** A reference to the registries */
- private static Registries registries;
+ /** A reference to the schemaManager */
+ private static SchemaManager schemaManager;
@BeforeClass public static void setup() throws Exception
{
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
- 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() ) );
}
- registries = sm.getRegistries();
-
LdapDN entryName = new LdapDN( "ou=test, ou=system" );
PROTECTED_ITEMS.add( new ProtectedItem.MaxImmSub( 2 ) );
- ENTRY = new DefaultServerEntry( registries, entryName );
+ ENTRY = new DefaultServerEntry( schemaManager, entryName );
ENTRY.put( "cn", "1", "2" );
}
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java Sat Nov 7 07:57:34 2009
@@ -20,6 +20,19 @@
package org.apache.directory.server.core.interceptor;
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
+
import org.apache.directory.server.core.CoreSession;
import org.apache.directory.server.core.DefaultCoreSession;
import org.apache.directory.server.core.DirectoryService;
@@ -33,31 +46,19 @@
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.journal.Journal;
import org.apache.directory.server.core.partition.ByPassConstants;
-import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.DefaultPartitionNexus;
+import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.replication.ReplicationConfiguration;
import org.apache.directory.server.core.schema.SchemaService;
import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.csn.Csn;
import org.apache.directory.shared.ldap.ldif.LdifEntry;
import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
-
-
-import javax.naming.NamingException;
-import javax.naming.ldap.LdapContext;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
/**
@@ -325,7 +326,7 @@
}
- public Registries getRegistries()
+ public SchemaManager getSchemaManager()
{
return null;
}
@@ -700,5 +701,12 @@
// TODO Auto-generated method stub
return null;
}
+
+
+ public void setSchemaManager( SchemaManager schemaManager )
+ {
+ // TODO Auto-generated method stub
+
+ }
}
}
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java Sat Nov 7 07:57:34 2009
@@ -34,8 +34,6 @@
import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
import org.apache.directory.shared.ldap.schema.SchemaManager;
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.JarLdifSchemaLoader;
@@ -54,28 +52,25 @@
/** a filter node value normalizer and undefined node remover */
private static FilterNormalizingVisitor normVisitor;
- /** A reference to the registries */
- private static Registries registries;
+ /** A reference to the schemaManager */
+ private static SchemaManager schemaManager;
@BeforeClass
public static void init() throws Exception
{
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
- 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() ) );
}
- registries = sm.getRegistries();
-
- AttributeTypeRegistry attributeRegistry = registries.getAttributeTypeRegistry();
- NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry );
- normVisitor = new FilterNormalizingVisitor( ncn, registries );
+ NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
+ normVisitor = new FilterNormalizingVisitor( ncn, schemaManager );
}
@Test
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java Sat Nov 7 07:57:34 2009
@@ -44,10 +44,7 @@
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.ObjectClassRegistry;
import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
import org.apache.directory.shared.ldap.util.StringTools;
import org.apache.directory.shared.schema.DefaultSchemaManager;
@@ -64,7 +61,7 @@
*/
public class SchemaCheckerTest
{
- static Registries registries;
+ static SchemaManager schemaManager;
@BeforeClass
@@ -83,16 +80,14 @@
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() ) );
}
-
- registries = sm.getRegistries();
}
@@ -105,23 +100,21 @@
{
LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
- ServerEntry modifyAttributes = new DefaultServerEntry( registries );
- AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
+ ServerEntry modifyAttributes = new DefaultServerEntry( schemaManager );
+ AttributeType atCN = schemaManager.lookupAttributeTypeRegistry( "cn" );
modifyAttributes.put( new DefaultServerAttribute( atCN ) );
- ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
-
// this should pass
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, modifyAttributes );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod, modifyAttributes );
// this should succeed since person is still in replaced set and is structural
modifyAttributes.removeAttributes( atCN );
- AttributeType atOC = registries.getAttributeTypeRegistry().lookup( "objectClass" );
+ AttributeType atOC = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
EntryAttribute objectClassesReplaced = new DefaultServerAttribute( atOC );
objectClassesReplaced.add( "top" );
objectClassesReplaced.add( "person" );
modifyAttributes.put( objectClassesReplaced );
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, modifyAttributes );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod, modifyAttributes );
// this should fail since only top is left
objectClassesReplaced = new DefaultServerAttribute( atOC );
@@ -129,7 +122,7 @@
modifyAttributes.put( objectClassesReplaced );
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, modifyAttributes );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod, modifyAttributes );
fail( "should never get here due to an LdapSchemaViolationException" );
}
catch ( LdapSchemaViolationException e )
@@ -144,7 +137,7 @@
modifyAttributes.put( objectClassesReplaced );
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, modifyAttributes );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager.getObjectClassRegistry(), name, mod, modifyAttributes );
fail( "should never get here due to an LdapSchemaViolationException" );
}
catch ( LdapSchemaViolationException e )
@@ -227,19 +220,19 @@
{
ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
- ServerEntry attributes = new DefaultServerEntry( registries, name );
+ ServerEntry attributes = new DefaultServerEntry( schemaManager, name );
attributes.put( "cn", "does not matter" );
// postive test which should pass
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, schemaManager );
// test should fail since we are removing the ou attribute
- AttributeType OU_AT = registries.getAttributeTypeRegistry().lookup( "ou" );
+ AttributeType OU_AT = schemaManager.lookupAttributeTypeRegistry( "ou" );
attributes.put( new DefaultServerAttribute( "ou", OU_AT ) );
try
{
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes,registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -249,17 +242,17 @@
// test success using more than one attribute for the Rdn but not modifying rdn attribute
name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
- attributes = new DefaultServerEntry( registries, name );
+ attributes = new DefaultServerEntry( schemaManager, name );
attributes.put( "sn", "does not matter" );
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, schemaManager );
// test for failure when modifying Rdn attribute in multi attribute Rdn
- AttributeType CN_AT = registries.getAttributeTypeRegistry().lookup( "cn" );
+ AttributeType CN_AT = schemaManager.lookupAttributeTypeRegistry( "cn" );
attributes.put( new DefaultServerAttribute( "cn", CN_AT ) );
try
{
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -269,16 +262,16 @@
// should succeed since the value being deleted from the rdn attribute is
// is not used when composing the Rdn
- attributes = new DefaultServerEntry( registries, name );
+ attributes = new DefaultServerEntry( schemaManager, name );
attributes.put( "ou", "container" );
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, schemaManager );
// now let's make it fail again just by providing the right value for ou (users)
- attributes = new DefaultServerEntry( registries, name );
+ attributes = new DefaultServerEntry( schemaManager, name );
attributes.put( "ou", "users" );
try
{
- SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -297,18 +290,18 @@
{
ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
- ServerEntry attributes = new DefaultServerEntry( registries, name );
+ ServerEntry attributes = new DefaultServerEntry( schemaManager, name );
attributes.put( "cn", "does not matter" );
// postive test which should pass
- SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
// test should fail since we are removing the ou attribute
attributes.put( "ou", (String)null );
try
{
- SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -318,16 +311,16 @@
// test success using more than one attribute for the Rdn but not modifying rdn attribute
name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
- attributes = new DefaultServerEntry( registries, name );
+ attributes = new DefaultServerEntry( schemaManager, name );
attributes.put( "sn", "does not matter" );
- SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
// test for failure when modifying Rdn attribute in multi attribute Rdn
attributes.put("cn", (String)null );
try
{
- SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -337,17 +330,17 @@
// should succeed since the values being replaced from the rdn attribute is
// is includes the old Rdn attribute value
- attributes = new DefaultServerEntry( registries, name );
+ attributes = new DefaultServerEntry( schemaManager, name );
attributes.put( "ou", "container" );
attributes.put( "ou", "users" );
- SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
// now let's make it fail by not including the old value for ou (users)
- attributes = new DefaultServerEntry( registries, name );
+ attributes = new DefaultServerEntry( schemaManager, name );
attributes.put( "ou", "container" );
try
{
- SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getAttributeTypeRegistry() );
+ SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -368,27 +361,26 @@
@Test
public void testPreventStructuralClassRemovalOnModifyReplaceAttribute() throws Exception
{
- ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
- AttributeType OBJECT_CLASS = registries.getAttributeTypeRegistry().lookup( "objectClass" );
- AttributeType CN_AT = registries.getAttributeTypeRegistry().lookup( "cn" );
+ AttributeType OBJECT_CLASS = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
+ AttributeType CN_AT = schemaManager.lookupAttributeTypeRegistry( "cn" );
// this should pass
LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, new DefaultServerAttribute( "cn", CN_AT ) );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, new DefaultServerAttribute( "cn", CN_AT ) );
// this should succeed since person is still in replaced set and is structural
ServerAttribute objectClassesReplaced = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
objectClassesReplaced.add( "top" );
objectClassesReplaced.add( "person" );
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, objectClassesReplaced );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, objectClassesReplaced );
// this should fail since only top is left
objectClassesReplaced = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
objectClassesReplaced.add( "top" );
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, objectClassesReplaced );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, objectClassesReplaced );
fail( "should never get here due to an LdapSchemaViolationException" );
}
catch ( LdapSchemaViolationException e )
@@ -401,7 +393,7 @@
objectClassesReplaced = new DefaultServerAttribute( "objectClass", OBJECT_CLASS );
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, objectClassesReplaced );
+ SchemaChecker.preventStructuralClassRemovalOnModifyReplace( schemaManager, name, mod, objectClassesReplaced );
fail( "should never get here due to an LdapSchemaViolationException" );
}
catch ( LdapSchemaViolationException e )
@@ -418,29 +410,26 @@
@Test
public void testPreventStructuralClassRemovalOnModifyRemoveAttribute() throws Exception
{
- AttributeTypeRegistry atReg = registries.getAttributeTypeRegistry();
LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
- AttributeType ocAt = atReg.lookup( "objectClass" );
+ AttributeType ocAt = schemaManager.lookupAttributeTypeRegistry( "objectClass" );
ServerAttribute entryObjectClasses = new DefaultServerAttribute( "objectClass", ocAt );
entryObjectClasses.add( "top", "person", "organizationalPerson" );
- ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
-
// this should pass
SchemaChecker.preventStructuralClassRemovalOnModifyRemove(
- ocRegistry,
+ schemaManager,
name,
mod,
- new DefaultServerAttribute( "cn", atReg.lookup( "cn" ) ),
+ new DefaultServerAttribute( "cn", schemaManager.lookupAttributeTypeRegistry( "cn" ) ),
entryObjectClasses );
// this should succeed since person is left and is structural
ServerAttribute objectClassesRemoved = new DefaultServerAttribute(
"objectClass", ocAt );
objectClassesRemoved.add( "person" );
- SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod, objectClassesRemoved,
+ SchemaChecker.preventStructuralClassRemovalOnModifyRemove( schemaManager, name, mod, objectClassesRemoved,
entryObjectClasses );
// this should fail since only top is left
@@ -449,7 +438,7 @@
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod, objectClassesRemoved,
+ SchemaChecker.preventStructuralClassRemovalOnModifyRemove( schemaManager, name, mod, objectClassesRemoved,
entryObjectClasses );
fail( "should never get here due to an LdapSchemaViolationException" );
}
@@ -464,7 +453,7 @@
try
{
- SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod, objectClassesRemoved,
+ SchemaChecker.preventStructuralClassRemovalOnModifyRemove( schemaManager, name, mod, objectClassesRemoved,
entryObjectClasses );
fail( "should never get here due to an LdapSchemaViolationException" );
}
@@ -482,22 +471,22 @@
@Test
public void testPreventRdnChangeOnModifyRemoveAttribute() throws Exception
{
- Map<String, OidNormalizer> oidNormalizers = registries.getAttributeTypeRegistry().getNormalizerMapping();
+ Map<String, OidNormalizer> oidNormalizers = schemaManager.getAttributeTypeRegistry().getNormalizerMapping();
ModificationOperation mod = ModificationOperation.REMOVE_ATTRIBUTE;
LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" ).normalize( oidNormalizers );
- AttributeType cnAt = registries.getAttributeTypeRegistry().lookup( "cn" );
- AttributeType ouAt = registries.getAttributeTypeRegistry().lookup( "ou" );
- AttributeType snAt = registries.getAttributeTypeRegistry().lookup( "sn" );
+ AttributeType cnAt = schemaManager.lookupAttributeTypeRegistry( "cn" );
+ AttributeType ouAt = schemaManager.lookupAttributeTypeRegistry( "ou" );
+ AttributeType snAt = schemaManager.lookupAttributeTypeRegistry( "sn" );
// postive test which should pass
SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultServerAttribute( "cn", cnAt, "does not matter" ), registries.getAttributeTypeRegistry() );
+ new DefaultServerAttribute( "cn", cnAt, "does not matter" ), schemaManager );
// test should fail since we are removing the ou attribute
try
{
SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultServerAttribute( "ou", ouAt ), registries.getAttributeTypeRegistry() );
+ new DefaultServerAttribute( "ou", ouAt ), schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -509,13 +498,13 @@
name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
name.normalize( oidNormalizers );
SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultServerAttribute( "sn", snAt, "does not matter" ), registries.getAttributeTypeRegistry() );
+ new DefaultServerAttribute( "sn", snAt, "does not matter" ), schemaManager );
// test for failure when modifying Rdn attribute in multi attribute Rdn
try
{
SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultServerAttribute( "cn", cnAt ), registries.getAttributeTypeRegistry() );
+ new DefaultServerAttribute( "cn", cnAt ), schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
@@ -526,13 +515,13 @@
// should succeed since the value being deleted from the rdn attribute is
// is not used when composing the Rdn
SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultServerAttribute( "ou", ouAt, "container" ), registries.getAttributeTypeRegistry() );
+ new DefaultServerAttribute( "ou", ouAt, "container" ), schemaManager );
// now let's make it fail again just by providing the right value for ou (users)
try
{
SchemaChecker.preventRdnChangeOnModifyRemove( name, mod,
- new DefaultServerAttribute( "ou", ouAt, "users" ), registries.getAttributeTypeRegistry() );
+ new DefaultServerAttribute( "ou", ouAt, "users" ), schemaManager );
fail( "should never get here due to a LdapSchemaViolationException being thrown" );
}
catch ( LdapSchemaViolationException e )
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java Sat Nov 7 07:57:34 2009
@@ -31,8 +31,6 @@
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.SchemaManager;
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;
@@ -45,7 +43,7 @@
*/
public class SchemaServiceTest
{
- private static Registries registries;
+ private static SchemaManager schemaManager;
@BeforeClass
@@ -64,22 +62,20 @@
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() ) );
}
- registries = sm.getRegistries();
-
- loaded = sm.loadWithDeps( "nis" );
+ loaded = schemaManager.loadWithDeps( "nis" );
if ( !loaded )
{
- fail( "Schema load failed : " + ExceptionUtils.printErrors( sm.getErrors() ) );
+ fail( "Schema load failed : " + ExceptionUtils.printErrors( schemaManager.getErrors() ) );
}
}
@@ -87,8 +83,7 @@
@Test
public void testDescendants() throws Exception
{
- AttributeTypeRegistry attrRegistry = registries.getAttributeTypeRegistry();
- Iterator<AttributeType> list = attrRegistry.descendants( "name" );
+ Iterator<AttributeType> list = schemaManager.getAttributeTypeRegistry().descendants( "name" );
Set<String> nameAttrs = new HashSet<String>();
while ( list.hasNext() )
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/security/TlsKeyGeneratorTest.java Sat Nov 7 07:57:34 2009
@@ -33,7 +33,6 @@
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-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;
@@ -53,7 +52,7 @@
{
private static final Logger LOG = LoggerFactory.getLogger( TlsKeyGeneratorTest.class );
private static LdifSchemaLoader loader;
- private static Registries registries;
+ private static SchemaManager schemaManager;
/**
@@ -75,16 +74,14 @@
SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
extractor.extractOrCopy();
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() ) );
}
-
- registries = sm.getRegistries();
}
@@ -94,7 +91,7 @@
@Test
public void testAll() throws Exception
{
- DefaultServerEntry entry = new DefaultServerEntry( registries, new LdapDN() );
+ DefaultServerEntry entry = new DefaultServerEntry( schemaManager, new LdapDN() );
TlsKeyGenerator.addKeyPair( entry );
LOG.debug( "Entry: {}", entry );
assertTrue( entry.contains( SchemaConstants.OBJECT_CLASS_AT, TlsKeyGenerator.TLS_KEY_INFO_OC ) );
Modified: directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java Sat Nov 7 07:57:34 2009
@@ -37,8 +37,6 @@
import org.apache.directory.shared.ldap.schema.SchemaManager;
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.subtree.SubtreeSpecification;
import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationModifier;
import org.apache.directory.shared.ldap.util.ExceptionUtils;
@@ -60,10 +58,9 @@
*/
public class SubtreeEvaluatorTest
{
- private static Registries registries;
+ private static SchemaManager schemaManager;
private SubtreeEvaluator evaluator;
FilterNormalizingVisitor visitor;
- static AttributeTypeRegistry attributeRegistry;
static ConcreteNameComponentNormalizer ncn;
@BeforeClass
@@ -82,28 +79,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() ) );
}
- registries = sm.getRegistries();
-
- attributeRegistry = registries.getAttributeTypeRegistry();
-
- ncn = new ConcreteNameComponentNormalizer( attributeRegistry );
+ ncn = new ConcreteNameComponentNormalizer( schemaManager );
}
@Before
public void initTest()
{
- visitor = new FilterNormalizingVisitor( ncn, registries );
- evaluator = new SubtreeEvaluator( registries.getOidRegistry(), registries.getAttributeTypeRegistry() );
+ visitor = new FilterNormalizingVisitor( ncn, schemaManager );
+ evaluator = new SubtreeEvaluator( schemaManager.getOidRegistry(), schemaManager );
}
@@ -118,7 +111,7 @@
@AfterClass
public static void tearDown() throws Exception
{
- registries = null;
+ schemaManager = null;
}
@@ -129,7 +122,7 @@
SubtreeSpecification ss = modifier.getSubtreeSpecification();
LdapDN apDn = new LdapDN( "ou=system" );
LdapDN entryDn = new LdapDN( "ou=users,ou=system" );
- ServerEntry entry = new DefaultServerEntry( registries, entryDn, "objectClass" );
+ ServerEntry entry = new DefaultServerEntry( schemaManager, entryDn, "objectClass" );
assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -149,7 +142,7 @@
SubtreeSpecification ss = modifier.getSubtreeSpecification();
LdapDN apDn = new LdapDN( "ou=system" );
LdapDN entryDn = new LdapDN( "ou=users,ou=system" );
- ServerEntry entry = new DefaultServerEntry( registries, entryDn, "objectClass" );
+ ServerEntry entry = new DefaultServerEntry( schemaManager, entryDn, "objectClass" );
assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -171,7 +164,7 @@
SubtreeSpecification ss = modifier.getSubtreeSpecification();
LdapDN apDn = new LdapDN( "ou=system" );
LdapDN entryDn = new LdapDN( "ou=users,ou=system" );
- ServerEntry entry = new DefaultServerEntry( registries, entryDn, "objectClass" );
+ ServerEntry entry = new DefaultServerEntry( schemaManager, entryDn, "objectClass" );
assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -206,7 +199,7 @@
SubtreeSpecification ss = modifier.getSubtreeSpecification();
LdapDN apDn = new LdapDN( "ou=system" );
LdapDN entryDn = new LdapDN( "ou=users,ou=system" );
- ServerEntry entry = new DefaultServerEntry( registries, entryDn, "objectClass" );
+ ServerEntry entry = new DefaultServerEntry( schemaManager, entryDn, "objectClass" );
assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -241,7 +234,7 @@
SubtreeSpecification ss = modifier.getSubtreeSpecification();
LdapDN apDn = new LdapDN( "ou=system" );
LdapDN entryDn = new LdapDN( "ou=users,ou=system" );
- ServerEntry entry = new DefaultServerEntry( registries, entryDn, "objectClass" );
+ ServerEntry entry = new DefaultServerEntry( schemaManager, entryDn, "objectClass" );
assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -276,7 +269,7 @@
SubtreeSpecification ss = modifier.getSubtreeSpecification();
LdapDN apDn = new LdapDN( "ou=system" );
LdapDN entryDn = new LdapDN( "ou=users,ou=system" );
- ServerEntry entry = new DefaultServerEntry( registries, entryDn );
+ ServerEntry entry = new DefaultServerEntry( schemaManager, entryDn );
entry.put( "objectClass", "person" );
assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -297,7 +290,7 @@
assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
// now change the refinement so the entry is rejected
- entry = new DefaultServerEntry( registries, entryDn );
+ entry = new DefaultServerEntry( schemaManager, entryDn );
entry.put( "objectClass", "organizationalUnit" );
@@ -336,7 +329,7 @@
LdapDN apDn = new LdapDN( "ou=system" );
LdapDN entryDn = new LdapDN( "ou=users,ou=system" );
- ServerEntry entry = new DefaultServerEntry( registries, entryDn );;
+ ServerEntry entry = new DefaultServerEntry( schemaManager, entryDn );;
entry.put( "objectClass", "person" );
entry.put( "cn", "Ersin" );
@@ -346,7 +339,7 @@
assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
// now change the filter so the entry is rejected
- entry = new DefaultServerEntry( registries, entryDn );;
+ entry = new DefaultServerEntry( schemaManager, entryDn );;
entry.put( "objectClass", "person" );
entry.put( "cn", "Alex" );