directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1235326 [18/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/EncKrbPrivPartDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncKrbPrivPartDecoderTest.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;
@@ -38,6 +39,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 
+
 /**
  * Test cases for EncKrbPrivPart codec.
  *
@@ -49,55 +51,104 @@ public class EncKrbPrivPartDecoderTest
     public void testDecodeEncKrbPrivPart() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x49;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x7C, 0x47,
-            0x30, 0x45,
-              (byte)0xA0, 0x4,        // user-data
-                     0x04, 0x02, 0x00, 0x01,
-              (byte)0xA1, 0x11,       // timestamp
-                     0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-              (byte)0xA2, 0x03,       // usec
-                     0x02, 0x01, 0x01,
-              (byte)0xA3, 0x03,       // seq-number
-                     0x02, 0x01, 0x01,
-              (byte)0xA4, 0xF,        // s-address
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1,
-              (byte)0xA5, 0xF,        // r-adress
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1
+            {
+                0x7C, 0x47,
+                0x30, 0x45,
+                ( byte ) 0xA0, 0x4, // user-data
+                0x04,
+                0x02,
+                0x00,
+                0x01,
+                ( byte ) 0xA1,
+                0x11, // timestamp
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA2,
+                0x03, // usec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA3,
+                0x03, // seq-number
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0xF, // s-address
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1,
+                ( byte ) 0xA5,
+                0xF, // r-adress
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1
         } );
 
-        String decoded = Strings.dumpBytes(stream.array());
+        String decoded = Strings.dumpBytes( stream.array() );
         stream.flip();
-        
+
         EncKrbPrivPartContainer container = new EncKrbPrivPartContainer( stream );
-        
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
-        
+
         String time = "20101119080043Z";
         HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
-        
-        assertTrue( Arrays.equals( new byte[]{0,1}, encKrbPrivPart.getUserData() ) );
+
+        assertTrue( Arrays.equals( new byte[]
+            { 0, 1 }, encKrbPrivPart.getUserData() ) );
         assertEquals( time, encKrbPrivPart.getTimestamp().getDate() );
         assertEquals( 1, encKrbPrivPart.getUsec() );
         assertEquals( 1, encKrbPrivPart.getSeqNumber() );
@@ -105,76 +156,108 @@ public class EncKrbPrivPartDecoderTest
         assertEquals( ad, encKrbPrivPart.getRecipientAddress() );
 
         int computedLen = encKrbPrivPart.computeLength();
-        
+
         assertEquals( streamLen, computedLen );
-        
+
         try
         {
             ByteBuffer bb = ByteBuffer.allocate( computedLen );
-            
+
             encKrbPrivPart.encode( bb );
-            
-            String encoded = Strings.dumpBytes(bb.array());
+
+            String encoded = Strings.dumpBytes( bb.array() );
             assertEquals( decoded, encoded );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
-    
-    
+
+
     @Test
     public void testDecodeEncKrbPrivPartWithoutTimestamp() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x36;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x7C, 0x34,
-            0x30, 0x32,
-              (byte)0xA0, 0x4,        // user-data
-                     0x04, 0x02, 0x00, 0x01,
-                     // NO timestamp
-              (byte)0xA2, 0x03,       // usec
-                     0x02, 0x01, 0x01,
-              (byte)0xA3, 0x03,       // seq-number
-                     0x02, 0x01, 0x01,
-              (byte)0xA4, 0xF,        // s-address
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1,
-              (byte)0xA5, 0xF,        // r-adress
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1
+            {
+                0x7C, 0x34,
+                0x30, 0x32,
+                ( byte ) 0xA0, 0x4, // user-data
+                0x04,
+                0x02,
+                0x00,
+                0x01,
+                // NO timestamp
+                ( byte ) 0xA2,
+                0x03, // usec
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA3,
+                0x03, // seq-number
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0xF, // s-address
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1,
+                ( byte ) 0xA5,
+                0xF, // r-adress
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1
         } );
 
-        String decoded = Strings.dumpBytes(stream.array());
+        String decoded = Strings.dumpBytes( stream.array() );
         stream.flip();
-        
+
         EncKrbPrivPartContainer container = new EncKrbPrivPartContainer( stream );
-        
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         EncKrbPrivPart enKrbPrivPart = container.getEncKrbPrivPart();
-        
+
         HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
-        
-        assertTrue( Arrays.equals( new byte[]{0,1}, enKrbPrivPart.getUserData() ) );
+
+        assertTrue( Arrays.equals( new byte[]
+            { 0, 1 }, enKrbPrivPart.getUserData() ) );
         assertNull( enKrbPrivPart.getTimestamp() );
         assertEquals( 1, enKrbPrivPart.getUsec() );
         assertEquals( 1, enKrbPrivPart.getSeqNumber() );
@@ -182,74 +265,103 @@ public class EncKrbPrivPartDecoderTest
         assertEquals( ad, enKrbPrivPart.getRecipientAddress() );
 
         int computedLen = enKrbPrivPart.computeLength();
-        
+
         assertEquals( streamLen, computedLen );
-        
+
         try
         {
             ByteBuffer bb = ByteBuffer.allocate( computedLen );
-            
+
             enKrbPrivPart.encode( bb );
-            
-            String encoded = Strings.dumpBytes(bb.array());
+
+            String encoded = Strings.dumpBytes( bb.array() );
             assertEquals( decoded, encoded );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeEncKrbPrivPartWithoutTimestampAndUsec() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x31;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x7C, 0x2F,
-            0x30, 0x2D,
-              (byte)0xA0, 0x4,        // user-data
-                     0x04, 0x02, 0x00, 0x01,
-                     // NO timestamp and usec
-              (byte)0xA3, 0x03,       // seq-number
-                     0x02, 0x01, 0x01,
-              (byte)0xA4, 0xF,        // s-address
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1,
-              (byte)0xA5, 0xF,        // r-adress
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1
+            {
+                0x7C, 0x2F,
+                0x30, 0x2D,
+                ( byte ) 0xA0, 0x4, // user-data
+                0x04,
+                0x02,
+                0x00,
+                0x01,
+                // NO timestamp and usec
+                ( byte ) 0xA3,
+                0x03, // seq-number
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA4,
+                0xF, // s-address
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1,
+                ( byte ) 0xA5,
+                0xF, // r-adress
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1
         } );
 
-        String decoded = Strings.dumpBytes(stream.array());
+        String decoded = Strings.dumpBytes( stream.array() );
         stream.flip();
-        
+
         EncKrbPrivPartContainer container = new EncKrbPrivPartContainer( stream );
-        
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
-        
+
         HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
-        
-        assertTrue( Arrays.equals( new byte[]{0,1}, encKrbPrivPart.getUserData() ) );
+
+        assertTrue( Arrays.equals( new byte[]
+            { 0, 1 }, encKrbPrivPart.getUserData() ) );
         assertNull( encKrbPrivPart.getTimestamp() );
         assertEquals( 0, encKrbPrivPart.getUsec() );
         assertEquals( 1, encKrbPrivPart.getSeqNumber() );
@@ -257,73 +369,99 @@ public class EncKrbPrivPartDecoderTest
         assertEquals( ad, encKrbPrivPart.getRecipientAddress() );
 
         int computedLen = encKrbPrivPart.computeLength();
-        
+
         assertEquals( streamLen, computedLen );
-        
+
         try
         {
             ByteBuffer bb = ByteBuffer.allocate( computedLen );
-            
+
             encKrbPrivPart.encode( bb );
-            
-            String encoded = Strings.dumpBytes(bb.array());
+
+            String encoded = Strings.dumpBytes( bb.array() );
             assertEquals( decoded, encoded );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeEncKrbPrivPartWithoutTimestampUsecAndSeqNumber() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x2C;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x7C, 0x2A,
-            0x30, 0x28,
-              (byte)0xA0, 0x4,        // user-data
-                     0x04, 0x02, 0x00, 0x01,
-                     // NO timestamp, usec and seq-number
-              (byte)0xA4, 0xF,        // s-address
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1,
-              (byte)0xA5, 0xF,        // r-adress
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1
+            {
+                0x7C, 0x2A,
+                0x30, 0x28,
+                ( byte ) 0xA0, 0x4, // user-data
+                0x04,
+                0x02,
+                0x00,
+                0x01,
+                // NO timestamp, usec and seq-number
+                ( byte ) 0xA4,
+                0xF, // s-address
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1,
+                ( byte ) 0xA5,
+                0xF, // r-adress
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1
         } );
 
-        String decoded = Strings.dumpBytes(stream.array());
+        String decoded = Strings.dumpBytes( stream.array() );
         stream.flip();
-        
+
         EncKrbPrivPartContainer container = new EncKrbPrivPartContainer( stream );
-        
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             e.printStackTrace();
             fail();
         }
-        
+
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
-        
+
         HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
-        
-        assertTrue( Arrays.equals( new byte[]{0,1}, encKrbPrivPart.getUserData() ) );
+
+        assertTrue( Arrays.equals( new byte[]
+            { 0, 1 }, encKrbPrivPart.getUserData() ) );
         assertNull( encKrbPrivPart.getTimestamp() );
         assertEquals( 0, encKrbPrivPart.getUsec() );
         assertEquals( 0, encKrbPrivPart.getSeqNumber() );
@@ -331,77 +469,123 @@ public class EncKrbPrivPartDecoderTest
         assertEquals( ad, encKrbPrivPart.getRecipientAddress() );
 
         int computedLen = encKrbPrivPart.computeLength();
-        
+
         assertEquals( streamLen, computedLen );
-        
+
         try
         {
             ByteBuffer bb = ByteBuffer.allocate( computedLen );
-            
+
             encKrbPrivPart.encode( bb );
-            
-            String encoded = Strings.dumpBytes(bb.array());
+
+            String encoded = Strings.dumpBytes( bb.array() );
             assertEquals( decoded, encoded );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeEncKrbPrivPartWithoutSequenceNumber() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x44;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x7C, 0x42,
-            0x30, 0x40,
-              (byte)0xA0, 0x4,        // user-data
-                     0x04, 0x02, 0x00, 0x01,
-              (byte)0xA1, 0x11,       // timestamp
-                     0x18, 0xF, '2', '0', '1', '0', '1', '1', '1', '9', '0', '8', '0', '0', '4', '3', 'Z',
-              (byte)0xA2, 0x03,       // usec
-                     0x02, 0x01, 0x01,
-                     // NO seq-number
-              (byte)0xA4, 0xF,        // s-address
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1,
-              (byte)0xA5, 0xF,        // r-adress
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1
+            {
+                0x7C, 0x42,
+                0x30, 0x40,
+                ( byte ) 0xA0, 0x4, // user-data
+                0x04,
+                0x02,
+                0x00,
+                0x01,
+                ( byte ) 0xA1,
+                0x11, // timestamp
+                0x18,
+                0xF,
+                '2',
+                '0',
+                '1',
+                '0',
+                '1',
+                '1',
+                '1',
+                '9',
+                '0',
+                '8',
+                '0',
+                '0',
+                '4',
+                '3',
+                'Z',
+                ( byte ) 0xA2,
+                0x03, // usec
+                0x02,
+                0x01,
+                0x01,
+                // NO seq-number
+                ( byte ) 0xA4,
+                0xF, // s-address
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1,
+                ( byte ) 0xA5,
+                0xF, // r-adress
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1
         } );
 
-        String decoded = Strings.dumpBytes(stream.array());
+        String decoded = Strings.dumpBytes( stream.array() );
         stream.flip();
-        
+
         EncKrbPrivPartContainer container = new EncKrbPrivPartContainer( stream );
-        
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             fail();
         }
-        
+
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
-        
+
         String time = "20101119080043Z";
         HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
-        
-        assertTrue( Arrays.equals( new byte[]{0,1}, encKrbPrivPart.getUserData() ) );
+
+        assertTrue( Arrays.equals( new byte[]
+            { 0, 1 }, encKrbPrivPart.getUserData() ) );
         assertEquals( time, encKrbPrivPart.getTimestamp().getDate() );
         assertEquals( 1, encKrbPrivPart.getUsec() );
         assertEquals( 0, encKrbPrivPart.getSeqNumber() );
@@ -409,68 +593,83 @@ public class EncKrbPrivPartDecoderTest
         assertEquals( ad, encKrbPrivPart.getRecipientAddress() );
 
         int computedLen = encKrbPrivPart.computeLength();
-        
+
         assertEquals( streamLen, computedLen );
-        
+
         try
         {
             ByteBuffer bb = ByteBuffer.allocate( computedLen );
-            
+
             encKrbPrivPart.encode( bb );
-            
-            String encoded = Strings.dumpBytes(bb.array());
+
+            String encoded = Strings.dumpBytes( bb.array() );
             assertEquals( decoded, encoded );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
             fail();
         }
     }
 
-    
+
     @Test
     public void testDecodeEncKrbPrivPartWithoutOptionalValues() throws Exception
     {
         Asn1Decoder decoder = new Asn1Decoder();
-        
+
         int streamLen = 0x1B;
         ByteBuffer stream = ByteBuffer.allocate( streamLen );
         stream.put( new byte[]
-        {
-            0x7C, 0x19,
-            0x30, 0x17,
-              (byte)0xA0, 0x4,        // user-data
-                     0x04, 0x02, 0x00, 0x01,
-                     // NO timestamp, usec and seq-number
-              (byte)0xA4, 0xF,        // s-address
-                     0x30, 0x0D,
-                      (byte)0xA0, 0x03,
-                             0x02, 0x01, 0x02,
-                       (byte)0xA1, 0x06,
-                              0x04, 0x04, 127, 0, 0, 1,
-                    // NO r-address
+            {
+                0x7C, 0x19,
+                0x30, 0x17,
+                ( byte ) 0xA0, 0x4, // user-data
+                0x04,
+                0x02,
+                0x00,
+                0x01,
+                // NO timestamp, usec and seq-number
+                ( byte ) 0xA4,
+                0xF, // s-address
+                0x30,
+                0x0D,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x06,
+                0x04,
+                0x04,
+                127,
+                0,
+                0,
+                1,
+            // NO r-address
         } );
 
-        String decoded = Strings.dumpBytes(stream.array());
+        String decoded = Strings.dumpBytes( stream.array() );
         stream.flip();
-        
+
         EncKrbPrivPartContainer container = new EncKrbPrivPartContainer( stream );
-        
+
         try
         {
             decoder.decode( stream, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             e.printStackTrace();
             fail();
         }
-        
+
         EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
-        
+
         HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
-        
-        assertTrue( Arrays.equals( new byte[]{0,1}, encKrbPrivPart.getUserData() ) );
+
+        assertTrue( Arrays.equals( new byte[]
+            { 0, 1 }, encKrbPrivPart.getUserData() ) );
         assertNull( encKrbPrivPart.getTimestamp() );
         assertEquals( 0, encKrbPrivPart.getUsec() );
         assertEquals( 0, encKrbPrivPart.getSeqNumber() );
@@ -478,19 +677,19 @@ public class EncKrbPrivPartDecoderTest
         assertNull( encKrbPrivPart.getRecipientAddress() );
 
         int computedLen = encKrbPrivPart.computeLength();
-        
+
         assertEquals( streamLen, computedLen );
-        
+
         try
         {
             ByteBuffer bb = ByteBuffer.allocate( computedLen );
-            
+
             encKrbPrivPart.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/EncTgsRepPartDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncTgsRepPartDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncTgsRepPartDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncTgsRepPartDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -54,59 +54,59 @@ public class EncTgsRepPartDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0xA2 );
-        
+
         stream.put( new byte[]
-        {
-            0x7A, (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,
-        });
+            {
+                0x7A, ( 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
         EncTgsRepPartContainer encTgsRepPartContainer = new EncTgsRepPartContainer( stream );
-        
+
         // Decode the EncTgsRepPart PDU
         try
         {
@@ -118,20 +118,20 @@ public class EncTgsRepPartDecoderTest
         }
 
         EncTgsRepPart encTgsRepPart = encTgsRepPartContainer.getEncTgsRepPart();
-        
+
         // Check the encoding
         int length = encTgsRepPart.computeLength();
 
         // Check the length
         assertEquals( 0xA2, length );
-        
+
         // Check the encoding
         ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-        
+
         try
         {
             encodedPdu = encTgsRepPart.encode( encodedPdu );
-            
+
             // Check the length
             assertEquals( 0xA2, encodedPdu.limit() );
         }
@@ -140,18 +140,18 @@ public class EncTgsRepPartDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncAsRepPart with nothing in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncTgsRepPartEmpty() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-        
+
         stream.put( new byte[]
             { 0x7A, 0x00 } );
 
@@ -164,23 +164,23 @@ public class EncTgsRepPartDecoderTest
         kerberosDecoder.decode( stream, encTgsRepPartContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncTgsRepPart with empty EncKdcRepPart tag
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncTgsRepPartEmptyEncKdcRepPart() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-        
+
         stream.put( new byte[]
-            { 
+            {
                 0x7A, 0x02,
-                  0x30, 0x00
-            } );
+                0x30, 0x00
+        } );
 
         stream.flip();
 

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncryptedDataDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncryptedDataDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncryptedDataDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncryptedDataDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -60,19 +60,32 @@ public class EncryptedDataDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x16 );
-        
+
         stream.put( new byte[]
-            { 
-              0x30, 0x14,
-                (byte)0xA0, 0x03,                 // etype
-                  0x02, 0x01, 0x12,               //
-                (byte)0xA1, 0x03,                 // kvno
-                  0x02, 0x01, 0x05,               //
-                (byte)0xA2, 0x08,                 // cipher
-                  0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f'
-            } );
+            {
+                0x30, 0x14,
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x12, //
+                ( byte ) 0xA1,
+                0x03, // kvno
+                0x02,
+                0x01,
+                0x05, //
+                ( byte ) 0xA2,
+                0x08, // cipher
+                0x04,
+                0x06,
+                'a',
+                'b',
+                'c',
+                'd',
+                'e',
+                'f'
+        } );
 
-        String decodedPdu = Strings.dumpBytes(stream.array());
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a EncryptedData Container
@@ -93,20 +106,20 @@ public class EncryptedDataDecoderTest
 
         assertEquals( EncryptionType.AES256_CTS_HMAC_SHA1_96, encryptedData.getEType() );
         assertEquals( 5, encryptedData.getKvno() );
-        assertTrue( Arrays.equals( Strings.getBytesUtf8("abcdef"), encryptedData.getCipher() ) );
+        assertTrue( Arrays.equals( Strings.getBytesUtf8( "abcdef" ), encryptedData.getCipher() ) );
 
         // Check the encoding
         ByteBuffer bb = ByteBuffer.allocate( encryptedData.computeLength() );
-        
+
         try
         {
             bb = encryptedData.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x16, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -114,8 +127,8 @@ public class EncryptedDataDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncryptedData with no kvno
      */
@@ -125,17 +138,27 @@ public class EncryptedDataDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x11 );
-        
+
         stream.put( new byte[]
-            { 
-              0x30, 0x0F,
-                (byte)0xA0, 0x03,                 // etype
-                  0x02, 0x01, 0x12,               //
-                (byte)0xA2, 0x08,                 // cipher
-                  0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f'
-            } );
+            {
+                0x30, 0x0F,
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x12, //
+                ( byte ) 0xA2,
+                0x08, // cipher
+                0x04,
+                0x06,
+                'a',
+                'b',
+                'c',
+                'd',
+                'e',
+                'f'
+        } );
 
-        String decodedPdu = Strings.dumpBytes(stream.array());
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a EncryptedData Container
@@ -156,20 +179,20 @@ public class EncryptedDataDecoderTest
 
         assertEquals( EncryptionType.AES256_CTS_HMAC_SHA1_96, encryptedData.getEType() );
         assertFalse( encryptedData.hasKvno() );
-        assertTrue( Arrays.equals( Strings.getBytesUtf8("abcdef"), encryptedData.getCipher() ) );
+        assertTrue( Arrays.equals( Strings.getBytesUtf8( "abcdef" ), encryptedData.getCipher() ) );
 
         // Check the encoding
         ByteBuffer bb = ByteBuffer.allocate( encryptedData.computeLength() );
-        
+
         try
         {
             bb = encryptedData.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x11, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -177,18 +200,18 @@ public class EncryptedDataDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncryptedData with nothing in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncryptedDataEmpty() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x00 } );
 
@@ -201,22 +224,22 @@ public class EncryptedDataDecoderTest
         kerberosDecoder.decode( stream, encryptedDataContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncryptedData with no type
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncryptedDataNoEType() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x02,
-                (byte)0xA0, 0x00                  // etype
-            } );
+                ( byte ) 0xA0, 0x00 // etype
+        } );
 
         stream.flip();
 
@@ -227,26 +250,36 @@ public class EncryptedDataDecoderTest
         kerberosDecoder.decode( stream, encryptedDataContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncryptedData with a missing type
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncryptedDataMissingEType() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x11 );
-        
+
         stream.put( new byte[]
-            { 
-              0x30, 0x0F,
-                (byte)0xA1, 0x03,                 // kvno
-                  0x02, 0x01, 0x05,               //
-                (byte)0xA2, 0x08,                 // cipher
-                  0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f'
-            } );
+            {
+                0x30, 0x0F,
+                ( byte ) 0xA1, 0x03, // kvno
+                0x02,
+                0x01,
+                0x05, //
+                ( byte ) 0xA2,
+                0x08, // cipher
+                0x04,
+                0x06,
+                'a',
+                'b',
+                'c',
+                'd',
+                'e',
+                'f'
+        } );
 
         stream.flip();
 
@@ -257,23 +290,24 @@ public class EncryptedDataDecoderTest
         kerberosDecoder.decode( stream, encryptedDataContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncryptedData with an empty type
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncryptedDataEmptyType() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x0B );
-        
+
         stream.put( new byte[]
             { 0x30, 0x04,
-                (byte)0xA0, 0x02,                 // etype
-                  0x02, 0x00                      // 
-            } );
+                ( byte ) 0xA0, 0x02, // etype
+                0x02,
+                0x00 // 
+        } );
 
         stream.flip();
 
@@ -284,24 +318,27 @@ public class EncryptedDataDecoderTest
         kerberosDecoder.decode( stream, encryptedDataContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncryptedData with an empty kvno
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncryptedDataEmptyKvno() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x09 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x07,
-                (byte)0xA0, 0x03,                 // etype
-                  0x02, 0x01, 0x01,               // 
-                (byte)0xA1, 0x00                  // kvno
-            } );
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x01, // 
+                ( byte ) 0xA1,
+                0x00 // kvno
+        } );
 
         stream.flip();
 
@@ -312,25 +349,30 @@ public class EncryptedDataDecoderTest
         kerberosDecoder.decode( stream, encryptedDataContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncryptedData with no cipher
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testEncryptedDataNoCipher() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x0C );
-        
+
         stream.put( new byte[]
             { 0x30, 0x0A,
-                (byte)0xA0, 0x03,                 // etype
-                  0x02, 0x01, 0x01,               // 
-                (byte)0xA1, 0x02,                 // kvno
-                  0x02, 0x01, 0x05                //
-            } );
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x01, // 
+                ( byte ) 0xA1,
+                0x02, // kvno
+                0x02,
+                0x01,
+                0x05 //
+        } );
 
         stream.flip();
 
@@ -341,26 +383,32 @@ public class EncryptedDataDecoderTest
         kerberosDecoder.decode( stream, encryptedDataContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncryptedData empty cipher
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testEncryptedDataEmptyCipher() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x0E );
-        
+
         stream.put( new byte[]
             { 0x30, 0x0C,
-                (byte)0xA0, 0x03,                 // etype
-                  0x02, 0x01, 0x01,               // 
-                (byte)0xA1, 0x03,                 // kvno
-                  0x02, 0x01, 0x01,               //
-                (byte)0xA2, 0x00                  // cipher
-            } );
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x01, // 
+                ( byte ) 0xA1,
+                0x03, // kvno
+                0x02,
+                0x01,
+                0x01, //
+                ( byte ) 0xA2,
+                0x00 // cipher
+        } );
 
         stream.flip();
 
@@ -371,26 +419,33 @@ public class EncryptedDataDecoderTest
         kerberosDecoder.decode( stream, encryptedDataContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a EncryptedData with a null cipher
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testEncryptedDataNullCipher() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x10 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x0E,
-                (byte)0xA0, 0x03,                 // etype
-                  0x02, 0x01, 0x01,               // 
-                (byte)0xA1, 0x03,                 // kvno
-                  0x02, 0x01, 0x01,               //
-                (byte)0xA2, 0x02,                 // cipher
-                  0x04, 0x00
+                ( byte ) 0xA0, 0x03, // etype
+                0x02,
+                0x01,
+                0x01, // 
+                ( byte ) 0xA1,
+                0x03, // kvno
+                0x02,
+                0x01,
+                0x01, //
+                ( byte ) 0xA2,
+                0x02, // cipher
+                0x04,
+                0x00
         } );
 
         stream.flip();

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncryptionKeyDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncryptionKeyDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncryptionKeyDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/EncryptionKeyDecoderTest.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.assertTrue;
 import static org.junit.Assert.fail;
@@ -36,6 +37,7 @@ import org.apache.directory.shared.kerbe
 import org.apache.directory.shared.util.Strings;
 import org.junit.Test;
 
+
 /**
  * Test cases for EncryptionKey codec.
  *
@@ -47,23 +49,33 @@ public class EncryptionKeyDecoderTest
     public void testDecodeFullEncryptionKey()
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x11 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x0F,
-                  (byte)0xA0, 0x03,                 // keytype
-                    0x02, 0x01, 0x02,
-                  (byte)0xA1, 0x08,                 // keyvalue
-                    0x04, 0x06, 'k', 'e', 'y', 'v', 'a', 'l'
-            } );
-        
-        String decodedPdu = Strings.dumpBytes(stream.array());
+                ( byte ) 0xA0, 0x03, // keytype
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x08, // keyvalue
+                0x04,
+                0x06,
+                'k',
+                'e',
+                'y',
+                'v',
+                'a',
+                'l'
+        } );
+
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         EncryptionKeyContainer container = new EncryptionKeyContainer();
-        
+
         try
         {
             krbDecoder.decode( stream, container );
@@ -71,26 +83,26 @@ public class EncryptionKeyDecoderTest
         catch ( DecoderException de )
         {
             de.printStackTrace();
-            
+
             fail( de.getMessage() );
         }
 
         EncryptionKey encKey = container.getEncryptionKey();
-        
+
         assertEquals( EncryptionType.getTypeByValue( 2 ), encKey.getKeyType() );
-        assertTrue( Arrays.equals( Strings.getBytesUtf8("keyval"), encKey.getKeyValue() ) );
-        
+        assertTrue( Arrays.equals( Strings.getBytesUtf8( "keyval" ), encKey.getKeyValue() ) );
+
         ByteBuffer bb = ByteBuffer.allocate( encKey.computeLength() );
-        
+
         try
         {
             bb = encKey.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x11, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -98,164 +110,180 @@ public class EncryptionKeyDecoderTest
             fail();
         }
     }
-    
-    
-    @Test( expected = DecoderException.class )
+
+
+    @Test(expected = DecoderException.class)
     public void testDecodeEncryptionKeyWithEmptySeq() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x00
-            } );
-        
+        } );
+
         stream.flip();
 
         EncryptionKeyContainer container = new EncryptionKeyContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
-    
-    
-    @Test( expected = DecoderException.class )
+
+
+    @Test(expected = DecoderException.class)
     public void testDecodeEncryptionKeyEmptyKeyTypeTag() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x04 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x02,
-                  (byte)0xA0, 0x00
-            } );
-        
+                ( byte ) 0xA0, 0x00
+        } );
+
         stream.flip();
 
         EncryptionKeyContainer container = new EncryptionKeyContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
-    
-    
-    @Test( expected = DecoderException.class )
+
+
+    @Test(expected = DecoderException.class)
     public void testDecodeEncryptionKeyEmptyKeyTypeValue() 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();
 
         EncryptionKeyContainer container = new EncryptionKeyContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
-    
-    
-    @Test( expected = DecoderException.class )
+
+
+    @Test(expected = DecoderException.class)
     public void testDecodeEncryptionKeyWithoutType() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x0C );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x0A,
-                  (byte)0xA1, 0x08,                 // keyvalue
-                      0x04, 0x06, 'k', 'e', 'y', 'v', 'a', 'l'
-            } );
-        
+                ( byte ) 0xA1, 0x08, // keyvalue
+                0x04,
+                0x06,
+                'k',
+                'e',
+                'y',
+                'v',
+                'a',
+                'l'
+        } );
+
         stream.flip();
 
         EncryptionKeyContainer chkContainer = new EncryptionKeyContainer();
-        
+
         krbDecoder.decode( stream, chkContainer );
         fail();
     }
-    
-    
-    @Test( expected = DecoderException.class )
+
+
+    @Test(expected = DecoderException.class)
     public void testDecodeChecksumWithoutEncryptionKeyValue() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x07 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x05,
-                  (byte)0xA0, 0x03,                 // keytype
-                    0x02, 0x01, 0x02
-            } );
-        
+                ( byte ) 0xA0, 0x03, // keytype
+                0x02,
+                0x01,
+                0x02
+        } );
+
         stream.flip();
 
         EncryptionKeyContainer container = new EncryptionKeyContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
-    
-    
-    @Test( expected = DecoderException.class )
+
+
+    @Test(expected = DecoderException.class)
     public void testDecodeChecksumWitEmptyEncryptionKeyTag() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x09 );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x07,
-                  (byte)0xA0, 0x03,                 // keytype
-                    0x02, 0x01, 0x02,
-                  (byte)0xA1, 0x00
-            } );
-        
+                ( byte ) 0xA0, 0x03, // keytype
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x00
+        } );
+
         stream.flip();
 
         EncryptionKeyContainer container = new EncryptionKeyContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }
-    
-    
-    @Test( expected = DecoderException.class )
+
+
+    @Test(expected = DecoderException.class)
     public void testDecodeChecksumWitEmptyEncryptionKeyValue() throws DecoderException
     {
         Asn1Decoder krbDecoder = new Asn1Decoder();
-        
+
         ByteBuffer stream = ByteBuffer.allocate( 0x0B );
 
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x09,
-                  (byte)0xA0, 0x03,                 // keytype
-                    0x02, 0x01, 0x02,
-                  (byte)0xA1, 0x02,
-                    0x04, 0x00
-            } );
-        
+                ( byte ) 0xA0, 0x03, // keytype
+                0x02,
+                0x01,
+                0x02,
+                ( byte ) 0xA1,
+                0x02,
+                0x04,
+                0x00
+        } );
+
         stream.flip();
 
         EncryptionKeyContainer container = new EncryptionKeyContainer();
-        
+
         krbDecoder.decode( stream, container );
         fail();
     }

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/HostAddressDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/HostAddressDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/HostAddressDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/HostAddressDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -59,17 +59,32 @@ public class HostAddressDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x16 );
-        
+
         stream.put( new byte[]
-            { 
-              0x30, 0x14,
-                (byte)0xA0, 0x03,                 // addr-type
-                  0x02, 0x01, 0x02,               // IPV4
-                (byte)0xA1, 0x0D,                 // address : 192.168.0.1
-                  0x04, 0x0B, '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1'
-            } );
+            {
+                0x30, 0x14,
+                ( byte ) 0xA0, 0x03, // addr-type
+                0x02,
+                0x01,
+                0x02, // IPV4
+                ( byte ) 0xA1,
+                0x0D, // address : 192.168.0.1
+                0x04,
+                0x0B,
+                '1',
+                '9',
+                '2',
+                '.',
+                '1',
+                '6',
+                '8',
+                '.',
+                '0',
+                '.',
+                '1'
+        } );
 
-        String decodedPdu = Strings.dumpBytes(stream.array());
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a HostAddress Container
@@ -89,20 +104,20 @@ public class HostAddressDecoderTest
         HostAddress hostAddress = ( ( HostAddressContainer ) hostAddressContainer ).getHostAddress();
 
         assertEquals( HostAddrType.ADDRTYPE_INET, hostAddress.getAddrType() );
-        assertTrue( Arrays.equals( Strings.getBytesUtf8("192.168.0.1"), hostAddress.getAddress() ) );
+        assertTrue( Arrays.equals( Strings.getBytesUtf8( "192.168.0.1" ), hostAddress.getAddress() ) );
 
         // Check the encoding
         ByteBuffer bb = ByteBuffer.allocate( hostAddress.computeLength() );
-        
+
         try
         {
             bb = hostAddress.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x16, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -110,18 +125,18 @@ public class HostAddressDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a HostAddress with nothing in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testHostAddressEmpty() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x00 } );
 
@@ -134,23 +149,23 @@ public class HostAddressDecoderTest
         kerberosDecoder.decode( stream, hostAddressContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a HostAddress with no addr-type
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testHostAddressNoAddrType() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-        
+
         stream.put( new byte[]
-            { 
-              0x30, 0x02,
-                (byte)0xA0, 0x00                  // addr-type
-            } );
+            {
+                0x30, 0x02,
+                ( byte ) 0xA0, 0x00 // addr-type
+        } );
 
         stream.flip();
 
@@ -161,24 +176,25 @@ public class HostAddressDecoderTest
         kerberosDecoder.decode( stream, hostAddressContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a HostAddress with an empty addr-type
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testHostAddressEmptyAddrType() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x0B );
-        
+
         stream.put( new byte[]
-            { 
-              0x30, 0x04,
-                (byte)0xA0, 0x03,                 // addr-type
-                  0x02, 0x00                      // 
-            } );
+            {
+                0x30, 0x04,
+                ( byte ) 0xA0, 0x03, // addr-type
+                0x02,
+                0x00 // 
+        } );
 
         stream.flip();
 
@@ -189,24 +205,27 @@ public class HostAddressDecoderTest
         kerberosDecoder.decode( stream, hostAddressContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a HostAddress with no address
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testHostAddressNoAddress() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x09 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x07,
-                (byte)0xA0, 0x03,                 // addr-type
-                  0x02, 0x01, 0x02,               // 
-                (byte)0xA1, 0x00                  // address
-            } );
+                ( byte ) 0xA0, 0x03, // addr-type
+                0x02,
+                0x01,
+                0x02, // 
+                ( byte ) 0xA1,
+                0x00 // address
+        } );
 
         stream.flip();
 
@@ -217,25 +236,29 @@ public class HostAddressDecoderTest
         kerberosDecoder.decode( stream, hostAddressContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a HostAddress empty address
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testHostAddressEmptyAddress() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x0E );
-        
+
         stream.put( new byte[]
-        { 
-          0x30, 0x14,
-            (byte)0xA0, 0x03,                 // addr-type
-              0x02, 0x01, 0x02,               // IPV4
-            (byte)0xA1, 0x02,                 // address
-              0x04, 0x00
+            {
+                0x30, 0x14,
+                ( byte ) 0xA0, 0x03, // addr-type
+                0x02,
+                0x01,
+                0x02, // IPV4
+                ( byte ) 0xA1,
+                0x02, // address
+                0x04,
+                0x00
         } );
 
         stream.flip();
@@ -247,23 +270,35 @@ public class HostAddressDecoderTest
         kerberosDecoder.decode( stream, hostAddressContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a HostAddress with no add-type
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testHostAddressMissingAddrType() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x11 );
-        
+
         stream.put( new byte[]
-        { 
-            0x30, 0x0F,
-              (byte)0xA1, 0x0D,                 // address : 192.168.0.1
-                0x04, 0x0B, '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1'
+            {
+                0x30, 0x0F,
+                ( byte ) 0xA1, 0x0D, // address : 192.168.0.1
+                0x04,
+                0x0B,
+                '1',
+                '9',
+                '2',
+                '.',
+                '1',
+                '6',
+                '8',
+                '.',
+                '0',
+                '.',
+                '1'
         } );
 
         stream.flip();
@@ -275,24 +310,26 @@ public class HostAddressDecoderTest
         kerberosDecoder.decode( stream, hostAddressContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a HostAddress with no adddress
      */
-    @Test( expected = DecoderException.class )
+    @Test(expected = DecoderException.class)
     public void testHostAddressMissingAddress() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x07 );
-        
+
         stream.put( new byte[]
-        { 
-            0x30, 0x05,
-              (byte)0xA0, 0x03,                 // addr-type
-                0x02, 0x01, 0x02,               // IPV4
-        } );
+            {
+                0x30, 0x05,
+                ( byte ) 0xA0, 0x03, // addr-type
+                0x02,
+                0x01,
+                0x02, // IPV4
+            } );
 
         stream.flip();
 

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/HostAddressesDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/HostAddressesDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/HostAddressesDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/HostAddressesDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -61,28 +61,77 @@ public class HostAddressesDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x44 );
-        
+
         stream.put( new byte[]
-            { 
-              0x30, 0x42,
-                0x30, 0x14,
-                  (byte)0xA0, 0x03,                 // addr-type
-                    0x02, 0x01, 0x02,               // IPV4
-                  (byte)0xA1, 0x0D,                 // address : 192.168.0.1
-                    0x04, 0x0B, '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '1',
+            {
+                0x30, 0x42,
                 0x30, 0x14,
-                  (byte)0xA0, 0x03,                 // addr-type
-                    0x02, 0x01, 0x02,               // IPV4
-                  (byte)0xA1, 0x0D,                 // address : 192.168.0.2
-                    0x04, 0x0B, '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '2',
-                0x30, 0x14,
-                  (byte)0xA0, 0x03,                 // addr-type
-                    0x02, 0x01, 0x02,               // IPV4
-                  (byte)0xA1, 0x0D,                 // address : 192.168.0.3
-                    0x04, 0x0B, '1', '9', '2', '.', '1', '6', '8', '.', '0', '.', '3'
-            } );
+                ( byte ) 0xA0, 0x03, // addr-type
+                0x02,
+                0x01,
+                0x02, // IPV4
+                ( byte ) 0xA1,
+                0x0D, // address : 192.168.0.1
+                0x04,
+                0x0B,
+                '1',
+                '9',
+                '2',
+                '.',
+                '1',
+                '6',
+                '8',
+                '.',
+                '0',
+                '.',
+                '1',
+                0x30,
+                0x14,
+                ( byte ) 0xA0,
+                0x03, // addr-type
+                0x02,
+                0x01,
+                0x02, // IPV4
+                ( byte ) 0xA1,
+                0x0D, // address : 192.168.0.2
+                0x04,
+                0x0B,
+                '1',
+                '9',
+                '2',
+                '.',
+                '1',
+                '6',
+                '8',
+                '.',
+                '0',
+                '.',
+                '2',
+                0x30,
+                0x14,
+                ( byte ) 0xA0,
+                0x03, // addr-type
+                0x02,
+                0x01,
+                0x02, // IPV4
+                ( byte ) 0xA1,
+                0x0D, // address : 192.168.0.3
+                0x04,
+                0x0B,
+                '1',
+                '9',
+                '2',
+                '.',
+                '1',
+                '6',
+                '8',
+                '.',
+                '0',
+                '.',
+                '3'
+        } );
 
-        String decodedPdu = Strings.dumpBytes(stream.array());
+        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a HostAddresses Container
@@ -103,29 +152,30 @@ public class HostAddressesDecoderTest
         HostAddresses hostAddresses = ( ( HostAddressesContainer ) hostAddressesContainer ).getHostAddresses();
 
         assertEquals( 3, hostAddresses.getAddresses().length );
-        
-        String[] expected = new String[]{ "192.168.0.1", "192.168.0.2", "192.168.0.3" };
+
+        String[] expected = new String[]
+            { "192.168.0.1", "192.168.0.2", "192.168.0.3" };
         int i = 0;
-        
+
         for ( HostAddress hostAddress : hostAddresses.getAddresses() )
         {
             assertEquals( HostAddrType.ADDRTYPE_INET, hostAddress.getAddrType() );
-            assertTrue( Arrays.equals( Strings.getBytesUtf8(expected[i]), hostAddress.getAddress() ) );
+            assertTrue( Arrays.equals( Strings.getBytesUtf8( expected[i] ), hostAddress.getAddress() ) );
             i++;
         }
 
         // Check the encoding
         ByteBuffer bb = ByteBuffer.allocate( hostAddresses.computeLength() );
-        
+
         try
         {
             bb = hostAddresses.encode( bb );
-    
+
             // Check the length
             assertEquals( 0x44, bb.limit() );
-    
-            String encodedPdu = Strings.dumpBytes(bb.array());
-    
+
+            String encodedPdu = Strings.dumpBytes( bb.array() );
+
             assertEquals( encodedPdu, decodedPdu );
         }
         catch ( EncoderException ee )
@@ -133,18 +183,18 @@ public class HostAddressesDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a HostAddresses with nothing in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testHostAddressEmpty() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x00 } );
 
@@ -157,22 +207,22 @@ public class HostAddressesDecoderTest
         kerberosDecoder.decode( stream, hostAddressesContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a HostAddresses with empty hostAddress in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testHostAddressesNoHostAddress() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x02,
-                (byte)0x30, 0x00                  // empty HostAddress
-            } );
+                ( byte ) 0x30, 0x00 // empty HostAddress
+        } );
 
         stream.flip();
 

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcRepDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcRepDecoderTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcRepDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/KdcRepDecoderTest.java Tue Jan 24 16:15:05 2012
@@ -55,73 +55,183 @@ public class KdcRepDecoderTest
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0xA9 );
-        
+
         stream.put( new byte[]
-        {
-            0x30, (byte)0x81, (byte)0xA6,
-              (byte)0xA0, 0x03,                         // PVNO
-                0x02, 0x01, 0x05,
-              (byte)0xA1, 0x03,                         // msg-type
-                0x02, 0x01, 0x0B,
-              (byte)0xA2, 0x20,                         // PA-DATA
-                0x30, 0x1E,
-                  0x30, 0x0D,
-                    (byte)0xA1,0x03,
-                      0x02, 0x01, 01,
-                    (byte)0xA2, 0x06,
-                      0x04, 0x04, 'a', 'b', 'c', 'd',
-                  0x30, 0x0D,
-                    (byte)0xA1,0x03,
-                      0x02, 0x01, 01,
-                    (byte)0xA2, 0x06,
-                      0x04, 0x04, 'e', 'f', 'g', 'h',
-              (byte)0xA3, 0x0D,                         // crealm
-                0x1B, 0x0B, 'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M',
-              (byte)0xA4, 0x14,                         // cname
-                0x30, 0x12,
-                  (byte)0xA0, 0x03,                     // name-type
-                    0x02, 0x01, 0x01,
-                  (byte)0xA1, 0x0B,                     // name-string
-                    0x30, 0x09,
-                      0x1B, 0x07, 'h', 'n', 'e', 'l', 's', 'o', 'n',
-              (byte)0xA5, 0x40,                         // Ticket
-                0x61, 0x3E, 
-                  0x30, 0x3C, 
-                    (byte)0xA0, 0x03, 
-                      0x02, 0x01, 0x05, 
-                    (byte)0xA1, 0x0D, 
-                      0x1B, 0x0B, 
-                        'E', 'X', 'A', 'M', 'P', 'L', 'E', '.', 'C', 'O', 'M', 
-                    (byte)0xA2, 0x13, 
-                      0x30, 0x11, 
-                        (byte)0xA0, 0x03, 
-                          0x02, 0x01, 0x01, 
-                        (byte)0xA1, 0x0A, 
-                          0x30, 0x08, 
-                            0x1B, 0x06, 
-                              'c', 'l', 'i', 'e', 'n', 't', 
-                    (byte)0xA3, 0x11, 
-                      0x30, 0x0F, 
-                        (byte)0xA0, 0x03, 
-                          0x02, 0x01, 0x11, 
-                        (byte)0xA2, 0x08, 
-                          0x04, 0x06, 
-                            'a', 'b', 'c', 'd', 'e', 'f', 
-              (byte)0xA6, 0x11,                         // enc-part
-                0x30, 0x0F, 
-                  (byte)0xA0, 0x03, 
-                    0x02, 0x01, 0x11, 
-                  (byte)0xA2, 0x08, 
-                    0x04, 0x06, 
-                      'a', 'b', 'c', 'd', 'e', 'f', 
-        });
+            {
+                0x30, ( byte ) 0x81, ( byte ) 0xA6,
+                ( byte ) 0xA0, 0x03, // PVNO
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x03, // msg-type
+                0x02,
+                0x01,
+                0x0B,
+                ( byte ) 0xA2,
+                0x20, // PA-DATA
+                0x30,
+                0x1E,
+                0x30,
+                0x0D,
+                ( byte ) 0xA1,
+                0x03,
+                0x02,
+                0x01,
+                01,
+                ( byte ) 0xA2,
+                0x06,
+                0x04,
+                0x04,
+                'a',
+                'b',
+                'c',
+                'd',
+                0x30,
+                0x0D,
+                ( byte ) 0xA1,
+                0x03,
+                0x02,
+                0x01,
+                01,
+                ( byte ) 0xA2,
+                0x06,
+                0x04,
+                0x04,
+                'e',
+                'f',
+                'g',
+                'h',
+                ( byte ) 0xA3,
+                0x0D, // crealm
+                0x1B,
+                0x0B,
+                'E',
+                'X',
+                'A',
+                'M',
+                'P',
+                'L',
+                'E',
+                '.',
+                'C',
+                'O',
+                'M',
+                ( byte ) 0xA4,
+                0x14, // cname
+                0x30,
+                0x12,
+                ( byte ) 0xA0,
+                0x03, // name-type
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA1,
+                0x0B, // name-string
+                0x30,
+                0x09,
+                0x1B,
+                0x07,
+                'h',
+                'n',
+                'e',
+                'l',
+                's',
+                'o',
+                'n',
+                ( byte ) 0xA5,
+                0x40, // Ticket
+                0x61,
+                0x3E,
+                0x30,
+                0x3C,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x05,
+                ( byte ) 0xA1,
+                0x0D,
+                0x1B,
+                0x0B,
+                'E',
+                'X',
+                'A',
+                'M',
+                'P',
+                'L',
+                'E',
+                '.',
+                'C',
+                'O',
+                'M',
+                ( byte ) 0xA2,
+                0x13,
+                0x30,
+                0x11,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x01,
+                ( byte ) 0xA1,
+                0x0A,
+                0x30,
+                0x08,
+                0x1B,
+                0x06,
+                'c',
+                'l',
+                'i',
+                'e',
+                'n',
+                't',
+                ( byte ) 0xA3,
+                0x11,
+                0x30,
+                0x0F,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x11,
+                ( byte ) 0xA2,
+                0x08,
+                0x04,
+                0x06,
+                'a',
+                'b',
+                'c',
+                'd',
+                'e',
+                'f',
+                ( byte ) 0xA6,
+                0x11, // enc-part
+                0x30,
+                0x0F,
+                ( byte ) 0xA0,
+                0x03,
+                0x02,
+                0x01,
+                0x11,
+                ( byte ) 0xA2,
+                0x08,
+                0x04,
+                0x06,
+                'a',
+                'b',
+                'c',
+                'd',
+                'e',
+                'f',
+        } );
 
         stream.flip();
 
         // Allocate a KdcRep Container
         KdcRepContainer kdcRepContainer = new KdcRepContainer( stream );
         kdcRepContainer.setKdcRep( new AsRep() );
-        
+
         // Decode the KdcRep PDU
         try
         {
@@ -133,20 +243,20 @@ public class KdcRepDecoderTest
         }
 
         KdcRep kdcRep = kdcRepContainer.getKdcRep();
-        
+
         // Check the encoding
         int length = kdcRep.computeLength();
 
         // Check the length, should be 3 bytes longer as the kdcRep is a AS-REP
         assertEquals( 0xAC, length );
-        
+
         // Check the encoding
         ByteBuffer encodedPdu = ByteBuffer.allocate( length );
-        
+
         try
         {
             encodedPdu = kdcRep.encode( encodedPdu );
-            
+
             // Check the length
             assertEquals( 0xAC, encodedPdu.limit() );
         }
@@ -155,18 +265,18 @@ public class KdcRepDecoderTest
             fail();
         }
     }
-    
-    
+
+
     /**
      * Test the decoding of a KDC-REP with nothing in it
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testKdcRepEmpty() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x02 );
-        
+
         stream.put( new byte[]
             { 0x30, 0x00 } );
 
@@ -179,23 +289,23 @@ public class KdcRepDecoderTest
         kerberosDecoder.decode( stream, kdcRepContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a KDC-REP with empty Pvno tag
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testKdcRepEmptyPvnoTag() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = new Asn1Decoder();
 
         ByteBuffer stream = ByteBuffer.allocate( 0x04 );
-        
+
         stream.put( new byte[]
-            { 
+            {
                 0x30, 0x02,
-                  (byte)0xA0, 0x00
-            } );
+                ( byte ) 0xA0, 0x00
+        } );
 
         stream.flip();
 
@@ -206,24 +316,24 @@ public class KdcRepDecoderTest
         kerberosDecoder.decode( stream, kdcRepContainer );
         fail();
     }
-    
-    
+
+
     /**
      * Test the decoding of a KDC-REP with empty Pvno value
      */
-    @Test( expected = DecoderException.class)
+    @Test(expected = DecoderException.class)
     public void testKdcRepEmptyPvnoValue() throws DecoderException
     {
         Asn1Decoder kerberosDecoder = 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();
 



Mime
View raw message