directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1235326 [17/28] - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-partitio...
Date Tue, 24 Jan 2012 16:15:29 GMT
Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfo2EntryDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfo2EntryDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfo2EntryDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfo2EntryDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -20,6 +20,7 @@
 
 package org.apache.directory.shared.kerberos.codec;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -37,6 +38,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 
+
 /**
  * Test cases for ETYPE-INFO2-ENTRY codec.
  *
@@ -51,25 +53,39 @@ public class ETypeInfo2EntryDecoderTest
     public void testDecodeETypeInfoEntry()
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x17 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x15,
-                  (byte)0xA0, 0x03,                     // etype
-                    0x02, 0x01, 0x05,
-                  (byte)0xA1, 0x06,                     // salt
-                    0x1B, 0x04, 'a', 'b', 'c', 'd',
-                  (byte)0xA2, 0x06,                     // s2kparams
-                    0x04, 0x04, 0x31, 0x32, 0x33, 0x34
-            } );
-        
-        String decodedPdu = Strings.dumpBytes(stream.array());
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x06, // salt
+                0x1B,
+                0x04,
+                'a',
+                'b',
+                'c',
+                'd',
+                ( byte ) 0xA2,
+                0x06, // s2kparams
+                0x04,
+                0x04,
+                0x31,
+                0x32,
+                0x33,
+                0x34
+        } );
+
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();
-        
+
         try
         {
             krbDecoder.decode( stream, container );
@@ -77,27 +93,27 @@ public class ETypeInfo2EntryDecoderTest
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            
+
             fail( de.getMessage() );
         }
 
         ETypeInfo2Entry etypeInfo2Entry = container.getETypeInfo2Entry();
-        
+
         assertEquals( EncryptionType.DES3_CBC_MD5, etypeInfo2Entry.getEType() );
         assertEquals( "abcd", etypeInfo2Entry.getSalt() );
-        assertTrue( Arrays.equals( Strings.getBytesUtf8("1234"), etypeInfo2Entry.getS2kparams() ) );
-        
+        assertTrue( Arrays.equals( Strings.getBytesUtf8( "1234" ), etypeInfo2Entry.getS2kparams() ) );
+
         ByteBuffer bb = ByteBuffer.allocate( etypeInfo2Entry.computeLength() );
-        
+
         try
         {
             bb = etypeInfo2Entry.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x17, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -105,8 +121,8 @@ public class ETypeInfo2EntryDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a ETYPE-INFO2-ENTRY with no salt nor s2kparams
      */
@@ -114,21 +130,23 @@ public class ETypeInfo2EntryDecoderTest
     public void testDecodeETypeInfo2EntryNoSaltNoS2KParams()
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x07 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x05,
-                  (byte)0xA0, 0x03,                 // etype
-                    0x02, 0x01, 0x05
-            } );
-        
-        String decodedPdu = Strings.dumpBytes(stream.array());
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x05
+        } );
+
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();
-        
+
         try
         {
             krbDecoder.decode( stream, container );
@@ -136,27 +154,27 @@ public class ETypeInfo2EntryDecoderTest
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            
+
             fail( de.getMessage() );
         }
 
         ETypeInfo2Entry etypeInfo2Entry = container.getETypeInfo2Entry();
-        
+
         assertEquals( EncryptionType.DES3_CBC_MD5, etypeInfo2Entry.getEType() );
         assertNull( etypeInfo2Entry.getSalt() );
         assertNull( etypeInfo2Entry.getS2kparams() );
-        
+
         ByteBuffer bb = ByteBuffer.allocate( etypeInfo2Entry.computeLength() );
-        
+
         try
         {
             bb = etypeInfo2Entry.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x07, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -164,35 +182,38 @@ public class ETypeInfo2EntryDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a ETYPE-INFO2-ENTRY with an empty salt
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeETypeInfo2EntryEmptySalt() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x09 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x07,
-                  (byte)0xA0, 0x03,                 // etype
-                    0x02, 0x01, 0x05,
-                  (byte)0xA1, 0x00                  // salt
-            } );
-        
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x00 // salt
+        } );
+
         stream.flip();
 
         ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a ETYPE-INFO2-ENTRY with an null salt
      */
@@ -200,22 +221,26 @@ public class ETypeInfo2EntryDecoderTest
     public void testDecodeETypeInfo2EntryNullSalt()
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x0B );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x09,
-                  (byte)0xA0, 0x03,                 // etype
-                    0x02, 0x01, 0x05,
-                  (byte)0xA1, 0x02,                 // salt
-                    0x1B, 0x00
-            } );
-        
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x02, // salt
+                0x1B,
+                0x00
+        } );
+
         stream.flip();
 
         ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();
-        
+
         try
         {
             krbDecoder.decode( stream, container );
@@ -223,37 +248,39 @@ public class ETypeInfo2EntryDecoderTest
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            
+
             fail( de.getMessage() );
         }
 
         ETypeInfo2Entry etypeInfo2Entry = container.getETypeInfo2Entry();
-        
+
         assertEquals( EncryptionType.DES3_CBC_MD5, etypeInfo2Entry.getEType() );
         assertNull( etypeInfo2Entry.getSalt() );
         assertNull( etypeInfo2Entry.getS2kparams() );
-        
+
         ByteBuffer bb = ByteBuffer.allocate( etypeInfo2Entry.computeLength() );
-        
+
         try
         {
             bb = etypeInfo2Entry.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x07, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             ByteBuffer stream2 = ByteBuffer.allocate( 0x07 );
 
             stream2.put( new byte[]
-                 { 
-                     0x30, 0x05,
-                       (byte)0xA0, 0x03,                 // etype
-                         0x02, 0x01, 0x05
-                 } );
-             
-            String decodedPdu2 = Strings.dumpBytes(stream2.array());
+                {
+                    0x30, 0x05,
+                    ( byte ) 0xA0, 0x03, // etype
+                    0x02,
+                    0x01,
+                    0x05
+            } );
+
+            String decodedPdu2 = Strings.dumpBytes( stream2.array() );
 
             assertEquals( encodedPdu, decodedPdu2 );
         }
@@ -263,112 +290,112 @@ public class ETypeInfo2EntryDecoderTest
         }
     }
 
-    
+
     /**
      * Test the decoding of an empty ETYPE-INFO2-ENTRY
      * @throws DecoderException
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeEmptyETypeInfo2Entry() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x00
-            } );
-        
+        } );
+
         stream.flip();
 
         ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
 
-    
+
     /**
      * Test the decoding of an ETYPE-INFO2-ENTRY with no etype
      * @throws DecoderException
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeEmptyETypeInfo2EntryNoEType() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x06 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x04,
-                  (byte)0xA2, 0x04,
-                    0x04, 0x00
-            } );
-        
+                ( byte ) 0xA2, 0x04,
+                0x04, 0x00
+        } );
+
         stream.flip();
 
         ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
 
-    
+
     /**
      * Test the decoding of an ETYPE-INFO2-ENTRY with an empty etype
      * @throws DecoderException
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeEmptyETypeInfo2EntryEmptyEType() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x06 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x04,
-                  (byte)0xA0, 0x00
-            } );
-        
+                ( byte ) 0xA0, 0x00
+        } );
+
         stream.flip();
 
         ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
 
-    
+
     /**
      * Test the decoding of an ETYPE-INFO2-ENTRY with a empty etype tag
      * @throws DecoderException
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeEmptyETypeInfo2EntryEmptyETypeTag() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x06 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x04,
-                  (byte)0xA0, 0x02,
-                    0x02, 0x00
-            } );
-        
+                ( byte ) 0xA0, 0x02,
+                0x02, 0x00
+        } );
+
         stream.flip();
 
         ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
 
-    
+
     /**
      * Test the decoding of an ETYPE-INFO2-ENTRY with a bad etype
      * @throws DecoderException
@@ -377,20 +404,20 @@ public class ETypeInfo2EntryDecoderTest
     public void testDecodeEmptyETypeInfo2EntryBadEType() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x07 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x05,
-                  (byte)0xA0, 0x03,
-                    0x02, 0x01, 0x40
-            } );
-        
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x40
+        } );
+
         stream.flip();
 
         ETypeInfo2EntryContainer container = new ETypeInfo2EntryContainer();
-        
+
         try
         {
             krbDecoder.decode( stream, container );
@@ -398,37 +425,39 @@ public class ETypeInfo2EntryDecoderTest
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            
+
             fail( de.getMessage() );
         }
 
         ETypeInfo2Entry etypeInfo2Entry = container.getETypeInfo2Entry();
-        
+
         assertEquals( EncryptionType.UNKNOWN, etypeInfo2Entry.getEType() );
         assertNull( etypeInfo2Entry.getSalt() );
         assertNull( etypeInfo2Entry.getS2kparams() );
-        
+
         ByteBuffer bb = ByteBuffer.allocate( etypeInfo2Entry.computeLength() );
-        
+
         try
         {
             bb = etypeInfo2Entry.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x07, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             ByteBuffer stream2 = ByteBuffer.allocate( 0x07 );
 
             stream2.put( new byte[]
-                 { 
-                     0x30, 0x05,
-                       (byte)0xA0, 0x03,                 // etype
-                         0x02, 0x01, (byte)0xFF
-                 } );
-             
-            String decodedPdu2 = Strings.dumpBytes(stream2.array());
+                {
+                    0x30, 0x05,
+                    ( byte ) 0xA0, 0x03, // etype
+                    0x02,
+                    0x01,
+                    ( byte ) 0xFF
+            } );
+
+            String decodedPdu2 = Strings.dumpBytes( stream2.array() );
             assertEquals( decodedPdu2, encodedPdu );
         }
         catch ( EncoderException ee )

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfoDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfoDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfoDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfoDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -60,23 +60,41 @@ public class ETypeInfoDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x20 );
-        
+
         stream.put( new byte[]
-            { 
-              0x30, 0x1E,
-                0x30, 0x0D,
-                  (byte)0xA0, 0x03,                 // etype
-                    0x02, 0x01, 0x05,
-                  (byte)0xA1, 0x06,                 // salt
-                    0x04, 0x04, 0x31, 0x32, 0x33, 0x34,
+            {
+                0x30, 0x1E,
                 0x30, 0x0D,
-                  (byte)0xA0, 0x03,                 // etype
-                    0x02, 0x01, 0x05,
-                  (byte)0xA1, 0x06,                 // salt
-                    0x04, 0x04, 0x35, 0x36, 0x37, 0x38
-            } );
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x06, // salt
+                0x04,
+                0x04,
+                0x31,
+                0x32,
+                0x33,
+                0x34,
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03, // etype
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x06, // salt
+                0x04,
+                0x04,
+                0x35,
+                0x36,
+                0x37,
+                0x38
+        } );
 
-        String decodedPdu = Strings.dumpBytes(stream.array());
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a ETypeInfo Container
@@ -97,29 +115,30 @@ public class ETypeInfoDecoderTest
         ETypeInfo etypeInfo = ( ( ETypeInfoContainer ) etypeInfoContainer ).getETypeInfo();
 
         assertEquals( 2, etypeInfo.getETypeInfoEntries().length );
-        
-        String[] expected = new String[]{ "1234", "5678" };
+
+        String[] expected = new String[]
+            { "1234", "5678" };
         int i = 0;
-        
+
         for ( ETypeInfoEntry etypeInfoEntry : etypeInfo.getETypeInfoEntries() )
         {
             assertEquals( EncryptionType.DES3_CBC_MD5, etypeInfoEntry.getEType() );
-            assertTrue( Arrays.equals( Strings.getBytesUtf8(expected[i]), etypeInfoEntry.getSalt() ) );
+            assertTrue( Arrays.equals( Strings.getBytesUtf8( expected[i] ), etypeInfoEntry.getSalt() ) );
             i++;
         }
 
         // Check the encoding
         ByteBuffer bb = ByteBuffer.allocate( etypeInfo.computeLength() );
-        
+
         try
         {
             bb = etypeInfo.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x20, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -127,18 +146,18 @@ public class ETypeInfoDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a ETypeInfo with nothing in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testETypeInfoEmpty() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x00 } );
 
@@ -151,23 +170,23 @@ public class ETypeInfoDecoderTest
         kerberosDecoder.decode( stream, etypeInfoContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a ETypeInfo with empty ETypeInfoEntry in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testETypeInfoNoETypeInfoEntry() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-        
+
         stream.put( new byte[]
-            { 
-              0x30, 0x02,
-                (byte)0x30, 0x00                  // empty ETypeInfoEntry
-            } );
+            {
+                0x30, 0x02,
+                ( byte ) 0x30, 0x00 // empty ETypeInfoEntry
+        } );
 
         stream.flip();
 

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfoEntryDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfoEntryDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfoEntryDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/ETypeInfoEntryDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -20,6 +20,7 @@
 
 package org.apache.directory.shared.kerberos.codec;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -37,6 +38,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 
+
 /**
  * Test cases for ETYPE-INFO-ENTRY codec.
  *
@@ -51,23 +53,31 @@ public class ETypeInfoEntryDecoderTest
     public void testDecodeETypeInfoEntry()
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x0F );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x0D,
-                  (byte)0xA0, 0x03,                 // etype
-                    0x02, 0x01, 0x05,
-                  (byte)0xA1, 0x06,                 // salt
-                    0x04, 0x04, 0x31, 0x32, 0x33, 0x34
-            } );
-        
-        String decodedPdu = Strings.dumpBytes(stream.array());
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x06, // salt
+                0x04,
+                0x04,
+                0x31,
+                0x32,
+                0x33,
+                0x34
+        } );
+
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         ETypeInfoEntryContainer container = new ETypeInfoEntryContainer();
-        
+
         try
         {
             krbDecoder.decode( stream, container );
@@ -75,26 +85,26 @@ public class ETypeInfoEntryDecoderTest
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            
+
             fail( de.getMessage() );
         }
 
         ETypeInfoEntry etypeInforEntry = container.getETypeInfoEntry();
-        
+
         assertEquals( EncryptionType.DES3_CBC_MD5, etypeInforEntry.getEType() );
-        assertTrue( Arrays.equals( Strings.getBytesUtf8("1234"), etypeInforEntry.getSalt() ) );
-        
+        assertTrue( Arrays.equals( Strings.getBytesUtf8( "1234" ), etypeInforEntry.getSalt() ) );
+
         ByteBuffer bb = ByteBuffer.allocate( etypeInforEntry.computeLength() );
-        
+
         try
         {
             bb = etypeInforEntry.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x0F, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -102,8 +112,8 @@ public class ETypeInfoEntryDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a ETYPE-INFO-ENTRY with no salt
      */
@@ -111,21 +121,23 @@ public class ETypeInfoEntryDecoderTest
     public void testDecodeETypeInfoEntryNoSalt()
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x07 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x05,
-                  (byte)0xA0, 0x03,                 // etype
-                    0x02, 0x01, 0x05
-            } );
-        
-        String decodedPdu = Strings.dumpBytes(stream.array());
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x05
+        } );
+
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         ETypeInfoEntryContainer container = new ETypeInfoEntryContainer();
-        
+
         try
         {
             krbDecoder.decode( stream, container );
@@ -133,26 +145,26 @@ public class ETypeInfoEntryDecoderTest
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            
+
             fail( de.getMessage() );
         }
 
         ETypeInfoEntry etypeInforEntry = container.getETypeInfoEntry();
-        
+
         assertEquals( EncryptionType.DES3_CBC_MD5, etypeInforEntry.getEType() );
         assertNull( etypeInforEntry.getSalt() );
-        
+
         ByteBuffer bb = ByteBuffer.allocate( etypeInforEntry.computeLength() );
-        
+
         try
         {
             bb = etypeInforEntry.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x07, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -160,35 +172,38 @@ public class ETypeInfoEntryDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a ETYPE-INFO-ENTRY with an empty salt
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeETypeInfoEntryEmptySalt() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x09 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x07,
-                  (byte)0xA0, 0x03,                 // etype
-                    0x02, 0x01, 0x05,
-                  (byte)0xA1, 0x00                  // salt
-            } );
-        
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x00 // salt
+        } );
+
         stream.flip();
 
         ETypeInfoEntryContainer container = new ETypeInfoEntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a ETYPE-INFO-ENTRY with an null salt
      */
@@ -196,22 +211,26 @@ public class ETypeInfoEntryDecoderTest
     public void testDecodeETypeInfoEntryNullSalt()
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x0B );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x09,
-                  (byte)0xA0, 0x03,                 // etype
-                    0x02, 0x01, 0x05,
-                  (byte)0xA1, 0x02,                 // salt
-                    0x04, 0x00
-            } );
-        
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x02, // salt
+                0x04,
+                0x00
+        } );
+
         stream.flip();
 
         ETypeInfoEntryContainer container = new ETypeInfoEntryContainer();
-        
+
         try
         {
             krbDecoder.decode( stream, container );
@@ -219,36 +238,38 @@ public class ETypeInfoEntryDecoderTest
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            
+
             fail( de.getMessage() );
         }
 
         ETypeInfoEntry etypeInforEntry = container.getETypeInfoEntry();
-        
+
         assertEquals( EncryptionType.DES3_CBC_MD5, etypeInforEntry.getEType() );
         assertNull( etypeInforEntry.getSalt() );
-        
+
         ByteBuffer bb = ByteBuffer.allocate( etypeInforEntry.computeLength() );
-        
+
         try
         {
             bb = etypeInforEntry.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x07, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             ByteBuffer stream2 = ByteBuffer.allocate( 0x07 );
 
             stream2.put( new byte[]
-                 { 
-                     0x30, 0x05,
-                       (byte)0xA0, 0x03,                 // etype
-                         0x02, 0x01, 0x05
-                 } );
-             
-            String decodedPdu2 = Strings.dumpBytes(stream2.array());
+                {
+                    0x30, 0x05,
+                    ( byte ) 0xA0, 0x03, // etype
+                    0x02,
+                    0x01,
+                    0x05
+            } );
+
+            String decodedPdu2 = Strings.dumpBytes( stream2.array() );
 
             assertEquals( encodedPdu, decodedPdu2 );
         }
@@ -258,112 +279,112 @@ public class ETypeInfoEntryDecoderTest
         }
     }
 
-    
+
     /**
      * Test the decoding of an empty ETYPE-INFO-ENTRY
      * @throws DecoderException
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeEmptyETypeInforEntry() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x00
-            } );
-        
+        } );
+
         stream.flip();
 
         ETypeInfoEntryContainer container = new ETypeInfoEntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
 
-    
+
     /**
      * Test the decoding of an ETYPE-INFO-ENTRY with no etype
      * @throws DecoderException
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeEmptyETypeInfoEntryNoEType() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x06 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x04,
-                  (byte)0xA2, 0x04,
-                    0x04, 0x00
-            } );
-        
+                ( byte ) 0xA2, 0x04,
+                0x04, 0x00
+        } );
+
         stream.flip();
 
         ETypeInfoEntryContainer container = new ETypeInfoEntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
 
-    
+
     /**
      * Test the decoding of an ETYPE-INFO-ENTRY with an empty etype
      * @throws org.apache.directory.shared.asn1.DecoderException
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeEmptyETypeInfoEntryEmptyEType() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x06 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x04,
-                  (byte)0xA0, 0x00
-            } );
-        
+                ( byte ) 0xA0, 0x00
+        } );
+
         stream.flip();
 
         ETypeInfoEntryContainer container = new ETypeInfoEntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
 
-    
+
     /**
      * Test the decoding of an ETYPE-INFO-ENTRY with a empty etype tag
      * @throws DecoderException
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testDecodeEmptyETypeInfoEntryEmptyETypeTag() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x06 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x04,
-                  (byte)0xA0, 0x02,
-                    0x02, 0x00
-            } );
-        
+                ( byte ) 0xA0, 0x02,
+                0x02, 0x00
+        } );
+
         stream.flip();
 
         ETypeInfoEntryContainer container = new ETypeInfoEntryContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
 
-    
+
     /**
      * Test the decoding of an ETYPE-INFO-ENTRY with a bad etype
      * @throws DecoderException
@@ -372,20 +393,20 @@ public class ETypeInfoEntryDecoderTest
     public void testDecodeEmptyETypeInfoEntryBadEType() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x07 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x05,
-                  (byte)0xA0, 0x03,
-                    0x02, 0x01, 0x40
-            } );
-        
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x40
+        } );
+
         stream.flip();
 
         ETypeInfoEntryContainer container = new ETypeInfoEntryContainer();
-        
+
         try
         {
             krbDecoder.decode( stream, container );
@@ -393,36 +414,38 @@ public class ETypeInfoEntryDecoderTest
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            
+
             fail( de.getMessage() );
         }
 
         ETypeInfoEntry etypeInforEntry = container.getETypeInfoEntry();
-        
+
         assertEquals( EncryptionType.UNKNOWN, etypeInforEntry.getEType() );
         assertNull( etypeInforEntry.getSalt() );
-        
+
         ByteBuffer bb = ByteBuffer.allocate( etypeInforEntry.computeLength() );
-        
+
         try
         {
             bb = etypeInforEntry.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x07, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             ByteBuffer stream2 = ByteBuffer.allocate( 0x07 );
 
             stream2.put( new byte[]
-                 { 
-                     0x30, 0x05,
-                       (byte)0xA0, 0x03,                 // etype
-                         0x02, 0x01, (byte)0xFF
-                 } );
-             
-            String decodedPdu2 = Strings.dumpBytes(stream2.array());
+                {
+                    0x30, 0x05,
+                    ( byte ) 0xA0, 0x03, // etype
+                    0x02,
+                    0x01,
+                    ( byte ) 0xFF
+            } );
+
+            String decodedPdu2 = Strings.dumpBytes( stream2.array() );
             assertEquals( decodedPdu2, encodedPdu );
         }
         catch ( EncoderException ee )

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncApRepPartDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncApRepPartDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncApRepPartDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncApRepPartDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -55,33 +55,65 @@ public class EncApRepPartDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x33 );
-        
+
         stream.put( new byte[]
-        {
-          0x7B, 0x31,
-            0x30, 0x2F,
-              (byte)0xA0, 0x11,         // ctime 
-                0x18, 0x0F, 
-                  '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
-              (byte)0xA1, 0x03,         // cusec
-                0x02, 0x01, 0x7F, 
-              (byte)0xA2, 0x0F,         // subkey
-                0x30, 0x0D,
-                  (byte)0xA0, 0x03,
-                    0x02, 0x01, 0x01,
-                  (byte)0xA1, 0x06,
-                    0x04, 0x04, 'A', 'B', 'C', 'D',
-              (byte)0xA3, 0x04,         // seq-number
-                0x02, 0x02, 
-                  0x30, 0x39, 
-        });
+            {
+                0x7B, 0x31,
+                0x30, 0x2F,
+                ( byte ) 0xA0, 0x11, // ctime 
+                0x18,
+                0x0F,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '0',
+                '1',
+                '5',
+                '4',
+                '5',
+                '2',
+                '5',
+                'Z',
+                ( byte ) 0xA1,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x7F,
+                ( byte ) 0xA2,
+                0x0F, // subkey
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                'A',
+                'B',
+                'C',
+                'D',
+                ( byte ) 0xA3,
+                0x04, // seq-number
+                0x02,
+                0x02,
+                0x30,
+                0x39,
+        } );
 
-        String decodedPdu = Strings.dumpBytes(stream.array());
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a EncApRepPart Container
         Asn1Container encApRepPartContainer = new EncApRepPartContainer( stream );
-        
+
         // Decode the EncApRepPart PDU
         try
         {
@@ -92,42 +124,42 @@ public class EncApRepPartDecoderTest
             fail( de.getMessage() );
         }
 
-        EncApRepPart encApRepPart = ((EncApRepPartContainer)encApRepPartContainer).getEncApRepPart();
-        
+        EncApRepPart encApRepPart = ( ( EncApRepPartContainer ) encApRepPartContainer ).getEncApRepPart();
+
         // Check the encoding
         int length = encApRepPart.computeLength();
 
         // Check the length
         assertEquals( 0x33, length );
-        
+
         // Check the encoding
         ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-        
+
         try
         {
             encodedPdu = encApRepPart.encode( encodedPdu );
-            
+
             // Check the length
             assertEquals( 0x33, encodedPdu.limit() );
-            assertEquals( decodedPdu, Strings.dumpBytes(encodedPdu.array()) );
+            assertEquals( decodedPdu, Strings.dumpBytes( encodedPdu.array() ) );
         }
         catch ( EncoderException ee )
         {
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncApRepPart with nothing in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testAuthenticatorEmpty() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-        
+
         stream.put( new byte[]
             { 0x7B, 0x00 } );
 
@@ -140,23 +172,23 @@ public class EncApRepPartDecoderTest
         kerberosDecoder.decode( stream, encApRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncApRepPart with empty sequence
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncApRepPartEmptySequence() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-        
+
         stream.put( new byte[]
-            { 
+            {
                 0x7B, 0x02,
-                  0x30, 0x00
-            } );
+                0x30, 0x00
+        } );
 
         stream.flip();
 
@@ -167,24 +199,24 @@ public class EncApRepPartDecoderTest
         kerberosDecoder.decode( stream, encApRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncApRepPart with empty ctime tag
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncApRepPartEmptyCTimeg() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x06 );
-        
+
         stream.put( new byte[]
-            { 
+            {
                 0x7B, 0x04,
-                  0x30, 0x02,
-                    (byte)0xA0, 0x00
-            } );
+                0x30, 0x02,
+                ( byte ) 0xA0, 0x00
+        } );
 
         stream.flip();
 
@@ -195,34 +227,50 @@ public class EncApRepPartDecoderTest
         kerberosDecoder.decode( stream, encApRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncApRepPart with no CTime
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncApRepPartNoCtime() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x20 );
-        
+
         stream.put( new byte[]
-            { 
-              0x7B, 0x1E,
+            {
+                0x7B, 0x1E,
                 0x30, 0x1C,
-                  (byte)0xA1, 0x03,         // cusec
-                    0x02, 0x01, 0x7F, 
-                  (byte)0xA2, 0x0F,         // subkey
-                    0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                        0x02, 0x01, 0x01,
-                      (byte)0xA1, 0x06,
-                        0x04, 0x04, 'A', 'B', 'C', 'D',
-                  (byte)0xA3, 0x04,         // seq-number
-                    0x02, 0x02, 
-                      0x30, 0x39, 
-            } );
+                ( byte ) 0xA1, 0x03, // cusec
+                0x02,
+                0x01,
+                0x7F,
+                ( byte ) 0xA2,
+                0x0F, // subkey
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                'A',
+                'B',
+                'C',
+                'D',
+                ( byte ) 0xA3,
+                0x04, // seq-number
+                0x02,
+                0x02,
+                0x30,
+                0x39,
+        } );
 
         stream.flip();
 
@@ -233,35 +281,64 @@ public class EncApRepPartDecoderTest
         kerberosDecoder.decode( stream, encApRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncApRepPart with no cusec
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncApRepPartNoCusec() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x2F );
-        
+
         stream.put( new byte[]
-            { 
-              0x7B, 0x2C,
+            {
+                0x7B, 0x2C,
                 0x30, 0x2A,
-                  (byte)0xA0, 0x11,         // ctime 
-                    0x18, 0x0F, 
-                      '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
-                  (byte)0xA2, 0x0F,         // subkey
-                    0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                        0x02, 0x01, 0x01,
-                      (byte)0xA1, 0x06,
-                        0x04, 0x04, 'A', 'B', 'C', 'D',
-                  (byte)0xA3, 0x04,         // seq-number
-                    0x02, 0x02, 
-                      0x30, 0x39, 
-            } );
+                ( byte ) 0xA0, 0x11, // ctime 
+                0x18,
+                0x0F,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '0',
+                '1',
+                '5',
+                '4',
+                '5',
+                '2',
+                '5',
+                'Z',
+                ( byte ) 0xA2,
+                0x0F, // subkey
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                'A',
+                'B',
+                'C',
+                'D',
+                ( byte ) 0xA3,
+                0x04, // seq-number
+                0x02,
+                0x02,
+                0x30,
+                0x39,
+        } );
 
         stream.flip();
 
@@ -283,27 +360,48 @@ public class EncApRepPartDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x22 );
-        
+
         stream.put( new byte[]
-        {
-          0x7B, 0x20,
-            0x30, 0x1E,
-              (byte)0xA0, 0x11,         // ctime 
-                0x18, 0x0F, 
-                  '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
-              (byte)0xA1, 0x03,         // cusec
-                0x02, 0x01, 0x7F, 
-              (byte)0xA3, 0x04,         // seq-number
-                0x02, 0x02, 
-                  0x30, 0x39, 
-        });
+            {
+                0x7B, 0x20,
+                0x30, 0x1E,
+                ( byte ) 0xA0, 0x11, // ctime 
+                0x18,
+                0x0F,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '0',
+                '1',
+                '5',
+                '4',
+                '5',
+                '2',
+                '5',
+                'Z',
+                ( byte ) 0xA1,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x7F,
+                ( byte ) 0xA3,
+                0x04, // seq-number
+                0x02,
+                0x02,
+                0x30,
+                0x39,
+        } );
 
-        String decodedPdu = Strings.dumpBytes(stream.array());
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a EncApRepPart Container
         Asn1Container encApRepPartContainer = new EncApRepPartContainer( stream );
-        
+
         // Decode the EncApRepPart PDU
         try
         {
@@ -314,32 +412,32 @@ public class EncApRepPartDecoderTest
             fail( de.getMessage() );
         }
 
-        EncApRepPart encApRepPart = ((EncApRepPartContainer)encApRepPartContainer).getEncApRepPart();
-        
+        EncApRepPart encApRepPart = ( ( EncApRepPartContainer ) encApRepPartContainer ).getEncApRepPart();
+
         // Check the encoding
         int length = encApRepPart.computeLength();
 
         // Check the length
         assertEquals( 0x22, length );
-        
+
         // Check the encoding
         ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-        
+
         try
         {
             encodedPdu = encApRepPart.encode( encodedPdu );
-            
+
             // Check the length
             assertEquals( 0x22, encodedPdu.limit() );
-            assertEquals( decodedPdu, Strings.dumpBytes(encodedPdu.array()) );
+            assertEquals( decodedPdu, Strings.dumpBytes( encodedPdu.array() ) );
         }
         catch ( EncoderException ee )
         {
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncApRepPart message with no seq-number
      */
@@ -349,30 +447,59 @@ public class EncApRepPartDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x2D );
-        
+
         stream.put( new byte[]
-        {
-          0x7B, 0x2B,
-            0x30, 0x29,
-              (byte)0xA0, 0x11,         // ctime 
-                0x18, 0x0F, 
-                  '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
-              (byte)0xA1, 0x03,         // cusec
-                0x02, 0x01, 0x7F, 
-              (byte)0xA2, 0x0F,         // subkey
-                0x30, 0x0D,
-                  (byte)0xA0, 0x03,
-                    0x02, 0x01, 0x01,
-                  (byte)0xA1, 0x06,
-                    0x04, 0x04, 'A', 'B', 'C', 'D',
-        });
+            {
+                0x7B, 0x2B,
+                0x30, 0x29,
+                ( byte ) 0xA0, 0x11, // ctime 
+                0x18,
+                0x0F,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '0',
+                '1',
+                '5',
+                '4',
+                '5',
+                '2',
+                '5',
+                'Z',
+                ( byte ) 0xA1,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x7F,
+                ( byte ) 0xA2,
+                0x0F, // subkey
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                'A',
+                'B',
+                'C',
+                'D',
+        } );
 
-        String decodedPdu = Strings.dumpBytes(stream.array());
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a EncApRepPart Container
         Asn1Container encApRepPartContainer = new EncApRepPartContainer( stream );
-        
+
         // Decode the EncApRepPart PDU
         try
         {
@@ -383,32 +510,32 @@ public class EncApRepPartDecoderTest
             fail( de.getMessage() );
         }
 
-        EncApRepPart encApRepPart = ((EncApRepPartContainer)encApRepPartContainer).getEncApRepPart();
-        
+        EncApRepPart encApRepPart = ( ( EncApRepPartContainer ) encApRepPartContainer ).getEncApRepPart();
+
         // Check the encoding
         int length = encApRepPart.computeLength();
 
         // Check the length
         assertEquals( 0x2D, length );
-        
+
         // Check the encoding
         ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-        
+
         try
         {
             encodedPdu = encApRepPart.encode( encodedPdu );
-            
+
             // Check the length
             assertEquals( 0x2D, encodedPdu.limit() );
-            assertEquals( decodedPdu, Strings.dumpBytes(encodedPdu.array()) );
+            assertEquals( decodedPdu, Strings.dumpBytes( encodedPdu.array() ) );
         }
         catch ( EncoderException ee )
         {
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncApRepPart message with no subKey nor seq-number
      */
@@ -418,24 +545,42 @@ public class EncApRepPartDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x1C );
-        
+
         stream.put( new byte[]
-        {
-          0x7B, 0x1A,
-            0x30, 0x18,
-              (byte)0xA0, 0x11,         // ctime 
-                0x18, 0x0F, 
-                  '2', '0', '1', '0', '1', '1', '1', '0', '1', '5', '4', '5', '2', '5', 'Z',
-              (byte)0xA1, 0x03,         // cusec
-                0x02, 0x01, 0x7F, 
-        });
+            {
+                0x7B, 0x1A,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x11, // ctime 
+                0x18,
+                0x0F,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '0',
+                '1',
+                '5',
+                '4',
+                '5',
+                '2',
+                '5',
+                'Z',
+                ( byte ) 0xA1,
+                0x03, // cusec
+                0x02,
+                0x01,
+                0x7F,
+        } );
 
-        String decodedPdu = Strings.dumpBytes(stream.array());
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a EncApRepPart Container
         Asn1Container encApRepPartContainer = new EncApRepPartContainer( stream );
-        
+
         // Decode the EncApRepPart PDU
         try
         {
@@ -446,24 +591,24 @@ public class EncApRepPartDecoderTest
             fail( de.getMessage() );
         }
 
-        EncApRepPart encApRepPart = ((EncApRepPartContainer)encApRepPartContainer).getEncApRepPart();
-        
+        EncApRepPart encApRepPart = ( ( EncApRepPartContainer ) encApRepPartContainer ).getEncApRepPart();
+
         // Check the encoding
         int length = encApRepPart.computeLength();
 
         // Check the length
         assertEquals( 0x1C, length );
-        
+
         // Check the encoding
         ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-        
+
         try
         {
             encodedPdu = encApRepPart.encode( encodedPdu );
-            
+
             // Check the length
             assertEquals( 0x1C, encodedPdu.limit() );
-            assertEquals( decodedPdu, Strings.dumpBytes(encodedPdu.array()) );
+            assertEquals( decodedPdu, Strings.dumpBytes( encodedPdu.array() ) );
         }
         catch ( EncoderException ee )
         {

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncAsRepPartDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncAsRepPartDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncAsRepPartDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncAsRepPartDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -54,59 +54,59 @@ public class EncAsRepPartDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0xA2 );
-        
+
         stream.put( new byte[]
-        {
-            0x79, (byte)0x81, (byte)0x9F,
-              0x30, (byte)0x81, (byte)0x9C,
-                (byte)0xA0, 0x11,
-                  0x30, 0x0F, 
-                    (byte)0xA0, 0x03, 
-                      0x02, 0x01, 0x11, 
-                    (byte)0xA1, 0x08, 
-                      0x04, 0x06, 
-                        0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
-                (byte)0xA1, 0x36,
-                  0x30, 0x34, 
-                    0x30, 0x18, 
-                      (byte)0xA0, 0x03, 
-                        0x02, 0x01, 0x02, 
-                      (byte)0xA1, 0x11, 
-                        0x18, 0x0F, 
-                          0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                    0x30, 0x18,
-                      (byte)0xA0, 0x03,
-                        0x02, 0x01, 0x02,
-                      (byte)0xA1, 0x11,
-                        0x18, 0x0F, 
-                          0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                (byte)0xA2, 0x03,
-                  0x02, 0x01, 0x01,
-                (byte)0xA4, 0x07,
-                  0x03, 0x05, 0x00, 0x40, 0x00, 0x00, 0x00,
-                (byte)0xA5, 0x11,
-                  0x18, 0x0F, 
-                    0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                (byte)0xA7, 0x11, 
-                  0x18, 0x0F, 
-                    0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                (byte)0xA9, 0x06,
-                  0x1B, 0x04, 'a', 'b', 'c', 'd',
-                (byte)0xAA, 0x13,
-                  0x30, 0x11, 
-                    (byte)0xA0, 0x03, 
-                      0x02, 0x01, 0x01, 
-                    (byte)0xA1, 0x0A, 
-                      0x30, 0x08,
-                        0x1B, 0x06, 
-                          0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
-        });
+            {
+                0x79, ( byte ) 0x81, ( byte ) 0x9F,
+                0x30, ( byte ) 0x81, ( byte ) 0x9C,
+                ( byte ) 0xA0, 0x11,
+                0x30, 0x0F,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x11,
+                ( byte ) 0xA1, 0x08,
+                0x04, 0x06,
+                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+                ( byte ) 0xA1, 0x36,
+                0x30, 0x34,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                ( byte ) 0xA2, 0x03,
+                0x02, 0x01, 0x01,
+                ( byte ) 0xA4, 0x07,
+                0x03, 0x05, 0x00, 0x40, 0x00, 0x00, 0x00,
+                ( byte ) 0xA5, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                ( byte ) 0xA7, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                ( byte ) 0xA9, 0x06,
+                0x1B, 0x04, 'a', 'b', 'c', 'd',
+                ( byte ) 0xAA, 0x13,
+                0x30, 0x11,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x01,
+                ( byte ) 0xA1, 0x0A,
+                0x30, 0x08,
+                0x1B, 0x06,
+                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+        } );
 
         stream.flip();
 
         // Allocate a EncAsRepPart Container
         EncAsRepPartContainer encAsRepPartContainer = new EncAsRepPartContainer( stream );
-        
+
         // Decode the EncAsRepPart PDU
         try
         {
@@ -118,20 +118,20 @@ public class EncAsRepPartDecoderTest
         }
 
         EncAsRepPart encAsRepPart = encAsRepPartContainer.getEncAsRepPart();
-        
+
         // Check the encoding
         int length = encAsRepPart.computeLength();
 
         // Check the length
         assertEquals( 0xA2, length );
-        
+
         // Check the encoding
         ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-        
+
         try
         {
             encodedPdu = encAsRepPart.encode( encodedPdu );
-            
+
             // Check the length
             assertEquals( 0xA2, encodedPdu.limit() );
         }
@@ -140,18 +140,18 @@ public class EncAsRepPartDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncAsRepPart with nothing in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncAsRepPartEmpty() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-        
+
         stream.put( new byte[]
             { 0x79, 0x00 } );
 
@@ -164,23 +164,23 @@ public class EncAsRepPartDecoderTest
         kerberosDecoder.decode( stream, encAsRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncAsRepPart with empty EncKdcRepPart tag
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncAsRepPartEmptyEncKdcRepPart() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-        
+
         stream.put( new byte[]
-            { 
+            {
                 0x79, 0x02,
-                  0x30, 0x00
-            } );
+                0x30, 0x00
+        } );
 
         stream.flip();
 

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKdcRepPartDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKdcRepPartDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKdcRepPartDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKdcRepPartDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -20,6 +20,7 @@
 
 package org.apache.directory.shared.kerberos.codec;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
@@ -34,6 +35,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 
+
 /**
  * Test cases for EncKrbPrivPart codec.
  *
@@ -45,18 +47,18 @@ public class EncKdcRepPartDecoderTest
      * Test an empty EncKdcRepPart
      * @throws Exception
      */
-    @Test( expected=DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testDecodeEncKdcRepPartEmpty() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x02;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x30, 0x00
-        });
-        
+            {
+                0x30, 0x00
+        } );
+
         stream.flip();
 
         // Allocate a EncKdcRepPart Container
@@ -66,25 +68,25 @@ public class EncKdcRepPartDecoderTest
         decoder.decode( stream, encKdcRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test an EncKdcRepPart with an empty key
      * @throws Exception
      */
-    @Test( expected=DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testDecodeEncKdcRepPartEmptyKey() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x04;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x30, 0x02,
-              (byte)0xA0, 0x00
-        });
-        
+            {
+                0x30, 0x02,
+                ( byte ) 0xA0, 0x00
+        } );
+
         stream.flip();
 
         // Allocate a EncKdcRepPart Container
@@ -94,25 +96,25 @@ public class EncKdcRepPartDecoderTest
         decoder.decode( stream, encKdcRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test an EncKdcRepPart with a missing key
      * @throws Exception
      */
-    @Test( expected=DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testDecodeEncKdcRepPartMissingKey() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x04;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x30, 0x02,
-              (byte)0xA1, 0x00 
-        });
-        
+            {
+                0x30, 0x02,
+                ( byte ) 0xA1, 0x00
+        } );
+
         stream.flip();
 
         // Allocate a EncKdcRepPart Container
@@ -122,32 +124,32 @@ public class EncKdcRepPartDecoderTest
         decoder.decode( stream, encKdcRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test an EncKdcRepPart with an empty last-req
      * @throws Exception
      */
-    @Test( expected=DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testDecodeEncKdcRepPartEmptylastReq() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x17;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x30, 0x15,
-              (byte)0xA0, 0x11,
-                0x30, 0x0F, 
-                  (byte)0xA0, 0x03, 
-                    0x02, 0x01, 0x11, 
-                  (byte)0xA1, 0x08, 
-                    0x04, 0x06, 
-                      0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
-              (byte)0xA1, 0x00 
-        });
-        
+            {
+                0x30, 0x15,
+                ( byte ) 0xA0, 0x11,
+                0x30, 0x0F,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x11,
+                ( byte ) 0xA1, 0x08,
+                0x04, 0x06,
+                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+                ( byte ) 0xA1, 0x00
+        } );
+
         stream.flip();
 
         // Allocate a EncKdcRepPart Container
@@ -157,32 +159,32 @@ public class EncKdcRepPartDecoderTest
         decoder.decode( stream, encKdcRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test an EncKdcRepPart with an missing last-req
      * @throws Exception
      */
-    @Test( expected=DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testDecodeEncKdcRepPartLastReqMissing() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x17;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x30, 0x15,
-              (byte)0xA0, 0x11,
-                0x30, 0x0F, 
-                  (byte)0xA0, 0x03, 
-                    0x02, 0x01, 0x11, 
-                  (byte)0xA1, 0x08, 
-                    0x04, 0x06, 
-                      0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
-              (byte)0xA2, 0x00 
-        });
-        
+            {
+                0x30, 0x15,
+                ( byte ) 0xA0, 0x11,
+                0x30, 0x0F,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x11,
+                ( byte ) 0xA1, 0x08,
+                0x04, 0x06,
+                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+                ( byte ) 0xA2, 0x00
+        } );
+
         stream.flip();
 
         // Allocate a EncKdcRepPart Container
@@ -192,46 +194,46 @@ public class EncKdcRepPartDecoderTest
         decoder.decode( stream, encKdcRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test an EncKdcRepPart with an empty nonce
      * @throws Exception
      */
-    @Test( expected=DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testDecodeEncKdcRepPartEmptyNonce() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x4F;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x30, 0x4D,
-              (byte)0xA0, 0x11,
-                0x30, 0x0F, 
-                  (byte)0xA0, 0x03, 
-                    0x02, 0x01, 0x11, 
-                  (byte)0xA1, 0x08, 
-                    0x04, 0x06, 
-                      0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
-              (byte)0xA1, 0x36,
-                0x30, 0x34, 
-                  0x30, 0x18, 
-                    (byte)0xA0, 0x03, 
-                      0x02, 0x01, 0x02, 
-                    (byte)0xA1, 0x11, 
-                      0x18, 0x0F, 
-                        0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                  0x30, 0x18,
-                    (byte)0xA0, 0x03,
-                      0x02, 0x01, 0x02,
-                    (byte)0xA1, 0x11,
-                      0x18, 0x0F, 
-                        0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-              (byte)0xA2, 0x00
-        });
-        
+            {
+                0x30, 0x4D,
+                ( byte ) 0xA0, 0x11,
+                0x30, 0x0F,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x11,
+                ( byte ) 0xA1, 0x08,
+                0x04, 0x06,
+                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+                ( byte ) 0xA1, 0x36,
+                0x30, 0x34,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                ( byte ) 0xA2, 0x00
+        } );
+
         stream.flip();
 
         // Allocate a EncKdcRepPart Container
@@ -241,46 +243,46 @@ public class EncKdcRepPartDecoderTest
         decoder.decode( stream, encKdcRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test an EncKdcRepPart with an missing nonce
      * @throws Exception
      */
-    @Test( expected=DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testDecodeEncKdcRepPartNonceMissing() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x4F;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-             {
-                 0x30, 0x4D,
-                   (byte)0xA0, 0x11,
-                     0x30, 0x0F, 
-                       (byte)0xA0, 0x03, 
-                         0x02, 0x01, 0x11, 
-                       (byte)0xA1, 0x08, 
-                         0x04, 0x06, 
-                           0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
-                   (byte)0xA1, 0x36,
-                     0x30, 0x34, 
-                       0x30, 0x18, 
-                         (byte)0xA0, 0x03, 
-                           0x02, 0x01, 0x02, 
-                         (byte)0xA1, 0x11, 
-                           0x18, 0x0F, 
-                             0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                       0x30, 0x18,
-                         (byte)0xA0, 0x03,
-                           0x02, 0x01, 0x02,
-                         (byte)0xA1, 0x11,
-                           0x18, 0x0F, 
-                             0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                   (byte)0xA3, 0x00
-             });
-        
+            {
+                0x30, 0x4D,
+                ( byte ) 0xA0, 0x11,
+                0x30, 0x0F,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x11,
+                ( byte ) 0xA1, 0x08,
+                0x04, 0x06,
+                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+                ( byte ) 0xA1, 0x36,
+                0x30, 0x34,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                ( byte ) 0xA3, 0x00
+        } );
+
         stream.flip();
 
         // Allocate a EncKdcRepPart Container
@@ -290,48 +292,48 @@ public class EncKdcRepPartDecoderTest
         decoder.decode( stream, encKdcRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test an EncKdcRepPart with an empty key-expiration
      * @throws Exception
      */
-    @Test( expected=DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testDecodeEncKdcRepPartEmptyKeyExpiration() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x54;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x30, 0x52,
-              (byte)0xA0, 0x11,
-                0x30, 0x0F, 
-                  (byte)0xA0, 0x03, 
-                    0x02, 0x01, 0x11, 
-                  (byte)0xA1, 0x08, 
-                    0x04, 0x06, 
-                      0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
-              (byte)0xA1, 0x36,
-                0x30, 0x34, 
-                  0x30, 0x18, 
-                    (byte)0xA0, 0x03, 
-                      0x02, 0x01, 0x02, 
-                    (byte)0xA1, 0x11, 
-                      0x18, 0x0F, 
-                        0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                  0x30, 0x18,
-                    (byte)0xA0, 0x03,
-                      0x02, 0x01, 0x02,
-                    (byte)0xA1, 0x11,
-                      0x18, 0x0F, 
-                        0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-              (byte)0xA2, 0x03,
+            {
+                0x30, 0x52,
+                ( byte ) 0xA0, 0x11,
+                0x30, 0x0F,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x11,
+                ( byte ) 0xA1, 0x08,
+                0x04, 0x06,
+                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+                ( byte ) 0xA1, 0x36,
+                0x30, 0x34,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                ( byte ) 0xA2, 0x03,
                 0x02, 0x01, 0x01,
-              (byte)0xA3, 0x00
-        });
-        
+                ( byte ) 0xA3, 0x00
+        } );
+
         stream.flip();
 
         // Allocate a EncKdcRepPart Container
@@ -341,8 +343,8 @@ public class EncKdcRepPartDecoderTest
         decoder.decode( stream, encKdcRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test an EncKdcRepPart with no optional fields
      * @throws Exception
@@ -351,56 +353,56 @@ public class EncKdcRepPartDecoderTest
     public void testDecodeEncKdcRepPartNoOptionalFields() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x9F;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-             {
-                 0x30, (byte)0x81, (byte)0x9C,
-                   (byte)0xA0, 0x11,
-                     0x30, 0x0F, 
-                       (byte)0xA0, 0x03, 
-                         0x02, 0x01, 0x11, 
-                       (byte)0xA1, 0x08, 
-                         0x04, 0x06, 
-                           0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
-                   (byte)0xA1, 0x36,
-                     0x30, 0x34, 
-                       0x30, 0x18, 
-                         (byte)0xA0, 0x03, 
-                           0x02, 0x01, 0x02, 
-                         (byte)0xA1, 0x11, 
-                           0x18, 0x0F, 
-                             0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                       0x30, 0x18,
-                         (byte)0xA0, 0x03,
-                           0x02, 0x01, 0x02,
-                         (byte)0xA1, 0x11,
-                           0x18, 0x0F, 
-                             0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                   (byte)0xA2, 0x03,
-                     0x02, 0x01, 0x01,
-                   (byte)0xA4, 0x07,
-                     0x03, 0x05, 0x00, 0x40, 0x00, 0x00, 0x00,
-                   (byte)0xA5, 0x11,
-                     0x18, 0x0F, 
-                       0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                   (byte)0xA7, 0x11, 
-                     0x18, 0x0F, 
-                       0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
-                   (byte)0xA9, 0x06,
-                     0x1B, 0x04, 'a', 'b', 'c', 'd',
-                   (byte)0xAA, 0x13,
-                     0x30, 0x11, 
-                       (byte)0xA0, 0x03, 
-                         0x02, 0x01, 0x01, 
-                       (byte)0xA1, 0x0A, 
-                         0x30, 0x08,
-                           0x1B, 0x06, 
-                             0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
-             });
-        
-        String decoded = Strings.dumpBytes(stream.array());
+            {
+                0x30, ( byte ) 0x81, ( byte ) 0x9C,
+                ( byte ) 0xA0, 0x11,
+                0x30, 0x0F,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x11,
+                ( byte ) 0xA1, 0x08,
+                0x04, 0x06,
+                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+                ( byte ) 0xA1, 0x36,
+                0x30, 0x34,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                0x30, 0x18,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x02,
+                ( byte ) 0xA1, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                ( byte ) 0xA2, 0x03,
+                0x02, 0x01, 0x01,
+                ( byte ) 0xA4, 0x07,
+                0x03, 0x05, 0x00, 0x40, 0x00, 0x00, 0x00,
+                ( byte ) 0xA5, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                ( byte ) 0xA7, 0x11,
+                0x18, 0x0F,
+                0x32, 0x30, 0x31, 0x30, 0x31, 0x31, 0x32, 0x35, 0x31, 0x36, 0x31, 0x32, 0x35, 0x39, 0x5A,
+                ( byte ) 0xA9, 0x06,
+                0x1B, 0x04, 'a', 'b', 'c', 'd',
+                ( byte ) 0xAA, 0x13,
+                0x30, 0x11,
+                ( byte ) 0xA0, 0x03,
+                0x02, 0x01, 0x01,
+                ( byte ) 0xA1, 0x0A,
+                0x30, 0x08,
+                0x1B, 0x06,
+                0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
+        } );
+
+        String decoded = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a EncKdcRepPart Container
@@ -411,28 +413,28 @@ public class EncKdcRepPartDecoderTest
         {
             decoder.decode( stream, encKdcRepPartContainer );
         }
-        catch( Exception e )
+        catch ( Exception e )
         {
             e.printStackTrace();
             fail();
         }
-        
+
         EncKdcRepPart encKdcRepPart = encKdcRepPartContainer.getEncKdcRepPart();
 
         int computedLen = encKdcRepPart.computeLength();
-        
+
         assertEquals( streamLen, computedLen );
-        
+
         try
         {
             ByteBuffer bb = ByteBuffer.allocate( computedLen );
-            
+
             encKdcRepPart.encode( bb );
-            
-            String encoded = Strings.dumpBytes(bb.array());
+
+            String encoded = Strings.dumpBytes( bb.array() );
             assertEquals( decoded, encoded );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbCredPartDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbCredPartDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbCredPartDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbCredPartDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -114,8 +114,8 @@ public class EncKrbCredPartDecoderTest
         recipientAddress = new HostAddress( InetAddress.getByName( "localhost" ) );
         optionalFieldValueList.add( new FieldValueHolder( "recipientAddress", recipientAddress ) );
     }
-    
-    
+
+
     @Test
     public void testEncKrbCredPart() throws Exception
     {
@@ -124,7 +124,7 @@ public class EncKrbCredPartDecoderTest
         {
             EncKrbCredPart expected = new EncKrbCredPart();
             expected.setTicketInfo( ticketInfo );
-            
+
             Map<String, Field> EncKrbCrePartFieldNameMap = getFieldMap( expected );
 
             List<FieldValueHolder> presentFieldList = new ArrayList<FieldValueHolder>();
@@ -165,8 +165,8 @@ public class EncKrbCredPartDecoderTest
             assertValues( presentFieldList, actual );
         }
     }
-    
-    
+
+
     @Test
     public void testKrbCredInfoWithEachOptElement() throws Exception
     {
@@ -211,6 +211,7 @@ public class EncKrbCredPartDecoderTest
         }
     }
 
+
     /**
      * compare the values that are inserted into the EncKrbCredPart objects before encoding to
      * those that are obtained from decoded EncKrbCredPart



Mime
View raw message