harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r407748 [1/3] - in /incubator/harmony/enhanced/classlib/trunk/modules/crypto: make/common/ src/test/api/ src/test/api/java.injected/ src/test/api/java.injected/javax/ src/test/api/java.injected/javax/crypto/ src/test/api/java.injected/javax...
Date Fri, 19 May 2006 08:45:05 GMT
Author: mloenko
Date: Fri May 19 01:44:59 2006
New Revision: 407748

URL: http://svn.apache.org/viewvc?rev=407748&view=rev
Log:
Adjusting crypto test layout in accordance to the current proposal

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherInputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherOutputStreamTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherSpiTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/ExemptionMechanismSpiTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyAgreementSpiTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyGeneratorSpiTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/MacSpiTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/SealedObjectTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/SecretKeyFactorySpiTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/spec/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/spec/PSourceTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/BadPaddingExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/BadPaddingExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/CipherTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/EncryptedPrivateKeyInfoTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/EncryptedPrivateKeyInfoTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/ExemptionMechanismExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/ExemptionMechanismExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/ExemptionMechanismTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/ExemptionMechanismTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/IllegalBlockSizeExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/IllegalBlockSizeExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/KeyAgreement1Test.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/KeyAgreement1Test.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/KeyGenerator1Test.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/KeyGenerator1Test.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/Mac1Test.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/Mac1Test.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/NoSuchPaddingExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/NoSuchPaddingExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/NullCipherTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/NullCipherTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/SecretKeyFactory1Test.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/SecretKeyFactory1Test.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/SecretKeyTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/SecretKeyTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/ShortBufferExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/ShortBufferExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/interfaces/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/interfaces/DHPrivateKeyTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/interfaces/DHPrivateKeyTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/interfaces/DHPublicKeyTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/interfaces/DHPublicKeyTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/interfaces/PBEKeyTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/interfaces/PBEKeyTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/BadPaddingExceptionTest.0.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/BadPaddingExceptionTest.0.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/BadPaddingExceptionTest.1.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/BadPaddingExceptionTest.1.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/BadPaddingExceptionTest.2.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/BadPaddingExceptionTest.2.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/BadPaddingExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/BadPaddingExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/ExemptionMechanismExceptionTest.0.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/ExemptionMechanismExceptionTest.0.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/ExemptionMechanismExceptionTest.1.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/ExemptionMechanismExceptionTest.1.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/ExemptionMechanismExceptionTest.2.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/ExemptionMechanismExceptionTest.2.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/ExemptionMechanismExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/ExemptionMechanismExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/IllegalBlockSizeExceptionTest.0.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/IllegalBlockSizeExceptionTest.0.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/IllegalBlockSizeExceptionTest.1.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/IllegalBlockSizeExceptionTest.1.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/IllegalBlockSizeExceptionTest.2.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/IllegalBlockSizeExceptionTest.2.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/IllegalBlockSizeExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/IllegalBlockSizeExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/NoSuchPaddingExceptionTest.0.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/NoSuchPaddingExceptionTest.0.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/NoSuchPaddingExceptionTest.1.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/NoSuchPaddingExceptionTest.1.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/NoSuchPaddingExceptionTest.2.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/NoSuchPaddingExceptionTest.2.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/NoSuchPaddingExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/NoSuchPaddingExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/ShortBufferExceptionTest.0.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/ShortBufferExceptionTest.0.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/ShortBufferExceptionTest.1.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/ShortBufferExceptionTest.1.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/ShortBufferExceptionTest.2.dat
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/ShortBufferExceptionTest.2.dat
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/serialization/ShortBufferExceptionTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/serialization/ShortBufferExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/DESedeKeySpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/DESedeKeySpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/DHGenParameterSpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/DHGenParameterSpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/DHParameterSpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/DHParameterSpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/DHPrivateKeySpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/DHPrivateKeySpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/DHPublicKeySpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/DHPublicKeySpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/IvParameterSpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/IvParameterSpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/OAEPParameterSpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/OAEPParameterSpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/PBEKeySpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/PBEKeySpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/PBEParameterSpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/PBEParameterSpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/RC2ParameterSpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/RC2ParameterSpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/RC5ParameterSpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/RC5ParameterSpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/SecretKeySpecTest.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/SecretKeySpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/javax/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/javax/crypto/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/javax/crypto/Cipher_ImplTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/javax/crypto/KeyAgreement_ImplTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/javax/crypto/KeyGenerator_ImplTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/javax/crypto/Mac_ImplTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/javax/crypto/SecretKeyFactory_ImplTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/javax/crypto/spec/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/javax/crypto/spec/DESKeySpecTest.java
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/spec/DESKeySpecTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/org/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/org/apache/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/org/apache/harmony/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/org/apache/harmony/crypto/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/org/apache/harmony/crypto/internal/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/impl/java.injected/org/apache/harmony/crypto/internal/NullCipherSpiTest.java
      - copied unchanged from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/org/apache/harmony/crypto/internal/NullCipherSpiTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyCipher.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/MyCipher.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyExemptionMechanismSpi.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/MyExemptionMechanismSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyAgreementSpi.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/MyKeyAgreementSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyKeyGeneratorSpi.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/MyKeyGeneratorSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MyMacSpi.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/MyMacSpi.java
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/support/common/java/org/apache/harmony/crypto/tests/support/MySecretKeyFactorySpi.java
      - copied, changed from r407735, incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/javax/crypto/MySecretKeyFactorySpi.java
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/build.xml
    incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/hyproperties.xml

Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/build.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/build.xml?rev=407748&r1=407747&r2=407748&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/build.xml Fri May 19 01:44:59 2006
@@ -49,98 +49,196 @@
 
 
     <target name="compile.tests">
-        <echo message="Compiling CRYPTO tests from ${hy.crypto.src.test.java}" />
 
-        <mkdir dir="${hy.crypto.bin.test}" />
+        <compile-tests description="test support files" destdir="../../../../build/tests">
+            <javac-elements>
+                <src path="${hy.crypto.src.test}/support/common/java"/>
+                <include name="**/*.java" />
+            </javac-elements>
+        </compile-tests>
+
+
+        <compile-tests description="api tests" destdir="${hy.crypto.bin.test}/api">
+            <javac-elements>
+                <!-- FIXME: CRYPTO tests should not reach into security module code -->
+                <src>
+                    <pathelement location="${hy.crypto.src.test}/api/java"/>
+                    <pathelement location="${hy.crypto}/../security/src/test/java/common"/>
+                </src>
+
+                <include name="javax/crypto/**/*Test.java" />
+                <include name="org/apache/harmony/crypto/**/*Test.java" />
+                <include name="org/apache/harmony/security/test/**/*" />
+            </javac-elements>
+        </compile-tests>
+
+        <compile-tests description="api injected tests" destdir="${hy.crypto.bin.test}/api.injected">
+            <javac-elements>
+                <src path="${hy.crypto.src.test}/api/java.injected"/>
+                <include name="**/*Test.java" />
+            </javac-elements>
+        </compile-tests>
+
+        <compile-tests description="impl tests" destdir="${hy.crypto.bin.test}">
+            <javac-elements>
+                <!-- FIXME: CRYPTO tests should not reach into security module code -->
+                <src>
+                    <pathelement location="${hy.crypto.src.test}/impl/java.injected"/>
+                    <pathelement location="${hy.crypto}/../security/src/test/java/common"/>
+                </src>
+
+                <include name="javax/crypto/**/*Test.java" />
+                <include name="org/apache/harmony/crypto/**/*Test.java" />
+                <include name="org/apache/harmony/security/**/*" />
+            </javac-elements>
+        </compile-tests>
 
-        <javac 	destdir="${hy.crypto.bin.test}"
-            source="${hy.javac.source}"
-            target="${hy.javac.target}"
-            debug="${java.debug.option}">
-
-            <!-- FIXME: CRYPTO tests should not reach into security module code -->
-            <src>
-                <pathelement location="${hy.crypto.src.test.java}"/>
-                <pathelement location="${hy.crypto}/../security/src/test/java/common"/>
-            </src>
-
-            <include name="tests/api/javax/crypto/**/*.java" />
-            <include name="javax/crypto/**/*.java" />
-            <include name="org/apache/harmony/crypto/**/*Test.java" />
-            <include name="org/apache/harmony/security/test/**/*" />
-
-            <bootclasspath>
-                <fileset dir="${hy.target}/jre/lib/boot">
-                    <include name="**/*.jar" />
-                </fileset>
-            </bootclasspath>
-            <classpath location="../../../../build/tests" />
-        </javac>
     </target>
 
 
-    <target name="run.tests">
 
-        <mkdir dir="${hy.tests.reports}" />
 
-        <property name="test.jre.home" value="${hy.target}/jre" />
+    <target name="run.tests" depends="run.tests.api, run.tests.impl" />
 
-        <junit fork="yes"
-            forkmode="once"
-            printsummary="withOutAndErr"
-            errorproperty="test.errors"
-            failureproperty="test.failures"
-            showoutput="on"
-            dir="${hy.crypto.bin.test}"
-            jvm="${test.jre.home}/bin/java">
+    <target name="run.tests.api">
 
-            <jvmarg value="-showversion"/>
+        <run-tests description="api tests">
+            <junit-elements>
+                <!-- Required for running the serialization unit tests -->
+                <!-- Note: will be deleted after improving             -->
+                <!-- SerializationTest support class: all resource     -->
+                <!-- files will be placed on the classpath             -->
+                <jvmarg value="-DTEST_SRC_DIR=${hy.crypto.src.test}/api/java"/>
+
+                <classpath>
+                    <pathelement path="${hy.crypto.bin.test}/api"/>
+                    <pathelement path="../../../../build/tests"/>
+                </classpath>
+
+                <batchtest todir="${hy.tests.reports}" haltonfailure="no" unless="test.case">
+                    <fileset dir="${hy.crypto.src.test}/api/java">
+                        <include name="**/*Test.java"/>
+                    </fileset>
+                </batchtest>
+
+            </junit-elements>
+        </run-tests>
+
+        <run-tests description="api.injected tests">
+            <junit-elements>
+                <!-- to pick up junit.jar               -->
+                <jvmarg value="-Xbootclasspath/a:${hy.crypto.bin.test}/api.injected${path.separator}../../../../${junit.jar}${path.separator}../../../../build/tests"/>
+
+                <batchtest todir="${hy.tests.reports}" haltonfailure="no" unless="test.case">
+                    <fileset dir="${hy.crypto.src.test}/api/java.injected">
+                        <include name="**/*Test.java"/>
+                    </fileset>
+                </batchtest>
 
-            <!-- Required for running the serialization unit tests -->
-            <!-- Note: will be deleted after improving             -->
-            <!-- SerializationTest support class: all resource     -->
-            <!-- files will be placed on the classpath             -->
-            <jvmarg value="-DTEST_SRC_DIR=${hy.crypto.src.test.java}"/>
+            </junit-elements>
+        </run-tests>
 
-            <env key="JAVA_HOME" value="${test.jre.home}"/>
-
-            <!-- to pick up junit.jar               -->
-            <!-- FIXME: package access tests and    -->
-            <!-- public API tests must be separated -->
-            <jvmarg value="-Xbootclasspath/a:${hy.crypto.bin.test}${path.separator}../../../../${junit.jar}${path.separator}../../../../build/tests"/>
+        <antcall target="touch-failures-file" />
+        <antcall target="touch-errors-file" />
+    </target>
 
-            <classpath>
-                <pathelement path="${hy.crypto.src.test.resources}"/>
-            </classpath>
 
-            <formatter type="xml" />
+    <target name="run.tests.impl">
+        <run-tests description="impl injected tests">
+            <junit-elements>
+                <!-- to pick up junit.jar               -->
+                <jvmarg value="-Xbootclasspath/a:${hy.crypto.bin.test}${path.separator}../../../../${junit.jar}${path.separator}../../../../build/tests"/>
+
+                <batchtest todir="${hy.tests.reports}" haltonfailure="no" unless="test.case">
+                    <fileset dir="${hy.crypto.src.test}/impl/java.injected">
+                        <include name="**/*Test.java"/>
+                    </fileset>
+                </batchtest>
 
-            <test name="${test.case}" todir="${hy.tests.reports}" if="test.case" />
-            <batchtest todir="${hy.tests.reports}" haltonfailure="no"
-                unless="test.case">
+            </junit-elements>
+        </run-tests>
 
-                <fileset dir="${hy.crypto.src.test.java}">
-                    <include name="**/*Test.java"/>
-                </fileset>
-            </batchtest>
-        </junit>
         <antcall target="touch-failures-file" />
         <antcall target="touch-errors-file" />
     </target>
 
+
     <target name="touch-failures-file" if="test.failures">
         <echo file="${hy.tests.reports}/test.failures"
             append="true" >crypto
-</echo>
+        </echo>
     </target>
     <target name="touch-errors-file" if="test.errors">
         <echo file="${hy.tests.reports}/test.errors"
             append="true" >crypto
-</echo>
+         </echo>
     </target>
 
     <target name="copy.resources">
         <!-- Nothing for CRYPTO -->
     </target>
+
+    <macrodef name="compile-tests">
+        <attribute name="description" default="" />
+        <attribute name="destdir"  />
+        <element name="javac-elements" />
+        <sequential>
+            <echo message="Compiling CRYPTO @{description}" />
+
+            <mkdir dir="@{destdir}" />
+
+            <javac destdir="@{destdir}"
+                source="${hy.javac.source}"
+                target="${hy.javac.target}"
+                debug="${java.debug.option}">
+
+                <javac-elements />
+
+                <bootclasspath>
+                    <fileset dir="${hy.target}/jre/lib/boot">
+                        <include name="**/*.jar" />
+                    </fileset>
+                </bootclasspath>
+                <classpath location="../../../../build/tests" />
+            </javac>
+        </sequential>
+    </macrodef>
+
+
+    <macrodef name="run-tests">
+        <attribute name="description" default="" />
+        <element name="junit-elements" />
+        <sequential>
+            <echo message="Running CRYPTO @{description}" />
+
+            <mkdir dir="${hy.tests.reports}" />
+
+            <property name="test.jre.home" value="${hy.target}/jre" />
+
+            <junit fork="yes"
+                forkmode="once"
+                printsummary="withOutAndErr"
+                errorproperty="test.errors"
+                failureproperty="test.failures"
+                showoutput="on"
+                dir="${hy.crypto.bin.test}"
+                jvm="${test.jre.home}/bin/java">
+
+                <jvmarg value="-showversion"/>
+
+                <env key="JAVA_HOME" value="${test.jre.home}"/>
+                <junit-elements />
+
+                <classpath>
+                    <pathelement path="${hy.crypto.src.test.resources}"/>
+                </classpath>
+
+                <formatter type="xml" />
+
+                <test name="${test.case}" todir="${hy.tests.reports}" if="test.case" />
+            </junit>
+        </sequential>
+    </macrodef>
+
 </project>
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/hyproperties.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/hyproperties.xml?rev=407748&r1=407747&r2=407748&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/hyproperties.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/make/common/hyproperties.xml Fri May 19 01:44:59 2006
@@ -22,8 +22,7 @@
             <java location="src/main/java" />
         	<resources location="src/main/resources" />
          </main>
-         <test>
-            <java location="src/test/java" />
+         <test location="src/test">
             <resources location="src/test/resources" />
          </test>
          <natives location="src/natives" />

Added: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherInputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherInputStreamTest.java?rev=407748&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherInputStreamTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherInputStreamTest.java Fri May 19 01:44:59 2006
@@ -0,0 +1,293 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Alexander Y. Kleymenov
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import javax.crypto.NullCipher;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ */
+
+public class CipherInputStreamTest extends TestCase {
+
+    private static class TestInputStream extends ByteArrayInputStream {
+        private boolean closed = false;
+
+        public TestInputStream(byte[] data) {
+            super(data);
+        }
+
+        public void close() {
+            closed = true;
+        }
+
+        public boolean wasClosed() {
+            return closed;
+        }
+    }
+
+    /**
+     * CipherInputStream(InputStream is) method testing. Tests that
+     * CipherInputStream uses NullCipher if Cipher is not specified
+     * in the constructor.
+     */
+    public void testCipherInputStream() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestInputStream tis = new TestInputStream(data);
+        CipherInputStream cis = new CipherInputStream(tis);
+
+        try {
+            for (int i=0; i<data.length; i++) {
+                if ((byte) cis.read() != data[i]) {
+                    fail("NullCipher should be used "
+                            + "if Cipher is not specified.");
+                }
+            }
+            if (cis.read() != -1) {
+                fail("NullCipher should be used if Cipher is not specified.");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * read() method testing. Tests that method returns the correct value
+     * (related to the InputStream) and that it returns -1 at the end of
+     * stream.
+     */
+    public void testRead1() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestInputStream tis = new TestInputStream(data);
+        CipherInputStream cis = new CipherInputStream(tis, new NullCipher());
+        byte res;
+        try {
+            for (int i=0; i<data.length; i++) {
+                if ((res = (byte) cis.read()) != data[i]) {
+                    fail("read() returned the incorrect value. " +
+                            "Expected: " + data[i] + ", Got: " + res + ".");
+                }
+            }
+            if (cis.read() != -1) {
+                fail("read() should return -1 at the end of the stream.");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * read(byte[] b) method testing. Tests that method returns the correct
+     * value (related to the InputStream) and that it returns -1 at the end of
+     * stream.
+     */
+    public void testRead2() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestInputStream tis = new TestInputStream(data);
+        CipherInputStream cis = new CipherInputStream(tis, new NullCipher());
+        try {
+            int expected = data.length;
+            byte[] result = new byte[expected];
+
+            int ind = 0; // index into the data array (to check the got data)
+            int got = cis.read(result); // the number of got bytes
+            while (true) {
+                for (int j=0; j<got-ind; j++) {
+                    if (result[j] != data[ind+j]) {
+                        fail("read(byte[] b) returned incorrect data.");
+                    }
+                }
+                if (got == expected) {
+                    break;
+                } else if (got > expected) {
+                    fail("The data returned by read(byte[] b) "
+                                                + "is larger than expected.");
+                } else {
+                    ind = got;
+                    got += cis.read(result);
+                }
+            }
+            if (cis.read(result) != -1) {
+                fail("read(byte[] b) should return -1 "
+                                                + "at the end of the stream.");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * read(byte[] b, int off, int len) method testing. Tests that method
+     * returns the correct value (related to the InputStream), that it
+     * dicards bytes in the case of null buffer, and that it returns -1 at
+     * the end of stream.
+     */
+    public void testRead3() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestInputStream tis = new TestInputStream(data);
+        CipherInputStream cis = new CipherInputStream(tis, new NullCipher());
+        try {
+            int expected = data.length;
+            byte[] result = new byte[expected];
+
+            int skip = 2;
+            int ind = skip; // index into the data array (to check the got data)
+            // should read and discard bytes;
+            cis.read(null, 0, skip);
+            int got = skip + cis.read(result, 0, 1); // the number of got bytes
+            while (true) {
+                for (int j=0; j<got-ind; j++) {
+                    assertEquals("read(byte[] b, int off, int len) "
+                        + "returned incorrect data.", result[j], data[ind+j]);
+                }
+                if (got == expected) {
+                    break;
+                } else if (got > expected) {
+                    fail("The data returned by "
+                            + "read(byte[] b, int off, int len) "
+                                                + "is larger than expected.");
+                } else {
+                    ind = got;
+                    got += cis.read(result, 0, 3);
+                }
+            }
+            if (cis.read(result, 0, 1) != -1) {
+                fail("read() should return -1 at the end of the stream.");
+            }
+        } catch (NullPointerException e) {
+            e.printStackTrace();
+            fail("Unexpected NullPointerException was thrown.");
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * skip(long n) method testing. Tests that the method correctly skips
+     * the bytes.
+     */
+    public void testSkip() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestInputStream tis = new TestInputStream(data);
+        CipherInputStream cis = new CipherInputStream(tis, new NullCipher());
+        try {
+            int expected = data.length;
+            byte[] result = new byte[expected];
+
+            int skipped = (int) cis.skip(2);
+            int ind = skipped;
+            int got = skipped + cis.read(result, 0, 1); // the number of got bytes
+            while (true) {
+                for (int j=0; j<got-ind; j++) {
+                    if (result[j] != data[ind+j]) {
+                        fail("read(byte[] b, int off, int len) "
+                                + "returned incorrect data: Expected "
+                                + data[ind+j] + ", got: " + result[j]);
+                    }
+                }
+                if (got == expected) {
+                    break;
+                } else if (got > expected) {
+                    fail("The data returned by "
+                            + "read(byte[] b, int off, int len) "
+                                                + "is larger than expected.");
+                } else {
+                    ind = got;
+                    got += cis.read(result, 0, 1);
+                }
+            }
+            if ((got = cis.read(result, 0, 1)) != -1) {
+                fail("read() should return -1 at the end of the stream. "
+                        + "Output is: " + got + ".");
+            }
+        } catch (NullPointerException e) {
+            e.printStackTrace();
+            fail("Unexpected NullPointerException was thrown.");
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * available() method testing. Tests that the method always return 0.
+     */
+    public void testAvailable() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestInputStream tis = new TestInputStream(data);
+        CipherInputStream cis = new CipherInputStream(tis, new NullCipher());
+        try {
+            assertEquals("The returned by available() method value "
+                    + "should be 0.", cis.available(), 0);
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * close() method testing. Tests that the method calls the close()
+     * method of the underlying input stream.
+     */
+    public void testClose() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestInputStream tis = new TestInputStream(data);
+        CipherInputStream cis = new CipherInputStream(tis, new NullCipher());
+        try {
+            cis.close();
+            assertTrue("The close() method should call the close() method "
+                            + "of its underlying input stream.", tis.wasClosed());
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * markSupported() method testing. Tests that mark is not supported.
+     */
+    public void testMarkSupported() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestInputStream tis = new TestInputStream(data);
+        CipherInputStream cis = new CipherInputStream(tis, new NullCipher());
+        assertFalse("The returned by markSupported() method value "
+                + "should be false.", cis.markSupported());
+    }
+
+    public static Test suite() {
+        return new TestSuite(CipherInputStreamTest.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+}
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherOutputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherOutputStreamTest.java?rev=407748&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherOutputStreamTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherOutputStreamTest.java Fri May 19 01:44:59 2006
@@ -0,0 +1,197 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Alexander Y. Kleymenov
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import javax.crypto.NullCipher;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ */
+
+public class CipherOutputStreamTest extends TestCase {
+
+    private static class TestOutputStream extends ByteArrayOutputStream {
+        private boolean closed = false;
+
+        public void close() {
+            closed = true;
+        }
+
+        public boolean wasClosed() {
+            return closed;
+        }
+    }
+
+    /**
+     * CipherOutputStream(OutputStream os) method testing. Tests that
+     * CipherOutputStream uses NullCipher if Cipher is not specified
+     * in the constructor.
+     */
+    public void testCipherOutputStream() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestOutputStream tos = new TestOutputStream();
+        CipherOutputStream cos = new CipherOutputStream(tos);
+
+        try {
+            cos.write(data);
+            cos.flush();
+            byte[] result = tos.toByteArray();
+            if (!Arrays.equals(result, data)) {
+                    fail("NullCipher should be used "
+                            + "if Cipher is not specified.");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * write(int b) method testing. Tests that method writes correct values
+     * to the underlying output stream.
+     */
+    public void testWrite1() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestOutputStream tos = new TestOutputStream();
+        CipherOutputStream cos = new CipherOutputStream(tos, new NullCipher());
+
+        try {
+            for (int i=0; i<data.length; i++) {
+                cos.write(data[i]);
+            }
+            cos.flush();
+            byte[] result = tos.toByteArray();
+            if (!Arrays.equals(result, data)) {
+                    fail("CipherOutputStream wrote incorrect data.");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * write(byte[] b) method testing. Tests that method writes correct values
+     * to the underlying output stream.
+     */
+    public void testWrite2() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestOutputStream tos = new TestOutputStream();
+        CipherOutputStream cos = new CipherOutputStream(tos, new NullCipher());
+
+        try {
+            cos.write(data);
+            cos.flush();
+            byte[] result = tos.toByteArray();
+            if (!Arrays.equals(result, data)) {
+                    fail("CipherOutputStream wrote incorrect data.");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * write(byte[] b, int off, int len) method testing.
+     */
+    public void testWrite3() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestOutputStream tos = new TestOutputStream();
+        CipherOutputStream cos = new CipherOutputStream(tos, new NullCipher());
+
+        try {
+            for (int i=0; i<data.length; i++) {
+                cos.write(data, i, 1);
+            }
+            cos.flush();
+            byte[] result = tos.toByteArray();
+            if (!Arrays.equals(result, data)) {
+                    fail("CipherOutputStream wrote incorrect data.");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * flush() method testing. Tests that method flushes the data to the
+     * underlying output stream.
+     */
+    public void testFlush() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestOutputStream tos = new TestOutputStream();
+        CipherOutputStream cos = new CipherOutputStream(tos);
+
+        try {
+            cos.write(data);
+            cos.flush();
+            byte[] result = tos.toByteArray();
+            if (!Arrays.equals(result, data)) {
+                    fail("CipherOutputStream did not flush the data.");
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    /**
+     * close() method testing. Tests that the method calls the close()
+     * method of the underlying input stream.
+     */
+    public void testClose() {
+        byte[] data = new byte[] {-127, -100, -50, -10, -1, 0, 1, 10, 50, 127};
+        TestOutputStream tos = new TestOutputStream();
+        CipherOutputStream cos = new CipherOutputStream(tos);
+
+        try {
+            cos.write(data);
+            cos.close();
+            byte[] result = tos.toByteArray();
+            if (!Arrays.equals(result, data)) {
+                    fail("CipherOutputStream did not flush the data.");
+            }
+            assertTrue("The close() method should call the close() method "
+                        + "of its underlying output stream.", tos.wasClosed());
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail("Unexpected IOException was thrown.");
+        }
+    }
+
+    public static Test suite() {
+        return new TestSuite(CipherOutputStreamTest.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+}
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherSpiTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherSpiTest.java?rev=407748&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherSpiTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/CipherSpiTest.java Fri May 19 01:44:59 2006
@@ -0,0 +1,344 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.AlgorithmParameters;
+import java.nio.ByteBuffer;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests for <code>CipherSpi</code> class constructors and methods.
+ * 
+ */
+
+public class CipherSpiTest extends TestCase {
+
+    /**
+     * Constructor for CipherSpiTests.
+     * 
+     * @param arg0
+     */
+    public CipherSpiTest(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Test for <code>CipherSpi</code> constructor 
+     * Assertion: constructs CipherSpi
+     */
+    public void testCipherSpiTests01() throws IllegalBlockSizeException,
+            BadPaddingException, ShortBufferException {
+        
+        CipherSpi cSpi = new myCipherSpi();
+        assertEquals("BlockSize is not 0", cSpi.engineGetBlockSize(), 0);
+        assertEquals("OutputSize is not 0", cSpi.engineGetOutputSize(1), 0);
+        byte[] bb = cSpi.engineGetIV();
+        assertEquals("Length of result byte array is not 0", bb.length, 0);
+        assertNull("Not null result", cSpi.engineGetParameters());
+        byte[] bb1 = new byte[10];
+        byte[] bb2 = new byte[10];
+        bb = cSpi.engineUpdate(bb1, 1, 2);
+        assertEquals("Incorrect result of engineUpdate(byte, int, int)",
+                bb.length, 2);
+        bb = cSpi.engineDoFinal(bb1, 1, 2);
+        assertEquals("Incorrect result of enfineDoFinal(byte, int, int)", 2,
+                bb.length);
+        assertEquals(
+                "Incorrect result of enfineUpdate(byte, int, int, byte, int)",
+                cSpi.engineUpdate(bb1, 1, 2, bb2, 7), 2);
+        assertEquals(
+                "Incorrect result of enfineDoFinal(byte, int, int, byte, int)",
+                2, cSpi.engineDoFinal(bb1, 1, 2, bb2, 0));
+    }
+    
+    /**
+     * Test for <code>engineGetKeySize(Key)</code> method 
+     * Assertion: It throws UnsupportedOperationException if it is not overriden
+     */
+    public void testCipherSpi02() {
+        CipherSpi cSpi = new myCipherSpi();
+        try {
+            cSpi.engineGetKeySize(null);
+            assertTrue("UnsupportedOperationException must be thrown", false);
+        } catch (UnsupportedOperationException e) {
+        } catch (Exception e) {
+            assertTrue(
+                    "Unexpected ".concat(e.toString()).concat(" was thrown"),
+                    false);
+        }
+    }
+
+    /**
+     * Test for <code>engineWrap(Key)</code> method 
+     * Assertion: It throws UnsupportedOperationException if it is not overriden
+     */
+    public void testCipherSpi03() {
+        CipherSpi cSpi = new myCipherSpi();
+        try {
+            cSpi.engineWrap(null);
+            assertTrue("UnsupportedOperationException must be thrown", false);
+        } catch (UnsupportedOperationException e) {
+        } catch (Exception e) {
+            assertTrue(
+                    "Unexpected ".concat(e.toString()).concat(" was thrown"),
+                    false);
+        }
+    }
+
+    /**
+     * Test for <code>engineUnwrap(byte[], String, int)</code> method
+     * Assertion: It throws UnsupportedOperationException if it is not overriden
+     */
+    public void testCipherSpi04() {
+        CipherSpi cSpi = new myCipherSpi();
+        try {
+            cSpi.engineUnwrap(new byte[0], "", 0);
+            assertTrue("UnsupportedOperationException must be thrown", false);
+        } catch (UnsupportedOperationException e) {
+        } catch (Exception e) {
+            assertTrue(
+                    "Unexpected ".concat(e.toString()).concat(" was thrown"),
+                    false);
+        }
+    }
+    
+    /**
+     * Test for <code>engineUpdate(ByteBuffer, ByteBuffer)</code> method
+     * Assertions:
+     * throws NullPointerException if one of these buffers is null;
+     * throws ShortBufferException is there is no space in output to hold result
+     */
+    public void testCipherSpi05() throws ShortBufferException {
+        CipherSpi cSpi = new myCipherSpi();
+        byte[] bb = { (byte) 0, (byte) 1, (byte) 2, (byte) 3, (byte) 4,
+                (byte) 5, (byte) 6, (byte) 7, (byte) 8, (byte) 9, (byte) 10 };
+        int pos = 5;
+        int len = bb.length;
+        ByteBuffer bbNull = null;
+        ByteBuffer bb1 = ByteBuffer.allocate(len);
+        bb1.put(bb);
+        bb1.position(0);
+        try {
+            cSpi.engineUpdate(bbNull, bb1);
+            fail("NullPointerException must be thrown");
+        } catch (NullPointerException e) {
+        }
+        try {
+            cSpi.engineUpdate(bb1, bbNull);
+            fail("NullPointerException must be thrown");
+        } catch (NullPointerException e) {
+        }
+        ByteBuffer bb2 = ByteBuffer.allocate(bb.length);
+        bb1.position(len);
+        assertEquals("Incorrect number of stored bytes", 0, cSpi.engineUpdate(
+                bb1, bb2));
+
+        bb1.position(0);
+        bb2.position(len - 2);
+        try {
+            cSpi.engineUpdate(bb1, bb2);
+            fail("ShortBufferException bust be thrown. Output buffer remaining: "
+                    .concat(Integer.toString(bb2.remaining())));
+        } catch (ShortBufferException e) {
+        }
+        bb1.position(10);
+        bb2.position(0);
+        assertTrue("Incorrect number of stored bytes", cSpi.engineUpdate(bb1,
+                bb2) > 0);
+        bb1.position(bb.length);
+        cSpi.engineUpdate(bb1, bb2);
+
+        bb1.position(pos);
+        bb2.position(0);
+        int res = cSpi.engineUpdate(bb1, bb2);
+        assertTrue("Incorrect result", res > 0);
+    }
+
+    /**
+     * Test for <code>engineDoFinal(ByteBuffer, ByteBuffer)</code> method
+     * Assertions: 
+     * throws NullPointerException if one of these buffers is null;
+     * throws ShortBufferException is there is no space in output to hold result
+     */
+    public void testCipherSpi06() throws BadPaddingException,
+            ShortBufferException, IllegalBlockSizeException {
+        CipherSpi cSpi = new myCipherSpi();
+        int len = 10;
+        byte[] bbuf = new byte[len];
+        for (int i = 0; i < bbuf.length; i++) {
+            bbuf[i] = (byte) i;
+        }
+        ByteBuffer bb1 = ByteBuffer.wrap(bbuf);
+        ByteBuffer bbNull = null;
+        try {
+            cSpi.engineDoFinal(bbNull, bb1);
+            fail("NullPointerException must be thrown");
+        } catch (NullPointerException e) {
+        }
+        try {
+            cSpi.engineDoFinal(bb1, bbNull);
+            fail("NullPointerException must be thrown");
+        } catch (NullPointerException e) {
+        }
+        ByteBuffer bb2 = ByteBuffer.allocate(len);
+        bb1.position(bb1.limit());
+        assertEquals("Incorrect result", 0, cSpi.engineDoFinal(bb1, bb2));
+
+        bb1.position(0);
+        bb2.position(len - 2);
+        try {
+            cSpi.engineDoFinal(bb1, bb2);
+            fail("ShortBufferException must be thrown. Output buffer remaining: "
+                    .concat(Integer.toString(bb2.remaining())));
+        } catch (ShortBufferException e) {
+        }
+        int pos = 5;
+        bb1.position(pos);
+        bb2.position(0);
+        assertTrue("Incorrect result", cSpi.engineDoFinal(bb1, bb2) > 0);
+    }
+    
+    public static void main(String args[]) {
+        junit.textui.TestRunner.run(CipherSpiTest.class);
+    }
+}
+/**
+ * 
+ * Additional class for CipherGeneratorSpi constructor verification
+ */
+
+class myCipherSpi extends CipherSpi {
+    private byte[] initV;
+
+    private static byte[] resV = { (byte) 7, (byte) 6, (byte) 5, (byte) 4,
+            (byte) 3, (byte) 2, (byte) 1, (byte) 0 };
+
+    public myCipherSpi() {
+        this.initV = new byte[0];
+    }
+
+    protected void engineSetMode(String mode) throws NoSuchAlgorithmException {
+    }
+
+    protected void engineSetPadding(String padding)
+            throws NoSuchPaddingException {
+    }
+
+    protected int engineGetBlockSize() {
+        return 0;
+    }
+
+    protected int engineGetOutputSize(int inputLen) {
+        return 0;
+    }
+
+    protected byte[] engineGetIV() {
+        return new byte[0];
+    }
+
+    protected AlgorithmParameters engineGetParameters() {
+        return null;
+    }
+
+    protected void engineInit(int opmode, Key key, SecureRandom random)
+            throws InvalidKeyException {
+    }
+
+    protected void engineInit(int opmode, Key key,
+            AlgorithmParameterSpec params, SecureRandom random)
+            throws InvalidKeyException, InvalidAlgorithmParameterException {
+    }
+
+    protected void engineInit(int opmode, Key key, AlgorithmParameters params,
+            SecureRandom random) throws InvalidKeyException,
+            InvalidAlgorithmParameterException {
+    }
+
+    protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen) {
+        if (initV.length < inputLen) {
+            initV = new byte[inputLen];
+        }
+        for (int i = 0; i < inputLen; i++) {
+            initV[i] = input[inputOffset + i];
+        }
+        return initV;
+    }
+
+    protected int engineUpdate(byte[] input, int inputOffset, int inputLen,
+            byte[] output, int outputOffset) throws ShortBufferException {
+        byte []res = engineUpdate(input, inputOffset, inputLen);
+        int t = res.length;
+        if ((output.length - outputOffset) < t) {
+            throw new ShortBufferException("Update");
+        }
+        for (int i = 0; i < t; i++) {
+            output[i + outputOffset] = initV[i];
+        }
+        return t;
+    }
+
+    protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
+            throws IllegalBlockSizeException, BadPaddingException {
+        if (resV.length > inputLen) {
+            byte[] bb = new byte[inputLen];
+            for (int i = 0; i < inputLen; i++) {
+                bb[i] = resV[i];
+            }
+            return bb;
+        }
+        return resV;
+    }
+
+    protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
+            byte[] output, int outputOffset) throws ShortBufferException,
+            IllegalBlockSizeException, BadPaddingException {
+        byte[] res = engineDoFinal(input, inputOffset, inputLen);
+        
+        int t = res.length;
+        if ((output.length - outputOffset) < t) {
+            throw new ShortBufferException("DoFinal");
+        }
+        for (int i = 0; i < t; i++) {            
+            output[i + outputOffset] = res[i];
+        }
+        return t;
+    }
+
+    
+    protected int engineUpdate(ByteBuffer input, ByteBuffer output)
+    throws ShortBufferException {
+        return super.engineUpdate(input, output);
+    }
+    protected int engineDoFinal(ByteBuffer input, ByteBuffer output)
+    throws ShortBufferException, IllegalBlockSizeException,
+    BadPaddingException {
+        return super.engineDoFinal(input, output);
+    }
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/ExemptionMechanismSpiTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/ExemptionMechanismSpiTest.java?rev=407748&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/ExemptionMechanismSpiTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/ExemptionMechanismSpiTest.java Fri May 19 01:44:59 2006
@@ -0,0 +1,107 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.spec.AlgorithmParameterSpec;
+
+import org.apache.harmony.crypto.tests.support.MyExemptionMechanismSpi;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests for <code>ExemptionMechanismSpi</code> class constructors and
+ * methods.
+ * 
+ */
+
+public class ExemptionMechanismSpiTest extends TestCase {
+    /**
+     * Constructor for ExemptionMechanismSpiTests.
+     * 
+     * @param arg0
+     */
+    public ExemptionMechanismSpiTest(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Test for <code>ExemptionMechanismSpi</code> constructor Assertion:
+     * constructs ExemptionMechanismSpi
+     */
+    public void testExemptionMechanismSpi01() 
+            throws  ExemptionMechanismException,
+            ShortBufferException, InvalidKeyException,
+            InvalidAlgorithmParameterException {
+        ExemptionMechanismSpi emSpi = new MyExemptionMechanismSpi();
+        int len = MyExemptionMechanismSpi.getLength();
+        byte [] bbRes = emSpi.engineGenExemptionBlob();
+        assertEquals("Incorrect length", bbRes.length, len);
+        assertEquals("Incorrect result", 
+                emSpi.engineGenExemptionBlob(new byte[1], len), len);
+        assertEquals("Incorrect output size", emSpi.engineGetOutputSize(100), 5);
+        Key key = null;
+        AlgorithmParameters params = null;        
+        AlgorithmParameterSpec parSpec = null;
+        try {
+            emSpi.engineInit(key);
+            fail("InvalidKeyException must be thrown");
+        } catch (InvalidKeyException e) {
+        }
+        try {
+            emSpi.engineInit(key, params);
+            fail("InvalidKeyException must be thrown");
+        } catch (InvalidKeyException e) {
+        }
+        try {
+            emSpi.engineInit(key, parSpec);
+            fail("InvalidKeyException must be thrown");
+        } catch (InvalidKeyException e) {
+        }
+        key = ((MyExemptionMechanismSpi)emSpi).new tmp1Key("Proba", new byte[0]);
+        try {
+            emSpi.engineInit(key);
+            fail("ExemptionMechanismException must be thrown");
+        } catch (ExemptionMechanismException e) {
+        }
+        try {
+            emSpi.engineInit(key, params);
+            fail("ExemptionMechanismException must be thrown");
+        } catch (ExemptionMechanismException e) {
+        }
+        try {
+            emSpi.engineInit(key, parSpec);
+            fail("ExemptionMechanismException must be thrown");
+        } catch (ExemptionMechanismException e) {
+        }
+        key = ((MyExemptionMechanismSpi)emSpi).new tmpKey("Proba", new byte[0]);
+        emSpi.engineInit(key);
+        emSpi.engineInit(key, params);
+        emSpi.engineInit(key, parSpec);
+        
+        assertEquals("Incorrect result", emSpi.engineGetOutputSize(100),5);
+    }
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyAgreementSpiTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyAgreementSpiTest.java?rev=407748&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyAgreementSpiTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyAgreementSpiTest.java Fri May 19 01:44:59 2006
@@ -0,0 +1,89 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.spec.AlgorithmParameterSpec;
+
+import org.apache.harmony.crypto.tests.support.MyKeyAgreementSpi;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>KeyAgreementSpi</code> class constructors and methods.
+ * 
+ */
+
+public class KeyAgreementSpiTest extends TestCase {
+    /**
+     * Constructor for KeyAgreementSpiTests.
+     * 
+     * @param arg0
+     */
+    public KeyAgreementSpiTest(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Test for <code>KeyAgreementSpi</code> constructor Assertion: constructs
+     * KeyAgreementSpi
+     */
+    public void testKeyAgreementSpi01() throws InvalidKeyException,
+            ShortBufferException, NoSuchAlgorithmException, 
+            InvalidAlgorithmParameterException {
+        KeyAgreementSpi kaSpi = new MyKeyAgreementSpi();
+
+        assertNull("Not null result", kaSpi.engineDoPhase(null, true));
+        try {
+            kaSpi.engineDoPhase(null, false);
+            fail("IllegalStateException must be thrown");
+        } catch (IllegalStateException e) {
+        }
+        byte[] bb = kaSpi.engineGenerateSecret();
+        assertEquals("Length is not 0", bb.length, 0);        
+        assertEquals("Returned integer is not 0", 
+                kaSpi.engineGenerateSecret(new byte[1], 10), 
+                -1);
+        assertNull("Not null result", kaSpi.engineGenerateSecret("aaa"));
+        try {
+            kaSpi.engineGenerateSecret("");
+            fail("NoSuchAlgorithmException must be throwm");
+        } catch (NoSuchAlgorithmException e) {
+        }
+        Key key = null;
+        try {
+            kaSpi.engineInit(key, new SecureRandom());
+            fail("IllegalArgumentException must be throwm");
+        } catch (IllegalArgumentException e) {
+        }
+        AlgorithmParameterSpec params = null;
+        try {
+            kaSpi.engineInit(key, params, new SecureRandom());
+            fail("IllegalArgumentException must be throwm");
+        } catch (IllegalArgumentException e) {
+        }        
+    }
+}
\ No newline at end of file

Added: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyGeneratorSpiTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyGeneratorSpiTest.java?rev=407748&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyGeneratorSpiTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/KeyGeneratorSpiTest.java Fri May 19 01:44:59 2006
@@ -0,0 +1,80 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.SecureRandom;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+import org.apache.harmony.crypto.tests.support.MyKeyGeneratorSpi;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>KeyGeneratorSpi</code> class constructors and methods.
+ * 
+ */
+
+public class KeyGeneratorSpiTest extends TestCase {
+
+    /**
+     * Constructor for KeyGeneratorSpiTests.
+     * 
+     * @param arg0
+     */
+    public KeyGeneratorSpiTest(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Test for <code>KeyGeneratorSpi</code> constructor Assertion: constructs
+     * KeyGeneratorSpi
+     */
+    public void testKeyGeneratorSpi01() throws InvalidAlgorithmParameterException {
+        KeyGeneratorSpi kgSpi = new MyKeyGeneratorSpi();
+        assertNull("Not null result", kgSpi.engineGenerateKey());
+        try {
+            kgSpi.engineInit(77, new SecureRandom());
+            fail("IllegalArgumentException must be thrown");
+        } catch (IllegalArgumentException e) {
+        }
+        try {
+            kgSpi.engineInit(new SecureRandom());
+            fail("IllegalArgumentException must be thrown");
+        } catch (IllegalArgumentException e) {
+        }
+        AlgorithmParameterSpec aps = null;        
+        try {
+            kgSpi.engineInit(aps, new SecureRandom());
+            fail("InvalidAlgorithmParameterException must be thrown when parameter is null");            
+       } catch (InvalidAlgorithmParameterException e) {
+       }
+       aps = new APSpecSpi();
+       kgSpi.engineInit(aps, new SecureRandom());
+    }
+}
+class APSpecSpi implements AlgorithmParameterSpec {
+    
+}

Added: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/MacSpiTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/MacSpiTest.java?rev=407748&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/MacSpiTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/api/java.injected/javax/crypto/MacSpiTest.java Fri May 19 01:44:59 2006
@@ -0,0 +1,152 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package javax.crypto;
+
+
+import java.nio.ByteBuffer;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.spec.AlgorithmParameterSpec;
+
+import javax.crypto.spec.SecretKeySpec;
+
+import org.apache.harmony.crypto.tests.support.MyMacSpi;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests for <code>MacSpi</code> class constructors and methods.
+ * 
+ */
+
+public class MacSpiTest extends TestCase {
+
+    /**
+     * Constructor for MacSpiTests.
+     * 
+     * @param arg0
+     */
+    public MacSpiTest(String arg0) {
+        super(arg0);
+    }
+
+    /** 
+     * Test for <code>MacSpi</code> constructor 
+     * Assertion: constructs MacSpi
+     */
+    public void testMacSpiTests01() throws Exception {
+        MacSpi mSpi = new MyMacSpi();
+                
+        byte [] bb1 = {(byte)1, (byte)2, (byte)3, (byte)4, (byte)5};
+        SecretKeySpec sks = new SecretKeySpec(bb1, "SHA1");        
+        
+        assertEquals("Incorrect MacLength", mSpi.engineGetMacLength(), 0);
+        
+        try {
+            mSpi.engineInit(null, null);            
+            fail("IllegalArgumentException must be thrown");
+        } catch (IllegalArgumentException e) {
+        }
+
+        mSpi.engineInit(sks, null);
+
+        byte[] bb = mSpi.engineDoFinal();
+        assertEquals(bb.length, 0);
+        try {
+            mSpi.clone();
+            fail("CloneNotSupportedException was not thrown as expected");
+        } catch (CloneNotSupportedException e) {
+        }
+        
+        MacSpi mSpi1 = new MyMacSpi1();
+        mSpi1.clone();
+        
+        byte [] bbb = new byte[10];
+        for (int i = 0; i < bbb.length; i++) {
+            bbb[i] = (byte)i;
+        }
+        try {
+            mSpi1.engineInit(null, null);
+            fail("IllegalArgumentException must be thrown");
+        } catch (IllegalArgumentException e) {
+        }
+        mSpi1.engineInit(sks, null);
+        
+        ByteBuffer byteBuf = ByteBuffer.allocate(10);
+        byteBuf.put(bbb);
+        byteBuf.position(5);
+        int beforeUp = byteBuf.remaining();
+        mSpi1.engineUpdate(byteBuf);
+        bb = mSpi1.engineDoFinal();
+        assertEquals("Incorrect result of engineDoFinal", bb.length, beforeUp);
+        
+        MacSpi mSpi2 = new MyMacSpi2();
+        
+        mSpi2.engineInit(null, null);
+        mSpi2.engineInit(sks, null);
+
+        try {
+            mSpi2.clone();
+        } catch (CloneNotSupportedException e) {
+        }
+
+        byte [] bbuf = {(byte)5, (byte)4, (byte)3, (byte)2, (byte)1};
+        byteBuf = ByteBuffer.allocate(5);        
+        byteBuf.put(bbuf);
+        byteBuf.position(5);
+        if (!byteBuf.hasRemaining()) {
+            mSpi2.engineUpdate(byteBuf);
+        }
+    }
+}
+
+
+class MyMacSpi1 extends MyMacSpi {
+    public Object clone() throws CloneNotSupportedException {
+        return new MyMacSpi1();
+    }
+}
+
+class MyMacSpi2 extends MacSpi {
+    protected int engineGetMacLength() {
+        return 0;
+    }
+
+    protected void engineInit(Key key, AlgorithmParameterSpec params)
+            throws InvalidKeyException, InvalidAlgorithmParameterException {
+    }
+
+    protected void engineUpdate(byte input) {
+    }
+
+    protected void engineUpdate(byte[] input, int offset, int len) {
+    }
+
+    protected byte[] engineDoFinal() {
+        return new byte[0];
+    }
+
+    protected void engineReset() {
+    }
+}



Mime
View raw message