Author: thomas.diesler(a)jboss.com
Date: 2008-04-23 02:25:32 -0400 (Wed, 23 Apr 2008)
New Revision: 6622
Modified:
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java
common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
Log:
Add getArchive/Resource to TestSetup
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-22 19:38:25 UTC
(rev 6621)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java 2008-04-23 06:25:32 UTC
(rev 6622)
@@ -119,6 +119,16 @@
return delegate.getServerHost();
}
+ public File getArchiveFile(String archive)
+ {
+ return delegate.getArchiveFile(archive);
+ }
+
+ public URL getArchiveURL(String archive) throws MalformedURLException
+ {
+ return delegate.getArchiveFile(archive).toURL();
+ }
+
public File getResourceFile(String resource)
{
return delegate.getResourceFile(resource);
@@ -126,8 +136,7 @@
public URL getResourceURL(String resource) throws MalformedURLException
{
- File file = delegate.getResourceFile(resource);
- return (file != null ? file.toURL() : null);
+ return delegate.getResourceFile(resource).toURL();
}
/** 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-22
19:38:25 UTC (rev 6621)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestHelper.java 2008-04-23
06:25:32 UTC (rev 6622)
@@ -22,7 +22,6 @@
package org.jboss.wsf.test;
import java.io.File;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.Hashtable;
@@ -50,7 +49,7 @@
private static final String SYSPROP_JBOSS_BIND_ADDRESS =
"jboss.bind.address";
private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY =
"test.archive.directory";
private static final String SYSPROP_TEST_RESOURCES_DIRECTORY =
"test.resources.directory";
-
+
private static MBeanServerConnection server;
private static String integrationTarget;
private static String implVendor;
@@ -63,7 +62,7 @@
*/
public void deploy(String archive) throws Exception
{
- URL url = getArchiveURL(archive);
+ URL url = getArchiveFile(archive).toURL();
getDeployer().deploy(url);
}
@@ -71,7 +70,7 @@
*/
public void undeploy(String archive) throws Exception
{
- URL url = getArchiveURL(archive);
+ URL url = getArchiveFile(archive).toURL();
getDeployer().undeploy(url);
}
@@ -203,8 +202,7 @@
jbossVersion = "jboss42";
else if (jbossVersion.startsWith("4.0"))
jbossVersion = "jboss40";
- else
- throw new RuntimeException("Unsupported jboss version: " +
jbossVersion);
+ else throw new RuntimeException("Unsupported jboss version: " +
jbossVersion);
}
catch (Throwable th)
{
@@ -218,24 +216,15 @@
}
/** Try to discover the URL for the deployment archive */
- public URL getArchiveURL(String archive) throws MalformedURLException
+ public File getArchiveFile(String archive)
{
- try
- {
- return (new URL(archive));
- }
- catch (MalformedURLException ignore)
- {
- // ignore
- }
-
File file = new File(archive);
if (file.exists())
- return file.toURL();
+ return file;
file = new File(getTestArchiveDir() + "/" + archive);
if (file.exists())
- return file.toURL();
+ return file;
String notSet = (getTestArchiveDir() == null ? " System property '" +
SYSPROP_TEST_ARCHIVE_DIRECTORY + "' not set." : "");
throw new IllegalArgumentException("Cannot obtain '" +
getTestArchiveDir() + "/" + archive + "'." + notSet);
Modified: common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
===================================================================
--- common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java 2008-04-22
19:38:25 UTC (rev 6621)
+++ common/trunk/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java 2008-04-23
06:25:32 UTC (rev 6622)
@@ -21,6 +21,8 @@
*/
package org.jboss.wsf.test;
+import java.io.File;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -30,12 +32,12 @@
import javax.management.MBeanServerConnection;
import javax.naming.NamingException;
-import org.jboss.logging.Logger;
-
import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.jboss.logging.Logger;
+
/**
* A test setup that deploys/undeploys archives
*
@@ -46,7 +48,7 @@
{
// provide logging
private static Logger log = Logger.getLogger(JBossWSTestSetup.class);
-
+
private JBossWSTestHelper delegate = new JBossWSTestHelper();
private String[] archives = new String[0];
@@ -67,6 +69,26 @@
super(test);
}
+ public File getArchiveFile(String archive)
+ {
+ return delegate.getArchiveFile(archive);
+ }
+
+ public URL getArchiveURL(String archive) throws MalformedURLException
+ {
+ return delegate.getArchiveFile(archive).toURL();
+ }
+
+ public File getResourceFile(String resource)
+ {
+ return delegate.getResourceFile(resource);
+ }
+
+ public URL getResourceURL(String resource) throws MalformedURLException
+ {
+ return delegate.getResourceFile(resource).toURL();
+ }
+
private void getArchiveArray(String archiveList)
{
if (archiveList != null)
@@ -84,7 +106,7 @@
// verify integration target
String integrationTarget = delegate.getIntegrationTarget();
log.debug("Integration target: " + integrationTarget);
-
+
List clientJars = new ArrayList();
for (int i = 0; i < archives.length; i++)
{
@@ -101,7 +123,7 @@
if (archive.endsWith("-client.jar"))
{
- URL archiveURL = delegate.getArchiveURL(archive);
+ URL archiveURL = getArchiveURL(archive);
clientJars.add(archiveURL);
}
}
@@ -128,7 +150,7 @@
delegate.undeploy(archive);
}
}
-
+
public MBeanServerConnection getServer() throws NamingException
{
return delegate.getServer();
Show replies by date