harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r452301 - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src/test: api/java/org/apache/harmony/security/tests/java/security/cert/ api/java/org/apache/harmony/security/tests/java/security/cert/serialization/ resources/java/se...
Date Tue, 03 Oct 2006 02:58:23 GMT
Author: smishura
Date: Mon Oct  2 19:58:22 2006
New Revision: 452301

URL: http://svn.apache.org/viewvc?view=rev&rev=452301
Log:
Load resources for testing from classpath

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/java/security/cert/CertPath.PkiPath
      - copied unchanged from r451931, incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/java/security/cert/serialization/CertPath.PkiPath
Removed:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/java/security/cert/serialization/CertPath.PkiPath
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory3Test.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertPathTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory3Test.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/cert/CertificateFactory3Test.java?view=diff&rev=452301&r1=452300&r2=452301
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory3Test.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory3Test.java
Mon Oct  2 19:58:22 2006
@@ -23,8 +23,7 @@
 package org.apache.harmony.security.tests.java.security.cert;
 
 import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
+import java.io.InputStream;
 import java.security.Provider;
 import java.security.cert.CertPath;
 import java.security.cert.Certificate;
@@ -39,6 +38,8 @@
 import org.apache.harmony.security.tests.support.SpiEngUtils;
 import org.apache.harmony.security.tests.support.cert.TestUtils;
 
+import tests.support.resource.Support_Resources;
+
 /**
  * Tests for <code>CertificateFactory</code> class methods
  */
@@ -51,7 +52,7 @@
 
     private static String defaultType = CertificateFactory1Test.defaultType;
 
-    public static String fileCertPathPki = "java/security/cert/serialization/CertPath.PkiPath";
+    public static String fileCertPathPki = "java/security/cert/CertPath.PkiPath";
 
     private static boolean X509Support = false;
 
@@ -64,12 +65,6 @@
         defaultProviderName = X509Support ? defaultProvider.getName() : null;
 
         NotSupportMsg = defaultType.concat(" is not supported");
-
-        fileCertPathPki = SpiEngUtils.getFileName(
-                org.apache.harmony.security.tests.support.TestUtils.TEST_ROOT,
-                fileCertPathPki);
-        fileCertPathPki = fileCertPathPki.replace('/', File.separatorChar);
-
     }
 
     private static CertificateFactory[] initCertFs() throws Exception {
@@ -156,7 +151,8 @@
         assertNotNull("CertificateFactory objects were not created", certFs);
         for (int i = 0; i < certFs.length; i++) {
             CertPath certPath = null;
-            FileInputStream fis = new FileInputStream(fileCertPathPki);
+            InputStream fis = Support_Resources
+                    .getResourceStream(fileCertPathPki);
             certPath = certFs[i].generateCertPath(fis, "PkiPath");
             fis.close();
             assertEquals(defaultType, certPath.getType());
@@ -183,7 +179,8 @@
                     .next());
 
             CertPath certPath = null;
-            FileInputStream fis = new FileInputStream(fileCertPathPki);
+            InputStream fis = Support_Resources
+                    .getResourceStream(fileCertPathPki);
             certPath = certFs[i].generateCertPath(fis);
             fis.close();
             assertEquals(defaultType, certPath.getType());

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertPathTest.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/cert/serialization/CertPathTest.java?view=diff&rev=452301&r1=452300&r2=452301
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertPathTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/serialization/CertPathTest.java
Mon Oct  2 19:58:22 2006
@@ -22,7 +22,6 @@
 
 package org.apache.harmony.security.tests.java.security.cert.serialization;
 
-import java.io.FileInputStream;
 import java.io.ObjectStreamException;
 import java.security.cert.CertPath;
 import java.security.cert.CertificateFactory;
@@ -32,6 +31,8 @@
 import org.apache.harmony.security.tests.support.cert.MyCertPath;
 import org.apache.harmony.testframework.serialization.SerializationTest;
 
+import tests.support.resource.Support_Resources;
+
 /**
  * Tests for <code>CertPath</code> serialization
  */
@@ -40,16 +41,8 @@
     //Certificate/CertPath type to be created during testing
     private static final String certType = "X.509";
 
-    // CertPath encoding name, defines input file names used during testing
-    private static final String certPathEncoding = "PkiPath";
-
-    /**
-     * Input file name used for <code>CertPath</code> instance generation
-     */
-    private static final String certPathFileName =
-        org.apache.harmony.security.tests.support.TestUtils.TEST_ROOT +
-        "java/security/cert/serialization/CertPath." +
-        certPathEncoding; //TODO move me to other folder
+    //Input file name used for <code>CertPath</code> instance generation
+    private static final String certPathFileName = "java/security/cert/CertPath.PkiPath";
 
     //
     // Tests
@@ -62,8 +55,8 @@
 
         CertificateFactory cf = CertificateFactory.getInstance(certType);
 
-        CertPath certPath = cf.generateCertPath(new FileInputStream(
-                certPathFileName));
+        CertPath certPath = cf.generateCertPath(Support_Resources
+                .getResourceStream(certPathFileName));
 
         SerializationTest.verifySelf(certPath);
     }
@@ -75,8 +68,8 @@
 
         CertificateFactory cf = CertificateFactory.getInstance(certType);
 
-        CertPath certPath = cf.generateCertPath(new FileInputStream(
-                certPathFileName));
+        CertPath certPath = cf.generateCertPath(Support_Resources
+                .getResourceStream(certPathFileName));
 
         SerializationTest.verifyGolden(this, certPath);
     }



Mime
View raw message