You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2009/12/29 14:59:12 UTC
svn commit: r894392 - in
/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core:
authz/ suites/
Author: kayyagari
Date: Tue Dec 29 13:59:11 2009
New Revision: 894392
URL: http://svn.apache.org/viewvc?rev=894392&view=rev
Log:
o migrated tests to the new testing framework
o removed unnecessary ServiceFactories from AutzIntegrationUtils
Modified:
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/GeneralAuthorizationIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/ModifyAuthorizationIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/MoveRenameAuthorizationIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/AuthzISuite.java
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java Tue Dec 29 13:59:11 2009
@@ -20,20 +20,13 @@
package org.apache.directory.server.core.authz;
-import org.apache.directory.server.core.DirectoryService;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAsAdmin;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
-import org.apache.directory.shared.ldap.name.LdapDN;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.junit.runner.RunWith;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
@@ -42,6 +35,14 @@
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests whether or not authorization around entry addition works properly.
@@ -49,12 +50,16 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class AddAuthorizationIT
+@RunWith ( FrameworkRunner.class )
+public class AddAuthorizationIT extends AbstractTestUnit
{
- public static DirectoryService service;
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
/**
* Checks if a simple entry (organizationalUnit) can be added to the DIT at an
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java Tue Dec 29 13:59:11 2009
@@ -20,27 +20,25 @@
package org.apache.directory.server.core.authz;
-import org.apache.directory.server.core.DirectoryService;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.SetupMode;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.core.integ.annotations.Mode;
-
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import javax.naming.Name;
import javax.naming.NamingException;
import javax.naming.NoPermissionException;
import javax.naming.directory.DirContext;
+import org.apache.directory.server.core.annotations.DSBuilder;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Some tests to make sure users in the cn=Administrators,ou=groups,ou=system
@@ -49,11 +47,16 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Mode ( SetupMode.PRISTINE )
-public class AdministratorsGroupIT
+@RunWith ( FrameworkRunner.class )
+public class AdministratorsGroupIT extends AbstractTestUnit
{
- public static DirectoryService service;
+
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
boolean canReadAdministrators( DirContext ctx ) throws NamingException
{
@@ -79,9 +82,12 @@
* @throws Exception on failures
*/
@Test
- @Factory ( AutzIntegUtils.ServiceFactory.class )
+ @DSBuilder ( enableAccessControl=true, name="testNonAdminReadAccessToGroups-method" )
public void testNonAdminReadAccessToGroups() throws Exception
{
+ // this is required cause the new service is at method level
+ AutzIntegUtils.service = service;
+
Name billydDn = createUser( "billyd", "s3kr3t" );
// this should fail with a no permission exception because we
@@ -112,9 +118,12 @@
* @throws Exception on failure
*/
@Test
- @Factory ( AutzIntegUtils.DefaultServiceFactory.class )
+ @DSBuilder ( name="testNonAdminReadAccessToGroups-method" )
public void testDefaultNonAdminReadAccessToGroups() throws Exception
{
+ // this is required cause the new service is at method level
+ AutzIntegUtils.service = service;
+
Name billydDn = createUser( "billyd", "s3kr3t" );
assertFalse( service.isAccessControlEnabled() );
DirContext ctx = getContextAs( billydDn, "s3kr3t" );
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java Tue Dec 29 13:59:11 2009
@@ -20,20 +20,13 @@
package org.apache.directory.server.core.authz;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
-import org.apache.directory.shared.ldap.util.ArrayUtils;
-import org.apache.directory.shared.ldap.util.StringTools;
-
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+
+import java.util.HashSet;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
@@ -43,7 +36,15 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
-import java.util.HashSet;
+
+import org.apache.directory.server.core.annotations.DSBuilder;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
+import org.apache.directory.shared.ldap.util.ArrayUtils;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
@@ -53,12 +54,9 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class AuthorizationServiceAsAdminIT
+@RunWith ( FrameworkRunner.class )
+public class AuthorizationServiceAsAdminIT extends AbstractTestUnit
{
- public static DirectoryService service;
-
/**
* Makes sure the admin cannot delete the admin account.
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminIT.java Tue Dec 29 13:59:11 2009
@@ -32,11 +32,10 @@
import javax.naming.NamingException;
import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.LdapPrincipal;
import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.annotations.Factory;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -63,12 +62,9 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class AuthorizationServiceAsNonAdminIT
+@RunWith ( FrameworkRunner.class )
+public class AuthorizationServiceAsNonAdminIT extends AbstractTestUnit
{
- public static DirectoryService service;
-
/**
* Makes sure a non-admin user cannot delete the admin account.
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java Tue Dec 29 13:59:11 2009
@@ -20,19 +20,19 @@
package org.apache.directory.server.core.authz;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
+import static org.junit.Assert.fail;
import junit.framework.Assert;
+
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.core.DirectoryService;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.fail;
+import org.junit.Before;
import org.junit.Test;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
+import org.junit.runner.RunWith;
/**
@@ -41,13 +41,16 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class AuthzAuthnIT
+@RunWith ( FrameworkRunner.class )
+public class AuthzAuthnIT extends AbstractTestUnit
{
- public static DirectoryService service;
-
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
/**
* Checks to make sure a user can authenticate with RootDSE as the
* provider URL without need of any access control permissions.
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java Tue Dec 29 13:59:11 2009
@@ -21,13 +21,8 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
-import static org.junit.Assert.fail;
-import java.io.File;
-import java.util.HashSet;
import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
import javax.naming.Name;
import javax.naming.NamingException;
@@ -40,27 +35,10 @@
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.entry.ServerEntry;
-import org.apache.directory.server.core.integ.DirectoryServiceFactory;
-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.core.subtree.SubentryInterceptor;
-import org.apache.directory.server.xdbm.Index;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
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.ldif.extractor.impl.DefaultSchemaLdifExtractor;
-import org.apache.directory.shared.ldap.schema.loader.ldif.JarLdifSchemaLoader;
-import org.apache.directory.shared.ldap.schema.loader.ldif.LdifSchemaLoader;
-import org.apache.directory.shared.ldap.schema.manager.impl.DefaultSchemaManager;
-import org.apache.directory.shared.ldap.schema.registries.SchemaLoader;
-import org.apache.directory.shared.ldap.util.ExceptionUtils;
/**
@@ -74,164 +52,6 @@
{
public static DirectoryService service;
- public static class ServiceFactory 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";
- }
-
- service = new DefaultDirectoryService();
- service.setWorkingDirectory( new File( workingDirectory ) );
-
- return service;
- }
-
-
- public void init() throws Exception
- {
- SchemaPartition schemaPartition = service.getSchemaService().getSchemaPartition();
-
- // Init the LdifPartition
- LdifPartition ldifPartition = new LdifPartition();
-
- String workingDirectory = service.getWorkingDirectory().getPath();
-
- 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 DefaultSchemaLdifExtractor( new File( workingDirectory ) );
- extractor.extractOrCopy();
-
- schemaPartition.setWrappedPartition( ldifPartition );
-
- SchemaLoader loader = new LdifSchemaLoader( schemaRepository );
-
- SchemaManager schemaManager = new DefaultSchemaManager( loader );
- service.setSchemaManager( schemaManager );
-
- schemaManager.loadAllEnabled();
-
- List<Throwable> errors = schemaManager.getErrors();
-
- if ( errors.size() != 0 )
- {
- fail( "Schema load failed : " + ExceptionUtils.printErrors( errors ) );
- }
-
- schemaPartition.setSchemaManager( schemaManager );
-
- 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.setSchemaManager( schemaManager );
- ( ( 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 );
-
- service.setSystemPartition( systemPartition );
- service.setAccessControlEnabled( true );
- }
- }
-
- public static class DefaultServiceFactory 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 ) );
-
- return service;
- }
-
-
- public void init() throws Exception
- {
- SchemaPartition schemaPartition = service.getSchemaService().getSchemaPartition();
-
- // Init the LdifPartition
- LdifPartition ldifPartition = new LdifPartition();
-
- String workingDirectory = service.getWorkingDirectory().getPath();
-
- 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 DefaultSchemaLdifExtractor( new File( workingDirectory ) );
-
- schemaPartition.setWrappedPartition( ldifPartition );
-
- JarLdifSchemaLoader loader = new JarLdifSchemaLoader();
- SchemaManager schemaManager = new DefaultSchemaManager( loader );
- service.setSchemaManager( schemaManager );
-
- schemaManager.loadAllEnabled();
-
- List<Throwable> errors = schemaManager.getErrors();
-
- if ( errors.size() != 0 )
- {
- fail( "Schema load failed : " + ExceptionUtils.printErrors( errors ) );
- }
-
- schemaPartition.setSchemaManager( schemaManager );
-
- 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.setSchemaManager( schemaManager );
- ( ( 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 );
-
- service.setSystemPartition( systemPartition );
- service.setAccessControlEnabled( false );
- AutzIntegUtils.service = service;
- }
- }
-
-
// -----------------------------------------------------------------------
// Utility methods used by subclasses
// -----------------------------------------------------------------------
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java Tue Dec 29 13:59:11 2009
@@ -20,27 +20,29 @@
package org.apache.directory.server.core.authz;
-import org.apache.directory.server.core.jndi.ServerLdapContext;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.junit.runner.RunWith;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAsAdmin;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+
+import org.apache.directory.server.core.annotations.DSBuilder;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.core.jndi.ServerLdapContext;
+import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.junit.Before;
import org.junit.Test;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAsAdmin;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
+import org.junit.runner.RunWith;
/**
@@ -49,13 +51,17 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class CompareAuthorizationIT
+@RunWith ( FrameworkRunner.class )
+public class CompareAuthorizationIT extends AbstractTestUnit
{
- public static DirectoryService service;
-
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
+
/**
* Checks if an attribute of a simple entry (an organizationalUnit's telephoneNumber)
* with an RDN relative to ou=system can be compared by a specific non-admin user.
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java Tue Dec 29 13:59:11 2009
@@ -19,14 +19,13 @@
*/
package org.apache.directory.server.core.authz;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.core.DirectoryService;
-import org.junit.runner.RunWith;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAsAdmin;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
@@ -34,14 +33,14 @@
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.junit.Before;
import org.junit.Test;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAsAdmin;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
+import org.junit.runner.RunWith;
/**
@@ -50,13 +49,17 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class DeleteAuthorizationIT
+@RunWith ( FrameworkRunner.class )
+public class DeleteAuthorizationIT extends AbstractTestUnit
{
- public static DirectoryService service;
-
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
+
/**
* Checks if a simple entry (organizationalUnit) can be deleted from the DIT at an
* RDN relative to ou=system by a specific non-admin user. The entry is first
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/GeneralAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/GeneralAuthorizationIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/GeneralAuthorizationIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/GeneralAuthorizationIT.java Tue Dec 29 13:59:11 2009
@@ -20,19 +20,20 @@
package org.apache.directory.server.core.authz;
-import org.apache.directory.server.core.DirectoryService;
import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
import javax.naming.NamingException;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests various authorization functionality without any specific operation.
@@ -40,13 +41,17 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev: 494176 $
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class GeneralAuthorizationIT
+@RunWith ( FrameworkRunner.class )
+public class GeneralAuthorizationIT extends AbstractTestUnit
{
- public static DirectoryService service;
-
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
+
/**
* Checks to make sure we cannot create a malformed ACI missing two
* last brackets.
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/ModifyAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/ModifyAuthorizationIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/ModifyAuthorizationIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/ModifyAuthorizationIT.java Tue Dec 29 13:59:11 2009
@@ -20,16 +20,23 @@
package org.apache.directory.server.core.authz;
-import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
-import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.core.DirectoryService;
-import org.junit.runner.RunWith;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.changePresciptiveACI;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createGroup;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.deleteAccessControlSubentry;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAsAdmin;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
-import javax.naming.NamingException;
-import javax.naming.NamingEnumeration;
import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
@@ -37,21 +44,13 @@
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
-import java.util.List;
-import java.util.ArrayList;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.junit.Before;
import org.junit.Test;
-
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAsAdmin;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.deleteAccessControlSubentry;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createGroup;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.changePresciptiveACI;
+import org.junit.runner.RunWith;
/**
@@ -60,13 +59,17 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class ModifyAuthorizationIT
+@RunWith ( FrameworkRunner.class )
+public class ModifyAuthorizationIT extends AbstractTestUnit
{
- public static DirectoryService service;
-
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
+
/**
* Checks if an attribute of a simple entry (an organizationalUnit) with an RDN
* relative to ou=system can be modified by a specific non-admin user. If a
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/MoveRenameAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/MoveRenameAuthorizationIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/MoveRenameAuthorizationIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/MoveRenameAuthorizationIT.java Tue Dec 29 13:59:11 2009
@@ -19,14 +19,16 @@
*/
package org.apache.directory.server.core.authz;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
-import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.core.DirectoryService;
-import org.junit.runner.RunWith;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.deleteAccessControlSubentry;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.deleteUser;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAsAdmin;
+import static org.apache.directory.server.core.authz.AutzIntegUtils.removeUserFromGroup;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
@@ -34,18 +36,14 @@
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.DirContext;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.junit.Before;
import org.junit.Test;
-
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createUser;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.deleteUser;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAs;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.getContextAsAdmin;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.createAccessControlSubentry;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.addUserToGroup;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.deleteAccessControlSubentry;
-import static org.apache.directory.server.core.authz.AutzIntegUtils.removeUserFromGroup;
+import org.junit.runner.RunWith;
/**
@@ -54,13 +52,17 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class MoveRenameAuthorizationIT
+@RunWith ( FrameworkRunner.class )
+public class MoveRenameAuthorizationIT extends AbstractTestUnit
{
- public static DirectoryService service;
-
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
+
/**
* Checks if a simple entry (organizationalUnit) can be renamed at an RDN relative
* to ou=system by a specific non-admin user. If a permission exception
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java Tue Dec 29 13:59:11 2009
@@ -51,12 +51,12 @@
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.annotations.Factory;
+import org.apache.directory.server.core.integ.AbstractTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
import org.apache.directory.shared.ldap.name.LdapDN;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -68,13 +68,17 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( AutzIntegUtils.ServiceFactory.class )
-public class SearchAuthorizationIT
+@RunWith ( FrameworkRunner.class )
+public class SearchAuthorizationIT extends AbstractTestUnit
{
- public static DirectoryService service;
-
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
+
/**
* The search results of tests are added to this map via put (<String, SearchResult>)
* the map is also cleared before each search test. This allows further inspections
Modified: directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/AuthzISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/AuthzISuite.java?rev=894392&r1=894391&r2=894392&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/AuthzISuite.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-integ/src/test/java/org/apache/directory/server/core/suites/AuthzISuite.java Tue Dec 29 13:59:11 2009
@@ -19,6 +19,7 @@
package org.apache.directory.server.core.suites;
+import org.apache.directory.server.core.annotations.DSBuilder;
import org.apache.directory.server.core.authz.AddAuthorizationIT;
import org.apache.directory.server.core.authz.AdministratorsGroupIT;
import org.apache.directory.server.core.authz.AuthorizationServiceAsAdminIT;
@@ -30,9 +31,7 @@
import org.apache.directory.server.core.authz.ModifyAuthorizationIT;
import org.apache.directory.server.core.authz.MoveRenameAuthorizationIT;
import org.apache.directory.server.core.authz.SearchAuthorizationIT;
-import org.apache.directory.server.core.integ.CiSuite;
-import org.apache.directory.server.core.integ.Level;
-import org.apache.directory.server.core.integ.annotations.CleanupLevel;
+import org.apache.directory.server.core.integ.FrameworkSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -43,7 +42,8 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith ( CiSuite.class )
+@RunWith ( FrameworkSuite.class )
+@DSBuilder( enableAccessControl=true, name="AuthzISuite" )
@Suite.SuiteClasses ( {
AddAuthorizationIT.class,
AuthorizationServiceAsAdminIT.class,
@@ -59,7 +59,6 @@
// the default factory service running instead of
// one with
} )
-@CleanupLevel ( Level.SUITE )
public class AuthzISuite
{
}