harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r413841 [3/9] - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src: main/java/common/java/security/ test/api/java.injected/java/security/ test/api/java/org/apache/harmony/security/tests/java/security/ test/impl/java.injected...
Date Tue, 13 Jun 2006 08:58:17 GMT
Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.KeyException;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyManagementExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyManagementExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyManagementExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyManagementExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyManagementExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyManagementExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyManagementExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.KeyManagementException;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator1Test.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGenerator1Test.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator1Test.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator1Test.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGenerator1Test.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGenerator1Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator1Test.java Tue Jun 13 01:58:11 2006
@@ -19,9 +19,9 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 
+import java.security.*;
 import java.math.BigInteger;
 import java.security.spec.AlgorithmParameterSpec;
 

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator2Test.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGenerator2Test.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator2Test.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator2Test.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGenerator2Test.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGenerator2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator2Test.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import java.security.spec.AlgorithmParameterSpec;
 
 import org.apache.harmony.security.tests.support.MyKeyPairGenerator1;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator3Test.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGenerator3Test.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator3Test.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator3Test.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGenerator3Test.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGenerator3Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGenerator3Test.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import org.apache.harmony.security.tests.support.SpiEngUtils;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGeneratorSpiTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGeneratorSpiTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGeneratorSpiTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGeneratorSpiTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGeneratorSpiTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairGeneratorSpiTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairGeneratorSpiTest.java Tue Jun 13 01:58:11 2006
@@ -19,9 +19,9 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 
+import java.security.*;
 import java.security.spec.AlgorithmParameterSpec;
 
 import org.apache.harmony.security.tests.support.MyKeyPairGeneratorSpi;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyPairTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyPairTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import java.security.spec.InvalidKeySpecException;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyRepTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyRepTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyRepTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyRepTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyRepTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyRepTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyRepTest.java Tue Jun 13 01:58:11 2006
@@ -19,12 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
-//import java.io.NotSerializableException;
-//import java.io.ObjectStreamException;
-//import java.util.Set;
-//import java.util.Iterator;
+package org.apache.harmony.security.tests.java.security;
 
 import junit.framework.TestCase;
 

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyStoreExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyStoreExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyStoreExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.KeyStoreException;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreSpiTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyStoreSpiTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreSpiTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreSpiTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyStoreSpiTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyStoreSpiTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreSpiTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import java.io.IOException;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateException;

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java?rev=413841&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java Tue Jun 13 01:58:11 2006
@@ -0,0 +1,214 @@
+/*
+ *  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 org.apache.harmony.security.tests.java.security;
+
+import java.io.IOException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.cert.Certificate;
+
+import org.apache.harmony.security.tests.support.KeyStoreTestSupport;
+import org.apache.harmony.security.tests.support.MyLoadStoreParams;
+import org.apache.harmony.security.tests.support.SpiEngUtils;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>KeyStore</code> constructor and methods
+ * 
+ */
+
+public class KeyStoreTest extends TestCase {
+
+    private static final String KeyStoreProviderClass = "org.apache.harmony.security.tests.support.MyKeyStore";
+
+    private static final String defaultType = "KeyStore";
+
+    public static boolean KSSupported = false;
+
+    public static String defaultProviderName = null;
+
+    public static Provider defaultProvider = null;
+
+    private static String NotSupportMsg = "Default KeyStore type is not supported";
+
+    Provider mProv;
+
+    public KeyStore[] createKS() throws Exception {
+        assertTrue(NotSupportMsg, KSSupported);
+        KeyStore[] kpg = new KeyStore[3];
+
+        kpg[0] = KeyStore.getInstance(defaultType);
+        kpg[1] = KeyStore.getInstance(defaultType, defaultProvider);
+        kpg[2] = KeyStore.getInstance(defaultType, defaultProviderName);
+        return kpg;
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        mProv = (new SpiEngUtils()).new MyProvider("MyKSProvider",
+                "Testing provider", KeyStoreTestSupport.srvKeyStore.concat(".")
+                        .concat(defaultType), KeyStoreProviderClass);
+        Security.insertProviderAt(mProv, 2);
+        defaultProvider = SpiEngUtils.isSupport(defaultType,
+                KeyStoreTestSupport.srvKeyStore);
+        KSSupported = (defaultProvider != null);
+        defaultProviderName = (KSSupported ? defaultProvider.getName() : null);
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        Security.removeProvider(mProv.getName());
+    }
+
+    /**
+     * Test for <code>load(LoadStoreParameter param)</code> 
+     * <code>store(LoadStoreParameter param)</code>
+     * methods 
+     * Assertions: throw IllegalArgumentException if param is null;
+     */
+    public void testLoadStore02() throws Exception {
+        assertTrue(NotSupportMsg, KSSupported);
+
+        KeyStore[] kss = createKS();
+        assertNotNull("KeyStore objects were not created", kss);
+
+        for (int i = 0; i < kss.length; i++) {
+            try {
+                kss[i].load(null);
+                fail("IOException or IllegalArgumentException should be thrown for null parameter");
+            } catch (IOException e) {
+            } catch (IllegalArgumentException e) {
+            }
+            kss[i].load(null, null);
+            try {
+                kss[i].store(null);
+                fail("IOException or IllegalArgumentException should be thrown for nill parameter");
+            } catch (IOException e) {
+            } catch (IllegalArgumentException e) {
+            }
+        }
+        KeyStore.LoadStoreParameter lParam = new MyLoadStoreParams(
+                new KeyStore.PasswordProtection(new char[0]));
+        for (int i = 0; i < kss.length; i++) {
+            kss[i].load(lParam);
+            assertEquals("Incorrect result", kss[i].size(), 0);
+            kss[i].store(lParam);
+        }
+    }
+
+    
+    /**
+     * Test for <code>setKeyEntry(String alias, bute[] key, Certificate[] chain)</code> 
+     * method 
+     * Assertion: stores KeyEntry.
+     */
+    public void testSetKeyEntry() throws Exception {
+        assertTrue(NotSupportMsg, KSSupported);
+        
+        KeyStore[] kss = createKS();
+        assertNotNull("KeyStore objects were not created", kss);
+        byte[] kk = { (byte) 1, (byte) 2, (byte) 127, (byte) 77 };
+        String alias = "keyEntry";
+        char[] pwd = new char[0];
+        byte[] res;
+        Certificate certs[] = {
+                new KeyStoreTestSupport.MCertificate(alias, kk),
+                new KeyStoreTestSupport.MCertificate(alias, kk) };
+        for (int i = 0; i < kss.length; i++) {
+            kss[i].load(null, null);
+            try {
+                kss[i].setKeyEntry("proba", null, null);
+                fail("KeyStoreException must be thrown");
+            } catch (KeyStoreException e) {
+            }
+            kss[i].setKeyEntry(alias, kk, certs);
+            res = kss[i].getKey(alias, pwd).getEncoded();
+            assertEquals(kk.length, res.length);
+            for (int j = 0; j < res.length; j++) {
+                assertEquals(res[j], kk[j]);
+            }
+            assertEquals(kss[i].getCertificateChain(alias).length, certs.length);
+            kss[i].setKeyEntry(alias, kk, null);
+            res = kss[i].getKey(alias, pwd).getEncoded();
+            assertEquals(kk.length, res.length);
+            for (int j = 0; j < res.length; j++) {
+                assertEquals(res[j], kk[j]);
+            }
+            assertNull(kss[i].getCertificateChain(alias));
+        }
+    }
+
+    /**
+     * Test for <code>getDefaultType()</code> method Assertion: returns
+     * default security key store type or "jks" string
+     */
+    public void testKeyStore01() {
+        String propName = "keystore.type";
+        String defKSType = Security.getProperty(propName);
+        String dType = KeyStore.getDefaultType();
+        String resType = defKSType;
+        if (resType == null) {
+            resType = defaultType;
+        }
+        assertNotNull("Default type have not be null", dType);
+        assertEquals("Incorrect default type", dType, resType);
+        
+        if (defKSType == null) {
+            Security.setProperty(propName, defaultType);
+            dType = KeyStore.getDefaultType();
+            resType = Security.getProperty(propName);
+            assertNotNull("Incorrect default type", resType);
+            assertNotNull("Default type have not be null", dType);
+            assertEquals("Incorrect default type", dType, resType);
+        }
+    }
+
+    /**
+     * Test for <code>getInstance(String type)</code> method 
+     * Assertion: 
+     * throws NullPointerException when type is null 
+     * throws KeyStoreException when type is not available
+     * 
+     */
+    public void testKeyStore02() throws KeyStoreException {
+        String[] invalidValues =  SpiEngUtils.invalidValues;
+        try {
+            KeyStore.getInstance(null);
+            fail("NullPointerException must be thrown when type is null");
+        } catch (NullPointerException e) {
+        }
+        for (int i = 0; i < invalidValues.length; i++) {
+            try {
+                KeyStore.getInstance(invalidValues[i]);
+                fail("KeyStoreException must be thrown (type: ".concat(
+                        invalidValues[i]).concat(" )"));
+            } catch (KeyStoreException e) {
+            }
+        }
+    }
+}

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/KeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.Key;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigest1Test.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/MessageDigest1Test.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigest1Test.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigest1Test.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/MessageDigest1Test.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/MessageDigest1Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/MessageDigest1Test.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import org.apache.harmony.security.tests.support.MyMessageDigest1;
 
 import junit.framework.TestCase;
@@ -88,24 +88,6 @@
 	}
 
 	/*
-	 * Class under test for int digest(byte[], int, int)
-	 */
-	public void testDigestbyteArrayintint() {
-		MyMessageDigest1 md = new MyMessageDigest1("ABC");
-		byte[] b = {1, 2, 3, 4, 5};
-		try {
-			if (md.digest(b, 2, 3) != 0) {
-				fail("incorrect result");
-			}			
-		} catch (java.security.DigestException e) {
-			fail(e.toString());
-		}
-		if (!md.runEngineDigest) {
-			fail("digest failed");
-		}
-	}
-
-	/*
 	 * Class under test for byte[] digest(byte[])
 	 */
 	public void testDigestbyteArray() {
@@ -116,16 +98,6 @@
 		}
 		if (!md.runEngineDigest) {
 			fail("update failed");
-		}
-	}
-
-	/*
-	 * Class under test for String toString()
-	 */
-	public void testToString() {
-		MyMessageDigest1 md = new MyMessageDigest1("ABC");
-		if (!"MESSAGE DIGEST ABC".equals(md.toString())) {
-			fail("incorrect result");			
 		}
 	}
 

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/NoSuchAlgorithmExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/NoSuchAlgorithmExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/NoSuchAlgorithmExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/NoSuchAlgorithmExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/NoSuchAlgorithmExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/NoSuchAlgorithmExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/NoSuchAlgorithmExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.NoSuchAlgorithmException;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/NoSuchProviderExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/NoSuchProviderExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/NoSuchProviderExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/NoSuchProviderExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/NoSuchProviderExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/NoSuchProviderExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/NoSuchProviderExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.NoSuchProviderException;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionCollectionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PermissionCollectionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionCollectionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionCollectionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PermissionCollectionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PermissionCollectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionCollectionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import java.util.*;
 
 import junit.framework.TestCase;
@@ -66,21 +66,7 @@
             return false;
         }
     }
-    
-    /** Test toString() transformation with different elements. */
-    public void testToString()
-    {
-        // no elements
-        PermissionCollection pc = new RealPermissionCollection(null);
-        String superString = pc.getClass().getName() + "@" + Integer.toHexString(pc.hashCode());
-        assertEquals("no elements", superString + " (\n)", pc.toString());
         
-        // several elements
-        pc = new RealPermissionCollection(Arrays.asList(new Object[]{"aaa", "bbb", "ccc"}));
-        superString = pc.getClass().getName() + "@" + Integer.toHexString(pc.hashCode());
-        assertEquals("several elements", superString + " (\n  aaa\n  bbb\n  ccc\n)", pc.toString());
-    }
-    
     /** Test read-only flag. Should be false by default and can be set once forever. */
     public void testReadOnly()
     {

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PermissionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PermissionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PermissionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import junit.framework.TestCase;
 
 /**

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionsTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PermissionsTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionsTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionsTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PermissionsTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PermissionsTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PermissionsTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -75,67 +75,6 @@
     }
 
     /**
-     * A permission is implied by this collection, if either of the following is
-     * true:
-     * <ul>
-     * <li>This collection contains AllPermission;
-     * <li>This collection has elements of the same type as the permission
-     * being checked, and they imply it;
-     * <li>This collection has UnresolvedPermissions which can be resolved to
-     * the checked type, and after resolving they imply the checked one.
-     * </ul>
-     * The only exception is UnresolvedPermission itself, which is effectively
-     * implied only by AllPermission
-     */
-    public void testImplies() {
-        Permissions ps = new Permissions();
-        Permission ap = new AllPermission();
-        Permission bp1 = new BasicPermission("jhb23jhg5") {
-        };
-        Permission bp2 = new BasicPermission("&%#&^$HJVH") {
-
-            public PermissionCollection newPermissionCollection() {
-                return null;
-            }
-        };
-        Permission sp1 = new SecurityPermission("a.b.c");
-        Permission sp2 = new SecurityPermission("a.b.*");
-        Permission sp3 = new SecurityPermission("a.*");
-        Permission up = new UnresolvedPermission(
-            "java.security.SecurityPermission", "*", null, null);
-
-        Permission[] arr = new Permission[] {
-            ap, bp1, bp2, sp1, sp2, up };
-        for (int i = 0; i < arr.length; i++) {
-            assertFalse(ps.implies(arr[i]));
-        }
-
-        ps.add(bp1);
-        assertTrue(ps.implies(bp1));
-        assertFalse(ps.implies(bp2));
-        assertFalse(ps.implies(ap));
-        assertFalse(ps.implies(sp1));
-
-        ps.add(sp2);
-        assertTrue(ps.implies(sp1));
-        assertTrue(ps.implies(sp2));
-        assertFalse(ps.implies(sp3));
-
-        ps.add(up);
-        assertFalse(ps.implies(up));
-        assertTrue(ps.implies(sp1));
-        assertTrue(ps.implies(sp2));
-        assertTrue(ps.implies(sp3));
-
-        assertFalse(ps.implies(null));
-        ps.add(ap);
-        for (int i = 0; i < arr.length; i++) {
-            assertTrue(ps.implies(arr[i]));
-        }
-        assertTrue(ps.implies(null));
-    }
-
-    /**
      * Should return non-null empty enumeration for empty collection. For
      * non-empty collection, should always return enumeration over unique
      * elements.
@@ -195,10 +134,9 @@
     		fail("should throw NoSuchElementException");
     	} catch (NoSuchElementException e) {}
     	try {
-    		assertFalse(ps.implies(null));
-    		//fail("should throw NPE");
+    		ps.implies(null);
+    		fail("should throw NPE");
     	} catch (NullPointerException e){
-    	    fail("implies() should not fail on null argument");
     	}
     	
     	try {	

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PolicyTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PolicyTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PolicyTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PolicyTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PolicyTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PolicyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PolicyTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import java.util.Collection;
 import java.util.Enumeration;
 import java.util.HashSet;
@@ -106,54 +106,6 @@
 
         public void refresh() {
         }
-    }
-
-    /**
-     * Tests loading of a default provider, both valid and invalid class
-     * references.
-     */
-    public void testGetPolicy_LoadDefaultProvider() {
-        Policy oldPolicy = Policy.getPolicy();
-        String POLICY_PROVIDER = "policy.provider";
-        String oldProvider = Security.getProperty(POLICY_PROVIDER);
-        try {
-            Security.setProperty(POLICY_PROVIDER, TestProvider.class.getName());
-            Policy.setPolicy(null);
-            Policy p = Policy.getPolicy();
-            assertNotNull(p);
-            assertEquals(TestProvider.class.getName(), p.getClass().getName());
-
-            Security.setProperty(POLICY_PROVIDER, "a.b.c.D");
-            Policy.setPolicy(null);
-            p = Policy.getPolicy();
-            assertNotNull(p);
-            //exact type of default provider does not matter
-            //assertEquals(DefaultPolicy.class.getName(), p.getClass().getName());
-        } finally {
-            Security.setProperty(POLICY_PROVIDER, (oldProvider == null) ? ""
-                : oldProvider);
-            Policy.setPolicy(oldPolicy);
-        }
-    }
-
-    /** 
-     * Tests that implies() does proper permission evaluation.
-     */
-    public void testImplies() {
-        TestProvider policy = new TestProvider();
-        SecurityPermission sp = new SecurityPermission("abc");
-        policy.pc = sp.newPermissionCollection();
-        
-        policy.pc.add(sp);
-        assertTrue(policy.implies(new ProtectionDomain(null, null), sp));
-        assertFalse(policy.implies(null, sp));
-        assertFalse(policy.implies(new ProtectionDomain(null, null), null));
-        assertFalse(policy.implies(null, null));
-        
-        ProtectionDomain pd = new ProtectionDomain(null, policy.pc);
-        policy.pc = null;
-        assertTrue(policy.implies(pd, sp));        
-        assertFalse(policy.implies(pd, new AllPermission()));
     }
     
     /** 

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PrivateKeyTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PrivateKeyTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PrivateKeyTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PrivateKeyTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PrivateKeyTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PrivateKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PrivateKeyTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.PrivateKey;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PrivilegedActionExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PrivilegedActionExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PrivilegedActionExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PrivilegedActionExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PrivilegedActionExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PrivilegedActionExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PrivilegedActionExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import junit.framework.TestCase;
 
 /**

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProtectionDomainTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProtectionDomainTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProtectionDomainTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProtectionDomainTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProtectionDomainTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProtectionDomainTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProtectionDomainTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import java.net.URL;
 import java.net.MalformedURLException;
 import java.net.URLClassLoader;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.ProviderException;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderServiceTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderServiceTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderServiceTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderServiceTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderServiceTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderServiceTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderServiceTest.java Tue Jun 13 01:58:11 2006
@@ -19,10 +19,14 @@
 * @version $Revision$
 */
 
-package java.security;
+package org.apache.harmony.security.tests.java.security;
 
+import java.security.Provider;
+import java.security.NoSuchAlgorithmException;
 import java.util.HashMap;
 
+import org.apache.harmony.security.tests.support.RandomImpl;
+
 import junit.framework.TestCase;
 
 
@@ -110,52 +114,30 @@
 			fail("getAttribute(KeySize) failed");			
 		}	
 	}
-
-	public void testNewInstance() {
-		Provider p = new MyProvider();
-		Provider.Service s = new Provider.Service(p,
-                "SecureRandom", "algorithm", "java.security.RandomImpl", null, null);
-		Object o = null;
-		try {
-			o = s.newInstance(null);
-		} catch (NoSuchAlgorithmException e) {
-			e.printStackTrace();
-			fail("newInstance() failed");
-		}
-		if (!(o instanceof RandomImpl)) {
-			fail("incorrect instance");
-		}
-		
-		try {
-			o = s.newInstance(new Object());
-			fail("No expected NoSuchAlgorithmException");
-		} catch (NoSuchAlgorithmException e) {
-		}
-	}
-
-	/*
-	 * Class under test for String toString()
-	 */
-	public void testToString() {
-		Provider p = new MyProvider();
-		Provider.Service s = new Provider.Service(p,
-                "type", "algorithm", "className", null, null);
-		if (!s.toString().equals("Provider MyProvider Service type.algorithm className")) {
-			fail("first toString() failed");
-		}
-		
-		HashMap hm = new HashMap();
-		hm.put("attribute", "value");
-		hm.put("KeySize", "1024");
-		hm.put("AAA", "BBB");	
-		
-		s = new Provider.Service(p, "type", "algorithm", "className", 
-		 		null, hm);
-		if (!s.toString().startsWith("Provider MyProvider Service type.algorithm className\n" +
-				"Attributes ")) {
-			fail("second toString() failed");
-		}
-	}
+    
+    public void testNewInstance() {
+        Provider p = new MyProvider();
+        Provider.Service s = new Provider.Service(p, "SecureRandom",
+                "algorithm",
+                "org.apache.harmony.security.tests.support.RandomImpl",
+                null, null);
+        Object o = null;
+        try {
+            o = s.newInstance(null);
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+            fail("newInstance() failed");
+        }
+        if (!(o instanceof RandomImpl)) {
+            fail("incorrect instance");
+        }
+        
+        try {
+            o = s.newInstance(new Object());
+            fail("No expected NoSuchAlgorithmException");
+        } catch (NoSuchAlgorithmException e) {
+        }
+    }
 	
 	class MyProvider extends Provider {
 		MyProvider() {

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/ProviderTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/ProviderTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/ProviderTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/ProviderTest.java Tue Jun 13 01:58:11 2006
@@ -19,11 +19,10 @@
 * @version $Revision$
 */
 
-package java.security;
+package org.apache.harmony.security.tests.java.security;
+
+import java.security.*;
 
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -32,9 +31,6 @@
 
 import junit.framework.TestCase;
 
-import org.apache.harmony.security.tests.support.SpiEngUtils;
-import org.apache.harmony.security.tests.support.TestUtils;
-
 
 /**
  * Tests for <code>Provider</code> constructor and methods
@@ -108,46 +104,6 @@
     }
 
     /*
-     * Class under test for String toString()
-     */
-    public final void testToString() {
-        if (!"MyProvider provider, Ver. 1.0 Provider for testing".equals(p.toString())) {
-            fail("Incorrect provider.toString()");
-        }
-    }
-
-    /*
-     * Class under test for void load(InputStream)
-     */
-    public final void testLoadInputStream() {
-        FileInputStream fis = null;
-        String fileName = SpiEngUtils.getFileName(TestUtils.TEST_ROOT,
-                "java/security/Provider.prop.dat");
-        try {
-            fis = new FileInputStream(fileName);
-        } catch (FileNotFoundException e) {
-            fail(e.toString());
-        }
-        try {
-            p.load(fis);    
-        } catch (IOException e) {
-            fail(e.toString());
-        }
-
-        if (!"value 1".equals(p.getProperty("Property 1").trim()) ||
-                !"className".equals(p.getProperty("serviceName.algName").trim()) ||    
-                !"attrValue".equals(p.getProperty("serviceName.algName attrName").trim()) ||
-                !"stanbdardName".equals(p.getProperty("Alg.Alias.engineClassName.aliasName").trim()) ||
-                !String.valueOf(p.getName()).equals(p.getProperty("Provider.id name").trim()) ||
-                !String.valueOf(p.getVersion()).equals(p.getProperty("Provider.id version").trim()) ||
-                !String.valueOf(p.getInfo()).equals(p.getProperty("Provider.id info").trim()) ||
-                !p.getClass().getName().equals(p.getProperty("Provider.id className").trim()) ||
-                !"SomeClassName".equals(p.getProperty("MessageDigest.SHA-1").trim()) ) {
-            fail("Incorrect property value");
-        }
-    }
-
-    /*
      * Class under test for void putAll(Map)
      */
     public final void testPutAllMap() {
@@ -174,16 +130,13 @@
         Set s = p.entrySet();
         try {
             s.clear();
-        } catch (UnsupportedOperationException e) {
-        }
-        Set s1 = p.entrySet();
-        if ((s == s1) || s1.isEmpty() ) {
             fail("Must return unmodifiable set");
+        } catch (UnsupportedOperationException e) {
         }
-        if (s1.size() != 8) {    
-            fail("Incorrect set size");
-        }
-        for (Iterator it = s1.iterator(); it.hasNext();) {
+
+        assertEquals("Incorrect set size", 8, s.size());
+
+        for (Iterator it = s.iterator(); it.hasNext();) {
             Entry e = (Entry)it.next();
             String key = (String)e.getKey();
             String val = (String)e.getValue();
@@ -324,169 +277,7 @@
             fail("Service not removed");
         }
     }
-
-    public final void testImplementsAlg() {
-        HashMap hm = new HashMap();
-        hm.put("KeySize", "1024");
-        hm.put("AAA", "BBB");
-        Provider.Service s = new Provider.Service(p, "Type", "Algorithm",
-                "className", null, hm);
-        p.putService(s);
-        if (!p.implementsAlg("Type", "Algorithm", null, null) ||
-                !p.implementsAlg("MessageDigest", "SHA-1", null, null)) {
-            fail("Case 1. implementsAlg failed");
-        }
-        if (!p.implementsAlg("Type", "Algorithm", "KeySize", "512")) {
-            fail("Case 2. implementsAlg failed");
-        }
-        if (p.implementsAlg("Type", "Algorithm", "KeySize", "1025")) {
-            fail("Case 3. implementsAlg failed");
-        }
-        if (!p.implementsAlg("Type", "Algorithm", "AAA", "BBB")) {
-            fail("Case 3. implementsAlg failed");
-        }    
-    }
-
-    public final void testSetProviderNumber() {
-        p.setProviderNumber(100);
-        if (p.getProviderNumber() != 100) {
-            fail("Incorrect ProviderNumber");        
-        }
-    }
-
-    public final void testGetProviderNumber() {
-        if (p.getProviderNumber() != -1) {
-            fail("Case 1. Incorrect ProviderNumber");        
-        }
-        
-        int i = Security.addProvider(p);
-        if (p.getProviderNumber() != i) {
-            fail("Case 2. Incorrect ProviderNumber");        
-        }
-        Security.removeProvider(p.getName());    // clean up
-    }
-
-    public final void testGetService() {
-        try { 
-            p.getService(null, "algorithm");
-            fail("No expected NullPointerException");
-        } catch (NullPointerException e) {
-        }
-        try { 
-            p.getService("type", null);
-            fail("No expected NullPointerException");
-        } catch (NullPointerException e) {
-        }
-        
-        Provider.Service s = new Provider.Service(p, "Type", "Algorithm",
-                "className", null, null);
-        p.putService(s);
-        
-        if (p.getService("Type", "AlgoRithM") != s) {
-            fail("Case 1. getService() failed");
-        }
-        
-        Provider.Service s1 = p.getService("MessageDigest", "AbC");
-        if (s1 == null) {
-            fail("Case 2. getService() failed");            
-        }
-        
-        s = new Provider.Service(p, "MessageDigest", "SHA-1",
-                "className", null, null);
-        p.putService(s);
-        if (s1 == p.getService("MessageDigest", "SHA-1")) {
-            fail("Case 3. getService() failed");
-        }
-        
-        if (p.getService("MessageDigest", "SHA1") == null) {
-            fail("Case 4. getService() failed");
-        }
-    }
-
-    public final void testGetServices() {
-        Provider.Service s = new Provider.Service(p, "Type", "Algorithm",
-                "className", null, null);
-
-        // incomplete services should be removed
-        p.put("serv.alg", "aaaaaaaaaaaaa");
-        p.put("serv.alg KeySize", "11111");
-        p.put("serv1.alg1 KeySize", "222222");
-        p.remove("serv.alg");
-        
-        p.putService(s);
-        Set services = p.getServices();
-        if (services.size() != 3) {
-            fail("incorrect size");
-        }
-        for (Iterator it = services.iterator(); it.hasNext();) {
-            s = (Provider.Service)it.next();
-            if ("Type".equals(s.getType()) &&
-                    "Algorithm".equals(s.getAlgorithm()) &&
-                    "className".equals(s.getClassName())) {
-                continue;
-            }
-            if ("MessageDigest".equals(s.getType()) &&
-                    "SHA-1".equals(s.getAlgorithm()) &&
-                    "SomeClassName".equals(s.getClassName())) {
-                continue;
-            }
-            if ("MessageDigest".equals(s.getType()) &&
-                    "abc".equals(s.getAlgorithm()) &&
-                    "SomeClassName".equals(s.getClassName())) {
-                continue;
-            }    
-            fail("Incorrect service");
-        }
-    }
-
-    public final void testPutService() {
-        HashMap hm = new HashMap();
-        hm.put("KeySize", "1024");
-        hm.put("AAA", "BBB");
-        Provider.Service s = new Provider.Service(p, "Type", "Algorithm",
-                "className", null, hm);
-        p.putService(s);
-        if (s != p.getService("Type", "Algorithm")){
-            fail("putService failed");
-        }
-        if (!"className".equals(p.getProperty("Type.Algorithm"))) {
-            fail("incorrect className");
-        }
-        if (!"1024".equals(p.getProperty("Type.Algorithm KeySize"))) {
-            fail("incorrect attribute");
-        }    
-    }
-
-    public final void testRemoveService() {
-        Provider.Service s = new Provider.Service(p, "Type", "Algorithm",
-                "className", null, null);
-        p.putService(s);
-        p.removeService(s);
-        Set services = p.getServices();
-        if (services.size() != 2) {
-            fail("incorrect size");
-        }
-        
-        for (Iterator it = services.iterator(); it.hasNext();) {
-            s = (Provider.Service)it.next();
-            if ("MessageDigest".equals(s.getType()) &&
-                    "SHA-1".equals(s.getAlgorithm()) &&
-                    "SomeClassName".equals(s.getClassName())) {
-                continue;
-            }
-            if ("MessageDigest".equals(s.getType()) &&
-                    "abc".equals(s.getAlgorithm()) &&
-                    "SomeClassName".equals(s.getClassName())) {
-                continue;
-            }
-            fail("Incorrect service");
-        }
-        
-        if (p.getProperty("Type.Algorithm") != null) {
-            fail("incorrect property");
-        }    
-    }
-    
+ 
     public final void testService1() {
         p.put("MessageDigest.SHA-1", "AnotherClassName");
         Provider.Service s = p.getService("MessageDigest", "SHA-1");

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PublicKeyTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PublicKeyTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PublicKeyTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PublicKeyTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PublicKeyTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/PublicKeyTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/PublicKeyTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.PublicKey;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityPermissionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SecurityPermissionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityPermissionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityPermissionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SecurityPermissionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SecurityPermissionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityPermissionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import junit.framework.TestCase;
 
 /**

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/SecurityTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/SecurityTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/SecurityTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SecurityTest.java Tue Jun 13 01:58:11 2006
@@ -19,11 +19,9 @@
 * @version $Revision$
 */
 
-package java.security;
+package org.apache.harmony.security.tests.java.security;
 
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
+import java.security.*;
 
 import org.apache.harmony.security.tests.support.TestKeyPair;
 
@@ -57,26 +55,7 @@
         }    
 
     }
-    
-    public final void testGetAlgorithmProperty() {
-        if (Security.getAlgorithmProperty(null, "MyService") != null ||
-                Security.getAlgorithmProperty("MyAlgorithm", null) != null) {
-            fail("Incorrect result on null parameter");
-        }
-        if (Security.getAlgorithmProperty("MyAlgorithm", "MyService") != null) {
-            fail("Incorrect result (provider not added)");
-        }
-        Provider p = new MyProvider();
-        Security.addProvider(p);
-        try {
-            if (!"SomeClassName".equals(Security.getAlgorithmProperty("MyAlGoriThm", "MySerVicE"))) {
-                fail("Incorrect result (provider added)");
-            }        
-        } finally { //clean up
-            Security.removeProvider(p.getName());
-        }
-    }
-
+  
     public final void testInsertProviderAt() {
         Provider p = new MyProvider();
         int position;
@@ -203,20 +182,6 @@
     }
 
     /*
-     * Class under test for Provider[] getProviders()
-     */
-    public final void testGetProviders() {
-        Provider[] providers;
-        
-        providers = Security.getProviders();
-        for (int i = 0; i < providers.length; i++) {
-            if (providers[i].getProviderNumber() != i+1) { // position is 1-based
-                fail("Incorrect provider number");
-            }
-        }        
-    }
-
-    /*
      * Class under test for Provider getProvider(String)
      */
     public final void testGetProvider() {
@@ -247,127 +212,6 @@
         }
     }
 
-    /*
-     * Class under test for Provider[] getProviders(String)
-     */
-    public final void testGetProvidersString() {
-        Provider[] providers;
-        try {
-            Security.getProviders("");
-            fail("No expected InvalidParameterException");
-        } catch (InvalidParameterException e) {    
-        }
-        
-        
-        try {
-            Security.getProviders((String)null);
-            fail("No expected NullPointerException");
-        } catch (NullPointerException e) {    
-        }
-        
-        try {
-            Security.getProviders("AAA.BBB CCC");
-            fail("AAA.BBB CCC: No expected InvalidParameterException");
-        } catch (InvalidParameterException  e) {    
-        }
-        
-        Provider p = new MyProvider();
-        
-        try {
-            Security.addProvider(p);
-            providers = Security.getProviders("MyService.MyAlgorithm");
-            if (providers == null ||
-                    providers.length != 1 || 
-                    providers[0] != p) {
-                fail("fail for MyService.MyAlgorithm");
-            }
-            
-            providers = Security.getProviders("MyService.MyAlgorithm KeySize:512");
-            if (providers == null ||
-                    providers.length != 1 ||
-                    providers[0] != p) {
-                fail("fail for MyService.MyAlgorithm KeySize:512");
-            }
-            
-            providers = Security.getProviders("MyService.MyAlgorithm KeySize:1025");
-            if (providers != null) {
-                fail("fail for MyService.MyAlgorithm KeySize:1025");
-            }
-        } finally { //clean up
-            Security.removeProvider(p.getName());
-        }
-    }
-
-    /*
-     * Class under test for Provider[] getProviders(Map)
-     */
-    public final void testGetProvidersMap() {
-        Provider[] providers;
-        Map m = new Properties();
-        Security.getProviders(m);
-        if (Security.getProviders(m) != null) {
-            fail("Not null result on empty map");
-        }
-                
-        try {
-            Security.getProviders((Map)null);
-            fail("No expected NullPointerException");
-        } catch (NullPointerException e) {    
-        }
-        
-        m.clear();
-        m.put("AAA.BBB CCC", "");
-        m.put("AAA.BBB", "");
-        try {
-            Security.getProviders(m);
-            fail("attribute value is empty string: No expected InvalidParameterException");
-        } catch (InvalidParameterException  e) {    
-        }
-        
-        m.clear();
-        m.put("AAA.BBB.CCC", "aaaa");
-        m.put("AAA.BBB", "");
-        try {
-            Security.getProviders(m);
-            fail("value associated with the key is not an empty string: No expected InvalidParameterException");
-        } catch (InvalidParameterException  e) {    
-        }
-        
-        Provider p = new MyProvider();
-        try {
-            Security.addProvider(p);
-            m.clear();
-            m.put("MyService.MyAlgorithm", "");
-            m.put("MessageDigest.SHA-1", "");
-            providers = Security.getProviders(m);
-            if (providers == null || 
-                    providers.length != 1 || 
-                    providers[0] != p) {
-                fail("fail for MyService.MyAlgorithm");
-            }
-            
-            m.clear();
-            m.put("MyService.MyAlgorithm KeySize", "512");
-            m.put("MessageDigest.SHA-1", "");
-            providers = Security.getProviders(m);
-            if (providers == null ||
-                    providers.length != 1 || 
-                    providers[0] != p) {
-                fail("fail for MyService.MyAlgorithm KeySize:512");
-            }
-            
-            m.clear();
-            m.put("MyService.MyAlgorithm KeySize", "1025");
-            m.put("MessageDigest.SHA-1", "");
-            providers = Security.getProviders(m);
-            if (providers != null) {
-                fail("fail for MyService.MyAlgorithm KeySize:1025");
-            }
-        } finally { //clean up
-            Security.removeProvider(p.getName());
-        }
-    }
-
     public final void testSetGetProperty() {
         try {
             Security.getProperty(null);
@@ -397,37 +241,6 @@
             fail("Case 5. Not empty property test failed");            
         }
     
-    }
-
-    public final void testGetAlgorithms() {
-        Set alg1;
-        Set alg2;
-        
-        alg1 = Security.getAlgorithms("AAAAAAAAAAAAAAA");
-        if (alg1 == null || alg1.size() != 0) {
-            fail("fail for non-existent service");
-        }
-        
-        alg1 = Security.getAlgorithms("SecureRandom");
-        alg2 = Security.getAlgorithms("seCuReranDom");
-        if (alg1.size() != alg2.size()) {
-            fail("different size");
-        }
-        if (!alg2.containsAll(alg1)) {
-            fail("different content");
-        }
-        
-        Provider p = new MyProvider();
-        
-        try {
-            Security.addProvider(p);
-            alg1 = Security.getAlgorithms("MyService");
-            if (alg1.size() != 1 || !alg1.contains("MyAlgorithm")) {
-                fail("fail for MyService");
-            }    
-        } finally { //clean up
-            Security.removeProvider(p.getName());
-        }
     }
     
     class MyProvider extends Provider {

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignatureExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignatureExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignatureExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignatureExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignatureExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignatureExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignatureExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.SignatureException;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignedObjectTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignedObjectTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignedObjectTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignedObjectTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignedObjectTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignedObjectTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignedObjectTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import java.io.IOException;
 import java.security.spec.InvalidKeySpecException;
 import java.util.Properties;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignerTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignerTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/SignerTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import org.apache.harmony.security.tests.support.PrivateKeyStub;
 import org.apache.harmony.security.tests.support.PublicKeyStub;
 import org.apache.harmony.security.tests.support.SignerStub;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/TimestampTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/TimestampTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/TimestampTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/TimestampTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/TimestampTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/TimestampTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/TimestampTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import java.security.cert.CertPath;
 import java.util.Date;
 
@@ -45,11 +45,6 @@
     private static final byte[] encoding = { 1, 2, 3 };
 
     private CertPath cpath = new MyCertPath(encoding);
-
-    public void testHashCode() {
-        assertTrue(new Timestamp(now, cpath).hashCode() == (now.hashCode() ^ cpath
-                .hashCode()));
-    }
 
     public void testTimestamp() {
         try {

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnrecoverableEntryExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/UnrecoverableEntryExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnrecoverableEntryExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnrecoverableEntryExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/UnrecoverableEntryExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/UnrecoverableEntryExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnrecoverableEntryExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,8 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
+import java.security.*;
 import junit.framework.TestCase;
 
 /**

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnrecoverableKeyExceptionTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/UnrecoverableKeyExceptionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnrecoverableKeyExceptionTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnrecoverableKeyExceptionTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/UnrecoverableKeyExceptionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/UnrecoverableKeyExceptionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnrecoverableKeyExceptionTest.java Tue Jun 13 01:58:11 2006
@@ -19,8 +19,7 @@
 * @version $Revision$
 */
 
-package java.security;
-
+package org.apache.harmony.security.tests.java.security;
 import java.security.UnrecoverableKeyException;
 
 import junit.framework.TestCase;

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/AllPermissionCollection_ImplTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/AllPermissionCollectionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/AllPermissionCollection_ImplTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/AllPermissionCollection_ImplTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/AllPermissionCollectionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/AllPermissionCollectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/AllPermissionCollection_ImplTest.java Tue Jun 13 01:58:11 2006
@@ -32,11 +32,7 @@
  * 
  */
 
-public class AllPermissionCollectionTest extends TestCase {
-
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(AllPermissionCollectionTest.class);
-    }
+public class AllPermissionCollection_ImplTest extends TestCase {
 
     /**
      * Empty collection implies nothing, non-empty collection implies

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/BasicPermissionCollection_ImplTest.java (from r412639, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/BasicPermissionCollectionTest.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/BasicPermissionCollection_ImplTest.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/BasicPermissionCollection_ImplTest.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/BasicPermissionCollectionTest.java&r1=412639&r2=413841&rev=413841&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/BasicPermissionCollectionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/BasicPermissionCollection_ImplTest.java Tue Jun 13 01:58:11 2006
@@ -39,11 +39,7 @@
  * 
  */
 
-public class BasicPermissionCollectionTest extends TestCase {
-
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(BasicPermissionCollectionTest.class);
-    }
+public class BasicPermissionCollection_ImplTest extends TestCase {
 
     /**
      * Can add only BasicPermissions of the same type as the first added. Cannot

Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/MessageDigestSpi_ImplTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/MessageDigestSpi_ImplTest.java?rev=413841&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/MessageDigestSpi_ImplTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/MessageDigestSpi_ImplTest.java Tue Jun 13 01:58:11 2006
@@ -0,0 +1,68 @@
+/*
+ *  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 Boris V. Kuznetsov
+* @version $Revision$
+*/
+
+package java.security;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests for <code>MessageDigestSpi</code> constructor and methods
+ * 
+ */
+public class MessageDigestSpi_ImplTest extends TestCase {
+	/*
+	 * Class under test for int engineDigest(byte[], int, int)
+	 */
+	public void testEngineDigestbyteArrayintint() throws Exception {
+        MyMessageDigest md = new MyMessageDigest();
+        byte[] b = new byte[5];
+        try {
+            md.engineDigest(null, 1, 1);
+            fail("No expected NullPointerException");
+        } catch (NullPointerException e) {
+        }
+        try {
+            md.engineDigest(b, 3, 10);
+            fail("No expected DigestException");
+        } catch (DigestException e) {
+        }
+
+        assertEquals("incorrect result", 0, md.engineDigest(b, 1, 3));
+    }
+
+	private class MyMessageDigest extends MessageDigestSpi {
+		
+		public void engineReset() {}
+
+		public byte[] engineDigest() {
+			return null;
+		}
+
+		public void engineUpdate(byte arg0) {}
+
+		public void engineUpdate(byte[] arg0, int arg1, int arg2) {}
+
+		public Object clone() throws CloneNotSupportedException {
+			throw new CloneNotSupportedException();
+		}
+	}
+}



Mime
View raw message