You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ml...@apache.org on 2006/06/20 10:11:19 UTC

svn commit: r415555 [17/17] - in /incubator/harmony/enhanced/classlib/trunk/modules/security: make/common/ src/test/api/java.injected/java/security/acl/ src/test/api/java.injected/java/security/cert/ src/test/api/java.injected/java/security/interfaces/...

Copied: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/cert/MyCertificateFactorySpi.java (from r414728, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/MyCertificateFactorySpi.java)
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/cert/MyCertificateFactorySpi.java?p2=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/cert/MyCertificateFactorySpi.java&p1=incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/MyCertificateFactorySpi.java&r1=414728&r2=415555&rev=415555&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/cert/MyCertificateFactorySpi.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/cert/MyCertificateFactorySpi.java Tue Jun 20 01:11:04 2006
@@ -1,131 +1,137 @@
-/*
- *  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 java.security.cert;
-
-import java.io.InputStream;
-import java.io.DataInputStream;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- * Additional class for verification CertificateFactorySpi and
- * CertificateFactory classes
- * 
- */
-
-public class MyCertificateFactorySpi extends CertificateFactorySpi {
-    // Variants of execution:
-    // mode: false - list of encodings is empty
-    // mode: true - list of encodings consists of 2 elements
-    //               some exceptions are thrown when
-    private static boolean mode;
-
-    private Set list;
-
-    public MyCertificateFactorySpi() {
-        super();
-        mode = true;
-        list = new HashSet();
-        list.add("aa");
-        list.add("bb");
-    }
-
-    public static void putMode(boolean newMode) {
-        mode = newMode;
-    }
-
-    public Certificate engineGenerateCertificate(InputStream inStream)
-            throws CertificateException {
-        if (!(inStream instanceof DataInputStream)) {
-            throw new CertificateException("Incorrect inputstream");
-        }
-        return null;
-    }
-
-    public Collection engineGenerateCertificates(InputStream inStream)
-            throws CertificateException {
-        if (!(inStream instanceof DataInputStream)) {
-            throw new CertificateException("Incorrect inputstream");
-        }
-        return null;
-    }
-
-    public CRL engineGenerateCRL(InputStream inStream) throws CRLException {
-        if (!(inStream instanceof DataInputStream)) {
-            throw new CRLException("Incorrect inputstream");
-        }
-        return null;
-    }
-
-    public Collection engineGenerateCRLs(InputStream inStream)
-            throws CRLException {
-        if (!(inStream instanceof DataInputStream)) {
-            throw new CRLException("Incorrect inputstream");
-        }
-        return null;
-    }
-
-    public CertPath engineGenerateCertPath(InputStream inStream)
-            throws CertificateException {
-        if (!(inStream instanceof DataInputStream)) {
-            throw new CertificateException("Incorrect inputstream");
-        }
-        Iterator it = engineGetCertPathEncodings();
-        if (!it.hasNext()) {
-            throw new CertificateException("There are no CertPath encodings");
-        }
-        return engineGenerateCertPath(inStream, (String) it.next());
-    }
-
-    public CertPath engineGenerateCertPath(InputStream inStream, String encoding)
-            throws CertificateException {
-        if (!(inStream instanceof DataInputStream)) {
-            throw new CertificateException("Incorrect inputstream");
-        }
-        if (encoding.length() == 0) {
-            if (mode) {
-                throw new IllegalArgumentException("Encoding is empty");
-            }
-        }
-        return null;
-    }
-
-    public CertPath engineGenerateCertPath(List certificates)
-            throws CertificateException {
-        if (certificates == null) {
-            if (mode) {
-                throw new NullPointerException("certificates is null");
-            }
-        }
-        return null;
-    }
-
-    public Iterator engineGetCertPathEncodings() {
-        if (!mode) {
-            list.clear();
-        }
-        return list.iterator();
-    }
+/*
+ *  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.support.cert;
+
+import java.io.DataInputStream;
+import java.io.InputStream;
+import java.security.cert.CRL;
+import java.security.cert.CRLException;
+import java.security.cert.CertPath;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactorySpi;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Additional class for verification CertificateFactorySpi and
+ * CertificateFactory classes
+ * 
+ */
+
+public class MyCertificateFactorySpi extends CertificateFactorySpi {
+    // Variants of execution:
+    // mode: false - list of encodings is empty
+    // mode: true - list of encodings consists of 2 elements
+    //               some exceptions are thrown when
+    private static boolean mode;
+
+    private Set list;
+
+    public MyCertificateFactorySpi() {
+        super();
+        mode = true;
+        list = new HashSet();
+        list.add("aa");
+        list.add("bb");
+    }
+
+    public static void putMode(boolean newMode) {
+        mode = newMode;
+    }
+
+    public Certificate engineGenerateCertificate(InputStream inStream)
+            throws CertificateException {
+        if (!(inStream instanceof DataInputStream)) {
+            throw new CertificateException("Incorrect inputstream");
+        }
+        return null;
+    }
+
+    public Collection engineGenerateCertificates(InputStream inStream)
+            throws CertificateException {
+        if (!(inStream instanceof DataInputStream)) {
+            throw new CertificateException("Incorrect inputstream");
+        }
+        return null;
+    }
+
+    public CRL engineGenerateCRL(InputStream inStream) throws CRLException {
+        if (!(inStream instanceof DataInputStream)) {
+            throw new CRLException("Incorrect inputstream");
+        }
+        return null;
+    }
+
+    public Collection engineGenerateCRLs(InputStream inStream)
+            throws CRLException {
+        if (!(inStream instanceof DataInputStream)) {
+            throw new CRLException("Incorrect inputstream");
+        }
+        return null;
+    }
+
+    public CertPath engineGenerateCertPath(InputStream inStream)
+            throws CertificateException {
+        if (!(inStream instanceof DataInputStream)) {
+            throw new CertificateException("Incorrect inputstream");
+        }
+        Iterator it = engineGetCertPathEncodings();
+        if (!it.hasNext()) {
+            throw new CertificateException("There are no CertPath encodings");
+        }
+        return engineGenerateCertPath(inStream, (String) it.next());
+    }
+
+    public CertPath engineGenerateCertPath(InputStream inStream, String encoding)
+            throws CertificateException {
+        if (!(inStream instanceof DataInputStream)) {
+            throw new CertificateException("Incorrect inputstream");
+        }
+        if (encoding.length() == 0) {
+            if (mode) {
+                throw new IllegalArgumentException("Encoding is empty");
+            }
+        }
+        return null;
+    }
+
+    public CertPath engineGenerateCertPath(List certificates)
+            throws CertificateException {
+        if (certificates == null) {
+            if (mode) {
+                throw new NullPointerException("certificates is null");
+            }
+        }
+        return null;
+    }
+
+    public Iterator engineGetCertPathEncodings() {
+        if (!mode) {
+            list.clear();
+        }
+        return list.iterator();
+    }
 }