harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r443539 [7/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/jav...
Date Fri, 15 Sep 2006 01:18:16 GMT
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/IdentityTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/MessageDigestSpiTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/MessageDigestSpiTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/MessageDigestSpiTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/MessageDigestSpiTest.java Thu Sep 14 18:17:39 2006
@@ -1,95 +1,95 @@
-/*
- *  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 java.nio.ByteBuffer;
-
-import junit.framework.TestCase;
-
-
-/**
- * Tests for <code>MessageDigestSpi</code> constructor and methods
- * 
- */
-public class MessageDigestSpiTest extends TestCase {
-
-	public void testEngineGetDigestLength() {
-		MyMessageDigest md = new MyMessageDigest();
-		if (md.engineGetDigestLength() != 0) {
-			fail("engineGetDigestLength failed");
-		}
-	}
-
-	/*
-	 * Class under test for void engineUpdate(ByteBuffer)
-	 */
-	public void testEngineUpdateByteBuffer() {
-		MyMessageDigest md = new MyMessageDigest();
-		byte[] b = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
-
-		ByteBuffer buf = ByteBuffer.wrap(b,0,b.length);
-		buf.get(b);
-		int l = buf.limit();
-		md.engineUpdate(buf);
-		if (buf.limit() !=l || buf.position() != l) {
-			fail("Case 1. Incorrect position");
-		}
-		
-		buf = ByteBuffer.wrap(b,0,b.length);
-		buf.get();
-		buf.get();
-		buf.get();
-		md.engineUpdate(buf);
-		if (buf.limit() !=l || buf.position() != l) {
-			fail("Case 2. Incorrect position");
-		}
-	}
-
-	/*
-	 * Class under test for Object clone()
-	 */
-	public void testClone() {
-		MyMessageDigest md = new MyMessageDigest();
-		try {
-			md.clone();
-			fail("No expected CloneNotSupportedException");
-		} catch (CloneNotSupportedException e) {			
-		}
-	}
-
-	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();
-		}
-	}
-}
+/*
+ *  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 java.nio.ByteBuffer;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests for <code>MessageDigestSpi</code> constructor and methods
+ * 
+ */
+public class MessageDigestSpiTest extends TestCase {
+
+	public void testEngineGetDigestLength() {
+		MyMessageDigest md = new MyMessageDigest();
+		if (md.engineGetDigestLength() != 0) {
+			fail("engineGetDigestLength failed");
+		}
+	}
+
+	/*
+	 * Class under test for void engineUpdate(ByteBuffer)
+	 */
+	public void testEngineUpdateByteBuffer() {
+		MyMessageDigest md = new MyMessageDigest();
+		byte[] b = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+		ByteBuffer buf = ByteBuffer.wrap(b,0,b.length);
+		buf.get(b);
+		int l = buf.limit();
+		md.engineUpdate(buf);
+		if (buf.limit() !=l || buf.position() != l) {
+			fail("Case 1. Incorrect position");
+		}
+		
+		buf = ByteBuffer.wrap(b,0,b.length);
+		buf.get();
+		buf.get();
+		buf.get();
+		md.engineUpdate(buf);
+		if (buf.limit() !=l || buf.position() != l) {
+			fail("Case 2. Incorrect position");
+		}
+	}
+
+	/*
+	 * Class under test for Object clone()
+	 */
+	public void testClone() {
+		MyMessageDigest md = new MyMessageDigest();
+		try {
+			md.clone();
+			fail("No expected CloneNotSupportedException");
+		} catch (CloneNotSupportedException e) {			
+		}
+	}
+
+	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();
+		}
+	}
+}

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/ProviderTest.java Thu Sep 14 18:17:39 2006
@@ -1,217 +1,217 @@
-/*
- *  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 java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-
-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
- * 
- */
-public class ProviderTest extends TestCase {
-
-    Provider p;
-    
-    /*
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-        p = new MyProvider();
-    }
-    
-    /*
-     * 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");
-        }
-    }
-
-    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");
-        }    
-    }
-
-    class MyProvider extends Provider {
-        MyProvider() {
-            super("MyProvider", 1.0, "Provider for testing");
-            put("MessageDigest.SHA-1", "SomeClassName");
-            put("MessageDigest.abc", "SomeClassName");
-            put("Alg.Alias.MessageDigest.SHA1", "SHA-1");
-        }
-        
-        MyProvider(String name, double version, String info) {
-            super(name, version, info);
-        }
-    }
-}
+/*
+ *  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 java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+
+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
+ * 
+ */
+public class ProviderTest extends TestCase {
+
+    Provider p;
+    
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        p = new MyProvider();
+    }
+    
+    /*
+     * 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");
+        }
+    }
+
+    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");
+        }    
+    }
+
+    class MyProvider extends Provider {
+        MyProvider() {
+            super("MyProvider", 1.0, "Provider for testing");
+            put("MessageDigest.SHA-1", "SomeClassName");
+            put("MessageDigest.abc", "SomeClassName");
+            put("Alg.Alias.MessageDigest.SHA1", "SHA-1");
+        }
+        
+        MyProvider(String name, double version, String info) {
+            super(name, version, info);
+        }
+    }
+}

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SecureRandomTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SecureRandomTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SecureRandomTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SecureRandomTest.java Thu Sep 14 18:17:39 2006
@@ -1,179 +1,179 @@
-/*
- *  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 org.apache.harmony.security.tests.support.RandomImpl;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for <code>SecureRandom</code> constructor and methods
- * 
- */
-public class SecureRandomTest extends TestCase {
-
-	/**
-	 * SRProvider
-	 */
-	Provider p;
-	
-	/*
-	 * @see TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-		p = new SRProvider();
-		Security.insertProviderAt(p, 1);
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-		Security.removeProvider(p.getName());
-	}
-
-	public final void testNext() {
-		SecureRandom sr = new SecureRandom();
-		if (sr.next(1) != 1 || sr.next(2) != 3 || sr.next(3) != 7) {
-			fail("next failed");			
-		}
-	}
-
-	/*
-	 * Class under test for void setSeed(long)
-	 */
-	public final void testSetSeedlong() {
-		SecureRandom sr = new SecureRandom();
-		sr.setSeed(12345);
-		if (!RandomImpl.runEngineSetSeed) {
-			fail("setSeed failed");
-		}	
-	}
-
-	public final void testNextBytes() {
-		byte[] b = new byte[5];
-		SecureRandom sr = new SecureRandom();
-		sr.nextBytes(b);
-		for (int i = 0; i < b.length; i++) {
-			if (b[i] != (byte)(i + 0xF1)) {
-				fail("nextBytes failed");
-			}
-		}
-	}
-
-	/*
-	 * Class under test for void SecureRandom()
-	 */
-	public final void testSecureRandom() {
-		SecureRandom sr = new SecureRandom();
-		if (!sr.getAlgorithm().equals("someRandom")  ||
-				sr.getProvider()!= p) {
-			fail("incorrect SecureRandom implementation" + p.getName());
-		}	
-	}
-
-	/*
-	 * Class under test for void SecureRandom(byte[])
-	 */
-	public final void testSecureRandombyteArray() {
-		byte[] b = {1,2,3};
-		new SecureRandom(b);
-		if (!RandomImpl.runEngineSetSeed) {
-			fail("No setSeed");
-		}
-	}
-
-	/*
-	 * Class under test for SecureRandom getInstance(String)
-	 */
-	public final void testGetInstanceString() {
-		SecureRandom sr = null;
-		try {
-			sr = SecureRandom.getInstance("someRandom");	
-		} catch (NoSuchAlgorithmException e) {
-			fail(e.toString());
-		}
-		if (sr.getProvider() != p || !"someRandom".equals(sr.getAlgorithm())) {
-			fail("getInstance failed");
-		}	
-	}
-
-	/*
-	 * Class under test for SecureRandom getInstance(String, String)
-	 */
-	public final void testGetInstanceStringString() throws Exception {
-		SecureRandom sr = SecureRandom.getInstance("someRandom", "SRProvider");	
-		if (sr.getProvider() != p || !"someRandom".equals(sr.getAlgorithm())) {
-			fail("getInstance failed");
-		}	
-	}
-
-	/*
-	 * Class under test for SecureRandom getInstance(String, Provider)
-	 */
-	public final void testGetInstanceStringProvider() throws Exception {
-		Provider p = new SRProvider();
-        SecureRandom sr = SecureRandom.getInstance("someRandom", p);
-        if (sr.getProvider() != p || !"someRandom".equals(sr.getAlgorithm())) {
-            fail("getInstance failed");
-        }	
-	}
-
-	/*
-	 * Class under test for void setSeed(byte[])
-	 */
-	public final void testSetSeedbyteArray() {
-		byte[] b = {1,2,3};
-		SecureRandom sr = new SecureRandom();
-		sr.setSeed(b);
-		if (!RandomImpl.runEngineSetSeed) {
-			fail("setSeed failed");
-		}
-	}
-
-	public final void testGetSeed() {
-		byte[] b = SecureRandom.getSeed(4);
-		if( b.length != 4) {
-			fail("getSeed failed");
-		}
-	}
-
-	public final void testGenerateSeed() {
-		SecureRandom sr = new SecureRandom();
-		byte[] b = sr.generateSeed(4);
-		for (int i = 0; i < b.length; i++) {
-			if (b[i] != (byte)i) {
-				fail("generateSeed failed");
-			}
-		}
-	}
-	
-	class SRProvider extends Provider {
-        public SRProvider() {
-            super("SRProvider", 1.0, "SRProvider for testing");
-            put("SecureRandom.someRandom",
-                    "org.apache.harmony.security.tests.support.RandomImpl");
-        }
-	}
-}
+/*
+ *  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 org.apache.harmony.security.tests.support.RandomImpl;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>SecureRandom</code> constructor and methods
+ * 
+ */
+public class SecureRandomTest extends TestCase {
+
+	/**
+	 * SRProvider
+	 */
+	Provider p;
+	
+	/*
+	 * @see TestCase#setUp()
+	 */
+	protected void setUp() throws Exception {
+		super.setUp();
+		p = new SRProvider();
+		Security.insertProviderAt(p, 1);
+	}
+
+	/*
+	 * @see TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		Security.removeProvider(p.getName());
+	}
+
+	public final void testNext() {
+		SecureRandom sr = new SecureRandom();
+		if (sr.next(1) != 1 || sr.next(2) != 3 || sr.next(3) != 7) {
+			fail("next failed");			
+		}
+	}
+
+	/*
+	 * Class under test for void setSeed(long)
+	 */
+	public final void testSetSeedlong() {
+		SecureRandom sr = new SecureRandom();
+		sr.setSeed(12345);
+		if (!RandomImpl.runEngineSetSeed) {
+			fail("setSeed failed");
+		}	
+	}
+
+	public final void testNextBytes() {
+		byte[] b = new byte[5];
+		SecureRandom sr = new SecureRandom();
+		sr.nextBytes(b);
+		for (int i = 0; i < b.length; i++) {
+			if (b[i] != (byte)(i + 0xF1)) {
+				fail("nextBytes failed");
+			}
+		}
+	}
+
+	/*
+	 * Class under test for void SecureRandom()
+	 */
+	public final void testSecureRandom() {
+		SecureRandom sr = new SecureRandom();
+		if (!sr.getAlgorithm().equals("someRandom")  ||
+				sr.getProvider()!= p) {
+			fail("incorrect SecureRandom implementation" + p.getName());
+		}	
+	}
+
+	/*
+	 * Class under test for void SecureRandom(byte[])
+	 */
+	public final void testSecureRandombyteArray() {
+		byte[] b = {1,2,3};
+		new SecureRandom(b);
+		if (!RandomImpl.runEngineSetSeed) {
+			fail("No setSeed");
+		}
+	}
+
+	/*
+	 * Class under test for SecureRandom getInstance(String)
+	 */
+	public final void testGetInstanceString() {
+		SecureRandom sr = null;
+		try {
+			sr = SecureRandom.getInstance("someRandom");	
+		} catch (NoSuchAlgorithmException e) {
+			fail(e.toString());
+		}
+		if (sr.getProvider() != p || !"someRandom".equals(sr.getAlgorithm())) {
+			fail("getInstance failed");
+		}	
+	}
+
+	/*
+	 * Class under test for SecureRandom getInstance(String, String)
+	 */
+	public final void testGetInstanceStringString() throws Exception {
+		SecureRandom sr = SecureRandom.getInstance("someRandom", "SRProvider");	
+		if (sr.getProvider() != p || !"someRandom".equals(sr.getAlgorithm())) {
+			fail("getInstance failed");
+		}	
+	}
+
+	/*
+	 * Class under test for SecureRandom getInstance(String, Provider)
+	 */
+	public final void testGetInstanceStringProvider() throws Exception {
+		Provider p = new SRProvider();
+        SecureRandom sr = SecureRandom.getInstance("someRandom", p);
+        if (sr.getProvider() != p || !"someRandom".equals(sr.getAlgorithm())) {
+            fail("getInstance failed");
+        }	
+	}
+
+	/*
+	 * Class under test for void setSeed(byte[])
+	 */
+	public final void testSetSeedbyteArray() {
+		byte[] b = {1,2,3};
+		SecureRandom sr = new SecureRandom();
+		sr.setSeed(b);
+		if (!RandomImpl.runEngineSetSeed) {
+			fail("setSeed failed");
+		}
+	}
+
+	public final void testGetSeed() {
+		byte[] b = SecureRandom.getSeed(4);
+		if( b.length != 4) {
+			fail("getSeed failed");
+		}
+	}
+
+	public final void testGenerateSeed() {
+		SecureRandom sr = new SecureRandom();
+		byte[] b = sr.generateSeed(4);
+		for (int i = 0; i < b.length; i++) {
+			if (b[i] != (byte)i) {
+				fail("generateSeed failed");
+			}
+		}
+	}
+	
+	class SRProvider extends Provider {
+        public SRProvider() {
+            super("SRProvider", 1.0, "SRProvider for testing");
+            put("SecureRandom.someRandom",
+                    "org.apache.harmony.security.tests.support.RandomImpl");
+        }
+	}
+}

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignatureTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignatureTest.java?view=diff&rev=443539&r1=443538&r2=443539
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignatureTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java.injected/java/security/SignatureTest.java Thu Sep 14 18:17:39 2006
@@ -1,465 +1,465 @@
-/*
- *  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 org.apache.harmony.security.tests.support.MySignature1;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for <code>Signature</code> constructor and methods
- * 
- */
-public class SignatureTest extends TestCase {
-
-	/*
-	 * Class under test for Object clone()
-	 */
-	public void testClone() {
-		MySignature1 s = new MySignature1("ABC");
-		try {
-			s.clone();
-			fail("No expected CloneNotSupportedException");
-		} catch (CloneNotSupportedException e) {	
-		}	
-	}
-
-	public void testGetProvider() {
-		MySignature1 s = new MySignature1("ABC");
-		if (s.getState() != Signature.UNINITIALIZED) {
-			fail("Incorrect state");
-		}
-		if (s.getProvider() != null) {
-			fail("getProvider() failed");
-		}
-	}
-
-	public void testGetAlgorithm() {
-		MySignature1 s = new MySignature1("ABC");
-		if (s.getState() != Signature.UNINITIALIZED) {
-			fail("Incorrect state");
-		}
-		if (!"ABC".equals(s.getAlgorithm())) {
-			fail("getAlgorithm() failed");
-		}
-	}
-
-	/*
-	 * Class under test for void initVerify(PublicKey)
-	 */
-	public void testInitVerifyPublicKey() {
-		MySignature1 s = new MySignature1("ABC");
-		try {
-			s.initVerify(new MyPublicKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		if (s.getState() != Signature.VERIFY) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineInitVerify) {
-			fail("initVerify() failed");
-		}
-	}
-
-	/*
-	 * Class under test for void initVerify(Certificate)
-	 */
-	public void testInitVerifyCertificate() {
-		MySignature1 s = new MySignature1("ABC");
-		try {
-			s.initVerify(new MyCertificate());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		if (s.getState() != Signature.VERIFY) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineInitVerify) {
-			fail("initVerify() failed");
-		}
-	}
-
-	/*
-	 * Class under test for void initSign(PrivateKey)
-	 */
-	public void testInitSignPrivateKey() {
-		MySignature1 s = new MySignature1("ABC");
-		try {
-			s.initSign(new MyPrivateKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		if (s.getState() != Signature.SIGN) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineInitSign) {
-			fail("initSign() failed");
-		}
-	}
-
-	/*
-	 * Class under test for void initSign(PrivateKey, SecureRandom)
-	 */
-	public void testInitSignPrivateKeySecureRandom() {
-		MySignature1 s = new MySignature1("ABC");
-		try {
-			s.initSign(new MyPrivateKey(), new SecureRandom());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		if (s.getState() != Signature.SIGN) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineInitSign) {
-			fail("initSign() failed");
-		}
-	}
-
-	/*
-	 * Class under test for byte[] sign()
-	 */
-	public void testSign() {
-		MySignature1 s = new MySignature1("ABC");
-		try {
-			s.sign();
-			fail("No expected SignatureException");
-		} catch (SignatureException e) {		
-		}
-
-		try {
-			s.initVerify(new MyPublicKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		
-		try {
-			s.sign();
-			fail("No expected SignatureException");
-		} catch (SignatureException e) {		
-		}
-		
-		try {
-			s.initSign(new MyPrivateKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		try {
-			s.sign();
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-		if (s.getState() != Signature.SIGN) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineSign) {
-			fail("sign() failed");
-		}
-	}
-
-	/*
-	 * Class under test for boolean verify(byte[])
-	 */
-	public void testVerifybyteArray() {
-		MySignature1 s = new MySignature1("ABC");
-		byte[] b = {1, 2, 3, 4};
-		try {
-			s.verify(b);
-			fail("No expected SignatureException");
-		} catch (SignatureException e) {		
-		}
-
-		try {
-			s.initSign(new MyPrivateKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		try {
-			s.verify(b);
-			fail("No expected SignatureException");
-		} catch (SignatureException e) {		
-		}
-		
-		try {
-			s.initVerify(new MyPublicKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		
-		try {
-			s.verify(b);
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-		
-		if (s.getState() != Signature.VERIFY) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineVerify) {
-			fail("verify() failed");
-		}
-	}
-
-	/*
-	 * Class under test for boolean verify(byte[], int, int)
-	 */
-	public void testVerifybyteArrayintint() {
-		MySignature1 s = new MySignature1("ABC");
-		byte[] b = {1, 2, 3, 4};
-		try {
-			s.verify(b, 0, 3);
-			fail("No expected SignatureException");
-		} catch (SignatureException e) {		
-		}
-
-		try {
-			s.initSign(new MyPrivateKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		try {
-			s.verify(b, 0, 3);
-			fail("No expected SignatureException");
-		} catch (SignatureException e) {		
-		}
-		
-		try {
-			s.initVerify(new MyPublicKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		
-		try {
-			s.verify(b, 0, 5);
-			fail("No expected IllegalArgumentException");
-		} catch (IllegalArgumentException e) {		
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-		
-		try {
-			s.verify(b, 0, 3);
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-		
-		if (s.getState() != Signature.VERIFY) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineVerify) {
-			fail("verify() failed");
-		}
-	}
-
-	/*
-	 * Class under test for void update(byte)
-	 */
-	public void testUpdatebyte() {
-		MySignature1 s = new MySignature1("ABC");
-		try {
-			s.update((byte)1);
-			fail("No expected SignatureException");
-		} catch (SignatureException e) {		
-		}
-
-		try {
-			s.initVerify(new MyPublicKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		
-		try {
-			s.update((byte)1);
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-		
-		try {
-			s.initSign(new MyPrivateKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		try {
-			s.update((byte)1);
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-		if (s.getState() != Signature.SIGN) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineUpdate1) {
-			fail("update() failed");
-		}
-	}
-
-	/*
-	 * Class under test for void update(byte[])
-	 */
-	public void testUpdatebyteArray() {
-		MySignature1 s = new MySignature1("ABC");
-		byte[] b = {1, 2, 3, 4};
-		try {
-			s.update(b);
-			fail("No expected SignatureException");
-		} catch (SignatureException e) {		
-		}
-
-		try {
-			s.initVerify(new MyPublicKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		
-		try {
-			s.update(b);
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-		
-		try {
-			s.initSign(new MyPrivateKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		try {
-			s.update(b);
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-		if (s.getState() != Signature.SIGN) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineUpdate2) {
-			fail("update() failed");
-		}
-	}
-
-	/*
-	 * Class under test for void update(byte[], int, int)
-	 */
-	public void testUpdatebyteArrayintint() {
-		MySignature1 s = new MySignature1("ABC");
-		byte[] b = {1, 2, 3, 4};
-		try {
-			s.update(b, 0, 3);
-			fail("No expected SignatureException");
-		} catch (SignatureException e) {		
-		}
-
-		try {
-			s.initVerify(new MyPublicKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		
-		try {
-			s.update(b, 0, 3);
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-			
-		try {
-			s.initSign(new MyPrivateKey());
-		} catch (InvalidKeyException e) {
-			fail(e.toString());
-		}
-		try {
-			s.update(b, 0, 3);
-		} catch (SignatureException e) {
-			fail(e.toString());
-		}
-		if (s.getState() != Signature.SIGN) {
-			fail("Incorrect state");
-		}
-		if (!s.runEngineUpdate2) {
-			fail("update() failed");
-		}
-	}
-
-	/*
-	 * Class under test for void setParameter(String, Object)
-	 */
-	public void testSetParameterStringObject() {
-		MySignature1 s = new MySignature1("ABC");
-		s.setParameter("aaa", new Object());
-	}
-
-	/*
-	 * Class under test for void setParameter(AlgorithmParameterSpec)
-	 */
-	public void testSetParameterAlgorithmParameterSpec() {
-		MySignature1 s = new MySignature1("ABC");
-		try {
-			s.setParameter((java.security.spec.AlgorithmParameterSpec)null);
-			fail("No expected UnsupportedOperationException");
-		} catch (UnsupportedOperationException e){	
-		} catch (Exception e){
-			fail(e.toString());
-		}
-	}
-
-	public void testGetParameter() {
-		MySignature1 s = new MySignature1("ABC");
-		try {
-			s.getParameter("aaa");
-		} catch (InvalidParameterException e){
-			fail(e.toString());
-		}
-	}
-	
-	private class MyKey implements Key {
-		public String getFormat() {
-			return "123";
-		}
-		public byte[] getEncoded() {
-			return null;
-		}
-		public String getAlgorithm() {
-			return "aaa";
-		}		
-	}
-	
-	private class MyPublicKey extends MyKey implements PublicKey {}
-
-	private class MyPrivateKey extends MyKey implements PrivateKey {}
-	
-	private class MyCertificate extends java.security.cert.Certificate {	
-		public  MyCertificate() {
-			super("MyCertificateType");
-		}
-		
-		public PublicKey getPublicKey() {
-			return new MyPublicKey();
-		}
-		
-		public byte[] getEncoded() {
-			return null;
-		}
-		public void verify(PublicKey key) {}
-		
-		public void verify(PublicKey key, String sigProvider) {}
-		
-		public String toString() {
-			return "MyCertificate";
-		}
-	}
-}
+/*
+ *  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 org.apache.harmony.security.tests.support.MySignature1;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests for <code>Signature</code> constructor and methods
+ * 
+ */
+public class SignatureTest extends TestCase {
+
+	/*
+	 * Class under test for Object clone()
+	 */
+	public void testClone() {
+		MySignature1 s = new MySignature1("ABC");
+		try {
+			s.clone();
+			fail("No expected CloneNotSupportedException");
+		} catch (CloneNotSupportedException e) {	
+		}	
+	}
+
+	public void testGetProvider() {
+		MySignature1 s = new MySignature1("ABC");
+		if (s.getState() != Signature.UNINITIALIZED) {
+			fail("Incorrect state");
+		}
+		if (s.getProvider() != null) {
+			fail("getProvider() failed");
+		}
+	}
+
+	public void testGetAlgorithm() {
+		MySignature1 s = new MySignature1("ABC");
+		if (s.getState() != Signature.UNINITIALIZED) {
+			fail("Incorrect state");
+		}
+		if (!"ABC".equals(s.getAlgorithm())) {
+			fail("getAlgorithm() failed");
+		}
+	}
+
+	/*
+	 * Class under test for void initVerify(PublicKey)
+	 */
+	public void testInitVerifyPublicKey() {
+		MySignature1 s = new MySignature1("ABC");
+		try {
+			s.initVerify(new MyPublicKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		if (s.getState() != Signature.VERIFY) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineInitVerify) {
+			fail("initVerify() failed");
+		}
+	}
+
+	/*
+	 * Class under test for void initVerify(Certificate)
+	 */
+	public void testInitVerifyCertificate() {
+		MySignature1 s = new MySignature1("ABC");
+		try {
+			s.initVerify(new MyCertificate());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		if (s.getState() != Signature.VERIFY) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineInitVerify) {
+			fail("initVerify() failed");
+		}
+	}
+
+	/*
+	 * Class under test for void initSign(PrivateKey)
+	 */
+	public void testInitSignPrivateKey() {
+		MySignature1 s = new MySignature1("ABC");
+		try {
+			s.initSign(new MyPrivateKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		if (s.getState() != Signature.SIGN) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineInitSign) {
+			fail("initSign() failed");
+		}
+	}
+
+	/*
+	 * Class under test for void initSign(PrivateKey, SecureRandom)
+	 */
+	public void testInitSignPrivateKeySecureRandom() {
+		MySignature1 s = new MySignature1("ABC");
+		try {
+			s.initSign(new MyPrivateKey(), new SecureRandom());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		if (s.getState() != Signature.SIGN) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineInitSign) {
+			fail("initSign() failed");
+		}
+	}
+
+	/*
+	 * Class under test for byte[] sign()
+	 */
+	public void testSign() {
+		MySignature1 s = new MySignature1("ABC");
+		try {
+			s.sign();
+			fail("No expected SignatureException");
+		} catch (SignatureException e) {		
+		}
+
+		try {
+			s.initVerify(new MyPublicKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		
+		try {
+			s.sign();
+			fail("No expected SignatureException");
+		} catch (SignatureException e) {		
+		}
+		
+		try {
+			s.initSign(new MyPrivateKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		try {
+			s.sign();
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+		if (s.getState() != Signature.SIGN) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineSign) {
+			fail("sign() failed");
+		}
+	}
+
+	/*
+	 * Class under test for boolean verify(byte[])
+	 */
+	public void testVerifybyteArray() {
+		MySignature1 s = new MySignature1("ABC");
+		byte[] b = {1, 2, 3, 4};
+		try {
+			s.verify(b);
+			fail("No expected SignatureException");
+		} catch (SignatureException e) {		
+		}
+
+		try {
+			s.initSign(new MyPrivateKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		try {
+			s.verify(b);
+			fail("No expected SignatureException");
+		} catch (SignatureException e) {		
+		}
+		
+		try {
+			s.initVerify(new MyPublicKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		
+		try {
+			s.verify(b);
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+		
+		if (s.getState() != Signature.VERIFY) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineVerify) {
+			fail("verify() failed");
+		}
+	}
+
+	/*
+	 * Class under test for boolean verify(byte[], int, int)
+	 */
+	public void testVerifybyteArrayintint() {
+		MySignature1 s = new MySignature1("ABC");
+		byte[] b = {1, 2, 3, 4};
+		try {
+			s.verify(b, 0, 3);
+			fail("No expected SignatureException");
+		} catch (SignatureException e) {		
+		}
+
+		try {
+			s.initSign(new MyPrivateKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		try {
+			s.verify(b, 0, 3);
+			fail("No expected SignatureException");
+		} catch (SignatureException e) {		
+		}
+		
+		try {
+			s.initVerify(new MyPublicKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		
+		try {
+			s.verify(b, 0, 5);
+			fail("No expected IllegalArgumentException");
+		} catch (IllegalArgumentException e) {		
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+		
+		try {
+			s.verify(b, 0, 3);
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+		
+		if (s.getState() != Signature.VERIFY) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineVerify) {
+			fail("verify() failed");
+		}
+	}
+
+	/*
+	 * Class under test for void update(byte)
+	 */
+	public void testUpdatebyte() {
+		MySignature1 s = new MySignature1("ABC");
+		try {
+			s.update((byte)1);
+			fail("No expected SignatureException");
+		} catch (SignatureException e) {		
+		}
+
+		try {
+			s.initVerify(new MyPublicKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		
+		try {
+			s.update((byte)1);
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+		
+		try {
+			s.initSign(new MyPrivateKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		try {
+			s.update((byte)1);
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+		if (s.getState() != Signature.SIGN) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineUpdate1) {
+			fail("update() failed");
+		}
+	}
+
+	/*
+	 * Class under test for void update(byte[])
+	 */
+	public void testUpdatebyteArray() {
+		MySignature1 s = new MySignature1("ABC");
+		byte[] b = {1, 2, 3, 4};
+		try {
+			s.update(b);
+			fail("No expected SignatureException");
+		} catch (SignatureException e) {		
+		}
+
+		try {
+			s.initVerify(new MyPublicKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		
+		try {
+			s.update(b);
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+		
+		try {
+			s.initSign(new MyPrivateKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		try {
+			s.update(b);
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+		if (s.getState() != Signature.SIGN) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineUpdate2) {
+			fail("update() failed");
+		}
+	}
+
+	/*
+	 * Class under test for void update(byte[], int, int)
+	 */
+	public void testUpdatebyteArrayintint() {
+		MySignature1 s = new MySignature1("ABC");
+		byte[] b = {1, 2, 3, 4};
+		try {
+			s.update(b, 0, 3);
+			fail("No expected SignatureException");
+		} catch (SignatureException e) {		
+		}
+
+		try {
+			s.initVerify(new MyPublicKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		
+		try {
+			s.update(b, 0, 3);
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+			
+		try {
+			s.initSign(new MyPrivateKey());
+		} catch (InvalidKeyException e) {
+			fail(e.toString());
+		}
+		try {
+			s.update(b, 0, 3);
+		} catch (SignatureException e) {
+			fail(e.toString());
+		}
+		if (s.getState() != Signature.SIGN) {
+			fail("Incorrect state");
+		}
+		if (!s.runEngineUpdate2) {
+			fail("update() failed");
+		}
+	}
+
+	/*
+	 * Class under test for void setParameter(String, Object)
+	 */
+	public void testSetParameterStringObject() {
+		MySignature1 s = new MySignature1("ABC");
+		s.setParameter("aaa", new Object());
+	}
+
+	/*
+	 * Class under test for void setParameter(AlgorithmParameterSpec)
+	 */
+	public void testSetParameterAlgorithmParameterSpec() {
+		MySignature1 s = new MySignature1("ABC");
+		try {
+			s.setParameter((java.security.spec.AlgorithmParameterSpec)null);
+			fail("No expected UnsupportedOperationException");
+		} catch (UnsupportedOperationException e){	
+		} catch (Exception e){
+			fail(e.toString());
+		}
+	}
+
+	public void testGetParameter() {
+		MySignature1 s = new MySignature1("ABC");
+		try {
+			s.getParameter("aaa");
+		} catch (InvalidParameterException e){
+			fail(e.toString());
+		}
+	}
+	
+	private class MyKey implements Key {
+		public String getFormat() {
+			return "123";
+		}
+		public byte[] getEncoded() {
+			return null;
+		}
+		public String getAlgorithm() {
+			return "aaa";
+		}		
+	}
+	
+	private class MyPublicKey extends MyKey implements PublicKey {}
+
+	private class MyPrivateKey extends MyKey implements PrivateKey {}
+	
+	private class MyCertificate extends java.security.cert.Certificate {	
+		public  MyCertificate() {
+			super("MyCertificateType");
+		}
+		
+		public PublicKey getPublicKey() {
+			return new MyPublicKey();
+		}
+		
+		public byte[] getEncoded() {
+			return null;
+		}
+		public void verify(PublicKey key) {}
+		
+		public void verify(PublicKey key, String sigProvider) {}
+		
+		public String toString() {
+			return "MyCertificate";
+		}
+	}
+}

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AccessControlException2Test.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/AccessControlException2Test.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/java/security/AccessControlException2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AccessControlException2Test.java Thu Sep 14 18:17:39 2006
@@ -1,80 +1,80 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.security.tests.java.security;
-
-import java.io.FilePermission;
-import java.security.AccessControlException;
-
-public class AccessControlException2Test extends junit.framework.TestCase {
-	FilePermission filePermission;
-
-	AccessControlException acException;
-
-	AccessControlException acException1;
-
-	/**
-	 * @tests java.security.AccessControlException#AccessControlException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method
-		// java.security.AccessControlException(java.lang.String)
-		assertTrue("AccessControlException's toString() should have returned "
-				+ "'java.security.AccessControlException: test message' but "
-				+ "returned: " + acException.toString(), acException.toString()
-				.equals("java.security.AccessControlException: test message"));
-	}
-
-	/**
-	 * @tests java.security.AccessControlException#AccessControlException(java.lang.String,
-	 *        java.security.Permission)
-	 */
-	public void test_ConstructorLjava_lang_StringLjava_security_Permission() {
-		// Test for method
-		// java.security.AccessControlException(java.lang.String,
-		// java.security.Permission)
-		assertTrue("AccessControlException's toString() should have returned "
-				+ "'java.security.AccessControlException: test message "
-				+ "(java.io.FilePermission /* read)' but returned: "
-				+ acException1.toString(), acException1.toString().equals(
-				"java.security.AccessControlException: test message"));
-	}
-
-	/**
-	 * @tests java.security.AccessControlException#getPermission()
-	 */
-	public void test_getPermission() {
-		// Test for method java.security.Permission
-		// java.security.AccessControlException.getPermission()
-		// make sure getPermission returns null when it's not set
-		assertNull(
-				"getPermission should have returned null if no permission was set",
-				acException.getPermission());
-		assertTrue(
-				"getPermission should have returned the permission we assigned to it",
-				acException1.getPermission() == filePermission);
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-		filePermission = new FilePermission("/*", "read");
-		acException = new AccessControlException("test message");
-		acException1 = new AccessControlException("test message",
-				filePermission);
-	}
+/* 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 org.apache.harmony.security.tests.java.security;
+
+import java.io.FilePermission;
+import java.security.AccessControlException;
+
+public class AccessControlException2Test extends junit.framework.TestCase {
+	FilePermission filePermission;
+
+	AccessControlException acException;
+
+	AccessControlException acException1;
+
+	/**
+	 * @tests java.security.AccessControlException#AccessControlException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method
+		// java.security.AccessControlException(java.lang.String)
+		assertTrue("AccessControlException's toString() should have returned "
+				+ "'java.security.AccessControlException: test message' but "
+				+ "returned: " + acException.toString(), acException.toString()
+				.equals("java.security.AccessControlException: test message"));
+	}
+
+	/**
+	 * @tests java.security.AccessControlException#AccessControlException(java.lang.String,
+	 *        java.security.Permission)
+	 */
+	public void test_ConstructorLjava_lang_StringLjava_security_Permission() {
+		// Test for method
+		// java.security.AccessControlException(java.lang.String,
+		// java.security.Permission)
+		assertTrue("AccessControlException's toString() should have returned "
+				+ "'java.security.AccessControlException: test message "
+				+ "(java.io.FilePermission /* read)' but returned: "
+				+ acException1.toString(), acException1.toString().equals(
+				"java.security.AccessControlException: test message"));
+	}
+
+	/**
+	 * @tests java.security.AccessControlException#getPermission()
+	 */
+	public void test_getPermission() {
+		// Test for method java.security.Permission
+		// java.security.AccessControlException.getPermission()
+		// make sure getPermission returns null when it's not set
+		assertNull(
+				"getPermission should have returned null if no permission was set",
+				acException.getPermission());
+		assertTrue(
+				"getPermission should have returned the permission we assigned to it",
+				acException1.getPermission() == filePermission);
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+		filePermission = new FilePermission("/*", "read");
+		acException = new AccessControlException("test message");
+		acException1 = new AccessControlException("test message",
+				filePermission);
+	}
 }

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AccessController2Test.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/AccessController2Test.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/java/security/AccessController2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AccessController2Test.java Thu Sep 14 18:17:39 2006
@@ -1,51 +1,51 @@
-/* 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 org.apache.harmony.security.tests.java.security;
-
-import java.security.AccessController;
-import java.security.AllPermission;
-import java.security.PrivilegedAction;
-
-public class AccessController2Test extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.security.AccessController#doPrivileged(java.security.PrivilegedAction)
-	 */
-	public void test_doPrivilegedLjava_security_PrivilegedAction() {
-		// Test for method java.lang.Object
-		// java.security.AccessController.doPrivileged(java.security.PrivilegedAction)
-
-		// Pass fail flag...
-		Boolean pass;
-
-		// First test 1 argument version (TBD).
-
-		// Then test 2 argument version. 
-		pass = (Boolean) AccessController.doPrivileged(new PrivilegedAction() {
-			public Object run() {
-				try {
-					AccessController.checkPermission(new AllPermission());
-					return new Boolean(false);
-				} catch (SecurityException ex) {
-					return new Boolean(true);
-				}
-			}
-		}, null);
-		assertTrue("Got AllPermission by passing in a null PD", pass
-				.booleanValue());
-
-	}
+/* 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 org.apache.harmony.security.tests.java.security;
+
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.PrivilegedAction;
+
+public class AccessController2Test extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.security.AccessController#doPrivileged(java.security.PrivilegedAction)
+	 */
+	public void test_doPrivilegedLjava_security_PrivilegedAction() {
+		// Test for method java.lang.Object
+		// java.security.AccessController.doPrivileged(java.security.PrivilegedAction)
+
+		// Pass fail flag...
+		Boolean pass;
+
+		// First test 1 argument version (TBD).
+
+		// Then test 2 argument version. 
+		pass = (Boolean) AccessController.doPrivileged(new PrivilegedAction() {
+			public Object run() {
+				try {
+					AccessController.checkPermission(new AllPermission());
+					return new Boolean(false);
+				} catch (SecurityException ex) {
+					return new Boolean(true);
+				}
+			}
+		}, null);
+		assertTrue("Got AllPermission by passing in a null PD", pass
+				.booleanValue());
+
+	}
 }

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

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AlgorithmParameterGenerator3Test.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/AlgorithmParameterGenerator3Test.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/java/security/AlgorithmParameterGenerator3Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AlgorithmParameterGenerator3Test.java Thu Sep 14 18:17:39 2006
@@ -1,190 +1,190 @@
-/* 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 org.apache.harmony.security.tests.java.security;
-
-import java.math.BigInteger;
-import java.security.AlgorithmParameterGenerator;
-import java.security.AlgorithmParameters;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchProviderException;
-import java.security.Provider;
-import java.security.SecureRandom;
-import java.security.Security;
-import java.security.spec.DSAParameterSpec;
-
-public class AlgorithmParameterGenerator3Test extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.security.AlgorithmParameterGenerator#generateParameters()
-	 */
-	public void test_generateParameters() throws Exception {
-
-		//fail("Takes ages. Problem with SecureRandom and stub math ?");
-		
-		// Test for method java.security.AlgorithmParameters
-		// java.security.AlgorithmParameterGenerator.generateParameters()
-		AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-				.getInstance("DSA");
-		gen.init(1024);
-
-		// WARNING - The next line can take MINUTES to run
-		AlgorithmParameters params = gen.generateParameters();
-		assertNotNull("params is null", params);
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameterGenerator#getAlgorithm()
-	 */
-	public void test_getAlgorithm() throws Exception {
-		// Test for method java.lang.String
-		// java.security.AlgorithmParameterGenerator.getAlgorithm()
-		String alg = AlgorithmParameterGenerator.getInstance("DSA")
-				.getAlgorithm();
-		assertEquals("getAlgorithm ok", "DSA", alg);
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameterGenerator#getInstance(java.lang.String)
-	 */
-	public void test_getInstanceLjava_lang_String() throws Exception {
-		// Test for method java.security.AlgorithmParameterGenerator
-		// java.security.AlgorithmParameterGenerator.getInstance(java.lang.String)
-		AlgorithmParameterGenerator.getInstance("DSA");
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameterGenerator#getInstance(java.lang.String,
-	 *        java.lang.String)
-	 */
-	public void test_getInstanceLjava_lang_StringLjava_lang_String() throws Exception {
-		// Test for method java.security.AlgorithmParameterGenerator
-		// java.security.AlgorithmParameterGenerator.getInstance(java.lang.String,
-		// java.lang.String)
-
-		// Opting for DSA here as it is pretty widely supported
-       		Provider[] provs = Security
-       				.getProviders("AlgorithmParameterGenerator.DSA");
-
-		for (int i = 0; i < provs.length; i++) {
-    			AlgorithmParameterGenerator.getInstance("DSA", provs[i].getName());
-    		}// end for
-
-
-		// exception case - should throw IllegalArgumentException for null
-		// provider
-		try {
-			AlgorithmParameterGenerator.getInstance("DSA", (String) null);
-			fail("Should have thrown IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-			// Expected
-		}
-
-		// exception case - should throw IllegalArgumentException for empty
-		// provider
-		try {
-			AlgorithmParameterGenerator.getInstance("DSA", "");
-			fail("Should have thrown IllegalArgumentException");
-		} catch (IllegalArgumentException e) {
-			// Expected
-		}
-
-		// exception case - should throw NoSuchProviderException
-		try {
-			AlgorithmParameterGenerator.getInstance("DSA", "IDontExist");
-			fail("Should have thrown NoSuchProviderException");
-		} catch (NoSuchProviderException e) {
-			// Expected
-		}
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameterGenerator#getProvider()
-	 */
-	public void test_getProvider() throws Exception {
-		// Test for method java.security.Provider
-		// java.security.AlgorithmParameterGenerator.getProvider()
-        	// checks that no exception is thrown
-		Provider p = AlgorithmParameterGenerator.getInstance("DSA")
-				.getProvider();
-		assertNotNull("provider is null", p);
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameterGenerator#init(int)
-	 */
-	public void test_initI() throws Exception {
-		// Test for method void
-		// java.security.AlgorithmParameterGenerator.init(int)
-        	// checks that no exception is thrown
-		AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-				.getInstance("DSA");
-		gen.init(1024);
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameterGenerator#init(int,
-	 *        java.security.SecureRandom)
-	 */
-	public void test_initILjava_security_SecureRandom() throws Exception {
-		// Test for method void
-		// java.security.AlgorithmParameterGenerator.init(int,
-		// java.security.SecureRandom)
-        	// checks that no exception is thrown
-		AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-				.getInstance("DSA");
-		gen.init(1024, new SecureRandom());
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameterGenerator#init(java.security.spec.AlgorithmParameterSpec)
-	 */
-	public void test_initLjava_security_spec_AlgorithmParameterSpec() throws Exception {
-        // Test for method void
-        // java.security.AlgorithmParameterGenerator.init(java.security.spec.AlgorithmParameterSpec)
-        // checks that InvalidAlgorithmParameterException is thrown
-        DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
-                BigInteger.ONE, BigInteger.ONE);
-        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-                .getInstance("DSA");
-        try {
-            gen.init(spec);
-            fail("No expected InvalidAlgorithmParameterException");
-        } catch (InvalidAlgorithmParameterException e) {
-            //expected
-        }
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameterGenerator#init(java.security.spec.AlgorithmParameterSpec,
-	 *        java.security.SecureRandom)
-	 */
-	public void test_initLjava_security_spec_AlgorithmParameterSpecLjava_security_SecureRandom() throws Exception {
-        // Test for method void
-        // java.security.AlgorithmParameterGenerator.init(java.security.spec.AlgorithmParameterSpec,
-        // java.security.SecureRandom)
-        // checks that InvalidAlgorithmParameterException  is thrown
-        DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
-                BigInteger.ONE, BigInteger.ONE);
-        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
-                .getInstance("DSA");
-        try {
-            gen.init(spec, new SecureRandom());
-            fail("No expected InvalidAlgorithmParameterException");
-        } catch (InvalidAlgorithmParameterException e) {
-            //expected
-        }
-	}
-}
+/* 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 org.apache.harmony.security.tests.java.security;
+
+import java.math.BigInteger;
+import java.security.AlgorithmParameterGenerator;
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.spec.DSAParameterSpec;
+
+public class AlgorithmParameterGenerator3Test extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.security.AlgorithmParameterGenerator#generateParameters()
+	 */
+	public void test_generateParameters() throws Exception {
+
+		//fail("Takes ages. Problem with SecureRandom and stub math ?");
+		
+		// Test for method java.security.AlgorithmParameters
+		// java.security.AlgorithmParameterGenerator.generateParameters()
+		AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
+				.getInstance("DSA");
+		gen.init(1024);
+
+		// WARNING - The next line can take MINUTES to run
+		AlgorithmParameters params = gen.generateParameters();
+		assertNotNull("params is null", params);
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameterGenerator#getAlgorithm()
+	 */
+	public void test_getAlgorithm() throws Exception {
+		// Test for method java.lang.String
+		// java.security.AlgorithmParameterGenerator.getAlgorithm()
+		String alg = AlgorithmParameterGenerator.getInstance("DSA")
+				.getAlgorithm();
+		assertEquals("getAlgorithm ok", "DSA", alg);
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameterGenerator#getInstance(java.lang.String)
+	 */
+	public void test_getInstanceLjava_lang_String() throws Exception {
+		// Test for method java.security.AlgorithmParameterGenerator
+		// java.security.AlgorithmParameterGenerator.getInstance(java.lang.String)
+		AlgorithmParameterGenerator.getInstance("DSA");
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameterGenerator#getInstance(java.lang.String,
+	 *        java.lang.String)
+	 */
+	public void test_getInstanceLjava_lang_StringLjava_lang_String() throws Exception {
+		// Test for method java.security.AlgorithmParameterGenerator
+		// java.security.AlgorithmParameterGenerator.getInstance(java.lang.String,
+		// java.lang.String)
+
+		// Opting for DSA here as it is pretty widely supported
+       		Provider[] provs = Security
+       				.getProviders("AlgorithmParameterGenerator.DSA");
+
+		for (int i = 0; i < provs.length; i++) {
+    			AlgorithmParameterGenerator.getInstance("DSA", provs[i].getName());
+    		}// end for
+
+
+		// exception case - should throw IllegalArgumentException for null
+		// provider
+		try {
+			AlgorithmParameterGenerator.getInstance("DSA", (String) null);
+			fail("Should have thrown IllegalArgumentException");
+		} catch (IllegalArgumentException e) {
+			// Expected
+		}
+
+		// exception case - should throw IllegalArgumentException for empty
+		// provider
+		try {
+			AlgorithmParameterGenerator.getInstance("DSA", "");
+			fail("Should have thrown IllegalArgumentException");
+		} catch (IllegalArgumentException e) {
+			// Expected
+		}
+
+		// exception case - should throw NoSuchProviderException
+		try {
+			AlgorithmParameterGenerator.getInstance("DSA", "IDontExist");
+			fail("Should have thrown NoSuchProviderException");
+		} catch (NoSuchProviderException e) {
+			// Expected
+		}
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameterGenerator#getProvider()
+	 */
+	public void test_getProvider() throws Exception {
+		// Test for method java.security.Provider
+		// java.security.AlgorithmParameterGenerator.getProvider()
+        	// checks that no exception is thrown
+		Provider p = AlgorithmParameterGenerator.getInstance("DSA")
+				.getProvider();
+		assertNotNull("provider is null", p);
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameterGenerator#init(int)
+	 */
+	public void test_initI() throws Exception {
+		// Test for method void
+		// java.security.AlgorithmParameterGenerator.init(int)
+        	// checks that no exception is thrown
+		AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
+				.getInstance("DSA");
+		gen.init(1024);
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameterGenerator#init(int,
+	 *        java.security.SecureRandom)
+	 */
+	public void test_initILjava_security_SecureRandom() throws Exception {
+		// Test for method void
+		// java.security.AlgorithmParameterGenerator.init(int,
+		// java.security.SecureRandom)
+        	// checks that no exception is thrown
+		AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
+				.getInstance("DSA");
+		gen.init(1024, new SecureRandom());
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameterGenerator#init(java.security.spec.AlgorithmParameterSpec)
+	 */
+	public void test_initLjava_security_spec_AlgorithmParameterSpec() throws Exception {
+        // Test for method void
+        // java.security.AlgorithmParameterGenerator.init(java.security.spec.AlgorithmParameterSpec)
+        // checks that InvalidAlgorithmParameterException is thrown
+        DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
+                BigInteger.ONE, BigInteger.ONE);
+        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
+                .getInstance("DSA");
+        try {
+            gen.init(spec);
+            fail("No expected InvalidAlgorithmParameterException");
+        } catch (InvalidAlgorithmParameterException e) {
+            //expected
+        }
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameterGenerator#init(java.security.spec.AlgorithmParameterSpec,
+	 *        java.security.SecureRandom)
+	 */
+	public void test_initLjava_security_spec_AlgorithmParameterSpecLjava_security_SecureRandom() throws Exception {
+        // Test for method void
+        // java.security.AlgorithmParameterGenerator.init(java.security.spec.AlgorithmParameterSpec,
+        // java.security.SecureRandom)
+        // checks that InvalidAlgorithmParameterException  is thrown
+        DSAParameterSpec spec = new DSAParameterSpec(BigInteger.ONE,
+                BigInteger.ONE, BigInteger.ONE);
+        AlgorithmParameterGenerator gen = AlgorithmParameterGenerator
+                .getInstance("DSA");
+        try {
+            gen.init(spec, new SecureRandom());
+            fail("No expected InvalidAlgorithmParameterException");
+        } catch (InvalidAlgorithmParameterException e) {
+            //expected
+        }
+	}
+}

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



Mime
View raw message