directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1089278 - in /directory: apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/ apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/ apacheds/trunk/core-integ/src/test/java/org/ap...
Date Tue, 05 Apr 2011 22:54:43 GMT
Author: elecharny
Date: Tue Apr  5 22:54:43 2011
New Revision: 1089278

URL: http://svn.apache.org/viewvc?rev=1089278&view=rev
Log:
o Created the DefaultEntry() constructor which takes a LDIF entry as a parameter.
o Removed the LdifEntry.createEntry() methods
o Modified the tests

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/configuration/PartitionConfigurationIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointAddIT.java
    directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/EntryTest.java
    directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntrySerializationTest.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntrySerializationTest.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntryTest.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/admin/AdministrativePointServiceIT.java Tue Apr  5 22:54:43 2011
@@ -31,11 +31,11 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.DefaultModification;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.model.message.AddResponse;
 import org.apache.directory.shared.ldap.model.message.ModifyDnResponse;
 import org.apache.directory.shared.ldap.model.message.ModifyResponse;
@@ -95,7 +95,7 @@ public class AdministrativePointServiceI
     @Test
     public void testAddAutonomousArea() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry( 
+        Entry autonomousArea = new DefaultEntry( 
             "ou=autonomousArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -116,7 +116,7 @@ public class AdministrativePointServiceI
         assertFalse( entry.contains( "administrativeRole", "2.5.23.4" ) );
         assertFalse( entry.contains( "administrativeRole", "triggerExecutionSpecificArea" ) );
 
-        autonomousArea = LdifUtils.createEntry( 
+        autonomousArea = new DefaultEntry( 
             "ou=autonomousArea2, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -141,7 +141,7 @@ public class AdministrativePointServiceI
     @Test
     public void testAddSpecificAreas() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry( 
+        Entry autonomousArea = new DefaultEntry( 
             "ou=autonomousArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -171,7 +171,7 @@ public class AdministrativePointServiceI
     @Test
     public void testAddInnerAreas() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry( 
+        Entry autonomousArea = new DefaultEntry( 
             "ou=autonomousArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -199,7 +199,7 @@ public class AdministrativePointServiceI
     @Test
     public void testAddInvalidRole() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry( 
+        Entry autonomousArea = new DefaultEntry( 
             "ou=autonomousArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -220,7 +220,7 @@ public class AdministrativePointServiceI
     @Test
     public void testAddInnerAndSpecificRole() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry( 
+        Entry autonomousArea = new DefaultEntry( 
             "ou=autonomousArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -241,7 +241,7 @@ public class AdministrativePointServiceI
     @Test
     public void testAddRoleMorehanOnce() throws Exception
     {
-        Entry autonomousArea = LdifUtils.createEntry( 
+        Entry autonomousArea = new DefaultEntry( 
             "ou=autonomousArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -267,7 +267,7 @@ public class AdministrativePointServiceI
     public void testModifyAddSpecificArea() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry( 
+        Entry caArea = new DefaultEntry( 
             "ou=caArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -297,7 +297,7 @@ public class AdministrativePointServiceI
     public void testModifyAddInnerArea() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry(
+        Entry caArea = new DefaultEntry(
                 "ou=caArea, ou=system",
                 "ObjectClass: top",
                 "ObjectClass: organizationalUnit",
@@ -327,7 +327,7 @@ public class AdministrativePointServiceI
     public void testModifyAddInnerAreaToSameSpecificArea() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry( 
+        Entry caArea = new DefaultEntry( 
             "ou=caArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -353,7 +353,7 @@ public class AdministrativePointServiceI
     public void testModifyAddSameSpecificArea() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry( 
+        Entry caArea = new DefaultEntry( 
             "ou=caArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -379,7 +379,7 @@ public class AdministrativePointServiceI
     public void testModifyDeleteAll() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry( 
+        Entry caArea = new DefaultEntry( 
             "ou=caArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -409,7 +409,7 @@ public class AdministrativePointServiceI
     public void testModifyDeleteAll2() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry( 
+        Entry caArea = new DefaultEntry( 
             "ou=caArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -440,7 +440,7 @@ public class AdministrativePointServiceI
     public void testModifyDeleteSomeRole() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry( 
+        Entry caArea = new DefaultEntry( 
             "ou=caArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -472,7 +472,7 @@ public class AdministrativePointServiceI
     public void testModifyDeleteSomeInexistingRole() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry( 
+        Entry caArea = new DefaultEntry( 
             "ou=caArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -499,7 +499,7 @@ public class AdministrativePointServiceI
     public void testModifyCombined() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry( 
+        Entry caArea = new DefaultEntry( 
             "ou=caArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -536,7 +536,7 @@ public class AdministrativePointServiceI
     public void testModifyReplace() throws Exception
     {
         // Inject an CASA
-        Entry caArea = LdifUtils.createEntry( 
+        Entry caArea = new DefaultEntry( 
             "ou=caArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -566,7 +566,7 @@ public class AdministrativePointServiceI
     public void testMoveAutonomousArea() throws Exception
     {
         // Inject an AAA
-        Entry autonomousArea = LdifUtils.createEntry( 
+        Entry autonomousArea = new DefaultEntry( 
             "ou=autonomousArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -593,7 +593,7 @@ public class AdministrativePointServiceI
     public void testMoveAndRenameAutonomousArea() throws Exception
     {
         // Inject an AAA
-        Entry autonomousArea = LdifUtils.createEntry( 
+        Entry autonomousArea = new DefaultEntry( 
             "ou=autonomousArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 
@@ -621,7 +621,7 @@ public class AdministrativePointServiceI
     public void testRenameAutonomousArea() throws Exception
     {
         // Inject an AAA
-        Entry autonomousArea = LdifUtils.createEntry( 
+        Entry autonomousArea = new DefaultEntry( 
             "ou=autonomousArea, ou=system", 
             "ObjectClass: top",
             "ObjectClass: organizationalUnit", 

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java Tue Apr  5 22:54:43 2011
@@ -49,11 +49,10 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.extras.controls.ppolicy_impl.PasswordPolicyDecorator;
 import org.apache.directory.shared.ldap.model.constants.LdapSecurityConstants;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.model.message.AddRequest;
 import org.apache.directory.shared.ldap.model.message.AddRequestImpl;
 import org.apache.directory.shared.ldap.model.message.AddResponse;
@@ -130,8 +129,13 @@ public class PasswordPolicyTest extends 
         LdapConnection connection = getAdminNetworkConnection( getLdapServer() );
         
         Dn userDn = new Dn( "cn=user,ou=system" );
-        Entry userEntry = LdifUtils.createEntry( userDn, "ObjectClass: top", "ObjectClass: person", "cn: user",
-            "sn: user_sn", "userPassword: 1234" );
+        Entry userEntry = new DefaultEntry( 
+            userDn.toString(), 
+            "ObjectClass: top", 
+            "ObjectClass: person", 
+            "cn: user",
+            "sn: user_sn", 
+            "userPassword: 1234" );
 
         AddRequest addRequest = new AddRequestImpl();
         addRequest.setEntry( userEntry );
@@ -208,8 +212,13 @@ public class PasswordPolicyTest extends 
         LdapConnection connection = getAdminNetworkConnection( getLdapServer() );
 
         Dn userDn = new Dn( "cn=userMinAge,ou=system" );
-        Entry userEntry = LdifUtils.createEntry(userDn, "ObjectClass: top", "ObjectClass: person", "cn: userMinAge",
-                "sn: userMinAge_sn", "userPassword: 12345");
+        Entry userEntry = new DefaultEntry(
+            userDn.toString(), 
+            "ObjectClass: top", 
+            "ObjectClass: person", 
+            "cn: userMinAge",
+            "sn: userMinAge_sn", 
+            "userPassword: 12345");
 
         AddRequest addRequest = new AddRequestImpl();
         addRequest.setEntry( userEntry );

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=1089278&r1=1089277&r2=1089278&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 Tue Apr  5 22:54:43 2011
@@ -23,9 +23,9 @@ package org.apache.directory.server.core
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.integ.IntegrationUtils;
-import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.message.AddResponse;
 import org.apache.directory.shared.ldap.model.message.ModifyRequest;
 import org.apache.directory.shared.ldap.model.message.ModifyRequestImpl;
@@ -82,9 +82,9 @@ public class AutzIntegUtils
     public static Dn createGroup( String cn, String firstMemberDn ) throws Exception
     {
         Dn groupDn = new Dn( "cn=" + cn + ",ou=groups,ou=system" );
-        Entry entry = LdifUtils.createEntry( 
+        Entry entry = new DefaultEntry( 
             service.getSchemaManager(),
-            groupDn, 
+            "cn=" + cn + ",ou=groups,ou=system", 
             "ObjectClass: top", 
             "ObjectClass: groupOfUniqueNames",
             "uniqueMember:", firstMemberDn,
@@ -123,7 +123,7 @@ public class AutzIntegUtils
     {
         LdapConnection connection = getAdminConnection();
 
-        Entry entry = LdifUtils.createEntry( 
+        Entry entry = new DefaultEntry( 
             service.getSchemaManager(),
             "uid=" + uid + ",ou=users,ou=system",
             "uid", uid,
@@ -154,9 +154,9 @@ public class AutzIntegUtils
     {
         Dn groupDn = new Dn( "cn=" + groupName + ",ou=groups,ou=system" );
 
-        Entry entry = LdifUtils.createEntry( 
+        Entry entry = new DefaultEntry( 
             service.getSchemaManager(),
-            groupDn,
+            "cn=" + groupName + ",ou=groups,ou=system",
             "objectClass: top", 
             "objectClass: groupOfUniqueNames",
             "uniqueMember: uid=admin, ou=system",
@@ -252,7 +252,7 @@ public class AutzIntegUtils
         }
 
         // now add the A/C subentry below ou=system
-        Entry subEntry = LdifUtils.createEntry( 
+        Entry subEntry = new DefaultEntry( 
             "cn=" + cn + ",ou=system",
             "objectClass: top", 
             "objectClass: subentry", 

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=1089278&r1=1089277&r2=1089278&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 Tue Apr  5 22:54:43 2011
@@ -34,8 +34,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.model.message.CompareResponse;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -96,9 +96,9 @@ public class CompareAuthorizationIT exte
         boolean result = true;
 
         // create the entry with the telephoneNumber attribute to compare
-        Entry testEntry = LdifUtils.createEntry( 
+        Entry testEntry = new DefaultEntry( 
             service.getSchemaManager(),
-            entryDn,
+            entryDn.toString(),
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
             "ou: testou",
@@ -263,9 +263,9 @@ public class CompareAuthorizationIT exte
         LdapConnection adminCtx = getAdminConnection();
 
         Dn userDn = new Dn( "uid=bob,ou=users,ou=system" );
-        Entry user = LdifUtils.createEntry(
+        Entry user = new DefaultEntry(
             service.getSchemaManager(),
-            userDn,
+            "uid=bob,ou=users,ou=system",
             "uid: bob",
             "userPassword: bobspassword",
             "ObjectClass: top", 
@@ -277,7 +277,7 @@ public class CompareAuthorizationIT exte
 
         adminCtx.add( user );
 
-        CompareResponse resp = adminCtx.compare(userDn, "userPassword", "bobspassword" );
+        CompareResponse resp = adminCtx.compare( userDn, "userPassword", "bobspassword" );
         assertEquals( ResultCodeEnum.COMPARE_TRUE, resp.getLdapResult().getResultCode() );
     }
 

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=1089278&r1=1089277&r2=1089278&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 Tue Apr  5 22:54:43 2011
@@ -48,7 +48,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.model.message.Response;
 import org.apache.directory.shared.ldap.model.message.SearchResultEntry;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
@@ -110,8 +109,8 @@ public class SearchAuthorizationIT exten
 
         for ( int i = 0; i < count; i++ )
         {
-            Entry entry = LdifUtils.createEntry(
-                base,
+            Entry entry = new DefaultEntry(
+                base.toString(),
                 "ObjectClass: top",
                 "ObjectClass: organizationalUnit",
                 "ou: testEntry",

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=1089278&r1=1089277&r2=1089278&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 Tue Apr  5 22:54:43 2011
@@ -34,15 +34,15 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.DefaultModification;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.ldif.LdapLdifException;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.model.message.AddResponse;
 import org.apache.directory.shared.ldap.model.message.ModifyResponse;
 import org.apache.directory.shared.ldap.model.message.Response;
@@ -71,7 +71,11 @@ public class CollectiveAttributeServiceI
 
     private Entry getTestEntry( String dn, String cn ) throws LdapLdifException, LdapException
     {
-        Entry subentry = LdifUtils.createEntry( new Dn( dn ), "objectClass: top", "objectClass: person", "cn", cn,
+        Entry subentry = new DefaultEntry( 
+            dn, 
+            "objectClass: top", 
+            "objectClass: person", 
+            "cn", cn,
             "sn: testentry" );
 
         return subentry;
@@ -80,9 +84,14 @@ public class CollectiveAttributeServiceI
 
     private Entry getTestSubentry( String dn ) throws LdapLdifException, LdapException
     {
-        Entry subentry = LdifUtils.createEntry( new Dn( dn ), "objectClass: top", "objectClass: subentry",
-            "objectClass: collectiveAttributeSubentry", "c-ou: configuration",
-            "subtreeSpecification: { base \"ou=configuration\" }", "cn: testsubentry" );
+        Entry subentry = new DefaultEntry( 
+            dn, 
+            "objectClass: top", 
+            "objectClass: subentry",
+            "objectClass: collectiveAttributeSubentry", 
+            "c-ou: configuration",
+            "subtreeSpecification: { base \"ou=configuration\" }", 
+            "cn: testsubentry" );
 
         return subentry;
     }
@@ -90,9 +99,14 @@ public class CollectiveAttributeServiceI
 
     private Entry getTestSubentry2( String dn ) throws LdapLdifException, LdapException
     {
-        Entry subentry = LdifUtils.createEntry(new Dn(dn), "objectClass: top", "objectClass: subentry",
-                "objectClass: collectiveAttributeSubentry", "c-ou: configuration2",
-                "subtreeSpecification: { base \"ou=configuration\" }", "cn: testsubentry2");
+        Entry subentry = new DefaultEntry(
+            dn, 
+            "objectClass: top", 
+            "objectClass: subentry",
+            "objectClass: collectiveAttributeSubentry", 
+            "c-ou: configuration2",
+            "subtreeSpecification: { base \"ou=configuration\" }", 
+            "cn: testsubentry2");
 
         return subentry;
     }
@@ -100,9 +114,14 @@ public class CollectiveAttributeServiceI
 
     private Entry getTestSubentry3( String dn ) throws LdapLdifException, LdapException
     {
-        Entry subentry = LdifUtils.createEntry( new Dn( dn ), "objectClass: top", "objectClass: subentry",
-            "objectClass: collectiveAttributeSubentry", "c-st: FL",
-            "subtreeSpecification: { base \"ou=configuration\" }", "cn: testsubentry3" );
+        Entry subentry = new DefaultEntry( 
+            dn, 
+            "objectClass: top", 
+            "objectClass: subentry",
+            "objectClass: collectiveAttributeSubentry", 
+            "c-st: FL",
+            "subtreeSpecification: { base \"ou=configuration\" }", 
+            "cn: testsubentry3" );
 
         return subentry;
     }

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=1089278&r1=1089277&r2=1089278&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 Tue Apr  5 22:54:43 2011
@@ -35,8 +35,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.shared.ldap.model.csn.CsnFactory;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -64,7 +64,9 @@ public class PartitionConfigurationIT ex
 
         Dn suffixDn = new Dn( getService().getSchemaManager(), "ou=removable" );
 
-        Entry ctxEntry = LdifUtils.createEntry( getService().getSchemaManager(), suffixDn,
+        Entry ctxEntry = new DefaultEntry( 
+            getService().getSchemaManager(), 
+            suffixDn.toString(),
             "objectClass: top",
             "objectClass: organizationalUnit",
             "ou: removable",

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceIT.java Tue Apr  5 22:54:43 2011
@@ -34,13 +34,13 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.DefaultModification;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.model.message.ModifyResponse;
 import org.apache.directory.shared.ldap.model.message.Response;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
@@ -76,8 +76,12 @@ public class OperationalAttributeService
 
         // add this entry before each test because we want 
         // to check that operational attributes are added
-        Entry entry = LdifUtils
-            .createEntry(DN_KATE_BUSH, "objectClass: top", "objectClass: person", "cn: Kate Bush", "sn: Bush");
+        Entry entry = new DefaultEntry(
+            DN_KATE_BUSH, 
+            "objectClass: top", 
+            "objectClass: person", 
+            "cn: Kate Bush", 
+            "sn: Bush");
         connection.add( entry );
     }
 
@@ -96,8 +100,8 @@ public class OperationalAttributeService
     @Test
     public void testBinaryAttributeFilterExtension() throws Exception
     {
-        Entry entry = LdifUtils.createEntry( 
-            new Dn( "ou=test,ou=system" ), 
+        Entry entry = new DefaultEntry( 
+            "ou=test,ou=system", 
             "objectClass: top", 
             "objectClass: person",
             "objectClass: organizationalPerson", 
@@ -140,8 +144,11 @@ public class OperationalAttributeService
         /*
          * create ou=testing00,ou=system
          */
-        Entry entry = LdifUtils.createEntry( new Dn( "ou=testing00,ou=system" ), "objectClass: top",
-            "objectClass: organizationalUnit", "ou", "testing00" );
+        Entry entry = new DefaultEntry( 
+            "ou=testing00,ou=system", 
+            "objectClass: top",
+            "objectClass: organizationalUnit", 
+            "ou", "testing00" );
 
         connection.add( entry );
 
@@ -222,11 +229,24 @@ public class OperationalAttributeService
     @Test
     public void testConfirmNonAdminUserDnIsCreatorsName() throws Exception
     {
-        Entry entry = LdifUtils.createEntry( new Dn( "uid=akarasulu,ou=users,ou=system" ), "objectClass: top",
-            "objectClass: person", "objectClass: organizationalPerson", "objectClass: inetOrgPerson",
-            "ou: Engineering", "ou: People", "uid: akarasulu", "l", "Bogusville", "cn: Alex Karasulu", "sn: Karasulu",
-            "givenName", "mail: akarasulu@apache.org", "telephoneNumber: +1 408 555 4798",
-            "facsimileTelephoneNumber: +1 408 555 9751", "roomnumber: 4612", "userPassword: test" );
+        Entry entry = new DefaultEntry( 
+            "uid=akarasulu,ou=users,ou=system", 
+            "objectClass: top",
+            "objectClass: person", 
+            "objectClass: organizationalPerson", 
+            "objectClass: inetOrgPerson",
+            "ou: Engineering", 
+            "ou: People", 
+            "uid: akarasulu", 
+            "l", "Bogusville", 
+            "cn: Alex Karasulu", 
+            "sn: Karasulu",
+            "givenName: Alex", 
+            "mail: akarasulu@apache.org", 
+            "telephoneNumber: +1 408 555 4798",
+            "facsimileTelephoneNumber: +1 408 555 9751", 
+            "roomnumber: 4612", 
+            "userPassword: test" );
 
         connection.add( entry );
 

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java Tue Apr  5 22:54:43 2011
@@ -51,9 +51,9 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.search.subentries.SubentriesDecorator;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.model.message.AddResponse;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.ModifyRequest;
@@ -225,9 +225,14 @@ public class SubentryServiceIT extends A
 
     public Entry getSubentry( String dn ) throws Exception
     {
-        Entry subentry = LdifUtils.createEntry( new Dn( dn ), "objectClass: top", "objectClass: subentry",
-            "objectClass: collectiveAttributeSubentry", "subtreeSpecification: { base \"ou=configuration\" }",
-            "c-o: Test Org", "cn: testsubentry" );
+        Entry subentry = new DefaultEntry( 
+            dn, 
+            "objectClass: top", 
+            "objectClass: subentry",
+            "objectClass: collectiveAttributeSubentry", 
+            "subtreeSpecification: { base \"ou=configuration\" }",
+            "c-o: Test Org", 
+            "cn: testsubentry" );
 
         return subentry;
     }
@@ -251,7 +256,8 @@ public class SubentryServiceIT extends A
 
     public Entry getTestSubentryWithExclusion( String dn ) throws LdapException
     {
-        Entry subentry = LdifUtils.createEntry( new Dn( dn ),
+        Entry subentry = new DefaultEntry( 
+            dn,
             "objectClass: top",
             "objectClass: subentry",
             "objectClass: collectiveAttributeSubentry",
@@ -405,10 +411,14 @@ public class SubentryServiceIT extends A
         LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
 
         // Add the subentry
-        Entry subEntryA = LdifUtils.createEntry( new Dn( "cn=testsubentryA,dc=AP-A,dc=test,ou=system" ),
-            "objectClass: top", "objectClass: subentry", "objectClass: collectiveAttributeSubentry",
+        Entry subEntryA = new DefaultEntry( 
+            "cn=testsubentryA,dc=AP-A,dc=test,ou=system",
+            "objectClass: top", 
+            "objectClass: subentry", 
+            "objectClass: collectiveAttributeSubentry",
             "subtreeSpecification: {}", // All the entry from the AP, including the AP
-            "c-o: Test Org", "cn: testsubentryA" );
+            "c-o: Test Org", 
+            "cn: testsubentryA" );
 
         AddResponse response = connection.add( subEntryA );
 
@@ -447,10 +457,14 @@ public class SubentryServiceIT extends A
 
         // Now add another subentry on AP-B
         // Add the subentry
-        Entry subEntryB = LdifUtils.createEntry(new Dn("cn=testsubentryB,dc=AP-B,cn=A2,dc=AP-A,dc=test,ou=system"),
-                "objectClass: top", "objectClass: subentry", "objectClass: collectiveAttributeSubentry",
-                "subtreeSpecification: {}", // All the entry from the AP, including the AP
-                "c-o: Test Org", "cn: testsubentryB");
+        Entry subEntryB = new DefaultEntry(
+            "cn=testsubentryB,dc=AP-B,cn=A2,dc=AP-A,dc=test,ou=system",
+            "objectClass: top", 
+            "objectClass: subentry", 
+            "objectClass: collectiveAttributeSubentry",
+            "subtreeSpecification: {}", // All the entry from the AP, including the AP
+            "c-o: Test Org", 
+            "cn: testsubentryB");
 
         response = connection.add( subEntryB );
 
@@ -1410,7 +1424,7 @@ public class SubentryServiceIT extends A
     {
         userConnection = IntegrationUtils.getConnectionAs( getService(), "cn=testUser,ou=system", "test" );
 
-        Entry sap = LdifUtils.createEntry(
+        Entry sap = new DefaultEntry(
             "ou=dummy,ou=system",
             "objectClass: organizationalUnit",
             "objectClass: top",

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointAddIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointAddIT.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointAddIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/admin/AdministrativePointAddIT.java Tue Apr  5 22:54:43 2011
@@ -31,9 +31,9 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
-import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.message.AddResponse;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
@@ -178,7 +178,7 @@ public class AdministrativePointAddIT ex
 
         // First check that we can't add an IAP in the DIT if there is no
         // parent AAP or SAP with the same role
-        Entry entry = LdifUtils.createEntry(
+        Entry entry = new DefaultEntry(
             "ou=IAP-CANew,ou=entry,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -194,7 +194,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response.getLdapResult().getResultCode() );
 
         // Add the entry under a SAP with the same role which has no parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
                 "ou=IAP-CANew,ou=SAP-CA2,ou=system",
                 "ObjectClass: top",
                 "ObjectClass: organizationalUnit",
@@ -209,7 +209,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under a SAP with a different role which has no parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=IAP-CANew,ou=SAP-AC2,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -224,7 +224,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response.getLdapResult().getResultCode() );
 
         // Add the entry under an AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=IAP-CANew,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -239,7 +239,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under an IAP with the same role which has a parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=IAP-CANew,ou=IAP-CA1,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -254,7 +254,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under an IAP with a different role which has a parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=IAP-CANew,ou=IAP-AC1,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -269,7 +269,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under an SAP with the same role which has a parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=IAP-CANew,ou=SAP-CA1,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -284,7 +284,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under an SAP with a different role which has a parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=IAP-CANew,ou=SAP-AC1,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -310,7 +310,7 @@ public class AdministrativePointAddIT ex
 
         // First check that we can add a SAP in the DIT if there is no
         // parent AAP or SAP
-        Entry entry = LdifUtils.createEntry(
+        Entry entry = new DefaultEntry(
             "ou=SAP-CANew,ou=entry,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -325,7 +325,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under a SAP with the same role which has no parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=SAP-CANew,ou=SAP-CA2,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -340,7 +340,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under a SAP with a different role which has no parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=SAP-CANew,ou=SAP-AC2,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -355,7 +355,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under an AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=SAP-CANew,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -370,7 +370,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under an IAP with the same role which has a parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=SAP-CANew,ou=IAP-CA1,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -385,7 +385,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under an IAP with a different role which has a parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=SAP-CANew,ou=IAP-AC1,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -400,7 +400,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under an SAP with the same role which has a parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=SAP-CANew,ou=SAP-CA1,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",
@@ -415,7 +415,7 @@ public class AdministrativePointAddIT ex
         assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
 
         // Add the entry under an SAP with a different role which has a parent AAP
-        entry = LdifUtils.createEntry(
+        entry = new DefaultEntry(
             "ou=SAP-CANew,ou=SAP-AC1,ou=AAP1,ou=system",
             "ObjectClass: top",
             "ObjectClass: organizationalUnit",

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/EntryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/EntryTest.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/EntryTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/EntryTest.java Tue Apr  5 22:54:43 2011
@@ -37,11 +37,11 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.BinaryValue;
-import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.StringValue;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
@@ -198,6 +198,28 @@ public class EntryTest
 
 
     /**
+     * Test method for DefaultEntry()
+     */
+    @Test
+    public void testDefaultClientEntryLdif() throws Exception
+    {
+        Entry entry = new DefaultEntry( 
+            "ou=example, dc=com",
+            "ObjectClass: top",
+            "ObjectClass: person",
+            "cn: test",
+            "sn: test" );
+        
+        assertNotNull( entry );
+        assertEquals( "ou=example, dc=com", entry.getDn().toString() );
+        assertEquals( 3, entry.size() );
+        assertTrue( entry.contains( "objectClass", "top", "person" ) );
+        assertTrue( entry.contains( "cn", "test" ) );
+        assertTrue( entry.contains( "sn", "test" ) );
+    }
+
+
+    /**
      * Test method for DefaultEntry( Dn )
      */
     @Test

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntrySerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntrySerializationTest.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntrySerializationTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntrySerializationTest.java Tue Apr  5 22:54:43 2011
@@ -31,7 +31,6 @@ import java.io.ObjectOutputStream;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
 import org.junit.BeforeClass;
@@ -65,7 +64,7 @@ public class SchemaAwareEntrySerializati
     @Test
     public void testEntryFullSerialization() throws IOException, LdapException, ClassNotFoundException
     {
-        Entry entry1 = LdifUtils.createEntry( 
+        Entry entry1 = new DefaultEntry( 
             schemaManager,
             "dc=example, dc=com", 
             "ObjectClass: top",
@@ -94,7 +93,7 @@ public class SchemaAwareEntrySerializati
     @Test
     public void testEntryNoDnSerialization() throws IOException, LdapException, ClassNotFoundException
     {
-        Entry entry1 = LdifUtils.createEntry( 
+        Entry entry1 = new DefaultEntry( 
             schemaManager,
             "", 
             "ObjectClass: top",
@@ -124,7 +123,7 @@ public class SchemaAwareEntrySerializati
     @Test
     public void testEntryNoAttributesSerialization() throws IOException, LdapException, ClassNotFoundException
     {
-        Entry entry1 = LdifUtils.createEntry( schemaManager, "dc=example, dc=com" ); 
+        Entry entry1 = new DefaultEntry( schemaManager, "dc=example, dc=com" ); 
         
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
@@ -147,7 +146,7 @@ public class SchemaAwareEntrySerializati
     @Test
     public void testEntryNoAttributesNoDnSerialization() throws IOException, LdapException, ClassNotFoundException
     {
-        Entry entry1 = LdifUtils.createEntry( schemaManager, "" ); 
+        Entry entry1 = new DefaultEntry( schemaManager, "" ); 
         
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java Tue Apr  5 22:54:43 2011
@@ -35,9 +35,12 @@ import org.apache.directory.shared.i18n.
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.shared.ldap.model.ldif.LdifAttributesReader;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.util.Base64;
 import org.apache.directory.shared.util.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -175,6 +178,93 @@ public final class DefaultEntry implemen
 
 
     /**
+     * Creates a new instance of DefaultEntry, with a
+     * Dn and a list of IDs.
+     *
+     * @param dn The Dn for this serverEntry. Can be null.
+     * @param upIds The list of attributes to create.
+     */
+    public DefaultEntry( String dn, Object... elements ) throws LdapException
+    {
+        this( null, dn, elements );
+    }
+
+
+    /**
+     * Creates a new instance of DefaultEntry, with a
+     * Dn and a list of IDs.
+     *
+     * @param dn The Dn for this serverEntry. Can be null.
+     * @param upIds The list of attributes to create.
+     */
+    public DefaultEntry( SchemaManager schemaManager, String dn, Object... elements ) throws LdapException
+    {
+        StringBuilder sb = new StringBuilder();
+        int pos = 0;
+        boolean valueExpected = false;
+
+        for ( Object element : elements )
+        {
+            if ( !valueExpected )
+            {
+                if ( !( element instanceof String ) )
+                {
+                    throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
+                        I18n.ERR_12085, ( pos + 1 ) ) );
+                }
+
+                String attribute = ( String ) element;
+                sb.append( attribute );
+
+                if ( attribute.indexOf( ':' ) != -1 )
+                {
+                    sb.append( '\n' );
+                }
+                else
+                {
+                    valueExpected = true;
+                }
+            }
+            else
+            {
+                if ( element instanceof String )
+                {
+                    sb.append( ": " ).append( ( String ) element ).append( '\n' );
+                }
+                else if ( element instanceof byte[] )
+                {
+                    sb.append( ":: " );
+                    sb.append( new String( Base64.encode( ( byte[] ) element ) ) );
+                    sb.append( '\n' );
+                }
+                else
+                {
+                    throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
+                        I18n.ERR_12086, ( pos + 1 ) ) );
+                }
+
+                valueExpected = false;
+            }
+        }
+
+        if ( valueExpected )
+        {
+            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n
+                .err( I18n.ERR_12087 ) );
+        }
+
+        LdifAttributesReader reader = new LdifAttributesReader();
+        DefaultEntry entry = (DefaultEntry)reader.parseEntry( schemaManager, sb.toString() );
+        this.dn = new Dn( schemaManager, dn );
+        this.attributes = entry.attributes;
+        this.schemaManager = schemaManager;
+        
+        // Initialize the ObjectClass object
+        initObjectClassAT();
+    }
+
+
+    /**
      * <p>
      * Creates a new instance of DefaultEntry, copying
      * another entry.

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java Tue Apr  5 22:54:43 2011
@@ -25,17 +25,16 @@ import java.io.UnsupportedEncodingExcept
 import javax.naming.directory.Attributes;
 
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.AttributeUtils;
 import org.apache.directory.shared.ldap.model.entry.DefaultAttribute;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.util.Base64;
 import org.apache.directory.shared.util.Strings;
 
@@ -731,164 +730,4 @@ public final class LdifUtils
 
         return attributes;
     }
-
-
-    /**
-     * Build a new Entry instance from a LDIF list of lines. The values can be
-     * either a complete Ava, or a couple of AttributeType ID and a value (a String or
-     * a byte[]). The following sample shows the three cases :
-     *
-     * <pre>
-     * Entry entry = LdifUtils.createEntry(
-     *     new Dn( "cn=test" ),
-     *     "objectclass: top",
-     *     "cn", "My name",
-     *     "jpegPhoto", new byte[]{0x01, 0x02} );
-     * </pre>
-     *
-     * @param dn The Entry's Dn
-     * @param avas The AttributeType and Values, using a ldif format, or a couple of
-     * Attribute ID/Value
-     * @return An Entry instance
-     * @throws LdapException If the data are invalid
-     */
-    public static Entry createEntry( Dn dn, Object... avas ) throws LdapException
-    {
-        return createEntry( null, dn, avas );
-    }
-
-
-    /**
-     * Build a new Entry instance from a LDIF list of lines. The values can be
-     * either a complete Ava, or a couple of AttributeType ID and a value (a String or
-     * a byte[]). The following sample shows the three cases :
-     *
-     * <pre>
-     * Entry entry = LdifUtils.createEntry(
-     *     new Dn( "cn=test" ),
-     *     "objectclass: top",
-     *     "cn", "My name",
-     *     "jpegPhoto", new byte[]{0x01, 0x02} );
-     * </pre>
-     *
-     * @param dn The entry's Dn as a String
-     * @param avas The AttributeType and Values, using a ldif format, or a couple of
-     * Attribute ID/Value
-     * @return An Entry instance
-     * @throws LdapException If the data are invalid
-     */
-    public static Entry createEntry( String dn, Object... avas ) throws LdapException
-    {
-        return createEntry( null, new Dn( dn ), avas );
-    }
-
-
-    /**
-     * Build a new Entry instance from a LDIF list of lines. The values can be
-     * either a complete Ava, or a couple of AttributeType ID and a value (a String or
-     * a byte[]). The following sample shows the three cases :
-     *
-     * <pre>
-     * Entry entry = LdifUtils.createEntry(
-     *     new Dn( "cn=test" ),
-     *     "objectclass: top",
-     *     "cn", "My name",
-     *     "jpegPhoto", new byte[]{0x01, 0x02} );
-     * </pre>
-     *
-     * @param schemaManager The SchemaManager instance
-     * @param dn The entry's Dn
-     * @param avas The AttributeType and Values, using a ldif format, or a couple of
-     * Attribute ID/Value
-     * @return An Entry instance
-     * @throws LdapException If the data are invalid
-     */
-    public static Entry createEntry( SchemaManager schemaManager, String dn, Object... avas ) throws LdapException
-    {
-        return createEntry( schemaManager, new Dn( dn ), avas );
-    }
-
-
-    /**
-     * Build a new Entry instance from a LDIF list of lines. The values can be
-     * either a complete Ava, or a couple of AttributeType ID and a value (a String or
-     * a byte[]). The following sample shows the three cases :
-     *
-     * <pre>
-     * Entry entry = LdifUtils.createEntry(
-     *     new Dn( "cn=test" ),
-     *     "objectclass: top",
-     *     "cn", "My name",
-     *     "jpegPhoto", new byte[]{0x01, 0x02} );
-     * </pre>
-     *
-     * @param schemaManager The SchemaManager instance
-     * @param dn The entry's Dn
-     * @param avas The AttributeType and Values, using a ldif format, or a couple of
-     * Attribute ID/Value
-     * @return An Entry instance
-     * @throws LdapException If the data are invalid
-     */
-    public static Entry createEntry( SchemaManager schemaManager, Dn dn, Object... avas ) throws LdapException
-    {
-        StringBuilder sb = new StringBuilder();
-        int pos = 0;
-        boolean valueExpected = false;
-
-        for ( Object ava : avas )
-        {
-            if ( !valueExpected )
-            {
-                if ( !( ava instanceof String ) )
-                {
-                    throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
-                        I18n.ERR_12085, ( pos + 1 ) ) );
-                }
-
-                String attribute = ( String ) ava;
-                sb.append( attribute );
-
-                if ( attribute.indexOf( ':' ) != -1 )
-                {
-                    sb.append( '\n' );
-                }
-                else
-                {
-                    valueExpected = true;
-                }
-            }
-            else
-            {
-                if ( ava instanceof String )
-                {
-                    sb.append( ": " ).append( ( String ) ava ).append( '\n' );
-                }
-                else if ( ava instanceof byte[] )
-                {
-                    sb.append( ":: " );
-                    sb.append( new String( Base64.encode( ( byte[] ) ava ) ) );
-                    sb.append( '\n' );
-                }
-                else
-                {
-                    throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err(
-                        I18n.ERR_12086, ( pos + 1 ) ) );
-                }
-
-                valueExpected = false;
-            }
-        }
-
-        if ( valueExpected )
-        {
-            throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n
-                .err( I18n.ERR_12087 ) );
-        }
-
-        LdifAttributesReader reader = new LdifAttributesReader();
-        Entry entry = reader.parseEntry( schemaManager, sb.toString() );
-        entry.setDn( dn );
-
-        return entry;
-    }
 }

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntrySerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntrySerializationTest.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntrySerializationTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntrySerializationTest.java Tue Apr  5 22:54:43 2011
@@ -29,7 +29,6 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
 import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.ldap.model.ldif.LdifUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -48,7 +47,7 @@ public class EntrySerializationTest
     @Test
     public void testEntryFullSerialization() throws IOException, LdapException, ClassNotFoundException
     {
-        Entry entry1 = LdifUtils.createEntry( 
+        Entry entry1 = new DefaultEntry( 
             "dc=example, dc=com", 
             "ObjectClass: top",
             "ObjectClass: domain",
@@ -76,7 +75,7 @@ public class EntrySerializationTest
     @Test
     public void testEntryNoDnSerialization() throws IOException, LdapException, ClassNotFoundException
     {
-        Entry entry1 = LdifUtils.createEntry( 
+        Entry entry1 = new DefaultEntry( 
             "", 
             "ObjectClass: top",
             "ObjectClass: domain",
@@ -105,7 +104,7 @@ public class EntrySerializationTest
     @Test
     public void testEntryNoAttributesSerialization() throws IOException, LdapException, ClassNotFoundException
     {
-        Entry entry1 = LdifUtils.createEntry( "dc=example, dc=com" ); 
+        Entry entry1 = new DefaultEntry( "dc=example, dc=com" ); 
         
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
@@ -128,7 +127,7 @@ public class EntrySerializationTest
     @Test
     public void testEntryNoAttributesNoDnSerialization() throws IOException, LdapException, ClassNotFoundException
     {
-        Entry entry1 = LdifUtils.createEntry( "" ); 
+        Entry entry1 = new DefaultEntry( "" ); 
         
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntryTest.java?rev=1089278&r1=1089277&r2=1089278&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntryTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntryTest.java Tue Apr  5 22:54:43 2011
@@ -26,8 +26,9 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Modification;
 import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
@@ -65,7 +66,7 @@ public class LdifEntryTest
     @Test
     public void testLdifEntryEmptyDn() throws Exception
     {
-        Entry entry = LdifUtils.createEntry( "", "cn: test" );
+        Entry entry = new DefaultEntry( "", "cn: test" );
         LdifEntry ldifEntry = new LdifEntry( "", "cn: test" );
         
         assertNotNull( ldifEntry );
@@ -81,7 +82,7 @@ public class LdifEntryTest
     @Test
     public void testLdifEntryNullDn() throws Exception
     {
-        Entry entry = LdifUtils.createEntry( "", "cn: test" );
+        Entry entry = new DefaultEntry( "", "cn: test" );
         LdifEntry ldifEntry = new LdifEntry( (Dn)null, "cn: test" );
         
         assertNotNull( ldifEntry );



Mime
View raw message