You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/11/10 19:31:33 UTC

svn commit: r1033633 - /directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java

Author: kayyagari
Date: Wed Nov 10 18:31:32 2010
New Revision: 1033633

URL: http://svn.apache.org/viewvc?rev=1033633&view=rev
Log:
o added two more test cases

Modified:
    directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java

Modified: directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java?rev=1033633&r1=1033632&r2=1033633&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/test/java/org/apache/directory/shared/kerberos/codec/AuthorizationDataDecoderTest.java Wed Nov 10 18:31:32 2010
@@ -181,4 +181,54 @@ public class AuthorizationDataDecoderTes
         fail();
     }
 
+    
+    @Test( expected = DecoderException.class)
+    public void testAuthorizationDataWithEmptyData() throws DecoderException
+    {
+        Asn1Decoder kerberosDecoder = new Asn1Decoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0xB );
+        
+        stream.put( new byte[]
+            { 
+                0x30, 0x09,
+                  (byte)0xA0, 0x03,                 // ad-type
+                    0x02, 0x01, 0x02,
+                  (byte)0xA1, 0x02,                 // ad-data
+                    0x04, 0x00
+            } );
+
+        stream.flip();
+
+        AuthorizationDataContainer authDataContainer = new AuthorizationDataContainer();
+        
+        kerberosDecoder.decode( stream, authDataContainer );
+        fail();
+    }
+
+    
+    @Test( expected = DecoderException.class)
+    public void testAuthorizationDataWithEmptyType() throws DecoderException
+    {
+        Asn1Decoder kerberosDecoder = new Asn1Decoder();
+
+        ByteBuffer stream = ByteBuffer.allocate( 0xB );
+        
+        stream.put( new byte[]
+            { 
+                0x30, 0x09,
+                  (byte)0xA0, 0x02,                 // ad-type
+                    0x02, 0x00,
+                  (byte)0xA1, 0x03,                 // ad-data
+                    0x04, 0x01, 0x02
+            } );
+
+        stream.flip();
+
+        AuthorizationDataContainer authDataContainer = new AuthorizationDataContainer();
+        
+        kerberosDecoder.decode( stream, authDataContainer );
+        fail();
+    }
+
 }