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 [7/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/operations/compare/CompareDirserver1139IT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/CompareDirserver1139IT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/CompareDirserver1139IT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/compare/CompareDirserver1139IT.java Wed Jan 6 18:26:43 2010
@@ -20,32 +20,28 @@
package org.apache.directory.server.core.operations.compare;
import static org.apache.directory.server.core.integ.IntegrationUtils.getSchemaContext;
-
+import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import javax.naming.NamingEnumeration;
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.directory.ModificationItem;
import javax.naming.directory.SearchControls;
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.Level;
-import org.apache.directory.server.core.integ.annotations.CleanupLevel;
+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.apache.directory.shared.ldap.util.StringTools;
-
-import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
/**
@@ -54,11 +50,9 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@CleanupLevel ( Level.CLASS )
-public class CompareDirserver1139IT
+@RunWith ( FrameworkRunner.class )
+public class CompareDirserver1139IT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
/**
* Activate the NIS and KRB5KDC schemas
@@ -92,11 +86,17 @@
// -------------------------------------------------------------------
// Enable the krb5kdc schema
// -------------------------------------------------------------------
+ // Check if krb5kdc is loaded
+ if ( !service.getSchemaManager().isSchemaLoaded( "krb5kdc" ) )
+ {
+ service.getSchemaManager().load( "krb5kdc" );
+ }
+
// check if krb5kdc is disabled
Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=krb5kdc" );
boolean isKrb5kdcDisabled = false;
- if ( nisAttrs.get( "m-disabled" ) != null )
+ if ( krb5kdcAttrs.get( "m-disabled" ) != null )
{
isKrb5kdcDisabled = ( ( String ) krb5kdcAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase( "TRUE" );
}
@@ -118,39 +118,35 @@
private void injectEntries( LdapContext sysRoot ) throws Exception
{
// Add the group
- Attributes attrs = new BasicAttributes( true );
- Attribute oc = new BasicAttribute( "ObjectClass" );
- oc.add( "groupOfNames" );
- oc.add( "top" );
- attrs.put( oc );
- attrs.put( "cn", "group" );
- attrs.put( "member", "cn=user,ou=users,ou=system" );
+ Attributes attrs = AttributeUtils.createAttributes(
+ "ObjectClass: top",
+ "ObjectClass: groupOfNames",
+ "cn: group",
+ "member: cn=user,ou=users,ou=system" );
sysRoot.createSubcontext( "cn=group,ou=groups", attrs );
// Add the user
- attrs = new BasicAttributes( "objectClass", "top", true );
- oc = new BasicAttribute( "ObjectClass" );
- oc.add( "top" );
- oc.add( "organizationalPerson" );
- oc.add( "person" );
- oc.add( "krb5Principal" );
- oc.add( "posixAccount" );
- oc.add( "shadowAccount" );
- oc.add( "krb5KDCEntry" );
- oc.add( "inetOrgPerson" );
- attrs.put( oc );
- attrs.put( "cn", "user" );
- attrs.put( "gidnumber", "100" );
- attrs.put( "givenname", "user" );
- attrs.put( "homedirectory", "/home/users/user" );
- attrs.put( "krb5KeyVersionNumber", "1" );
- attrs.put( "krb5PrincipalName", "user@APACHE.ORG" );
- attrs.put( "loginshell", "/bin/bash" );
- attrs.put( "mail", "user@apache.org" );
- attrs.put( "sn", "User" );
- attrs.put( "uid", "user" );
- attrs.put( "uidnumber", "1001" );
+ attrs = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: organizationalPerson",
+ "objectClass: person",
+ "objectClass: krb5Principal",
+ "objectClass: posixAccount",
+ "objectClass: shadowAccount",
+ "objectClass: krb5KDCEntry",
+ "objectClass: inetOrgPerson",
+ "cn: user",
+ "gidnumber: 100",
+ "givenname: user",
+ "homedirectory: /home/users/user",
+ "krb5KeyVersionNumber: 1",
+ "krb5PrincipalName: user@APACHE.ORG",
+ "loginshell: /bin/bash",
+ "mail: user@apache.org",
+ "sn: User",
+ "uid: user",
+ "uidnumber: 1001" );
sysRoot.createSubcontext( "cn=user,ou=users", attrs );
}
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java Wed Jan 6 18:26:43 2010
@@ -23,12 +23,9 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.Level;
-import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
-import org.apache.directory.server.core.integ.annotations.CleanupLevel;
+import org.apache.directory.server.core.annotations.ApplyLdifs;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.shared.ldap.entry.Entry;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.junit.Test;
@@ -41,20 +38,16 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@CleanupLevel ( Level.CLASS )
+@RunWith ( FrameworkRunner.class )
@ApplyLdifs( {
// Entry # 1
- "dn: cn=test,ou=system\n" +
- "objectClass: person\n" +
- "cn: test\n" +
- "sn: sn_test\n"
+ "dn: cn=test,ou=system",
+ "objectClass: person",
+ "cn: test",
+ "sn: sn_test"
})
-public class LookupIT
+public class LookupIT extends AbstractLdapTestUnit
{
- /** The directory service */
- public static DirectoryService service;
-
/**
* Test a lookup( DN, "*") operation
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyAddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyAddIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyAddIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyAddIT.java Wed Jan 6 18:26:43 2010
@@ -37,9 +37,9 @@
import javax.naming.directory.NoSuchAttributeException;
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.ApplyLdifs;
+import org.apache.directory.server.core.annotations.ApplyLdifs;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.shared.ldap.exception.LdapAttributeInUseException;
import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
@@ -55,94 +55,92 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev: 770988 $
*/
-@RunWith ( CiRunner.class )
+@RunWith ( FrameworkRunner.class )
@ApplyLdifs(
{
- "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema\n" +
- "objectclass: metaAttributeType\n" +
- "objectclass: metaTop\n" +
- "objectclass: top\n" +
- "m-oid: 2.2.0\n" +
- "m-name: integerAttribute\n" +
- "m-description: the precursor for all integer attributes\n" +
- "m-equality: integerMatch\n" +
- "m-ordering: integerOrderingMatch\n" +
- "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27\n" +
- "m-length: 0\n" +
- "\n" +
- "dn: ou=testing00,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing00\n" +
- "integerAttribute: 0\n" +
- "\n" +
- "dn: ou=testing01,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing01\n" +
- "integerAttribute: 1\n" +
- "\n" +
- "dn: ou=testing02,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing02\n" +
- "integerAttribute: 2\n" +
- "\n" +
- "dn: ou=testing03,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing03\n" +
- "integerAttribute: 3\n" +
- "\n" +
- "dn: ou=testing04,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing04\n" +
- "integerAttribute: 4\n" +
- "\n" +
- "dn: ou=testing05,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing05\n" +
- "integerAttribute: 5\n" +
- "\n" +
- "dn: ou=subtest,ou=testing01,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "ou: subtest\n" +
- "\n" +
- "dn: cn=Heather Nova, ou=system\n" +
- "objectClass: top\n" +
- "objectClass: person\n" +
- "cn: Heather Nova\n" +
- "sn: Nova\n" +
- "telephoneNumber: 1 801 555 1212 \n" +
- "description: an American singer-songwriter\n" +
- "\n" +
- "dn: cn=with-dn, ou=system\n" +
- "objectClass: top\n" +
- "objectClass: person\n" +
- "objectClass: organizationalPerson\n" +
- "objectClass: inetorgPerson\n" +
- "cn: singer\n" +
- "sn: manager\n" +
- "telephoneNumber: 1 801 555 1212 \n" +
- "manager: cn=Heather Nova, ou=system\n"
+ "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema",
+ "objectclass: metaAttributeType",
+ "objectclass: metaTop",
+ "objectclass: top",
+ "m-oid: 2.2.0",
+ "m-name: integerAttribute",
+ "m-description: the precursor for all integer attributes",
+ "m-equality: integerMatch",
+ "m-ordering: integerOrderingMatch",
+ "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27",
+ "m-length: 0",
+ "",
+ "dn: ou=testing00,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing00",
+ "integerAttribute: 0",
+ "",
+ "dn: ou=testing01,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing01",
+ "integerAttribute: 1",
+ "",
+ "dn: ou=testing02,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing02",
+ "integerAttribute: 2",
+ "",
+ "dn: ou=testing03,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing03",
+ "integerAttribute: 3",
+ "",
+ "dn: ou=testing04,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing04",
+ "integerAttribute: 4",
+ "",
+ "dn: ou=testing05,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing05",
+ "integerAttribute: 5",
+ "",
+ "dn: ou=subtest,ou=testing01,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "ou: subtest",
+ "",
+ "dn: cn=Heather Nova, ou=system",
+ "objectClass: top",
+ "objectClass: person",
+ "cn: Heather Nova",
+ "sn: Nova",
+ "telephoneNumber: 1 801 555 1212 ",
+ "description: an American singer-songwriter",
+ "",
+ "dn: cn=with-dn, ou=system",
+ "objectClass: top",
+ "objectClass: person",
+ "objectClass: organizationalPerson",
+ "objectClass: inetorgPerson",
+ "cn: singer",
+ "sn: manager",
+ "telephoneNumber: 1 801 555 1212 ",
+ "manager: cn=Heather Nova, ou=system"
}
)
-public class ModifyAddIT
+public class ModifyAddIT extends AbstractLdapTestUnit
{
private static final String PERSON_DESCRIPTION = "an American singer-songwriter";
private static final String RDN_HEATHER_NOVA = "cn=Heather Nova";
- public static DirectoryService service;
-
/**
* @param sysRoot the system root to add entries to
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyDelIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyDelIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyDelIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyDelIT.java Wed Jan 6 18:26:43 2010
@@ -23,10 +23,10 @@
import static org.apache.directory.server.core.integ.IntegrationUtils.getSchemaContext;
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
@@ -37,9 +37,9 @@
import javax.naming.directory.ModificationItem;
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.ApplyLdifs;
+import org.apache.directory.server.core.annotations.ApplyLdifs;
+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.LdapNoSuchAttributeException;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
@@ -53,104 +53,102 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev: 770988 $
*/
-@RunWith ( CiRunner.class )
+@RunWith ( FrameworkRunner.class )
@ApplyLdifs(
{
- "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema\n" +
- "objectclass: metaAttributeType\n" +
- "objectclass: metaTop\n" +
- "objectclass: top\n" +
- "m-oid: 2.2.0\n" +
- "m-name: integerAttribute\n" +
- "m-description: the precursor for all integer attributes\n" +
- "m-equality: integerMatch\n" +
- "m-ordering: integerOrderingMatch\n" +
- "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27\n" +
- "m-length: 0\n" +
- "\n" +
- "dn: ou=testing00,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing00\n" +
- "integerAttribute: 0\n" +
- "\n" +
- "dn: ou=testing01,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing01\n" +
- "integerAttribute: 1\n" +
- "\n" +
- "dn: ou=testing02,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing02\n" +
- "integerAttribute: 2\n" +
- "c: FR\n" +
- "\n" +
- "dn: ou=testing03,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing03\n" +
- "integerAttribute: 3\n" +
- "\n" +
- "dn: ou=testing04,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing04\n" +
- "integerAttribute: 4\n" +
- "\n" +
- "dn: ou=testing05,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing05\n" +
- "integerAttribute: 5\n" +
- "\n" +
- "dn: ou=subtest,ou=testing01,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "ou: subtest\n" +
- "\n" +
- "dn: cn=Heather Nova, ou=system\n" +
- "objectClass: top\n" +
- "objectClass: person\n" +
- "cn: Heather Nova\n" +
- "sn: Nova\n" +
- "telephoneNumber: 1 801 555 1212 \n" +
- "description: an American singer-songwriter\n" +
- "\n" +
- "dn: cn=Kim Wilde, ou=system\n" +
- "objectClass: top\n" +
- "objectClass: person\n" +
- "cn: Kim Wilde\n" +
- "sn: Wilde\n" +
- "telephoneNumber: 1 801 555 1212 \n" +
- "description: an American singer-songwriter\n" +
- "description: She has blond hair\n" +
- "\n" +
- "dn: cn=with-dn, ou=system\n" +
- "objectClass: top\n" +
- "objectClass: person\n" +
- "objectClass: organizationalPerson\n" +
- "objectClass: inetorgPerson\n" +
- "cn: singer\n" +
- "sn: manager\n" +
- "telephoneNumber: 1 801 555 1212 \n" +
- "manager: cn=Heather Nova, ou=system\n"
+ "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema",
+ "objectclass: metaAttributeType",
+ "objectclass: metaTop",
+ "objectclass: top",
+ "m-oid: 2.2.0",
+ "m-name: integerAttribute",
+ "m-description: the precursor for all integer attributes",
+ "m-equality: integerMatch",
+ "m-ordering: integerOrderingMatch",
+ "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27",
+ "m-length: 0",
+ "",
+ "dn: ou=testing00,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing00",
+ "integerAttribute: 0",
+ "",
+ "dn: ou=testing01,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing01",
+ "integerAttribute: 1",
+ "",
+ "dn: ou=testing02,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing02",
+ "integerAttribute: 2",
+ "c: FR",
+ "",
+ "dn: ou=testing03,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing03",
+ "integerAttribute: 3",
+ "",
+ "dn: ou=testing04,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing04",
+ "integerAttribute: 4",
+ "",
+ "dn: ou=testing05,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing05",
+ "integerAttribute: 5",
+ "",
+ "dn: ou=subtest,ou=testing01,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "ou: subtest",
+ "",
+ "dn: cn=Heather Nova, ou=system",
+ "objectClass: top",
+ "objectClass: person",
+ "cn: Heather Nova",
+ "sn: Nova",
+ "telephoneNumber: 1 801 555 1212 ",
+ "description: an American singer-songwriter",
+ "",
+ "dn: cn=Kim Wilde, ou=system",
+ "objectClass: top",
+ "objectClass: person",
+ "cn: Kim Wilde",
+ "sn: Wilde",
+ "telephoneNumber: 1 801 555 1212 ",
+ "description: an American singer-songwriter",
+ "description: She has blond hair",
+ "",
+ "dn: cn=with-dn, ou=system",
+ "objectClass: top",
+ "objectClass: person",
+ "objectClass: organizationalPerson",
+ "objectClass: inetorgPerson",
+ "cn: singer",
+ "sn: manager",
+ "telephoneNumber: 1 801 555 1212 ",
+ "manager: cn=Heather Nova, ou=system"
}
)
-public class ModifyDelIT
+public class ModifyDelIT extends AbstractLdapTestUnit
{
private static final String RDN_HEATHER_NOVA = "cn=Heather Nova";
private static final String RDN_KIM_WILDE = "cn=kim wilde";
- public static DirectoryService service;
-
/**
* @param sysRoot the system root to add entries to
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyMultipleChangesIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyMultipleChangesIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyMultipleChangesIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/modify/ModifyMultipleChangesIT.java Wed Jan 6 18:26:43 2010
@@ -20,6 +20,12 @@
package org.apache.directory.server.core.operations.modify;
+import static org.apache.directory.server.core.integ.IntegrationUtils.getSchemaContext;
+import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
@@ -29,20 +35,13 @@
import javax.naming.directory.ModificationItem;
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.ApplyLdifs;
-
+import org.apache.directory.server.core.annotations.ApplyLdifs;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.apache.directory.server.core.integ.IntegrationUtils.getSchemaContext;
-import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
/**
* Test case with multiple modifications on a person entry.
@@ -50,33 +49,31 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
+@RunWith ( FrameworkRunner.class )
@ApplyLdifs( {
// Entry # 1
- "dn: cn=Tori Amos,ou=system\n" +
- "objectClass: inetOrgPerson\n" +
- "objectClass: organizationalPerson\n" +
- "objectClass: person\n" +
- "objectClass: top\n" +
- "description: an American singer-songwriter\n" +
- "cn: Tori Amos\n" +
- "sn: Amos\n\n" +
+ "dn: cn=Tori Amos,ou=system",
+ "objectClass: inetOrgPerson",
+ "objectClass: organizationalPerson",
+ "objectClass: person",
+ "objectClass: top",
+ "description: an American singer-songwriter",
+ "cn: Tori Amos",
+ "sn: Amos",
// Entry # 2
- "dn: cn=Debbie Harry,ou=system\n" +
- "objectClass: inetOrgPerson\n" +
- "objectClass: organizationalPerson\n" +
- "objectClass: person\n" +
- "objectClass: top\n" +
- "cn: Debbie Harry\n" +
- "sn: Harry\n\n"
+ "dn: cn=Debbie Harry,ou=system",
+ "objectClass: inetOrgPerson",
+ "objectClass: organizationalPerson",
+ "objectClass: person",
+ "objectClass: top",
+ "cn: Debbie Harry",
+ "sn: Harry"
}
)
-public class ModifyMultipleChangesIT
+public class ModifyMultipleChangesIT extends AbstractLdapTestUnit
{
private static final String RDN_TORI_AMOS = "cn=Tori Amos";
- public static DirectoryService service;
-
/**
* @param sysRoot the system root to add entries to
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/DIRSERVER759IT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/DIRSERVER759IT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/DIRSERVER759IT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/DIRSERVER759IT.java Wed Jan 6 18:26:43 2010
@@ -20,16 +20,10 @@
package org.apache.directory.server.core.operations.search;
-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.JndiPropertyConstants;
-import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.junit.runner.RunWith;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
@@ -41,6 +35,13 @@
import javax.naming.directory.SearchControls;
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.JndiPropertyConstants;
+import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests the search() methods of the provider.
@@ -48,11 +49,9 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev: 493916 $
*/
-@RunWith ( CiRunner.class )
-public class DIRSERVER759IT
+@RunWith ( FrameworkRunner.class )
+public class DIRSERVER759IT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
/**
* @todo replace with ldif annotations
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java Wed Jan 6 18:26:43 2010
@@ -38,7 +38,6 @@
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.directory.InvalidSearchFilterException;
import javax.naming.directory.ModificationItem;
@@ -46,13 +45,16 @@
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.ApplyLdifs;
+import org.apache.directory.server.core.annotations.ApplyLdifs;
+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.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.exception.LdapSizeLimitExceededException;
import org.apache.directory.shared.ldap.exception.LdapTimeLimitExceededException;
import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -64,100 +66,105 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
+@RunWith ( FrameworkRunner.class )
+@CreateDS( name="SearchDS" )
@ApplyLdifs(
{
- "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema\n" +
- "objectclass: metaAttributeType\n" +
- "objectclass: metaTop\n" +
- "objectclass: top\n" +
- "m-oid: 2.2.0\n" +
- "m-name: integerAttribute\n" +
- "m-description: the precursor for all integer attributes\n" +
- "m-equality: integerMatch\n" +
- "m-ordering: integerOrderingMatch\n" +
- "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27\n" +
- "m-length: 0\n" +
- "\n" +
- "dn: ou=testing00,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing00\n" +
- "integerAttribute: 0\n" +
- "\n" +
- "dn: ou=testing01,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing01\n" +
- "integerAttribute: 1\n" +
- "\n" +
- "dn: ou=testing02,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing02\n" +
- "integerAttribute: 2\n" +
- "\n" +
- "dn: ou=testing03,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing03\n" +
- "integerAttribute: 3\n" +
- "\n" +
- "dn: ou=testing04,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing04\n" +
- "integerAttribute: 4\n" +
- "\n" +
- "dn: ou=testing05,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "objectClass: extensibleObject\n" +
- "ou: testing05\n" +
- "integerAttribute: 5\n" +
- "\n" +
- "dn: ou=subtest,ou=testing01,ou=system\n" +
- "objectClass: top\n" +
- "objectClass: organizationalUnit\n" +
- "ou: subtest\n" +
- "\n" +
- "dn: cn=Heather Nova, ou=system\n" +
- "objectClass: top\n" +
- "objectClass: person\n" +
- "cn: Heather Nova\n" +
- "sn: Nova\n" +
- "telephoneNumber: 1 801 555 1212 \n" +
- "\n" +
- "dn: cn=with-dn, ou=system\n" +
- "objectClass: top\n" +
- "objectClass: person\n" +
- "objectClass: organizationalPerson\n" +
- "objectClass: inetorgPerson\n" +
- "cn: singer\n" +
- "sn: manager\n" +
- "telephoneNumber: 1 801 555 1212 \n" +
- "manager: cn=Heather Nova, ou=system\n"
+ "dn: m-oid=2.2.0, ou=attributeTypes, cn=apachemeta, ou=schema",
+ "objectclass: metaAttributeType",
+ "objectclass: metaTop",
+ "objectclass: top",
+ "m-oid: 2.2.0",
+ "m-name: integerAttribute",
+ "m-description: the precursor for all integer attributes",
+ "m-equality: integerMatch",
+ "m-ordering: integerOrderingMatch",
+ "m-syntax: 1.3.6.1.4.1.1466.115.121.1.27",
+ "m-length: 0",
+ "",
+ "dn: ou=testing00,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing00",
+ "integerAttribute: 0",
+ "",
+ "dn: ou=testing01,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing01",
+ "integerAttribute: 1",
+ "",
+ "dn: ou=testing02,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing02",
+ "integerAttribute: 2",
+ "",
+ "dn: ou=testing03,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing03",
+ "integerAttribute: 3",
+ "",
+ "dn: ou=testing04,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing04",
+ "integerAttribute: 4",
+ "",
+ "dn: ou=testing05,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "objectClass: extensibleObject",
+ "ou: testing05",
+ "integerAttribute: 5",
+ "",
+ "dn: ou=subtest,ou=testing01,ou=system",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "ou: subtest",
+ "",
+ "dn: cn=Heather Nova, ou=system",
+ "objectClass: top",
+ "objectClass: person",
+ "cn: Heather Nova",
+ "sn: Nova",
+ "telephoneNumber: 1 801 555 1212 ",
+ "",
+ "dn: cn=with-dn, ou=system",
+ "objectClass: top",
+ "objectClass: person",
+ "objectClass: organizationalPerson",
+ "objectClass: inetorgPerson",
+ "cn: singer",
+ "sn: manager",
+ "telephoneNumber: 1 801 555 1212 ",
+ "manager: cn=Heather Nova, ou=system"
}
)
-public class SearchIT
+public class SearchIT extends AbstractLdapTestUnit
{
private static final String RDN = "cn=Heather Nova";
private static final String FILTER = "(objectclass=*)";
- public static DirectoryService service;
+ public static LdapContext sysRoot;
-
/**
* @param sysRoot the system root to add entries to
* @throws NamingException on errors
*/
- protected void createData( LdapContext sysRoot ) throws Exception
+ @Before
+ public void createData() throws Exception
{
+ service.getSchemaManager().enable( "nis" );
+
+ sysRoot = getSystemContext( service );
+
/*
* Check ou=testing00,ou=system
*/
@@ -258,12 +265,14 @@
/**
* Create a NIS group
*/
- private DirContext addNisPosixGroup( String name, int gid ) throws Exception
+ private static DirContext addNisPosixGroup( String name, int gid ) throws Exception
{
- Attributes attrs = new BasicAttributes( "objectClass", "top", true );
- attrs.get( "objectClass" ).add( "posixGroup" );
- attrs.put( "cn", name );
- attrs.put( "gidNumber", String.valueOf( gid ) );
+ Attributes attrs = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: posixGroup",
+ "cn", name,
+ "gidNumber", String.valueOf( gid ) );
+
return getSystemContext( service ).createSubcontext( "cn="+name+",ou=groups", attrs );
}
@@ -271,9 +280,6 @@
@Test
public void testSearchOneLevel() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
@@ -299,9 +305,6 @@
@Test
public void testSearchSubTreeLevel() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -329,9 +332,6 @@
@Test
public void testSearchSubTreeLevelNoAttributes() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -360,9 +360,6 @@
@Test
public void testSearchSubstringSubTreeLevel() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -406,7 +403,6 @@
boolean oldSetAllowAnnonymousAccess = service.isAllowAnonymousAccess();
service.setAllowAnonymousAccess( true );
- LdapContext sysRoot = getSystemContext( service );
SearchControls cons = new SearchControls();
NamingEnumeration<SearchResult> e = sysRoot.search( "", "(bogusAttribute=abc123)", cons );
assertNotNull( e );
@@ -437,9 +433,6 @@
@Test
public void testSearchFilterArgs() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
@@ -466,9 +459,6 @@
@Ignore ( "TODO - fix me" )
public void testSearchSizeLimit() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -500,9 +490,6 @@
@Ignore ( "TODO - fix me" )
public void testSearchTimeLimit() throws Exception, InterruptedException
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -537,9 +524,6 @@
@Test
public void testFilterExpansion0() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -563,9 +547,6 @@
@Test
public void testFilterExpansion1() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -601,9 +582,6 @@
@Test
public void testFilterExpansion2() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -628,9 +606,6 @@
@Test
public void testFilterExpansion4() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -659,9 +634,6 @@
@Test
public void testFilterExpansion5() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -695,9 +667,6 @@
@Test
public void testOpAttrDenormalizationOff() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
@@ -725,9 +694,6 @@
@Test
public void testOpAttrDenormalizationOn() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
service.setDenormalizeOpAttrsEnabled( true );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
@@ -760,15 +726,14 @@
* @param sn the surName of the person
* @return the attributes of a new person entry
*/
- protected Attributes getPersonAttributes( String sn, String cn )
+ protected Attributes getPersonAttributes( String sn, String cn ) throws NamingException
{
- Attributes attributes = new BasicAttributes( true );
- Attribute attribute = new BasicAttribute( "objectClass" );
- attribute.add( "top" );
- attribute.add( "person" );
- attributes.put( attribute );
- attributes.put( "cn", cn );
- attributes.put( "sn", sn );
+ Attributes attributes = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: top",
+ "objectClass: person",
+ "cn", cn,
+ "sn", sn );
return attributes;
}
@@ -777,9 +742,6 @@
@Test
public void testBinaryAttributesInFilter() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
byte[] certData = new byte[] { 0x34, 0x56, 0x4e, 0x5f };
// First let's add a some binary data representing a userCertificate
@@ -813,9 +775,6 @@
@Test
public void testSearchOperationalAttr() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
@@ -846,9 +805,6 @@
@Test
public void testSearchUserAttr() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
@@ -879,9 +835,6 @@
@Test
public void testSearchUserAttrAndOpAttr() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
@@ -912,9 +865,6 @@
@Test
public void testSearchUserAttrAndNoAttr() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
@@ -945,9 +895,6 @@
@Test
public void testSearchNoAttr() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
@@ -978,9 +925,6 @@
@Test
public void testSearchAllAttr() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
@@ -1016,9 +960,6 @@
@Test
public void testSearchFetchNonExistingAttributeOption() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls ctls = new SearchControls();
ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
ctls.setReturningAttributes( new String[]
@@ -1054,9 +995,6 @@
@Test
public void testSearchFetchTwiceSameAttribute() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls ctls = new SearchControls();
ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
ctls.setReturningAttributes( new String[]
@@ -1216,9 +1154,6 @@
@Test
public void testSetup() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
Set<String> results = searchGroups( "(objectClass=posixGroup)" );
assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
@@ -1232,9 +1167,6 @@
@Test
public void testLessThanSearch() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
Set<String> results = searchGroups( "(gidNumber<=5)" );
assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
@@ -1280,9 +1212,6 @@
@Test
public void testGreaterThanSearch() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
Set<String> results = searchGroups( "(gidNumber>=0)" );
assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
@@ -1320,9 +1249,6 @@
@Test
public void testNotOperator() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
Set<String> results = searchGroups( "(!(gidNumber=4))" );
assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
@@ -1336,9 +1262,6 @@
@Test
public void testNotOperatorSubtree() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -1355,17 +1278,14 @@
@Test
public void testSearchWithEscapedCharsInFilter() throws Exception
{
- // Create an entry with special chars in the description attribute
- LdapContext sysRoot = getSystemContext( service );
// Create entry cn=Sid Vicious, ou=system
- Attributes vicious = new BasicAttributes( true );
- Attribute ocls = new BasicAttribute( "objectClass" );
- ocls.add( "top" );
- ocls.add( "person" );
- vicious.put( ocls );
- vicious.put( "cn", "Sid Vicious" );
- vicious.put( "sn", "Vicious" );
- vicious.put( "description", "(sex*pis\\tols)" );
+ Attributes vicious = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: person",
+ "cn", "Sid Vicious",
+ "sn", "Vicious",
+ "description", "(sex*pis\\tols)" );
+
DirContext ctx = sysRoot.createSubcontext( "cn=Sid Vicious", vicious );
assertNotNull( ctx );
@@ -1408,17 +1328,14 @@
@Test
public void testSubstringSearchWithEscapedCharsInFilter() throws Exception
{
- // Create an entry with special chars in the description attribute
- LdapContext sysRoot = getSystemContext( service );
// Create entry cn=Sid Vicious, ou=system
- Attributes vicious = new BasicAttributes( true );
- Attribute ocls = new BasicAttribute( "objectClass" );
- ocls.add( "top" );
- ocls.add( "person" );
- vicious.put( ocls );
- vicious.put( "cn", "Sid Vicious" );
- vicious.put( "sn", "Vicious" );
- vicious.put( "description", "(sex*pis\\tols)" );
+ Attributes vicious = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: person",
+ "cn", "Sid Vicious",
+ "sn", "Vicious",
+ "description", "(sex*pis\\tols)" );
+
DirContext ctx = sysRoot.createSubcontext( "cn=Sid Vicious", vicious );
assertNotNull( ctx );
@@ -1464,15 +1381,13 @@
@Test
public void testSubstringSearchWithEscapedAsterisksInFilter_DIRSERVER_1181() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
+ Attributes vicious = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: person",
+ "cn", "x*y*z*",
+ "sn", "x*y*z*",
+ "description", "(sex*pis\\tols)" );
- Attributes vicious = new BasicAttributes( true );
- Attribute ocls = new BasicAttribute( "objectClass" );
- ocls.add( "top" );
- ocls.add( "person" );
- vicious.put( ocls );
- vicious.put( "cn", "x*y*z*" );
- vicious.put( "sn", "x*y*z*" );
sysRoot.createSubcontext( "cn=x*y*z*", vicious );
SearchControls controls = new SearchControls();
@@ -1500,9 +1415,6 @@
@Test
public void testBadFilter() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -1569,9 +1481,6 @@
*/
@Test
public void testIntegerComparison() throws Exception {
- LdapContext sysRoot = getSystemContext(service);
- createData(sysRoot);
-
Set<String> results = searchUnits("(&(objectClass=organizationalUnit)(integerAttribute<=2))",null);
assertTrue(results.contains("ou=testing00,ou=system"));
assertTrue(results.contains("ou=testing01,ou=system"));
@@ -1591,8 +1500,6 @@
*/
@Test
public void testIntegerComparison2() throws Exception {
- LdapContext sysRoot = getSystemContext(service);
- createData(sysRoot);
Set<String> results = searchUnits("(&(objectClass=organizationalUnit)(integerAttribute>=3))",null);
assertFalse(results.contains("ou=testing00,ou=system"));
assertFalse(results.contains("ou=testing01,ou=system"));
@@ -1612,9 +1519,6 @@
*/
@Test
public void testIntegerComparison3() throws Exception {
- LdapContext sysRoot = getSystemContext(service);
- createData(sysRoot);
-
Set<String> results = searchUnits("(&(objectClass=organizationalUnit)(integerAttribute<=42))",null);
assertTrue(results.contains("ou=testing00,ou=system"));
assertTrue(results.contains("ou=testing01,ou=system"));
@@ -1633,9 +1537,6 @@
*/
@Test
public void testIntegerComparison4() throws Exception {
- LdapContext sysRoot = getSystemContext(service);
- createData(sysRoot);
-
Set<String> results = searchUnits("(&(objectClass=organizationalUnit)(|(integerAttribute<=1)(integerAttribute>=5)))",null);
assertTrue(results.contains("ou=testing00,ou=system"));
assertTrue(results.contains("ou=testing01,ou=system"));
@@ -1649,9 +1550,6 @@
@Test
public void testSearchTelephoneNumber() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
@@ -1673,9 +1571,6 @@
@Test
public void testSearchDN() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -1700,9 +1595,6 @@
@Test
public void testComplexFilter() throws Exception
{
- LdapContext sysRoot = getSystemContext( service );
- createData( sysRoot );
-
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
@@ -1710,10 +1602,12 @@
AliasDerefMode.NEVER_DEREF_ALIASES.getJndiValue() );
// Create an entry which does not match
- Attributes attrs = new BasicAttributes( "objectClass", "top", true );
- attrs.get( "objectClass" ).add( "groupOfUniqueNames" );
- attrs.put( "cn", "testGroup3" );
- attrs.put( "uniqueMember", "uid=admin,ou=system" );
+ Attributes attrs = AttributeUtils.createAttributes(
+ "objectClass: top",
+ "objectClass: groupOfUniqueNames",
+ "cn", "testGroup3",
+ "uniqueMember", "uid=admin,ou=system" );
+
getSystemContext( service ).createSubcontext( "cn=testGroup3,ou=groups", attrs );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchWithIndicesITest.java Wed Jan 6 18:26:43 2010
@@ -20,24 +20,13 @@
package org.apache.directory.server.core.operations.search;
-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.CiRunner;
-import org.apache.directory.server.core.integ.DirectoryServiceFactory;
import static org.apache.directory.server.core.integ.IntegrationUtils.getSchemaContext;
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
-import org.apache.directory.server.core.integ.Level;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.core.integ.annotations.CleanupLevel;
-import org.apache.directory.server.xdbm.Index;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
-
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+
+import java.util.HashSet;
+import java.util.Set;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
@@ -50,8 +39,17 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
-import java.util.HashSet;
-import java.util.Set;
+
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+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.xdbm.Index;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
@@ -60,16 +58,12 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@CleanupLevel ( Level.CLASS )
-@Factory ( SearchWithIndicesITest.MyFactory.class )
-public class SearchWithIndicesITest
+@RunWith ( FrameworkRunner.class )
+public class SearchWithIndicesITest extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
-
- private void createData() throws Exception
+ @Before
+ public void createData() throws Exception
{
// -------------------------------------------------------------------
// Enable the nis schema
@@ -79,6 +73,7 @@
LdapContext schemaRoot = getSchemaContext( service );
Attributes nisAttrs = schemaRoot.getAttributes( "cn=nis" );
boolean isNisDisabled = false;
+
if ( nisAttrs.get( "m-disabled" ) != null )
{
isNisDisabled = ( ( String ) nisAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase( "TRUE" );
@@ -93,6 +88,10 @@
schemaRoot.modifyAttributes( "cn=nis", mods );
}
+ Partition systemPartition = service.getSystemPartition();
+ Set<Index<?,ServerEntry>> indexedAtributes = ( ( JdbmPartition ) systemPartition ).getIndexedAttributes();
+ indexedAtributes.add( new JdbmIndex<String,ServerEntry>( "gidNumber" ) );
+
// -------------------------------------------------------------------
// Add a bunch of nis groups
// -------------------------------------------------------------------
@@ -115,32 +114,6 @@
}
- public static class MyFactory implements DirectoryServiceFactory
- {
- public DirectoryService newInstance()
- {
- DirectoryService service = new DefaultDirectoryService();
- service.getChangeLog().setEnabled( true );
-
- // -------------------------------------------------------------------
- // Alter the partition configuration to index gidNumber
- // -------------------------------------------------------------------
-
- JdbmPartition partition = new JdbmPartition();
- partition.setId( "system" );
- partition.setSuffix( "ou=system" );
-
- Set<Index<?, ServerEntry>> indices = new HashSet<Index<?, ServerEntry>>();
- indices.addAll( partition.getIndexedAttributes() );
- indices.add( new JdbmIndex<String,ServerEntry>( "gidNumber" ) );
- partition.setIndexedAttributes( indices );
- service.setSystemPartition( partition );
-
- return service;
- }
- }
-
-
/**
* Convenience method that performs a one level search using the
* specified filter returning their DNs as Strings in a set.
@@ -187,7 +160,6 @@
@Test
public void testLessThanSearchWithIndices() throws Exception
{
- createData();
Set<String> results = searchGroups( "(gidNumber<=5)" );
assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
@@ -233,7 +205,6 @@
@Test
public void testGreaterThanSearchWithIndices() throws Exception
{
- createData();
Set<String> results = searchGroups( "(gidNumber>=0)" );
assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/partition/PartitionIT.java Wed Jan 6 18:26:43 2010
@@ -20,31 +20,28 @@
package org.apache.directory.server.core.partition;
-import java.util.HashMap;
-
-import org.apache.directory.server.core.DefaultDirectoryService;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.DirectoryServiceFactory;
-import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
-import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
-
import static org.apache.directory.server.core.integ.IntegrationUtils.getRootContext;
-
-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 org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttributes;
import javax.naming.ldap.LdapContext;
+import org.apache.directory.server.core.annotations.ContextEntry;
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
+import org.apache.directory.server.core.annotations.CreatePartition;
+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;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -53,54 +50,51 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-@Factory ( PartitionIT.Factory.class )
-@ApplyLdifs (
+@RunWith(FrameworkRunner.class)
+/*
+ * Creates a DirectoryService configured with two separate dc=com based
+ * domains to test multiple partitions.
+ */
+@CreateDS( name = "PartitionIT-class",
+ partitions =
{
- "dn: dc=foo,dc=com\n" +
- "objectClass: top\n" +
- "objectClass: domain\n" +
- "dc: foo\n\n" +
-
- "dn: dc=bar,dc=com\n" +
- "objectClass: top\n" +
- "objectClass: domain\n" +
- "dc: bar\n\n"
- }
-)
-public final class PartitionIT
+ @CreatePartition(
+ name = "foo",
+ suffix = "dc=foo,dc=com",
+ contextEntry = @ContextEntry(
+ entryLdif =
+ "dn: dc=foo,dc=com\n" +
+ "dc: foo\n" +
+ "objectClass: top\n" +
+ "objectClass: domain\n\n" ),
+ indexes =
+ {
+ @CreateIndex( attribute = "objectClass" ),
+ @CreateIndex( attribute = "dc" ),
+ @CreateIndex( attribute = "ou" )
+ } ),
+ @CreatePartition(
+ name = "bar",
+ suffix = "dc=bar,dc=com",
+ contextEntry = @ContextEntry(
+ entryLdif =
+ "dn: dc=bar,dc=com\n" +
+ "dc: bar\n" +
+ "objectClass: top\n" +
+ "objectClass: domain\n\n" ),
+ indexes =
+ {
+ @CreateIndex( attribute = "objectClass" ),
+ @CreateIndex( attribute = "dc" ),
+ @CreateIndex( attribute = "ou" )
+ } )
+ } )
+public final class PartitionIT extends AbstractLdapTestUnit
{
private static final Logger LOG = LoggerFactory.getLogger( PartitionIT.class );
- public static DirectoryService service;
/**
- * Creates a DirectoryService configured with two separate dc=com based
- * domains to test multiple partitions.
- */
- public static class Factory implements DirectoryServiceFactory
- {
- public DirectoryService newInstance() throws Exception
- {
- DirectoryService service = new DefaultDirectoryService();
- service.getChangeLog().setEnabled( true );
-
- Partition foo = new JdbmPartition();
- foo.setId( "foo" );
- foo.setSuffix( "dc=foo,dc=com" );
- service.addPartition( foo );
-
- Partition bar = new JdbmPartition();
- bar.setId( "bar" );
- bar.setSuffix( "dc=bar,dc=com" );
- service.addPartition( bar );
-
- return service;
- }
- }
-
-
- /**
* Test case to weed out issue in DIRSERVER-1118.
*
* @see https://issues.apache.org/jira/browse/DIRSERVER-1118
@@ -112,13 +106,13 @@
* Confirm the presence of the partitions foo and bar through DS API
*/
HashMap<String, Partition> partitionMap = new HashMap<String, Partition>();
-
+
for ( Partition partition : service.getPartitions() )
{
LOG.debug( "partition id = {}", partition.getId() );
partitionMap.put( partition.getId(), partition );
}
-
+
assertNotNull( partitionMap.containsKey( "foo" ) );
assertNotNull( partitionMap.containsKey( "bar" ) );
@@ -127,19 +121,19 @@
* namingContexts as values innamingContexts attribute of the rootDSE
*/
LdapContext rootDSE = getRootContext( service );
- Attribute namingContexts = rootDSE.getAttributes( "",
- new String[] { "namingContexts" } ).get( "namingContexts" );
+ Attribute namingContexts = rootDSE.getAttributes( "", new String[]
+ { "namingContexts" } ).get( "namingContexts" );
assertTrue( namingContexts.contains( "dc=foo,dc=com" ) );
assertTrue( namingContexts.contains( "dc=bar,dc=com" ) );
LOG.debug( "Found both dc=foo,dc=com and dc=bar,dc=com in namingContexts" );
-
+
/*
* Add, lookup, then delete entry in both foo and bar partitions
*/
addLookupDelete( "dc=foo,dc=com" );
addLookupDelete( "dc=bar,dc=com" );
}
-
+
/**
* Given the suffix DN of a partition this method will add an entry, look
@@ -155,12 +149,12 @@
String entryDn = "ou=people," + partitionSuffix;
rootDSE.createSubcontext( entryDn, attrs );
LOG.debug( "added entry {} to partition {}", entryDn, partitionSuffix );
-
+
Attributes reloaded = rootDSE.getAttributes( entryDn );
assertNotNull( reloaded );
assertTrue( reloaded.get( "ou" ).contains( "people" ) );
LOG.debug( "looked up entry {} from partition {}", entryDn, partitionSuffix );
-
+
rootDSE.destroySubcontext( entryDn );
try
{
Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/PreferencesIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/PreferencesIT.java?rev=896599&r1=896598&r2=896599&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/PreferencesIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/PreferencesIT.java Wed Jan 6 18:26:43 2010
@@ -20,17 +20,18 @@
package org.apache.directory.server.core.prefs;
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.integ.CiRunner;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import static org.junit.Assert.assertTrue;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
+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;
+
/**
* Tests the ServerSystemPreferences class.
@@ -38,11 +39,9 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@RunWith ( CiRunner.class )
-public class PreferencesIT
+@RunWith ( FrameworkRunner.class )
+public class PreferencesIT extends AbstractLdapTestUnit
{
- public static DirectoryService service;
-
@Test
public void testSystemRoot()