Author: thomas.diesler(a)jboss.com
Date: 2008-04-15 15:14:12 -0400 (Tue, 15 Apr 2008)
New Revision: 6441
Modified:
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
Log:
Add support for archive, resources dir sys properties
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-15
14:16:02 UTC (rev 6440)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2008-04-15
19:14:12 UTC (rev 6441)
@@ -36,7 +36,6 @@
import javax.xml.ws.Service.Mode;
import javax.xml.ws.soap.SOAPBinding;
-import org.jboss.logging.Logger;
import org.jboss.wsf.common.ObjectNameFactory;
/**
@@ -47,14 +46,13 @@
*/
public class JBossWSTestHelper
{
- // provide logging
- private static Logger log = Logger.getLogger(JBossWSTestHelper.class);
-
private static MBeanServerConnection server;
private static String integrationTarget;
private static String implVendor;
private static String implTitle;
private static String implVersion;
+ private static String testArchiveDir;
+ private static String testResourcesDir;
/** Deploy the given archive
*/
@@ -216,33 +214,62 @@
/** Try to discover the URL for the deployment archive */
public URL getArchiveURL(String archive) throws MalformedURLException
{
- URL url = null;
try
{
- url = new URL(archive);
+ return (new URL(archive));
}
catch (MalformedURLException ignore)
{
// ignore
}
- if (url == null)
+ File file = new File(archive);
+ if (file.exists())
+ return file.toURL();
+
+ file = new File(getTestArchiveDir() + "/" + archive);
+ if (file.exists())
+ return file.toURL();
+
+ throw new IllegalArgumentException("Cannot obtain URL for: " + archive);
+ }
+
+ /** Try to discover the URL for the test resource */
+ public URL getResourceURL(String resource) throws MalformedURLException
+ {
+ try
{
- File file = new File(archive);
- if (file.exists())
- url = file.toURL();
+ return (new URL(resource));
}
-
- if (url == null)
+ catch (MalformedURLException ignore)
{
- File file = new File("libs/" + archive);
- if (file.exists())
- url = file.toURL();
+ // ignore
}
- if (url == null)
- throw new IllegalArgumentException("Cannot obtain URL for: " +
archive);
+ File file = new File(resource);
+ if (file.exists())
+ return file.toURL();
- return url;
+ file = new File(getTestResourcesDir() + "/" + resource);
+ if (file.exists())
+ return file.toURL();
+
+ throw new IllegalArgumentException("Cannot obtain URL for: " +
resource);
}
+
+ public static String getTestArchiveDir()
+ {
+ if (testArchiveDir == null)
+ testArchiveDir = System.getProperty("test.archive.directory");
+
+ return testArchiveDir;
+ }
+
+ public static String getTestResourcesDir()
+ {
+ if (testResourcesDir == null)
+ testResourcesDir = System.getProperty("test.resources.directory");
+
+ return testResourcesDir;
+ }
}
Show replies by date