directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1065043 - in /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search: SearchRequestTest.java SearchResultDoneTest.java SearchResultEntryTest.java SearchResultReferenceTest.java
Date Sat, 29 Jan 2011 15:45:31 GMT
Author: elecharny
Date: Sat Jan 29 15:45:31 2011
New Revision: 1065043

URL: http://svn.apache.org/viewvc?rev=1065043&view=rev
Log:
SearchRequest and result

Modified:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultDoneTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java?rev=1065043&r1=1065042&r2=1065043&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java Sat Jan 29 15:45:31 2011
@@ -36,13 +36,14 @@ 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.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
+import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
+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.controls.Subentries;
+import org.apache.directory.shared.ldap.codec.decorators.SearchRequestDecorator;
 import org.apache.directory.shared.ldap.codec.search.controls.subentries.SubentriesDecorator;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.filter.AndNode;
@@ -62,6 +63,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.message.SearchRequest;
 import org.apache.directory.shared.ldap.model.message.SearchResultDoneImpl;
+import org.apache.directory.shared.ldap.model.message.controls.Subentries;
 import org.apache.directory.shared.ldap.model.schema.normalizers.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.model.schema.normalizers.OidNormalizer;
 import org.apache.directory.shared.util.Strings;
@@ -82,6 +84,10 @@ public class SearchRequestTest
     /** The encoder instance */
     LdapEncoder encoder = new LdapEncoder();
 
+    /** The codec service */
+    ILdapCodecService codec = new DefaultLdapCodecService();
+
+    /** An oid normalizer map */
     static Map<String, OidNormalizer> oids = new HashMap<String, OidNormalizer>();
 
 
@@ -181,7 +187,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -195,7 +202,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString() );
@@ -340,7 +347,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -354,7 +362,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString() );
@@ -507,7 +515,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -521,7 +530,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString() );
@@ -650,7 +659,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -664,7 +674,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 3, searchRequest.getMessageId() );
         assertEquals( "ou=users,ou=system", searchRequest.getBase().toString() );
@@ -755,7 +765,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -769,7 +780,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 3, searchRequest.getMessageId() );
         assertEquals( "ou=users,ou=system", searchRequest.getBase().toString() );
@@ -842,7 +853,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -856,7 +868,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 3, searchRequest.getMessageId() );
         assertEquals( "ou=users,ou=system", searchRequest.getBase().toString() );
@@ -931,7 +943,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -945,7 +958,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 33, searchRequest.getMessageId() );
         assertEquals( "dc=example,dc=com", searchRequest.getBase().toString() );
@@ -1103,7 +1116,8 @@ public class SearchRequestTest
         streamJava5.put( asn1BERJava5 );
         String decodedPduJava5 = Strings.dumpBytes(streamJava5.array());
 
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -1117,7 +1131,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 4, searchRequest.getMessageId() );
         assertEquals( 2, searchRequest.getControls().size() );
@@ -1281,7 +1295,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -1295,7 +1310,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString() );
@@ -1399,7 +1414,8 @@ public class SearchRequestTest
         String decodedPdu = Strings.dumpBytes(stream.array());
         stream.flip();
 
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -1413,7 +1429,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 4, searchRequest.getMessageId() );
         assertEquals( 1, searchRequest.getControls().size() );
@@ -1475,7 +1491,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -1509,7 +1526,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -1588,7 +1606,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -1602,7 +1621,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "", searchRequest.getBase().toString() );
@@ -1748,7 +1767,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -1789,7 +1809,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -1872,7 +1893,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -1909,7 +1931,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -1992,7 +2015,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -2029,7 +2053,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2112,7 +2137,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -2152,7 +2178,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2235,7 +2262,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -2275,7 +2303,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2316,7 +2345,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2357,7 +2387,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2398,7 +2429,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2439,7 +2471,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2480,7 +2513,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2521,7 +2555,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2563,7 +2598,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2611,7 +2647,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2626,7 +2663,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 4, searchRequest.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString() );
@@ -2701,7 +2738,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2716,7 +2754,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 4, searchRequest.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString() );
@@ -2791,7 +2829,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2806,7 +2845,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 4, searchRequest.getMessageId() );
         assertEquals( "uid=akarasulu,dc=example,dc=com", searchRequest.getBase().toString() );
@@ -2859,7 +2898,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2905,7 +2945,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2951,7 +2992,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -2998,7 +3040,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -3038,7 +3081,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         // Decode a SearchRequest message
         try
@@ -3053,7 +3097,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 2, searchRequest.getMessageId() );
         assertEquals( "dc=pgpkeys", searchRequest.getBase().toString() );
@@ -3151,7 +3195,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -3165,7 +3210,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -3252,7 +3297,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -3266,7 +3312,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -3366,7 +3412,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -3380,7 +3427,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -3481,7 +3528,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -3495,7 +3543,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -3602,7 +3650,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -3616,7 +3665,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -3729,7 +3778,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -3743,7 +3793,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -3860,7 +3910,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -3874,7 +3925,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -3999,7 +4050,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -4013,7 +4065,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -4134,7 +4186,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -4148,7 +4201,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -4273,7 +4326,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -4287,7 +4341,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -4414,7 +4468,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -4428,7 +4483,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "a=b", searchRequest.getBase().toString() );
@@ -4521,7 +4576,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -4535,7 +4591,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchRequest.getMessageId() );
         assertEquals( "", searchRequest.getBase().toString() );
@@ -4585,7 +4641,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -4599,7 +4656,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 3, searchRequest.getMessageId() );
         assertEquals( "ou=users,ou=system", searchRequest.getBase().toString() );
@@ -4641,7 +4698,7 @@ public class SearchRequestTest
      * (&(objectClass=person)(|(cn=Tori*)(sn=Jagger)))
      */
     @Test
-    public void testDecodeSearchRequestComplexFilter()
+    public void testDecodeSearchRequestComplexFilterWithControl()
     {
         Asn1Decoder ldapDecoder = new Asn1Decoder();
 
@@ -4695,7 +4752,8 @@ public class SearchRequestTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchRequestDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchRequestDecorator>( codec );
 
         try
         {
@@ -4709,7 +4767,7 @@ public class SearchRequestTest
 
         assertEquals( TLVStateEnum.PDU_DECODED, ldapMessageContainer.getState() );
 
-        SearchRequest searchRequest = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getMessage();
 
         assertEquals( 6, searchRequest.getMessageId() );
         assertEquals( "ou=system", searchRequest.getBase().toString() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultDoneTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultDoneTest.java?rev=1065043&r1=1065042&r2=1065043&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultDoneTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultDoneTest.java Sat Jan 29 15:45:31 2011
@@ -32,9 +32,12 @@ 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.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.SearchResultDoneDecorator;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.model.message.SearchResultDone;
@@ -55,6 +58,9 @@ public class SearchResultDoneTest
     /** The encoder instance */
     LdapEncoder encoder = new LdapEncoder();
 
+    /** The codec service */
+    ILdapCodecService codec = new DefaultLdapCodecService();
+
 
     /**
      * Test the decoding of a SearchResultDone
@@ -69,7 +75,7 @@ public class SearchResultDoneTest
         stream.put( new byte[]
             { 0x30, 0x0C, // LDAPMessage ::=SEQUENCE {
                 0x02, 0x01, 0x01, // messageID MessageID
-                0x65, 0x07, // CHOICE { ..., delResponse DelResponse, ...
+                0x65, 0x07, // CHOICE { ..., searchResDone SearchResultDone, ...
                 // SearchResultDone ::= [APPLICATION 5] LDAPResult
                 0x0A, 0x01, 0x00, // LDAPResult ::= SEQUENCE {
                 // resultCode ENUMERATED {
@@ -84,8 +90,9 @@ public class SearchResultDoneTest
         String decodedPdu = Strings.dumpBytes(stream.array());
         stream.flip();
 
-        // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        // Allocate a SearchResultDone Container
+        LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultDoneDecorator>( codec );
 
         try
         {
@@ -97,7 +104,7 @@ public class SearchResultDoneTest
             fail( de.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchResultDone();
+        SearchResultDone searchResultDone = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultDone.getMessageId() );
         assertEquals( ResultCodeEnum.SUCCESS, searchResultDone.getLdapResult().getResultCode() );
@@ -140,7 +147,7 @@ public class SearchResultDoneTest
                 0x02, 0x01,
                 0x01, // messageID MessageID
                 0x65,
-                0x07, // CHOICE { ..., delResponse DelResponse, ...
+                0x07, // CHOICE { ..., searchResDone SearchResultDone, ...
                 // SearchResultDone ::= [APPLICATION 5] LDAPResult
                 0x0A,
                 0x01,
@@ -165,7 +172,8 @@ public class SearchResultDoneTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultDoneDecorator>( codec );
 
         try
         {
@@ -177,7 +185,7 @@ public class SearchResultDoneTest
             fail( de.getMessage() );
         }
 
-        SearchResultDone searchResultDone = ( ( LdapMessageContainer ) ldapMessageContainer ).getSearchResultDone();
+        SearchResultDone searchResultDone = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultDone.getMessageId() );
         assertEquals( ResultCodeEnum.SUCCESS, searchResultDone.getLdapResult().getResultCode() );
@@ -189,7 +197,7 @@ public class SearchResultDoneTest
 
         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()) );
 
@@ -226,13 +234,14 @@ public class SearchResultDoneTest
         stream.put( new byte[]
             { 0x30, 0x05, // LDAPMessage ::=SEQUENCE {
                 0x02, 0x01, 0x01, // messageID MessageID
-                0x65, 0x00 // CHOICE { ..., delResponse DelResponse, ...
+                0x65, 0x00 // CHOICE { ..., searchResDone SearchResultDone, ...
             } );
 
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultDoneDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultDoneDecorator>( codec );
 
         // Decode a SearchResultDone message
         try

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java?rev=1065043&r1=1065042&r2=1065043&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java Sat Jan 29 15:45:31 2011
@@ -34,9 +34,12 @@ 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.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.SearchResultEntryDecorator;
 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.message.Control;
@@ -58,6 +61,9 @@ public class SearchResultEntryTest
     /** The encoder instance */
     LdapEncoder encoder = new LdapEncoder();
 
+    /** The codec service */
+    ILdapCodecService codec = new DefaultLdapCodecService();
+
 
     /**
      * Test the decoding of a SearchResultEntry
@@ -100,7 +106,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -112,8 +119,7 @@ public class SearchResultEntryTest
             fail( de.getMessage() );
         }
 
-        SearchResultEntry searchResultEntry = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultEntry.getMessageId() );
         assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName().toString() );
@@ -201,7 +207,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -213,8 +220,7 @@ public class SearchResultEntryTest
             fail( de.getMessage() );
         }
 
-        SearchResultEntry searchResultEntry = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultEntry.getMessageId() );
         assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName().toString() );
@@ -312,7 +318,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -324,8 +331,7 @@ public class SearchResultEntryTest
             fail( de.getMessage() );
         }
 
-        SearchResultEntry searchResultEntry = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getMessage();
 
         assertEquals( 2, searchResultEntry.getMessageId() );
         assertEquals( "uid=admin,ou=system", searchResultEntry.getObjectName().toString() );
@@ -399,7 +405,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -439,7 +446,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -484,7 +492,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -531,7 +540,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -543,8 +553,7 @@ public class SearchResultEntryTest
             fail( de.getMessage() );
         }
 
-        SearchResultEntry searchResultEntry = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultEntry.getMessageId() );
         assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName().toString() );
@@ -603,7 +612,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -655,7 +665,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -705,7 +716,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -755,7 +767,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -806,7 +819,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -818,8 +832,7 @@ public class SearchResultEntryTest
             fail( de.getMessage() );
         }
 
-        SearchResultEntry searchResultEntry = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultEntry.getMessageId() );
         assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName().toString() );
@@ -893,7 +906,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -905,8 +919,7 @@ public class SearchResultEntryTest
             fail( de.getMessage() );
         }
 
-        SearchResultEntry searchResultEntry = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultEntry.getMessageId() );
         assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName().toString() );
@@ -983,7 +996,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -995,8 +1009,7 @@ public class SearchResultEntryTest
             fail( de.getMessage() );
         }
 
-        SearchResultEntry searchResultEntry = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultEntry.getMessageId() );
         assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName().toString() );
@@ -1019,7 +1032,7 @@ public class SearchResultEntryTest
 
         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()) );
 
@@ -1080,7 +1093,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -1092,8 +1106,7 @@ public class SearchResultEntryTest
             fail( de.getMessage() );
         }
 
-        SearchResultEntry searchResultEntry = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultEntry.getMessageId() );
         assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName().toString() );
@@ -1174,7 +1187,8 @@ public class SearchResultEntryTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultEntryDecorator> ldapMessageContainer = 
+            new LdapMessageContainer<SearchResultEntryDecorator>( codec );
 
         try
         {
@@ -1186,8 +1200,7 @@ public class SearchResultEntryTest
             fail( de.getMessage() );
         }
 
-        SearchResultEntry searchResultEntry = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultEntry.getMessageId() );
         assertEquals( "ou=contacts,dc=iktek,dc=com", searchResultEntry.getObjectName().toString() );
@@ -1210,7 +1223,7 @@ public class SearchResultEntryTest
 
         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()) );
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java?rev=1065043&r1=1065042&r2=1065043&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java Sat Jan 29 15:45:31 2011
@@ -35,12 +35,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.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.SearchResultReferenceDecorator;
+import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.Referral;
 import org.apache.directory.shared.ldap.model.message.SearchResultReference;
-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;
@@ -58,6 +61,9 @@ public class SearchResultReferenceTest
     /** The encoder instance */
     LdapEncoder encoder = new LdapEncoder();
 
+    /** The codec service */
+    ILdapCodecService codec = new DefaultLdapCodecService();
+
 
     /**
      * Test the decoding of a SearchResultReference
@@ -114,7 +120,7 @@ public class SearchResultReferenceTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>( codec );
 
         try
         {
@@ -126,8 +132,7 @@ public class SearchResultReferenceTest
             fail( de.getMessage() );
         }
 
-        SearchResultReference searchResultReference = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultReference();
+        SearchResultReference searchResultReference = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultReference.getMessageId() );
 
@@ -242,11 +247,11 @@ public class SearchResultReferenceTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>( codec );
 
         try
         {
-            ( ( LdapMessageContainer ) ldapMessageContainer ).clean();
+            ldapMessageContainer.clean();
             ldapDecoder.decode( stream, ldapMessageContainer );
         }
         catch ( DecoderException de )
@@ -257,8 +262,7 @@ public class SearchResultReferenceTest
 
         stream.flip();
 
-        SearchResultReference searchResultReference = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultReference();
+        SearchResultReference searchResultReference = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultReference.getMessageId() );
 
@@ -292,7 +296,7 @@ public class SearchResultReferenceTest
 
         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()) );
 
@@ -339,7 +343,7 @@ public class SearchResultReferenceTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>( codec );
 
         // Decode a SearchResultReference message
         try
@@ -386,7 +390,7 @@ public class SearchResultReferenceTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        Asn1Container ldapMessageContainer = new LdapMessageContainer();
+        LdapMessageContainer<SearchResultReferenceDecorator> ldapMessageContainer = new LdapMessageContainer<SearchResultReferenceDecorator>( codec );
 
         try
         {
@@ -398,8 +402,7 @@ public class SearchResultReferenceTest
             fail( de.getMessage() );
         }
 
-        SearchResultReference searchResultReference = ( ( LdapMessageContainer ) ldapMessageContainer )
-            .getSearchResultReference();
+        SearchResultReference searchResultReference = ldapMessageContainer.getMessage();
 
         assertEquals( 1, searchResultReference.getMessageId() );
 



Mime
View raw message