diff options
Diffstat (limited to 'support')
-rw-r--r-- | support/src/test/java/tests/support/Support_Configuration.java | 10 | ||||
-rw-r--r-- | support/src/test/java/tests/support/resource/Support_Resources.java | 20 |
2 files changed, 17 insertions, 13 deletions
diff --git a/support/src/test/java/tests/support/Support_Configuration.java b/support/src/test/java/tests/support/Support_Configuration.java index fed0bc8..9cb617d 100644 --- a/support/src/test/java/tests/support/Support_Configuration.java +++ b/support/src/test/java/tests/support/Support_Configuration.java @@ -91,18 +91,8 @@ public class Support_Configuration { // than one addresses returned for this host name as needed by a test // END android-changed - public static String testURL = "harmony.apache.org"; - - public static String hTTPURLwExpiration = "http://phpwiki.sourceforge.net/phpwiki-1.2/"; - public static String hTTPURLwLastModified = "http://www.php.net/manual/en/function.explode.php"; - public static String hTTPURLyahoo = "http://news.yahoo.com/"; - - public static String hTTPURLgoogle = "http://www.google.com/ie"; - - public static String testContentEncoding = "http://www.amazon.com/"; - public static int SpecialInetTestAddressNumber = 4; /** diff --git a/support/src/test/java/tests/support/resource/Support_Resources.java b/support/src/test/java/tests/support/resource/Support_Resources.java index 80a53fb..ddcb881 100644 --- a/support/src/test/java/tests/support/resource/Support_Resources.java +++ b/support/src/test/java/tests/support/resource/Support_Resources.java @@ -18,6 +18,7 @@ package tests.support.resource; import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; @@ -34,12 +35,25 @@ public class Support_Resources { public static final String RESOURCE_PACKAGE_NAME = "tests.resources"; public static InputStream getStream(String name) { + // If we have the resources packaged up in our jar file, get them that way. String path = RESOURCE_PACKAGE + name; InputStream result = Support_Resources.class.getResourceAsStream(path); - if (result == null) { - throw new IllegalArgumentException("No such resource: " + path); + if (result != null) { + return result; } - return result; + // Otherwise, if we're in an Android build tree, get the files directly. + String ANDROID_BUILD_TOP = System.getenv("ANDROID_BUILD_TOP"); + if (ANDROID_BUILD_TOP != null) { + File resource = new File(ANDROID_BUILD_TOP + "/libcore/support/src/test/java" + path); + if (resource.exists()) { + try { + return new FileInputStream(resource); + } catch (IOException ex) { + throw new IllegalArgumentException("Couldn't open: " + resource, ex); + } + } + } + throw new IllegalArgumentException("No such resource: " + path); } public static String getURL(String name) { |