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 [5/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-integ/src/test/java/org/apache/directory/server/core/jndi/referral/CompareReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/CompareReferralIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/CompareReferralIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/CompareReferralIT.java Sat Nov 7 07:57:34 2009
@@ -21,9 +21,9 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getContext;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
import java.util.HashSet;
import java.util.Set;
@@ -133,7 +133,7 @@
// Core API entry
LdapDN dn = new LdapDN( "cn=Emmanuel Lecharny, ou=apache, ou=people, o=MNN, c=WW, ou=system" );
- serverEntry = new DefaultServerEntry( service.getRegistries(), dn );
+ serverEntry = new DefaultServerEntry( service.getSchemaManager(), dn );
serverEntry.put( "ObjectClass", "top", "person" );
serverEntry.put( "sn", "elecharny" );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/DeleteReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/DeleteReferralIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/DeleteReferralIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/DeleteReferralIT.java Sat Nov 7 07:57:34 2009
@@ -124,7 +124,7 @@
// Core API entry
LdapDN dn = new LdapDN( "cn=Emmanuel Lecharny, ou=apache, ou=people, o=MNN, c=WW, ou=system" );
- serverEntry = new DefaultServerEntry( service.getRegistries(), dn );
+ serverEntry = new DefaultServerEntry( service.getSchemaManager(), dn );
serverEntry.put( "ObjectClass", "top", "person" );
serverEntry.put( "sn", "elecharny" );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/ModifyReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/ModifyReferralIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/ModifyReferralIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/ModifyReferralIT.java Sat Nov 7 07:57:34 2009
@@ -21,9 +21,9 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getContext;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
import java.util.HashSet;
@@ -136,7 +136,7 @@
// Core API entry
LdapDN dn = new LdapDN( "cn=Emmanuel Lecharny, ou=apache, ou=people, o=MNN, c=WW, ou=system" );
- serverEntry = new DefaultServerEntry( service.getRegistries(), dn );
+ serverEntry = new DefaultServerEntry( service.getSchemaManager(), dn );
serverEntry.put( "ObjectClass", "top", "person" );
serverEntry.put( "sn", "elecharny" );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/MoveAndRenameReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/MoveAndRenameReferralIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/MoveAndRenameReferralIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/MoveAndRenameReferralIT.java Sat Nov 7 07:57:34 2009
@@ -21,9 +21,9 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getContext;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
import java.util.HashSet;
import java.util.Set;
@@ -155,7 +155,7 @@
// Core API entry
LdapDN dn = new LdapDN( "cn=Emmanuel Lecharny, ou=apache, ou=people, o=MNN, c=WW, ou=system" );
- serverEntry = new DefaultServerEntry( service.getRegistries(), dn );
+ serverEntry = new DefaultServerEntry( service.getSchemaManager(), dn );
serverEntry.put( "ObjectClass", "top", "person" );
serverEntry.put( "sn", "elecharny" );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/MoveReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/MoveReferralIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/MoveReferralIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/MoveReferralIT.java Sat Nov 7 07:57:34 2009
@@ -21,9 +21,9 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getContext;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
import java.util.HashSet;
import java.util.Set;
@@ -146,7 +146,7 @@
// Core API entry
LdapDN dn = new LdapDN( "cn=Emmanuel Lecharny, ou=apache, ou=people, o=MNN, c=WW, ou=system" );
- serverEntry = new DefaultServerEntry( service.getRegistries(), dn );
+ serverEntry = new DefaultServerEntry( service.getSchemaManager(), dn );
serverEntry.put( "ObjectClass", "top", "person" );
serverEntry.put( "sn", "elecharny" );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/RenameReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/RenameReferralIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/RenameReferralIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/RenameReferralIT.java Sat Nov 7 07:57:34 2009
@@ -21,9 +21,9 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getContext;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
import java.util.HashSet;
import java.util.Set;
@@ -143,7 +143,7 @@
// Core API entry
LdapDN dn = new LdapDN( "cn=Emmanuel Lecharny, ou=apache, ou=people, o=MNN, c=WW, ou=system" );
- serverEntry = new DefaultServerEntry( service.getRegistries(), dn );
+ serverEntry = new DefaultServerEntry( service.getSchemaManager(), dn );
serverEntry.put( "ObjectClass", "top", "person" );
serverEntry.put( "sn", "elecharny" );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/SearchReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/SearchReferralIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/SearchReferralIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/jndi/referral/SearchReferralIT.java Sat Nov 7 07:57:34 2009
@@ -21,9 +21,9 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getContext;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
import java.util.HashSet;
import java.util.Set;
@@ -144,7 +144,7 @@
// Core API entry
LdapDN dn = new LdapDN( "cn=Emmanuel Lecharny, ou=apache, ou=people, o=MNN, c=WW, ou=system" );
- serverEntry = new DefaultServerEntry( service.getRegistries(), dn );
+ serverEntry = new DefaultServerEntry( service.getSchemaManager(), dn );
serverEntry.put( "ObjectClass", "top", "person" );
serverEntry.put( "sn", "elecharny" );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java Sat Nov 7 07:57:34 2009
@@ -270,7 +270,7 @@
{
LdifEntry akarasulu = getUserAddLdif();
service.getAdminSession().add(
- new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );
+ new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );
LdapContext sysRoot = getSystemContext( service );
createData( sysRoot );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/CompareDirserver1139IT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/CompareDirserver1139IT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/CompareDirserver1139IT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/CompareDirserver1139IT.java Sat Nov 7 07:57:34 2009
@@ -90,6 +90,12 @@
// -------------------------------------------------------------------
// Enable the krb5kdc schema
// -------------------------------------------------------------------
+ // Check if krb5kdc is loaded
+ if ( !service.getSchemaManager().isSchemaLoaded( "krb5kdc" ) )
+ {
+ service.getSchemaManager().load( "krb5kdc" );
+ }
+
// check if krb5kdc is disabled
Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=krb5kdc" );
boolean isKrb5kdcDisabled = false;
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java Sat Nov 7 07:57:34 2009
@@ -24,11 +24,8 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import java.io.File;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.naming.NamingEnumeration;
@@ -43,28 +40,16 @@
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
-import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.DefaultDirectoryService;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.authz.AutzIntegUtils;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.DirectoryServiceFactory;
import org.apache.directory.server.core.integ.Level;
import org.apache.directory.server.core.integ.annotations.CleanupLevel;
-import org.apache.directory.server.core.integ.annotations.Factory;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
-import org.apache.directory.server.core.partition.ldif.LdifPartition;
-import org.apache.directory.server.core.schema.SchemaPartition;
import org.apache.directory.server.xdbm.Index;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.schema.SchemaManager;
-import org.apache.directory.shared.ldap.schema.ldif.extractor.SchemaLdifExtractor;
-import org.apache.directory.shared.ldap.util.ExceptionUtils;
-import org.apache.directory.shared.schema.DefaultSchemaManager;
-import org.apache.directory.shared.schema.loader.ldif.JarLdifSchemaLoader;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -77,14 +62,14 @@
*/
@RunWith ( CiRunner.class )
@CleanupLevel ( Level.CLASS )
-@Factory ( SearchWithIndicesITest.MyFactory.class )
public class SearchWithIndicesITest
{
public static DirectoryService service;
- private void createData() throws Exception
+ @Before
+ public void createData() throws Exception
{
// -------------------------------------------------------------------
// Enable the nis schema
@@ -109,6 +94,10 @@
schemaRoot.modifyAttributes( "cn=nis", mods );
}
+ Partition systemPartition = service.getSystemPartition();
+ Set<Index<?,ServerEntry>> indexedAtributes = ( ( JdbmPartition ) systemPartition ).getIndexedAttributes();
+ indexedAtributes.add( new JdbmIndex<String,ServerEntry>( "gidNumber" ) );
+
// -------------------------------------------------------------------
// Add a bunch of nis groups
// -------------------------------------------------------------------
@@ -131,84 +120,6 @@
}
- public static class MyFactory implements DirectoryServiceFactory
- {
- public DirectoryService newInstance() throws Exception
- {
- String workingDirectory = System.getProperty( "workingDirectory" );
-
- if ( workingDirectory == null )
- {
- String path = DirectoryServiceFactory.class.getResource( "" ).getPath();
- int targetPos = path.indexOf( "target" );
- workingDirectory = path.substring( 0, targetPos + 6 ) + "/server-work";
- }
-
- DirectoryService service = new DefaultDirectoryService();
- service.setWorkingDirectory( new File( workingDirectory ) );
- SchemaPartition schemaPartition = service.getSchemaService().getSchemaPartition();
-
- // Init the LdifPartition
- LdifPartition ldifPartition = new LdifPartition();
-
- ldifPartition.setWorkingDirectory( workingDirectory + "/schema" );
-
- // Extract the schema on disk (a brand new one) and load the registries
- File schemaRepository = new File( workingDirectory, "schema" );
- SchemaLdifExtractor extractor = new SchemaLdifExtractor( new File( workingDirectory ) );
-
- schemaPartition.setWrappedPartition( ldifPartition );
-
- JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
-
- SchemaManager sm = new DefaultSchemaManager( loader );
-
- sm.loadAllEnabled();
- List<Throwable> errors = sm.getErrors();
-
- if ( errors.size() != 0 )
- {
- fail( "Schema load failed : " + ExceptionUtils.printErrors( errors ) );
- }
-
- schemaPartition.setRegistries( sm.getRegistries() );
-
- extractor.extractOrCopy();
-
- service.getChangeLog().setEnabled( true );
-
- // change the working directory to something that is unique
- // on the system and somewhere either under target directory
- // or somewhere in a temp area of the machine.
-
- // Inject the System Partition
- Partition systemPartition = new JdbmPartition();
- systemPartition.setId( "system" );
- ((JdbmPartition)systemPartition).setCacheSize( 500 );
- systemPartition.setSuffix( ServerDNConstants.SYSTEM_DN );
- systemPartition.setRegistries( sm.getRegistries() );
- ((JdbmPartition)systemPartition).setPartitionDir( new File( workingDirectory, "system" ) );
-
- // Add objectClass attribute for the system partition
- Set<Index<?,ServerEntry>> indexedAttrs = new HashSet<Index<?,ServerEntry>>();
- indexedAttrs.add(
- new JdbmIndex<Object,ServerEntry>( SchemaConstants.OBJECT_CLASS_AT ) );
- ( ( JdbmPartition ) systemPartition ).setIndexedAttributes( indexedAttrs );
-
- // -------------------------------------------------------------------
- // Alter the partition configuration to index gidNumber
- // -------------------------------------------------------------------
- indexedAttrs.add( new JdbmIndex<String,ServerEntry>( "gidNumber" ) );
-
- service.setSystemPartition( systemPartition );
- service.setAccessControlEnabled( false );
- AutzIntegUtils.service = service;
-
- return service;
- }
- }
-
-
/**
* Convenience method that performs a one level search using the
* specified filter returning their DNs as Strings in a set.
@@ -255,7 +166,6 @@
@Test
public void testLessThanSearchWithIndices() throws Exception
{
- createData();
Set<String> results = searchGroups( "(gidNumber<=5)" );
assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
@@ -301,7 +211,6 @@
@Test
public void testGreaterThanSearchWithIndices() throws Exception
{
- createData();
Set<String> results = searchGroups( "(gidNumber>=0)" );
assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java Sat Nov 7 07:57:34 2009
@@ -123,18 +123,19 @@
JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
- SchemaManager sm = new DefaultSchemaManager( loader );
-
- sm.loadAllEnabled();
+ SchemaManager schemaManager = new DefaultSchemaManager( loader );
+ service.setSchemaManager( schemaManager );
+
+ schemaManager.loadAllEnabled();
- List<Throwable> errors = sm.getErrors();
+ List<Throwable> errors = schemaManager.getErrors();
if ( errors.size() != 0 )
{
fail( "Schema load failed : " + ExceptionUtils.printErrors( errors ) );
}
- schemaPartition.setRegistries( sm.getRegistries() );
+ schemaPartition.setSchemaManager( schemaManager );
extractor.extractOrCopy();
@@ -149,7 +150,7 @@
systemPartition.setId( "system" );
((JdbmPartition)systemPartition).setCacheSize( 500 );
systemPartition.setSuffix( ServerDNConstants.SYSTEM_DN );
- systemPartition.setRegistries( sm.getRegistries() );
+ systemPartition.setSchemaManager( schemaManager );
((JdbmPartition)systemPartition).setPartitionDir( new File( workingDirectory, "system" ) );
// Add objectClass attribute for the system partition
@@ -159,19 +160,19 @@
( ( JdbmPartition ) systemPartition ).setIndexedAttributes( indexedAttrs );
service.setSystemPartition( systemPartition );
- schemaPartition.setSchemaManager( sm );
+ schemaPartition.setSchemaManager( schemaManager );
Partition foo = new JdbmPartition();
foo.setId( "foo" );
foo.setSuffix( "dc=foo,dc=com" );
- foo.setRegistries( sm.getRegistries() );
+ foo.setSchemaManager( schemaManager );
((JdbmPartition)foo).setPartitionDir( new File( workingDirectory, "foo" ) );
service.addPartition( foo );
Partition bar = new JdbmPartition();
bar.setId( "bar" );
bar.setSuffix( "dc=bar,dc=com" );
- bar.setRegistries( sm.getRegistries() );
+ bar.setSchemaManager( schemaManager );
((JdbmPartition)bar).setPartitionDir( new File( workingDirectory, "bar" ) );
service.addPartition( bar );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java Sat Nov 7 07:57:34 2009
@@ -45,7 +45,7 @@
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.junit.Ignore;
import org.junit.Test;
@@ -71,13 +71,8 @@
private static final String DEPENDEE_OID = "1.3.6.1.4.1.18060.0.4.0.2.100002";
public static DirectoryService service;
+ public static SchemaManager schemaManager;
- protected static AttributeTypeRegistry getAttributeTypeRegistry()
- {
- return service.getRegistries().getAttributeTypeRegistry();
- }
-
-
/*
@Before
public void checkBefore()
@@ -137,8 +132,8 @@
dn.add( "m-oid=" + OID );
getSchemaContext( service ).createSubcontext( dn, attrs );
- assertTrue( service.getRegistries().getAttributeTypeRegistry().contains( OID ) );
- assertEquals( getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
+ assertEquals( service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
assertTrue( isOnDisk( dn ) );
}
@@ -162,7 +157,7 @@
getSchemaContext( service ).createSubcontext( dn, attrs );
assertFalse( "adding new attributeType to disabled schema should not register it into the registries",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
}
@@ -177,7 +172,7 @@
// Check in Registries
assertTrue( "attributeType should be removed from the registry after being deleted",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
// Check on disk that the added SchemaObject exist
assertTrue( isOnDisk( dn ) );
@@ -186,7 +181,7 @@
// Check in Registries
assertFalse( "attributeType should be removed from the registry after being deleted",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
// Check on disk that the deleted SchemaObject does not exist anymore
assertFalse( isOnDisk( dn ) );
@@ -203,7 +198,7 @@
// Check in Registries
assertFalse( "attributeType should be removed from the registry after being deleted",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
// Check on disk that the added SchemaObject exist
assertTrue( isOnDisk( dn ) );
@@ -212,7 +207,7 @@
// Check in Registries
assertFalse( "attributeType should be removed from the registry after being deleted",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
// Check on disk that the deleted SchemaObject does not exist anymore
assertFalse( isOnDisk( dn ) );
@@ -233,18 +228,18 @@
schemaRoot.rename( dn, newdn );
assertFalse( "old attributeType OID should be removed from the registry after being renamed",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
try
{
- getAttributeTypeRegistry().lookup( OID );
+ service.getSchemaManager().getAttributeTypeRegistry().lookup( OID );
fail( "attributeType lookup should fail after renaming the attributeType" );
}
catch( NamingException e )
{
}
- assertTrue( getAttributeTypeRegistry().contains( NEW_OID ) );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( NEW_OID ) );
}
@@ -263,10 +258,10 @@
getSchemaContext( service ).rename( dn, newdn );
assertTrue( "attributeType OID should still be present",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
assertEquals( "attributeType schema should be set to apache not apachemeta",
- getAttributeTypeRegistry().getSchemaName( OID ), "apache" );
+ service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apache" );
}
@@ -285,13 +280,13 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "old attributeType OID should NOT be present",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
assertTrue( "new attributeType OID should be present",
- getAttributeTypeRegistry().contains( NEW_OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( NEW_OID ) );
assertEquals( "attributeType with new oid should have schema set to apache NOT apachemeta",
- getAttributeTypeRegistry().getSchemaName( NEW_OID ), "apache" );
+ service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( NEW_OID ), "apache" );
}
@@ -300,7 +295,7 @@
{
testAddAttributeTypeToEnabledSchema();
- AttributeType at = getAttributeTypeRegistry().lookup( OID );
+ AttributeType at = service.getSchemaManager().lookupAttributeTypeRegistry( OID );
assertEquals( at.getDescription(), DESCRIPTION0 );
assertEquals( at.getSyntax().getOid(), SchemaConstants.INTEGER_SYNTAX );
@@ -315,12 +310,12 @@
getSchemaContext( service ).modifyAttributes( dn, mods );
assertTrue( "attributeType OID should still be present",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
assertEquals( "attributeType schema should be set to apachemeta",
- getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
+ service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
- at = getAttributeTypeRegistry().lookup( OID );
+ at = service.getSchemaManager().lookupAttributeTypeRegistry( OID );
assertEquals( at.getDescription(), DESCRIPTION1 );
assertEquals( at.getSyntax().getOid(), SchemaConstants.DIRECTORY_STRING_SYNTAX );
}
@@ -331,7 +326,7 @@
{
testAddAttributeTypeToEnabledSchema();
- AttributeType at = getAttributeTypeRegistry().lookup( OID );
+ AttributeType at = service.getSchemaManager().lookupAttributeTypeRegistry( OID );
assertEquals( at.getDescription(), DESCRIPTION0 );
assertEquals( at.getSyntax().getOid(), SchemaConstants.INTEGER_SYNTAX );
@@ -344,12 +339,12 @@
getSchemaContext( service ).modifyAttributes( dn, DirContext.REPLACE_ATTRIBUTE, mods );
assertTrue( "attributeType OID should still be present",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
assertEquals( "attributeType schema should be set to apachemeta",
- getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
+ service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
- at = getAttributeTypeRegistry().lookup( OID );
+ at = service.getSchemaManager().lookupAttributeTypeRegistry( OID );
assertEquals( at.getDescription(), DESCRIPTION1 );
assertEquals( at.getSyntax().getOid(), SchemaConstants.DIRECTORY_STRING_SYNTAX );
}
@@ -379,8 +374,8 @@
dn.add( "m-oid=" + DEPENDEE_OID );
getSchemaContext( service ).createSubcontext( dn, attrs );
- assertTrue( getAttributeTypeRegistry().contains( DEPENDEE_OID ) );
- assertEquals( getAttributeTypeRegistry().getSchemaName( DEPENDEE_OID ), "apachemeta" );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( DEPENDEE_OID ) );
+ assertEquals( service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( DEPENDEE_OID ), "apachemeta" );
}
@@ -404,7 +399,7 @@
}
assertTrue( "attributeType should still be in the registry after delete failure",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
}
@@ -432,7 +427,7 @@
}
assertTrue( "attributeType should still be in the registry after move failure",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
}
@@ -460,7 +455,7 @@
}
assertTrue( "attributeType should still be in the registry after move failure",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
}
@@ -487,7 +482,7 @@
}
assertTrue( "attributeType should still be in the registry after rename failure",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
}
@@ -519,7 +514,7 @@
}
assertTrue( "attributeType should still be in the registry after move failure",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
}
@@ -546,7 +541,7 @@
}
assertTrue( "attributeType should still be in the registry after move failure",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
}
@@ -566,7 +561,7 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "attributeType OID should no longer be present",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
}
@@ -581,7 +576,7 @@
dn.add( "m-oid=" + OID );
assertFalse( "attributeType OID should NOT be present when added to disabled nis schema",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
LdapDN newdn = getAttributeTypeContainer( "apachemeta" );
newdn.add( "m-oid=" + OID );
@@ -589,9 +584,9 @@
getSchemaContext( service ).rename( dn, newdn );
assertTrue( "attributeType OID should be present when moved to enabled schema",
- getAttributeTypeRegistry().contains( OID ) );
+ service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
assertEquals( "attributeType should be in apachemeta schema after move",
- getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
+ service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
}
}
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java Sat Nov 7 07:57:34 2009
@@ -46,12 +46,11 @@
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.comparators.BooleanComparator;
import org.apache.directory.shared.ldap.schema.comparators.StringComparator;
-import org.apache.directory.shared.ldap.schema.registries.ComparatorRegistry;
-import org.apache.directory.shared.ldap.schema.registries.MatchingRuleRegistry;
-import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -73,8 +72,16 @@
public static DirectoryService service;
+ public static SchemaManager schemaManager;
+ @Before
+ public void setup()
+ {
+ schemaManager = service.getSchemaManager();
+ }
+
+
/**
* Gets relative DN to ou=schema.
*
@@ -86,26 +93,7 @@
{
return new LdapDN( "ou=comparators,cn=" + schemaName );
}
-
-
- private static ComparatorRegistry getComparatorRegistry()
- {
- return service.getRegistries().getComparatorRegistry();
- }
-
- private static MatchingRuleRegistry getMatchingRuleRegistry()
- {
- return service.getRegistries().getMatchingRuleRegistry();
- }
-
-
- private static OidRegistry getOidRegistry()
- {
- return service.getRegistries().getOidRegistry();
- }
-
-
// ----------------------------------------------------------------------
// Test all core methods with normal operational pathways
// ----------------------------------------------------------------------
@@ -124,9 +112,9 @@
dn.add( "m-oid" + "=" + OID );
getSchemaContext( service ).createSubcontext( dn, attrs );
- assertTrue( getComparatorRegistry().contains( OID ) );
- assertEquals( getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
- Class<?> clazz = getComparatorRegistry().lookup( OID ).getClass();
+ assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
+ assertEquals( schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
+ Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
assertEquals( clazz, StringComparator.class );
assertTrue( isOnDisk( dn ) );
}
@@ -149,7 +137,7 @@
getSchemaContext( service ).createSubcontext( dn, attrs );
assertFalse( "adding new comparator to disabled schema should not register it into the registries",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
}
@@ -178,9 +166,9 @@
dn.add( "m-oid" + "=" + OID );
getSchemaContext( service ).createSubcontext( dn, attrs );
- assertTrue( getComparatorRegistry().contains( OID ) );
- assertEquals( getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
- Class<?> clazz = getComparatorRegistry().lookup( OID ).getClass();
+ assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
+ assertEquals( schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
+ Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
assertEquals( clazz.getName(), "org.apache.directory.shared.ldap.schema.comparators.DummyComparator" );
assertTrue( isOnDisk( dn ) );
}
@@ -212,7 +200,7 @@
getSchemaContext( service ).createSubcontext( dn, attrs );
assertFalse( "adding new comparator to disabled schema should not register it into the registries",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
}
@@ -225,17 +213,17 @@
dn.add( "m-oid" + "=" + OID );
testAddComparatorToEnabledSchema();
- assertTrue( getComparatorRegistry().contains( OID ) );
+ assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
getSchemaContext( service ).destroySubcontext( dn );
assertFalse( "comparator should be removed from the registry after being deleted",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
try
{
- getComparatorRegistry().lookup( OID );
+ schemaManager.getComparatorRegistry().lookup( OID );
fail( "comparator lookup should fail after deleting the comparator" );
}
catch( NamingException e )
@@ -254,17 +242,17 @@
testAddComparatorToDisabledSchema();
assertFalse( "comparator should be removed from the registry after being deleted",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
getSchemaContext( service ).destroySubcontext( dn );
assertFalse( "comparator should be removed from the registry after being deleted",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
try
{
- getComparatorRegistry().lookup( OID );
+ schemaManager.getComparatorRegistry().lookup( OID );
fail( "comparator lookup should fail after deleting the comparator" );
}
catch( NamingException e )
@@ -287,19 +275,19 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "old comparator OID should be removed from the registry after being renamed",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
try
{
- getComparatorRegistry().lookup( OID );
+ schemaManager.getComparatorRegistry().lookup( OID );
fail( "comparator lookup should fail after deleting the comparator" );
}
catch( NamingException e )
{
}
- assertTrue( getComparatorRegistry().contains( NEW_OID ) );
- Class<?> clazz = getComparatorRegistry().lookup( NEW_OID ).getClass();
+ assertTrue( schemaManager.getComparatorRegistry().contains( NEW_OID ) );
+ Class<?> clazz = schemaManager.getComparatorRegistry().lookup( NEW_OID ).getClass();
assertEquals( clazz, StringComparator.class );
}
@@ -319,12 +307,12 @@
getSchemaContext( service ).rename( dn, newdn );
assertTrue( "comparator OID should still be present",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
assertEquals( "comparator schema should be set to apache not apachemeta",
- getComparatorRegistry().getSchemaName( OID ), "apache" );
+ schemaManager.getComparatorRegistry().getSchemaName( OID ), "apache" );
- Class<?> clazz = getComparatorRegistry().lookup( OID ).getClass();
+ Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
assertEquals( clazz, StringComparator.class );
}
@@ -344,15 +332,15 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "old comparator OID should NOT be present",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
assertTrue( "new comparator OID should be present",
- getComparatorRegistry().contains( NEW_OID ) );
+ schemaManager.getComparatorRegistry().contains( NEW_OID ) );
assertEquals( "comparator with new oid should have schema set to apache NOT apachemeta",
- getComparatorRegistry().getSchemaName( NEW_OID ), "apache" );
+ schemaManager.getComparatorRegistry().getSchemaName( NEW_OID ), "apache" );
- Class<?> clazz = getComparatorRegistry().lookup( NEW_OID ).getClass();
+ Class<?> clazz = schemaManager.getComparatorRegistry().lookup( NEW_OID ).getClass();
assertEquals( clazz, StringComparator.class );
}
@@ -371,12 +359,12 @@
getSchemaContext( service ).modifyAttributes( dn, mods );
assertTrue( "comparator OID should still be present",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
assertEquals( "comparator schema should be set to apachemeta",
- getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
+ schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
- Class<?> clazz = getComparatorRegistry().lookup( OID ).getClass();
+ Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
assertEquals( clazz, BooleanComparator.class );
}
@@ -394,12 +382,12 @@
getSchemaContext( service ).modifyAttributes( dn, DirContext.REPLACE_ATTRIBUTE, mods );
assertTrue( "comparator OID should still be present",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
assertEquals( "comparator schema should be set to apachemeta",
- getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
+ schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
- Class<?> clazz = getComparatorRegistry().lookup( OID ).getClass();
+ Class<?> clazz = schemaManager.getComparatorRegistry().lookup( OID ).getClass();
assertEquals( clazz, BooleanComparator.class );
}
@@ -415,7 +403,7 @@
LdapDN dn = getComparatorContainer( "apachemeta" );
dn.add( "m-oid" + "=" + OID );
testAddComparatorToEnabledSchema();
- getMatchingRuleRegistry().register( new DummyMR() );
+ schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
try
{
@@ -428,9 +416,9 @@
}
assertTrue( "comparator should still be in the registry after delete failure",
- getComparatorRegistry().contains( OID ) );
- getMatchingRuleRegistry().unregister( OID );
- getOidRegistry().unregister( OID );
+ schemaManager.getComparatorRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().unregister( OID );
+ service.getSchemaManager().getOidRegistry().unregister( OID );
}
@@ -439,7 +427,7 @@
public void testMoveComparatorWhenInUse() throws Exception
{
testAddComparatorToEnabledSchema();
- getMatchingRuleRegistry().register( new DummyMR() );
+ schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
LdapDN dn = getComparatorContainer( "apachemeta" );
dn.add( "m-oid" + "=" + OID );
@@ -458,9 +446,9 @@
}
assertTrue( "comparator should still be in the registry after move failure",
- getComparatorRegistry().contains( OID ) );
- getMatchingRuleRegistry().unregister( OID );
- getOidRegistry().unregister( OID );
+ schemaManager.getComparatorRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().unregister( OID );
+ service.getSchemaManager().getOidRegistry().unregister( OID );
}
@@ -469,7 +457,7 @@
public void testMoveComparatorAndChangeRdnWhenInUse() throws Exception
{
testAddComparatorToEnabledSchema();
- getMatchingRuleRegistry().register( new DummyMR() );
+ schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
LdapDN dn = getComparatorContainer( "apachemeta" );
dn.add( "m-oid" + "=" + OID );
@@ -488,9 +476,9 @@
}
assertTrue( "comparator should still be in the registry after move failure",
- getComparatorRegistry().contains( OID ) );
- getMatchingRuleRegistry().unregister( OID );
- getOidRegistry().unregister( OID );
+ schemaManager.getComparatorRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().unregister( OID );
+ service.getSchemaManager().getOidRegistry().unregister( OID );
}
@@ -500,7 +488,7 @@
LdapDN dn = getComparatorContainer( "apachemeta" );
dn.add( "m-oid" + "=" + OID );
testAddComparatorToEnabledSchema();
- getMatchingRuleRegistry().register( new DummyMR() );
+ schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
LdapDN newdn = getComparatorContainer( "apachemeta" );
newdn.add( "m-oid" + "=" + NEW_OID );
@@ -516,9 +504,9 @@
}
assertTrue( "comparator should still be in the registry after rename failure",
- getComparatorRegistry().contains( OID ) );
- getMatchingRuleRegistry().unregister( OID );
- getOidRegistry().unregister( OID );
+ schemaManager.getComparatorRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().unregister( OID );
+ service.getSchemaManager().getOidRegistry().unregister( OID );
}
@@ -550,7 +538,7 @@
}
assertTrue( "comparator should still be in the registry after move failure",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
}
@@ -577,7 +565,7 @@
}
assertTrue( "comparator should still be in the registry after move failure",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
}
@@ -597,7 +585,7 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "comparator OID should no longer be present",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
}
@@ -612,7 +600,7 @@
dn.add( "m-oid" + "=" + OID );
assertFalse( "comparator OID should NOT be present when added to disabled nis schema",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
LdapDN newdn = getComparatorContainer( "apachemeta" );
newdn.add( "m-oid" + "=" + OID );
@@ -620,10 +608,10 @@
getSchemaContext( service ).rename( dn, newdn );
assertTrue( "comparator OID should be present when moved to enabled schema",
- getComparatorRegistry().contains( OID ) );
+ schemaManager.getComparatorRegistry().contains( OID ) );
assertEquals( "comparator should be in apachemeta schema after move",
- getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
+ schemaManager.getComparatorRegistry().getSchemaName( OID ), "apachemeta" );
}
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerIT.java Sat Nov 7 07:57:34 2009
@@ -43,8 +43,9 @@
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.MatchingRule;
-import org.apache.directory.shared.ldap.schema.registries.MatchingRuleRegistry;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -69,14 +70,16 @@
public static DirectoryService service;
+ public static SchemaManager schemaManager;
- private static MatchingRuleRegistry getMatchingRuleRegistry()
+ @Before
+ public void setup()
{
- return service.getRegistries().getMatchingRuleRegistry();
+ schemaManager = service.getSchemaManager();
}
-
-
+
+
/**
* Gets relative DN to ou=schema.
*
@@ -110,8 +113,8 @@
dn.add( "m-oid" + "=" + OID );
getSchemaContext( service ).createSubcontext( dn, attrs );
- assertTrue( getMatchingRuleRegistry().contains( OID ) );
- assertEquals( getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
+ assertTrue( schemaManager.getMatchingRuleRegistry().contains( OID ) );
+ assertEquals( schemaManager.getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
assertTrue( isOnDisk( dn ) );
}
@@ -132,7 +135,7 @@
getSchemaContext( service ).createSubcontext( dn, attrs );
assertFalse( "adding new matchingRule to disabled schema should not register it into the registries",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
}
@@ -145,17 +148,17 @@
testAddMatchingRuleToEnabledSchema();
assertTrue( "matchingRule should be removed from the registry after being deleted",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
getSchemaContext( service ).destroySubcontext( dn );
assertFalse( "matchingRule should be removed from the registry after being deleted",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
try
{
- getMatchingRuleRegistry().lookup( OID );
+ schemaManager.getMatchingRuleRegistry().lookup( OID );
fail( "matchingRule lookup should fail after deleting it" );
}
catch( NamingException e )
@@ -174,13 +177,13 @@
testAddMatchingRuleToDisabledSchema();
assertFalse( "matchingRule should be removed from the registry after being deleted",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
getSchemaContext( service ).destroySubcontext( dn );
assertFalse( "matchingRule should be removed from the registry after being deleted",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
assertFalse( isOnDisk( dn ) );
}
@@ -197,18 +200,18 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "old matchingRule OID should be removed from the registry after being renamed",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
try
{
- getMatchingRuleRegistry().lookup( OID );
+ schemaManager.getMatchingRuleRegistry().lookup( OID );
fail( "matchingRule lookup should fail after renaming the matchingRule" );
}
catch( NamingException e )
{
}
- assertTrue( getMatchingRuleRegistry().contains( NEW_OID ) );
+ assertTrue( schemaManager.getMatchingRuleRegistry().contains( NEW_OID ) );
}
@@ -227,10 +230,10 @@
getSchemaContext( service ).rename( dn, newdn );
assertTrue( "matchingRule OID should still be present",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
assertEquals( "matchingRule schema should be set to apache not apachemeta",
- getMatchingRuleRegistry().getSchemaName( OID ), "apache" );
+ schemaManager.getMatchingRuleRegistry().getSchemaName( OID ), "apache" );
}
@@ -249,13 +252,13 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "old matchingRule OID should NOT be present",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
assertTrue( "new matchingRule OID should be present",
- getMatchingRuleRegistry().contains( NEW_OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( NEW_OID ) );
assertEquals( "matchingRule with new oid should have schema set to apache NOT apachemeta",
- getMatchingRuleRegistry().getSchemaName( NEW_OID ), "apache" );
+ schemaManager.getMatchingRuleRegistry().getSchemaName( NEW_OID ), "apache" );
}
@@ -264,7 +267,7 @@
{
testAddMatchingRuleToEnabledSchema();
- MatchingRule mr = getMatchingRuleRegistry().lookup( OID );
+ MatchingRule mr = schemaManager.getMatchingRuleRegistry().lookup( OID );
assertEquals( mr.getDescription(), DESCRIPTION0 );
assertEquals( mr.getSyntax().getOid(), SchemaConstants.INTEGER_SYNTAX );
@@ -279,12 +282,12 @@
getSchemaContext( service ).modifyAttributes( dn, mods );
assertTrue( "matchingRule OID should still be present",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
assertEquals( "matchingRule schema should be set to apachemeta",
- getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
+ schemaManager.getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
- mr = getMatchingRuleRegistry().lookup( OID );
+ mr = schemaManager.getMatchingRuleRegistry().lookup( OID );
assertEquals( mr.getDescription(), DESCRIPTION1 );
assertEquals( mr.getSyntax().getOid(), SchemaConstants.DIRECTORY_STRING_SYNTAX );
}
@@ -295,7 +298,7 @@
{
testAddMatchingRuleToEnabledSchema();
- MatchingRule mr = getMatchingRuleRegistry().lookup( OID );
+ MatchingRule mr = schemaManager.getMatchingRuleRegistry().lookup( OID );
assertEquals( mr.getDescription(), DESCRIPTION0 );
assertEquals( mr.getSyntax().getOid(), SchemaConstants.INTEGER_SYNTAX );
@@ -308,12 +311,12 @@
getSchemaContext( service ).modifyAttributes( dn, DirContext.REPLACE_ATTRIBUTE, mods );
assertTrue( "matchingRule OID should still be present",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
assertEquals( "matchingRule schema should be set to apachemeta",
- getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
+ schemaManager.getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
- mr = getMatchingRuleRegistry().lookup( OID );
+ mr = schemaManager.getMatchingRuleRegistry().lookup( OID );
assertEquals( mr.getDescription(), DESCRIPTION1 );
assertEquals( mr.getSyntax().getOid(), SchemaConstants.DIRECTORY_STRING_SYNTAX );
}
@@ -460,7 +463,7 @@
}
assertTrue( "matchingRule should still be in the registry after move failure",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
}
@@ -487,7 +490,7 @@
}
assertTrue( "matchingRule should still be in the registry after move failure",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
}
@@ -507,7 +510,7 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "matchingRule OID should no longer be present",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
}
@@ -522,7 +525,7 @@
dn.add( "m-oid" + "=" + OID );
assertFalse( "matchingRule OID should NOT be present when added to disabled nis schema",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
LdapDN newdn = getMatchingRuleContainer( "apachemeta" );
newdn.add( "m-oid" + "=" + OID );
@@ -530,9 +533,9 @@
getSchemaContext( service ).rename( dn, newdn );
assertTrue( "matchingRule OID should be present when moved to enabled schema",
- getMatchingRuleRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().contains( OID ) );
assertEquals( "matchingRule should be in apachemeta schema after move",
- getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
+ schemaManager.getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
}
}
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaNormalizerHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaNormalizerHandlerIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaNormalizerHandlerIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaNormalizerHandlerIT.java Sat Nov 7 07:57:34 2009
@@ -46,12 +46,11 @@
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
import org.apache.directory.shared.ldap.schema.normalizers.DeepTrimNormalizer;
import org.apache.directory.shared.ldap.schema.normalizers.NoOpNormalizer;
-import org.apache.directory.shared.ldap.schema.registries.MatchingRuleRegistry;
-import org.apache.directory.shared.ldap.schema.registries.NormalizerRegistry;
-import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -73,6 +72,14 @@
public static DirectoryService service;
+ public static SchemaManager schemaManager;
+
+
+ @Before
+ public void setup()
+ {
+ schemaManager = service.getSchemaManager();
+ }
/**
@@ -86,24 +93,6 @@
{
return new LdapDN( "ou=normalizers,cn=" + schemaName );
}
-
-
- private static NormalizerRegistry getNormalizerRegistry()
- {
- return service.getRegistries().getNormalizerRegistry();
- }
-
-
- private static MatchingRuleRegistry getMatchingRuleRegistry()
- {
- return service.getRegistries().getMatchingRuleRegistry();
- }
-
-
- private static OidRegistry getOidRegistry()
- {
- return service.getRegistries().getOidRegistry();
- }
// ----------------------------------------------------------------------
@@ -126,9 +115,9 @@
dn.add( "m-oid" + "=" + OID );
getSchemaContext( service ).createSubcontext( dn, attrs );
- assertTrue( getNormalizerRegistry().contains( OID ) );
- assertEquals( getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
- Class<?> clazz = getNormalizerRegistry().lookup( OID ).getClass();
+ assertTrue( schemaManager.getNormalizerRegistry().contains( OID ) );
+ assertEquals( schemaManager.getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
+ Class<?> clazz = schemaManager.getNormalizerRegistry().lookup( OID ).getClass();
assertEquals( clazz, NoOpNormalizer.class );
assertTrue( isOnDisk( dn ) );
}
@@ -151,7 +140,7 @@
getSchemaContext( service ).createSubcontext( dn, attrs );
assertFalse( "adding new normalizer to disabled schema should not register it into the registries",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
}
@@ -180,9 +169,9 @@
dn.add( "m-oid" + "=" + OID );
getSchemaContext( service ).createSubcontext( dn, attrs );
- assertTrue( getNormalizerRegistry().contains( OID ) );
- assertEquals( getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
- Class<?> clazz = getNormalizerRegistry().lookup( OID ).getClass();
+ assertTrue( schemaManager.getNormalizerRegistry().contains( OID ) );
+ assertEquals( schemaManager.getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
+ Class<?> clazz = schemaManager.getNormalizerRegistry().lookup( OID ).getClass();
assertEquals( clazz.getName(), "org.apache.directory.shared.ldap.schema.normalizers.DummyNormalizer" );
assertTrue( isOnDisk( dn ) );
}
@@ -212,7 +201,7 @@
dn.add( "m-oid" + "=" + OID );
getSchemaContext( service ).createSubcontext( dn, attrs );
- assertFalse( getNormalizerRegistry().contains( OID ) );
+ assertFalse( schemaManager.getNormalizerRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
}
@@ -225,17 +214,17 @@
testAddNormalizerToEnabledSchema();
assertTrue( "normalizer should be removed from the registry after being deleted",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
getSchemaContext( service ).destroySubcontext( dn );
assertFalse( "normalizer should be removed from the registry after being deleted",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
try
{
- getNormalizerRegistry().lookup( OID );
+ schemaManager.getNormalizerRegistry().lookup( OID );
fail( "normalizer lookup should fail after deleting the normalizer" );
}
catch( NamingException e )
@@ -254,17 +243,17 @@
testAddNormalizerToEnabledSchema();
assertTrue( "normalizer should be removed from the registry after being deleted",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
assertTrue( isOnDisk( dn ) );
getSchemaContext( service ).destroySubcontext( dn );
assertFalse( "normalizer should be removed from the registry after being deleted",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
try
{
- getNormalizerRegistry().lookup( OID );
+ schemaManager.getNormalizerRegistry().lookup( OID );
fail( "normalizer lookup should fail after deleting the normalizer" );
}
catch( NamingException e )
@@ -287,20 +276,20 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "old normalizer OID should be removed from the registry after being renamed",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
//noinspection EmptyCatchBlock
try
{
- getNormalizerRegistry().lookup( OID );
+ schemaManager.getNormalizerRegistry().lookup( OID );
fail( "normalizer lookup should fail after deleting the normalizer" );
}
catch( NamingException e )
{
}
- assertTrue( getNormalizerRegistry().contains( NEW_OID ) );
- Class<?> clazz = getNormalizerRegistry().lookup( NEW_OID ).getClass();
+ assertTrue( schemaManager.getNormalizerRegistry().contains( NEW_OID ) );
+ Class<?> clazz = schemaManager.getNormalizerRegistry().lookup( NEW_OID ).getClass();
assertEquals( clazz, NoOpNormalizer.class );
}
@@ -320,12 +309,12 @@
getSchemaContext( service ).rename( dn, newdn );
assertTrue( "normalizer OID should still be present",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
assertEquals( "normalizer schema should be set to apache not apachemeta",
- getNormalizerRegistry().getSchemaName( OID ), "apache" );
+ schemaManager.getNormalizerRegistry().getSchemaName( OID ), "apache" );
- Class<?> clazz = getNormalizerRegistry().lookup( OID ).getClass();
+ Class<?> clazz = schemaManager.getNormalizerRegistry().lookup( OID ).getClass();
assertEquals( clazz, NoOpNormalizer.class );
}
@@ -345,15 +334,15 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "old normalizer OID should NOT be present",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
assertTrue( "new normalizer OID should be present",
- getNormalizerRegistry().contains( NEW_OID ) );
+ schemaManager.getNormalizerRegistry().contains( NEW_OID ) );
assertEquals( "normalizer with new oid should have schema set to apache NOT apachemeta",
- getNormalizerRegistry().getSchemaName( NEW_OID ), "apache" );
+ schemaManager.getNormalizerRegistry().getSchemaName( NEW_OID ), "apache" );
- Class<?> clazz = getNormalizerRegistry().lookup( NEW_OID ).getClass();
+ Class<?> clazz = schemaManager.getNormalizerRegistry().lookup( NEW_OID ).getClass();
assertEquals( clazz, NoOpNormalizer.class );
}
@@ -372,12 +361,12 @@
getSchemaContext( service ).modifyAttributes( dn, mods );
assertTrue( "normalizer OID should still be present",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
assertEquals( "normalizer schema should be set to apachemeta",
- getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
+ schemaManager.getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
- Class<?> clazz = getNormalizerRegistry().lookup( OID ).getClass();
+ Class<?> clazz = schemaManager.getNormalizerRegistry().lookup( OID ).getClass();
assertEquals( clazz, DeepTrimNormalizer.class );
}
@@ -395,12 +384,12 @@
getSchemaContext( service ).modifyAttributes( dn, DirContext.REPLACE_ATTRIBUTE, mods );
assertTrue( "normalizer OID should still be present",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
assertEquals( "normalizer schema should be set to apachemeta",
- getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
+ schemaManager.getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
- Class<?> clazz = getNormalizerRegistry().lookup( OID ).getClass();
+ Class<?> clazz = schemaManager.getNormalizerRegistry().lookup( OID ).getClass();
assertEquals( clazz, DeepTrimNormalizer.class );
}
@@ -416,7 +405,7 @@
LdapDN dn = getNormalizerContainer( "apachemeta" );
dn.add( "m-oid" + "=" + OID );
testAddNormalizerToEnabledSchema();
- getMatchingRuleRegistry().register( new DummyMR() );
+ schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
try
{
@@ -429,9 +418,9 @@
}
assertTrue( "normalizer should still be in the registry after delete failure",
- getNormalizerRegistry().contains( OID ) );
- getMatchingRuleRegistry().unregister( OID );
- getOidRegistry().unregister( OID );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().unregister( OID );
+ schemaManager.getOidRegistry().unregister( OID );
}
@@ -440,7 +429,7 @@
public void testMoveNormalizerWhenInUse() throws Exception
{
testAddNormalizerToEnabledSchema();
- getMatchingRuleRegistry().register( new DummyMR() );
+ schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
LdapDN dn = getNormalizerContainer( "apachemeta" );
dn.add( "m-oid" + "=" + OID );
@@ -459,9 +448,9 @@
}
assertTrue( "normalizer should still be in the registry after move failure",
- getNormalizerRegistry().contains( OID ) );
- getMatchingRuleRegistry().unregister( OID );
- getOidRegistry().unregister( OID );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().unregister( OID );
+ schemaManager.getOidRegistry().unregister( OID );
}
@@ -470,7 +459,7 @@
public void testMoveNormalizerAndChangeRdnWhenInUse() throws Exception
{
testAddNormalizerToEnabledSchema();
- getMatchingRuleRegistry().register( new DummyMR() );
+ schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
LdapDN dn = getNormalizerContainer( "apachemeta" );
dn.add( "m-oid" + "=" + OID );
@@ -489,9 +478,9 @@
}
assertTrue( "normalizer should still be in the registry after move failure",
- getNormalizerRegistry().contains( OID ) );
- getMatchingRuleRegistry().unregister( OID );
- getOidRegistry().unregister( OID );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().unregister( OID );
+ schemaManager.getOidRegistry().unregister( OID );
}
@@ -501,7 +490,7 @@
LdapDN dn = getNormalizerContainer( "apachemeta" );
dn.add( "m-oid" + "=" + OID );
testAddNormalizerToEnabledSchema();
- getMatchingRuleRegistry().register( new DummyMR() );
+ schemaManager.getMatchingRuleRegistry().register( new DummyMR() );
LdapDN newdn = getNormalizerContainer( "apachemeta" );
newdn.add( "m-oid" + "=" + NEW_OID );
@@ -517,9 +506,9 @@
}
assertTrue( "normalizer should still be in the registry after rename failure",
- getNormalizerRegistry().contains( OID ) );
- getMatchingRuleRegistry().unregister( OID );
- getOidRegistry().unregister( OID );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
+ schemaManager.getMatchingRuleRegistry().unregister( OID );
+ schemaManager.getOidRegistry().unregister( OID );
}
@@ -551,7 +540,7 @@
}
assertTrue( "normalizer should still be in the registry after move failure",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
}
@@ -578,7 +567,7 @@
}
assertTrue( "normalizer should still be in the registry after move failure",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
}
@@ -598,7 +587,7 @@
getSchemaContext( service ).rename( dn, newdn );
assertFalse( "normalizer OID should no longer be present",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
}
@@ -613,7 +602,7 @@
dn.add( "m-oid" + "=" + OID );
assertFalse( "normalizer OID should NOT be present when added to disabled nis schema",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
LdapDN newdn = getNormalizerContainer( "apachemeta" );
newdn.add( "m-oid" + "=" + OID );
@@ -621,10 +610,10 @@
getSchemaContext( service ).rename( dn, newdn );
assertTrue( "normalizer OID should be present when moved to enabled schema",
- getNormalizerRegistry().contains( OID ) );
+ schemaManager.getNormalizerRegistry().contains( OID ) );
assertEquals( "normalizer should be in apachemeta schema after move",
- getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
+ schemaManager.getNormalizerRegistry().getSchemaName( OID ), "apachemeta" );
}
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaObjectClassHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaObjectClassHandlerIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaObjectClassHandlerIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaObjectClassHandlerIT.java Sat Nov 7 07:57:34 2009
@@ -91,7 +91,7 @@
private static ObjectClassRegistry getObjectClassRegistry()
{
- return service.getRegistries().getObjectClassRegistry();
+ return service.getSchemaManager().getObjectClassRegistry();
}
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSchemaHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSchemaHandlerIT.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSchemaHandlerIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSchemaHandlerIT.java Sat Nov 7 07:57:34 2009
@@ -46,7 +46,6 @@
import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.junit.Before;
import org.junit.Test;
@@ -70,12 +69,6 @@
public static DirectoryService service;
- private static AttributeTypeRegistry getAttributeTypeRegistry()
- {
- return service.getRegistries().getAttributeTypeRegistry();
- }
-
-
@Before
public void checkSambaSchema() throws Exception
{
@@ -354,14 +347,12 @@
@Test
public void testEnableSchema() throws Exception
{
- AttributeTypeRegistry atr = getAttributeTypeRegistry();
-
// check that the nis schema is not loaded
assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
// double check and make sure an attribute from that schema is
// not in the AttributeTypeRegistry
- assertFalse( atr.contains( TEST_ATTR_OID ) );
+ assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
// now enable the test schema
IntegrationUtils.enableSchema( service, "nis" );
@@ -371,7 +362,7 @@
// double check and make sure the test attribute from the
// test schema is now loaded and present within the attr registry
- assertTrue( atr.contains( TEST_ATTR_OID ) );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
}
@@ -384,14 +375,12 @@
@Test
public void testEnableSchemaAlreadyEnabled() throws Exception
{
- AttributeTypeRegistry atr = getAttributeTypeRegistry();
-
// check that the nis schema is not loaded
assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
// double check and make sure an attribute from that schema is
// not in the AttributeTypeRegistry
- assertFalse( atr.contains( TEST_ATTR_OID ) );
+ assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
// now enable the test schema
IntegrationUtils.enableSchema( service, "nis" );
@@ -404,7 +393,7 @@
// double check and make sure the test attribute from the
// test schema is now loaded and present within the attr registry
- assertTrue( atr.contains( TEST_ATTR_OID ) );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
}
@@ -417,14 +406,12 @@
@Test
public void testDisableSchemaAlreadyDisabled() throws Exception
{
- AttributeTypeRegistry atr = getAttributeTypeRegistry();
-
// check that the nis schema is not loaded
assertTrue( IntegrationUtils.isDisabled( service, "nis" ) );
// double check and make sure an attribute from that schema is
// not in the AttributeTypeRegistry
- assertFalse( atr.contains( TEST_ATTR_OID ) );
+ assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
// now disable the test schema
IntegrationUtils.disableSchema( service, "nis" );
@@ -440,7 +427,7 @@
// double check and make sure the test attribute from the
// test schema is now loaded and present within the attr registry
- assertFalse( atr.contains( TEST_ATTR_OID ) );
+ assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
}
@@ -456,14 +443,12 @@
// let's enable the test schema
testEnableSchema();
- AttributeTypeRegistry atr = getAttributeTypeRegistry();
-
// check that the nis schema is enabled
assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
// double check and make sure an attribute from that schema is
// in the AttributeTypeRegistry
- assertTrue( atr.contains( TEST_ATTR_OID ) );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
// now disable the test schema
IntegrationUtils.disableSchema( service, "samba" );
@@ -474,7 +459,7 @@
// double check and make sure the test attribute from the test
// schema is now NOT loaded and present within the attr registry
- assertFalse( atr.contains( TEST_ATTR_OID ) );
+ assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
}
@@ -507,11 +492,9 @@
assertTrue( IntegrationUtils.isEnabled( service, "nis" ) );
assertTrue( IntegrationUtils.isEnabled( service, "dummy" ) );
- AttributeTypeRegistry atr = getAttributeTypeRegistry();
-
// double check and make sure an attribute from that schema is
// in the AttributeTypeRegistry
- assertTrue( atr.contains( TEST_ATTR_OID ) );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
// now try to disable the test schema which should fail
// since it's dependent, the dummy schema, is enabled
@@ -535,7 +518,7 @@
// double check and make sure the test attribute from the test
// schema is still loaded and present within the attr registry
- assertTrue( atr.contains( TEST_ATTR_OID ) );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( TEST_ATTR_OID ) );
}
@@ -626,13 +609,13 @@
LdapContext schemaRoot = getSchemaContext( service );
IntegrationUtils.enableSchema( service, "samba" );
- assertTrue( getAttributeTypeRegistry().contains( "sambaNTPassword" ) );
- assertEquals( "samba", getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "sambaNTPassword" ) );
+ assertEquals( "samba", service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );
schemaRoot.rename( "cn=samba", "cn=foo" );
assertNotNull( schemaRoot.lookup( "cn=foo" ) );
- assertTrue( getAttributeTypeRegistry().contains( "sambaNTPassword" ) );
- assertEquals( "foo", getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );
+ assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "sambaNTPassword" ) );
+ assertEquals( "foo", service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( "sambaNTPassword" ) );
//noinspection EmptyCatchBlock
try