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 2010/01/06 19:27:19 UTC
svn commit: r896599 [5/30] - in /directory/apacheds/trunk: ./ avl-partition/
avl-partition/src/ avl-partition/src/main/ avl-partition/src/main/java/
avl-partition/src/main/java/org/ avl-partition/src/main/java/org/apache/
avl-partition/src/main/java/or...
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java Wed Jan 6 18:26:43 2010
@@ -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.AbstractLdapTestUnit;
+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 AbstractLdapTestUnit
{
- 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/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AdministratorsGroupIT.java Wed Jan 6 18:26:43 2010
@@ -20,25 +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.*;
-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.CreateDS;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+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
@@ -47,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 AbstractLdapTestUnit
{
- public static DirectoryService service;
+
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ }
+
boolean canReadAdministrators( DirContext ctx ) throws NamingException
{
@@ -77,9 +82,12 @@
* @throws Exception on failures
*/
@Test
- @Factory ( AutzIntegUtils.ServiceFactory.class )
+ @CreateDS ( 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
@@ -110,9 +118,12 @@
* @throws Exception on failure
*/
@Test
- @Factory ( AutzIntegUtils.DefaultServiceFactory.class )
+ @CreateDS ( 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/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsAdminIT.java Wed Jan 6 18:26:43 2010
@@ -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,14 @@
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.integ.AbstractLdapTestUnit;
+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 +53,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 AbstractLdapTestUnit
{
- public static DirectoryService service;
-
/**
* Makes sure the admin cannot delete the admin account.
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthorizationServiceAsNonAdminIT.java Wed Jan 6 18:26:43 2010
@@ -20,17 +20,22 @@
package org.apache.directory.server.core.authz;
+import static org.apache.directory.server.core.integ.IntegrationUtils.getUserAddLdif;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import javax.naming.NamingException;
+
import org.apache.directory.server.core.CoreSession;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.LdapPrincipal;
import org.apache.directory.server.core.entry.DefaultServerEntry;
-import org.apache.directory.server.core.integ.CiRunner;
-import static org.apache.directory.server.core.integ.IntegrationUtils.getUserAddLdif;
-import org.apache.directory.server.core.integ.annotations.Factory;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+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;
@@ -46,15 +51,9 @@
import org.apache.directory.shared.ldap.message.AliasDerefMode;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.naming.NamingException;
-
/**
* Tests the Authorization service to make sure it is enforcing policies
@@ -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 AbstractLdapTestUnit
{
- public static DirectoryService service;
-
/**
* Makes sure a non-admin user cannot delete the admin account.
@@ -81,7 +77,7 @@
LdifEntry akarasulu = getUserAddLdif();
service.getAdminSession().add(
- new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );
+ new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );
try
{
@@ -106,7 +102,7 @@
LdifEntry akarasulu = getUserAddLdif();
service.getAdminSession().add(
- new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );
+ new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );
try
{
@@ -134,7 +130,7 @@
LdifEntry akarasulu = getUserAddLdif();
service.getAdminSession().add(
- new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );
+ new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );
// Read the entry we just created using the akarasuluSession
Entry readEntry = service.getAdminSession().lookup( akarasulu.getDn(), new String[]{ "userPassword"} );
@@ -149,7 +145,7 @@
mods.add( mod );
LdapDN userDn = new LdapDN( "uid=akarasulu,ou=users,ou=system" );
- userDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+ userDn.normalize( service.getSchemaManager().getAttributeTypeRegistry().getNormalizerMapping() );
LdapPrincipal principal = new LdapPrincipal( userDn, AuthenticationLevel.SIMPLE );
CoreSession akarasuluSession = service.getSession( principal );
@@ -176,7 +172,7 @@
LdifEntry akarasulu = getUserAddLdif();
service.getAdminSession().add(
- new DefaultServerEntry( service.getRegistries(), akarasulu.getEntry() ) );
+ new DefaultServerEntry( service.getSchemaManager(), akarasulu.getEntry() ) );
try
{
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AuthzAuthnIT.java Wed Jan 6 18:26:43 2010
@@ -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.AbstractLdapTestUnit;
+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.*;
-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 AbstractLdapTestUnit
{
- 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/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java Wed Jan 6 18:26:43 2010
@@ -20,14 +20,9 @@
package org.apache.directory.server.core.authz;
-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.integ.DirectoryServiceFactory;
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
-import org.apache.directory.server.core.subtree.SubentryInterceptor;
-import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.name.LdapDN;
+
+import java.util.Hashtable;
import javax.naming.Name;
import javax.naming.NamingException;
@@ -38,7 +33,12 @@
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.ldap.LdapContext;
-import java.util.Hashtable;
+
+import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.subtree.SubentryInterceptor;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.name.LdapDN;
/**
@@ -52,33 +52,6 @@
{
public static DirectoryService service;
-
- public static class ServiceFactory implements DirectoryServiceFactory
- {
- public DirectoryService newInstance()
- {
- DefaultDirectoryService service = new DefaultDirectoryService();
- service.setAccessControlEnabled( true );
- service.getChangeLog().setEnabled( true );
- AutzIntegUtils.service = service;
- return service;
- }
- }
-
-
- public static class DefaultServiceFactory implements DirectoryServiceFactory
- {
- public DirectoryService newInstance()
- {
- DefaultDirectoryService service = new DefaultDirectoryService();
- service.setAccessControlEnabled( false );
- service.getChangeLog().setEnabled( true );
- AutzIntegUtils.service = service;
- return service;
- }
- }
-
-
// -----------------------------------------------------------------------
// Utility methods used by subclasses
// -----------------------------------------------------------------------
@@ -108,7 +81,7 @@
public static DirContext getContextAsAdmin( String dn ) throws Exception
{
LdapContext sysRoot = getSystemContext( service );
- Hashtable<String,Object> env = ( Hashtable<String,Object> ) sysRoot.getEnvironment().clone();
+ Hashtable<String, Object> env = ( Hashtable<String, Object> ) sysRoot.getEnvironment().clone();
env.put( DirContext.PROVIDER_URL, dn );
env.put( DirContext.SECURITY_AUTHENTICATION, "simple" );
env.put( DirContext.SECURITY_PRINCIPAL, "uid=admin, ou=system" );
@@ -202,7 +175,7 @@
group.put( objectClass );
objectClass.add( "top" );
objectClass.add( "groupOfUniqueNames" );
-
+
// TODO might be ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED
group.put( "uniqueMember", "uid=admin, ou=system" );
adminCtx.createSubcontext( "cn=" + groupName + ",ou=groups", group );
@@ -268,7 +241,7 @@
public static DirContext getContextAs( Name user, String password, String dn ) throws Exception
{
LdapContext sysRoot = getSystemContext( service );
- Hashtable<String,Object> env = ( Hashtable<String,Object> ) sysRoot.getEnvironment().clone();
+ Hashtable<String, Object> env = ( Hashtable<String, Object> ) sysRoot.getEnvironment().clone();
env.put( DirContext.PROVIDER_URL, dn );
env.put( DirContext.SECURITY_AUTHENTICATION, "simple" );
env.put( DirContext.SECURITY_PRINCIPAL, user.toString() );
@@ -368,8 +341,8 @@
Attributes changes = new BasicAttributes( "subentryACI", aciItem, true );
adminCtx.modifyAttributes( "", DirContext.ADD_ATTRIBUTE, changes );
}
-
-
+
+
/**
* Replaces values of an prescriptiveACI attribute of a subentry subordinate
* to ou=system.
@@ -384,7 +357,8 @@
Attributes changes = new BasicAttributes( "prescriptiveACI", aciItem, true );
adminCtx.modifyAttributes( "cn=" + cn, DirContext.REPLACE_ATTRIBUTE, changes );
}
-
+
+
public static void addPrescriptiveACI( String cn, String aciItem ) throws Exception
{
DirContext adminCtx = getContextAsAdmin();
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java Wed Jan 6 18:26:43 2010
@@ -20,27 +20,28 @@
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.integ.AbstractLdapTestUnit;
+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 +50,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 AbstractLdapTestUnit
{
- 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/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/DeleteAuthorizationIT.java Wed Jan 6 18:26:43 2010
@@ -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,13 @@
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.integ.AbstractLdapTestUnit;
+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 +48,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 AbstractLdapTestUnit
{
- 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/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/GeneralAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/GeneralAuthorizationIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/GeneralAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/GeneralAuthorizationIT.java Wed Jan 6 18:26:43 2010
@@ -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.AbstractLdapTestUnit;
+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 AbstractLdapTestUnit
{
- 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/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/ModifyAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/ModifyAuthorizationIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/ModifyAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/ModifyAuthorizationIT.java Wed Jan 6 18:26:43 2010
@@ -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.AbstractLdapTestUnit;
+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 AbstractLdapTestUnit
{
- 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/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/MoveRenameAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/MoveRenameAuthorizationIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/MoveRenameAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/MoveRenameAuthorizationIT.java Wed Jan 6 18:26:43 2010
@@ -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,13 @@
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.integ.AbstractLdapTestUnit;
+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 +51,18 @@
* @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 AbstractLdapTestUnit
{
- public static DirectoryService service;
-
+ @Before
+ public void setService()
+ {
+ AutzIntegUtils.service = service;
+ service.setAccessControlEnabled( true );
+ }
+
+
/**
* 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/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java Wed Jan 6 18:26:43 2010
@@ -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.AbstractLdapTestUnit;
+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 AbstractLdapTestUnit
{
- 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/trunk/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/changelog/DefaultChangeLogIT.java Wed Jan 6 18:26:43 2010
@@ -19,21 +19,14 @@
package org.apache.directory.server.core.changelog;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
-import static org.apache.directory.server.core.integ.state.TestServiceContext.shutdown;
-import static org.apache.directory.server.core.integ.state.TestServiceContext.startup;
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
-import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
@@ -43,7 +36,16 @@
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
import javax.naming.ldap.LdapContext;
-import java.util.Arrays;
+
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -54,15 +56,12 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith ( CiRunner.class )
-public class DefaultChangeLogIT
+@RunWith ( FrameworkRunner.class )
+@CreateDS( factory=DefaultDirectoryServiceFactory.class, name="DefaultChangeLogIT-class" )
+public class DefaultChangeLogIT extends AbstractLdapTestUnit
{
public static final Logger LOG = LoggerFactory.getLogger( DefaultChangeLogIT.class );
- public static DirectoryService service;
-
-
-// service.setShutdownHookEnabled( false );
@Test
public void testManyTagsPersistenceAcrossRestarts() throws Exception, InterruptedException
@@ -92,8 +91,8 @@
assertEquals( revision + 2, service.getChangeLog().getCurrentRevision() );
assertEquals( revision + 2, t1.getRevision() );
- shutdown();
- startup();
+ service.shutdown();
+ service.startup();
assertEquals( revision + 2, service.getChangeLog().getCurrentRevision() );
assertEquals( t1, service.getChangeLog().getLatest() );
@@ -120,8 +119,8 @@
assertEquals( t1, service.getChangeLog().getLatest() );
// no sync this time but should happen automatically
- shutdown();
- startup();
+ service.shutdown();
+ service.startup();
assertEquals( revision + 7, service.getChangeLog().getCurrentRevision() );
assertEquals( t1, service.getChangeLog().getLatest() );
assertEquals( revision + 2, t1.getRevision() );
@@ -151,8 +150,8 @@
sysRoot.createSubcontext( "ou=test", attrs );
assertEquals( revision + 1, service.getChangeLog().getCurrentRevision() );
- shutdown();
- startup();
+ service.shutdown();
+ service.startup();
assertEquals( revision + 1, service.getChangeLog().getCurrentRevision() );
assertEquals( t0, service.getChangeLog().getLatest() );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java Wed Jan 6 18:26:43 2010
@@ -20,18 +20,15 @@
package org.apache.directory.server.core.collective;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.SetupMode;
-import org.apache.directory.server.core.integ.annotations.Mode;
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+
+import java.util.HashMap;
+import java.util.Map;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
@@ -44,8 +41,11 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
-import java.util.HashMap;
-import java.util.Map;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
@@ -54,72 +54,64 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Mode ( SetupMode.ROLLBACK )
-public class CollectiveAttributeServiceIT
+@RunWith ( FrameworkRunner.class )
+public class CollectiveAttributeServiceIT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
-
- public Attributes getTestEntry( String cn )
+ private Attributes getTestEntry( String cn ) throws NamingException
{
- Attributes subentry = new BasicAttributes( true );
- Attribute objectClass = new BasicAttribute( "objectClass" );
- objectClass.add( "top" );
- objectClass.add( "person" );
- subentry.put( objectClass );
- subentry.put( "cn", cn );
- subentry.put( "sn", "testentry" );
+ Attributes subentry = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: person",
+ "cn", cn ,
+ "sn: testentry" );
+
return subentry;
}
- public Attributes getTestSubentry()
+ private Attributes getTestSubentry() throws NamingException
{
- Attributes subentry = new BasicAttributes( true );
- Attribute objectClass = new BasicAttribute( "objectClass" );
- objectClass.add( "top" );
- objectClass.add( "subentry" );
- objectClass.add( "collectiveAttributeSubentry" );
- subentry.put( objectClass );
- subentry.put( "c-ou", "configuration" );
- subentry.put( "subtreeSpecification", "{ base \"ou=configuration\" }" );
- subentry.put( "cn", "testsubentry" );
+ Attributes subentry = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: subentry",
+ "objectClass: collectiveAttributeSubentry",
+ "c-ou: configuration",
+ "subtreeSpecification: { base \"ou=configuration\" }",
+ "cn: testsubentry" );
+
return subentry;
}
- public Attributes getTestSubentry2()
+ private Attributes getTestSubentry2() throws NamingException
{
- Attributes subentry = new BasicAttributes( true );
- Attribute objectClass = new BasicAttribute( "objectClass" );
- objectClass.add( "top" );
- objectClass.add( "subentry" );
- objectClass.add( "collectiveAttributeSubentry" );
- subentry.put( objectClass );
- subentry.put( "c-ou", "configuration2" );
- subentry.put( "subtreeSpecification", "{ base \"ou=configuration\" }" );
- subentry.put( "cn", "testsubentry2" );
+ Attributes subentry = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: subentry",
+ "objectClass: collectiveAttributeSubentry",
+ "c-ou: configuration2",
+ "subtreeSpecification: { base \"ou=configuration\" }",
+ "cn: testsubentry2" );
+
return subentry;
}
- public Attributes getTestSubentry3()
+ private Attributes getTestSubentry3() throws NamingException
{
- Attributes subentry = new BasicAttributes( true );
- Attribute objectClass = new BasicAttribute( "objectClass" );
- objectClass.add( "top" );
- objectClass.add( "subentry" );
- objectClass.add( "collectiveAttributeSubentry" );
- subentry.put( objectClass );
- subentry.put( "c-st", "FL" );
- subentry.put( "subtreeSpecification", "{ base \"ou=configuration\" }" );
- subentry.put( "cn", "testsubentry3" );
+ Attributes subentry = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: subentry",
+ "objectClass: collectiveAttributeSubentry",
+ "c-st: FL",
+ "subtreeSpecification: { base \"ou=configuration\" }",
+ "cn: testsubentry3" );
+
return subentry;
}
- public void addAdministrativeRole( String role ) throws Exception
+ private void addAdministrativeRole( String role ) throws Exception
{
Attribute attribute = new BasicAttribute( "administrativeRole" );
attribute.add( role );
@@ -128,7 +120,7 @@
}
- public Map<String, Attributes> getAllEntries() throws Exception
+ private Map<String, Attributes> getAllEntries() throws Exception
{
Map<String, Attributes> resultMap = new HashMap<String, Attributes>();
SearchControls controls = new SearchControls();
@@ -146,25 +138,7 @@
}
- public SearchResult getEntry( String name ) throws Exception
- {
- SearchControls controls = new SearchControls();
- controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- controls.setReturningAttributes( new String[]
- { "+", "*" } );
-
- NamingEnumeration<SearchResult> results = getSystemContext( service ).search( name, "(objectClass=*)", controls );
-
- if ( results.hasMore() )
- {
- return results.next();
- }
-
- return null;
- }
-
-
- public Map<String, Attributes> getAllEntriesRestrictAttributes() throws Exception
+ private Map<String, Attributes> getAllEntriesRestrictAttributes() throws Exception
{
Map<String, Attributes> resultMap = new HashMap<String, Attributes>();
SearchControls controls = new SearchControls();
@@ -181,7 +155,7 @@
}
- public Map<String, Attributes> getAllEntriesCollectiveAttributesOnly() throws Exception
+ private Map<String, Attributes> getAllEntriesCollectiveAttributesOnly() throws Exception
{
Map<String, Attributes> resultMap = new HashMap<String, Attributes>();
SearchControls controls = new SearchControls();
@@ -465,10 +439,11 @@
@Test
- public void testAddRegularEntryWithCollectiveAttribute()
+ public void testAddRegularEntryWithCollectiveAttribute() throws NamingException
{
Attributes entry = getTestEntry( "Ersin Er" );
entry.put( "c-l", "Turkiye" );
+
try
{
getSystemContext( service ).createSubcontext( "cn=Ersin Er", entry );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java Wed Jan 6 18:26:43 2010
@@ -20,14 +20,22 @@
package org.apache.directory.server.core.configuration;
+import java.util.Hashtable;
+import java.util.UUID;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+
import junit.framework.Assert;
+
import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.entry.DefaultServerEntry;
import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.integ.CiRunner;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.jndi.CoreContextFactory;
-import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
import org.apache.directory.shared.ldap.csn.CsnFactory;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -35,12 +43,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import java.util.Hashtable;
-import java.util.UUID;
-
/**
* Tests dynamic partition addition and removal.
@@ -48,25 +50,24 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-public class PartitionConfigurationIT
+@RunWith ( FrameworkRunner.class )
+public class PartitionConfigurationIT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
@Test
public void testAddAndRemove() throws Exception
{
- Partition partition = new JdbmPartition();
+ JdbmPartition partition = new JdbmPartition();
partition.setId( "removable" );
partition.setSuffix( "ou=removable" );
+ partition.setPartitionDir( service.getWorkingDirectory() );
// Test AddContextPartition
service.addPartition( partition );
LdapDN suffixDn = new LdapDN( "ou=removable" );
- suffixDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
- ServerEntry ctxEntry = new DefaultServerEntry( service.getRegistries(), suffixDn );
+ suffixDn.normalize( service.getSchemaManager().getNormalizerMapping() );
+ ServerEntry ctxEntry = new DefaultServerEntry( service.getSchemaManager(), suffixDn );
ctxEntry.put( "objectClass", "top" );
ctxEntry.get( "objectClass" ).add( "organizationalUnit" );
ctxEntry.put( "ou", "removable" );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/event/EventServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/event/EventServiceIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/event/EventServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/event/EventServiceIT.java Wed Jan 6 18:26:43 2010
@@ -20,18 +20,15 @@
package org.apache.directory.server.core.event;
-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 static org.junit.Assert.assertEquals;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.EventObject;
+import java.util.List;
import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
import javax.naming.directory.SearchControls;
import javax.naming.event.EventDirContext;
import javax.naming.event.NamespaceChangeListener;
@@ -39,9 +36,11 @@
import javax.naming.event.NamingExceptionEvent;
import javax.naming.event.ObjectChangeListener;
-import java.util.ArrayList;
-import java.util.EventObject;
-import java.util.List;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
@@ -50,12 +49,9 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-public class EventServiceIT
+@RunWith ( FrameworkRunner.class )
+public class EventServiceIT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
-
/**
* Test to make sure NamingListener's are no longer registered
* after they are removed via the EventContex.removeNamingListener method.
@@ -68,10 +64,12 @@
TestListener listener = new TestListener();
EventDirContext ctx = ( EventDirContext ) getSystemContext( service ).lookup( "" );
ctx.addNamingListener( "", SearchControls.SUBTREE_SCOPE, listener );
- Attributes testEntry = new BasicAttributes( "ou", "testentry", true );
- Attribute objectClass = new BasicAttribute( "objectClass", "top" );
- objectClass.add( "organizationalUnit" );
- testEntry.put( objectClass );
+
+ Attributes testEntry = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "ou", "testentry" );
+
ctx.createSubcontext( "ou=testentry", testEntry );
// Wait 1 second, as the process is asynchronous
@@ -118,10 +116,12 @@
TestListener listener = new TestListener();
EventDirContext ctx = ( EventDirContext ) getSystemContext( service ).lookup( "" );
ctx.addNamingListener( "", SearchControls.SUBTREE_SCOPE, listener );
- Attributes testEntry = new BasicAttributes( "ou", "testentry", true );
- Attribute objectClass = new BasicAttribute( "objectClass", "top" );
- objectClass.add( "organizationalUnit" );
- testEntry.put( objectClass );
+
+ Attributes testEntry = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "ou", "testentry" );
+
ctx.createSubcontext( "ou=testentry", testEntry );
// Wait 1 second, as the process is asynchronous
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceIT.java Wed Jan 6 18:26:43 2010
@@ -20,22 +20,12 @@
package org.apache.directory.server.core.exception;
-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.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.exception.LdapContextNotEmptyException;
-import org.apache.directory.shared.ldap.exception.LdapNameAlreadyBoundException;
-import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
-import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
@@ -49,6 +39,18 @@
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.exception.LdapContextNotEmptyException;
+import org.apache.directory.shared.ldap.exception.LdapNameAlreadyBoundException;
+import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
+import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests the correct operation of the ServerExceptionService.
@@ -56,12 +58,9 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-public class ExceptionServiceIT
+@RunWith ( FrameworkRunner.class )
+public class ExceptionServiceIT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
-
private DirContext createSubContext( String type, String value ) throws Exception
{
return createSubContext( getSystemContext( service ), type, value );
@@ -70,17 +69,14 @@
private DirContext createSubContext( DirContext ctx, String type, String value ) throws NamingException
{
- Attributes attrs = new BasicAttributes( type, value, true );
- Attribute attr = new BasicAttribute( "ObjectClass" );
- attr.add( "top" );
- attr.add( "person" );
- attr.add( "OrganizationalPerson" );
- attrs.put( attr );
+ Attributes subentry = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: person",
+ "objectClass: OrganizationalPerson",
+ "sn", value,
+ "cn", value );
- attrs.put( "sn", value );
- attrs.put( "cn", value );
-
- return ctx.createSubcontext( type + "=" + value, attrs );
+ return ctx.createSubcontext( type + "=" + value, subentry );
}
@@ -296,7 +292,7 @@
}
catch ( LdapNameNotFoundException e )
{
- assertEquals( "ou=system", e.getResolvedName().toString() );
+ assertEquals( "ou=blah,ou=system", e.getResolvedName().toString() );
assertEquals( ResultCodeEnum.NO_SUCH_OBJECT, e.getResultCode() );
}
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/AddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/AddIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/AddIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/AddIT.java Wed Jan 6 18:26:43 2010
@@ -20,22 +20,25 @@
package org.apache.directory.server.core.jndi;
-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.shared.ldap.exception.LdapInvalidAttributeValueException;
-import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
+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 org.junit.Test;
-import org.junit.runner.RunWith;
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 javax.naming.ldap.LdapContext;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Contributed by Luke Taylor to fix DIRSERVER-169.
@@ -43,59 +46,55 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-public class AddIT
+@RunWith(FrameworkRunner.class)
+public class AddIT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
+ // /**
+ // * Test that attribute name case is preserved after adding an entry
+ // * in the case the user added them. This is to test DIRSERVER-832.
+ // */
+ // public void testAddCasePreservedOnAttributeNames() throws Exception
+ // {
+ // Attributes attrs = new AttributesImpl( true );
+ // Attribute oc = new AttributeImpl( "ObjectClass", "top" );
+ // oc.add( "PERSON" );
+ // oc.add( "organizationalPerson" );
+ // oc.add( "inetORGperson" );
+ // Attribute cn = new AttributeImpl( "Cn", "Kevin Spacey" );
+ // Attribute dc = new AttributeImpl( "sN", "Spacey" );
+ // attrs.put( oc );
+ // attrs.put( cn );
+ // attrs.put( dc);
+ // sysRoot.createSubcontext( "uID=kevin", attrs );
+ // Attributes returned = sysRoot.getObject( "UID=kevin" );
+ //
+ // NamingEnumeration attrList = returned.getAll();
+ // while( attrList.hasMore() )
+ // {
+ // Attribute attr = ( Attribute ) attrList.next();
+ //
+ // if ( attr.getID().equalsIgnoreCase( "uid" ) )
+ // {
+ // assertEquals( "uID", attr.getID() );
+ // }
+ //
+ // if ( attr.getID().equalsIgnoreCase( "objectClass" ) )
+ // {
+ // assertEquals( "ObjectClass", attr.getID() );
+ // }
+ //
+ // if ( attr.getID().equalsIgnoreCase( "sn" ) )
+ // {
+ // assertEquals( "sN", attr.getID() );
+ // }
+ //
+ // if ( attr.getID().equalsIgnoreCase( "cn" ) )
+ // {
+ // assertEquals( "Cn", attr.getID() );
+ // }
+ // }
+ // }
-// /**
-// * Test that attribute name case is preserved after adding an entry
-// * in the case the user added them. This is to test DIRSERVER-832.
-// */
-// public void testAddCasePreservedOnAttributeNames() throws Exception
-// {
-// Attributes attrs = new AttributesImpl( true );
-// Attribute oc = new AttributeImpl( "ObjectClass", "top" );
-// oc.add( "PERSON" );
-// oc.add( "organizationalPerson" );
-// oc.add( "inetORGperson" );
-// Attribute cn = new AttributeImpl( "Cn", "Kevin Spacey" );
-// Attribute dc = new AttributeImpl( "sN", "Spacey" );
-// attrs.put( oc );
-// attrs.put( cn );
-// attrs.put( dc);
-// sysRoot.createSubcontext( "uID=kevin", attrs );
-// Attributes returned = sysRoot.getObject( "UID=kevin" );
-//
-// NamingEnumeration attrList = returned.getAll();
-// while( attrList.hasMore() )
-// {
-// Attribute attr = ( Attribute ) attrList.next();
-//
-// if ( attr.getID().equalsIgnoreCase( "uid" ) )
-// {
-// assertEquals( "uID", attr.getID() );
-// }
-//
-// if ( attr.getID().equalsIgnoreCase( "objectClass" ) )
-// {
-// assertEquals( "ObjectClass", attr.getID() );
-// }
-//
-// if ( attr.getID().equalsIgnoreCase( "sn" ) )
-// {
-// assertEquals( "sN", attr.getID() );
-// }
-//
-// if ( attr.getID().equalsIgnoreCase( "cn" ) )
-// {
-// assertEquals( "Cn", attr.getID() );
-// }
-// }
-// }
-
-
/**
* Test that we can't add an entry with an attribute type not within
* any of the MUST or MAY of any of its objectClasses
@@ -107,13 +106,10 @@
{
LdapContext sysRoot = getSystemContext( service );
- Attributes attrs = new BasicAttributes( true );
- Attribute oc = new BasicAttribute( "ObjectClass", "top" );
- Attribute cn = new BasicAttribute( "cn", "kevin Spacey" );
- Attribute dc = new BasicAttribute( "dc", "ke" );
- attrs.put( oc );
- attrs.put( cn );
- attrs.put( dc);
+ Attributes attrs = AttributeUtils.createAttributes(
+ "ObjectClass: top",
+ "cn: kevin Spacey",
+ "dc: ke" );
String base = "uid=kevin";
@@ -140,20 +136,16 @@
{
LdapContext sysRoot = getSystemContext( service );
- Attributes attrs = new BasicAttributes( true );
- Attribute oc = new BasicAttribute( "ObjectClass", "top" );
- oc.add( "person" );
- Attribute cn = new BasicAttribute( "cn", "kevin Spacey" );
- Attribute sn = new BasicAttribute( "sn", "ke" );
- Attribute telephone = new BasicAttribute( "telephoneNumber", "0123456abc" );
- attrs.put( oc );
- attrs.put( cn );
- attrs.put( sn );
- attrs.put( telephone );
+ Attributes attrs = AttributeUtils.createAttributes(
+ "ObjectClass: top",
+ "ObjectClass: person",
+ "cn: kevin Spacey",
+ "sn: ke",
+ "telephoneNumber: 0123456abc");
String base = "sn=kevin";
- //create subcontext
+ // create subcontext
try
{
sysRoot.createSubcontext( base, attrs );
@@ -164,4 +156,49 @@
assertTrue( true );
}
}
+
+
+ /**
+ * test case for DIRSERVER-1442
+ */
+ @Test
+ public void testAddAttributeWithEscapedPlusCharacter() throws Exception
+ {
+ Attributes entry = AttributeUtils.createAttributes(
+ "ObjectClass: top",
+ "ObjectClass: inetorgperson",
+ "cn: John\\+Doe",
+ "sn: \\+Name\\+" );
+
+ LdapContext sysRoot = getSystemContext( service );
+ DirContext dc = sysRoot.createSubcontext( "cn=John\\+Doe", entry );
+
+ ServerLdapContext sc = ( ServerLdapContext ) dc;
+
+ assertTrue( sc.getDn().toString().contains( "+" ) );
+
+ try
+ {
+ Object obj = sysRoot.lookup( "cn=John\\+Doe" );
+ assertNotNull( obj );
+ }
+ catch( Exception e )
+ {
+ fail( e.getMessage() );
+ }
+
+ try
+ {
+ Attributes result = sysRoot.getAttributes( "cn=John\\+Doe" );
+ assertNotNull( result );
+
+ Attribute cn = result.get( "cn" );
+ assertNotNull( cn );
+ assertEquals( 1, cn.size() );
+ }
+ catch( Exception e )
+ {
+ fail( e.getMessage() );
+ }
+ }
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/CreateContextIT.java Wed Jan 6 18:26:43 2010
@@ -20,17 +20,12 @@
package org.apache.directory.server.core.jndi;
-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.shared.ldap.exception.LdapSchemaViolationException;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNull;
-import org.junit.runner.RunWith;
import javax.naming.CompositeName;
import javax.naming.Name;
@@ -45,6 +40,13 @@
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests the creation of contexts in various ways.
@@ -52,21 +54,16 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-public class CreateContextIT
+@RunWith ( FrameworkRunner.class )
+public class CreateContextIT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
-
- protected Attributes getPersonAttributes( String sn, String cn )
+ protected Attributes getPersonAttributes( String sn, String cn ) throws Exception
{
- Attributes attrs = new BasicAttributes( true );
- Attribute ocls = new BasicAttribute( "objectClass" );
- ocls.add( "top" );
- ocls.add( "person" );
- attrs.put( ocls );
- attrs.put( "cn", cn );
- attrs.put( "sn", sn );
+ Attributes attrs = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: person",
+ "cn", cn,
+ "sn", sn );
return attrs;
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169IT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169IT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169IT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169IT.java Wed Jan 6 18:26:43 2010
@@ -20,14 +20,11 @@
package org.apache.directory.server.core.jndi;
-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 static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+
+import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
@@ -41,7 +38,12 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
-import java.util.Hashtable;
+
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
@@ -50,11 +52,9 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-public class DIRSERVER169IT
+@RunWith ( FrameworkRunner.class )
+public class DIRSERVER169IT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
/**
* @todo replace this later with an Ldif tag
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER783IT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER783IT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER783IT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER783IT.java Wed Jan 6 18:26:43 2010
@@ -20,13 +20,11 @@
package org.apache.directory.server.core.jndi;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.junit.Test;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
-import org.junit.runner.RunWith;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
@@ -41,7 +39,11 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
-import java.util.Hashtable;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Tries to demonstrate DIRSERVER-783 ("Adding another value to an attribute
@@ -49,11 +51,9 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith ( CiRunner.class )
-public class DIRSERVER783IT
+@RunWith ( FrameworkRunner.class )
+public class DIRSERVER783IT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
/**
* Try to add entry with required attribute missing.
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER791IT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER791IT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER791IT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER791IT.java Wed Jan 6 18:26:43 2010
@@ -42,7 +42,8 @@
import javax.naming.directory.SchemaViolationException;
import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -52,11 +53,9 @@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(CiRunner.class)
-public class DIRSERVER791IT
+@RunWith(FrameworkRunner.class)
+public class DIRSERVER791IT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
/**
* Returns the attributes as depicted as test data in DIRSERVER-791