harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r443539 [8/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
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AlgorithmParameters2Test.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/AlgorithmParameters2Test.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/AlgorithmParameters2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AlgorithmParameters2Test.java Thu Sep 14 18:17:39 2006
@@ -1,214 +1,214 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.security.tests.java.security;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.AlgorithmParameters;
-import java.security.NoSuchAlgorithmException;
-import java.security.Provider;
-import java.security.Security;
-import java.security.spec.DSAParameterSpec;
-import java.security.spec.InvalidParameterSpecException;
-import java.util.Arrays;
-
-public class AlgorithmParameters2Test extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.security.AlgorithmParameters#getAlgorithm()
-	 */
-	public void test_getAlgorithm() throws Exception {
-		// Test for method java.lang.String
-		// java.security.AlgorithmParameters.getAlgorithm()
-		String alg = AlgorithmParameters.getInstance("DSA").getAlgorithm();
-		assertEquals("algorithm name should be DSA", alg, "DSA");
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameters#getEncoded()
-	 */
-	public void test_getEncoded() throws Exception {
-		// Test for method byte []
-		// java.security.AlgorithmParameters.getEncoded()
-		AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
-
-		byte[] enc = null;
-		try {
-			enc = params.getEncoded();
-			fail("should not get encoded from un-initialized instance");
-		} catch (IOException e) {
-			// expected
-		}
-
-		params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
-				BigInteger.ONE));
-		enc = params.getEncoded();
-		assertNotNull("encoded is null", enc);
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameters#getEncoded(java.lang.String)
-	 */
-    public void test_getEncodedLjava_lang_String() throws Exception {
-        // Test for method byte []
-        // java.security.AlgorithmParameters.getEncoded(java.lang.String)
-        AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
-
-        params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
-                BigInteger.ONE));
-        
-        // getEncoded behavior is not specified for unknown 'format'
-        // different providers work in different manner:
-        // 1.5 RI provider uses primary encoding format,
-        // but BC provider returns null.
-        // As it is provider specific behavior - it is not tested.
-        //byte[] enc = params.getEncoded("JUNK");
-
-        byte[] enc = params.getEncoded("ASN.1");
-        assertNotNull("ANS.1 should be supported", enc);
-    }
-
-	/**
-	 * @tests java.security.AlgorithmParameters#getInstance(java.lang.String)
-	 */
-	public void test_getInstanceLjava_lang_String() throws Exception {
-		// Test for method java.security.AlgorithmParameters
-		// java.security.AlgorithmParameters.getInstance(java.lang.String)
-		AlgorithmParameters.getInstance("DSA");
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameters#getInstance(java.lang.String,
-	 *        java.lang.String)
-	 */
-	public void test_getInstanceLjava_lang_StringLjava_lang_String() throws Exception {
-		// Test for method java.security.AlgorithmParameters
-		// java.security.AlgorithmParameters.getInstance(java.lang.String,
-		// java.lang.String)
-
-		// Opting for DSA here as it is pretty widely supported
-       	Provider[] provs = Security.getProviders("AlgorithmParameters.DSA");
-
-       	for (int i = 0; i < provs.length; i++) {
-       		Provider provider = provs[i];
-       		AlgorithmParameters.getInstance("DSA", provider.getName());
-       	}// end for
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameters#getParameterSpec(java.lang.Class)
-	 */
-	public void test_getParameterSpecLjava_lang_Class() throws Exception {
-		// Test for method java.security.spec.AlgorithmParameterSpec
-		// java.security.AlgorithmParameters.getParameterSpec(java.lang.Class)
-
-		AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
-
-		DSAParameterSpec dsaps = new DSAParameterSpec(BigInteger.ONE,
-				BigInteger.ONE, BigInteger.ONE);
-
-		params.init(dsaps);
-
-       		DSAParameterSpec spec = (DSAParameterSpec) params
-       				.getParameterSpec(dsaps.getClass());
-       		assertNotNull("param spec is null", spec);
-       		assertTrue("p is wrong ", spec.getP().equals(BigInteger.ONE));
-       		assertTrue("q is wrong ", spec.getQ().equals(BigInteger.ONE));
-       		assertTrue("g is wrong ", spec.getG().equals(BigInteger.ONE));
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameters#getProvider()
-	 */
-	public void test_getProvider() throws Exception {
-		// Test for method java.security.Provider
-		// java.security.AlgorithmParameters.getProvider()
-        Provider p = AlgorithmParameters.getInstance("DSA").getProvider();
-        assertNotNull("provider is null", p);
-
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameters#init(byte[])
-	 */
-	public void test_init$B() throws Exception {
-		// Test for method void java.security.AlgorithmParameters.init(byte [])
-        AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
-        params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
-                BigInteger.ONE));
-        byte[] encoded = params.getEncoded();
-        assertNotNull("encoded spec is null", encoded);
-        AlgorithmParameters params2 = AlgorithmParameters.getInstance("DSA");
-        params2.init(encoded);
-        byte[] encodedAfter = params2.getEncoded();
-        assertTrue("param encoded is different", Arrays.equals(encoded,
-                encodedAfter));
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameters#init(byte[], java.lang.String)
-	 */
-	public void test_init$BLjava_lang_String() throws Exception {
-		// Test for method void java.security.AlgorithmParameters.init(byte [],
-		// java.lang.String)
-        AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
-        params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
-                BigInteger.ONE));
-        byte[] encoded = params.getEncoded();
-        assertNotNull("encoded spec is null", encoded);
-        AlgorithmParameters params2 = AlgorithmParameters.getInstance("DSA");
-        params2.init(encoded, "ASN.1");
-        byte[] encodedAfter = params2.getEncoded();
-        assertTrue("param encoded is different", Arrays.equals(encoded,
-                encodedAfter));
-
-		try {
-			params = AlgorithmParameters.getInstance("DSA");
-			params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
-					BigInteger.ONE));
-			encoded = params.getEncoded();
-			assertNotNull("encoded spec is null", encoded);
-			params.init(encoded, "DOUGLASMAWSON");
-			fail("unsupported format should have raised IOException");
-		} catch (IOException e) {
-			// expected
-		}
-
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameters#init(java.security.spec.AlgorithmParameterSpec)
-	 */
-	public void test_initLjava_security_spec_AlgorithmParameterSpec() throws Exception {
-		// Test for method void
-		// java.security.AlgorithmParameters.init(java.security.spec.AlgorithmParameterSpec)
-		AlgorithmParameters params = null;
-        params = AlgorithmParameters.getInstance("DSA");
-        params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
-                BigInteger.ONE));
-	}
-
-	/**
-	 * @tests java.security.AlgorithmParameters#toString()
-	 */
-	public void test_toString() throws Exception {
-		// Test for method java.lang.String
-		// java.security.AlgorithmParameters.toString()
-        String str = AlgorithmParameters.getInstance("DSA").toString();
-        assertNull("toString should be null", str);
-
-	}
-}
+/* 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.IOException;
+import java.math.BigInteger;
+import java.security.AlgorithmParameters;
+import java.security.NoSuchAlgorithmException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.spec.DSAParameterSpec;
+import java.security.spec.InvalidParameterSpecException;
+import java.util.Arrays;
+
+public class AlgorithmParameters2Test extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.security.AlgorithmParameters#getAlgorithm()
+	 */
+	public void test_getAlgorithm() throws Exception {
+		// Test for method java.lang.String
+		// java.security.AlgorithmParameters.getAlgorithm()
+		String alg = AlgorithmParameters.getInstance("DSA").getAlgorithm();
+		assertEquals("algorithm name should be DSA", alg, "DSA");
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameters#getEncoded()
+	 */
+	public void test_getEncoded() throws Exception {
+		// Test for method byte []
+		// java.security.AlgorithmParameters.getEncoded()
+		AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
+
+		byte[] enc = null;
+		try {
+			enc = params.getEncoded();
+			fail("should not get encoded from un-initialized instance");
+		} catch (IOException e) {
+			// expected
+		}
+
+		params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
+				BigInteger.ONE));
+		enc = params.getEncoded();
+		assertNotNull("encoded is null", enc);
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameters#getEncoded(java.lang.String)
+	 */
+    public void test_getEncodedLjava_lang_String() throws Exception {
+        // Test for method byte []
+        // java.security.AlgorithmParameters.getEncoded(java.lang.String)
+        AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
+
+        params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
+                BigInteger.ONE));
+        
+        // getEncoded behavior is not specified for unknown 'format'
+        // different providers work in different manner:
+        // 1.5 RI provider uses primary encoding format,
+        // but BC provider returns null.
+        // As it is provider specific behavior - it is not tested.
+        //byte[] enc = params.getEncoded("JUNK");
+
+        byte[] enc = params.getEncoded("ASN.1");
+        assertNotNull("ANS.1 should be supported", enc);
+    }
+
+	/**
+	 * @tests java.security.AlgorithmParameters#getInstance(java.lang.String)
+	 */
+	public void test_getInstanceLjava_lang_String() throws Exception {
+		// Test for method java.security.AlgorithmParameters
+		// java.security.AlgorithmParameters.getInstance(java.lang.String)
+		AlgorithmParameters.getInstance("DSA");
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameters#getInstance(java.lang.String,
+	 *        java.lang.String)
+	 */
+	public void test_getInstanceLjava_lang_StringLjava_lang_String() throws Exception {
+		// Test for method java.security.AlgorithmParameters
+		// java.security.AlgorithmParameters.getInstance(java.lang.String,
+		// java.lang.String)
+
+		// Opting for DSA here as it is pretty widely supported
+       	Provider[] provs = Security.getProviders("AlgorithmParameters.DSA");
+
+       	for (int i = 0; i < provs.length; i++) {
+       		Provider provider = provs[i];
+       		AlgorithmParameters.getInstance("DSA", provider.getName());
+       	}// end for
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameters#getParameterSpec(java.lang.Class)
+	 */
+	public void test_getParameterSpecLjava_lang_Class() throws Exception {
+		// Test for method java.security.spec.AlgorithmParameterSpec
+		// java.security.AlgorithmParameters.getParameterSpec(java.lang.Class)
+
+		AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
+
+		DSAParameterSpec dsaps = new DSAParameterSpec(BigInteger.ONE,
+				BigInteger.ONE, BigInteger.ONE);
+
+		params.init(dsaps);
+
+       		DSAParameterSpec spec = (DSAParameterSpec) params
+       				.getParameterSpec(dsaps.getClass());
+       		assertNotNull("param spec is null", spec);
+       		assertTrue("p is wrong ", spec.getP().equals(BigInteger.ONE));
+       		assertTrue("q is wrong ", spec.getQ().equals(BigInteger.ONE));
+       		assertTrue("g is wrong ", spec.getG().equals(BigInteger.ONE));
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameters#getProvider()
+	 */
+	public void test_getProvider() throws Exception {
+		// Test for method java.security.Provider
+		// java.security.AlgorithmParameters.getProvider()
+        Provider p = AlgorithmParameters.getInstance("DSA").getProvider();
+        assertNotNull("provider is null", p);
+
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameters#init(byte[])
+	 */
+	public void test_init$B() throws Exception {
+		// Test for method void java.security.AlgorithmParameters.init(byte [])
+        AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
+        params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
+                BigInteger.ONE));
+        byte[] encoded = params.getEncoded();
+        assertNotNull("encoded spec is null", encoded);
+        AlgorithmParameters params2 = AlgorithmParameters.getInstance("DSA");
+        params2.init(encoded);
+        byte[] encodedAfter = params2.getEncoded();
+        assertTrue("param encoded is different", Arrays.equals(encoded,
+                encodedAfter));
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameters#init(byte[], java.lang.String)
+	 */
+	public void test_init$BLjava_lang_String() throws Exception {
+		// Test for method void java.security.AlgorithmParameters.init(byte [],
+		// java.lang.String)
+        AlgorithmParameters params = AlgorithmParameters.getInstance("DSA");
+        params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
+                BigInteger.ONE));
+        byte[] encoded = params.getEncoded();
+        assertNotNull("encoded spec is null", encoded);
+        AlgorithmParameters params2 = AlgorithmParameters.getInstance("DSA");
+        params2.init(encoded, "ASN.1");
+        byte[] encodedAfter = params2.getEncoded();
+        assertTrue("param encoded is different", Arrays.equals(encoded,
+                encodedAfter));
+
+		try {
+			params = AlgorithmParameters.getInstance("DSA");
+			params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
+					BigInteger.ONE));
+			encoded = params.getEncoded();
+			assertNotNull("encoded spec is null", encoded);
+			params.init(encoded, "DOUGLASMAWSON");
+			fail("unsupported format should have raised IOException");
+		} catch (IOException e) {
+			// expected
+		}
+
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameters#init(java.security.spec.AlgorithmParameterSpec)
+	 */
+	public void test_initLjava_security_spec_AlgorithmParameterSpec() throws Exception {
+		// Test for method void
+		// java.security.AlgorithmParameters.init(java.security.spec.AlgorithmParameterSpec)
+		AlgorithmParameters params = null;
+        params = AlgorithmParameters.getInstance("DSA");
+        params.init(new DSAParameterSpec(BigInteger.ONE, BigInteger.ONE,
+                BigInteger.ONE));
+	}
+
+	/**
+	 * @tests java.security.AlgorithmParameters#toString()
+	 */
+	public void test_toString() throws Exception {
+		// Test for method java.lang.String
+		// java.security.AlgorithmParameters.toString()
+        String str = AlgorithmParameters.getInstance("DSA").toString();
+        assertNull("toString should be null", str);
+
+	}
+}

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AllPermission2Test.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/AllPermission2Test.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/AllPermission2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/AllPermission2Test.java Thu Sep 14 18:17:39 2006
@@ -1,98 +1,98 @@
-/* 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.AllPermission;
-import java.security.SecurityPermission;
-
-public class AllPermission2Test extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.security.AllPermission#AllPermission()
-	 */
-	public void test_Constructor() {
-		// Test for method java.security.AllPermission()
-		AllPermission ap = new AllPermission();
-		assertEquals("Bogus name for AllPermission \"" + ap.getName() + "\".",
-				"<all permissions>", ap.getName());
-	}
-
-	/**
-	 * @tests java.security.AllPermission#AllPermission(java.lang.String,
-	 *        java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_StringLjava_lang_String() {
-		// Test for method java.security.AllPermission(java.lang.String,
-		// java.lang.String)
-		AllPermission ap = new AllPermission("Don't remember this stupid name",
-				"or this action");
-		assertEquals("Bogus name for AllPermission \"" + ap.getName() + "\".",
-				"<all permissions>", ap.getName());
-		assertEquals(
-				"AllPermission constructed with actions didn't ignore them.",
-				"<all actions>", ap.getActions());
-	}
-
-	/**
-	 * @tests java.security.AllPermission#equals(java.lang.Object)
-	 */
-	public void test_equalsLjava_lang_Object() {
-		// Test for method boolean
-		// java.security.AllPermission.equals(java.lang.Object)
-		assertTrue("Two AllPermissions not equal to each other.",
-				new AllPermission().equals(new AllPermission()));
-		assertTrue("AllPermission equals a SecurityPermission.",
-				!(new AllPermission().equals(new SecurityPermission("ugh!"))));
-	}
-
-	/**
-	 * @tests java.security.AllPermission#getActions()
-	 */
-	public void test_getActions() {
-		AllPermission ap = new AllPermission();
-		// Test for method java.lang.String
-		// java.security.AllPermission.getActions()
-		assertTrue("AllPermission has non-empty actions. (" + ap.getActions()
-				+ ")", ap.getActions().equals("<all actions>"));
-	}
-
-	/**
-	 * @tests java.security.AllPermission#hashCode()
-	 */
-	public void test_hashCode() {
-		final int ALLPERMISSION_HASH = 1;
-		// Test for method int java.security.AllPermission.hashCode()
-		AllPermission TestAllPermission = new AllPermission();
-		assertTrue("AllPermission hashCode is wrong. Should have been "
-				+ ALLPERMISSION_HASH + " but was "
-				+ TestAllPermission.hashCode(),
-				TestAllPermission.hashCode() == ALLPERMISSION_HASH);
-	}
-
-	/**
-	 * @tests java.security.AllPermission#implies(java.security.Permission)
-	 */
-	public void test_impliesLjava_security_Permission() {
-		// Test for method boolean
-		// java.security.AllPermission.implies(java.security.Permission)
-		assertTrue("AllPermission does not imply a AllPermission.",
-				new AllPermission().implies(new AllPermission()));
-		assertTrue("AllPermission does not imply a SecurityPermission.",
-				new AllPermission().implies(new SecurityPermission("ugh!")));
-		assertTrue("SecurityPermission implies AllPermission.",
-				!(new SecurityPermission("ugh!").implies(new AllPermission())));
-	}
+/* 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.AllPermission;
+import java.security.SecurityPermission;
+
+public class AllPermission2Test extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.security.AllPermission#AllPermission()
+	 */
+	public void test_Constructor() {
+		// Test for method java.security.AllPermission()
+		AllPermission ap = new AllPermission();
+		assertEquals("Bogus name for AllPermission \"" + ap.getName() + "\".",
+				"<all permissions>", ap.getName());
+	}
+
+	/**
+	 * @tests java.security.AllPermission#AllPermission(java.lang.String,
+	 *        java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_StringLjava_lang_String() {
+		// Test for method java.security.AllPermission(java.lang.String,
+		// java.lang.String)
+		AllPermission ap = new AllPermission("Don't remember this stupid name",
+				"or this action");
+		assertEquals("Bogus name for AllPermission \"" + ap.getName() + "\".",
+				"<all permissions>", ap.getName());
+		assertEquals(
+				"AllPermission constructed with actions didn't ignore them.",
+				"<all actions>", ap.getActions());
+	}
+
+	/**
+	 * @tests java.security.AllPermission#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		// Test for method boolean
+		// java.security.AllPermission.equals(java.lang.Object)
+		assertTrue("Two AllPermissions not equal to each other.",
+				new AllPermission().equals(new AllPermission()));
+		assertTrue("AllPermission equals a SecurityPermission.",
+				!(new AllPermission().equals(new SecurityPermission("ugh!"))));
+	}
+
+	/**
+	 * @tests java.security.AllPermission#getActions()
+	 */
+	public void test_getActions() {
+		AllPermission ap = new AllPermission();
+		// Test for method java.lang.String
+		// java.security.AllPermission.getActions()
+		assertTrue("AllPermission has non-empty actions. (" + ap.getActions()
+				+ ")", ap.getActions().equals("<all actions>"));
+	}
+
+	/**
+	 * @tests java.security.AllPermission#hashCode()
+	 */
+	public void test_hashCode() {
+		final int ALLPERMISSION_HASH = 1;
+		// Test for method int java.security.AllPermission.hashCode()
+		AllPermission TestAllPermission = new AllPermission();
+		assertTrue("AllPermission hashCode is wrong. Should have been "
+				+ ALLPERMISSION_HASH + " but was "
+				+ TestAllPermission.hashCode(),
+				TestAllPermission.hashCode() == ALLPERMISSION_HASH);
+	}
+
+	/**
+	 * @tests java.security.AllPermission#implies(java.security.Permission)
+	 */
+	public void test_impliesLjava_security_Permission() {
+		// Test for method boolean
+		// java.security.AllPermission.implies(java.security.Permission)
+		assertTrue("AllPermission does not imply a AllPermission.",
+				new AllPermission().implies(new AllPermission()));
+		assertTrue("AllPermission does not imply a SecurityPermission.",
+				new AllPermission().implies(new SecurityPermission("ugh!")));
+		assertTrue("SecurityPermission implies AllPermission.",
+				!(new SecurityPermission("ugh!").implies(new AllPermission())));
+	}
 }

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/BasicPermission2Test.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/BasicPermission2Test.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/BasicPermission2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/BasicPermission2Test.java Thu Sep 14 18:17:39 2006
@@ -1,120 +1,120 @@
-/* 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.BasicPermission;
-import java.security.PermissionCollection;
-
-public class BasicPermission2Test extends junit.framework.TestCase {
-
-	public static class BasicPermissionSubclass extends BasicPermission {
-		public BasicPermissionSubclass(String name) {
-			super(name);
-		}
-
-		public BasicPermissionSubclass(String name, String actions) {
-			super(name, actions);
-		}
-	}
-
-	BasicPermission bp = new BasicPermissionSubclass("aName");
-
-	BasicPermission bp2 = new BasicPermissionSubclass("aName", "anAction");
-
-	BasicPermission bp3 = new BasicPermissionSubclass("*");
-
-	BasicPermission bp4 = new BasicPermissionSubclass("this.that");
-
-	BasicPermission bp5 = new BasicPermissionSubclass("this.*");
-
-	/**
-	 * @tests java.security.BasicPermission#BasicPermission(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.security.BasicPermission(java.lang.String)
-		assertEquals("Incorrect name returned", "aName", bp.getName());
-	}
-
-	/**
-	 * @tests java.security.BasicPermission#BasicPermission(java.lang.String,
-	 *        java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_StringLjava_lang_String() {
-		// Test for method java.security.BasicPermission(java.lang.String,
-		// java.lang.String)
-		assertEquals("Incorrect name returned", "aName", bp2.getName());
-	}
-
-	/**
-	 * @tests java.security.BasicPermission#equals(java.lang.Object)
-	 */
-	public void test_equalsLjava_lang_Object() {
-		// Test for method boolean
-		// java.security.BasicPermission.equals(java.lang.Object)
-		assertTrue("a) Equal objects returned non-equal", bp.equals(bp2));
-		assertTrue("b) Equal objects returned non-equal", bp2.equals(bp));
-		assertTrue("a) Unequal objects returned equal", !bp.equals(bp3));
-		assertTrue("b) Unequal objects returned equal", !bp4.equals(bp5));
-	}
-
-	/**
-	 * @tests java.security.BasicPermission#getActions()
-	 */
-	public void test_getActions() {
-		// Test for method java.lang.String
-		// java.security.BasicPermission.getActions()
-		assertTrue("a) Incorrect actions returned, wanted the empty String", bp
-				.getActions().equals(""));
-		assertTrue("b) Incorrect actions returned, wanted the empty String",
-				bp2.getActions().equals(""));
-	}
-
-	/**
-	 * @tests java.security.BasicPermission#hashCode()
-	 */
-	public void test_hashCode() {
-		// Test for method int java.security.BasicPermission.hashCode()
-		assertTrue("Equal objects should return same hash",
-				bp.hashCode() == bp2.hashCode());
-	}
-
-	/**
-	 * @tests java.security.BasicPermission#implies(java.security.Permission)
-	 */
-	public void test_impliesLjava_security_Permission() {
-		// Test for method boolean
-		// java.security.BasicPermission.implies(java.security.Permission)
-		assertTrue("Equal objects should imply eachother", bp.implies(bp2));
-		assertTrue("a) should not imply", !bp.implies(bp3));
-		assertTrue("b) should not imply", !bp4.implies(bp5));
-		assertTrue("a) should imply", bp3.implies(bp5));
-		assertTrue("b) should imply", bp5.implies(bp4));
-
-	}
-
-	/**
-	 * @tests java.security.BasicPermission#newPermissionCollection()
-	 */
-	public void test_newPermissionCollection() {
-		// Test for method java.security.PermissionCollection
-		// java.security.BasicPermission.newPermissionCollection()
-		PermissionCollection bpc = bp.newPermissionCollection();
-		bpc.add(bp5);
-		bpc.add(bp);
-		assertTrue("Should imply", bpc.implies(bp4));
-		assertTrue("Should not imply", !bpc.implies(bp3));
-	}
+/* 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.BasicPermission;
+import java.security.PermissionCollection;
+
+public class BasicPermission2Test extends junit.framework.TestCase {
+
+	public static class BasicPermissionSubclass extends BasicPermission {
+		public BasicPermissionSubclass(String name) {
+			super(name);
+		}
+
+		public BasicPermissionSubclass(String name, String actions) {
+			super(name, actions);
+		}
+	}
+
+	BasicPermission bp = new BasicPermissionSubclass("aName");
+
+	BasicPermission bp2 = new BasicPermissionSubclass("aName", "anAction");
+
+	BasicPermission bp3 = new BasicPermissionSubclass("*");
+
+	BasicPermission bp4 = new BasicPermissionSubclass("this.that");
+
+	BasicPermission bp5 = new BasicPermissionSubclass("this.*");
+
+	/**
+	 * @tests java.security.BasicPermission#BasicPermission(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.security.BasicPermission(java.lang.String)
+		assertEquals("Incorrect name returned", "aName", bp.getName());
+	}
+
+	/**
+	 * @tests java.security.BasicPermission#BasicPermission(java.lang.String,
+	 *        java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_StringLjava_lang_String() {
+		// Test for method java.security.BasicPermission(java.lang.String,
+		// java.lang.String)
+		assertEquals("Incorrect name returned", "aName", bp2.getName());
+	}
+
+	/**
+	 * @tests java.security.BasicPermission#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() {
+		// Test for method boolean
+		// java.security.BasicPermission.equals(java.lang.Object)
+		assertTrue("a) Equal objects returned non-equal", bp.equals(bp2));
+		assertTrue("b) Equal objects returned non-equal", bp2.equals(bp));
+		assertTrue("a) Unequal objects returned equal", !bp.equals(bp3));
+		assertTrue("b) Unequal objects returned equal", !bp4.equals(bp5));
+	}
+
+	/**
+	 * @tests java.security.BasicPermission#getActions()
+	 */
+	public void test_getActions() {
+		// Test for method java.lang.String
+		// java.security.BasicPermission.getActions()
+		assertTrue("a) Incorrect actions returned, wanted the empty String", bp
+				.getActions().equals(""));
+		assertTrue("b) Incorrect actions returned, wanted the empty String",
+				bp2.getActions().equals(""));
+	}
+
+	/**
+	 * @tests java.security.BasicPermission#hashCode()
+	 */
+	public void test_hashCode() {
+		// Test for method int java.security.BasicPermission.hashCode()
+		assertTrue("Equal objects should return same hash",
+				bp.hashCode() == bp2.hashCode());
+	}
+
+	/**
+	 * @tests java.security.BasicPermission#implies(java.security.Permission)
+	 */
+	public void test_impliesLjava_security_Permission() {
+		// Test for method boolean
+		// java.security.BasicPermission.implies(java.security.Permission)
+		assertTrue("Equal objects should imply eachother", bp.implies(bp2));
+		assertTrue("a) should not imply", !bp.implies(bp3));
+		assertTrue("b) should not imply", !bp4.implies(bp5));
+		assertTrue("a) should imply", bp3.implies(bp5));
+		assertTrue("b) should imply", bp5.implies(bp4));
+
+	}
+
+	/**
+	 * @tests java.security.BasicPermission#newPermissionCollection()
+	 */
+	public void test_newPermissionCollection() {
+		// Test for method java.security.PermissionCollection
+		// java.security.BasicPermission.newPermissionCollection()
+		PermissionCollection bpc = bp.newPermissionCollection();
+		bpc.add(bp5);
+		bpc.add(bp);
+		assertTrue("Should imply", bpc.implies(bp4));
+		assertTrue("Should not imply", !bpc.implies(bp3));
+	}
 }

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/CodeSource2Test.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/CodeSource2Test.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/CodeSource2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/CodeSource2Test.java Thu Sep 14 18:17:39 2006
@@ -1,102 +1,102 @@
-/* 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.net.URL;
-import java.security.CodeSource;
-import java.security.cert.Certificate;
-
-public class CodeSource2Test extends junit.framework.TestCase {
-
-	/**
-	 * @throws Exception
-	 * @tests java.security.CodeSource#CodeSource(java.net.URL,
-	 *        java.security.cert.Certificate[])
-	 */
-	public void test_ConstructorLjava_net_URL$Ljava_security_cert_Certificate() throws Exception {
-		// Test for method java.security.CodeSource(java.net.URL,
-		// java.security.cert.Certificate [])
-		new CodeSource(new java.net.URL("file:///test"),
-				(Certificate[]) null);
-	}
-
-	/**
-	 * @tests java.security.CodeSource#equals(java.lang.Object)
-	 */
-	public void test_equalsLjava_lang_Object() throws Exception {
-		// Test for method boolean
-		// java.security.CodeSource.equals(java.lang.Object)
-		CodeSource cs1 = new CodeSource(new java.net.URL("file:///test"),
-				(Certificate[]) null);
-		CodeSource cs2 = new CodeSource(new java.net.URL("file:///test"),
-				(Certificate[]) null);
-		assertTrue("Identical objects were not equal()!", cs1.equals(cs2));
-	}
-
-	/**
-	 * @tests java.security.CodeSource#hashCode()
-	 */
-	public void test_hashCode() throws Exception {
-       		URL url = new java.net.URL("file:///test");
-       		CodeSource cs = new CodeSource(url, (Certificate[]) null);
-       		assertTrue("Did not get expected hashCode!", cs.hashCode() == url
-       				.hashCode());
-	}
-
-	/**
-	 * @tests java.security.CodeSource#getCertificates()
-	 */
-	public void test_getCertificates() throws Exception {
-       		CodeSource cs = new CodeSource(new java.net.URL("file:///test"),
-       				(Certificate[]) null);
-       		assertNull("Should have gotten null certificate list.", cs
-       				.getCertificates());
-	}
-
-	/**
-	 * @tests java.security.CodeSource#getLocation()
-	 */
-	public void test_getLocation() throws Exception {
-		// Test for method java.net.URL java.security.CodeSource.getLocation()
-       		CodeSource cs = new CodeSource(new java.net.URL("file:///test"),
-       				(Certificate[]) null);
-       		assertEquals("Did not get expected location!", "file:/test", cs.getLocation()
-       				.toString());
-	}
-
-	/**
-	 * @tests java.security.CodeSource#implies(java.security.CodeSource)
-	 */
-	public void test_impliesLjava_security_CodeSource() throws Exception {
-		// Test for method boolean
-		// java.security.CodeSource.implies(java.security.CodeSource)
-       		CodeSource cs1 = new CodeSource(new URL("file:/d:/somedir"),
-       				(Certificate[]) null);
-       		CodeSource cs2 = new CodeSource(new URL("file:/d:/somedir/"),
-       				(Certificate[]) null);
-       		assertTrue("Does not add /", cs1.implies(cs2));
-
-
-
-       		cs1 = new CodeSource(new URL("file", null, -1,
-       				"/d:/somedir/"), (Certificate[]) null);
-       		cs2 = new CodeSource(new URL("file:/d:/somedir/"),
-       				(Certificate[]) null);
-       		assertTrue("null host should imply host", cs1.implies(cs2));
-       		assertTrue("host should not imply null host", !cs2.implies(cs1));
-	}
-
+/* 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.net.URL;
+import java.security.CodeSource;
+import java.security.cert.Certificate;
+
+public class CodeSource2Test extends junit.framework.TestCase {
+
+	/**
+	 * @throws Exception
+	 * @tests java.security.CodeSource#CodeSource(java.net.URL,
+	 *        java.security.cert.Certificate[])
+	 */
+	public void test_ConstructorLjava_net_URL$Ljava_security_cert_Certificate() throws Exception {
+		// Test for method java.security.CodeSource(java.net.URL,
+		// java.security.cert.Certificate [])
+		new CodeSource(new java.net.URL("file:///test"),
+				(Certificate[]) null);
+	}
+
+	/**
+	 * @tests java.security.CodeSource#equals(java.lang.Object)
+	 */
+	public void test_equalsLjava_lang_Object() throws Exception {
+		// Test for method boolean
+		// java.security.CodeSource.equals(java.lang.Object)
+		CodeSource cs1 = new CodeSource(new java.net.URL("file:///test"),
+				(Certificate[]) null);
+		CodeSource cs2 = new CodeSource(new java.net.URL("file:///test"),
+				(Certificate[]) null);
+		assertTrue("Identical objects were not equal()!", cs1.equals(cs2));
+	}
+
+	/**
+	 * @tests java.security.CodeSource#hashCode()
+	 */
+	public void test_hashCode() throws Exception {
+       		URL url = new java.net.URL("file:///test");
+       		CodeSource cs = new CodeSource(url, (Certificate[]) null);
+       		assertTrue("Did not get expected hashCode!", cs.hashCode() == url
+       				.hashCode());
+	}
+
+	/**
+	 * @tests java.security.CodeSource#getCertificates()
+	 */
+	public void test_getCertificates() throws Exception {
+       		CodeSource cs = new CodeSource(new java.net.URL("file:///test"),
+       				(Certificate[]) null);
+       		assertNull("Should have gotten null certificate list.", cs
+       				.getCertificates());
+	}
+
+	/**
+	 * @tests java.security.CodeSource#getLocation()
+	 */
+	public void test_getLocation() throws Exception {
+		// Test for method java.net.URL java.security.CodeSource.getLocation()
+       		CodeSource cs = new CodeSource(new java.net.URL("file:///test"),
+       				(Certificate[]) null);
+       		assertEquals("Did not get expected location!", "file:/test", cs.getLocation()
+       				.toString());
+	}
+
+	/**
+	 * @tests java.security.CodeSource#implies(java.security.CodeSource)
+	 */
+	public void test_impliesLjava_security_CodeSource() throws Exception {
+		// Test for method boolean
+		// java.security.CodeSource.implies(java.security.CodeSource)
+       		CodeSource cs1 = new CodeSource(new URL("file:/d:/somedir"),
+       				(Certificate[]) null);
+       		CodeSource cs2 = new CodeSource(new URL("file:/d:/somedir/"),
+       				(Certificate[]) null);
+       		assertTrue("Does not add /", cs1.implies(cs2));
+
+
+
+       		cs1 = new CodeSource(new URL("file", null, -1,
+       				"/d:/somedir/"), (Certificate[]) null);
+       		cs2 = new CodeSource(new URL("file:/d:/somedir/"),
+       				(Certificate[]) null);
+       		assertTrue("null host should imply host", cs1.implies(cs2));
+       		assertTrue("host should not imply null host", !cs2.implies(cs1));
+	}
+
 }

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestException2Test.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/DigestException2Test.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/DigestException2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestException2Test.java Thu Sep 14 18:17:39 2006
@@ -1,41 +1,41 @@
-/* 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.DigestException;
-
-public class DigestException2Test extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.security.DigestException#DigestException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.security.DigestException()
-		DigestException de = new DigestException();
-		assertNull("Exception with no message should yield null message.", de
-				.getMessage());
-	}
-
-	/**
-	 * @tests java.security.DigestException#DigestException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method java.security.DigestException(java.lang.String)
-		DigestException de = new DigestException("Test message");
-		assertEquals("Exception message is incorrect", "Test message", de
-				.getMessage());
-	}
+/* 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.DigestException;
+
+public class DigestException2Test extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.security.DigestException#DigestException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.security.DigestException()
+		DigestException de = new DigestException();
+		assertNull("Exception with no message should yield null message.", de
+				.getMessage());
+	}
+
+	/**
+	 * @tests java.security.DigestException#DigestException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method java.security.DigestException(java.lang.String)
+		DigestException de = new DigestException("Test message");
+		assertEquals("Exception message is incorrect", "Test message", de
+				.getMessage());
+	}
 }

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

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestInputStream2Test.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/DigestInputStream2Test.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/DigestInputStream2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestInputStream2Test.java Thu Sep 14 18:17:39 2006
@@ -1,189 +1,189 @@
-/* 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.ByteArrayInputStream;
-import java.io.IOException;
-import java.security.DigestInputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-public class DigestInputStream2Test extends junit.framework.TestCase {
-
-	ByteArrayInputStream inStream;
-
-	ByteArrayInputStream inStream1;
-
-	MessageDigest digest;
-
-	/**
-	 * @tests java.security.DigestInputStream#DigestInputStream(java.io.InputStream,
-	 *        java.security.MessageDigest)
-	 */
-	public void test_ConstructorLjava_io_InputStreamLjava_security_MessageDigest() {
-		// Test for method java.security.DigestInputStream(java.io.InputStream,
-		// java.security.MessageDigest)
-		DigestInputStream dis = new DigestInputStream(inStream, digest);
-		assertNotNull("Constructor returned null instance", dis);
-	}
-
-	/**
-	 * @tests java.security.DigestInputStream#getMessageDigest()
-	 */
-	public void test_getMessageDigest() {
-		// Test for method java.security.MessageDigest
-		// java.security.DigestInputStream.getMessageDigest()
-		DigestInputStream dis = new DigestInputStream(inStream, digest);
-		assertEquals("getMessageDigest returned a bogus result", digest, dis
-				.getMessageDigest());
-	}
-
-	/**
-	 * @tests java.security.DigestInputStream#on(boolean)
-	 */
-	public void test_onZ() {
-		// Test for method void java.security.DigestInputStream.on(boolean)
-		try {
-			MessageDigest originalDigest = (MessageDigest) (digest.clone());
-			MessageDigest noChangeDigest = (MessageDigest) (digest.clone());
-			DigestInputStream dis = new DigestInputStream(inStream,
-					noChangeDigest);
-			// turn off processing
-			dis.on(false);
-			// read some data
-			try {
-				int c = dis.read();
-				assertTrue("Stream returned bogus first character. Char was: '"
-						+ (char) c + " 'Should have been 'T'", c == 'T');
-			} catch (IOException e) {
-				fail("Stream threw an IOException : " + e);
-			}
-			
-			// make sure the digest for the part where it was off has not
-			// changed
-			assertTrue("MessageDigest changed even though processing was off",
-					MessageDigest.isEqual(noChangeDigest.digest(),
-							originalDigest.digest()));
-			MessageDigest changeDigest = (MessageDigest) (digest.clone());
-			dis = new DigestInputStream(inStream, digest);
-			
-			// turn on processing
-			dis.on(true);
-			try {
-				int c = dis.read();
-				assertTrue(
-						"Stream returned bogus second character. Char was: '"
-								+ (char) c + " 'Should have been 'h'", c == 'h');
-			} catch (IOException e) {
-				fail("Stream threw an IOException : " + e);
-			}
-			// make sure the digest has changed
-			assertTrue("MessageDigest did not change with processing on",
-					!MessageDigest.isEqual(digest.digest(), changeDigest
-							.digest()));
-		} catch (CloneNotSupportedException e) {
-			fail("MessageDigest should support clone : " + e);
-		}
-
-	}
-
-	/**
-	 * @tests java.security.DigestInputStream#read()
-	 */
-	public void test_read() {
-		// Test for method int java.security.DigestInputStream.read()
-		DigestInputStream dis = new DigestInputStream(inStream, digest);
-		
-		// read and compare the data that the inStream has
-		try {
-			int c;
-			while ((c = dis.read()) > -1) {
-				int d = inStream1.read();
-				assertTrue("Stream returned bogus character '" + (char) c
-						+ "' should have been '" + (char) d + "'", c == d);
-			}// end while
-		} catch (IOException e) {
-			fail("Stream threw an IOException : " + e);
-		}
-	}
-
-	/**
-	 * @tests java.security.DigestInputStream#read(byte[], int, int)
-	 */
-	public void test_read$BII() {
-		// Test for method int java.security.DigestInputStream.read(byte [],
-		// int, int)
-		DigestInputStream dis = new DigestInputStream(inStream, digest);
-		int bytesToRead = inStream.available();
-		byte buf1[] = new byte[bytesToRead + 5];
-		byte buf2[] = new byte[bytesToRead + 5];
-		// make sure we're actually reading some data
-		assertTrue("No data to read for this test", bytesToRead>0);
-		
-		// read and compare the data that the inStream has
-		try {
-			int bytesRead1 = dis.read(buf1, 5, bytesToRead);
-			int bytesRead2 = inStream1.read(buf2, 5, bytesToRead);
-			assertTrue("Didn't read the same from each stream",
-					bytesRead1 == bytesRead2);
-			assertTrue("Didn't read the entire", bytesRead1 == bytesToRead);
-			// compare the arrays
-			boolean same = true;
-			for (int i = 0; i < bytesToRead + 5; i++) {
-				if (buf1[i] != buf2[i]) {
-					same = false;
-				}
-			}// end for 
-			assertTrue("Didn't get the same data", same);
-		} catch (IOException e) {
-			fail("Stream threw an IOException : " + e);
-		}
-	}
-
-	/**
-	 * @tests java.security.DigestInputStream#setMessageDigest(java.security.MessageDigest)
-	 */
-	public void test_setMessageDigestLjava_security_MessageDigest() {
-		// Test for method void
-		// java.security.DigestInputStream.setMessageDigest(java.security.MessageDigest)
-		DigestInputStream dis = new DigestInputStream(inStream, null);
-		
-		// make sure the digest is null when it's not been set
-		assertNull(
-				"Uninitialised MessageDigest should have been returned as null",
-				dis.getMessageDigest());
-		dis.setMessageDigest(digest);
-		assertEquals("Wrong MessageDigest was returned.", digest, dis
-				.getMessageDigest());
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-		// create a ByteArrayInputStream to perform digesting on
-		inStream = new ByteArrayInputStream(
-				"This is a test string for digesting".getBytes());
-		inStream1 = new ByteArrayInputStream(
-				"This is a test string for digesting".getBytes());
-		try {
-			digest = MessageDigest.getInstance("SHA-1");
-		} catch (NoSuchAlgorithmException e) {
-			fail("Unable to find SHA-1 algorithim");
-		}
-	}
+/* 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.ByteArrayInputStream;
+import java.io.IOException;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class DigestInputStream2Test extends junit.framework.TestCase {
+
+	ByteArrayInputStream inStream;
+
+	ByteArrayInputStream inStream1;
+
+	MessageDigest digest;
+
+	/**
+	 * @tests java.security.DigestInputStream#DigestInputStream(java.io.InputStream,
+	 *        java.security.MessageDigest)
+	 */
+	public void test_ConstructorLjava_io_InputStreamLjava_security_MessageDigest() {
+		// Test for method java.security.DigestInputStream(java.io.InputStream,
+		// java.security.MessageDigest)
+		DigestInputStream dis = new DigestInputStream(inStream, digest);
+		assertNotNull("Constructor returned null instance", dis);
+	}
+
+	/**
+	 * @tests java.security.DigestInputStream#getMessageDigest()
+	 */
+	public void test_getMessageDigest() {
+		// Test for method java.security.MessageDigest
+		// java.security.DigestInputStream.getMessageDigest()
+		DigestInputStream dis = new DigestInputStream(inStream, digest);
+		assertEquals("getMessageDigest returned a bogus result", digest, dis
+				.getMessageDigest());
+	}
+
+	/**
+	 * @tests java.security.DigestInputStream#on(boolean)
+	 */
+	public void test_onZ() {
+		// Test for method void java.security.DigestInputStream.on(boolean)
+		try {
+			MessageDigest originalDigest = (MessageDigest) (digest.clone());
+			MessageDigest noChangeDigest = (MessageDigest) (digest.clone());
+			DigestInputStream dis = new DigestInputStream(inStream,
+					noChangeDigest);
+			// turn off processing
+			dis.on(false);
+			// read some data
+			try {
+				int c = dis.read();
+				assertTrue("Stream returned bogus first character. Char was: '"
+						+ (char) c + " 'Should have been 'T'", c == 'T');
+			} catch (IOException e) {
+				fail("Stream threw an IOException : " + e);
+			}
+			
+			// make sure the digest for the part where it was off has not
+			// changed
+			assertTrue("MessageDigest changed even though processing was off",
+					MessageDigest.isEqual(noChangeDigest.digest(),
+							originalDigest.digest()));
+			MessageDigest changeDigest = (MessageDigest) (digest.clone());
+			dis = new DigestInputStream(inStream, digest);
+			
+			// turn on processing
+			dis.on(true);
+			try {
+				int c = dis.read();
+				assertTrue(
+						"Stream returned bogus second character. Char was: '"
+								+ (char) c + " 'Should have been 'h'", c == 'h');
+			} catch (IOException e) {
+				fail("Stream threw an IOException : " + e);
+			}
+			// make sure the digest has changed
+			assertTrue("MessageDigest did not change with processing on",
+					!MessageDigest.isEqual(digest.digest(), changeDigest
+							.digest()));
+		} catch (CloneNotSupportedException e) {
+			fail("MessageDigest should support clone : " + e);
+		}
+
+	}
+
+	/**
+	 * @tests java.security.DigestInputStream#read()
+	 */
+	public void test_read() {
+		// Test for method int java.security.DigestInputStream.read()
+		DigestInputStream dis = new DigestInputStream(inStream, digest);
+		
+		// read and compare the data that the inStream has
+		try {
+			int c;
+			while ((c = dis.read()) > -1) {
+				int d = inStream1.read();
+				assertTrue("Stream returned bogus character '" + (char) c
+						+ "' should have been '" + (char) d + "'", c == d);
+			}// end while
+		} catch (IOException e) {
+			fail("Stream threw an IOException : " + e);
+		}
+	}
+
+	/**
+	 * @tests java.security.DigestInputStream#read(byte[], int, int)
+	 */
+	public void test_read$BII() {
+		// Test for method int java.security.DigestInputStream.read(byte [],
+		// int, int)
+		DigestInputStream dis = new DigestInputStream(inStream, digest);
+		int bytesToRead = inStream.available();
+		byte buf1[] = new byte[bytesToRead + 5];
+		byte buf2[] = new byte[bytesToRead + 5];
+		// make sure we're actually reading some data
+		assertTrue("No data to read for this test", bytesToRead>0);
+		
+		// read and compare the data that the inStream has
+		try {
+			int bytesRead1 = dis.read(buf1, 5, bytesToRead);
+			int bytesRead2 = inStream1.read(buf2, 5, bytesToRead);
+			assertTrue("Didn't read the same from each stream",
+					bytesRead1 == bytesRead2);
+			assertTrue("Didn't read the entire", bytesRead1 == bytesToRead);
+			// compare the arrays
+			boolean same = true;
+			for (int i = 0; i < bytesToRead + 5; i++) {
+				if (buf1[i] != buf2[i]) {
+					same = false;
+				}
+			}// end for 
+			assertTrue("Didn't get the same data", same);
+		} catch (IOException e) {
+			fail("Stream threw an IOException : " + e);
+		}
+	}
+
+	/**
+	 * @tests java.security.DigestInputStream#setMessageDigest(java.security.MessageDigest)
+	 */
+	public void test_setMessageDigestLjava_security_MessageDigest() {
+		// Test for method void
+		// java.security.DigestInputStream.setMessageDigest(java.security.MessageDigest)
+		DigestInputStream dis = new DigestInputStream(inStream, null);
+		
+		// make sure the digest is null when it's not been set
+		assertNull(
+				"Uninitialised MessageDigest should have been returned as null",
+				dis.getMessageDigest());
+		dis.setMessageDigest(digest);
+		assertEquals("Wrong MessageDigest was returned.", digest, dis
+				.getMessageDigest());
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() {
+		// create a ByteArrayInputStream to perform digesting on
+		inStream = new ByteArrayInputStream(
+				"This is a test string for digesting".getBytes());
+		inStream1 = new ByteArrayInputStream(
+				"This is a test string for digesting".getBytes());
+		try {
+			digest = MessageDigest.getInstance("SHA-1");
+		} catch (NoSuchAlgorithmException e) {
+			fail("Unable to find SHA-1 algorithim");
+		}
+	}
 }

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStream2Test.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/DigestOutputStream2Test.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/DigestOutputStream2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/DigestOutputStream2Test.java Thu Sep 14 18:17:39 2006
@@ -1,139 +1,139 @@
-/* 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.ByteArrayOutputStream;
-import java.security.DigestOutputStream;
-import java.security.MessageDigest;
-
-public class DigestOutputStream2Test extends junit.framework.TestCase {
-	ByteArrayOutputStream output1;
-
-	ByteArrayOutputStream output2;
-
-	MessageDigest digest;
-
-	/**
-	 * @tests java.security.DigestOutputStream#DigestOutputStream(java.io.OutputStream,
-	 *        java.security.MessageDigest)
-	 */
-	public void test_ConstructorLjava_io_OutputStreamLjava_security_MessageDigest() {
-		// Test for method
-		// java.security.DigestOutputStream(java.io.OutputStream,
-		// java.security.MessageDigest)
-		assertNotNull("Constructor returned null instance",
-				new DigestOutputStream(output1, digest));
-	}
-
-	/**
-	 * @tests java.security.DigestOutputStream#getMessageDigest()
-	 */
-	public void test_getMessageDigest() {
-		// Test for method java.security.MessageDigest
-		// java.security.DigestOutputStream.getMessageDigest()
-		DigestOutputStream dos = new DigestOutputStream(output1, digest);
-		assertEquals("getMessageDigest did not return expected result", 
-				digest, dos.getMessageDigest());
-		dos = new DigestOutputStream(output1, null);
-		assertNull("getMessageDigest should have returned null", dos
-				.getMessageDigest());
-	}
-
-	/**
-	 * @tests java.security.DigestOutputStream#on(boolean)
-	 */
-	public void test_onZ() {
-		// Test for method void java.security.DigestOutputStream.on(boolean)
-		try {
-			DigestOutputStream dos = new DigestOutputStream(output1, digest);
-			dos.on(false);
-			byte digestArray[] = { 23, 43, 44 };
-			dos.write(digestArray, 1, 1);
-			byte digestResult[] = dos.getMessageDigest().digest();
-			byte expected[] = { -38, 57, -93, -18, 94, 107, 75, 13, 50, 85,
-					-65, -17, -107, 96, 24, -112, -81, -40, 7, 9 };
-			assertTrue("Digest did not return expected result.",
-					java.util.Arrays.equals(digestResult, expected));
-			// now turn on processing and re-run
-			dos.on(true);
-			dos.write(digestArray, 1, 1);
-			digestResult = dos.getMessageDigest().digest();
-			byte expected1[] = { -87, 121, -17, 16, -52, 111, 106, 54, -33,
-					107, -118, 50, 51, 7, -18, 59, -78, -30, -37, -100 };
-
-			assertTrue("Digest did not return expected result.",
-					java.util.Arrays.equals(digestResult, expected1));
-		} catch (Exception e) {
-			fail("Caught exception : " + e);
-		}
-	}
-
-	/**
-	 * @tests java.security.DigestOutputStream#setMessageDigest(java.security.MessageDigest)
-	 */
-	public void test_setMessageDigestLjava_security_MessageDigest() {
-		// Test for method void
-		// java.security.DigestOutputStream.setMessageDigest(java.security.MessageDigest)
-		DigestOutputStream dos = new DigestOutputStream(output1, null);
-		dos.setMessageDigest(digest);
-		assertEquals("getMessageDigest did not return expected result", digest,
-				dos.getMessageDigest());
-		dos.setMessageDigest(null);
-		assertNull("getMessageDigest should have returned null", dos
-				.getMessageDigest());
-	}
-
-	/**
-	 * @tests java.security.DigestOutputStream#write(byte[], int, int)
-	 */
-	public void test_write$BII() throws Exception {
-		// Test for method void java.security.DigestOutputStream.write(byte [],
-		// int, int)
-       		DigestOutputStream dos = new DigestOutputStream(output1, digest);
-       		byte digestArray[] = { 23, 43, 44 };
-       		dos.write(digestArray, 1, 1);
-       		byte digestResult[] = dos.getMessageDigest().digest();
-       		byte expected[] = { -87, 121, -17, 16, -52, 111, 106, 54, -33, 107,
-       				-118, 50, 51, 7, -18, 59, -78, -30, -37, -100 };
-
-       		assertTrue("Digest did not return expected result.",
-       				java.util.Arrays.equals(digestResult, expected));
-	}
-
-	/**
-	 * @tests java.security.DigestOutputStream#write(int)
-	 */
-	public void test_writeI() throws Exception {
-		// Test for method void java.security.DigestOutputStream.write(int)
-       		DigestOutputStream dos = new DigestOutputStream(output1, digest);
-       		dos.write((byte) 43);
-       		byte digestResult[] = dos.getMessageDigest().digest();
-       		byte expected[] = { -87, 121, -17, 16, -52, 111, 106, 54, -33, 107,
-       				-118, 50, 51, 7, -18, 59, -78, -30, -37, -100 };
-
-       		assertTrue("Digest did not return expected result.",
-       				java.util.Arrays.equals(digestResult, expected));
-	}
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() throws Exception {
-		output1 = new ByteArrayOutputStream();
-		digest = MessageDigest.getInstance("SHA");
-	}
+/* 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.ByteArrayOutputStream;
+import java.security.DigestOutputStream;
+import java.security.MessageDigest;
+
+public class DigestOutputStream2Test extends junit.framework.TestCase {
+	ByteArrayOutputStream output1;
+
+	ByteArrayOutputStream output2;
+
+	MessageDigest digest;
+
+	/**
+	 * @tests java.security.DigestOutputStream#DigestOutputStream(java.io.OutputStream,
+	 *        java.security.MessageDigest)
+	 */
+	public void test_ConstructorLjava_io_OutputStreamLjava_security_MessageDigest() {
+		// Test for method
+		// java.security.DigestOutputStream(java.io.OutputStream,
+		// java.security.MessageDigest)
+		assertNotNull("Constructor returned null instance",
+				new DigestOutputStream(output1, digest));
+	}
+
+	/**
+	 * @tests java.security.DigestOutputStream#getMessageDigest()
+	 */
+	public void test_getMessageDigest() {
+		// Test for method java.security.MessageDigest
+		// java.security.DigestOutputStream.getMessageDigest()
+		DigestOutputStream dos = new DigestOutputStream(output1, digest);
+		assertEquals("getMessageDigest did not return expected result", 
+				digest, dos.getMessageDigest());
+		dos = new DigestOutputStream(output1, null);
+		assertNull("getMessageDigest should have returned null", dos
+				.getMessageDigest());
+	}
+
+	/**
+	 * @tests java.security.DigestOutputStream#on(boolean)
+	 */
+	public void test_onZ() {
+		// Test for method void java.security.DigestOutputStream.on(boolean)
+		try {
+			DigestOutputStream dos = new DigestOutputStream(output1, digest);
+			dos.on(false);
+			byte digestArray[] = { 23, 43, 44 };
+			dos.write(digestArray, 1, 1);
+			byte digestResult[] = dos.getMessageDigest().digest();
+			byte expected[] = { -38, 57, -93, -18, 94, 107, 75, 13, 50, 85,
+					-65, -17, -107, 96, 24, -112, -81, -40, 7, 9 };
+			assertTrue("Digest did not return expected result.",
+					java.util.Arrays.equals(digestResult, expected));
+			// now turn on processing and re-run
+			dos.on(true);
+			dos.write(digestArray, 1, 1);
+			digestResult = dos.getMessageDigest().digest();
+			byte expected1[] = { -87, 121, -17, 16, -52, 111, 106, 54, -33,
+					107, -118, 50, 51, 7, -18, 59, -78, -30, -37, -100 };
+
+			assertTrue("Digest did not return expected result.",
+					java.util.Arrays.equals(digestResult, expected1));
+		} catch (Exception e) {
+			fail("Caught exception : " + e);
+		}
+	}
+
+	/**
+	 * @tests java.security.DigestOutputStream#setMessageDigest(java.security.MessageDigest)
+	 */
+	public void test_setMessageDigestLjava_security_MessageDigest() {
+		// Test for method void
+		// java.security.DigestOutputStream.setMessageDigest(java.security.MessageDigest)
+		DigestOutputStream dos = new DigestOutputStream(output1, null);
+		dos.setMessageDigest(digest);
+		assertEquals("getMessageDigest did not return expected result", digest,
+				dos.getMessageDigest());
+		dos.setMessageDigest(null);
+		assertNull("getMessageDigest should have returned null", dos
+				.getMessageDigest());
+	}
+
+	/**
+	 * @tests java.security.DigestOutputStream#write(byte[], int, int)
+	 */
+	public void test_write$BII() throws Exception {
+		// Test for method void java.security.DigestOutputStream.write(byte [],
+		// int, int)
+       		DigestOutputStream dos = new DigestOutputStream(output1, digest);
+       		byte digestArray[] = { 23, 43, 44 };
+       		dos.write(digestArray, 1, 1);
+       		byte digestResult[] = dos.getMessageDigest().digest();
+       		byte expected[] = { -87, 121, -17, 16, -52, 111, 106, 54, -33, 107,
+       				-118, 50, 51, 7, -18, 59, -78, -30, -37, -100 };
+
+       		assertTrue("Digest did not return expected result.",
+       				java.util.Arrays.equals(digestResult, expected));
+	}
+
+	/**
+	 * @tests java.security.DigestOutputStream#write(int)
+	 */
+	public void test_writeI() throws Exception {
+		// Test for method void java.security.DigestOutputStream.write(int)
+       		DigestOutputStream dos = new DigestOutputStream(output1, digest);
+       		dos.write((byte) 43);
+       		byte digestResult[] = dos.getMessageDigest().digest();
+       		byte expected[] = { -87, 121, -17, 16, -52, 111, 106, 54, -33, 107,
+       				-118, 50, 51, 7, -18, 59, -78, -30, -37, -100 };
+
+       		assertTrue("Digest did not return expected result.",
+       				java.util.Arrays.equals(digestResult, expected));
+	}
+
+	/**
+	 * Sets up the fixture, for example, open a network connection. This method
+	 * is called before a test is executed.
+	 */
+	protected void setUp() throws Exception {
+		output1 = new ByteArrayOutputStream();
+		digest = MessageDigest.getInstance("SHA");
+	}
 }

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/GeneralSecurityException2Test.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/GeneralSecurityException2Test.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/GeneralSecurityException2Test.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/GeneralSecurityException2Test.java Thu Sep 14 18:17:39 2006
@@ -1,46 +1,46 @@
-/* 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.GeneralSecurityException;
-
-public class GeneralSecurityException2Test extends junit.framework.TestCase {
-
-	/**
-	 * @tests java.security.GeneralSecurityException#GeneralSecurityException()
-	 */
-	public void test_Constructor() {
-		// Test for method java.security.GeneralSecurityException()
-		GeneralSecurityException e = new GeneralSecurityException();
-		assertNotNull("Constructor returned null instance", e);
-		assertEquals("Failed toString test for constructed instance", "java.security.GeneralSecurityException", e
-				.toString());
-	}
-
-	/**
-	 * @tests java.security.GeneralSecurityException#GeneralSecurityException(java.lang.String)
-	 */
-	public void test_ConstructorLjava_lang_String() {
-		// Test for method
-		// java.security.GeneralSecurityException(java.lang.String)
-		GeneralSecurityException e = new GeneralSecurityException(
-				"test message");
-		assertNotNull("Constructor returned null instance", e);
-		assertEquals("Failed toString test for constructed instance", 
-						"java.security.GeneralSecurityException: test message", e
-				.toString());
-	}
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.security.tests.java.security;
+
+import java.security.GeneralSecurityException;
+
+public class GeneralSecurityException2Test extends junit.framework.TestCase {
+
+	/**
+	 * @tests java.security.GeneralSecurityException#GeneralSecurityException()
+	 */
+	public void test_Constructor() {
+		// Test for method java.security.GeneralSecurityException()
+		GeneralSecurityException e = new GeneralSecurityException();
+		assertNotNull("Constructor returned null instance", e);
+		assertEquals("Failed toString test for constructed instance", "java.security.GeneralSecurityException", e
+				.toString());
+	}
+
+	/**
+	 * @tests java.security.GeneralSecurityException#GeneralSecurityException(java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_String() {
+		// Test for method
+		// java.security.GeneralSecurityException(java.lang.String)
+		GeneralSecurityException e = new GeneralSecurityException(
+				"test message");
+		assertNotNull("Constructor returned null instance", e);
+		assertEquals("Failed toString test for constructed instance", 
+						"java.security.GeneralSecurityException: test message", e
+				.toString());
+	}
 }

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

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

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



Mime
View raw message