User: user57
Date: 01/07/05 19:29:21
Modified: src/main/org/jboss/test/util Deploy.java
Log:
o Changed all tests which deploy one or more jars to undeploy after
testing.
Revision Changes Path
1.4 +47 -27 jbosstest/src/main/org/jboss/test/util/Deploy.java
Index: Deploy.java
===================================================================
RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/util/Deploy.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Deploy.java 2001/07/04 10:26:08 1.3
+++ Deploy.java 2001/07/06 02:29:21 1.4
@@ -7,62 +7,82 @@
package org.jboss.test.util;
+import java.util.Map;
+import java.util.Hashtable;
+
import junit.framework.TestCase;
/**
- * A utility class for deploying the a named ejb jar.
+ * A utility class for deploying jar files.
*
* @author [EMAIL PROTECTED]
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class Deploy
{
- //
- // Is each CL expected to only manage one deployed application archive?
- //
- public static boolean deployed;
+ /** A map of jarname -> Boolean deployment status. */
+ private static Map deployed = new Hashtable();
/**
- * Deploy the security ejb jar one time.
+ * Check if a jar is deployed.
+ */
+ private static boolean isDeployed(final String jarName) {
+ Boolean bool = (Boolean)deployed.get(jarName);
+ if (bool == null)
+ return false;
+ return bool.booleanValue();
+ }
+
+ /**
+ * Mark a jar as deployed or undeployed.
*/
- public static void deploy(String jarName) throws Exception
+ private static void setDeployed(final String jarName, final boolean flag)
{
- String noDeploy = System.getProperty("no-deploy");
- if (noDeploy != null || deployed) {
- return;
- }
+ deployed.put(jarName, new Boolean(flag));
+ }
+ /** Return the deployment directory to use. */
+ private static String getDeployFilename(final String filename) {
String deployDir = System.getProperty("jbosstest.deploy.dir");
if (deployDir == null) {
deployDir = "../deploy";
}
+ return deployDir + "/" + filename;
+ }
+
+ /**
+ * Deploy the security ejb jar one time.
+ */
+ public static void deploy(final String jarName) throws Exception
+ {
+ String noDeploy = System.getProperty("no-deploy");
+ if (noDeploy != null || isDeployed(jarName)) {
+ return;
+ }
- System.out.println("Deploying: "+ jarName);
- new org.jboss.jmx.client.Deployer().deploy(deployDir+'/' + jarName);
- deployed = true;
- System.out.println("Deployed: "+ jarName);
+ String filename = getDeployFilename(jarName);
+ System.out.print("Deploying: "+ jarName + "...");
+ new org.jboss.jmx.client.Deployer().deploy(filename);
+ setDeployed(jarName, true);
+ System.out.println("Done");
}
/**
* Undeploy an archive from a the remote JBoss server.
*/
- public static void undeploy(String jarName) throws Exception
+ public static void undeploy(final String jarName) throws Exception
{
String noUndeploy = System.getProperty("no-undeploy");
- if (noUndeploy != null || !deployed) {
+ if (noUndeploy != null || !isDeployed(jarName)) {
return;
}
-
- String deployDir = System.getProperty("jbosstest.deploy.dir");
- if (deployDir == null) {
- deployDir = "../deploy";
- }
- System.out.println("Undeploying: "+ jarName);
- new org.jboss.jmx.client.Deployer().undeploy(deployDir+'/' + jarName);
- deployed = false;
- System.out.println("Undeployed: "+ jarName);
+ String filename = getDeployFilename(jarName);
+ System.out.print("Undeploying: "+ jarName + "...");
+ new org.jboss.jmx.client.Deployer().undeploy(filename);
+ setDeployed(jarName, false);
+ System.out.println("Done");
}
/**
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development