harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r463602 - /incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/login/ConfigurationTest.java
Date Fri, 13 Oct 2006 09:04:57 GMT
Author: smishura
Date: Fri Oct 13 02:04:56 2006
New Revision: 463602

URL: http://svn.apache.org/viewvc?view=rev&rev=463602
Log:
Remove code duplication: use support class that is the same

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/login/ConfigurationTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/login/ConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/login/ConfigurationTest.java?view=diff&rev=463602&r1=463601&r2=463602
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/login/ConfigurationTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/login/ConfigurationTest.java
Fri Oct 13 02:04:56 2006
@@ -23,7 +23,6 @@
 package org.apache.harmony.auth.tests.javax.security.auth.login;
 
 import java.io.File;
-import java.security.Permission;
 import java.security.Security;
 import java.util.Properties;
 
@@ -33,6 +32,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.harmony.auth.tests.support.SecurityChecker;
 import org.apache.harmony.auth.tests.support.TestUtils;
 
 import tests.support.Support_Exec;
@@ -50,38 +50,6 @@
     private static final String LOGIN_CONFIG_PROVIDER = "login.configuration.provider";
 
 	/**
-	 * Easy the SecurityManager class
-	 */
-	class MySecurityManager extends SecurityManager {
-
-		public boolean enableAccess;
-
-		public Permission checkTarget;
-
-		public boolean checkAsserted;
-
-		public MySecurityManager(Permission target, boolean enable) {
-			checkAsserted = false;
-			checkTarget = target;
-			enableAccess = enable;
-		}
-
-		public void checkPermission(Permission p) {
-			if (p instanceof AuthPermission && checkTarget.equals(p)) {
-				checkAsserted = true;
-				if (!enableAccess) {
-					throw new SecurityException();
-				}
-			}
-		}
-
-		public MySecurityManager reset() {
-			checkAsserted = false;
-			return this;
-		}
-	}
-
-	/**
 	 * Ease the configuration class
 	 */
 	public static class ConfTestProvider extends Configuration {
@@ -130,7 +98,7 @@
 	 * Tests that setConfiguration() is properly secured via SecurityManager.
 	 */
 	public void testSetConfiguration() {
-		MySecurityManager checker = new MySecurityManager(new AuthPermission(
+        SecurityChecker checker = new SecurityChecker(new AuthPermission(
 				"setLoginConfiguration"), true);
 		System.setSecurityManager(checker);
 		Configuration custom = new ConfTestProvider();
@@ -152,7 +120,7 @@
 	 */
 	public void testGetConfiguration() {
 		Configuration.setConfiguration(new ConfTestProvider());
-		MySecurityManager checker = new MySecurityManager(new AuthPermission(
+        SecurityChecker checker = new SecurityChecker(new AuthPermission(
 				"getLoginConfiguration"), true);
 		System.setSecurityManager(checker);
 		Configuration.getConfiguration();



Mime
View raw message