harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r443539 [25/29] - in /incubator/harmony/enhanced/classlib/trunk/modules/security: ./ .settings/ META-INF/ make/ src/main/java/common/java/security/ src/main/java/common/java/security/acl/ src/main/java/common/java/security/cert/ src/main/ja...
Date Fri, 15 Sep 2006 01:18:16 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/javax/security/cert/X509CertificateTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/javax/security/cert/X509CertificateTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/javax/security/cert/X509CertificateTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/javax/security/cert/X509CertificateTest.java Thu Sep 14 18:17:39 2006
@@ -1,340 +1,340 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-/**
-* @author Alexander Y. Kleymenov
-* @version $Revision$
-*/
-
-package org.apache.harmony.security.tests.javax.security.cert;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.security.cert.CertificateFactory;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-
-import javax.security.cert.CertificateEncodingException;
-import javax.security.cert.CertificateException;
-import javax.security.cert.CertificateExpiredException;
-import javax.security.cert.CertificateNotYetValidException;
-import javax.security.cert.X509Certificate;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-
-
-/**
- */
-
-public class X509CertificateTest extends TestCase {
-
-    // Testing data was generated by using of classes 
-    // from org.apache.harmony.security.asn1 package encoded
-    // by org.apache.harmony.misc.Base64 class.
-
-    private static String base64cert = 
-        "-----BEGIN CERTIFICATE-----\n" +
-        "MIIC+jCCAragAwIBAgICAiswDAYHKoZIzjgEAwEBADAdMRswGQYDVQQKExJDZXJ0a" +
-        "WZpY2F0ZSBJc3N1ZXIwIhgPMTk3MDAxMTIxMzQ2NDBaGA8xOTcwMDEyNDAzMzMyMF" +
-        "owHzEdMBsGA1UEChMUU3ViamVjdCBPcmdhbml6YXRpb24wGTAMBgcqhkjOOAQDAQE" +
-        "AAwkAAQIDBAUGBwiBAgCqggIAVaOCAhQwggIQMA8GA1UdDwEB/wQFAwMBqoAwEgYD" +
-        "VR0TAQH/BAgwBgEB/wIBBTAUBgNVHSABAf8ECjAIMAYGBFUdIAAwZwYDVR0RAQH/B" +
-        "F0wW4EMcmZjQDgyMi5OYW1lggdkTlNOYW1lpBcxFTATBgNVBAoTDE9yZ2FuaXphdG" +
-        "lvboYaaHR0cDovL3VuaWZvcm0uUmVzb3VyY2UuSWSHBP///wCIByoDolyDsgMwDAY" +
-        "DVR0eAQH/BAIwADAMBgNVHSQBAf8EAjAAMIGZBgNVHSUBAf8EgY4wgYsGBFUdJQAG" +
-        "CCsGAQUFBwMBBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEFBQcDB" +
-        "AYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEFBQcDBwYIKwYBBQUHAwgGCCsGAQUFBw" +
-        "MJBggrBgEFBQgCAgYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GA1UdNgEB/wQDAgE" +
-        "BMA4GBCpNhgkBAf8EAwEBATBkBgNVHRIEXTBbgQxyZmNAODIyLk5hbWWCB2ROU05h" +
-        "bWWkFzEVMBMGA1UEChMMT3JnYW5pemF0aW9uhhpodHRwOi8vdW5pZm9ybS5SZXNvd" +
-        "XJjZS5JZIcE////AIgHKgOiXIOyAzAJBgNVHR8EAjAAMAoGA1UdIwQDAQEBMAoGA1" +
-        "UdDgQDAQEBMAoGA1UdIQQDAQEBMAwGByqGSM44BAMBAQADMAAwLQIUAL4QvoazNWP" +
-        "7jrj84/GZlhm09DsCFQCBKGKCGbrP64VtUt4JPmLjW1VxQA==\n" +
-        "-----END CERTIFICATE-----"; 
-
-    private java.security.cert.X509Certificate cert;
-    private javax.security.cert.X509Certificate tbt_cert;
-
-    protected void setUp() throws Exception {
-        try {
-            ByteArrayInputStream bais =
-                new ByteArrayInputStream(base64cert.getBytes());
-
-            CertificateFactory cf = CertificateFactory.getInstance("X.509");
-            this.cert = (java.security.cert.X509Certificate)
-                                                cf.generateCertificate(bais);
-            this.tbt_cert = X509Certificate.getInstance(cert.getEncoded());
-        } catch (java.security.cert.CertificateException e) {
-            // The requested certificate type is not available.
-            // Test pass..
-            this.cert = null;
-        } catch (javax.security.cert.CertificateException e) {
-            // The requested certificate type is not available.
-            // Test pass..
-            this.cert = null;
-        }
-    }
-
-    /**
-     * getInstance(InputStream inStream) method testing.
-     */
-    public void testGetInstance1() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        try {
-            ByteArrayInputStream bais =
-                new ByteArrayInputStream(cert.getEncoded());
-
-            X509Certificate.getInstance(bais);
-        } catch (java.security.cert.CertificateEncodingException e) {
-            e.printStackTrace();
-            fail("Unexpected CertificateEncodingException was thrown.");
-        } catch (CertificateEncodingException e) {
-            e.printStackTrace();
-            fail("Unexpected CertificateEncodingException was thrown.");
-        } catch (CertificateException e) {
-            // The requested certificate type is not available.
-            // Test pass..
-        }
-        // Regression for HARMONY-756
-		try {
-			X509Certificate.getInstance((InputStream) null);
-		} catch (CertificateException e) {
-			//expected;
-		}
-    }
-
-    /**
-     * getInstance(byte[] certData) method testing.
-     */
-    public void testGetInstance2() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        try {
-            X509Certificate.getInstance(cert.getEncoded());
-        } catch (java.security.cert.CertificateEncodingException e) {
-            e.printStackTrace();
-            fail("Unexpected CertificateEncodingException was thrown.");
-        } catch (CertificateException e) {
-            // The requested certificate type is not available.
-            // Test pass..
-        }
-   		// Regression for HARMONY-756
-		try {
-			X509Certificate.getInstance((byte[]) null);
-		} catch (CertificateException e) {
-			//expected;
-		}
-    }
-
-    /**
-     * checkValidity() method testing.
-     */
-    public void testCheckValidity1() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        Date date = new Date();
-        Date nb_date = tbt_cert.getNotBefore();
-        Date na_date = tbt_cert.getNotAfter();
-        try {
-            tbt_cert.checkValidity();
-            assertFalse("CertificateExpiredException expected",
-                                            date.compareTo(na_date) > 0);
-            assertFalse("CertificateNotYetValidException expected",
-                                            date.compareTo(nb_date) < 0);
-        } catch (CertificateExpiredException e) {
-            assertTrue("Unexpected CertificateExpiredException was thrown",
-                                            date.compareTo(na_date) > 0);
-        } catch (CertificateNotYetValidException e) {
-            assertTrue("Unexpected CertificateNotYetValidException was thrown",
-                                            date.compareTo(nb_date) < 0);
-        }
-    }
-
-    /**
-     * checkValidity(Date date) method testing.
-     */
-    public void testCheckValidity2() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        Date[] date = new Date[4];
-        Calendar calendar = Calendar.getInstance();
-        for (int i=0; i<date.length; i++) {
-            calendar.set(i*50, Calendar.JANUARY, 1);
-            date[i] = calendar.getTime();
-        }
-        Date nb_date = tbt_cert.getNotBefore();
-        Date na_date = tbt_cert.getNotAfter();
-        for (int i=0; i<date.length; i++) {
-            try {
-                tbt_cert.checkValidity(date[i]);
-                assertFalse("CertificateExpiredException expected",
-                                                date[i].compareTo(na_date) > 0);
-                assertFalse("CertificateNotYetValidException expected",
-                                                date[i].compareTo(nb_date) < 0);
-            } catch (CertificateExpiredException e) {
-                assertTrue("Unexpected CertificateExpiredException was thrown",
-                                                date[i].compareTo(na_date) > 0);
-            } catch (CertificateNotYetValidException e) {
-                assertTrue("Unexpected CertificateNotYetValidException "
-                                + "was thrown", date[i].compareTo(nb_date) < 0);
-            }
-        }
-    }
-
-    /**
-     * getVersion() method testing.
-     */
-    public void testGetVersion() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        assertEquals("The version is not correct.",
-                                                tbt_cert.getVersion(), 2);
-    }
-
-    /**
-     * getSerialNumber() method testing.
-     */
-    public void testGetSerialNumber() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        assertEquals("The serial number is not correct.",
-                            tbt_cert.getSerialNumber(), cert.getSerialNumber());
-    }
-
-    /**
-     * getIssuerDN() method testing.
-     */
-    public void testGetIssuerDN() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        assertEquals("The issuer DN is not correct.",
-                                    tbt_cert.getIssuerDN(), cert.getIssuerDN());
-    }
-
-    /**
-     * getSubjectDN() method testing.
-     */
-    public void testGetSubjectDN() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        assertEquals("The subject DN is not correct.",
-                                tbt_cert.getSubjectDN(), cert.getSubjectDN());
-    }
-
-    /**
-     * getNotBefore() method testing.
-     */
-    public void testGetNotBefore() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        assertEquals("The NotBefore date is not correct.",
-                                tbt_cert.getNotBefore(), cert.getNotBefore());
-    }
-
-    /**
-     * getNotAfter() method testing.
-     */
-    public void testGetNotAfter() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        assertEquals("The NotAfter date is not correct.",
-                                tbt_cert.getNotAfter(), cert.getNotAfter());
-    }
-
-    /**
-     * getSigAlgName() method testing.
-     */
-    public void testGetSigAlgName() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        assertEquals("The name of signature algorithm is not correct.",
-                                tbt_cert.getSigAlgName(), cert.getSigAlgName());
-    }
-
-    /**
-     * getSigAlgOID() method testing.
-     */
-    public void testGetSigAlgOID() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        assertEquals("The name of OID of signature algorithm is not correct.",
-                                tbt_cert.getSigAlgOID(), cert.getSigAlgOID());
-    }
-
-    /**
-     * getSigAlgParams() method testing.
-     */
-    public void testGetSigAlgParams() {
-        if (this.cert == null) {
-            // The requested certificate type is not available.
-            // Test can not be applied.
-            return;
-        }
-        assertTrue("The byte array with encoded algorithm parameters "
-                + "is not correct.", Arrays.equals(tbt_cert.getSigAlgParams(),
-                                                    cert.getSigAlgParams()));
-    }
-
-    public static Test suite() {
-        return new TestSuite(X509CertificateTest.class);
-    }
-
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(suite());
-    }
-}
-
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Alexander Y. Kleymenov
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.tests.javax.security.cert;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.security.cert.CertificateFactory;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.security.cert.CertificateEncodingException;
+import javax.security.cert.CertificateException;
+import javax.security.cert.CertificateExpiredException;
+import javax.security.cert.CertificateNotYetValidException;
+import javax.security.cert.X509Certificate;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+
+/**
+ */
+
+public class X509CertificateTest extends TestCase {
+
+    // Testing data was generated by using of classes 
+    // from org.apache.harmony.security.asn1 package encoded
+    // by org.apache.harmony.misc.Base64 class.
+
+    private static String base64cert = 
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIC+jCCAragAwIBAgICAiswDAYHKoZIzjgEAwEBADAdMRswGQYDVQQKExJDZXJ0a" +
+        "WZpY2F0ZSBJc3N1ZXIwIhgPMTk3MDAxMTIxMzQ2NDBaGA8xOTcwMDEyNDAzMzMyMF" +
+        "owHzEdMBsGA1UEChMUU3ViamVjdCBPcmdhbml6YXRpb24wGTAMBgcqhkjOOAQDAQE" +
+        "AAwkAAQIDBAUGBwiBAgCqggIAVaOCAhQwggIQMA8GA1UdDwEB/wQFAwMBqoAwEgYD" +
+        "VR0TAQH/BAgwBgEB/wIBBTAUBgNVHSABAf8ECjAIMAYGBFUdIAAwZwYDVR0RAQH/B" +
+        "F0wW4EMcmZjQDgyMi5OYW1lggdkTlNOYW1lpBcxFTATBgNVBAoTDE9yZ2FuaXphdG" +
+        "lvboYaaHR0cDovL3VuaWZvcm0uUmVzb3VyY2UuSWSHBP///wCIByoDolyDsgMwDAY" +
+        "DVR0eAQH/BAIwADAMBgNVHSQBAf8EAjAAMIGZBgNVHSUBAf8EgY4wgYsGBFUdJQAG" +
+        "CCsGAQUFBwMBBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEFBQcDB" +
+        "AYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEFBQcDBwYIKwYBBQUHAwgGCCsGAQUFBw" +
+        "MJBggrBgEFBQgCAgYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GA1UdNgEB/wQDAgE" +
+        "BMA4GBCpNhgkBAf8EAwEBATBkBgNVHRIEXTBbgQxyZmNAODIyLk5hbWWCB2ROU05h" +
+        "bWWkFzEVMBMGA1UEChMMT3JnYW5pemF0aW9uhhpodHRwOi8vdW5pZm9ybS5SZXNvd" +
+        "XJjZS5JZIcE////AIgHKgOiXIOyAzAJBgNVHR8EAjAAMAoGA1UdIwQDAQEBMAoGA1" +
+        "UdDgQDAQEBMAoGA1UdIQQDAQEBMAwGByqGSM44BAMBAQADMAAwLQIUAL4QvoazNWP" +
+        "7jrj84/GZlhm09DsCFQCBKGKCGbrP64VtUt4JPmLjW1VxQA==\n" +
+        "-----END CERTIFICATE-----"; 
+
+    private java.security.cert.X509Certificate cert;
+    private javax.security.cert.X509Certificate tbt_cert;
+
+    protected void setUp() throws Exception {
+        try {
+            ByteArrayInputStream bais =
+                new ByteArrayInputStream(base64cert.getBytes());
+
+            CertificateFactory cf = CertificateFactory.getInstance("X.509");
+            this.cert = (java.security.cert.X509Certificate)
+                                                cf.generateCertificate(bais);
+            this.tbt_cert = X509Certificate.getInstance(cert.getEncoded());
+        } catch (java.security.cert.CertificateException e) {
+            // The requested certificate type is not available.
+            // Test pass..
+            this.cert = null;
+        } catch (javax.security.cert.CertificateException e) {
+            // The requested certificate type is not available.
+            // Test pass..
+            this.cert = null;
+        }
+    }
+
+    /**
+     * getInstance(InputStream inStream) method testing.
+     */
+    public void testGetInstance1() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        try {
+            ByteArrayInputStream bais =
+                new ByteArrayInputStream(cert.getEncoded());
+
+            X509Certificate.getInstance(bais);
+        } catch (java.security.cert.CertificateEncodingException e) {
+            e.printStackTrace();
+            fail("Unexpected CertificateEncodingException was thrown.");
+        } catch (CertificateEncodingException e) {
+            e.printStackTrace();
+            fail("Unexpected CertificateEncodingException was thrown.");
+        } catch (CertificateException e) {
+            // The requested certificate type is not available.
+            // Test pass..
+        }
+        // Regression for HARMONY-756
+		try {
+			X509Certificate.getInstance((InputStream) null);
+		} catch (CertificateException e) {
+			//expected;
+		}
+    }
+
+    /**
+     * getInstance(byte[] certData) method testing.
+     */
+    public void testGetInstance2() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        try {
+            X509Certificate.getInstance(cert.getEncoded());
+        } catch (java.security.cert.CertificateEncodingException e) {
+            e.printStackTrace();
+            fail("Unexpected CertificateEncodingException was thrown.");
+        } catch (CertificateException e) {
+            // The requested certificate type is not available.
+            // Test pass..
+        }
+   		// Regression for HARMONY-756
+		try {
+			X509Certificate.getInstance((byte[]) null);
+		} catch (CertificateException e) {
+			//expected;
+		}
+    }
+
+    /**
+     * checkValidity() method testing.
+     */
+    public void testCheckValidity1() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        Date date = new Date();
+        Date nb_date = tbt_cert.getNotBefore();
+        Date na_date = tbt_cert.getNotAfter();
+        try {
+            tbt_cert.checkValidity();
+            assertFalse("CertificateExpiredException expected",
+                                            date.compareTo(na_date) > 0);
+            assertFalse("CertificateNotYetValidException expected",
+                                            date.compareTo(nb_date) < 0);
+        } catch (CertificateExpiredException e) {
+            assertTrue("Unexpected CertificateExpiredException was thrown",
+                                            date.compareTo(na_date) > 0);
+        } catch (CertificateNotYetValidException e) {
+            assertTrue("Unexpected CertificateNotYetValidException was thrown",
+                                            date.compareTo(nb_date) < 0);
+        }
+    }
+
+    /**
+     * checkValidity(Date date) method testing.
+     */
+    public void testCheckValidity2() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        Date[] date = new Date[4];
+        Calendar calendar = Calendar.getInstance();
+        for (int i=0; i<date.length; i++) {
+            calendar.set(i*50, Calendar.JANUARY, 1);
+            date[i] = calendar.getTime();
+        }
+        Date nb_date = tbt_cert.getNotBefore();
+        Date na_date = tbt_cert.getNotAfter();
+        for (int i=0; i<date.length; i++) {
+            try {
+                tbt_cert.checkValidity(date[i]);
+                assertFalse("CertificateExpiredException expected",
+                                                date[i].compareTo(na_date) > 0);
+                assertFalse("CertificateNotYetValidException expected",
+                                                date[i].compareTo(nb_date) < 0);
+            } catch (CertificateExpiredException e) {
+                assertTrue("Unexpected CertificateExpiredException was thrown",
+                                                date[i].compareTo(na_date) > 0);
+            } catch (CertificateNotYetValidException e) {
+                assertTrue("Unexpected CertificateNotYetValidException "
+                                + "was thrown", date[i].compareTo(nb_date) < 0);
+            }
+        }
+    }
+
+    /**
+     * getVersion() method testing.
+     */
+    public void testGetVersion() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        assertEquals("The version is not correct.",
+                                                tbt_cert.getVersion(), 2);
+    }
+
+    /**
+     * getSerialNumber() method testing.
+     */
+    public void testGetSerialNumber() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        assertEquals("The serial number is not correct.",
+                            tbt_cert.getSerialNumber(), cert.getSerialNumber());
+    }
+
+    /**
+     * getIssuerDN() method testing.
+     */
+    public void testGetIssuerDN() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        assertEquals("The issuer DN is not correct.",
+                                    tbt_cert.getIssuerDN(), cert.getIssuerDN());
+    }
+
+    /**
+     * getSubjectDN() method testing.
+     */
+    public void testGetSubjectDN() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        assertEquals("The subject DN is not correct.",
+                                tbt_cert.getSubjectDN(), cert.getSubjectDN());
+    }
+
+    /**
+     * getNotBefore() method testing.
+     */
+    public void testGetNotBefore() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        assertEquals("The NotBefore date is not correct.",
+                                tbt_cert.getNotBefore(), cert.getNotBefore());
+    }
+
+    /**
+     * getNotAfter() method testing.
+     */
+    public void testGetNotAfter() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        assertEquals("The NotAfter date is not correct.",
+                                tbt_cert.getNotAfter(), cert.getNotAfter());
+    }
+
+    /**
+     * getSigAlgName() method testing.
+     */
+    public void testGetSigAlgName() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        assertEquals("The name of signature algorithm is not correct.",
+                                tbt_cert.getSigAlgName(), cert.getSigAlgName());
+    }
+
+    /**
+     * getSigAlgOID() method testing.
+     */
+    public void testGetSigAlgOID() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        assertEquals("The name of OID of signature algorithm is not correct.",
+                                tbt_cert.getSigAlgOID(), cert.getSigAlgOID());
+    }
+
+    /**
+     * getSigAlgParams() method testing.
+     */
+    public void testGetSigAlgParams() {
+        if (this.cert == null) {
+            // The requested certificate type is not available.
+            // Test can not be applied.
+            return;
+        }
+        assertTrue("The byte array with encoded algorithm parameters "
+                + "is not correct.", Arrays.equals(tbt_cert.getSigAlgParams(),
+                                                    cert.getSigAlgParams()));
+    }
+
+    public static Test suite() {
+        return new TestSuite(X509CertificateTest.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+}
+

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/javax/security/cert/X509CertificateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/AccessControlContextTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/AccessControlContextTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/AccessControlContextTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/AccessControlContextTest.java Thu Sep 14 18:17:39 2006
@@ -1,81 +1,81 @@
-/* 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.
- */
-
-package tests.api.java.security;
-
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.ProtectionDomain;
-import java.util.PropertyPermission;
-
-public class AccessControlContextTest extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.security.AccessControlContext#AccessControlContext(java.security.ProtectionDomain[])
-	 */
-	public void test_Constructor$Ljava_security_ProtectionDomain() {
-		// Test for method
-		// java.security.AccessControlContext(java.security.ProtectionDomain [])
-
-		// Create a permission which is not normally granted
-		final Permission perm = new PropertyPermission("java.class.path",
-				"read");
-		PermissionCollection col = perm.newPermissionCollection();
-		col.add(perm);
-		final ProtectionDomain pd = new ProtectionDomain(null, col);
-		AccessControlContext acc = new AccessControlContext(
-				new ProtectionDomain[] { pd });
-		try {
-			acc.checkPermission(perm);
-		} catch (SecurityException e) {
-			fail("Should have permission");
-		}
-
-		final boolean[] result = new boolean[] { false };
-		Thread th = new Thread(new Runnable() {
-			public void run() {
-				AccessControlContext acc = new AccessControlContext(
-						new ProtectionDomain[] { pd });
-				try {
-					acc.checkPermission(perm);
-					result[0] = true;
-				} catch (SecurityException e) {
-				}
-			}
-		});
-		th.start();
-		try {
-			th.join();
-		} catch (InterruptedException e) {
-			// ignore
-		}
-		assertTrue("Thread should have permission", result[0]);
-	}
-
-	/**
-	 * @tests java.security.AccessControlContext#AccessControlContext(java.security.AccessControlContext,
-	 *        java.security.DomainCombiner)
-	 */
-	public void test_ConstructorLjava_security_AccessControlContextLjava_security_DomainCombiner() {
-		AccessControlContext context = AccessController.getContext();
-		try {
-			new AccessControlContext(context, null);
-		} catch (NullPointerException e) {
-			fail("should not throw NullPointerException");
-		}
-	}
+/* 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.
+ */
+
+package tests.api.java.security;
+
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.ProtectionDomain;
+import java.util.PropertyPermission;
+
+public class AccessControlContextTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.security.AccessControlContext#AccessControlContext(java.security.ProtectionDomain[])
+	 */
+	public void test_Constructor$Ljava_security_ProtectionDomain() {
+		// Test for method
+		// java.security.AccessControlContext(java.security.ProtectionDomain [])
+
+		// Create a permission which is not normally granted
+		final Permission perm = new PropertyPermission("java.class.path",
+				"read");
+		PermissionCollection col = perm.newPermissionCollection();
+		col.add(perm);
+		final ProtectionDomain pd = new ProtectionDomain(null, col);
+		AccessControlContext acc = new AccessControlContext(
+				new ProtectionDomain[] { pd });
+		try {
+			acc.checkPermission(perm);
+		} catch (SecurityException e) {
+			fail("Should have permission");
+		}
+
+		final boolean[] result = new boolean[] { false };
+		Thread th = new Thread(new Runnable() {
+			public void run() {
+				AccessControlContext acc = new AccessControlContext(
+						new ProtectionDomain[] { pd });
+				try {
+					acc.checkPermission(perm);
+					result[0] = true;
+				} catch (SecurityException e) {
+				}
+			}
+		});
+		th.start();
+		try {
+			th.join();
+		} catch (InterruptedException e) {
+			// ignore
+		}
+		assertTrue("Thread should have permission", result[0]);
+	}
+
+	/**
+	 * @tests java.security.AccessControlContext#AccessControlContext(java.security.AccessControlContext,
+	 *        java.security.DomainCombiner)
+	 */
+	public void test_ConstructorLjava_security_AccessControlContextLjava_security_DomainCombiner() {
+		AccessControlContext context = AccessController.getContext();
+		try {
+			new AccessControlContext(context, null);
+		} catch (NullPointerException e) {
+			fail("should not throw NullPointerException");
+		}
+	}
 }

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/AccessControlContextTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/DomainCombinerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/DomainCombinerTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/DomainCombinerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/DomainCombinerTest.java Thu Sep 14 18:17:39 2006
@@ -1,112 +1,112 @@
-/* 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.
- */
-
-package tests.api.java.security;
-
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.AllPermission;
-import java.security.CodeSource;
-import java.security.DomainCombiner;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.PrivilegedAction;
-import java.security.ProtectionDomain;
-import java.security.SecurityPermission;
-import java.security.cert.Certificate;
-
-public class DomainCombinerTest extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.security.DomainCombiner#combine(java.security.ProtectionDomain[],
-	 *        java.security.ProtectionDomain[])
-	 */
-	public void test_combine$Ljava_security_ProtectionDomain$Ljava_security_ProtectionDomain() {
-		final boolean[] calledDomainCombiner = new boolean[] { false, false };
-
-		class MyCombiner implements DomainCombiner {
-			int i;
-
-			MyCombiner(int i) {
-				this.i = i;
-			}
-
-			public ProtectionDomain[] combine(
-					ProtectionDomain[] executionDomains,
-					ProtectionDomain[] parentDomains) {
-				calledDomainCombiner[i] = true;
-				PermissionCollection pc = new Permissions();
-				pc.add(new AllPermission());
-				ProtectionDomain pd;
-				// if run with the system classloader then there will be no
-				// execution domains 
-				if (executionDomains.length > 0) {
-					pd = new ProtectionDomain(executionDomains[0]
-							.getCodeSource(), pc);
-				} else {
-					pd = new ProtectionDomain(parentDomains[0].getCodeSource(),
-							pc);
-				}
-				return new ProtectionDomain[] { pd };
-			}
-		}
-
-		ProtectionDomain[] domains = new ProtectionDomain[] { new ProtectionDomain(
-				new CodeSource(null, (Certificate[]) null), new Permissions()) };
-
-		AccessControlContext parent = new AccessControlContext(domains);
-		AccessControlContext c0 = new AccessControlContext(parent,
-				new MyCombiner(0));
-		final AccessControlContext c1 = new AccessControlContext(parent,
-				new MyCombiner(1));
-
-        
-        SecurityManager sm = new SecurityManager() {
-            public void checkPermission(Permission p) {
-                if( p == null || !"setSecurityManager".equals(p.getName()) ) {
-                    super.checkPermission(p);   
-                }
-            }
-        };
-        
-        System.setSecurityManager(sm);
-		try {
-			AccessController.doPrivileged(new PrivilegedAction() {
-				public Object run() {
-					// AccessController.getContext();
-					AccessController.checkPermission(new SecurityPermission(
-							"MyTest"));
-
-					AccessController.doPrivileged(new PrivilegedAction() {
-						public Object run() {
-							AccessController
-									.checkPermission(new SecurityPermission(
-											"MyTest"));
-							return null;
-						}
-					}, c1);
-					return null;
-				}
-			}, c0);
-			assertTrue("Failed to combine domains for security permission",
-					calledDomainCombiner[0]);
-			assertTrue("Failed to combine domains for security permission",
-					calledDomainCombiner[1]);
-		} finally {
-			System.setSecurityManager(null);
-		}
-	}
+/* 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.
+ */
+
+package tests.api.java.security;
+
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.CodeSource;
+import java.security.DomainCombiner;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import java.security.SecurityPermission;
+import java.security.cert.Certificate;
+
+public class DomainCombinerTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.security.DomainCombiner#combine(java.security.ProtectionDomain[],
+	 *        java.security.ProtectionDomain[])
+	 */
+	public void test_combine$Ljava_security_ProtectionDomain$Ljava_security_ProtectionDomain() {
+		final boolean[] calledDomainCombiner = new boolean[] { false, false };
+
+		class MyCombiner implements DomainCombiner {
+			int i;
+
+			MyCombiner(int i) {
+				this.i = i;
+			}
+
+			public ProtectionDomain[] combine(
+					ProtectionDomain[] executionDomains,
+					ProtectionDomain[] parentDomains) {
+				calledDomainCombiner[i] = true;
+				PermissionCollection pc = new Permissions();
+				pc.add(new AllPermission());
+				ProtectionDomain pd;
+				// if run with the system classloader then there will be no
+				// execution domains 
+				if (executionDomains.length > 0) {
+					pd = new ProtectionDomain(executionDomains[0]
+							.getCodeSource(), pc);
+				} else {
+					pd = new ProtectionDomain(parentDomains[0].getCodeSource(),
+							pc);
+				}
+				return new ProtectionDomain[] { pd };
+			}
+		}
+
+		ProtectionDomain[] domains = new ProtectionDomain[] { new ProtectionDomain(
+				new CodeSource(null, (Certificate[]) null), new Permissions()) };
+
+		AccessControlContext parent = new AccessControlContext(domains);
+		AccessControlContext c0 = new AccessControlContext(parent,
+				new MyCombiner(0));
+		final AccessControlContext c1 = new AccessControlContext(parent,
+				new MyCombiner(1));
+
+        
+        SecurityManager sm = new SecurityManager() {
+            public void checkPermission(Permission p) {
+                if( p == null || !"setSecurityManager".equals(p.getName()) ) {
+                    super.checkPermission(p);   
+                }
+            }
+        };
+        
+        System.setSecurityManager(sm);
+		try {
+			AccessController.doPrivileged(new PrivilegedAction() {
+				public Object run() {
+					// AccessController.getContext();
+					AccessController.checkPermission(new SecurityPermission(
+							"MyTest"));
+
+					AccessController.doPrivileged(new PrivilegedAction() {
+						public Object run() {
+							AccessController
+									.checkPermission(new SecurityPermission(
+											"MyTest"));
+							return null;
+						}
+					}, c1);
+					return null;
+				}
+			}, c0);
+			assertTrue("Failed to combine domains for security permission",
+					calledDomainCombiner[0]);
+			assertTrue("Failed to combine domains for security permission",
+					calledDomainCombiner[1]);
+		} finally {
+			System.setSecurityManager(null);
+		}
+	}
 }

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/DomainCombinerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PrincipalTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PrincipalTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PrincipalTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PrincipalTest.java Thu Sep 14 18:17:39 2006
@@ -1,36 +1,36 @@
-/* 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.
- */
-
-package tests.api.java.security;
-
-import java.security.Principal;
-
-import javax.security.auth.x500.X500Principal;
-
-public class PrincipalTest extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.security.Principal#equals(java.lang.Object)
-	 */
-	public void test_equalsLjava_lang_Object() {
-		Principal xp1 = new X500Principal(
-				"C=US, ST=California, L=San Diego, O=Apache, OU=Project Harmony, CN=Test cert");
-		assertNotNull(xp1);
-		assertEquals(
-				"Unexpected name",
-				"C=US,ST=California,L=San Diego,O=Apache,OU=Project Harmony,CN=Test cert",
-				xp1.getName());
-	}
+/* 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.
+ */
+
+package tests.api.java.security;
+
+import java.security.Principal;
+
+import javax.security.auth.x500.X500Principal;
+
+public class PrincipalTest extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.security.Principal#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		Principal xp1 = new X500Principal(
+				"C=US, ST=California, L=San Diego, O=Apache, OU=Project Harmony, CN=Test cert");
+		assertNotNull(xp1);
+		assertEquals(
+				"Unexpected name",
+				"C=US,ST=California,L=San Diego,O=Apache,OU=Project Harmony,CN=Test cert",
+				xp1.getName());
+	}
 }

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/tests/api/java/security/PrincipalTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/AllPermissionCollection_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/BasicPermissionCollection_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/MessageDigestSpi_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/Provider_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/Security_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/Signature_Impl1Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/Signature_Impl2Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermissionCollection_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermissionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermissionTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermissionTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermissionTest.java Thu Sep 14 18:17:39 2006
@@ -1,39 +1,39 @@
-/*
- *  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.
- */
-
-package java.security;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for <code>UnresolvedPermission</code> class fields and methods
- * 
- */
-
-public class UnresolvedPermissionTest extends TestCase {
-
-    /**
-     * newPermissionCollection() should return new BasicPermissionCollection on every invokation
-     */
-    public void testCollection()
-    {
-        UnresolvedPermission up = new UnresolvedPermission("a.b.c", null, null, null);
-        PermissionCollection pc1 = up.newPermissionCollection();
-        PermissionCollection pc2 = up.newPermissionCollection();
-        assertTrue((pc1 instanceof UnresolvedPermissionCollection) && (pc2 instanceof UnresolvedPermissionCollection));
-        assertNotSame(pc1, pc2);
-    }
-}
+/*
+ *  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.
+ */
+
+package java.security;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>UnresolvedPermission</code> class fields and methods
+ * 
+ */
+
+public class UnresolvedPermissionTest extends TestCase {
+
+    /**
+     * newPermissionCollection() should return new BasicPermissionCollection on every invokation
+     */
+    public void testCollection()
+    {
+        UnresolvedPermission up = new UnresolvedPermission("a.b.c", null, null, null);
+        PermissionCollection pc1 = up.newPermissionCollection();
+        PermissionCollection pc2 = up.newPermissionCollection();
+        assertTrue((pc1 instanceof UnresolvedPermissionCollection) && (pc2 instanceof UnresolvedPermissionCollection));
+        assertNotSame(pc1, pc2);
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermissionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/UnresolvedPermission_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/cert/X509CRLSelectorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/cert/X509CertSelectorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/java/security/cert/X509CertificateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/PolicyEntryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/SystemScopeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/UnresolvedPrincipalTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/fortress/DefaultPolicyParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/fortress/DefaultPolicyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/fortress/EngineTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/fortress/MyProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/fortress/PolicyUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/fortress/ServicesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/fortress/SomeClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/AlgorithmParameterGenerator_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/CodeSigner_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/CodeSource_ImplTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/CodeSource_ImplTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/CodeSource_ImplTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/CodeSource_ImplTest.java Thu Sep 14 18:17:39 2006
@@ -1,222 +1,222 @@
-/*
- *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-/**
-* @author Alexander V. Astapchuk
-* @version $Revision$
-*/
-
-package org.apache.harmony.security.tests.java.security;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.CodeSigner;
-import java.security.CodeSource;
-import java.security.Provider;
-import java.security.Security;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-
-import javax.security.auth.x500.X500Principal;
-
-import org.apache.harmony.security.tests.support.TestCertUtils;
-
-import junit.framework.TestCase;
-
-/**
- * Unit test for CodeSource.
- * 
- */
-
-public class CodeSource_ImplTest extends TestCase {
-
-    /* Below are various URLs used during the testing */
-    private static URL urlSite;
-
-    static {
-        try {
-            String siteName = "www.intel.com";
-            urlSite = new URL("http://"+siteName+"");
-        } catch (MalformedURLException ex) {
-            throw new Error(ex);
-        }
-    }
-
-    /**
-     * Test for equals(Object)<br>
-     * The signer certificate may contain nulls, and equals() must not fail with NPE 
-     */
-    public void testEqualsObject_03() {
-        Certificate cert0 = new TestCertUtils.TestCertificate();
-        Certificate[] certs0 = new Certificate[] { cert0, null };
-        Certificate[] certs1 = new Certificate[] { null, cert0 };
-        CodeSource thiz = new CodeSource(urlSite, certs0);
-        CodeSource that = new CodeSource(urlSite, certs1);
-        assertTrue(thiz.equals(that));
-    }
-
-    /**
-     * Test for equals(Object)<br>
-     * Checks that both 'null' and not-null certs are taken into account - properly. 
-     */
-    public void testEqualsObject_05() {
-        Certificate cert0 = new TestCertUtils.TestCertificate("cert0");
-        Certificate cert1 = new TestCertUtils.TestCertificate("cert1");
-        Certificate cert2 = new TestCertUtils.TestCertificate("cert2");
-
-        Certificate[] smallSet = new Certificate[] { cert0, cert1 };
-        Certificate[] bigSet = new Certificate[] { cert0, cert1, cert2 };
-
-        CodeSource thiz = new CodeSource(urlSite, smallSet);
-        CodeSource that = new CodeSource(urlSite, (Certificate[]) null);
-        assertFalse(thiz.equals(that));
-
-        that = new CodeSource(urlSite, bigSet);
-        assertFalse(thiz.equals(that));
-
-        thiz = new CodeSource(urlSite, bigSet);
-        that = new CodeSource(urlSite, smallSet);
-        assertFalse(thiz.equals(that));
-
-        thiz = new CodeSource(urlSite, (Certificate[]) null);
-        that = new CodeSource(urlSite, /*any set*/smallSet);
-        assertFalse(thiz.equals(that));
-        assertFalse(that.equals(thiz));
-    }
-
-    /**
-     * getCodeSigners() must not take into account non-X509 certificates.
-     */
-    public void testGetCodeSigners_01() {
-        Certificate[] certs = { new TestCertUtils.TestCertificate("00") };
-        CodeSource cs = new CodeSource(null, certs);
-        assertNull(cs.getCodeSigners());
-    }
-
-    /**
-     * getCodeSigners() must return null if no X509 factory available
-     */
-    public void testGetCodeSigners_02() {
-        ArrayList al = new ArrayList();
-        boolean noMoreFactories = false;
-        try {
-            // remove all providers for x509
-            // 'for' loop here for the sake of avoding endless loop - well, just 
-            // in case if something is wrong with add/remove machinery.
-            // '100' seems reasonable big to remove all necessary providers
-            // ...
-            for (int i = 0; i < 100; i++) {
-                try {
-                    CertificateFactory f = CertificateFactory
-                            .getInstance("X.509");
-                    al.add(f.getProvider());
-                    Security.removeProvider(f.getProvider().getName());
-                } catch (CertificateException ex) {
-                    noMoreFactories = true;
-                    break;
-                }
-            }
-            if (!noMoreFactories) {
-                throw new Error(
-                        "Unable to setup test: too many providers provide X.509");
-            }
-            Certificate[] certs = new Certificate[] { TestCertUtils.rootCA };
-            CodeSource cs = new CodeSource(null, certs);
-            assertNull(cs.getCodeSigners());
-        } finally {
-            // .. and restore providers back - to avoid affecting following tests
-            for (int i = 0; i < al.size(); i++) {
-                Security.addProvider((Provider) al.get(i));
-            }
-        }
-
-    }
-
-    /**
-     * getCodeSigners() must return an array of CodeSigners. Just make sure
-     * the array looks healthy.
-     */
-    public void testGetCodeSigners_03() {
-        TestCertUtils.install_test_x509_factory();
-        try {
-            X500Principal[] ps = TestCertUtils.UniGen.genX500s(3);
-
-            // 2-certs chain 
-            X509Certificate rootCA = TestCertUtils.rootCA;
-            X509Certificate c0 = new TestCertUtils.TestX509Certificate(ps[0],
-                    rootCA.getIssuerX500Principal());
-            //
-            X509Certificate c1 = new TestCertUtils.TestX509Certificate(ps[1],
-                    ps[1]);
-            X509Certificate c2 = new TestCertUtils.TestX509Certificate(ps[2],
-                    ps[2]);
-
-            java.security.cert.Certificate [] certs = new java.security.cert.Certificate[] {
-                    c0, rootCA, c1, c2 };
-            CodeSource cs = new CodeSource(null, certs);
-            CodeSigner[] signers = cs.getCodeSigners();
-
-            // must get exactly 3 CodeSigner-s: one for the chain, and one 
-            // for each of single certs
-            assertEquals(3, signers.length);
-        } finally {
-            TestCertUtils.uninstall_test_x509_factory();
-        }
-    }
-
-    /**
-     * getCodeSigners(). Make sure, that CertException is handled properly
-     */
-    public void testGetCodeSigners_04() {
-        try {
-            TestCertUtils.install_test_x509_factory();
-            X500Principal[] ps = TestCertUtils.UniGen.genX500s(1);
-
-            // 2-certs chain 
-            X509Certificate rootCA = TestCertUtils.rootCA;
-            X509Certificate c0 = new TestCertUtils.TestInvalidX509Certificate(
-                    ps[0], rootCA.getIssuerX500Principal());
-            java.security.cert.Certificate [] certs = new java.security.cert.Certificate[] {
-                    c0, rootCA };
-
-            CodeSource cs = new CodeSource(null, certs);
-            CodeSigner[] signers = cs.getCodeSigners();
-
-            assertNull(signers);
-
-            // Must force a check for 'factory==null' 
-            cs.getCodeSigners();
-        } finally {
-            TestCertUtils.uninstall_test_x509_factory();
-        }
-    }
-    
-
-    /**
-     * @tests java.security.CodeSource#toString()
-     */
-    public void test_toString() throws Exception {
-        // Test for method java.lang.String java.security.CodeSource.toString()
-        CodeSource cs = new CodeSource(new java.net.URL("file:///test"),
-                (Certificate[]) null);
-        assertEquals("toString did not return expected value.",
-                "CodeSource, url=file:/test, <no certificates>", cs.toString());
-    }
-
-}
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Alexander V. Astapchuk
+* @version $Revision$
+*/
+
+package org.apache.harmony.security.tests.java.security;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.CodeSigner;
+import java.security.CodeSource;
+import java.security.Provider;
+import java.security.Security;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+
+import javax.security.auth.x500.X500Principal;
+
+import org.apache.harmony.security.tests.support.TestCertUtils;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test for CodeSource.
+ * 
+ */
+
+public class CodeSource_ImplTest extends TestCase {
+
+    /* Below are various URLs used during the testing */
+    private static URL urlSite;
+
+    static {
+        try {
+            String siteName = "www.intel.com";
+            urlSite = new URL("http://"+siteName+"");
+        } catch (MalformedURLException ex) {
+            throw new Error(ex);
+        }
+    }
+
+    /**
+     * Test for equals(Object)<br>
+     * The signer certificate may contain nulls, and equals() must not fail with NPE 
+     */
+    public void testEqualsObject_03() {
+        Certificate cert0 = new TestCertUtils.TestCertificate();
+        Certificate[] certs0 = new Certificate[] { cert0, null };
+        Certificate[] certs1 = new Certificate[] { null, cert0 };
+        CodeSource thiz = new CodeSource(urlSite, certs0);
+        CodeSource that = new CodeSource(urlSite, certs1);
+        assertTrue(thiz.equals(that));
+    }
+
+    /**
+     * Test for equals(Object)<br>
+     * Checks that both 'null' and not-null certs are taken into account - properly. 
+     */
+    public void testEqualsObject_05() {
+        Certificate cert0 = new TestCertUtils.TestCertificate("cert0");
+        Certificate cert1 = new TestCertUtils.TestCertificate("cert1");
+        Certificate cert2 = new TestCertUtils.TestCertificate("cert2");
+
+        Certificate[] smallSet = new Certificate[] { cert0, cert1 };
+        Certificate[] bigSet = new Certificate[] { cert0, cert1, cert2 };
+
+        CodeSource thiz = new CodeSource(urlSite, smallSet);
+        CodeSource that = new CodeSource(urlSite, (Certificate[]) null);
+        assertFalse(thiz.equals(that));
+
+        that = new CodeSource(urlSite, bigSet);
+        assertFalse(thiz.equals(that));
+
+        thiz = new CodeSource(urlSite, bigSet);
+        that = new CodeSource(urlSite, smallSet);
+        assertFalse(thiz.equals(that));
+
+        thiz = new CodeSource(urlSite, (Certificate[]) null);
+        that = new CodeSource(urlSite, /*any set*/smallSet);
+        assertFalse(thiz.equals(that));
+        assertFalse(that.equals(thiz));
+    }
+
+    /**
+     * getCodeSigners() must not take into account non-X509 certificates.
+     */
+    public void testGetCodeSigners_01() {
+        Certificate[] certs = { new TestCertUtils.TestCertificate("00") };
+        CodeSource cs = new CodeSource(null, certs);
+        assertNull(cs.getCodeSigners());
+    }
+
+    /**
+     * getCodeSigners() must return null if no X509 factory available
+     */
+    public void testGetCodeSigners_02() {
+        ArrayList al = new ArrayList();
+        boolean noMoreFactories = false;
+        try {
+            // remove all providers for x509
+            // 'for' loop here for the sake of avoding endless loop - well, just 
+            // in case if something is wrong with add/remove machinery.
+            // '100' seems reasonable big to remove all necessary providers
+            // ...
+            for (int i = 0; i < 100; i++) {
+                try {
+                    CertificateFactory f = CertificateFactory
+                            .getInstance("X.509");
+                    al.add(f.getProvider());
+                    Security.removeProvider(f.getProvider().getName());
+                } catch (CertificateException ex) {
+                    noMoreFactories = true;
+                    break;
+                }
+            }
+            if (!noMoreFactories) {
+                throw new Error(
+                        "Unable to setup test: too many providers provide X.509");
+            }
+            Certificate[] certs = new Certificate[] { TestCertUtils.rootCA };
+            CodeSource cs = new CodeSource(null, certs);
+            assertNull(cs.getCodeSigners());
+        } finally {
+            // .. and restore providers back - to avoid affecting following tests
+            for (int i = 0; i < al.size(); i++) {
+                Security.addProvider((Provider) al.get(i));
+            }
+        }
+
+    }
+
+    /**
+     * getCodeSigners() must return an array of CodeSigners. Just make sure
+     * the array looks healthy.
+     */
+    public void testGetCodeSigners_03() {
+        TestCertUtils.install_test_x509_factory();
+        try {
+            X500Principal[] ps = TestCertUtils.UniGen.genX500s(3);
+
+            // 2-certs chain 
+            X509Certificate rootCA = TestCertUtils.rootCA;
+            X509Certificate c0 = new TestCertUtils.TestX509Certificate(ps[0],
+                    rootCA.getIssuerX500Principal());
+            //
+            X509Certificate c1 = new TestCertUtils.TestX509Certificate(ps[1],
+                    ps[1]);
+            X509Certificate c2 = new TestCertUtils.TestX509Certificate(ps[2],
+                    ps[2]);
+
+            java.security.cert.Certificate [] certs = new java.security.cert.Certificate[] {
+                    c0, rootCA, c1, c2 };
+            CodeSource cs = new CodeSource(null, certs);
+            CodeSigner[] signers = cs.getCodeSigners();
+
+            // must get exactly 3 CodeSigner-s: one for the chain, and one 
+            // for each of single certs
+            assertEquals(3, signers.length);
+        } finally {
+            TestCertUtils.uninstall_test_x509_factory();
+        }
+    }
+
+    /**
+     * getCodeSigners(). Make sure, that CertException is handled properly
+     */
+    public void testGetCodeSigners_04() {
+        try {
+            TestCertUtils.install_test_x509_factory();
+            X500Principal[] ps = TestCertUtils.UniGen.genX500s(1);
+
+            // 2-certs chain 
+            X509Certificate rootCA = TestCertUtils.rootCA;
+            X509Certificate c0 = new TestCertUtils.TestInvalidX509Certificate(
+                    ps[0], rootCA.getIssuerX500Principal());
+            java.security.cert.Certificate [] certs = new java.security.cert.Certificate[] {
+                    c0, rootCA };
+
+            CodeSource cs = new CodeSource(null, certs);
+            CodeSigner[] signers = cs.getCodeSigners();
+
+            assertNull(signers);
+
+            // Must force a check for 'factory==null' 
+            cs.getCodeSigners();
+        } finally {
+            TestCertUtils.uninstall_test_x509_factory();
+        }
+    }
+    
+
+    /**
+     * @tests java.security.CodeSource#toString()
+     */
+    public void test_toString() throws Exception {
+        // Test for method java.lang.String java.security.CodeSource.toString()
+        CodeSource cs = new CodeSource(new java.net.URL("file:///test"),
+                (Certificate[]) null);
+        assertEquals("toString did not return expected value.",
+                "CodeSource, url=file:/test, <no certificates>", cs.toString());
+    }
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/CodeSource_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KeyStore_Impl1Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KeyStore_Impl2Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KeyStore_Impl3Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/MessageDigest_Impl1Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/MessageDigest_Impl2Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/PermissionCollection_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/Permissions_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/Policy_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/ProviderService_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/SecureRandom_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/Timestamp_ImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message