You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/01/31 12:04:50 UTC
svn commit: r373789 [2/9] - in
/incubator/harmony/enhanced/classlib/trunk/modules/security2/test:
common/unit/java/security/ common/unit/java/security/cert/
common/unit/java/security/interfaces/ common/unit/java/security/spec/
common/unit/javax/crypto/...
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSBuilderTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSBuilderTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSBuilderTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSBuilderTest.java Tue Jan 31 03:01:12 2006
@@ -34,7 +34,7 @@
import org.apache.harmony.security.SpiEngUtils;
import org.apache.harmony.security.TestKeyPair;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
import org.apache.harmony.security.test.TestUtils;
/**
@@ -42,7 +42,7 @@
*
*/
-public class KSBuilderTest extends PerformanceTest {
+public class KSBuilderTest extends TestCase {
/**
* Constructor for KSBuilderTest
*
@@ -63,8 +63,6 @@
private static boolean JKSSupported = false;
- private static String defaultProviderName = null;
-
private static Provider defaultProvider = null;
private static String fileEmpty = "java/security/KSEmpty.dat";
@@ -75,7 +73,6 @@
defaultProvider = SpiEngUtils.isSupport(
KeyStoreTest1.defaultType, KeyStoreTest1.srvKeyStore);
JKSSupported = (defaultProvider != null);
- defaultProviderName = (JKSSupported ? defaultProvider.getName() : null);
fileEmpty = SpiEngUtils.getFileName(TestUtils.TEST_ROOT,
fileEmpty);
fileName = SpiEngUtils.getFileName(TestUtils.TEST_ROOT,
@@ -194,15 +191,11 @@
}
ks.load(null, pass);
ksB = KeyStore.Builder.newInstance(ks, pp[i]);
- assertTrue("Not KeyStore.Builder object with empty KeyStore",
- ksB instanceof KeyStore.Builder);
assertEquals("Incorrect KeyStore", ksB.getKeyStore().size(), 0);
ks.setEntry("aaa", pKey, pp[0]);
ksB = KeyStore.Builder.newInstance(ks, pp[i]);
- assertTrue("Not KeyStore.Builder object",
- ksB instanceof KeyStore.Builder);
// verification getKeyStore() and getProtectionParameter(String
// alias)
@@ -218,18 +211,22 @@
} catch (KeyStoreException e) {
fail("Unexpected: " + e.toString() + " was thrown");
}
+
try {
assertEquals(ksB.getProtectionParameter("Bad alias"), pp[i]);
} catch (KeyStoreException e) {
- logln("KeyStoreException was thrown because there is no entry with such alias");
+ // KeyStoreException might be thrown because there is no entry with such alias
}
+
try {
assertEquals(ksB.getProtectionParameter(""), pp[i]);
} catch (KeyStoreException e) {
- logln("KeyStoreException was thrown because there is no entry with such alias");
+ // KeyStoreException might be thrown because there is no entry with such alias
}
+
KeyStore.ProtectionParameter pPar = ksB
.getProtectionParameter("aaa");
+
switch (i) {
case 0:
assertTrue(pPar instanceof KeyStore.PasswordProtection);
@@ -324,8 +321,6 @@
}
ksB = KeyStore.Builder.newInstance(defaultType, defaultProvider, fl,
protPass);
- assertTrue("Not KeyStore.Builder object",
- ksB instanceof KeyStore.Builder);
try {
ksB.getKeyStore();
fail("KeyStoreException must be throw because file is empty");
@@ -353,10 +348,6 @@
ksB = KeyStore.Builder.newInstance(defaultType, null, fl, pp[i]);
ksB1 = KeyStore.Builder.newInstance(defaultType, defaultProvider,
fl, pp[i]);
- assertTrue("Incorrect KeyStore.Builder",
- ksB instanceof KeyStore.Builder);
- assertTrue("Incorrect KeyStore.Builder",
- ksB1 instanceof KeyStore.Builder);
try {
ks = ksB.getKeyStore();
if (i == 2) {
@@ -367,9 +358,8 @@
} catch (KeyStoreException e) {
if (i == 2) {
continue;
- } else {
- fail("Unexpected KeyException was thrown");
}
+ fail("Unexpected KeyException was thrown");
}
try {
ks1 = ksB1.getKeyStore();
@@ -379,13 +369,13 @@
} catch (KeyStoreException e) {
if (i == 2) {
continue;
- } else {
- fail("Unexpected KeyException was thrown");
}
+ fail("Unexpected KeyException was thrown");
}
assertEquals("Incorrect KeyStore size", ks.size(), ks1.size());
Enumeration iter = ks.aliases();
String aName;
+
while (iter.hasMoreElements()) {
aName = (String) iter.nextElement();
try {
@@ -396,11 +386,13 @@
+ " was thrown for alias: " + aName);
}
}
+
try {
assertEquals(ksB.getProtectionParameter("Bad alias"), pp[i]);
} catch (KeyStoreException e) {
- logln("KeyStoreException was thrown because there is no entry with such alias");
+ // KeyStoreException might be thrown because there is no entry with such alias
}
+
iter = ks1.aliases();
while (iter.hasMoreElements()) {
aName = (String) iter.nextElement();
@@ -412,10 +404,11 @@
+ " was thrown for alias: " + aName);
}
}
+
try {
assertEquals(ksB1.getProtectionParameter("Bad alias"), pp[i]);
} catch (KeyStoreException e) {
- logln("KeyStoreException was thrown because there is no entry with such alias");
+ // KeyStoreException might be thrown because there is no entry with such alias
}
}
}
@@ -443,13 +436,13 @@
return;
}
try {
- KeyStore.Builder ksB = KeyStore.Builder.newInstance(null,
+ KeyStore.Builder.newInstance(null,
defaultProvider, protPass);
fail("NullPointerException must be thrown when type is null");
} catch (NullPointerException e) {
}
try {
- KeyStore.Builder ksB = KeyStore.Builder.newInstance(defaultType,
+ KeyStore.Builder.newInstance(defaultType,
defaultProvider, null);
fail("NullPointerException must be thrown when ProtectionParameter is null");
} catch (NullPointerException e) {
@@ -464,7 +457,6 @@
ksB1 = KeyStore.Builder.newInstance(defaultType, null, pp[i]);
switch (i) {
case 0:
- Exception ex1 = null;
try {
ks = ksB.getKeyStore();
assertNotNull("KeyStore is null", ks);
@@ -472,31 +464,30 @@
assertEquals(ksB.getProtectionParameter("Bad alias"),
pp[i]);
} catch (KeyStoreException e) {
- logln("KeyStoreException was thrown because there is no entry in key store");
+ // KeyStoreException might be thrown because there is no entry with such alias
}
+
ks = ksB1.getKeyStore();
assertNotNull("KeyStore is null", ks);
+
try {
assertEquals(ksB1.getProtectionParameter("Bad alias"),
pp[i]);
} catch (KeyStoreException e) {
- logln("KeyStoreException must was thrown because there is no entry in key store");
+ // KeyStoreException might be thrown because there is no entry with such alias
}
} catch (KeyStoreException e) {
- ex1 = e;
- }
- if (ex1 != null) {
try {
ks = ksB.getKeyStore();
- } catch (KeyStoreException e) {
- assertEquals("Incorrect exception", ex1.getMessage(), e
+ } catch (KeyStoreException e1) {
+ assertEquals("Incorrect exception", e.getMessage(), e1
.getMessage());
}
}
break;
case 1:
case 2:
- ex1 = null;
+ Exception ex1 = null;
Exception ex2 = null;
try {
ks = ksB.getKeyStore();
@@ -510,11 +501,14 @@
}
assertEquals("Incorrect exception", ex1.getMessage(), ex2
.getMessage());
+
+
try {
ksB.getProtectionParameter("aaa");
fail("IllegalStateException must be thrown because getKeyStore() was not invoked");
} catch (IllegalStateException e) {
}
+
try {
ks = ksB1.getKeyStore();
} catch (KeyStoreException e) {
@@ -527,6 +521,8 @@
}
assertEquals("Incorrect exception", ex1.getMessage(), ex2
.getMessage());
+
+
try {
ksB1.getProtectionParameter("aaa");
fail("IllegalStateException must be thrown because getKeyStore() was not invoked");
@@ -595,11 +591,9 @@
* Additional class for creating KeyStoreBuilder
*/
class myProtectionParameter implements KeyStore.ProtectionParameter {
- private byte [] myPPParam;
public myProtectionParameter(byte [] param) {
if (param == null) {
throw new NullPointerException("param is null");
}
- myPPParam = param;
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSCallbackHandlerProtectionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSCallbackHandlerProtectionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSCallbackHandlerProtectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSCallbackHandlerProtectionTest.java Tue Jan 31 03:01:12 2006
@@ -25,14 +25,14 @@
import javax.security.auth.callback.CallbackHandler;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>KeyStore.CallbackHandlerProtection> class constructor and methods
*
*/
-public class KSCallbackHandlerProtectionTest extends PerformanceTest {
+public class KSCallbackHandlerProtectionTest extends TestCase {
/**
* Constructor for KSCallbackHandlerProtectionTest.
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSPasswordProtectionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSPasswordProtectionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSPasswordProtectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSPasswordProtectionTest.java Tue Jan 31 03:01:12 2006
@@ -24,14 +24,14 @@
import javax.security.auth.DestroyFailedException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>KeyStore.PasswordProtection</code> class constructor and methods
*
*/
-public class KSPasswordProtectionTest extends PerformanceTest {
+public class KSPasswordProtectionTest extends TestCase {
/**
* Constructor for KSPasswordProtectionTest.
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSPrivateKeyEntryTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSPrivateKeyEntryTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSPrivateKeyEntryTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSPrivateKeyEntryTest.java Tue Jan 31 03:01:12 2006
@@ -25,7 +25,7 @@
import java.security.cert.Certificate;
import org.apache.harmony.security.cert.MyCertificate;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -35,7 +35,7 @@
*
*/
-public class KSPrivateKeyEntryTest extends PerformanceTest {
+public class KSPrivateKeyEntryTest extends TestCase {
/**
* Constructor for KSPrivateKeyEntryTest.
@@ -65,7 +65,7 @@
* Assertion: throws NullPointerException when privateKey is null
*/
public void testPrivateKeyEntry01() {
- Certificate[] certs = (Certificate[]) new MyCertificate[1];//new Certificate[1];
+ Certificate[] certs = new MyCertificate[1];//new Certificate[1];
PrivateKey pk = null;
try {
new KeyStore.PrivateKeyEntry(pk, certs);
@@ -133,8 +133,6 @@
createParams(false, false);
KeyStore.PrivateKeyEntry ksPKE = new KeyStore.PrivateKeyEntry(
testPrivateKey, testChain);
- assertTrue("Not KeyStore.PrivateKeyEntry object",
- ksPKE instanceof KeyStore.PrivateKeyEntry);
assertEquals("Incorrect PrivateKey", testPrivateKey, ksPKE
.getPrivateKey());
}
@@ -147,8 +145,6 @@
createParams(false, false);
KeyStore.PrivateKeyEntry ksPKE = new KeyStore.PrivateKeyEntry(
testPrivateKey, testChain);
- assertTrue("Not KeyStore.PrivateKeyEntry object",
- ksPKE instanceof KeyStore.PrivateKeyEntry);
Certificate[] res = ksPKE.getCertificateChain();
assertEquals("Incorrect chain length", testChain.length, res.length);
for (int i = 0; i < res.length; i++) {
@@ -165,8 +161,6 @@
createParams(false, false);
KeyStore.PrivateKeyEntry ksPKE = new KeyStore.PrivateKeyEntry(
testPrivateKey, testChain);
- assertTrue("Not KeyStore.PrivateKeyEntry object",
- ksPKE instanceof KeyStore.PrivateKeyEntry);
Certificate res = ksPKE.getCertificate();
assertEquals("Incorrect end certificate (number 0)", testChain[0], res);
}
@@ -179,11 +173,8 @@
createParams(false, false);
KeyStore.PrivateKeyEntry ksPKE = new KeyStore.PrivateKeyEntry(
testPrivateKey, testChain);
- assertTrue("Not KeyStore.PrivateKeyEntry object",
- ksPKE instanceof KeyStore.PrivateKeyEntry);
String res = ksPKE.toString();
assertNotNull("toString() returns null", res);
- logln(res);
}
public static Test suite() {
@@ -217,4 +208,4 @@
alg = algorithm;
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSSecretKeyEntryTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSSecretKeyEntryTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSSecretKeyEntryTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSSecretKeyEntryTest.java Tue Jan 31 03:01:12 2006
@@ -24,14 +24,14 @@
import javax.crypto.SecretKey;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>KeyStore.SecretKeyEntry</code> class constructor and methods
*
*/
-public class KSSecretKeyEntryTest extends PerformanceTest {
+public class KSSecretKeyEntryTest extends TestCase {
/**
* Constructor for KSSecretKeyTest.
@@ -60,7 +60,6 @@
public void testGetSecretKey() {
SecretKey sk = new tmpSecretKey();
KeyStore.SecretKeyEntry ske = new KeyStore.SecretKeyEntry(sk);
- assertTrue("Not KeyStore.SecretKeyEntry object", ske instanceof KeyStore.SecretKeyEntry);
assertEquals("Incorrect SecretKey", sk, ske.getSecretKey());
}
@@ -71,9 +70,7 @@
public void testToString() {
SecretKey sk = new tmpSecretKey();
KeyStore.SecretKeyEntry ske = new KeyStore.SecretKeyEntry(sk);
- assertTrue("Not KeyStore.SecretKeyEntry object", ske instanceof KeyStore.SecretKeyEntry);
assertNotNull("toString() returns null string", ske.toString());
- logln(ske.toString());
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSTrustedCertificateEntryTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSTrustedCertificateEntryTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSTrustedCertificateEntryTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KSTrustedCertificateEntryTest.java Tue Jan 31 03:01:12 2006
@@ -24,14 +24,14 @@
import java.security.cert.Certificate;
import org.apache.harmony.security.cert.MyCertificate;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>KeyStore.TrustedCertificateEntry</code> class constructor and methods
*
*/
-public class KSTrustedCertificateEntryTest extends PerformanceTest {
+public class KSTrustedCertificateEntryTest extends TestCase {
/**
* Test for <codfe>KeyStore.TrustedCertificateEntry(Certificate trustCert)</code>
@@ -55,8 +55,6 @@
Certificate cert = new MyCertificate("TEST", new byte[10]);
KeyStore.TrustedCertificateEntry ksTCE =
new KeyStore.TrustedCertificateEntry(cert);
- assertTrue("Not KeyStore.TrustedCertificateEntry object",
- ksTCE instanceof KeyStore.TrustedCertificateEntry);
assertEquals("Incorrect certificate", cert, ksTCE.getTrustedCertificate());
}
@@ -68,9 +66,6 @@
Certificate cert = new MyCertificate("TEST", new byte[10]);
KeyStore.TrustedCertificateEntry ksTCE =
new KeyStore.TrustedCertificateEntry(cert);
- assertTrue("Not KeyStore.TrustedCertificateEntry object",
- ksTCE instanceof KeyStore.TrustedCertificateEntry);
assertNotNull("toString() returns null string", ksTCE.toString());
- logln(ksTCE.toString());
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.security.KeyException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>KeyException</code> class constructors and methods.
*
*/
-public class KeyExceptionTest extends PerformanceTest {
+public class KeyExceptionTest extends TestCase {
public static void main(String[] args) {
}
@@ -78,7 +78,6 @@
*/
public void testKeyException01() {
KeyException tE = new KeyException();
- assertTrue(errNotExc, tE instanceof KeyException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -97,8 +96,6 @@
KeyException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new KeyException(msgs[i]);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof KeyException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -117,7 +114,6 @@
public void testKeyException03() {
String msg = null;
KeyException tE = new KeyException(msg);
- assertTrue(errNotExc, tE instanceof KeyException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -134,7 +130,6 @@
public void testKeyException04() {
Throwable cause = null;
KeyException tE = new KeyException(cause);
- assertTrue(errNotExc, tE instanceof KeyException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -150,7 +145,6 @@
*/
public void testKeyException05() {
KeyException tE = new KeyException(tCause);
- assertTrue(errNotExc, tE instanceof KeyException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -174,7 +168,6 @@
*/
public void testKeyException06() {
KeyException tE = new KeyException(null, null);
- assertTrue(errNotExc, tE instanceof KeyException);
assertNull("getMessage() must return null", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -193,8 +186,6 @@
KeyException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new KeyException(msgs[i], null);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof KeyException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -213,7 +204,6 @@
*/
public void testKeyException08() {
KeyException tE = new KeyException(null, tCause);
- assertTrue(errNotExc, tE instanceof KeyException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -239,8 +229,6 @@
KeyException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new KeyException(msgs[i], tCause);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof KeyException);
String getM = tE.getMessage();
String toS = tCause.toString();
if (msgs[i].length() > 0) {
@@ -262,4 +250,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyManagementExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyManagementExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyManagementExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyManagementExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
import java.security.KeyManagementException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -31,7 +31,7 @@
* methods.
*
*/
-public class KeyManagementExceptionTest extends PerformanceTest {
+public class KeyManagementExceptionTest extends TestCase {
public static void main(String[] args) {
}
@@ -79,7 +79,6 @@
*/
public void testKeyManagementException01() {
KeyManagementException tE = new KeyManagementException();
- assertTrue(errNotExc, tE instanceof KeyManagementException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -98,8 +97,6 @@
KeyManagementException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new KeyManagementException(msgs[i]);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof KeyManagementException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -119,7 +116,6 @@
public void testKeyManagementException03() {
String msg = null;
KeyManagementException tE = new KeyManagementException(msg);
- assertTrue(errNotExc, tE instanceof KeyManagementException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -137,7 +133,6 @@
public void testKeyManagementException04() {
Throwable cause = null;
KeyManagementException tE = new KeyManagementException(cause);
- assertTrue(errNotExc, tE instanceof KeyManagementException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -154,7 +149,6 @@
*/
public void testKeyManagementException05() {
KeyManagementException tE = new KeyManagementException(tCause);
- assertTrue(errNotExc, tE instanceof KeyManagementException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -178,7 +172,6 @@
*/
public void testKeyManagementException06() {
KeyManagementException tE = new KeyManagementException(null, null);
- assertTrue(errNotExc, tE instanceof KeyManagementException);
assertNull("getMessage() must return null", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -197,8 +190,6 @@
KeyManagementException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new KeyManagementException(msgs[i], null);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof KeyManagementException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -217,7 +208,6 @@
*/
public void testKeyManagementException08() {
KeyManagementException tE = new KeyManagementException(null, tCause);
- assertTrue(errNotExc, tE instanceof KeyManagementException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -243,8 +233,6 @@
KeyManagementException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new KeyManagementException(msgs[i], tCause);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof KeyManagementException);
String getM = tE.getMessage();
String toS = tCause.toString();
if (msgs[i].length() > 0) {
@@ -266,4 +254,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorSpiTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorSpiTests.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorSpiTests.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorSpiTests.java Tue Jan 31 03:01:12 2006
@@ -24,14 +24,14 @@
import java.security.spec.AlgorithmParameterSpec;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>KeyPairGeneratorSpi</code> class constructors and methods.
*
*/
-public class KeyPairGeneratorSpiTests extends PerformanceTest {
+public class KeyPairGeneratorSpiTests extends TestCase {
/**
* Constructor for KeyPairGeneratorSpiTests.
@@ -80,4 +80,4 @@
junit.textui.TestRunner.run(KeyPairGeneratorSpiTests.class);
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest1.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest1.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest1.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest1.java Tue Jan 31 03:01:12 2006
@@ -26,14 +26,14 @@
import java.security.spec.AlgorithmParameterSpec;
import org.apache.harmony.security.SpiEngUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>KeyPairGenerator</code> class constructors and methods.
*
*/
-public class KeyPairGeneratorTest1 extends PerformanceTest {
+public class KeyPairGeneratorTest1 extends TestCase {
/**
* Constructor for KayPairGeneratorTest.
@@ -124,8 +124,6 @@
KeyPairGenerator kpg;
for (int i = 0; i < algs.length; i++) {
kpg = KeyPairGenerator.getInstance(algs[i]);
- assertTrue("Not KeyPairGenerator object",
- kpg instanceof KeyPairGenerator);
assertEquals("Incorrect algorithm ", kpg.getAlgorithm().toUpperCase(),
algs[i].toUpperCase());
}
@@ -227,8 +225,6 @@
KeyPairGenerator kpg;
for (int i = 0; i < algs.length; i++) {
kpg = KeyPairGenerator.getInstance(algs[i], validProviderName);
- assertTrue("Not KeyPairGenerator object",
- kpg instanceof KeyPairGenerator);
assertEquals("Incorrect algorithm", kpg.getAlgorithm().toUpperCase(),
algs[i].toUpperCase());
assertEquals("Incorrect provider", kpg.getProvider().getName(),
@@ -299,8 +295,6 @@
KeyPairGenerator kpg;
for (int i = 0; i < algs.length; i++) {
kpg = KeyPairGenerator.getInstance(algs[i], validProvider);
- assertTrue("Not KeyPairGenerator object",
- kpg instanceof KeyPairGenerator);
assertEquals("Incorrect algorithm", kpg.getAlgorithm().toUpperCase(),
algs[i].toUpperCase());
assertEquals("Incorrect provider", kpg.getProvider(), validProvider);
@@ -325,10 +319,8 @@
for (int i = 0; i < kpg.length; i++) {
kpg[i].initialize(512);
kp = kpg[i].generateKeyPair();
- assertTrue("Not KeyPair object", kp instanceof KeyPair);
kp1 = kpg[i].genKeyPair();
- assertTrue("Not KeyPair object", kp1 instanceof KeyPair);
assertFalse("Incorrect private key", kp.getPrivate().equals(
kp1.getPrivate()));
assertFalse("Incorrect public key", kp.getPublic().equals(
@@ -357,32 +349,20 @@
assertNotNull("KeyPairGenerator objects were not created", kpg);
SecureRandom random = new SecureRandom();
AlgorithmParameterSpec aps = null;
+
for (int i = 0; i < kpg.length; i++) {
for (int j = 0; j < keys.length; j++) {
try {
kpg[i].initialize(keys[j]);
- logln("Ignore keysize:" + Integer.toString(keys[j]));
- } catch (InvalidParameterException e) {
- } catch (IllegalArgumentException e) {
- }
-
- try {
kpg[i].initialize(keys[j], random);
- logln("Ignore keysize:" + Integer.toString(keys[j])
- + " with non-null random");
} catch (InvalidParameterException e) {
- } catch (IllegalArgumentException e) {
}
}
+
try {
kpg[i].initialize(aps);
- logln("Ignore null AlgorithmParameterSpec");
- } catch (InvalidAlgorithmParameterException e) {
- }
- try {
kpg[i].initialize(aps, random);
- logln("Ignore null AlgorithmParameterSpec");
} catch (InvalidAlgorithmParameterException e) {
}
}
@@ -404,16 +384,12 @@
int[] keys = { -1, -250, 1, 64, 512, 1024 };
SecureRandom random = new SecureRandom();
AlgorithmParameterSpec aps;
- KeyPairGenerator mKPG = (KeyPairGenerator) new MyKeyPairGenerator1("");
- assertTrue("Not KeyPairGenerator object",
- mKPG instanceof KeyPairGenerator);
+ KeyPairGenerator mKPG = new MyKeyPairGenerator1("");
assertEquals("Incorrect algorithm", mKPG.getAlgorithm(),
MyKeyPairGenerator1.getResAlgorithm());
- KeyPair kp = mKPG.generateKeyPair();
- assertTrue("Not KeyPair object", kp instanceof KeyPair);
- kp = mKPG.genKeyPair();
- assertTrue("Not KeyPair object", kp instanceof KeyPair);
+ mKPG.generateKeyPair();
+ mKPG.genKeyPair();
for (int i = 0; i < keys.length; i++) {
try {
@@ -483,9 +459,7 @@
public void testKeyPairGenerator13() {
int[] keys = { -1, -250, 1, 63, -512, -1024 };
SecureRandom random = new SecureRandom();
- KeyPairGenerator mKPG = (KeyPairGenerator) new MyKeyPairGenerator2(null);
- assertTrue("Not KeyPairGenerator object",
- mKPG instanceof KeyPairGenerator);
+ KeyPairGenerator mKPG = new MyKeyPairGenerator2(null);
assertEquals("Algorithm must be null", mKPG.getAlgorithm(),
MyKeyPairGenerator2.getResAlgorithm());
assertNull("genKeyPair() must return null", mKPG.genKeyPair());
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest2.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest2.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest2.java Tue Jan 31 03:01:12 2006
@@ -28,7 +28,7 @@
import java.security.spec.AlgorithmParameterSpec;
import org.apache.harmony.security.SpiEngUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -36,7 +36,7 @@
*
*/
-public class KeyPairGeneratorTest2 extends PerformanceTest {
+public class KeyPairGeneratorTest2 extends TestCase {
private String KeyPairGeneratorProviderClass = "";
private static final String KeyPairGeneratorProviderClass1 = "java.security.MyKeyPairGenerator1";
@@ -113,8 +113,8 @@
assertEquals("Incorrect exception", e.getMessage(),
"Incorrect random");
}
- assertTrue("Not KeyPair object", keyPairGen.generateKeyPair() instanceof KeyPair);
- assertTrue("Not KeyPair object", keyPairGen.genKeyPair() instanceof KeyPair);
+ keyPairGen.generateKeyPair();
+ keyPairGen.genKeyPair();
break;
case 2:
try {
@@ -133,26 +133,11 @@
assertNull("Not null KeyPair", keyPairGen.genKeyPair());
break;
case 3:
- try {
- keyPairGen.initialize(pp, new SecureRandom());
- logln("Method initialize(AlgorithmParameterSpec, SecureRandom) is supported");
- } catch (UnsupportedOperationException e) {
- }
- try {
- keyPairGen.initialize(pp);
- logln("Method initialize(AlgorithmParameterSpec) is supported");
- } catch (UnsupportedOperationException e) {
- }
- try {
- keyPairGen.initialize(1000, new SecureRandom());
- logln("Method initialize(int, SecureRandom) is supported");
- } catch (UnsupportedOperationException e) {
- }
- try {
- keyPairGen.initialize(100);
- logln("Method initialize(int) is supported");
- } catch (UnsupportedOperationException e) {
- }
+ keyPairGen.initialize(pp, new SecureRandom());
+ keyPairGen.initialize(pp);
+ keyPairGen.initialize(1000, new SecureRandom());
+ keyPairGen.initialize(100);
+
assertNotNull("Null KeyPair", keyPairGen.generateKeyPair());
assertNotNull("Null KeyPair", keyPairGen.genKeyPair());
break;
@@ -219,8 +204,6 @@
for (int i = 0; i < validValues.length; i++) {
String alg = validValues[i].concat(post);
kpG = KeyPairGenerator.getInstance(alg);
- assertTrue("Not instanceof KeyPairGenerator object",
- kpG instanceof KeyPairGenerator);
assertEquals("Incorrect algorithm", kpG.getAlgorithm()
.toUpperCase(), (mode <= 2 ? resAlg : alg).toUpperCase());
assertEquals("Incorrect provider", kpG.getProvider(), mProv);
@@ -282,8 +265,6 @@
for (int i = 0; i < validValues.length; i++) {
String alg = validValues[i].concat(post);
kpG = KeyPairGenerator.getInstance(alg, mProv.getName());
- assertTrue("Not instanceof KeyPairGenerator object",
- kpG instanceof KeyPairGenerator);
assertEquals("Incorrect algorithm", kpG.getAlgorithm()
.toUpperCase(), (mode <= 2 ? resAlg : alg).toUpperCase());
assertEquals("Incorrect provider", kpG.getProvider().getName(),
@@ -331,8 +312,6 @@
for (int i = 0; i < validValues.length; i++) {
String alg = validValues[i].concat(post);
kpG = KeyPairGenerator.getInstance(alg, mProv);
- assertTrue("Not instanceof KeyPairGenerator object",
- kpG instanceof KeyPairGenerator);
assertEquals("Incorrect algorithm", kpG.getAlgorithm()
.toUpperCase(), (mode <= 2 ? resAlg : alg).toUpperCase());
assertEquals("Incorrect provider", kpG.getProvider(), mProv);
@@ -454,4 +433,4 @@
public static void main(String args[]) {
junit.textui.TestRunner.run(KeyPairGeneratorTest2.class);
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest3.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest3.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest3.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairGeneratorTest3.java Tue Jan 31 03:01:12 2006
@@ -25,7 +25,7 @@
import java.security.NoSuchProviderException;
import org.apache.harmony.security.SpiEngUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -33,7 +33,7 @@
*
*/
-public class KeyPairGeneratorTest3 extends PerformanceTest {
+public class KeyPairGeneratorTest3 extends TestCase {
/**
* Constructor for KeyPairGeneratorTest3.
@@ -101,9 +101,7 @@
for (int i = 0; i < kpg.length; i++) {
kpg[i].initialize(512, rr);
kp = kpg[i].generateKeyPair();
- assertTrue("Not KeyPair object", kp instanceof KeyPair);
kp1 = kpg[i].genKeyPair();
- assertTrue("Not KeyPair object", kp1 instanceof KeyPair);
assertFalse("Incorrect private key", kp.getPrivate().equals(
kp1.getPrivate()));
assertFalse("Incorrect public key", kp.getPublic().equals(
@@ -126,19 +124,12 @@
assertNotNull("KeyPairGenerator objects were not created", kpg);
KeyPair kp, kp1;
for (int i = 0; i < kpg.length; i++) {
- try {
- kp = kpg[i].generateKeyPair();
- assertTrue("Not KeyPair object", kp instanceof KeyPair);
- kp1 = kpg[i].genKeyPair();
- assertTrue("Not KeyPair object", kp1 instanceof KeyPair);
- assertFalse("Incorrect private key", kp.getPrivate().equals(
- kp1.getPrivate()));
- assertFalse("Incorrect public key", kp.getPublic().equals(
- kp1.getPublic()));
- } catch (Exception e) {
- logln("Unexpected exception was thrown during KeyPair "
- + " generation without previous initialization");
- }
+ kp = kpg[i].generateKeyPair();
+ kp1 = kpg[i].genKeyPair();
+ assertFalse("Incorrect private key", kp.getPrivate().equals(
+ kp1.getPrivate()));
+ assertFalse("Incorrect public key", kp.getPublic().equals(
+ kp1.getPublic()));
}
}
@@ -146,4 +137,4 @@
junit.textui.TestRunner.run(KeyPairGeneratorTest3.class);
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyPairTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.security.spec.InvalidKeySpecException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for fields and methods of class <code>KeyPair</code>
*
*/
-public class KeyPairTest extends PerformanceTest {
+public class KeyPairTest extends TestCase {
private static class TestKeyPair {
static PublicKey getPublic() {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.security.KeyStoreException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>KeyStoreException</code> class constructors and methods.
*
*/
-public class KeyStoreExceptionTest extends PerformanceTest {
+public class KeyStoreExceptionTest extends TestCase {
public static void main(String[] args) {
}
@@ -78,7 +78,6 @@
*/
public void testKeyStoreException01() {
KeyStoreException tE = new KeyStoreException();
- assertTrue(errNotExc, tE instanceof KeyStoreException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -97,8 +96,6 @@
KeyStoreException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new KeyStoreException(msgs[i]);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof KeyStoreException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -117,7 +114,6 @@
public void testKeyStoreException03() {
String msg = null;
KeyStoreException tE = new KeyStoreException(msg);
- assertTrue(errNotExc, tE instanceof KeyStoreException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -134,7 +130,6 @@
public void testKeyStoreException04() {
Throwable cause = null;
KeyStoreException tE = new KeyStoreException(cause);
- assertTrue(errNotExc, tE instanceof KeyStoreException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -151,7 +146,6 @@
*/
public void testKeyStoreException05() {
KeyStoreException tE = new KeyStoreException(tCause);
- assertTrue(errNotExc, tE instanceof KeyStoreException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -175,7 +169,6 @@
*/
public void testKeyStoreException06() {
KeyStoreException tE = new KeyStoreException(null, null);
- assertTrue(errNotExc, tE instanceof KeyStoreException);
assertNull("getMessage() must return null", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -194,8 +187,6 @@
KeyStoreException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new KeyStoreException(msgs[i], null);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof KeyStoreException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -214,7 +205,6 @@
*/
public void testKeyStoreException08() {
KeyStoreException tE = new KeyStoreException(null, tCause);
- assertTrue(errNotExc, tE instanceof KeyStoreException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -240,8 +230,6 @@
KeyStoreException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new KeyStoreException(msgs[i], tCause);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof KeyStoreException);
String getM = tE.getMessage();
String toS = tCause.toString();
if (msgs[i].length() > 0) {
@@ -263,4 +251,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreSpiTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreSpiTests.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreSpiTests.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreSpiTests.java Tue Jan 31 03:01:12 2006
@@ -27,7 +27,7 @@
import java.util.Date;
import org.apache.harmony.security.cert.MyCertificate;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -35,7 +35,7 @@
*
*/
-public class KeyStoreSpiTests extends PerformanceTest {
+public class KeyStoreSpiTests extends TestCase {
/**
* Constructor for KeyStoreSpi.
@@ -62,36 +62,37 @@
public void testKeyStoteSpi01() throws IOException,
NoSuchAlgorithmException, CertificateException,
UnrecoverableEntryException, KeyStoreException {
- KeyStoreSpi ksSpi = (KeyStoreSpi) new MyKeyStoreSpi();
- assertTrue("Not KeyStoreSpi object", ksSpi instanceof KeyStoreSpi);
+ KeyStoreSpi ksSpi = new MyKeyStoreSpi();
tmpEntry entry = new tmpEntry();
tmpProtection pPar = new tmpProtection();
try {
ksSpi.engineLoad(null);
} catch (UnsupportedOperationException e) {
- logln("UnsupportedOperationException was thrown: " + e.getMessage());
}
+
try {
ksSpi.engineStore(null);
} catch (UnsupportedOperationException e) {
- logln("UnsupportedOperationException was thrown: " + e.getMessage());
}
assertNull("Not null entry", ksSpi.engineGetEntry("aaa", null));
assertNull("Not null entry", ksSpi.engineGetEntry(null, pPar));
assertNull("Not null entry", ksSpi.engineGetEntry("aaa", pPar));
+
try {
ksSpi.engineSetEntry("", null, null);
fail("KeyStoreException or NullPointerException must be thrown");
} catch (KeyStoreException e) {
} catch (NullPointerException e) {
}
+
try {
ksSpi.engineSetEntry("", new KeyStore.TrustedCertificateEntry(
new MyCertificate("type", new byte[0])), null);
fail("KeyStoreException must be thrown");
} catch (KeyStoreException e) {
}
+
try {
ksSpi.engineSetEntry("aaa", entry, null);
fail("KeyStoreException must be thrown");
@@ -107,8 +108,7 @@
*/
public void testKeyStoteSpi02() throws NoSuchAlgorithmException,
UnrecoverableKeyException, CertificateException {
- KeyStoreSpi ksSpi = (KeyStoreSpi) new MyKeyStoreSpi();
- assertTrue("Not KeyStoreSpi object", ksSpi instanceof KeyStoreSpi);
+ KeyStoreSpi ksSpi = new MyKeyStoreSpi();
assertNull("engineGetKey(..) must return null", ksSpi.engineGetKey("",
new char[0]));
assertNull("engineGetCertificateChain(..) must return null", ksSpi
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest1.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest1.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest1.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest1.java Tue Jan 31 03:01:12 2006
@@ -33,14 +33,14 @@
import org.apache.harmony.security.SpiEngUtils;
import org.apache.harmony.security.TestKeyPair;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>KeyStore</code> constructor and methods
*
*/
-public class KeyStoreTest1 extends PerformanceTest {
+public class KeyStoreTest1 extends TestCase {
public static final String srvKeyStore = "KeyStore";
public static String[] validValues = {
@@ -156,7 +156,6 @@
KeyStore ks;
for (int i = 0; i < validValues.length; i++) {
ks = KeyStore.getInstance(validValues[i]);
- assertTrue("Not KeyStore object", ks instanceof KeyStore);
assertEquals("Incorrect type", ks.getType(), validValues[i]);
}
}
@@ -251,7 +250,6 @@
KeyStore ks;
for (int i = 0; i < validValues.length; i++) {
ks = KeyStore.getInstance(validValues[i], defaultProviderName);
- assertTrue("Not KeyStore object", ks instanceof KeyStore);
assertEquals("Incorrect type", ks.getType(), validValues[i]);
assertEquals("Incorrect provider", ks.getProvider().getName(),
defaultProviderName);
@@ -320,7 +318,6 @@
KeyStore ks;
for (int i = 0; i < validValues.length; i++) {
ks = KeyStore.getInstance(validValues[i], defaultProvider);
- assertTrue("not KeyStore object", ks instanceof KeyStore);
assertEquals("Incorrect type", ks.getType(), validValues[i]);
assertEquals("Incorrect provider", ks.getProvider(),
defaultProvider);
@@ -660,26 +657,19 @@
kss[i].setEntry("ZZZ", pKey, pPath);
fail("KeyStoreException should be thrown because password is destroyed");
} catch (KeyStoreException e) {
- } catch (IllegalStateException e) {
- logln("testEntry02: setEntry(..) throws IllegalStateException instead of "
- + "KeyStoreException for destroyed password");
}
+
for (int j = 0; j < aliases.length; j++) {
try {
kss[i].getEntry(aliases[j], pPath);
fail("KeyStoreException should be thrown because password is destroyed");
} catch (KeyStoreException e) {
- } catch (IllegalStateException e) {
- logln("testEntry02: getEntry(..) throws IllegalStateExceptioninstead of "
- +"KeyStoreException for destroyed password");
}
+
try {
kss[i].getEntry(aliases[j], pPar);
fail("UnrecoverableEntryExceptionn should be thrown");
} catch (UnrecoverableEntryException e) {
- } catch (UnsupportedOperationException e) {
- logln("testEntry02: getEntry(..) throws UnsupportedOperationException, "
- + "but expected UnrecoverableEntryException");
}
}
}
@@ -727,11 +717,11 @@
try {
kss[i].setEntry(aliases[j], sKey, pPath);
} catch (KeyStoreException e) {
- logln("testEntry03: non-PrivateKeys not supported.");
- return;
+ //logln("testEntry03: non-PrivateKeys not supported.");
+ return;
}
}
- KeyStore.Entry en;
+
for (int j = 0; j < aliases.length; j++) {
assertTrue("Incorrect alias", kss[i].containsAlias(aliases[j]));
assertTrue("Not KeyEntry", kss[i].isKeyEntry(aliases[j]));
@@ -740,7 +730,7 @@
try {
key1 = kss[i].getKey(aliases[j], pwd);
} catch (UnrecoverableKeyException e) {
- logln("testEntry03: non-PrivateKeys not supported.");
+ //logln("testEntry03: non-PrivateKeys not supported.");
return;
}
if (!secKey.getAlgorithm().equals(key1.getAlgorithm()) ||
@@ -904,19 +894,14 @@
fail("KeyStoreException or IllegalArgumentException should be thrown "
+ "when chain is null and key is private");
} catch (KeyStoreException e) {
- } catch (IllegalArgumentException e) {
- logln("testEntry05: setKeyEntry throws IllegalArgumentException for "
- + "private key and null chain");
}
try {
kss[i].setKeyEntry("ZZZ", key, pwd, new MCertificate[0]);
fail("KeyStoreException or IllegalArgumentException should be thrown "
+ "when chain is empty and key is private");
} catch (KeyStoreException e) {
- } catch (IllegalArgumentException e) {
- logln("testEntry05: setKeyEntry throws IllegalArgumentException "
- + "for private key and emptyl chain");
}
+
for (int j = 0; j < aliases.length; j++) {
kss[i].setKeyEntry(aliases[j], key, pwd, certs);
}
@@ -968,8 +953,8 @@
assertEquals("Incorrect certificate", cc[t], certs[t]);
}
}
- assertEquals(kss[i].getCertificateAlias((Certificate)cert), null);
- String ss = kss[i].getCertificateAlias((Certificate)certs[0]);
+ assertEquals(kss[i].getCertificateAlias(cert), null);
+ String ss = kss[i].getCertificateAlias(certs[0]);
boolean ans = false;
for (int j = 1; j < aliases.length; j++) {
if (ss.equals(aliases[j])) {
@@ -1079,7 +1064,7 @@
char [] pwd = {'p', 'a', 's', 's', 'w', 'd'};
String aliasKE = "KeyAlias";
KeyStore.PasswordProtection pp = new KeyStore.PasswordProtection(pwd);
- KeyStore.PasswordProtection anotherPath = new KeyStore.PasswordProtection(new char[0]);
+ new KeyStore.PasswordProtection(new char[0]);
KeyStore [] kss = createKS();
assertNotNull("KeyStore objects were not created", kss);
@@ -1126,7 +1111,6 @@
KeyStoreSpi spi = new MyKeyStoreSpi();
KeyStore keySt = new tmpKeyStore(spi, defaultProvider,
defaultType);
- assertTrue("Not CertStore object", keySt instanceof KeyStore);
assertEquals("Incorrect name", keySt.getType(),
defaultType);
assertEquals("Incorrect provider", keySt.getProvider(), defaultProvider);
@@ -1137,7 +1121,6 @@
} catch (KeyStoreException e) {
}
keySt = new tmpKeyStore(null, null, null);
- assertTrue("Not CertStore object", keySt instanceof KeyStore);
assertNull("Aalgorithm must be null", keySt.getType());
assertNull("Provider must be null", keySt.getProvider());
try {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest2.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest2.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest2.java Tue Jan 31 03:01:12 2006
@@ -33,7 +33,7 @@
import org.apache.harmony.security.SpiEngUtils;
import org.apache.harmony.security.cert.MyCertificate;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
import java.util.Date;
@@ -43,7 +43,7 @@
*
*/
-public class KeyStoreTest2 extends PerformanceTest {
+public class KeyStoreTest2 extends TestCase {
private static final String KeyStoreProviderClass = "java.security.MyKeyStoreSpi";
@@ -153,32 +153,29 @@
fail("IOException must be thrown");
} catch (IOException e) {
}
+
KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(
new KeyStore.PasswordProtection(new char[0]));
try {
keyS.store(null);
fail("IOException must be thrown when param is null");
} catch (IOException e) {
- } catch (UnsupportedOperationException e) {
- logln("store(null) throws UnsupportedOperationException, but expected IOException");
- } catch (IllegalArgumentException e) {
- logln("store(null) throws IllegalArgumentException, but expected IOException");
}
+
try {
keyS.load(null);
- logln("load(null) does not throw any exception");
+ fail("load(null) does not throw any exception");
} catch (IOException e) {
}
+
try {
keyS.store(lParam);
fail("UnsupportedOperationException must be thrown");
} catch (UnsupportedOperationException e) {
}
- try {
- keyS.load(lParam);
- } catch (UnsupportedOperationException e) {
- logln("load(LoadSroreParameter) throws UnsupportedOperationException");
- }
+
+ keyS.load(lParam);
+
assertFalse("Incorrect result of entryInstanceOf", keyS
.entryInstanceOf(alias, alias.getClass()));
}
@@ -216,7 +213,7 @@
}
MyCertificate mc = new MyCertificate("type", new byte[0]);
try {
- keyS.getCertificateAlias((Certificate) mc);
+ keyS.getCertificateAlias(mc);
fail(eMsg);
} catch (KeyStoreException e) {
}
@@ -233,7 +230,7 @@
KeyStore.PasswordProtection pp = new KeyStore.PasswordProtection(
new char[0]);
try {
- keyS.getEntry(alias, (KeyStore.ProtectionParameter) pp);
+ keyS.getEntry(alias, pp);
fail(eMsg);
} catch (KeyStoreException e) {
}
@@ -320,8 +317,6 @@
KeyStore keyS;
for (int i = 0; i < validValues.length; i++) {
keyS = KeyStore.getInstance(validValues[i]);
- assertTrue("Not instanceof KeyStore object",
- keyS instanceof KeyStore);
assertEquals("Incorrect type", keyS.getType(), validValues[i]);
assertEquals("Incorrect provider", keyS.getProvider(), mProv);
checkKeyStoreException(keyS);
@@ -379,8 +374,6 @@
KeyStore keyS;
for (int i = 0; i < validValues.length; i++) {
keyS = KeyStore.getInstance(validValues[i], mProv.getName());
- assertTrue("Not instanceof KeyStore object",
- keyS instanceof KeyStore);
assertEquals("Incorrect type", keyS.getType(), validValues[i]);
assertEquals("Incorrect provider", keyS.getProvider().getName(),
mProv.getName());
@@ -428,8 +421,6 @@
KeyStore keyS;
for (int i = 0; i < validValues.length; i++) {
keyS = KeyStore.getInstance(validValues[i], mProv);
- assertTrue("Not instanceof KeyStore object",
- keyS instanceof KeyStore);
assertEquals("Incorrect type", keyS.getType(), validValues[i]);
assertEquals("Incorrect provider", keyS.getProvider(), mProv);
checkKeyStoreException(keyS);
@@ -440,4 +431,4 @@
junit.textui.TestRunner.run(KeyStoreTest2.class);
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest3.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest3.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest3.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyStoreTest3.java Tue Jan 31 03:01:12 2006
@@ -31,7 +31,7 @@
import java.security.spec.InvalidKeySpecException;
import org.apache.harmony.security.SpiEngUtils;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -39,7 +39,7 @@
*
*/
-public class KeyStoreTest3 extends PerformanceTest {
+public class KeyStoreTest3 extends TestCase {
private static final String KeyStoreProviderClass = "java.security.MyKeyStore";
@@ -159,11 +159,13 @@
} catch (IOException e) {
} catch (NullPointerException e) {
}
+
try {
kss[i].store(bos, null);
- logln("store(...) does not throw any exception when password is null");
+ fail("store(...) does not throw any exception when password is null");
} catch (IOException e) {
}
+
kss[i].store(bos, pwd);
ByteArrayInputStream bis = new ByteArrayInputStream(bos
.toByteArray());
@@ -306,4 +308,4 @@
public static void main(String args[]) {
junit.textui.TestRunner.run(KeyStoreTest3.class);
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/KeyTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
import java.security.Key;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -31,7 +31,7 @@
*
*/
-public class KeyTest extends PerformanceTest {
+public class KeyTest extends TestCase {
/**
* Constructor for KeyTest.
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestSpiTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestSpiTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestSpiTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestSpiTest.java Tue Jan 31 03:01:12 2006
@@ -23,14 +23,14 @@
import java.nio.ByteBuffer;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>MessageDigestSpi</code> constructor and methods
*
*/
-public class MessageDigestSpiTest extends PerformanceTest {
+public class MessageDigestSpiTest extends TestCase {
public void testEngineGetDigestLength() {
MyMessageDigest md = new MyMessageDigest();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestTest1.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestTest1.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestTest1.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestTest1.java Tue Jan 31 03:01:12 2006
@@ -21,13 +21,13 @@
package java.security;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>MessageDigest</code> constructor and methods
*
*/
-public class MessageDigestTest1 extends PerformanceTest {
+public class MessageDigestTest1 extends TestCase {
public void testReset() {
MyMessageDigest1 md = new MyMessageDigest1("ABC");
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestTest2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestTest2.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestTest2.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/MessageDigestTest2.java Tue Jan 31 03:01:12 2006
@@ -21,13 +21,13 @@
package java.security;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>MessageDigest</code> constructor and methods
*
*/
-public class MessageDigestTest2 extends PerformanceTest {
+public class MessageDigestTest2 extends TestCase {
/**
* Provider
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/NoSuchAlgorithmExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/NoSuchAlgorithmExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/NoSuchAlgorithmExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/NoSuchAlgorithmExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
import java.security.NoSuchAlgorithmException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -31,7 +31,7 @@
* methods.
*
*/
-public class NoSuchAlgorithmExceptionTest extends PerformanceTest {
+public class NoSuchAlgorithmExceptionTest extends TestCase {
public static void main(String[] args) {
}
@@ -79,7 +79,6 @@
*/
public void testNoSuchAlgorithmException01() {
NoSuchAlgorithmException tE = new NoSuchAlgorithmException();
- assertTrue(errNotExc, tE instanceof NoSuchAlgorithmException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -98,8 +97,6 @@
NoSuchAlgorithmException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new NoSuchAlgorithmException(msgs[i]);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof NoSuchAlgorithmException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -119,7 +116,6 @@
public void testNoSuchAlgorithmException03() {
String msg = null;
NoSuchAlgorithmException tE = new NoSuchAlgorithmException(msg);
- assertTrue(errNotExc, tE instanceof NoSuchAlgorithmException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -137,7 +133,6 @@
public void testNoSuchAlgorithmException04() {
Throwable cause = null;
NoSuchAlgorithmException tE = new NoSuchAlgorithmException(cause);
- assertTrue(errNotExc, tE instanceof NoSuchAlgorithmException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -154,7 +149,6 @@
*/
public void testNoSuchAlgorithmException05() {
NoSuchAlgorithmException tE = new NoSuchAlgorithmException(tCause);
- assertTrue(errNotExc, tE instanceof NoSuchAlgorithmException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -178,7 +172,6 @@
*/
public void testNoSuchAlgorithmException06() {
NoSuchAlgorithmException tE = new NoSuchAlgorithmException(null, null);
- assertTrue(errNotExc, tE instanceof NoSuchAlgorithmException);
assertNull("getMessage() must return null", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -197,8 +190,6 @@
NoSuchAlgorithmException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new NoSuchAlgorithmException(msgs[i], null);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof NoSuchAlgorithmException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -217,7 +208,6 @@
*/
public void testNoSuchAlgorithmException08() {
NoSuchAlgorithmException tE = new NoSuchAlgorithmException(null, tCause);
- assertTrue(errNotExc, tE instanceof NoSuchAlgorithmException);
if (tE.getMessage() != null) {
String toS = tCause.toString();
String getM = tE.getMessage();
@@ -243,8 +233,6 @@
NoSuchAlgorithmException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new NoSuchAlgorithmException(msgs[i], tCause);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof NoSuchAlgorithmException);
String getM = tE.getMessage();
String toS = tCause.toString();
if (msgs[i].length() > 0) {
@@ -266,4 +254,4 @@
}
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/NoSuchProviderExceptionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/NoSuchProviderExceptionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/NoSuchProviderExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/NoSuchProviderExceptionTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
import java.security.NoSuchProviderException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -31,7 +31,7 @@
* methods.
*
*/
-public class NoSuchProviderExceptionTest extends PerformanceTest {
+public class NoSuchProviderExceptionTest extends TestCase {
public static void main(String[] args) {
}
@@ -66,8 +66,6 @@
static Throwable tCause = new Throwable("Throwable for exception");
- private static String errNotExc = "Exception is not NoSuchProviderException";
-
static String createErr(Exception tE, Exception eE) {
return "NoSuchProvideException: ".concat(tE.toString()).concat(
" is not equal to caught exception: ").concat(eE.toString());
@@ -79,7 +77,6 @@
*/
public void testNoSuchProviderException01() {
NoSuchProviderException tE = new NoSuchProviderException();
- assertTrue(errNotExc, tE instanceof NoSuchProviderException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -98,8 +95,6 @@
NoSuchProviderException tE;
for (int i = 0; i < msgs.length; i++) {
tE = new NoSuchProviderException(msgs[i]);
- assertTrue(errNotExc.concat(" (msg: ").concat(msgs[i]).concat(")"),
- tE instanceof NoSuchProviderException);
assertEquals("getMessage() must return: ".concat(msgs[i]), tE
.getMessage(), msgs[i]);
assertNull("getCause() must return null", tE.getCause());
@@ -119,7 +114,6 @@
public void testNoSuchProviderException03() {
String msg = null;
NoSuchProviderException tE = new NoSuchProviderException(msg);
- assertTrue(errNotExc, tE instanceof NoSuchProviderException);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
try {
@@ -129,4 +123,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionCollectionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionCollectionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionCollectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionCollectionTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
import java.util.*;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -31,7 +31,7 @@
*
*/
-public class PermissionCollectionTest extends PerformanceTest {
+public class PermissionCollectionTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(PermissionCollectionTest.class);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionTest.java Tue Jan 31 03:01:12 2006
@@ -21,13 +21,13 @@
package java.security;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
* Tests for <code>Permission</code>
*/
-public class PermissionTest extends PerformanceTest {
+public class PermissionTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(PermissionTest.class);
@@ -109,4 +109,4 @@
public void testCollection() {
assertNull(new RealPermission("123").newPermissionCollection());
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionsTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionsTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionsTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PermissionsTest.java Tue Jan 31 03:01:12 2006
@@ -27,7 +27,7 @@
import java.util.Enumeration;
import java.util.NoSuchElementException;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -35,7 +35,7 @@
*
*/
-public class PermissionsTest extends PerformanceTest {
+public class PermissionsTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(PermissionsTest.class);
@@ -209,4 +209,4 @@
}
- }
\ No newline at end of file
+ }
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PolicyTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PolicyTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PolicyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PolicyTest.java Tue Jan 31 03:01:12 2006
@@ -26,7 +26,7 @@
import java.util.HashSet;
import org.apache.harmony.security.fortress.DefaultPolicy;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
import org.apache.harmony.security.test.SecurityChecker;
@@ -35,7 +35,7 @@
*
*/
-public class PolicyTest extends PerformanceTest {
+public class PolicyTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(PolicyTest.class);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PrivateKeyTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PrivateKeyTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PrivateKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/PrivateKeyTest.java Tue Jan 31 03:01:12 2006
@@ -23,7 +23,7 @@
import java.security.PrivateKey;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -31,7 +31,7 @@
*
*/
-public class PrivateKeyTest extends PerformanceTest {
+public class PrivateKeyTest extends TestCase {
/**
* Constructor for PrivateKeyTest.
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/ProtectionDomainTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/ProtectionDomainTest.java?rev=373789&r1=373788&r2=373789&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/ProtectionDomainTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security2/test/common/unit/java/security/ProtectionDomainTest.java Tue Jan 31 03:01:12 2006
@@ -25,7 +25,7 @@
import java.net.MalformedURLException;
import java.net.URLClassLoader;
-import org.apache.harmony.security.test.PerformanceTest;
+import junit.framework.TestCase;
/**
@@ -33,7 +33,7 @@
*
*/
-public class ProtectionDomainTest extends PerformanceTest {
+public class ProtectionDomainTest extends TestCase {
/**
* Entry point for standalone runs.
@@ -272,4 +272,4 @@
}
}
-}
\ No newline at end of file
+}