directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1065276 - /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java
Date Sun, 30 Jan 2011 13:56:13 GMT
Author: elecharny
Date: Sun Jan 30 13:56:13 2011
New Revision: 1065276

URL: http://svn.apache.org/viewvc?rev=1065276&view=rev
Log:
Fixed the SyncModifyDn control tests

Modified:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java?rev=1065276&r1=1065275&r2=1065276&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java
Sun Jan 30 13:56:13 2011
@@ -31,8 +31,8 @@ import org.apache.directory.junit.tools.
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.ISyncModifyDn;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnDecorator;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnContainer;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -49,7 +49,7 @@ public class SyncModifyDnControlTest
 {
     
     @Test
-    public void testDecodeSyncModifyDnControlWithMoveOperation()
+    public void testDecodeSyncModifyDnControlWithMoveOperation() throws Exception
     {
         ByteBuffer bb = ByteBuffer.allocate( 0x12 );
         bb.put( new byte[]
@@ -61,20 +61,10 @@ public class SyncModifyDnControlTest
             } );
         bb.flip();
 
-        SyncModifyDnContainer container = new SyncModifyDnContainer();
-        SyncModifyDnDecorator decorator = container.getSyncModifyDnControl();
+        SyncModifyDnDecorator decorator = new SyncModifyDnDecorator();
 
-        try
-        {
-            decorator.decode( bb.array() );
-        }
-        catch ( DecoderException de )
-        {
-            de.printStackTrace();
-            fail( de.getMessage() );
-        }
+        ISyncModifyDn syncmodDnControl = (ISyncModifyDn)decorator.decode( bb.array() );
 
-        SyncModifyDnDecorator syncmodDnControl = container.getSyncModifyDnControl();
         assertEquals( "uid=jim", syncmodDnControl.getEntryDn() );
         assertEquals( "ou=dc", syncmodDnControl.getNewSuperiorDn() );
         assertFalse( syncmodDnControl.isDeleteOldRdn() );
@@ -99,9 +89,9 @@ public class SyncModifyDnControlTest
                 } );
             buffer.flip();
 
-            ByteBuffer encoded = syncmodDnControl.encode( ByteBuffer.allocate( syncmodDnControl.computeLength()
) );
+            ByteBuffer encoded = ((SyncModifyDnDecorator)syncmodDnControl).encode( ByteBuffer.allocate(
((SyncModifyDnDecorator)syncmodDnControl).computeLength() ) );
             assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array())
);
-                }
+        }
         catch ( EncoderException ee )
         {
             fail( ee.getMessage() );
@@ -110,7 +100,7 @@ public class SyncModifyDnControlTest
 
     
     @Test
-    public void testDecodeSyncModifyDnControlWithRenameOperation()
+    public void testDecodeSyncModifyDnControlWithRenameOperation() throws Exception
     {
         ByteBuffer bb = ByteBuffer.allocate( 0x17 );
         bb.put( new byte[]
@@ -123,20 +113,10 @@ public class SyncModifyDnControlTest
             } );
         bb.flip();
 
-        SyncModifyDnContainer container = new SyncModifyDnContainer();
-        SyncModifyDnDecorator decorator = container.getSyncModifyDnControl();
+        SyncModifyDnDecorator decorator = new SyncModifyDnDecorator();
 
-        try
-        {
-            decorator.decode( bb.array() );
-        }
-        catch ( DecoderException de )
-        {
-            de.printStackTrace();
-            fail( de.getMessage() );
-        }
+        ISyncModifyDn syncmodDnControl = (ISyncModifyDn)decorator.decode( bb.array() );
 
-        SyncModifyDnDecorator syncmodDnControl = container.getSyncModifyDnControl();
         assertEquals( "uid=jim", syncmodDnControl.getEntryDn() );
         assertEquals( "uid=j", syncmodDnControl.getNewRdn() );
         assertTrue( syncmodDnControl.isDeleteOldRdn() );
@@ -162,7 +142,7 @@ public class SyncModifyDnControlTest
                 } );
             buffer.flip();
 
-            ByteBuffer encoded = syncmodDnControl.encode( ByteBuffer.allocate( syncmodDnControl.computeLength()
) );
+            ByteBuffer encoded = ((SyncModifyDnDecorator)syncmodDnControl).encode( ByteBuffer.allocate(
((SyncModifyDnDecorator)syncmodDnControl).computeLength() ) );
             assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array())
);
                 }
         catch ( EncoderException ee )
@@ -173,7 +153,7 @@ public class SyncModifyDnControlTest
 
     
     @Test
-    public void testDecodeSyncModifyDnControlWithRenameAndMoveOperation()
+    public void testDecodeSyncModifyDnControlWithRenameAndMoveOperation() throws Exception
     {
         ByteBuffer bb = ByteBuffer.allocate( 0x1E );
         bb.put( new byte[]
@@ -187,20 +167,10 @@ public class SyncModifyDnControlTest
             } );
         bb.flip();
 
-        SyncModifyDnContainer container = new SyncModifyDnContainer();
-        SyncModifyDnDecorator decorator = container.getSyncModifyDnControl();
+        SyncModifyDnDecorator decorator = new SyncModifyDnDecorator();
 
-        try
-        {
-            decorator.decode( bb.array() );
-        }
-        catch ( DecoderException de )
-        {
-            de.printStackTrace();
-            fail( de.getMessage() );
-        }
+        ISyncModifyDn syncmodDnControl = (ISyncModifyDn)decorator.decode( bb.array() );
 
-        SyncModifyDnDecorator syncmodDnControl = container.getSyncModifyDnControl();
         assertEquals( "uid=jim", syncmodDnControl.getEntryDn() );
         assertEquals( "ou=dc", syncmodDnControl.getNewSuperiorDn() );
         assertEquals( "uid=j", syncmodDnControl.getNewRdn() );
@@ -228,7 +198,7 @@ public class SyncModifyDnControlTest
                 } );
             buffer.flip();
 
-            ByteBuffer encoded = syncmodDnControl.encode( ByteBuffer.allocate( syncmodDnControl.computeLength()
) );
+            ByteBuffer encoded = ((SyncModifyDnDecorator)syncmodDnControl).encode( ByteBuffer.allocate(
((SyncModifyDnDecorator)syncmodDnControl).computeLength() ) );
             assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array())
);
                 }
         catch ( EncoderException ee )
@@ -250,8 +220,8 @@ public class SyncModifyDnControlTest
             } );
         bb.flip();
 
-        SyncModifyDnContainer container = new SyncModifyDnContainer();
-        SyncModifyDnDecorator decorator = container.getSyncModifyDnControl();
+        SyncModifyDnDecorator decorator = new SyncModifyDnDecorator();
+        
         decorator.decode( bb.array() );
     }
 }



Mime
View raw message