directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1065051 - in /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn: ModifyDNRequestTest.java ModifyDNResponseTest.java
Date Sat, 29 Jan 2011 16:04:41 GMT
Author: elecharny
Date: Sat Jan 29 16:04:41 2011
New Revision: 1065051

URL: http://svn.apache.org/viewvc?rev=1065051&view=rev
Log:
Fixed the ModifyDn tests

Modified:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNResponseTest.java

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestTest.java?rev=1065051&r1=1065050&r2=1065051&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestTest.java
Sat Jan 29 16:04:41 2011
@@ -30,14 +30,20 @@ import java.util.Map;
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
+import org.apache.directory.shared.ldap.codec.ICodecControl;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapEncoder;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
-import org.apache.directory.shared.ldap.model.message.*;
+import org.apache.directory.shared.ldap.codec.decorators.ModifyDnRequestDecorator;
+import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.directory.shared.ldap.model.message.Message;
+import org.apache.directory.shared.ldap.model.message.ModifyDnRequest;
 import org.apache.directory.shared.ldap.model.message.ModifyDnResponseImpl;
+import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -55,6 +61,9 @@ public class ModifyDNRequestTest
     /** The encoder instance */
     LdapEncoder encoder = new LdapEncoder();
 
+    /** The codec service */
+    ILdapCodecService codec = new DefaultLdapCodecService();
+
 
     /**
      * Test the decoding of a full ModifyDNRequest
@@ -90,7 +99,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a ModifyRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         try
         {
@@ -102,8 +112,7 @@ public class ModifyDNRequestTest
             fail( de.getMessage() );
         }
 
-        ModifyDnRequest modifyDnRequest = ( ( LdapMessageContainer ) ldapMessageContainer
)
-            .getModifyDnRequest();
+        ModifyDnRequest modifyDnRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, modifyDnRequest.getMessageId() );
         assertEquals( "cn=testModify,ou=users,ou=system", modifyDnRequest.getName().toString()
);
@@ -164,7 +173,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a ModifyRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         try
         {
@@ -217,7 +227,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a ModifyRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         try
         {
@@ -270,7 +281,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a ModifyRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         try
         {
@@ -329,7 +341,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a ModifyRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         try
         {
@@ -341,8 +354,7 @@ public class ModifyDNRequestTest
             fail( de.getMessage() );
         }
 
-        ModifyDnRequest modifyDnRequest = ( ( LdapMessageContainer ) ldapMessageContainer
)
-            .getModifyDnRequest();
+        ModifyDnRequest modifyDnRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, modifyDnRequest.getMessageId() );
         assertEquals( "cn=testModify,ou=users,ou=system", modifyDnRequest.getName().toString()
);
@@ -355,7 +367,7 @@ public class ModifyDNRequestTest
 
         assertEquals( 1, controls.size() );
 
-        Control control = modifyDnRequest.getControl( "2.16.840.1.113730.3.4.2" );
+        ICodecControl<Control> control = ( ICodecControl<Control> )modifyDnRequest.getControl(
"2.16.840.1.113730.3.4.2" );
         assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
         assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
 
@@ -411,7 +423,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a ModifyRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         try
         {
@@ -423,8 +436,7 @@ public class ModifyDNRequestTest
             fail( de.getMessage() );
         }
 
-        ModifyDnRequest modifyDnRequest = ( ( LdapMessageContainer ) ldapMessageContainer
)
-            .getModifyDnRequest();
+        ModifyDnRequest modifyDnRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, modifyDnRequest.getMessageId() );
         assertEquals( "cn=testModify,ou=users,ou=system", modifyDnRequest.getName().toString()
);
@@ -490,7 +502,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a ModifyRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         try
         {
@@ -502,8 +515,7 @@ public class ModifyDNRequestTest
             fail( de.getMessage() );
         }
 
-        ModifyDnRequest modifyDnRequest = ( ( LdapMessageContainer ) ldapMessageContainer
)
-            .getModifyDnRequest();
+        ModifyDnRequest modifyDnRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, modifyDnRequest.getMessageId() );
         assertEquals( "cn=testModify,ou=users,ou=system", modifyDnRequest.getName().toString()
);
@@ -517,7 +529,7 @@ public class ModifyDNRequestTest
 
         assertTrue( modifyDnRequest.hasControl( "2.16.840.1.113730.3.4.2" ) );
 
-        Control control = modifyDnRequest.getControl( "2.16.840.1.113730.3.4.2" );
+        ICodecControl<Control> control = ( ICodecControl<Control> )modifyDnRequest.getControl(
"2.16.840.1.113730.3.4.2" );
         assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
         assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
 
@@ -563,7 +575,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         // Decode a ModifyDNRequest PDU
         try
@@ -598,7 +611,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         // Decode a ModifyDNRequest PDU
         try
@@ -637,7 +651,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         // Decode a ModifyDNRequest PDU
         try
@@ -680,7 +695,8 @@ public class ModifyDNRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnRequestDecorator>( codec );
 
         // Decode a ModifyDNRequest PDU
         try

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNResponseTest.java?rev=1065051&r1=1065050&r2=1065051&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNResponseTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNResponseTest.java
Sat Jan 29 16:04:41 2011
@@ -32,12 +32,15 @@ import org.apache.directory.junit.tools.
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
+import org.apache.directory.shared.ldap.codec.ICodecControl;
+import org.apache.directory.shared.ldap.codec.ILdapCodecService;
 import org.apache.directory.shared.ldap.codec.LdapEncoder;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.decorators.ModifyDnResponseDecorator;
+import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.ModifyDnResponse;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -55,6 +58,9 @@ public class ModifyDNResponseTest
     /** The encoder instance */
     LdapEncoder encoder = new LdapEncoder();
 
+    /** The codec service */
+    ILdapCodecService codec = new DefaultLdapCodecService();
+
 
     /**
      * Test the decoding of a ModifyDNResponse
@@ -86,7 +92,8 @@ public class ModifyDNResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnResponseDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnResponseDecorator>( codec );
 
         // Decode the ModifyDNResponse PDU
         try
@@ -100,8 +107,7 @@ public class ModifyDNResponseTest
         }
 
         // Check the decoded ModifyDNResponse PDU
-        ModifyDnResponse modifyDnResponse = ( ( LdapMessageContainer ) ldapMessageContainer
)
-            .getModifyDnResponse();
+        ModifyDnResponse modifyDnResponse = ldapMessageContainer.getMessage();
 
         assertEquals( 1, modifyDnResponse.getMessageId() );
         assertEquals( ResultCodeEnum.SUCCESS, modifyDnResponse.getLdapResult().getResultCode()
);
@@ -169,7 +175,8 @@ public class ModifyDNResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnResponseDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnResponseDecorator>( codec );
 
         // Decode the ModifyDNResponse PDU
         try
@@ -183,8 +190,7 @@ public class ModifyDNResponseTest
         }
 
         // Check the decoded ModifyDNResponse PDU
-        ModifyDnResponse modifyDnResponse = ( ( LdapMessageContainer ) ldapMessageContainer
)
-            .getModifyDnResponse();
+        ModifyDnResponse modifyDnResponse = ldapMessageContainer.getMessage();
 
         assertEquals( 1, modifyDnResponse.getMessageId() );
         assertEquals( ResultCodeEnum.SUCCESS, modifyDnResponse.getLdapResult().getResultCode()
);
@@ -196,7 +202,7 @@ public class ModifyDNResponseTest
 
         assertEquals( 1, controls.size() );
 
-        Control control = controls.get( "2.16.840.1.113730.3.4.2" );
+        ICodecControl<Control> control = ( ICodecControl<Control> )controls.get(
"2.16.840.1.113730.3.4.2" );
         assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
         assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
 
@@ -240,7 +246,8 @@ public class ModifyDNResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<ModifyDnResponseDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<ModifyDnResponseDecorator>( codec );
 
         // Decode a ModifyDNResponse message
         try



Mime
View raw message