directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1065021 - /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
Date Sat, 29 Jan 2011 14:37:26 GMT
Author: akarasulu
Date: Sat Jan 29 14:37:26 2011
New Revision: 1065021

URL: http://svn.apache.org/viewvc?rev=1065021&view=rev
Log:
fixing tests

Modified:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java?rev=1065021&r1=1065020&r2=1065021&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
Sat Jan 29 14:37:26 2011
@@ -34,7 +34,10 @@ import org.apache.directory.shared.asn1.
 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.decorators.AddResponseDecorator;
+import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.model.message.AddResponse;
+import org.apache.directory.shared.ldap.model.message.Message;
 import org.apache.directory.shared.ldap.model.message.Referral;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.util.Strings;
@@ -54,6 +57,8 @@ public class LdapResultTest
 {
     /** The encoder instance */
     LdapEncoder encoder = new LdapEncoder();
+    
+    ILdapCodecService codec = new DefaultLdapCodecService();
 
 
     // ~ Methods
@@ -79,7 +84,7 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<?
extends Message>>( codec );
 
         // Decode a AddResponse message
         try
@@ -116,7 +121,7 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<?
extends Message>>( codec );
 
         // Decode a AddResponse message
         try
@@ -159,7 +164,7 @@ public class LdapResultTest
             stream.flip();
 
             // Allocate a LdapMessage Container
-            Asn1Container ldapMessageContainer = new LdapMessageContainer();
+            Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<?
extends Message>>( codec );
 
             // Decode a AddResponse PDU
             try
@@ -198,7 +203,7 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<?
extends Message>>( codec );
 
         // Decode a AddResponse message
         try
@@ -236,7 +241,7 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<?
extends Message>>( codec );
 
         // Decode a AddResponse message
         try
@@ -276,12 +281,13 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<AddResponseDecorator> container = 
+            new LdapMessageContainer<AddResponseDecorator>( codec );
 
         // Decode the AddResponse PDU
         try
         {
-            ldapDecoder.decode( stream, ldapMessageContainer );
+            ldapDecoder.decode( stream, container );
         }
         catch ( DecoderException de )
         {
@@ -290,7 +296,7 @@ public class LdapResultTest
         }
 
         // Check the decoded AddResponse
-        AddResponse addResponse = ( ( LdapMessageContainer ) ldapMessageContainer ).getAddResponse();
+        AddResponse addResponse = container.getMessage();
 
         assertEquals( 1, addResponse.getMessageId() );
         assertEquals( ResultCodeEnum.SUCCESS, addResponse.getLdapResult().getResultCode()
);
@@ -339,12 +345,12 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<AddResponseDecorator> container = new LdapMessageContainer<AddResponseDecorator>(
codec );
 
         // Decode the AddResponse PDU
         try
         {
-            ldapDecoder.decode( stream, ldapMessageContainer );
+            ldapDecoder.decode( stream, container );
         }
         catch ( DecoderException de )
         {
@@ -353,7 +359,7 @@ public class LdapResultTest
         }
 
         // Check the decoded AddResponse
-        AddResponse addResponse = ( ( LdapMessageContainer ) ldapMessageContainer ).getAddResponse();
+        AddResponse addResponse = container.getMessage();
 
         assertEquals( 1, addResponse.getMessageId() );
         assertEquals( ResultCodeEnum.REFERRAL, addResponse.getLdapResult().getResultCode()
);
@@ -417,12 +423,12 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<AddResponseDecorator> container = new LdapMessageContainer<AddResponseDecorator>(
codec );
 
         // Decode the AddResponse PDU
         try
         {
-            ldapDecoder.decode( stream, ldapMessageContainer );
+            ldapDecoder.decode( stream, container );
         }
         catch ( DecoderException de )
         {
@@ -431,7 +437,7 @@ public class LdapResultTest
         }
 
         // Check the decoded AddResponse
-        AddResponse addResponse = ( ( LdapMessageContainer ) ldapMessageContainer ).getAddResponse();
+        AddResponse addResponse = container.getMessage();
 
         assertEquals( 1, addResponse.getMessageId() );
         assertEquals( ResultCodeEnum.REFERRAL, addResponse.getLdapResult().getResultCode()
);
@@ -494,12 +500,12 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<AddResponseDecorator> container = new LdapMessageContainer<AddResponseDecorator>(
codec );
 
         // Decode the AddResponse PDU
         try
         {
-            ldapDecoder.decode( stream, ldapMessageContainer );
+            ldapDecoder.decode( stream, container );
         }
         catch ( DecoderException de )
         {
@@ -508,7 +514,7 @@ public class LdapResultTest
         }
 
         // Check the decoded AddResponse
-        AddResponse addResponse = ( ( LdapMessageContainer ) ldapMessageContainer ).getAddResponse();
+        AddResponse addResponse = container.getMessage();
 
         assertEquals( 1, addResponse.getMessageId() );
         assertEquals( ResultCodeEnum.REFERRAL, addResponse.getLdapResult().getResultCode()
);
@@ -575,12 +581,13 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<MessageDecorator<? extends Message>> container =

+            new LdapMessageContainer<MessageDecorator<? extends Message>>( codec
);
 
         // Decode the AddResponse PDU
         try
         {
-            ldapDecoder.decode( stream, ldapMessageContainer );
+            ldapDecoder.decode( stream, container );
         }
         catch ( DecoderException de )
         {



Mime
View raw message