directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1104280 - in /directory/apacheds/trunk/jdbm-partition/src: main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
Date Tue, 17 May 2011 14:28:37 GMT
Author: kayyagari
Date: Tue May 17 14:28:37 2011
New Revision: 1104280

URL: http://svn.apache.org/viewvc?rev=1104280&view=rev
Log:
o removed the Dn serialization while serializing the entry

Modified:
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializer.java
    directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializer.java?rev=1104280&r1=1104279&r2=1104280&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializer.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializer.java
Tue May 17 14:28:37 2011
@@ -88,8 +88,6 @@ public class ServerEntrySerializer imple
      * <p>
      * The structure used to store the entry is the following :
      * <ul>
-     *   <li><b>[a byte]</b> : if the Dn is empty 0 will be written else
1</li>
-     *   <li><b>[Rdn]</b> : The entry's Rdn.</li>
      *   <li><b>[numberAttr]</b> : the bumber of attributes. Can be 0</li>
      *   <li>For each Attribute :
      *     <ul>
@@ -107,21 +105,6 @@ public class ServerEntrySerializer imple
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
-        // First, the Dn
-        Dn dn = entry.getDn();
-        
-        // Write the Rdn of the Dn
-        if ( dn.isEmpty() )
-        {
-            out.writeByte( 0 );
-        }
-        else
-        {
-            out.writeByte( 1 );
-            Rdn rdn = dn.getRdn();
-            rdn.writeExternal( out );
-        }
-
         // Then the attributes.
         out.writeInt( entry.getAttributeTypes().size() );
 
@@ -174,28 +157,6 @@ public class ServerEntrySerializer imple
         {
             Entry entry = new DefaultEntry( schemaManager );
 
-            // Read the Dn, if any
-            byte hasDn = in.readByte();
-
-            if ( hasDn == 1 )
-            {
-                Rdn rdn = new Rdn( schemaManager );
-                rdn.readExternal( in );
-                
-                try
-                {
-                    entry.setDn( new Dn( schemaManager, rdn ) );
-                }
-                catch ( LdapInvalidDnException lide )
-                {
-                    throw new IOException( lide.getMessage() );
-                }
-            }
-            else
-            {
-                entry.setDn( Dn.EMPTY_DN );
-            }
-
             // Read the number of attributes
             int nbAttributes = in.readInt();
 

Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java?rev=1104280&r1=1104279&r2=1104280&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ServerEntrySerializerTest.java
Tue May 17 14:28:37 2011
@@ -29,10 +29,10 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
+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.Entry;
-import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
@@ -130,8 +130,7 @@ public class ServerEntrySerializerTest
     @Test
     public void testSerializeEmtpyServerEntry() throws Exception
     {
-        Dn dn = Dn.EMPTY_DN;
-        Entry entry = new DefaultEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager );
 
         ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
 
@@ -146,9 +145,7 @@ public class ServerEntrySerializerTest
     @Test
     public void testSerializeDNServerEntry() throws Exception
     {
-        Dn dn = new Dn( schemaManager, "cn=text, dc=example, dc=com" );
-
-        Entry entry = new DefaultEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager );
 
         ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
 
@@ -156,9 +153,6 @@ public class ServerEntrySerializerTest
 
         Entry result = ( Entry ) ses.deserialize( data );
 
-        Dn newDn = new Dn( dn.getRdn() );
-        entry.setDn( newDn );
-
         assertEquals( entry, result );
     }
 
@@ -166,10 +160,7 @@ public class ServerEntrySerializerTest
     @Test
     public void testSerializeServerEntryOC() throws Exception
     {
-        Dn dn = new Dn( "cn=text, dc=example, dc=com" );
-        dn.apply( schemaManager );
-
-        Entry entry = new DefaultEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager );
         entry.add( "objectClass", "top", "person", "inetOrgPerson", "organizationalPerson"
);
 
         ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
@@ -178,10 +169,6 @@ public class ServerEntrySerializerTest
 
         Entry result = ( Entry ) ses.deserialize( data );
 
-        Dn newDn = new Dn();
-        newDn = newDn.add( dn.getRdn() );
-        entry.setDn( newDn );
-
         assertEquals( entry, result );
     }
 
@@ -189,10 +176,7 @@ public class ServerEntrySerializerTest
     @Test
     public void testSerializeServerEntry() throws Exception
     {
-        Dn dn = new Dn( "cn=text, dc=example, dc=com" );
-        dn.apply( schemaManager );
-
-        Entry entry = new DefaultEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager );
         entry.add( "objectClass", "top", "person", "inetOrgPerson", "organizationalPerson"
);
         entry.add( "cn", "text", "test" );
         entry.add( "SN", "Test" );
@@ -204,10 +188,6 @@ public class ServerEntrySerializerTest
 
         Entry result = ( Entry ) ses.deserialize( data );
 
-        Dn newDn = new Dn();
-        newDn = newDn.add( dn.getRdn() );
-        entry.setDn( newDn );
-
         assertEquals( entry, result );
     }
 
@@ -215,10 +195,7 @@ public class ServerEntrySerializerTest
     @Test
     public void testSerializeServerEntryWithEmptyDN() throws Exception
     {
-        Dn dn = new Dn( "" );
-        dn.apply( schemaManager );
-
-        Entry entry = new DefaultEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager );
         entry.add( "objectClass", "top", "person", "inetOrgPerson", "organizationalPerson"
);
         entry.add( "cn", "text", "test" );
         entry.add( "SN", "Test" );
@@ -237,10 +214,7 @@ public class ServerEntrySerializerTest
     @Test
     public void testSerializeServerEntryWithNoAttributes() throws Exception
     {
-        Dn dn = new Dn( "" );
-        dn.apply( schemaManager );
-
-        Entry entry = new DefaultEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager );
 
         ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
 
@@ -255,10 +229,7 @@ public class ServerEntrySerializerTest
     @Test
     public void testSerializeServerEntryWithAttributeNoValue() throws Exception
     {
-        Dn dn = new Dn( "" );
-        dn.apply( schemaManager );
-
-        Entry entry = new DefaultEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager );
 
         ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
         Attribute oc = new DefaultAttribute( "ObjectClass", schemaManager
@@ -276,10 +247,7 @@ public class ServerEntrySerializerTest
     @Test
     public void testSerializeServerEntryWithAttributeStringValue() throws Exception
     {
-        Dn dn = new Dn( "" );
-        dn.apply( schemaManager );
-
-        Entry entry = new DefaultEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager );
 
         ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
         entry.add( "ObjectClass", "top", "person" );
@@ -295,10 +263,7 @@ public class ServerEntrySerializerTest
     @Test
     public void testSerializeServerEntryWithAttributeBinaryValue() throws Exception
     {
-        Dn dn = new Dn( "" );
-        dn.apply( schemaManager );
-
-        Entry entry = new DefaultEntry( schemaManager, dn );
+        Entry entry = new DefaultEntry( schemaManager );
 
         ServerEntrySerializer ses = new ServerEntrySerializer( schemaManager );
         entry.add( "userPassword", Strings.getBytesUtf8("secret") );



Mime
View raw message