Author: thomas.diesler(a)jboss.com
Date: 2008-04-19 16:28:52 -0400 (Sat, 19 Apr 2008)
New Revision: 6551
Modified:
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
Log:
Add getResourceFile()
Modified: common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java 2008-04-19 20:17:09 UTC
(rev 6550)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java 2008-04-19 20:28:52 UTC
(rev 6551)
@@ -21,6 +21,7 @@
*/
package org.jboss.wsf.test;
+import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -118,9 +119,15 @@
return delegate.getServerHost();
}
+ public File getResourceFile(String resource)
+ {
+ return delegate.getResourceFile(resource);
+ }
+
public URL getResourceURL(String resource) throws MalformedURLException
{
- return delegate.getResourceURL(resource);
+ File file = delegate.getResourceFile(resource);
+ return (file != null ? file.toURL() : null);
}
/** Get the client's env context for a given name.
Modified: common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2008-04-19
20:17:09 UTC (rev 6550)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2008-04-19
20:28:52 UTC (rev 6551)
@@ -242,24 +242,15 @@
}
/** Try to discover the URL for the test resource */
- public URL getResourceURL(String resource) throws MalformedURLException
+ public File getResourceFile(String resource)
{
- try
- {
- return (new URL(resource));
- }
- catch (MalformedURLException ignore)
- {
- // ignore
- }
-
File file = new File(resource);
if (file.exists())
- return file.toURL();
+ return file;
file = new File(getTestResourcesDir() + "/" + resource);
if (file.exists())
- return file.toURL();
+ return file;
String notSet = (getTestResourcesDir() == null ? " System property '"
+ SYSPROP_TEST_RESOURCES_DIRECTORY + "' not set." : "");
throw new IllegalArgumentException("Cannot obtain '" +
getTestResourcesDir() + "/" + resource + "'." + notSet);
Show replies by date