harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r463178 - in /incubator/harmony/enhanced/classlib/trunk/modules/security: ./ src/test/impl/java/org/apache/harmony/security/tests/java/security/ src/test/resources/java/security/ src/test/support/common/java/org/apache/harmony/security/test...
Date Thu, 12 Oct 2006 09:55:21 GMT
Author: smishura
Date: Thu Oct 12 02:55:17 2006
New Revision: 463178

URL: http://svn.apache.org/viewvc?view=rev&rev=463178
Log:
Remove RESOURCE_DIR env.var.

Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/java/security/KSEmpty.dat
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/build.xml
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SpiEngUtils.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/TestUtils.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/build.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/build.xml?view=diff&rev=463178&r1=463177&r2=463178
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/build.xml Thu Oct 12 02:55:17
2006
@@ -248,11 +248,7 @@
                     <pathelement path="${tests.resources.dir}"/>
                     <pathelement path="${hy.hdk}/build/test/support.jar" />
                 </classpath>
-                <!-- Required for running the unit tests               -->
-                <!-- Note: will be deleted after improving             -->
-                <!-- support class: all resource                       -->
-                <!-- files will be placed on the classpath             -->
-                <jvmarg value="-DRESOURCE_DIR=${tests.resources.dir}"/>
+
                 <batchtest todir="${hy.tests.reports}" haltonfailure="no" unless="test.case">
                     <fileset dir="${hy.security.src.test}/api/java">
                         <include name="**/*Test.java"/>
@@ -269,12 +265,6 @@
 
         <run-tests description="api.injected tests">
             <junit-elements>
-                <!-- Required for running the serialization unit tests -->
-                <!-- Note: will be deleted after improving             -->
-                <!-- SerializationTest support class: all resource     -->
-                <!-- files will be placed on the classpath             -->
-                <jvmarg value="-DRESOURCE_DIR=${tests.resources.dir}"/>
-
                 <!-- to pick up junit.jar               -->
                 <jvmarg value="-Xbootclasspath/a:${tests.hdk.dir}/${hy.security.packaging.jarname}_tests_api_in.jar${path.separator}../../${junit.jar}${path.separator}../../build/tests${path.separator}${hy.hdk}/build/test/support.jar${path.separator}${tests.hdk.dir}/${hy.security.packaging.jarname}_tests_support.jar"/>
 
@@ -294,12 +284,6 @@
     <target name="run-tests-impl" unless="test.noimpl">
         <run-tests description="impl tests">
             <junit-elements>
-                <!-- Required for running the serialization unit tests -->
-                <!-- Note: will be deleted after improving             -->
-                <!-- SerializationTest support class: all resource     -->
-                <!-- files will be placed on the classpath             -->
-                <jvmarg value="-DRESOURCE_DIR=${tests.resources.dir}"/>
-
                 <classpath>
                     <pathelement path="${tests.hdk.dir}/${hy.security.packaging.jarname}_tests_impl.jar"/>
                     <pathelement path="${tests.hdk.dir}/${hy.security.packaging.jarname}_tests_support.jar"/>
@@ -318,12 +302,6 @@
 
         <run-tests description="impl injected tests">
             <junit-elements>
-                <!-- Required for running the serialization unit tests -->
-                <!-- Note: will be deleted after improving             -->
-                <!-- SerializationTest support class: all resource     -->
-                <!-- files will be placed on the classpath             -->
-                <jvmarg value="-DRESOURCE_DIR=${tests.resources.dir}"/>
-
                 <!-- to pick up junit.jar               -->
                 <jvmarg value="-Xbootclasspath/a:${tests.hdk.dir}/${hy.security.packaging.jarname}_tests_impl_in.jar${path.separator}../../${junit.jar}${path.separator}${hy.hdk}/build/test/support.jar${path.separator}${tests.hdk.dir}/${hy.security.packaging.jarname}_tests_support.jar"/>
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java?view=diff&rev=463178&r1=463177&r2=463178
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KSBuilder_ImplTest.java
Thu Oct 12 02:55:17 2006
@@ -40,19 +40,16 @@
 import java.security.spec.InvalidKeySpecException;
 import java.util.Enumeration;
 
+import junit.framework.TestCase;
+
 import org.apache.harmony.security.tests.support.KeyStoreTestSupport;
 import org.apache.harmony.security.tests.support.SpiEngUtils;
 import org.apache.harmony.security.tests.support.TestKeyPair;
-import org.apache.harmony.security.tests.support.TestUtils;
 import org.apache.harmony.security.tests.support.tmpCallbackHandler;
 
-import junit.framework.TestCase;
-
 /**
  * Tests for <code>KeyStore.Builder</code> class
- * 
  */
-
 public class KSBuilder_ImplTest extends TestCase {
 
     private static char[] pass =  {'s','t','o','r','e','p','w','d'};
@@ -69,65 +66,32 @@
 
     private static Provider defaultProvider = null;
     
-    private static String fileEmpty = "java/security/KSEmpty.dat";
-    private static String fileName = "java/security/KStmp.dat";
-    private static String dirName = "java/security";
-    
     static {
         defaultProvider = SpiEngUtils.isSupport(
                 KeyStoreTestSupport.defaultType, KeyStoreTestSupport.srvKeyStore);
         JKSSupported = (defaultProvider != null);
-        fileEmpty = SpiEngUtils.getFileName(TestUtils.TEST_ROOT,
-                fileEmpty);
-        fileName = SpiEngUtils.getFileName(TestUtils.TEST_ROOT,
-                fileName);
-        dirName = SpiEngUtils.getFileName(TestUtils.TEST_ROOT, dirName);        
     }
 
-    private boolean isCreateKS;
-    // Creates empty KeyStoreand loads it to file    
-    private void createKS()throws Exception {
-        isCreateKS = false;
+    // Creates empty KeyStore and loads it to file    
+    private File createKS() throws Exception {
         FileOutputStream fos = null;
+        File ff = File.createTempFile("KSBuilder_ImplTest", "keystore");
+        ff.deleteOnExit();
         try {
-            File ff = new File(fileName);
-            if (ff.exists()) {
-                ff.delete();
-                if (!ff.createNewFile()) {
-                    isCreateKS = false;
-                    return;
-                }                
-            }            
+
             KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
             fos = new FileOutputStream(ff);
             ks.load(null, null);
             ks.store(fos, pass);
-            isCreateKS = true;
         } finally {
             if (fos != null) {
                 try {
                     fos.close();
                 } catch (IOException e) {
-                    isCreateKS = false;
                 }
             }
         }
-    }
-
-    private void deleteKS() {
-        File ff = new File(fileName);
-        if (ff.exists()) {
-            ff.delete();
-            isCreateKS = false;
-        }            
-    }
-    
-    /*
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        deleteKS();
+        return ff;
     }
 
     /*
@@ -273,8 +237,8 @@
             fail(defaultType + " type is not supported");
             return;
         }
-        File fl = new File(fileEmpty);
-        assertTrue("There is no file: ".concat(fileEmpty), fl.exists());
+        File fl = File.createTempFile("KSBuilder_ImplTest", "keystore");
+        fl.deleteOnExit();
         KeyStore.Builder ksB;
         KeyStore.Builder ksB1;
         KeyStore ks = null;
@@ -308,13 +272,15 @@
         }
         try {
             KeyStore.Builder.newInstance(defaultType, defaultProvider,
-                    new File(fileName.concat("zzz")), protPass);
+                    new File(fl.getAbsolutePath().concat("should_absent")),
+                    protPass);
             fail("IllegalArgumentException must be thrown when file does not exist");
         } catch (IllegalArgumentException e) {
         }
         try {
+            // 'file' param points to directory
             KeyStore.Builder.newInstance(defaultType, defaultProvider,
-                    new File(dirName), protPass);
+                    fl.getParentFile(), protPass);
             fail("IllegalArgumentException must be thrown when file does not exist");
         } catch (IllegalArgumentException e) {
         }
@@ -325,9 +291,8 @@
             fail("KeyStoreException must be throw because file is empty");
         } catch (KeyStoreException e) {
         }
-        createKS();
-        assertTrue("Not create KS", isCreateKS);
-        fl = new File(fileName);
+
+        fl = createKS();
         KeyStore.ProtectionParameter [] pp = { myPP, protPass, callbackHand };
         for (int i = 0; i < pp.length; i++) {
             if (i == 0) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SpiEngUtils.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SpiEngUtils.java?view=diff&rev=463178&r1=463177&r2=463178
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SpiEngUtils.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/SpiEngUtils.java
Thu Oct 12 02:55:17 2006
@@ -59,20 +59,6 @@
         }
     }
 
-    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) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/TestUtils.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/TestUtils.java?view=diff&rev=463178&r1=463177&r2=463178
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/TestUtils.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/support/common/java/org/apache/harmony/security/tests/support/TestUtils.java
Thu Oct 12 02:55:17 2006
@@ -22,18 +22,12 @@
 
 package org.apache.harmony.security.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



Mime
View raw message