You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/04/20 08:15:07 UTC
svn commit: r395507 -
/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java
Author: smishura
Date: Wed Apr 19 23:15:05 2006
New Revision: 395507
URL: http://svn.apache.org/viewcvs?rev=395507&view=rev
Log:
Fix for loading resource files
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java?rev=395507&r1=395506&r2=395507&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/crypto/src/test/java/tests/api/javax/crypto/CipherTest.java Wed Apr 19 23:15:05 2006
@@ -33,8 +33,6 @@
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.IvParameterSpec;
-import tests.support.resource.Support_Resources;
-
public class CipherTest extends junit.framework.TestCase {
/**
@@ -495,7 +493,7 @@
byte[] input = new byte[256];
String resPath = "hyts_" + "des-ede3-cbc.test" + index
+ ".ciphertext";
- InputStream is = Support_Resources.getStream(resPath);
+ InputStream is = getStream(resPath);
int bytesRead = is.read(input, 0, 256);
while (bytesRead > 0) {
@@ -545,7 +543,7 @@
byte[] input = new byte[256];
String resPath = "hyts_" + "des-ede3-cbc.test" + index
+ ".plaintext";
- InputStream is = Support_Resources.getStream(resPath);
+ InputStream is = getStream(resPath);
int bytesRead = is.read(input, 0, 256);
while (bytesRead > 0) {
@@ -572,7 +570,7 @@
private byte[] loadBytes(String resPath) {
try {
- InputStream is = Support_Resources.getStream(resPath);
+ InputStream is = getStream(resPath);
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buff = new byte[1024];
@@ -586,6 +584,15 @@
return null;
}
}
+
+ public InputStream getStream(String name) {
+
+ InputStream is = ClassLoader.getSystemClassLoader()
+ .getResourceAsStream(name);
+
+ assertNotNull("Failed to load resource: " + name, is);
+ return is;
+ }
private boolean bytesArraysAreEqual(byte[] arr1, byte[] arr2) {
if (arr1.length != arr2.length) {