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 2011/03/19 00:22:22 UTC
svn commit: r1083106 - in /directory:
apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/
apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/
shared/trunk/integ/src/test/java/org/apache/directory...
Author: elecharny
Date: Fri Mar 18 23:22:22 2011
New Revision: 1083106
URL: http://svn.apache.org/viewvc?rev=1083106&view=rev
Log:
o Removed the EntryAttributeSerializer, LdifControlSerializer, LdifEntrySerializer and DnSerializer classes
o Renamed some tests
Added:
directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializationTest.java
- copied, changed from r1082924, directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializerTest.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializationTest.java
- copied, changed from r1082924, directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializerTest.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializationTest.java
- copied, changed from r1082924, directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializerTest.java
Removed:
directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializerTest.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttributeSerializer.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializer.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntrySerializer.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/DnSerializer.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializerTest.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializerTest.java
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java
directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntryAttributeSerializerTest.java
directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java
directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryAttributeSerializerTest.java
directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntrySerializationTest.java
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java Fri Mar 18 23:22:22 2011
@@ -26,7 +26,6 @@ import java.io.ObjectOutput;
import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.name.DnSerializer;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,11 +63,11 @@ public final class LdapPrincipalSerializ
// The principal's DN
if ( principal.getDn() == null )
{
- DnSerializer.serialize( Dn.EMPTY_DN, out );
+ Dn.EMPTY_DN.writeExternal( out );
}
else
{
- DnSerializer.serialize( principal.getDn(), out );
+ principal.getDn().writeExternal( out );
}
}
@@ -88,7 +87,16 @@ public final class LdapPrincipalSerializ
AuthenticationLevel authenticationLevel = AuthenticationLevel.getLevel( in.readInt() );
// Read the principal's DN
- Dn dn = DnSerializer.deserialize( schemaManager, in );
+ Dn dn = new Dn( schemaManager );
+
+ try
+ {
+ dn.readExternal( in );
+ }
+ catch ( ClassNotFoundException cnfe )
+ {
+ throw new IOException( cnfe.getMessage() );
+ }
LdapPrincipal principal = new LdapPrincipal( schemaManager, dn, authenticationLevel );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventMessage.java Fri Mar 18 23:22:22 2011
@@ -37,9 +37,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.entry.DefaultEntryAttribute;
import org.apache.directory.shared.ldap.model.entry.Entry;
import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.name.DnSerializer;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.slf4j.Logger;
@@ -148,11 +146,12 @@ public class ReplicaEventMessage impleme
try
{
- dn = DnSerializer.deserialize( schemaManager, in );
+ dn = new Dn( schemaManager );
+ dn.readExternal( in );
}
- catch ( LdapInvalidDnException lide )
+ catch ( ClassNotFoundException cnfe )
{
- throw new IOException( lide.getMessage() );
+ throw new IOException( cnfe.getMessage() );
}
entry.setDn( dn );
Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntryAttributeSerializerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntryAttributeSerializerTest.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntryAttributeSerializerTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/entry/SchemaAwareEntryAttributeSerializerTest.java Fri Mar 18 23:22:22 2011
@@ -29,7 +29,6 @@ import java.io.ObjectOutputStream;
import org.apache.directory.shared.ldap.model.entry.DefaultEntryAttribute;
import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.model.entry.EntryAttributeSerializer;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
@@ -71,42 +70,46 @@ public class SchemaAwareEntryAttributeSe
@Test
- public void testEntryAttributeNoStringValueSerialization() throws IOException
+ public void testEntryAttributeNoStringValueSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( cn );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( schemaManager, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
+ attribute2.applySchemaManager( schemaManager );
assertEquals( attribute1, attribute2 );
}
@Test
- public void testEntryAttributeOneStringValueSerialization() throws IOException
+ public void testEntryAttributeOneStringValueSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( "CommonName", cn, "test" );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( schemaManager, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
+ attribute2.applySchemaManager( schemaManager );
assertEquals( attribute1, attribute2 );
assertEquals( "CommonName", attribute2.getUpId() );
@@ -114,21 +117,23 @@ public class SchemaAwareEntryAttributeSe
@Test
- public void testEntryAttributeManyStringValuesSerialization() throws IOException
+ public void testEntryAttributeManyStringValuesSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( "CN", cn, "test1", "test2", "test3" );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( schemaManager, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
+ attribute2.applySchemaManager( schemaManager );
assertEquals( attribute1, attribute2 );
assertEquals( "CN", attribute2.getUpId() );
@@ -136,63 +141,69 @@ public class SchemaAwareEntryAttributeSe
@Test
- public void testEntryAttributeNoBinaryValueSerialization() throws IOException
+ public void testEntryAttributeNoBinaryValueSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( userCertificate );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( schemaManager, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
+ attribute2.applySchemaManager( schemaManager );
assertEquals( attribute1, attribute2 );
}
@Test
- public void testEntryAttributeOneBinaryValueSerialization() throws IOException
+ public void testEntryAttributeOneBinaryValueSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( userCertificate, data1 );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( schemaManager, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
+ attribute2.applySchemaManager( schemaManager );
assertEquals( attribute1, attribute2 );
}
@Test
- public void testEntryAttributeManyBinaryValuesSerialization() throws IOException
+ public void testEntryAttributeManyBinaryValuesSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( "UserCertificate", userCertificate, data1, data2, data3 );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( schemaManager, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
+ attribute2.applySchemaManager( schemaManager );
assertEquals( attribute1, attribute2 );
assertEquals( "UserCertificate", attribute2.getUpId() );
Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/DnTest.java Fri Mar 18 23:22:22 2011
@@ -29,10 +29,6 @@ import static org.junit.Assert.assertSam
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.util.Arrays;
import java.util.List;
@@ -44,7 +40,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.name.Ava;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.name.DnParser;
-import org.apache.directory.shared.ldap.model.name.DnSerializer;
import org.apache.directory.shared.ldap.model.name.Rdn;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
@@ -2495,117 +2490,6 @@ public class DnTest
}
- /**
- * Test the serialization of a Dn
- *
- * @throws Exception
- */
- @Test
- public void testNameSerialization() throws Exception
- {
- Dn dn = new Dn( "ou= Some People + dc= And Some anImAls,dc = eXample,dc= cOm" );
- dn.normalize( schemaManager );
-
- assertEquals( dn, DnSerializer.deserialize( schemaManager, DnSerializer.serialize( dn ) ) );
- }
-
-
- @Test
- public void testSerializeEmptyDN() throws Exception
- {
- Dn dn = Dn.EMPTY_DN;
-
- assertEquals( dn, DnSerializer.deserialize( schemaManager, DnSerializer.serialize( dn ) ) );
- }
-
-
- /**
- * Test the serialization of a Dn
- *
- * @throws Exception
- */
- @Test
- public void testNameStaticSerialization() throws Exception
- {
- Dn dn = new Dn( "ou= Some People + dc= And Some anImAls,dc = eXample,dc= cOm" );
- dn.normalize( schemaManager );
-
- byte[] data = DnSerializer.serialize( dn );
-
- ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
-
- assertEquals( dn, DnSerializer.deserialize( schemaManager, in ) );
- }
-
-
- /*
- @Test public void testSerializationPerfs() throws Exception
- {
- Dn dn = new Dn( "ou= Some People + dc= And Some anImAls,dc = eXample,dc= cOm" );
- dn.normalize( oids );
-
- long t0 = System.currentTimeMillis();
-
- for ( int i = 0; i < 1000; i++ )
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream( baos );
-
- DnSerializer.serialize( dn, out );
-
- byte[] data = baos.toByteArray();
- ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
-
- Dn dn1 = DnSerializer.deserialize( in );
- }
-
- long t1 = System.currentTimeMillis();
-
- System.out.println( "delta :" + ( t1 - t0) );
-
- long t2 = System.currentTimeMillis();
-
- for ( int i = 0; i < 1000000; i++ )
- {
- //ByteArrayOutputStream baos = new ByteArrayOutputStream();
- //ObjectOutputStream out = new ObjectOutputStream( baos );
-
- //DnSerializer.serializeString( dn, out );
-
- //byte[] data = baos.toByteArray();
- //ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
-
- //Dn dn1 = DnSerializer.deserializeString( in, oids );
- dn.normalize( oids );
- }
-
- long t3 = System.currentTimeMillis();
-
- System.out.println( "delta :" + ( t3 - t2) );
-
- //assertEquals( dn, DnSerializer.deserialize( in ) );
- }
- */
-
- @Test
- public void testStaticSerializeEmptyDN() throws Exception
- {
- Dn dn = Dn.EMPTY_DN;
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream( baos );
-
- DnSerializer.serialize( dn, out );
- out.flush();
-
- byte[] data = baos.toByteArray();
- ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
-
- assertEquals( dn, DnSerializer.deserialize( schemaManager, in ) );
- assertEquals( dn, DnSerializer.deserialize( schemaManager, DnSerializer.serialize( dn ) ) );
- }
-
-
@Test
public void testCompositeRDN() throws LdapException
{
Copied: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializationTest.java (from r1082924, directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializerTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializationTest.java?p2=directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializationTest.java&p1=directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializerTest.java&r1=1082924&r2=1083106&rev=1083106&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializerTest.java (original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/name/SchemaAwareDnSerializationTest.java Fri Mar 18 23:22:22 2011
@@ -32,6 +32,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,7 +46,7 @@ import com.mycila.junit.concurrent.Concu
*/
@RunWith(ConcurrentJunitRunner.class)
@Concurrency()
-public class SchemaAwareDnSerializerTest
+public class SchemaAwareDnSerializationTest
{
private static SchemaManager schemaManager;
@@ -125,4 +126,145 @@ public class SchemaAwareDnSerializerTest
assertEquals( "Cn = Doe", dn2.getName() );
assertEquals( "2.5.4.3=doe", dn2.getNormName() );
}
+ /**
+ * Test the serialization of a Dn
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testNameSerialization() throws Exception
+ {
+ Dn dn = new Dn( "ou= Some People + dc= And Some anImAls,dc = eXample,dc= cOm" );
+ dn.normalize( schemaManager );
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream( baos );
+
+ dn.writeExternal( out );
+
+ byte[] data = baos.toByteArray();
+ ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
+
+ Dn dn2 = new Dn( schemaManager );
+ dn2.readExternal( in );
+
+ assertEquals( dn, dn2 );
+ }
+
+
+ @Test
+ public void testSerializeEmptyDN() throws Exception
+ {
+ Dn dn = Dn.EMPTY_DN;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream( baos );
+
+ dn.writeExternal( out );
+
+ byte[] data = baos.toByteArray();
+ ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
+
+ Dn dn2 = new Dn( schemaManager );
+ dn2.readExternal( in );
+
+ assertEquals( dn, dn2 );
+ }
+
+
+ /**
+ * Test the serialization of a Dn
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testNameStaticSerialization() throws Exception
+ {
+ Dn dn = new Dn( "ou= Some People + dc= And Some anImAls,dc = eXample,dc= cOm" );
+ dn.normalize( schemaManager );
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream( baos );
+
+ dn.writeExternal( out );
+
+ byte[] data = baos.toByteArray();
+ ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
+
+ Dn dn2 = new Dn( schemaManager );
+ dn2.readExternal( in );
+
+ assertEquals( dn, dn2 );
+ }
+
+
+ @Ignore
+ @Test public void testSerializationPerfs() throws Exception
+ {
+ Dn dn = new Dn( "ou= Some People + dc= And Some anImAls,dc = eXample,dc= cOm" );
+ dn.normalize( schemaManager );
+
+ long t0 = System.currentTimeMillis();
+
+ for ( int i = 0; i < 1000; i++ )
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream( baos );
+
+ dn.writeExternal( out );
+
+ byte[] data = baos.toByteArray();
+ ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
+
+ Dn dn1 = new Dn( schemaManager );
+ dn1.readExternal( in );
+ }
+
+ long t1 = System.currentTimeMillis();
+
+ System.out.println( "delta :" + ( t1 - t0) );
+
+ long t2 = System.currentTimeMillis();
+
+ for ( int i = 0; i < 1000000; i++ )
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream( baos );
+
+ dn.writeExternal( out );
+
+ byte[] data = baos.toByteArray();
+ ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
+
+ Dn dn1 = new Dn( schemaManager );
+ dn1.readExternal( in );
+
+ dn.normalize( schemaManager );
+ }
+
+ long t3 = System.currentTimeMillis();
+
+ System.out.println( "delta :" + ( t3 - t2) );
+
+ //assertEquals( dn, DnSerializer.deserialize( in ) );
+ }
+
+ @Test
+ public void testStaticSerializeEmptyDN() throws Exception
+ {
+ Dn dn = Dn.EMPTY_DN;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream( baos );
+
+ dn.writeExternal( out );
+
+ byte[] data = baos.toByteArray();
+ ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
+
+ Dn dn2 = new Dn( schemaManager );
+ dn2.readExternal( in );
+
+ assertEquals( dn, dn2 );
+ }
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java Fri Mar 18 23:22:22 2011
@@ -32,6 +32,7 @@ import org.apache.directory.shared.ldap.
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.schema.AttributeType;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.ldap.model.schema.SyntaxChecker;
import org.apache.directory.shared.util.Strings;
import org.slf4j.Logger;
@@ -2326,4 +2327,23 @@ public class DefaultEntryAttribute imple
}
}
}
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void applySchemaManager( SchemaManager schemaManager )
+ {
+ AttributeType attributeType = null;
+
+ if ( schemaManager != null )
+ {
+ if ( !Strings.isEmpty( id ) )
+ {
+ attributeType = schemaManager.getAttributeType( id );
+ }
+
+ this.setAttributeType( attributeType );
+ }
+ }
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Entry.java Fri Mar 18 23:22:22 2011
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Set;
import org.apache.directory.shared.ldap.model.exception.LdapException;
-
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryAttribute.java Fri Mar 18 23:22:22 2011
@@ -25,6 +25,7 @@ import java.util.Iterator;
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.schema.AttributeType;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.ldap.model.schema.SyntaxChecker;
@@ -486,4 +487,10 @@ public interface EntryAttribute extends
* @throws LdapException if there is a failure to check syntaxes of values
*/
boolean isValid( SyntaxChecker checker) throws LdapException;
+
+
+ /**
+ * Apply the give SchemaManager to make this EntryAttribute Schema aware
+ */
+ void applySchemaManager( SchemaManager schemaManager );
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java Fri Mar 18 23:22:22 2011
@@ -151,6 +151,8 @@ public class LdifControl implements Cont
{
out.writeBoolean( false );
}
+
+ out.flush();
}
Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryAttributeSerializerTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryAttributeSerializerTest.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryAttributeSerializerTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/EntryAttributeSerializerTest.java Fri Mar 18 23:22:22 2011
@@ -47,126 +47,132 @@ public class EntryAttributeSerializerTes
private static byte[] data3 = new byte[] {0x09, 0x0A, 0x0B, 0x0C};
@Test
- public void testEntryAttributeNoStringValueSerialization() throws IOException
+ public void testEntryAttributeNoStringValueSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( "CN" );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( null, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
assertEquals( attribute1, attribute2 );
}
@Test
- public void testEntryAttributeOneStringValueSerialization() throws IOException
+ public void testEntryAttributeOneStringValueSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( "CN", "test" );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( null, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
assertEquals( attribute1, attribute2 );
}
@Test
- public void testEntryAttributeManyStringValuesSerialization() throws IOException
+ public void testEntryAttributeManyStringValuesSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( "CN", "test1", "test2", "test3" );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( null, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
assertEquals( attribute1, attribute2 );
}
@Test
- public void testEntryAttributeNoBinaryValueSerialization() throws IOException
+ public void testEntryAttributeNoBinaryValueSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( "UserCertificate" );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( null, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
assertEquals( attribute1, attribute2 );
}
@Test
- public void testEntryAttributeOneBinaryValueSerialization() throws IOException
+ public void testEntryAttributeOneBinaryValueSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( "UserCertificate", data1 );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( null, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
assertEquals( attribute1, attribute2 );
}
@Test
- public void testEntryAttributeManyBinaryValuesSerialization() throws IOException
+ public void testEntryAttributeManyBinaryValuesSerialization() throws IOException, ClassNotFoundException
{
EntryAttribute attribute1 = new DefaultEntryAttribute( "UserCertificate", data1, data2, data3 );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- EntryAttributeSerializer.serialize( attribute1, out );
+ attribute1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- EntryAttribute attribute2 = EntryAttributeSerializer.deserialize( null, in );
+ EntryAttribute attribute2 = new DefaultEntryAttribute();
+ attribute2.readExternal( in );
assertEquals( attribute1, attribute2 );
}
Copied: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializationTest.java (from r1082924, directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializerTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializationTest.java?p2=directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializationTest.java&p1=directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializerTest.java&r1=1082924&r2=1083106&rev=1083106&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializerTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifControlSerializationTest.java Fri Mar 18 23:22:22 2011
@@ -44,7 +44,7 @@ import com.mycila.junit.concurrent.Concu
*/
@RunWith(ConcurrentJunitRunner.class)
@Concurrency()
-public class LdifControlSerializerTest
+public class LdifControlSerializationTest
{
private static Control controlCriticalWithData;
private static Control controlCriticalNoData;
@@ -81,7 +81,7 @@ public class LdifControlSerializerTest
@Test
- public void testControlCriticalWithDataSerialization() throws IOException
+ public void testControlCriticalWithDataSerialization() throws IOException, ClassNotFoundException
{
LdifControl ldifControl1 = new LdifControl( controlCriticalWithData.getOid() );
ldifControl1.setCritical( controlCriticalWithData.isCritical() );
@@ -90,21 +90,22 @@ public class LdifControlSerializerTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifControlSerializer.serialize( ldifControl1, out );
+ ldifControl1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifControl ldifControl2 = LdifControlSerializer.deserialize( in );
+ LdifControl ldifControl2 = new LdifControl();
+ ldifControl2.readExternal( in );
assertEquals( ldifControl1, ldifControl2 );
}
@Test
- public void testControlCriticalNoDataSerialization() throws IOException
+ public void testControlCriticalNoDataSerialization() throws IOException, ClassNotFoundException
{
LdifControl ldifControl1 = new LdifControl( controlCriticalNoData.getOid() );
ldifControl1.setCritical( controlCriticalNoData.isCritical() );
@@ -112,21 +113,22 @@ public class LdifControlSerializerTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifControlSerializer.serialize( ldifControl1, out );
+ ldifControl1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifControl ldifControl2 = LdifControlSerializer.deserialize( in );
+ LdifControl ldifControl2 = new LdifControl();
+ ldifControl2.readExternal( in );
assertEquals( ldifControl1, ldifControl2 );
}
@Test
- public void testControlCriticalEmptyDataSerialization() throws IOException
+ public void testControlCriticalEmptyDataSerialization() throws IOException, ClassNotFoundException
{
LdifControl ldifControl1 = new LdifControl( controlCriticalEmptyData.getOid() );
ldifControl1.setCritical( controlCriticalEmptyData.isCritical() );
@@ -135,21 +137,22 @@ public class LdifControlSerializerTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifControlSerializer.serialize( ldifControl1, out );
+ ldifControl1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifControl ldifControl2 = LdifControlSerializer.deserialize( in );
+ LdifControl ldifControl2 = new LdifControl();
+ ldifControl2.readExternal( in );
assertEquals( ldifControl1, ldifControl2 );
}
@Test
- public void testControlNoCriticalWithDataSerialization() throws IOException
+ public void testControlNoCriticalWithDataSerialization() throws IOException, ClassNotFoundException
{
LdifControl ldifControl1 = new LdifControl( controlNoCriticalWithData.getOid() );
ldifControl1.setCritical( controlNoCriticalWithData.isCritical() );
@@ -158,21 +161,22 @@ public class LdifControlSerializerTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifControlSerializer.serialize( ldifControl1, out );
+ ldifControl1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifControl ldifControl2 = LdifControlSerializer.deserialize( in );
+ LdifControl ldifControl2 = new LdifControl();
+ ldifControl2.readExternal( in );
assertEquals( ldifControl1, ldifControl2 );
}
@Test
- public void testControlNoCriticalNoDataSerialization() throws IOException
+ public void testControlNoCriticalNoDataSerialization() throws IOException, ClassNotFoundException
{
LdifControl ldifControl1 = new LdifControl( controlNoCriticalNoData.getOid() );
ldifControl1.setCritical( controlNoCriticalNoData.isCritical() );
@@ -180,21 +184,22 @@ public class LdifControlSerializerTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifControlSerializer.serialize( ldifControl1, out );
+ ldifControl1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifControl ldifControl2 = LdifControlSerializer.deserialize( in );
+ LdifControl ldifControl2 = new LdifControl();
+ ldifControl2.readExternal( in );
assertEquals( ldifControl1, ldifControl2 );
}
@Test
- public void testControlNoCriticalEmptyDataSerialization() throws IOException
+ public void testControlNoCriticalEmptyDataSerialization() throws IOException, ClassNotFoundException
{
LdifControl ldifControl1 = new LdifControl( controlNoCriticalEmptyData.getOid() );
ldifControl1.setCritical( controlNoCriticalEmptyData.isCritical() );
@@ -203,14 +208,15 @@ public class LdifControlSerializerTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifControlSerializer.serialize( ldifControl1, out );
+ ldifControl1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifControl ldifControl2 = LdifControlSerializer.deserialize( in );
+ LdifControl ldifControl2 = new LdifControl();
+ ldifControl2.readExternal( in );
assertEquals( ldifControl1, ldifControl2 );
}
Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntrySerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntrySerializationTest.java?rev=1083106&r1=1083105&r2=1083106&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntrySerializationTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifEntrySerializationTest.java Fri Mar 18 23:22:22 2011
@@ -59,14 +59,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -92,14 +93,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -125,14 +127,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -159,14 +162,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -194,14 +198,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -228,14 +233,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -263,14 +269,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -299,14 +306,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -328,14 +336,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -358,14 +367,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -389,14 +399,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -421,14 +432,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -452,14 +464,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -481,14 +494,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
@@ -512,14 +526,15 @@ public class LdifEntrySerializationTest
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream( baos );
- LdifEntrySerializer.serialize( ldifEntry1, out );
+ ldifEntry1.writeExternal( out );
ObjectInputStream in = null;
byte[] data = baos.toByteArray();
in = new ObjectInputStream( new ByteArrayInputStream( data ) );
- LdifEntry ldifEntry2 = LdifEntrySerializer.deserialize( null, in );
+ LdifEntry ldifEntry2 = new LdifEntry();
+ ldifEntry2.readExternal( in );
assertEquals( ldifEntry1, ldifEntry2 );
}
Copied: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializationTest.java (from r1082924, directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializerTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializationTest.java?p2=directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializationTest.java&p1=directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializerTest.java&r1=1082924&r2=1083106&rev=1083106&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializerTest.java (original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/name/DnSerializationTest.java Fri Mar 18 23:22:22 2011
@@ -41,7 +41,7 @@ import com.mycila.junit.concurrent.Concu
*/
@RunWith(ConcurrentJunitRunner.class)
@Concurrency()
-public class DnSerializerTest
+public class DnSerializationTest
{
@Test
public void testDnFullSerialization() throws IOException, LdapException, ClassNotFoundException