harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r424279 - in /incubator/harmony/enhanced/classlib/trunk/modules/auth: ./ META-INF/ src/test/java/common/javax/security/auth/ src/test/java/common/javax/security/sasl/ src/test/java/common/org/apache/harmony/auth/login/ src/test/java/common/...
Date Fri, 21 Jul 2006 12:18:33 GMT
Author: tellison
Date: Fri Jul 21 05:18:32 2006
New Revision: 424279

URL: http://svn.apache.org/viewvc?rev=424279&view=rev
Log:
Resolve a FIXME : remove AUTH test dependencies on SECURITY.

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java
  (with props)
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java
  (with props)
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/TestUtils.java
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF
    incubator/harmony/enhanced/classlib/trunk/modules/auth/build.xml
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl2Test.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl3Test.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl4Test.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF?rev=424279&r1=424278&r2=424279&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF Fri Jul 21
05:18:32 2006
@@ -20,7 +20,6 @@
  org.apache.harmony.security,
  org.apache.harmony.security.asn1,
  org.apache.harmony.security.fortress,
- org.apache.harmony.security.tests.support;hy_usage=test;resolution:=optional,
  org.apache.harmony.security.utils,
  org.apache.harmony.security.x501,
  org.apache.harmony.testframework.serialization;hy_usage=test;resolution:=optional

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/build.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/build.xml?rev=424279&r1=424278&r2=424279&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/build.xml Fri Jul 21 05:18:32 2006
@@ -113,11 +113,9 @@
                 target="${hy.javac.target}"
                 debug="${hy.javac.debug}">
 
-            <!-- FIXME: AUTH tests should not reach into security module code -->
             <src>
                 <pathelement location="${hy.auth.src.test.java}"/>
                 <pathelement location="${hy.auth.src.test.java.platform}"/>
-                <pathelement location="${hy.auth}/../security/src/test/support/common/java"/>
             </src>
 
             <include name="javax/security/auth/**/*Test*.java" />

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java?rev=424279&r1=424278&r2=424279&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/auth/PolicyTest.java
Fri Jul 21 05:18:32 2006
@@ -35,8 +35,8 @@
 
 import junit.framework.TestCase;
 
-import org.apache.harmony.security.tests.support.SecurityChecker;
-import org.apache.harmony.security.tests.support.TestUtils;
+import org.apache.harmony.auth.tests.support.SecurityChecker;
+import org.apache.harmony.auth.tests.support.TestUtils;
 
 
 /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl2Test.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl2Test.java?rev=424279&r1=424278&r2=424279&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl2Test.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl2Test.java
Fri Jul 21 05:18:32 2006
@@ -26,7 +26,7 @@
 import java.security.Security;
 import javax.security.auth.callback.CallbackHandler;
 
-import org.apache.harmony.security.tests.support.SpiEngUtils;
+import org.apache.harmony.auth.tests.support.SpiEngUtils;
 
 import junit.framework.TestCase;
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl3Test.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl3Test.java?rev=424279&r1=424278&r2=424279&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl3Test.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl3Test.java
Fri Jul 21 05:18:32 2006
@@ -34,7 +34,7 @@
 import javax.security.auth.callback.TextOutputCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
-import org.apache.harmony.security.tests.support.SpiEngUtils;
+import org.apache.harmony.auth.tests.support.SpiEngUtils;
 
 import junit.framework.TestCase;
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl4Test.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl4Test.java?rev=424279&r1=424278&r2=424279&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl4Test.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/javax/security/sasl/Sasl4Test.java
Fri Jul 21 05:18:32 2006
@@ -31,7 +31,7 @@
 import javax.security.auth.callback.TextOutputCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
-import org.apache.harmony.security.tests.support.SpiEngUtils;
+import org.apache.harmony.auth.tests.support.SpiEngUtils;
 
 import junit.framework.TestCase;
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java?rev=424279&r1=424278&r2=424279&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/login/DefaultConfigurationTest.java
Fri Jul 21 05:18:32 2006
@@ -35,7 +35,7 @@
 
 import junit.framework.TestCase;
 
-import org.apache.harmony.security.tests.support.TestUtils;
+import org.apache.harmony.auth.tests.support.TestUtils;
 import org.apache.harmony.auth.login.DefaultConfiguration;
 
 

Added: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java?rev=424279&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java
Fri Jul 21 05:18:32 2006
@@ -0,0 +1,57 @@
+/*
+ *  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 Alexey V. Varlamov
+* @version $Revision$
+*/
+
+package org.apache.harmony.auth.tests.support;
+
+import java.security.Permission;
+
+/**
+ * Custom security manager
+ */
+
+public class SecurityChecker extends SecurityManager {
+
+    public boolean enableAccess;
+
+    public Permission checkTarget;
+
+    public boolean checkAsserted;
+
+    public SecurityChecker(Permission target, boolean enable) {
+        checkAsserted = false;
+        checkTarget = target;
+        enableAccess = enable;
+    }
+
+    public void checkPermission(Permission p) {
+        if (checkTarget.equals(p)) {
+            checkAsserted = true;
+            if (!enableAccess) {
+                throw new SecurityException();
+            }
+        }
+    }
+    
+    public SecurityChecker reset() {
+        checkAsserted = false;
+        return this;
+    }
+}
\ No newline at end of file

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SecurityChecker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java?rev=424279&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java
Fri Jul 21 05:18:32 2006
@@ -0,0 +1,84 @@
+/*
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+* @author Vera Y. Petrashkova
+* @version $Revision$
+*/
+
+package org.apache.harmony.auth.tests.support;
+
+import java.io.File;
+import java.security.Security;
+import java.security.Provider;
+import java.util.StringTokenizer;
+
+/**
+ * Additional class for verification spi-engine classes
+ * 
+ */
+
+public class SpiEngUtils {
+
+    public static final String[] invalidValues = {
+            "",
+            "BadAlgorithm",
+            "Long message Long message Long message Long message Long message Long message
Long message Long message Long message Long message Long message Long message Long message"
};
+
+    /**
+     * Verification: is algorithm supported or not
+     * 
+     * @param algorithm
+     * @param service
+     * @return
+     */
+    public static Provider isSupport(String algorithm, String service) {
+        try {
+            Provider[] provs = Security.getProviders(service.concat(".")
+                    .concat(algorithm));
+            if (provs == null) {
+                return null;
+            }
+            return (provs.length == 0 ? null : provs[0]);
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    public static String getFileName(String dir, String name) {
+        String res = dir;
+        if (res.charAt(res.length() - 1) == '/') {
+            res = res.substring(0, res.length() - 1);
+        }
+        char[] mm = { File.separatorChar };
+        String sp = String.copyValueOf(mm);
+        StringTokenizer st = new StringTokenizer(name, "/");
+        while (st.hasMoreElements()) {
+            res = res.concat(sp).concat((String) st.nextElement());
+        }
+        return res;
+    }
+
+    public class MyProvider extends Provider {
+
+        public MyProvider(String name, String info, String key, String clName) {
+            super(name, 1.0, info);
+            put(key, clName);
+        }
+
+    }
+
+}
\ No newline at end of file

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/SpiEngUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/TestUtils.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/TestUtils.java?rev=424279&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/TestUtils.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/TestUtils.java
Fri Jul 21 05:18:32 2006
@@ -0,0 +1,85 @@
+/*
+ *  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 Vladimir N. Molotkov
+* @version $Revision$
+*/
+
+package org.apache.harmony.auth.tests.support;
+
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * Test utility class
+ * 
+ */
+public class TestUtils {
+    /**
+     * Relative (to the project home) test root path
+     */
+    public static final String TEST_ROOT = System.getProperty("RESOURCE_DIR", "test/common/unit")+
File.separator;
+
+    /**
+     * No need to instantiate
+     */
+    private TestUtils() {
+    }
+
+    /**
+     * Prints byte array <code>data</code> as hex to the
+     * <code>System.out</code> in the customizable form.
+     *
+     * @param perLine how many numbers put on single line
+     * @param prefix custom output number prefix
+     * @param delimiter custom output number delimiter
+     * @param data data to be printed
+     */
+    public static void printAsHex(int perLine,
+                                  String prefix,
+                                  String delimiter,
+                                  byte[] data) {
+        for (int i=0; i<data.length; i++) {
+            String tail = Integer.toHexString(0x000000ff & data[i]);
+            if (tail.length() == 1) {
+                tail = "0" + tail; 
+            }
+            System.out.print(prefix + "0x" + tail + delimiter);
+
+            if (((i+1)%perLine) == 0) {
+                System.out.println("");
+            }
+        }
+        System.out.println("");
+    }
+    
+    /**
+     * Sets system property
+     *
+     * @param key - the name of the system property.
+     * @param value - the value to be set
+     */
+    public static void setSystemProperty(String key, String value) {
+        Properties properties = System.getProperties();
+        if (value == null) {
+            properties.remove(key);
+        } else {
+            properties.setProperty(key, value);
+        }
+        System.setProperties(properties);
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/support/TestUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message