directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r169731 - /directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/spnego/codec/SpnegoTest.java
Date Wed, 11 May 2005 23:40:27 GMT
Author: elecharny
Date: Wed May 11 16:40:27 2005
New Revision: 169731

URL: http://svn.apache.org/viewcvs?rev=169731&view=rev
Log:
- Changed the call from oid.getOID() to oid.toString()
- added a SPNEGO encoding test

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/spnego/codec/SpnegoTest.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/spnego/codec/SpnegoTest.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/spnego/codec/SpnegoTest.java?rev=169731&r1=169730&r2=169731&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/spnego/codec/SpnegoTest.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/test/org/apache/asn1/spnego/codec/SpnegoTest.java
Wed May 11 16:40:27 2005
@@ -21,6 +21,7 @@
 import org.apache.asn1.DecoderException;
 import org.apache.asn1.ber.Asn1Decoder;
 import org.apache.asn1.ber.containers.IAsn1Container;
+import org.apache.asn1.codec.EncoderException;
 import org.apache.asn1.primitives.OID;
 import org.apache.asn1.primitives.OctetString;
 import org.apache.asn1.spnego.pojo.SpnegoNegTokenInitPOJO;
@@ -200,7 +201,7 @@
         }
         
         Assert.assertEquals(1, nbOids);
-        Assert.assertEquals("1.2.840.48018.1.2.2", oids[0].getOID());
+        Assert.assertEquals("1.2.840.48018.1.2.2", oids[0].toString());
         
         // Check the reqFlags
         Assert.assertTrue(checkDefaultReqFlags((SpnegoNegTokenInitPOJO)spnego));
@@ -292,7 +293,7 @@
 
         for ( int i = 0 ; i < nbOids ; i++ )
         {
-            Assert.assertEquals("1.2.840.48018.1.2.2", oids[i].getOID());
+            Assert.assertEquals("1.2.840.48018.1.2.2", oids[i].toString());
         }
         
         // Check the reqFlags
@@ -382,7 +383,7 @@
 
         for ( int i = 0 ; i < nbOids ; i++ )
         {
-            Assert.assertEquals("1.2.840.48018.1.2." + i, oids[i].getOID());
+            Assert.assertEquals("1.2.840.48018.1.2." + i, oids[i].toString());
         }
         
         // Check the reqFlags
@@ -965,8 +966,8 @@
         }
         
         Assert.assertEquals(2, nbOids);
-        Assert.assertEquals("1.2.840.48018.1.2.2", oids[0].getOID());
-        Assert.assertEquals("1.2.840.113554.1.2.2", oids[1].getOID());
+        Assert.assertEquals("1.2.840.48018.1.2.2", oids[0].toString());
+        Assert.assertEquals("1.2.840.113554.1.2.2", oids[1].toString());
         
         // Check the reqFlags
         Assert.assertTrue(checkDefaultReqFlags((SpnegoNegTokenInitPOJO)spnego));
@@ -1066,8 +1067,8 @@
         }
         
         Assert.assertEquals(2, nbOids);
-        Assert.assertEquals("1.2.840.48018.1.2.2", oids[0].getOID());
-        Assert.assertEquals("1.2.840.113554.1.2.2", oids[1].getOID());
+        Assert.assertEquals("1.2.840.48018.1.2.2", oids[0].toString());
+        Assert.assertEquals("1.2.840.113554.1.2.2", oids[1].toString());
         
         // Check the reqFlags
         Assert.assertEquals(false, ((SpnegoNegTokenInitPOJO)spnego).isAnonFlag());
@@ -1090,6 +1091,27 @@
         // Check the mechListMIC
         Assert.assertEquals("[61][62][63][64][65][66][67][68][69][6A][6B][6C]", ((SpnegoNegTokenInitPOJO)spnego).getMechListMIC().toString());
 
+        try
+        {
+            ByteBuffer res = (ByteBuffer)((SpnegoNegTokenInitPOJO)spnego).encode(this);
+            stream.flip();
+            res.flip();
+            
+            for (int i = 0; i < stream.capacity(); i++)
+            {
+                if (stream.get() != res.get() )
+                {
+                    System.out.println("Error pos " + i);
+                }
+            }
+            
+            res.flip();
+        }
+        catch (EncoderException ee)
+        {
+            
+        }
+        
         // Free the BindRequest Container. It will be put back in the IPool
         // after being reset.
         spnegoContainer.free();
@@ -1168,7 +1190,7 @@
         
         // Check the supported mech
         OID supportedMech = spnego.getSupportedMech();
-        Assert.assertEquals("1.2.840.48018.1.2.2", supportedMech.getOID());
+        Assert.assertEquals("1.2.840.48018.1.2.2", supportedMech.toString());
         
         // Check the responseToken
         OctetString responseToken = spnego.getResponseToken();



Mime
View raw message