directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1068929 [1/4] - in /directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec: ./ abandon/ add/ bind/ compare/ del/ extended/ intermediate/ modify/ modifyDn/ search/ search/controls/
Date Wed, 09 Feb 2011 15:10:53 GMT
Author: elecharny
Date: Wed Feb  9 15:10:51 2011
New Revision: 1068929

URL: http://svn.apache.org/viewvc?rev=1068929&view=rev
Log:
Fixed the issue we had in eclipse due to the codec service not being shutdowned when each tests was done

Added:
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/AbstractCodecServiceTest.java
Modified:
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapMessageTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareResponseTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelResponseTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/intermediate/IntermediateResponseTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyResponseTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequestTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNResponseTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestSubstringTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultDoneTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultReferenceTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java
    directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java

Added: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/AbstractCodecServiceTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/AbstractCodecServiceTest.java?rev=1068929&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/AbstractCodecServiceTest.java (added)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/AbstractCodecServiceTest.java Wed Feb  9 15:10:51 2011
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec;
+
+import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * Initialize the Codec service
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class AbstractCodecServiceTest
+{
+    /** The encoder instance */
+    protected static LdapEncoder encoder = new LdapEncoder();
+
+    protected static DefaultLdapCodecService codec;
+
+    /**
+     * Initialize the codec service
+     */
+    @BeforeClass
+    public static void setupLdapCodecService()
+    {
+        codec = new DefaultLdapCodecService();
+    }
+
+
+    /**
+     * Shutdown the codec service
+     */
+    @AfterClass
+    public static void tearDownLdapCodecService()
+    {
+        codec.shutdown();
+        codec = null;
+    }
+}

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec;
 
@@ -28,15 +28,11 @@ import static org.junit.Assert.fail;
 import java.nio.ByteBuffer;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 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.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.decorators.AbandonRequestDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.model.message.AbandonRequest;
@@ -47,16 +43,14 @@ import org.apache.directory.shared.util.
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class LdapControlTest
+public class LdapControlTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-    LdapCodecService codec = new DefaultLdapCodecService();
-
-
     /**
      * Test the decoding of a Request with controls
      */
@@ -94,7 +88,7 @@ public class LdapControlTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        LdapMessageContainer<AbandonRequestDecorator> ldapMessageContainer = 
+        LdapMessageContainer<AbandonRequestDecorator> ldapMessageContainer =
             new LdapMessageContainer<AbandonRequestDecorator>( codec );
 
         // Decode the PDU
@@ -125,25 +119,25 @@ public class LdapControlTest
 
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls.get( "1.3.6.1.5.5.1" );
         assertEquals( "1.3.6.1.5.5.1", control.getOid() );
-        assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
+        assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", Strings.dumpBytes( control.getValue() ) );
         assertTrue( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
         control = (org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls.get( "1.3.6.1.5.5.2" );
         assertEquals( "1.3.6.1.5.5.2", control.getOid() );
-        assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", Strings.dumpBytes((byte[]) control.getValue()) );
+        assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", Strings.dumpBytes(control.getValue()) );
         assertFalse( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
         control = (org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls.get( "1.3.6.1.5.5.3" );
         assertEquals( "1.3.6.1.5.5.3", control.getOid() );
-        assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
+        assertEquals( "", Strings.dumpBytes(control.getValue()) );
         assertTrue( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
         control = (org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls.get( "1.3.6.1.5.5.4" );
         assertEquals( "1.3.6.1.5.5.4", control.getOid() );
-        assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
+        assertEquals( "", Strings.dumpBytes(control.getValue()) );
         assertFalse( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
@@ -205,7 +199,7 @@ public class LdapControlTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        Asn1Container ldapMessageContainer = 
+        Asn1Container ldapMessageContainer =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode the PDU
@@ -249,7 +243,7 @@ public class LdapControlTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        Asn1Container ldapMessageContainer = 
+        Asn1Container ldapMessageContainer =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode the PDU
@@ -293,7 +287,7 @@ public class LdapControlTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        Asn1Container ldapMessageContainer = 
+        Asn1Container ldapMessageContainer =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode the PDU

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec;
 
@@ -29,14 +29,10 @@ import java.io.InputStream;
 import java.nio.ByteBuffer;
 import java.util.Queue;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 import org.apache.directory.shared.asn1.DecoderException;
 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.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.decorators.BindRequestDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.model.message.BindRequest;
@@ -51,31 +47,32 @@ import org.apache.mina.filter.codec.Prot
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * A global Ldap Decoder test
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class LdapDecoderTest
+public class LdapDecoderTest extends AbstractCodecServiceTest
 {
-    LdapCodecService codec = new DefaultLdapCodecService();
-    
-    private static class LdapProtocolDecoderOutput extends AbstractProtocolDecoderOutput 
+    private static class LdapProtocolDecoderOutput extends AbstractProtocolDecoderOutput
     {
         public LdapProtocolDecoderOutput()
         {
             // Do nothing
         }
-        
-        public void flush( NextFilter nextFilter, IoSession session ) 
+
+        public void flush( NextFilter nextFilter, IoSession session )
         {
             // Do nothing
             Queue<Object> messageQueue = getMessageQueue();
-            
-            while ( !messageQueue.isEmpty() ) 
+
+            while ( !messageQueue.isEmpty() )
             {
                 nextFilter.messageReceived( session, messageQueue.poll()) ;
             }
@@ -96,7 +93,7 @@ public class LdapDecoderTest
             }
         }
     }
-    
+
     /**
      * Test the decoding of a full PDU
      */
@@ -104,13 +101,13 @@ public class LdapDecoderTest
     public void testDecodeFull()
     {
         LdapDecoder ldapDecoder = new LdapDecoder();
-        LdapMessageContainer<MessageDecorator<? extends Message>> container = 
+        LdapMessageContainer<MessageDecorator<? extends Message>> container =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
         ldapDecoder.setLdapMessageContainer( container );
 
         ByteBuffer stream = ByteBuffer.allocate( 0x35 );
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x33,                     // LDAPMessage ::=SEQUENCE {
                     0x02, 0x01, 0x01,           // messageID MessageID
                   0x60, 0x2E,                   // CHOICE { ..., bindRequest BindRequest, ...
@@ -118,7 +115,7 @@ public class LdapDecoderTest
                     0x02, 0x01, 0x03,           // version INTEGER (1..127),
                     0x04, 0x1F,                 // name LDAPDN,
                       'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
-                      'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
+                      'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm',
                     ( byte ) 0x80, 0x08,        // authentication
                                                 // AuthenticationChoice
                                                 // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
@@ -160,7 +157,7 @@ public class LdapDecoderTest
     public void testDecode2Messages() throws Exception
     {
         LdapDecoder ldapDecoder = new LdapDecoder();
-        LdapMessageContainer<MessageDecorator<? extends Message>> container = 
+        LdapMessageContainer<MessageDecorator<? extends Message>> container =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
         ldapDecoder.setLdapMessageContainer( container );
 
@@ -169,7 +166,7 @@ public class LdapDecoderTest
 
         IoBuffer stream = IoBuffer.allocate( 0x6A );
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x33,                     // LDAPMessage ::=SEQUENCE {
                   0x02, 0x01, 0x01,             // messageID MessageID
                   0x60, 0x2E,                   // CHOICE { ..., bindRequest BindRequest, ...
@@ -177,7 +174,7 @@ public class LdapDecoderTest
                     0x02, 0x01, 0x03,           // version INTEGER (1..127),
                     0x04, 0x1F,                 // name LDAPDN,
                       'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
-                      'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
+                      'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm',
                     ( byte ) 0x80, 0x08,        // authentication
                                                 // AuthenticationChoice
                                                 // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
@@ -190,7 +187,7 @@ public class LdapDecoderTest
                     0x02, 0x01, 0x03,           // version INTEGER (1..127),
                     0x04, 0x1F,                 // name LDAPDN,
                       'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
-                      'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
+                      'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm',
                     ( byte ) 0x80, 0x08,        // authentication
                                                 // AuthenticationChoice
                                                 // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
@@ -221,7 +218,7 @@ public class LdapDecoderTest
         assertEquals( "uid=akarasulu,dc=example,dc=com", bindRequest.getName().toString() );
         assertTrue( bindRequest.isSimple() );
         assertEquals( "password", Strings.utf8ToString(bindRequest.getCredentials()) );
-        
+
         // The second message
         bindRequest = ( BindRequest ) ( ( LdapProtocolDecoderOutput ) result ).getMessage();
 
@@ -388,7 +385,7 @@ public class LdapDecoderTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer = 
+        LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode a BindRequest PDU
@@ -441,7 +438,7 @@ public class LdapDecoderTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        Asn1Container ldapMessageContainer = 
+        Asn1Container ldapMessageContainer =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode a BindRequest PDU
@@ -512,9 +509,9 @@ public class LdapDecoderTest
 
     /**
      * Test the decoding of a split Length.
-     * 
+     *
      * The length is 3 bytes long, but the PDU has been split
-     * just after the first byte 
+     * just after the first byte
      */
     @Test
     public void testDecodeSplittedLength()

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapMessageTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapMessageTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapMessageTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapMessageTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec;
 
@@ -26,14 +26,10 @@ import static org.junit.Assert.fail;
 
 import java.nio.ByteBuffer;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.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.EncoderException;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.UnbindRequestDecorator;
 import org.apache.directory.shared.ldap.model.message.Message;
@@ -43,25 +39,19 @@ import org.apache.directory.shared.util.
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * A global Ldap Decoder test
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class LdapMessageTest
+public class LdapMessageTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-    
-    LdapCodecService codec = new DefaultLdapCodecService();
-
-
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
     /**
      * Test the decoding of null length messageId
      */
@@ -305,7 +295,7 @@ public class LdapMessageTest
         stream.flip();
 
         // Allocate a BindRequest Container
-        LdapMessageContainer<UnbindRequestDecorator> container = 
+        LdapMessageContainer<UnbindRequestDecorator> container =
             new LdapMessageContainer<UnbindRequestDecorator>( codec );
 
         try

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/LdapResultTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec;
 
@@ -28,14 +28,10 @@ import static org.junit.Assert.fail;
 import java.nio.ByteBuffer;
 import java.util.Collection;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
-
 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.api.DefaultLdapCodecService;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 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;
@@ -43,46 +39,23 @@ import org.apache.directory.shared.ldap.
 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;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * A test for LdapResults. We will use a AddResponse message to test the
  * LdapResult part
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class LdapResultTest
+public class LdapResultTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    private static LdapEncoder encoder = new LdapEncoder();
-    
-    private static DefaultLdapCodecService codec = new DefaultLdapCodecService();
-    
-    
-    @BeforeClass
-    public static void setupLdapCodecService()
-    {
-        codec = new DefaultLdapCodecService();
-    }
-    
-    
-    @AfterClass
-    public static void tearDownLdapCodecService()
-    {
-        codec.shutdown();
-        codec = null;
-    }
-    
-
-    // ~ Methods
-    // ------------------------------------------------------------------------------------
-
     /**
      * Test the decoding of a AddResponse with no LdapResult
      */
@@ -300,7 +273,7 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<AddResponseDecorator> container = 
+        LdapMessageContainer<AddResponseDecorator> container =
             new LdapMessageContainer<AddResponseDecorator>( codec );
 
         // Decode the AddResponse PDU
@@ -600,7 +573,7 @@ public class LdapResultTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<MessageDecorator<? extends Message>> container = 
+        LdapMessageContainer<MessageDecorator<? extends Message>> container =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode the AddResponse PDU

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.abandon;
 
@@ -28,16 +28,12 @@ import static org.junit.Assert.fail;
 import java.nio.ByteBuffer;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 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.ldap.codec.LdapEncoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.decorators.AbandonRequestDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.model.message.AbandonRequest;
@@ -48,22 +44,19 @@ import org.apache.directory.shared.util.
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test an AbandonRequest
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class AbandonRequestTest
+public class AbandonRequestTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-    
-    LdapCodecService codec = new DefaultLdapCodecService();
-
-
     /**
      * Test the decoding of a AbandonRequest with controls
      */
@@ -85,17 +78,17 @@ public class AbandonRequestTest
                                 // criticality BOOLEAN DEFAULT FALSE,
                     0x01, 0x01, ( byte ) 0xFF,
                                 // controlValue OCTET STRING OPTIONAL }
-                    0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f', 
+                    0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f',
                   0x30, 0x17, // Control ::= SEQUENCE {
                               // controlType LDAPOID,
                     0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '2',
                                 // controlValue OCTET STRING OPTIONAL }
-                    0x04, 0x06, 'g', 'h', 'i', 'j', 'k', 'l', 
+                    0x04, 0x06, 'g', 'h', 'i', 'j', 'k', 'l',
                   0x30, 0x12, // Control ::= SEQUENCE {
                               // controlType LDAPOID,
                     0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '3',
                                 // criticality BOOLEAN DEFAULT FALSE }
-                    0x01, 0x01, ( byte ) 0xFF, 
+                    0x01, 0x01, ( byte ) 0xFF,
                   0x30, 0x0F, // Control ::= SEQUENCE {
                               // controlType LDAPOID}
                     0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '4' } );
@@ -103,7 +96,7 @@ public class AbandonRequestTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        LdapMessageContainer<AbandonRequestDecorator> ldapMessageContainer = 
+        LdapMessageContainer<AbandonRequestDecorator> ldapMessageContainer =
             new LdapMessageContainer<AbandonRequestDecorator>( codec );
 
         // Decode the PDU
@@ -134,25 +127,25 @@ public class AbandonRequestTest
 
         CodecControl<? extends Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<?> ) controls.get( "1.3.6.1.5.5.1" );
         assertEquals( "1.3.6.1.5.5.1", control.getOid() );
-        assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
+        assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", Strings.dumpBytes( control.getValue() ) );
         assertTrue( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
         control = (org.apache.directory.shared.ldap.codec.api.CodecControl<?> ) controls.get( "1.3.6.1.5.5.2" );
         assertEquals( "1.3.6.1.5.5.2", control.getOid() );
-        assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", Strings.dumpBytes( ( byte[] ) control.getValue() ) );
+        assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", Strings.dumpBytes( control.getValue() ) );
         assertFalse( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
         control = (org.apache.directory.shared.ldap.codec.api.CodecControl<?> ) controls.get( "1.3.6.1.5.5.3" );
         assertEquals( "1.3.6.1.5.5.3", control.getOid() );
-        assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
+        assertEquals( "", Strings.dumpBytes(control.getValue()) );
         assertTrue( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
         control = (org.apache.directory.shared.ldap.codec.api.CodecControl<?> ) controls.get( "1.3.6.1.5.5.4" );
         assertEquals( "1.3.6.1.5.5.4", control.getOid() );
-        assertEquals( "", Strings.dumpBytes((byte[]) control.getValue()) );
+        assertEquals( "", Strings.dumpBytes(control.getValue()) );
         assertFalse( control.isCritical() );
         internalAbandonRequest.addControl( control );
 
@@ -208,7 +201,7 @@ public class AbandonRequestTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        LdapMessageContainer<AbandonRequestDecorator> ldapMessageContainer = 
+        LdapMessageContainer<AbandonRequestDecorator> ldapMessageContainer =
             new LdapMessageContainer<AbandonRequestDecorator>( codec );
 
         // Decode the PDU
@@ -271,7 +264,7 @@ public class AbandonRequestTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer = 
+        LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode the PDU
@@ -308,7 +301,7 @@ public class AbandonRequestTest
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
-        LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer = 
+        LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode the PDU

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.add;
 
@@ -32,43 +32,41 @@ import java.util.Set;
 
 import javax.naming.NamingException;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 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.LdapEncoder;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.api.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.decorators.AddRequestDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 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.entry.Value;
-import org.apache.directory.shared.ldap.model.message.*;
+import org.apache.directory.shared.ldap.model.message.AddRequest;
+import org.apache.directory.shared.ldap.model.message.AddResponseImpl;
+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.ResultCodeEnum;
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test the AddRequest codec
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class AddRequestTest
+public class AddRequestTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-
-    LdapCodecService codec = new DefaultLdapCodecService();
-
     /**
      * Test the decoding of a AddRequest
      */
@@ -120,7 +118,7 @@ public class AddRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<AddRequestDecorator> container = 
+        LdapMessageContainer<AddRequestDecorator> container =
             new LdapMessageContainer<AddRequestDecorator>( codec );
 
         // Decode a AddRequest message
@@ -165,7 +163,7 @@ public class AddRequestTest
 
         assertTrue( expectedTypes.contains( attribute.getId().toLowerCase() ) );
 
-        Set<String> vals = ( Set<String> ) typesVals.get( attribute.getId().toLowerCase() );
+        Set<String> vals = typesVals.get( attribute.getId().toLowerCase() );
 
         for ( Value<?> value : attribute )
         {
@@ -178,7 +176,7 @@ public class AddRequestTest
 
         assertTrue( expectedTypes.contains( attribute.getId().toLowerCase() ) );
 
-        vals = ( Set<String> ) typesVals.get( attribute.getId().toLowerCase() );
+        vals = typesVals.get( attribute.getId().toLowerCase() );
 
         for ( Value<?> value : attribute )
         {
@@ -373,7 +371,7 @@ public class AddRequestTest
 
         // Allocate a LdapMessage Container
         Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
- 
+
         // Decode a AddRequest message
         try
         {
@@ -794,7 +792,7 @@ public class AddRequestTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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() ) );
+        assertEquals( "", Strings.dumpBytes( control.getValue() ) );
 
         // Check the encoding
         try

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.add;
 
@@ -27,17 +27,13 @@ import static org.junit.Assert.fail;
 import java.nio.ByteBuffer;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 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.LdapEncoder;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 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;
@@ -48,20 +44,17 @@ import org.apache.directory.shared.util.
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class AddResponseTest
+public class AddResponseTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-
-    LdapCodecService codec = new DefaultLdapCodecService();
-    
-
     /**
      * Test the decoding of a AddResponse
      */
@@ -206,7 +199,7 @@ public class AddResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<AddResponseDecorator> container 
+        LdapMessageContainer<AddResponseDecorator> container
             = new LdapMessageContainer<AddResponseDecorator>( codec );
 
         // Decode the AddResponse PDU
@@ -236,7 +229,7 @@ public class AddResponseTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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()) );
+        assertEquals( "", Strings.dumpBytes( control.getValue()) );
 
         try
         {

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.bind;
 
@@ -27,21 +27,16 @@ import static org.junit.Assert.fail;
 import java.nio.ByteBuffer;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+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.DecoderException;
-import org.apache.directory.shared.ldap.codec.LdapEncoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.decorators.BindRequestDecorator;
 import org.apache.directory.shared.ldap.model.message.BindRequest;
 import org.apache.directory.shared.ldap.model.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.model.message.Control;
-import org.apache.directory.shared.ldap.model.message.controls.AbstractControl;
 import org.apache.directory.shared.ldap.model.message.controls.OpaqueControl;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.util.Strings;
@@ -49,19 +44,17 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class BindRequestPerfTest
+public class BindRequestPerfTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-
-    LdapCodecService codec = new DefaultLdapCodecService();
-
     /**
      * Test the decoding of a BindRequest with Simple authentication and no
      * controls
@@ -147,7 +140,7 @@ public class BindRequestPerfTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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() ) );
+        assertEquals( "", Strings.dumpBytes( control.getValue() ) );
 
         // Check the encoding
         try

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.bind;
 
@@ -28,17 +28,13 @@ import static org.junit.Assert.fail;
 import java.nio.ByteBuffer;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.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.ldap.codec.LdapEncoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.api.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.decorators.BindRequestDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
@@ -51,19 +47,17 @@ import org.apache.directory.shared.util.
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class BindRequestTest
+public class BindRequestTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-
-    LdapCodecService codec = new DefaultLdapCodecService();
-
     /**
      * Test the decoding of a BindRequest with Simple authentication and no
      * controls
@@ -76,7 +70,7 @@ public class BindRequestTest
 
         ByteBuffer stream = ByteBuffer.allocate( 0x52 );
         stream.put( new byte[]
-             { 
+             {
              0x30, 0x50,                 // LDAPMessage ::=SEQUENCE {
                0x02, 0x01, 0x01,         // messageID MessageID
                0x60, 0x2E,               // CHOICE { ..., bindRequest BindRequest, ...
@@ -84,16 +78,16 @@ public class BindRequestTest
                  0x02, 0x01, 0x03,       // version INTEGER (1..127),
                  0x04, 0x1F,             // name LDAPDN,
                  'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a',
-                 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', 
+                 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm',
                  ( byte ) 0x80, 0x08,    // authentication AuthenticationChoice
                                          // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING,
                                          // ...
-                   'p', 'a', 's', 's', 'w', 'o', 'r', 'd', 
+                   'p', 'a', 's', 's', 'w', 'o', 'r', 'd',
                ( byte ) 0xA0, 0x1B, // A control
-                 0x30, 0x19, 
-                   0x04, 0x17, 
-                     0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31, 0x33, 0x37, 0x33, 
-                     0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 
+                 0x30, 0x19,
+                   0x04, 0x17,
+                     0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31, 0x33, 0x37, 0x33,
+                     0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32
              } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
@@ -114,7 +108,7 @@ public class BindRequestTest
             }
             long t1 = System.currentTimeMillis();
             System.out.println( "Delta = " + ( t1 - t0 ) );
-            
+
             ldapDecoder.decode( stream, container );
         }
         catch ( DecoderException de )
@@ -268,7 +262,7 @@ public class BindRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<MessageDecorator<? extends Message>> container = 
+        LdapMessageContainer<MessageDecorator<? extends Message>> container =
             new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
 
         // Decode the BindRequest PDU
@@ -510,7 +504,7 @@ public class BindRequestTest
                 0x04, 0x0B, 'K', 'E', 'R', 'B', 'E', 'R', 'O', 'S', '_', 'V', '4', ( byte ) 0x04, 0x06, // SaslCredentials ::= SEQUENCE {
                 // ...
                 // credentials OCTET STRING OPTIONAL }
-                // 
+                //
                 'a', 'b', 'c', 'd', 'e', 'f' } );
 
         String decodedPdu = Strings.dumpBytes(stream.array());
@@ -587,7 +581,7 @@ public class BindRequestTest
                 0x04, 0x0B, 'K', 'E', 'R', 'B', 'E', 'R', 'O', 'S', '_', 'V', '4', ( byte ) 0x04, 0x06, // SaslCredentials ::= SEQUENCE {
                 // ...
                 // credentials OCTET STRING OPTIONAL }
-                // 
+                //
                 'a', 'b', 'c', 'd', 'e', 'f' } );
 
         String decodedPdu = Strings.dumpBytes(stream.array());
@@ -1063,13 +1057,13 @@ public class BindRequestTest
 
         ByteBuffer stream = ByteBuffer.allocate( 0x11 );
         stream.put( new byte[]
-            { 
+            {
             0x30, 0x0F,                 // LDAPMessage ::=SEQUENCE {
               0x02, 0x01, 0x01,         // messageID MessageID
               0x60, 0x0A,               // CHOICE { ..., bindRequest BindRequest, ...
                 0x02, 0x01, 0x03,       // version INTEGER (1..127),
-                0x04, 0x00, 
-                ( byte ) 0xA3, 0x03, 
+                0x04, 0x00,
+                ( byte ) 0xA3, 0x03,
                   0x04, 0x01, (byte)0xFF
             } );
 
@@ -1218,7 +1212,7 @@ public class BindRequestTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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() ) );
+        assertEquals( "", Strings.dumpBytes( control.getValue() ) );
 
         // Check the encoding
         try
@@ -1298,7 +1292,7 @@ public class BindRequestTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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() ) );
+        assertEquals( "", Strings.dumpBytes( control.getValue() ) );
 
         // Check the encoding
         try
@@ -1329,17 +1323,17 @@ public class BindRequestTest
     {
         Dn name = new Dn( "uid=akarasulu,dc=example,dc=com" );
         long t0 = System.currentTimeMillis();
-        
+
         for ( int i = 0; i< 10000; i++)
         {
             // Check the decoded BindRequest
             LdapMessage message = new LdapMessage();
             message.setMessageId( 1 );
-            
+
             BindRequest br = new BindRequest();
             br.setMessageId( 1 );
             br.setName( name );
-            
+
             Control control = new Control();
             control.setControlType( "2.16.840.1.113730.3.4.2" );
 
@@ -1349,7 +1343,7 @@ public class BindRequestTest
             br.addControl( control );
             br.setAuthentication( authentication );
             message.setProtocolOP( br );
-    
+
             // Check the encoding
             try
             {

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.bind;
 
@@ -28,17 +28,13 @@ import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.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.ldap.codec.LdapEncoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.BindResponseDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
@@ -50,19 +46,17 @@ import org.apache.directory.shared.util.
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class BindResponseTest
+public class BindResponseTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-
-    LdapCodecService codec = new DefaultLdapCodecService();
-
     /**
      * Test the decoding of a BindResponse
      */
@@ -161,13 +155,13 @@ public class BindResponseTest
                 ( byte ) 0xa0, 0x2C,                    // controls
                   0x30, 0x2A,                           // The PagedSearchControl
                     0x04, 0x16,                         // Oid : 1.2.840.113556.1.4.319
-                      0x31, 0x2e, 0x32, 0x2e, 0x38, 0x34, 0x30, 0x2e, 
-                      0x31, 0x31, 0x33, 0x35, 0x35, 0x36, 0x2e, 0x31, 
-                      0x2e, 0x34, 0x2e, 0x33, 0x31, 0x39, 
+                      0x31, 0x2e, 0x32, 0x2e, 0x38, 0x34, 0x30, 0x2e,
+                      0x31, 0x31, 0x33, 0x35, 0x35, 0x36, 0x2e, 0x31,
+                      0x2e, 0x34, 0x2e, 0x33, 0x31, 0x39,
                     0x01, 0x01, ( byte ) 0xff,          // criticality: false
-                    0x04, 0x0D, 
-                      0x30, 0x0B, 
-                        0x02, 0x01, 0x05,               // Size = 5, cookie = "abcdef" 
+                    0x04, 0x0D,
+                      0x30, 0x0B,
+                        0x02, 0x01, 0x05,               // Size = 5, cookie = "abcdef"
                         0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f' } );
 
         String decodedPdu = Strings.dumpBytes(stream.array());
@@ -329,11 +323,11 @@ public class BindResponseTest
                   ( byte ) 0x87, 0x00, // serverSaslCreds [7] OCTET STRING
                 // OPTIONAL }
                 ( byte ) 0xA0, 0x1B, // A control
-                  0x30, 0x19, 
-                    0x04, 0x17, 
+                  0x30, 0x19,
+                    0x04, 0x17,
                       0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30,
-                      0x2E, 0x31, 0x2E, 0x31, 0x31, 0x33, 0x37, 0x33, 
-                      0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 
+                      0x2E, 0x31, 0x2E, 0x31, 0x31, 0x33, 0x37, 0x33,
+                      0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32
               } );
 
         String decodedPdu = Strings.dumpBytes(stream.array());
@@ -370,7 +364,7 @@ public class BindResponseTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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() ) );
+        assertEquals( "", Strings.dumpBytes( control.getValue() ) );
 
         // Check the encoding
         try
@@ -423,7 +417,7 @@ public class BindResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<BindResponseDecorator> container = 
+        LdapMessageContainer<BindResponseDecorator> container =
             new LdapMessageContainer<BindResponseDecorator>( codec );
 
         // Decode the BindResponse PDU

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.compare;
 
@@ -27,20 +27,16 @@ import static org.junit.Assert.fail;
 import java.nio.ByteBuffer;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 import org.apache.directory.shared.asn1.DecoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.model.message.CompareRequest;
-import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
-import org.apache.directory.shared.ldap.codec.LdapEncoder;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.api.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.decorators.CompareRequestDecorator;
+import org.apache.directory.shared.ldap.model.message.CompareRequest;
+import org.apache.directory.shared.ldap.model.message.CompareResponseImpl;
 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.ResultCodeEnum;
@@ -48,22 +44,19 @@ import org.apache.directory.shared.util.
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test the CompareRequest codec
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class CompareRequestTest
+public class CompareRequestTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-    
-    LdapCodecService codec = new DefaultLdapCodecService();
-
-
     /**
      * Test the decoding of a full CompareRequest
      */
@@ -96,7 +89,7 @@ public class CompareRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareRequestDecorator> container 
+        LdapMessageContainer<CompareRequestDecorator> container
             = new LdapMessageContainer<CompareRequestDecorator>( codec );
 
         // Decode the CompareRequest PDU
@@ -158,7 +151,7 @@ public class CompareRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareRequestDecorator> container 
+        LdapMessageContainer<CompareRequestDecorator> container
         = new LdapMessageContainer<CompareRequestDecorator>( codec );
 
         // Decode the CompareRequest PDU
@@ -200,7 +193,7 @@ public class CompareRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareRequestDecorator> container 
+        LdapMessageContainer<CompareRequestDecorator> container
             = new LdapMessageContainer<CompareRequestDecorator>( codec );
 
         // Decode the CompareRequest PDU
@@ -244,7 +237,7 @@ public class CompareRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareRequestDecorator> container 
+        LdapMessageContainer<CompareRequestDecorator> container
             = new LdapMessageContainer<CompareRequestDecorator>( codec );
 
         // Decode the CompareRequest PDU
@@ -288,7 +281,7 @@ public class CompareRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareRequestDecorator> container 
+        LdapMessageContainer<CompareRequestDecorator> container
             = new LdapMessageContainer<CompareRequestDecorator>( codec );
 
         // Decode the CompareRequest PDU
@@ -337,7 +330,7 @@ public class CompareRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareRequestDecorator> container 
+        LdapMessageContainer<CompareRequestDecorator> container
             = new LdapMessageContainer<CompareRequestDecorator>( codec );
 
         // Decode the CompareRequest PDU
@@ -390,7 +383,7 @@ public class CompareRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareRequestDecorator> container 
+        LdapMessageContainer<CompareRequestDecorator> container
             = new LdapMessageContainer<CompareRequestDecorator>( codec );
 
         // Decode the CompareRequest PDU
@@ -470,7 +463,7 @@ public class CompareRequestTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareRequestDecorator> container 
+        LdapMessageContainer<CompareRequestDecorator> container
             = new LdapMessageContainer<CompareRequestDecorator>( codec );
 
         // Decode the CompareRequest PDU
@@ -500,7 +493,7 @@ public class CompareRequestTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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() ) );
+        assertEquals( "", Strings.dumpBytes( control.getValue() ) );
 
         // Check the encoding
         try

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareResponseTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareResponseTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareResponseTest.java Wed Feb  9 15:10:51 2011
@@ -6,37 +6,33 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.compare;
 
 
-import static org.junit.Assert.assertEquals; 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.nio.ByteBuffer;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 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.ldap.codec.LdapEncoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.decorators.CompareResponseDecorator;
 import org.apache.directory.shared.ldap.model.message.CompareResponse;
 import org.apache.directory.shared.ldap.model.message.Control;
@@ -45,21 +41,19 @@ import org.apache.directory.shared.util.
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test the CompareResponse codec
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class CompareResponseTest
+public class CompareResponseTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-
-    LdapCodecService codec = new DefaultLdapCodecService();
-
     /**
      * Test the decoding of a CompareResponse
      */
@@ -90,7 +84,7 @@ public class CompareResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareResponseDecorator> container = 
+        LdapMessageContainer<CompareResponseDecorator> container =
             new LdapMessageContainer<CompareResponseDecorator>( codec );
 
         // Decode the CompareResponse PDU
@@ -173,7 +167,7 @@ public class CompareResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareResponseDecorator> container = 
+        LdapMessageContainer<CompareResponseDecorator> container =
             new LdapMessageContainer<CompareResponseDecorator>( codec );
 
         // Decode the CompareResponse PDU
@@ -203,7 +197,7 @@ public class CompareResponseTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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() ) );
+        assertEquals( "", Strings.dumpBytes( control.getValue() ) );
 
         // Check the encoding
         try
@@ -245,7 +239,7 @@ public class CompareResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<CompareResponseDecorator> container = 
+        LdapMessageContainer<CompareResponseDecorator> container =
             new LdapMessageContainer<CompareResponseDecorator>( codec );
 
         // Decode a CompareResponse message

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.del;
 
@@ -27,39 +27,37 @@ import static org.junit.Assert.fail;
 import java.nio.ByteBuffer;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 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.ldap.codec.LdapEncoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.api.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.decorators.DeleteRequestDecorator;
-import org.apache.directory.shared.ldap.model.message.*;
+import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.directory.shared.ldap.model.message.DeleteRequest;
+import org.apache.directory.shared.ldap.model.message.DeleteRequestImpl;
+import org.apache.directory.shared.ldap.model.message.DeleteResponseImpl;
+import org.apache.directory.shared.ldap.model.message.Message;
+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;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test the DelRequest codec
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class DelRequestTest
+public class DelRequestTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-
-    LdapCodecService codec = new DefaultLdapCodecService();
-    
-
     /**
      * Test the decoding of a full DelRequest
      */
@@ -265,7 +263,7 @@ public class DelRequestTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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() ) );
+        assertEquals( "", Strings.dumpBytes( control.getValue() ) );
 
         DeleteRequest internalDeleteRequest = new DeleteRequestImpl( delRequest.getMessageId() );
         internalDeleteRequest.setName( delRequest.getName() );

Modified: directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelResponseTest.java?rev=1068929&r1=1068928&r2=1068929&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelResponseTest.java (original)
+++ directory/shared/branches/m1/ldap-codec/src/test/java/org/apache/directory/shared/ldap/codec/del/DelResponseTest.java Wed Feb  9 15:10:51 2011
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.shared.ldap.codec.del;
 
@@ -27,16 +27,12 @@ import static org.junit.Assert.fail;
 import java.nio.ByteBuffer;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 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.ldap.codec.LdapEncoder;
+import org.apache.directory.shared.ldap.codec.AbstractCodecServiceTest;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.CodecControl;
-import org.apache.directory.shared.ldap.codec.api.DefaultLdapCodecService;
-import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.codec.decorators.DeleteResponseDecorator;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.DeleteResponse;
@@ -45,21 +41,19 @@ import org.apache.directory.shared.util.
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test the DelResponse codec
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(ConcurrentJunitRunner.class)
 @Concurrency()
-public class DelResponseTest
+public class DelResponseTest extends AbstractCodecServiceTest
 {
-    /** The encoder instance */
-    LdapEncoder encoder = new LdapEncoder();
-
-    LdapCodecService codec = new DefaultLdapCodecService();
-
     /**
      * Test the decoding of a DelResponse
      */
@@ -97,7 +91,7 @@ public class DelResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<DeleteResponseDecorator> container = 
+        LdapMessageContainer<DeleteResponseDecorator> container =
             new LdapMessageContainer<DeleteResponseDecorator>( codec );
 
         // Decode the DelResponse PDU
@@ -158,7 +152,7 @@ public class DelResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<DeleteResponseDecorator> container = 
+        LdapMessageContainer<DeleteResponseDecorator> container =
             new LdapMessageContainer<DeleteResponseDecorator>( codec );
 
 
@@ -205,10 +199,10 @@ public class DelResponseTest
                                           // referral [3] Referral OPTIONAL }
                                           // }
                     ( byte ) 0xA0, 0x1B,  // A control
-                      0x30, 0x19, 
-                        0x04, 0x17, 
-                          0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 
-                          0x2E, 0x31, 0x2E, 0x31, 0x31, 0x33, 0x37, 0x33, 
+                      0x30, 0x19,
+                        0x04, 0x17,
+                          0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30,
+                          0x2E, 0x31, 0x2E, 0x31, 0x31, 0x33, 0x37, 0x33,
                           0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32
 
             } );
@@ -217,7 +211,7 @@ public class DelResponseTest
         stream.flip();
 
         // Allocate a LdapMessage Container
-        LdapMessageContainer<DeleteResponseDecorator> container = 
+        LdapMessageContainer<DeleteResponseDecorator> container =
             new LdapMessageContainer<DeleteResponseDecorator>( codec );
 
         // Decode the DelResponse PDU
@@ -247,7 +241,7 @@ public class DelResponseTest
         @SuppressWarnings("unchecked")
         CodecControl<Control> control = (org.apache.directory.shared.ldap.codec.api.CodecControl<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() ) );
+        assertEquals( "", Strings.dumpBytes( control.getValue() ) );
 
         // Check the encoding
         try



Mime
View raw message