[jboss-cvs] JBossAS SVN: r112200 - in branches/JBPAPP_5_1/testsuite: src/main/org/jboss/test/deployment and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Sep 3 21:41:17 EDT 2011
Author: bmaxwell
Date: 2011-09-03 21:41:16 -0400 (Sat, 03 Sep 2011)
New Revision: 112200
Modified:
branches/JBPAPP_5_1/testsuite/imports/sections/jmx.xml
branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/deployment/JBPAPP6716UnitTestCase.java
Log:
[JBPAPP-6716] added exploded deployment tests
Modified: branches/JBPAPP_5_1/testsuite/imports/sections/jmx.xml
===================================================================
--- branches/JBPAPP_5_1/testsuite/imports/sections/jmx.xml 2011-09-04 00:23:37 UTC (rev 112199)
+++ branches/JBPAPP_5_1/testsuite/imports/sections/jmx.xml 2011-09-04 01:41:16 UTC (rev 112200)
@@ -687,6 +687,8 @@
<include name="*l"/>
</fileset>
</jar>
+ <!-- exploded dummy war -->
+ <unzip src="${build.lib}/dummy.war" dest="${build.lib}/dummy-exploded.war"/>
<!-- invoker adaptor test ear -->
<jar destfile="${build.lib}/invoker-adaptor-test.ear">
Modified: branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/deployment/JBPAPP6716UnitTestCase.java
===================================================================
--- branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/deployment/JBPAPP6716UnitTestCase.java 2011-09-04 00:23:37 UTC (rev 112199)
+++ branches/JBPAPP_5_1/testsuite/src/main/org/jboss/test/deployment/JBPAPP6716UnitTestCase.java 2011-09-04 01:41:16 UTC (rev 112200)
@@ -53,6 +53,7 @@
private MainDeployerMBean deployer;
private ServerConfigImplMBean serverInfo;
private URL dummyUrl;
+ private URL dummyExplodedUrl;
private URL dummyIndexUrl;
private String hostname;
private String JBOSS_HOME;
@@ -72,6 +73,7 @@
setSecurity(new SimplePrincipal("admin"), "admin");
dummyUrl = getDeployURL("dummy.war");
+ dummyExplodedUrl = getDeployURL("dummy-exploded.war");
MBeanServerConnection server = getServer();
@@ -99,78 +101,81 @@
//***** Deploy Tests *****//
- /* this tests these methods:
+ /* this tests these methods with exploded and non-exploded deploymenets
* deploy(URL)
* deploy(String)
* undeploy(URL)
* undeploy(String)
* redeploy(URL)
* redeploy(String)
- * isDeployed(URL)
- *
+ * isDeployed(URL)
*/
public void testDeployUnDeployReDeployIsDeployed() throws Exception
- {
- String dummyUrlString = dummyUrl.toExternalForm();
-
+ {
log.info("+++ testDeployUnDeployReDeployIsDeployed");
-
- try
- {
- //Deploy & undeploy with URL
- deployer.deploy(dummyUrl);
- assertTrue("Failed to deploy URL: " + dummyUrl, isDeployed(dummyUrl, false));
- deployer.undeploy(dummyUrl);
- assertTrue("Failed to undeploy URL: " + dummyUrl, !isDeployed(dummyUrl, false));
-
- //Deploy & undeploy with String
- deployer.deploy(dummyUrlString);
- assertTrue("Failed to deploy String: " + dummyUrlString, isDeployed(dummyUrl, true));
-
- deployer.undeploy(dummyUrlString);
- assertTrue("Failed to undeploy String: " + dummyUrlString, !isDeployed(dummyUrl, true));
-
- //Redploy
- deployer.deploy(dummyUrl);
- assertTrue("Failed to deploy URL: " + dummyUrl, isDeployed(dummyUrl, false));
-
- //With URL
- deployer.redeploy(dummyUrl);
- assertTrue("Failed to redeploy URL: " + dummyUrl, isDeployed(dummyUrl, false));
-
- //With String
- deployer.redeploy(dummyUrlString);
- assertTrue("Failed to redeploy String: " + dummyUrlString, isDeployed(dummyUrl, true));
- }
- catch (Exception e)
+ for(URL testURL : new URL[] {dummyUrl, dummyExplodedUrl } )
{
- e.printStackTrace();
- super.fail("Caught exception, message: " + e.getMessage());
- }
- finally
- {
+ String testURLString = testURL.toExternalForm();
try
{
- //make sure it's undeployed before moving on
- deployer.undeploy(dummyUrl);
+ //Deploy & undeploy with URL
+ deployer.deploy(testURL);
+ assertTrue("Failed to deploy URL: " + testURL, deployer.isDeployed(testURL));
+
+ deployer.undeploy(testURL);
+ assertTrue("Failed to undeploy URL: " + testURL, !deployer.isDeployed(testURL));
+
+ //Deploy & undeploy with String
+ deployer.deploy(testURLString);
+ assertTrue("Failed to deploy String: " + testURLString, deployer.isDeployed(testURLString));
+
+ deployer.undeploy(testURLString);
+ assertTrue("Failed to undeploy String: " + testURLString, !deployer.isDeployed(testURLString));
+
+ //Redploy
+ deployer.deploy(testURL);
+ assertTrue("Failed to deploy URL: " + testURL, deployer.isDeployed(testURL));
+
+ //With URL
+ deployer.redeploy(testURL);
+ assertTrue("Failed to redeploy URL: " + testURL, deployer.isDeployed(testURL));
+
+ //With String
+ deployer.redeploy(testURLString);
+ assertTrue("Failed to redeploy String: " + testURLString, deployer.isDeployed(testURLString));
}
- catch(Exception ignore)
+ catch (Exception e)
{
- //ignore
+ e.printStackTrace();
+ super.fail("Caught exception, message: " + e.getMessage());
}
+ finally
+ {
+ try
+ {
+ //make sure it's undeployed before moving on
+ deployer.undeploy(testURL);
+ }
+ catch(Exception ignore)
+ {
+ //ignore
+ }
+ }
}
}
- // run tests using $JBOSS_HOME/bin/twiddle.sh
+ // run tests using $JBOSS_HOME/bin/twiddle.sh on exploded and non-exploded deployments with path and url strings
public void testTwiddle()
{
// $JBOSS_HOME/bin/twiddle.sh -u admin -p admin -s hostname invoke jboss.system:service=MainDeployer listDeployedAsString
String invoke = "-u admin -p admin -s " + hostname + " invoke jboss.system:service=MainDeployer ";
String[] deployments = new String[]
- {
- dummyUrl.toExternalForm(),
- dummyUrl.getPath()
+ {
+ dummyUrl.toExternalForm(),
+ dummyUrl.getPath(),
+ dummyExplodedUrl.toExternalForm(),
+ dummyExplodedUrl.getPath()
};
try
{
@@ -219,6 +224,9 @@
}
}
+ // This tests is to test when deployements are copied into the deploy directory
+ // undeploy on deployments int the deploy directory should not delete the deployement from deploy, it should just stop/undeploy the deployment
+ // calling deploy on deployment in the deploy dir should start/deploy it
public void testDeploymentsInDeployDirectory()
{
File dummyWarFile = new File(JBOSS_DEPLOY, "dummy.war");
@@ -277,48 +285,55 @@
public void testListDeployedAsString() throws Exception
{
log.info("+++ testListDeployedAsString");
-
- try
- {
- deployer.deploy(dummyUrl);
- log.info("calling assert: " + dummyUrl.toExternalForm());
- log.info(deployer.listDeployedAsString());
- assertTrue("listDeployedAsString does not contain: " + dummyUrl, deployer.listDeployedAsString().contains(dummyUrl.toExternalForm()));
+
+ for(URL testURL : new URL[] {dummyUrl, dummyExplodedUrl } )
+ {
+ try
+ {
+ deployer.deploy(testURL);
+ log.info("calling assert: " + testURL.toExternalForm());
+ log.info(deployer.listDeployedAsString());
+ assertTrue("listDeployedAsString does not contain: " + testURL, deployer.listDeployedAsString().contains(testURL.toExternalForm()));
+ }
+ catch (Exception e)
+ {
+ super.fail("Caught exception, message: " + e.getMessage());
+ }
+ finally
+ {
+ cleanUp();
+ }
}
- catch (Exception e)
- {
- super.fail("Caught exception, message: " + e.getMessage());
- }
- finally
- {
- cleanUp();
- }
}
// this tests methods: listDeployed, listDeployedModules
public void testListDeployedListDeployedModules() throws Exception
{
log.info("+++ testListDeployedListDeployedModules");
- try
- {
- // deploy the dummy.war & make sure it is deployed
- deployer.deploy(dummyUrl);
- assertTrue("listDeployedAsString does not contain: " + dummyUrl, deployer.listDeployedAsString().contains(dummyUrl.toExternalForm()));
-
- if(collectionContains(deployer.listDeployed(), dummyUrl.toExternalForm()) == false)
- fail("listDeployed does not contain: " + dummyUrl);
-
- if(collectionContains(deployer.listDeployedModules(), dummyUrl.toExternalForm()) == false)
- fail("listDeployedModules does not contain: " + dummyUrl);
+
+ for(URL testURL : new URL[] {dummyUrl, dummyExplodedUrl } )
+ {
+ try
+ {
+ // deploy the dummy.war & make sure it is deployed
+ deployer.deploy(testURL);
+ assertTrue("listDeployedAsString does not contain: " + testURL, deployer.listDeployedAsString().contains(testURL.toExternalForm()));
+
+ if(collectionContains(deployer.listDeployed(), testURL.toExternalForm()) == false)
+ fail("listDeployed does not contain: " + testURL);
+
+ if(collectionContains(deployer.listDeployedModules(), testURL.toExternalForm()) == false)
+ fail("listDeployedModules does not contain: " + testURL);
+ }
+ catch (Exception e)
+ {
+ super.fail("Caught exception, message: " + e.getMessage());
+ }
+ finally
+ {
+ cleanUp();
+ }
}
- catch (Exception e)
- {
- super.fail("Caught exception, message: " + e.getMessage());
- }
- finally
- {
- cleanUp();
- }
}
// tests isDeployed, undeploy, deploy, redeploy with a URL/String does not exist
@@ -401,14 +416,21 @@
private void cleanUp()
{
- try
+ URL[] testURLs = new URL[] {
+ dummyUrl,
+ dummyExplodedUrl
+ } ;
+ for(URL testURL : testURLs)
{
- deployer.undeploy(dummyUrl);
+ try
+ {
+ deployer.undeploy(testURL);
+ }
+ catch(Exception e)
+ {
+ // eat it
+ }
}
- catch(Exception e)
- {
- // eat it
- }
}
private void setSecurity(Principal username, Object password)
@@ -419,28 +441,7 @@
SecurityAssociation.setPrincipal(username);
SecurityAssociation.setCredential(password);
}
-
- /**
- * Verifies that a given module is acutally deployed. Waits for a while,
- * checking every few seconds, to see if the module has deployed yet.
- *
- * @param url The URL for which we're testing deployment
- * @param asString Should we use URL or URL.toExternalForm() (String)?
- * @return
- */
- private boolean isDeployed(URL url, boolean isString)
- throws Exception
- {
- boolean isDeployed = false;
-
- if(isString)
- isDeployed = deployer.isDeployed(url.toExternalForm());
- else
- isDeployed = deployer.isDeployed(url);
-
- return isDeployed;
- }
-
+
private void failIfIsFileDeployedNotEqual(File file, boolean isDeployed)
{
int attempts = 0;
More information about the jboss-cvs-commits
mailing list