directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r809948 - in /directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared: crypto/encryption/ keytab/ messages/components/ messages/value/
Date Tue, 01 Sep 2009 10:01:10 GMT
Author: elecharny
Date: Tue Sep  1 10:01:09 2009
New Revision: 809948

URL: http://svn.apache.org/viewvc?rev=809948&view=rev
Log:
Removed the Junit 3.8 constructs and replaced them with 4.5

Modified:
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesEncryptionTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandlerTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryptionTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryptionTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5EncryptionTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKeyTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactoryTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KeyTypeTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NFoldTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactoryTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/keytab/KeytabTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/components/TicketTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataTest.java
    directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/ChecksumTest.java

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesEncryptionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesEncryptionTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesEncryptionTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/AesEncryptionTest.java
Tue Sep  1 10:01:09 2009
@@ -29,8 +29,10 @@
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Tests the use of AES for Kerberos, using test vectors from RFC 3962,
@@ -39,7 +41,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class AesEncryptionTest extends TestCase
+public class AesEncryptionTest
 {
     private byte[] keyBytes =
         { ( byte ) 0x63, ( byte ) 0x68, ( byte ) 0x69, ( byte ) 0x63, ( byte ) 0x6b, ( byte
) 0x65, ( byte ) 0x6e,
@@ -60,6 +62,7 @@
      * Tests the first test vector from RFC 3962,
      * "Advanced Encryption Standard (AES) Encryption for Kerberos 5."
      */
+    @Test
     public void testFirstAesVector()
     {
         if ( !VendorHelper.isCtsSupported() )
@@ -88,6 +91,7 @@
      * Tests the last test vector from RFC 3962,
      * "Advanced Encryption Standard (AES) Encryption for Kerberos 5."
      */
+    @Test
     public void testLastAesVector()
     {
         if ( !VendorHelper.isCtsSupported() )

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandlerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandlerTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandlerTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/CipherTextHandlerTest.java
Tue Sep  1 10:01:09 2009
@@ -28,13 +28,14 @@
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import junit.framework.TestCase;
-
 import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 
 /**
@@ -43,7 +44,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class CipherTextHandlerTest extends TestCase
+public class CipherTextHandlerTest
 {
     private byte[] desEncryptedTimeStamp =
         { ( byte ) 0x97, ( byte ) 0x21, ( byte ) 0x58, ( byte ) 0x5f, ( byte ) 0x81, ( byte
) 0x46, ( byte ) 0x17,
@@ -111,6 +112,7 @@
      * of the supported encryption types.  The length of the Kerberos Cipher Text
      * is relevant to the structure of the underlying plaintext.
      */
+    @Test
     public void testTestVectorLengths()
     {
         assertEquals( "DES length", 56, desEncryptedTimeStamp.length );
@@ -126,6 +128,7 @@
      * an integrity check, an attempt is made to decode the bytes as an EncryptedTimestamp.
 The
      * result is timestamp data.
      */
+    @Test
     public void testDesGoodPasswordDecrypt()
     {
         CipherTextHandler lockBox = new CipherTextHandler();
@@ -152,6 +155,7 @@
      * Tests the unsealing of Kerberos CipherText with a bad password.  After decryption,
the
      * checksum is tested and should fail on comparison, resulting in an integrity check
error.
      */
+    @Test
     public void testDesBadPasswordDecrypt()
     {
         CipherTextHandler lockBox = new CipherTextHandler();
@@ -178,6 +182,7 @@
      * an integrity check, an attempt is made to decode the bytes as an EncryptedTimestamp.
 The
      * result is timestamp data.
      */
+    @Test
     public void testTripleDesGoodPasswordDecrypt()
     {
         CipherTextHandler lockBox = new CipherTextHandler();
@@ -208,6 +213,7 @@
      * 
      * @throws ParseException 
      */
+    @Test
     public void testTripleDesGoodPasswordEncrypt() throws ParseException
     {
         CipherTextHandler lockBox = new CipherTextHandler();
@@ -252,6 +258,7 @@
      * an integrity check, an attempt is made to decode the bytes as an EncryptedTimestamp.
 The
      * result is timestamp data.
      */
+    @Test
     public void testAes128GoodPasswordDecrypt()
     {
         if ( !VendorHelper.isCtsSupported() )
@@ -286,6 +293,7 @@
      * 
      * @throws ParseException 
      */
+    @Test
     public void testAes128GoodPasswordEncrypt() throws ParseException
     {
         if ( !VendorHelper.isCtsSupported() )
@@ -334,6 +342,7 @@
      * an integrity check, an attempt is made to decode the bytes as an EncryptedTimestamp.
 The
      * result is timestamp data.
      */
+    @Test
     public void testAes256GoodPasswordDecrypt()
     {
         if ( !VendorHelper.isCtsSupported() )
@@ -380,6 +389,7 @@
      * 
      * @throws ParseException 
      */
+    @Test
     public void testAes256GoodPasswordEncrypt() throws ParseException
     {
         if ( !VendorHelper.isCtsSupported() )

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryptionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryptionTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryptionTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/Des3CbcSha1KdEncryptionTest.java
Tue Sep  1 10:01:09 2009
@@ -25,7 +25,9 @@
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -35,7 +37,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class Des3CbcSha1KdEncryptionTest extends TestCase
+public class Des3CbcSha1KdEncryptionTest
 {
     private Des3CbcSha1KdEncryption keyDerivationFunction = new Des3CbcSha1KdEncryption();
 
@@ -43,6 +45,7 @@
     /**
      * Tests setting parity as defined in RFC 3961.
      */
+    @Test
     public void testParity()
     {
         byte[] test =
@@ -60,6 +63,7 @@
     /**
      * Tests 'deriveRandom' and 'randomToKey' functions. 
      */
+    @Test
     public void testDerivedKey()
     {
         byte[] key =
@@ -94,6 +98,7 @@
     /**
      * Tests 'deriveRandom' and 'randomToKey' functions. 
      */
+    @Test
     public void testDerivedKey2()
     {
         byte[] key =
@@ -128,6 +133,7 @@
     /**
      * Tests that key derivation can be performed for a Triple-DES key.
      */
+    @Test
     public void testTestVectorsTripleDesKerberosKey1()
     {
         byte[] expectedKey =
@@ -148,6 +154,7 @@
     /**
      * Tests that key derivation can be performed for a Triple-DES key.
      */
+    @Test
     public void testTestVectorsTripleDesKerberosKey2()
     {
         byte[] expectedKey =
@@ -168,6 +175,7 @@
     /**
      * Tests that key derivation can be performed for a Triple-DES key.
      */
+    @Test
     public void testTestVectorsTripleDesKerberosKey3()
     {
         byte[] expectedKey =
@@ -188,6 +196,7 @@
     /**
      * Tests that key derivation can be performed for a Triple-DES key.
      */
+    @Test
     public void testTestVectorsTripleDesKerberosKey4()
     {
         if ( VendorHelper.isIbm() )
@@ -213,6 +222,7 @@
     /**
      * Tests that key derivation can be performed for a Triple-DES key.
      */
+    @Test
     public void testTestVectorsTripleDesKerberosKey5()
     {
         if ( VendorHelper.isIbm() )

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryptionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryptionTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryptionTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcCrcEncryptionTest.java
Tue Sep  1 10:01:09 2009
@@ -23,10 +23,10 @@
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import junit.framework.TestCase;
-
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -35,7 +35,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DesCbcCrcEncryptionTest extends TestCase
+public class DesCbcCrcEncryptionTest
 {
     private static final char[] PASSWORD = "password".toCharArray();
 
@@ -45,6 +45,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testPlainTextSizeLessThanBlockSize() throws Exception
     {
         KerberosKey key = new KerberosKey( new KerberosPrincipal( "hnelson@EXAMPLE.COM" ),
PASSWORD, "DES" );
@@ -68,6 +69,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testPlainTextSizeEqualsBlockSize() throws Exception
     {
         KerberosKey key = new KerberosKey( new KerberosPrincipal( "hnelson@EXAMPLE.COM" ),
PASSWORD, "DES" );
@@ -91,6 +93,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testPlainTextSizeGreaterThanBlockSize() throws Exception
     {
         KerberosKey key = new KerberosKey( new KerberosPrincipal( "hnelson@EXAMPLE.COM" ),
PASSWORD, "DES" );

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5EncryptionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5EncryptionTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5EncryptionTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesCbcMd5EncryptionTest.java
Tue Sep  1 10:01:09 2009
@@ -23,10 +23,10 @@
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import junit.framework.TestCase;
-
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -35,7 +35,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DesCbcMd5EncryptionTest extends TestCase
+public class DesCbcMd5EncryptionTest
 {
     private static final char[] PASSWORD = "password".toCharArray();
 
@@ -45,6 +45,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testPlainTextSizeLessThanBlockSize() throws Exception
     {
         KerberosKey key = new KerberosKey( new KerberosPrincipal( "hnelson@EXAMPLE.COM" ),
PASSWORD, "DES" );
@@ -68,6 +69,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testPlainTextSizeEqualsBlockSize() throws Exception
     {
         KerberosKey key = new KerberosKey( new KerberosPrincipal( "hnelson@EXAMPLE.COM" ),
PASSWORD, "DES" );
@@ -91,6 +93,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testPlainTextSizeGreaterThanBlockSize() throws Exception
     {
         KerberosKey key = new KerberosKey( new KerberosPrincipal( "hnelson@EXAMPLE.COM" ),
PASSWORD, "DES" );

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKeyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKeyTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKeyTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKeyTest.java
Tue Sep  1 10:01:09 2009
@@ -25,7 +25,9 @@
 
 import javax.crypto.spec.DESKeySpec;
 
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -35,7 +37,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DesStringToKeyTest extends TestCase
+public class DesStringToKeyTest
 {
     private byte[] fanFold1 =
         { ( byte ) 0xC0, ( byte ) 0x1E, ( byte ) 0x38, ( byte ) 0x68, ( byte ) 0x8A, ( byte
) 0xC8, ( byte ) 0x6C,
@@ -63,6 +65,7 @@
     /**
      * Tests DES StringToKey test vector 1 from RFC 3961.
      */
+    @Test
     public void testDesStringToKeyVector1()
     {
         byte[] key = stringToKey.getKey( "password", "ATHENA.MIT.EDU", "raeburn" );
@@ -74,6 +77,7 @@
     /**
      * Tests DES StringToKey test vector 2 from RFC 3961.
      */
+    @Test
     public void testDesStringToKeyVector2()
     {
         byte[] key = stringToKey.getKey( "potatoe", "WHITEHOUSE.GOV", "danny" );
@@ -87,6 +91,7 @@
      *
      * @throws InvalidKeyException
      */
+    @Test
     public void testIntermediateDesStringToKeyVector1() throws InvalidKeyException
     {
         String passPhrase = "passwordATHENA.MIT.EDUraeburn";
@@ -110,6 +115,7 @@
      * 
      * @throws InvalidKeyException
      */
+    @Test
     public void testIntermediateDesStringToKeyVector2() throws InvalidKeyException
     {
         String passPhrase = "potatoeWHITEHOUSE.GOVdanny";
@@ -137,6 +143,7 @@
      * @return The final DES key.
      * @throws InvalidKeyException
      */
+    @Test
     private byte[] getDesKey( byte[] paddedByteArray, byte[] intermediateKey ) throws InvalidKeyException
     {
         if ( DESKeySpec.isWeak( intermediateKey, 0 ) )

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactoryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactoryTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactoryTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactoryTest.java
Tue Sep  1 10:01:09 2009
@@ -28,9 +28,10 @@
 import javax.security.auth.kerberos.KerberosKey;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
-import junit.framework.TestCase;
-
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -40,11 +41,12 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class KerberosKeyFactoryTest extends TestCase
+public class KerberosKeyFactoryTest
 {
     /**
      * Tests that key derivation can be performed for a DES key.
      */
+    @Test
     public void testDesKerberosKey()
     {
         KerberosPrincipal principal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
@@ -57,6 +59,7 @@
     /**
      * Tests that key derivation can be performed for a Triple-DES key.
      */
+    @Test
     public void testTripleDesKerberosKey()
     {
         KerberosPrincipal principal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
@@ -70,6 +73,7 @@
     /**
      * Tests that key derivation can be performed for an RC4-HMAC key.
      */
+    @Test
     public void testArcFourHmacKerberosKey()
     {
         if ( !VendorHelper.isArcFourHmacSupported() )
@@ -89,6 +93,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testAes128KerberosKey() throws Exception
     {
         KerberosPrincipal principal = new KerberosPrincipal( "hnelson@EXAMPLE.COM" );
@@ -101,6 +106,7 @@
     /**
      * Tests that key derivation can be performed for an AES-256 key.
      */
+    @Test
     public void testAes256KerberosKey()
     {
         try
@@ -119,6 +125,7 @@
     /**
      * Tests that key derivation can be performed by the factory for the des-cbc-md5 encryption
type.
      */
+    @Test
     public void testKerberosKeyFactoryOnlyDes()
     {
         String principalName = "hnelson@EXAMPLE.COM";
@@ -150,6 +157,7 @@
     /**
      * Tests that key derivation can be performed by the factory for the des3-cbc-sha1-kd
encryption type.
      */
+    @Test
     public void testKerberosKeyFactoryOnlyTripleDes()
     {
         if ( !VendorHelper.isTripleDesSupported() )
@@ -188,6 +196,7 @@
     /**
      * Tests that key derivation can be performed by the factory for the rc4-hmac encryption
type.
      */
+    @Test
     public void testKerberosKeyFactoryOnlyArcFourHmac()
     {
         if ( !VendorHelper.isArcFourHmacSupported() )
@@ -225,6 +234,7 @@
     /**
      * Tests that key derivation can be performed by the factory for the aes128-cts-hmac-sha1-96
encryption type.
      */
+    @Test
     public void testKerberosKeyFactoryOnlyAes128()
     {
         if ( VendorHelper.isIbm() )
@@ -263,6 +273,7 @@
     /**
      * Tests that key derivation can be performed by the factory for the aes256-cts-hmac-sha1-96
encryption type.
      */
+    @Test
     public void testKerberosKeyFactoryOnlyAes256()
     {
         if ( VendorHelper.isIbm() )
@@ -306,6 +317,7 @@
     /**
      * Tests that key derivation can be performed by the factory for multiple encryption
types.
      */
+    @Test
     public void testKerberosKeyFactory()
     {
         if ( VendorHelper.isIbm() )

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KeyTypeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KeyTypeTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KeyTypeTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KeyTypeTest.java
Tue Sep  1 10:01:09 2009
@@ -26,7 +26,6 @@
 import java.security.Security;
 import java.util.Arrays;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -37,8 +36,10 @@
 import javax.crypto.SecretKeyFactory;
 import javax.crypto.spec.DESKeySpec;
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Test cases for the encryption types used by Kerberos "5.2" per RFC 4120,
@@ -58,16 +59,17 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class KeyTypeTest extends TestCase
+public class KeyTypeTest
 {
     /**
      * Tests that the cipher types used by Kerberos exist, namely
      * DES, DESede, RC4, and AES.
      */
+    @Test
     public void testKeyTypes()
     {
         String[] names = getCryptoImpls( "Cipher" );
-        List ciphers = Arrays.asList( names );
+        List<String> ciphers = Arrays.asList( names );
 
         assertTrue( ciphers.contains( "DES" ) );
         assertTrue( ciphers.contains( "DESede" ) );
@@ -82,10 +84,11 @@
      * Tests that the message digest types used by Kerberos exist, namely
      * SHA1 and MD5.
      */
+    @Test
     public void testMessageDigestTypes()
     {
         String[] names = getCryptoImpls( "MessageDigest" );
-        List ciphers = Arrays.asList( names );
+        List<String> ciphers = Arrays.asList( names );
 
         assertTrue( ciphers.contains( "MD5" ) );
         assertTrue( ciphers.contains( "SHA1" ) );
@@ -96,10 +99,11 @@
      * Tests that the MAC types used by Kerberos exist, namely
      * HmacMD5 and HmacSHA1.
      */
+    @Test
     public void testMacTypes()
     {
         String[] names = getCryptoImpls( "Mac" );
-        List ciphers = Arrays.asList( names );
+        List<String> ciphers = Arrays.asList( names );
 
         assertTrue( ciphers.contains( "HmacMD5" ) );
         assertTrue( ciphers.contains( "HmacSHA1" ) );
@@ -111,6 +115,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void generateDes() throws Exception
     {
         byte[] desKeyData =
@@ -129,6 +134,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testDesCipher() throws Exception
     {
         KeyGenerator keygen = KeyGenerator.getInstance( "DES" );
@@ -145,6 +151,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testTripleDesCipher() throws Exception
     {
         KeyGenerator keygen = KeyGenerator.getInstance( "DESede" );
@@ -161,6 +168,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testArcFourCipher() throws Exception
     {
         KeyGenerator keygen = KeyGenerator.getInstance( "ARCFOUR" );
@@ -178,6 +186,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testAes128Cipher() throws Exception
     {
         KeyGenerator keyGenerator = KeyGenerator.getInstance( "AES" );
@@ -204,6 +213,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testAes256Cipher() throws Exception
     {
         KeyGenerator keyGenerator = KeyGenerator.getInstance( "AES" );
@@ -233,6 +243,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testGenerateHmacMd5() throws Exception
     {
         KeyGenerator kg = KeyGenerator.getInstance( "HmacMD5" );
@@ -251,6 +262,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testGenerateHmacSha1() throws Exception
     {
         KeyGenerator kg = KeyGenerator.getInstance( "HmacSHA1" );
@@ -275,13 +287,15 @@
         Set<String> result = new HashSet<String>();
 
         Provider[] providers = Security.getProviders();
-        for ( int i = 0; i < providers.length; i++ )
+        
+        for ( Provider provider : providers )
         {
             // Get services provided by each provider
-            Set keys = providers[i].keySet();
-            for ( Iterator it = keys.iterator(); it.hasNext(); )
+            Set<Object> keys = provider.keySet();
+            
+            for ( Object keyObject : keys )
             {
-                String key = ( String ) it.next();
+                String key = ( String ) keyObject;
                 key = key.split( " " )[0];
 
                 if ( key.startsWith( serviceType + "." ) )

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NFoldTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NFoldTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NFoldTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/NFoldTest.java
Tue Sep  1 10:01:09 2009
@@ -22,7 +22,9 @@
 
 import java.util.Arrays;
 
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -32,11 +34,12 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class NFoldTest extends TestCase
+public class NFoldTest
 {
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFold1()
     {
         int n = 64;
@@ -58,6 +61,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFold2()
     {
         int n = 56;
@@ -78,6 +82,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFold3()
     {
         int n = 64;
@@ -99,6 +104,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFold4()
     {
         int n = 168;
@@ -122,6 +128,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFold5()
     {
         int n = 192;
@@ -146,6 +153,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFold6()
     {
         int n = 168;
@@ -169,6 +177,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFold7()
     {
         int n = 168;
@@ -192,6 +201,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFoldKerberos64()
     {
         int n = 64;
@@ -213,6 +223,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFoldKerberos128()
     {
         int n = 128;
@@ -235,6 +246,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFoldKerberos168()
     {
         int n = 168;
@@ -258,6 +270,7 @@
     /**
      * Tests an n-fold test vector from RFC 3961.
      */
+    @Test
     public void testNFoldKerberos256()
     {
         int n = 256;
@@ -284,6 +297,7 @@
      * that for purposes of n-folding, we do not actually complement the
      * result of the addition.
      */
+    @Test
     public void testSum()
     {
         byte[] n1 =

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactoryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactoryTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactoryTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/crypto/encryption/RandomKeyFactoryTest.java
Tue Sep  1 10:01:09 2009
@@ -28,10 +28,11 @@
 import javax.crypto.SecretKey;
 import javax.crypto.spec.DESKeySpec;
 
-import junit.framework.TestCase;
-
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
+import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Test cases for random-to-key functions for DES-, DES3-, AES-, and RC4-based
@@ -40,13 +41,14 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class RandomKeyFactoryTest extends TestCase
+public class RandomKeyFactoryTest
 {
     /**
      * Tests that random DES keys can be generated.
      *
      * @throws Exception
      */
+    @Test
     public void testGenerateDesKey() throws Exception
     {
         KeyGenerator keygen = KeyGenerator.getInstance( "DES" );
@@ -61,6 +63,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testGenerateTripleDesKey() throws Exception
     {
         KeyGenerator keygen = KeyGenerator.getInstance( "DESede" );
@@ -74,6 +77,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testGenerateAes128Key() throws Exception
     {
         KeyGenerator keygen = KeyGenerator.getInstance( "AES" );
@@ -88,6 +92,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testGenerateAes256Key() throws Exception
     {
         KeyGenerator keygen = KeyGenerator.getInstance( "AES" );
@@ -102,6 +107,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testGenerateArcFourKey() throws Exception
     {
         if ( !VendorHelper.isArcFourHmacSupported() )
@@ -120,6 +126,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testGenerateRc4Key() throws Exception
     {
         if ( !VendorHelper.isArcFourHmacSupported() )
@@ -138,6 +145,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testRandomKeyFactory() throws Exception
     {
         Map<EncryptionType, EncryptionKey> map = RandomKeyFactory.getRandomKeys();
@@ -188,6 +196,7 @@
      * 
      * @throws Exception
      */
+    @Test
     public void testRandomKeyFactoryOnlyDes() throws Exception
     {
         Set<EncryptionType> encryptionTypes = new HashSet<EncryptionType>();

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/keytab/KeytabTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/keytab/KeytabTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/keytab/KeytabTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/keytab/KeytabTest.java
Tue Sep  1 10:01:09 2009
@@ -32,13 +32,15 @@
 
 import javax.crypto.spec.DESKeySpec;
 
-import junit.framework.TestCase;
-
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.KerberosKeyFactory;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
 import org.apache.mina.core.buffer.IoBuffer;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 
 /**
@@ -49,7 +51,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class KeytabTest extends TestCase
+public class KeytabTest
 {
     private static final byte[] keytab1 = new byte[]
         { ( byte ) 0x05, ( byte ) 0x02, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte
) 0x3C, ( byte ) 0x00,
@@ -90,6 +92,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testReadKeytab1() throws Exception
     {
         Keytab keytab = Keytab.read( keytab1 );
@@ -116,6 +119,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testReadKeytab2() throws Exception
     {
         Keytab keytab = Keytab.read( keytab2 );
@@ -142,6 +146,7 @@
      *
      * @throws Exception
      */
+    @Test
     public void testWriteKeytab() throws Exception
     {
         List<KeytabEntry> entries = new ArrayList<KeytabEntry>();

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/components/TicketTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/components/TicketTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/components/TicketTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/components/TicketTest.java
Tue Sep  1 10:01:09 2009
@@ -28,8 +28,10 @@
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.store.TicketFactory;
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.junit.Test;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Test the Ticket encoding and decoding
@@ -37,8 +39,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 542147 $, $Date: 2007-05-28 10:14:21 +0200 (Mon, 28 May 2007) $
  */
-public class TicketTest extends TestCase
+public class TicketTest
 {
+    @Test
     public void testTicket() throws Exception
     {
         TicketFactory ticketFactory = new TicketFactory();

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/AuthorizationDataTest.java
Tue Sep  1 10:01:09 2009
@@ -24,9 +24,9 @@
 import java.util.Arrays;
 
 import org.apache.directory.server.kerberos.shared.messages.value.types.AuthorizationType;
+import org.junit.Test;
 
-import junit.framework.TestCase;
-
+import static org.junit.Assert.assertTrue;
 
 /**
  * Test the AuthorizationData encoding and decoding
@@ -34,8 +34,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 542147 $, $Date: 2007-05-28 10:14:21 +0200 (Mon, 28 May 2007) $
  */
-public class AuthorizationDataTest extends TestCase
+public class AuthorizationDataTest
 {
+    @Test
     public void testAuthorizationDataOneAD() throws Exception
     {
         AuthorizationData ad = new AuthorizationData();
@@ -60,6 +61,7 @@
     }
 
 
+    @Test
     public void testAuthorizationDataThreeAD() throws Exception
     {
         AuthorizationData ad = new AuthorizationData();

Modified: directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/ChecksumTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/ChecksumTest.java?rev=809948&r1=809947&r2=809948&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/ChecksumTest.java
(original)
+++ directory/apacheds/branches/apacheds-schema/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/ChecksumTest.java
Tue Sep  1 10:01:09 2009
@@ -24,8 +24,8 @@
 import java.util.Arrays;
 
 import org.apache.directory.server.kerberos.shared.crypto.checksum.ChecksumType;
-
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.assertTrue;
 
 
 /**
@@ -34,8 +34,9 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev: 542147 $, $Date: 2007-05-28 10:14:21 +0200 (Mon, 28 May 2007) $
  */
-public class ChecksumTest extends TestCase
+public class ChecksumTest
 {
+    @Test
     public void testEncodingChecksum() throws Exception
     {
         Checksum chk = new Checksum( ChecksumType.CRC32, new byte[]
@@ -59,6 +60,7 @@
     }
 
 
+    @Test
     public void testEncodingNullChecksum() throws Exception
     {
         Checksum chk = new Checksum( ChecksumType.CRC32, null );
@@ -83,6 +85,7 @@
     /**
      * Tests that two Checksums are equal if both their type and value are equal.
      */
+    @Test
     public void testEquality()
     {
         byte[] checksumValue =



Mime
View raw message