EMBJOPR SVN: r455 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-05-20 11:19:08 -0400 (Wed, 20 May 2009)
New Revision: 455
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java
Log:
EarTest updated - added testEarDeployFineThenRedeployMalformedDescriptor().
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java 2009-05-20 14:00:24 UTC (rev 454)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java 2009-05-20 15:19:08 UTC (rev 455)
@@ -107,7 +107,6 @@
deployEar( earFilePath );
String expectedMessage = DEPLOYABLE_NAME + " created successfully";
-
checkClientAndServerMessages(expectedMessage, expectedMessage, false);
// Use JMX to assert that the EAR components really did deploy successfully.
@@ -202,7 +201,7 @@
if( ejtt.deployment.isDeployedAccordingToEmbJopr(APP_TYPE, DEPLOYABLE_NAME)){
ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
- throw new EmbJoprTestException("An EAR witt malformed descriptor " +
+ throw new EmbJoprTestException("An EAR with malformed descriptor " +
"stays deployed after the deployment failed.");
}
}
@@ -213,7 +212,61 @@
+ /**
+ * TODO:
+ * 1) Deploy a valid EAR with a war in it (to check it's functionality).
+ * 2) In the Control tab, update it with an EAR with malformed descriptor.
+ * 3) Check that the error message contains "***** ROLLED BACK TO ORIGINAL APPLICATION FILE. *****"
+ * 4) Check that the embedded WAR works to verify the rollback.
+ *
+ */
+ public void testEarDeployFineThenRedeployMalformedDescriptor() throws IOException, EmbJoprTestException {
+ final String DEPLOYABLE_NAME = EAR_NOT_MALFORMED_APP_FILENAME;
+ final String DEPLOYABLE_2_NAME = EAR_MALFORMED_APP_FILENAME_2;
+
+ try {
+ // Deploy first deployable - the correct one.
+
+ String earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+ //deployEar(earFilePath);
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, earFilePath);
+
+ String expectedMessage = DEPLOYABLE_NAME + " created successfully";
+ checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+
+ // Redeploy new version with malformed application.xml in the Content tab.
+
+ earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_2_NAME;
+ String tmpFilePath = ejtt.getTempDir()+'/'+DEPLOYABLE_NAME;
+ FileUtils.copyFile( new File(earFilePath), new File(tmpFilePath) );
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, tmpFilePath);
+
+ // We should get an error message.
+ checkClientAndServerMessages("Failed to create Resource", "Failed to create Resource", true);
+
+ // The original EAR should remain deployed.
+ if( ejtt.deployment.isDeployedAccordingToEmbJopr(APP_TYPE, DEPLOYABLE_NAME)){
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ }
+ else{
+ throw new EmbJoprTestException("The original EAR should remain deployed " +
+ "after unsuccessful deployment of bad version of the same EAR.");
+ }
+ }
+ finally {
+
+ }
+ }
+
+
+
+
+
+
+
+
/**
* assertion:
@@ -357,14 +410,18 @@
*/
public void testEarSummaryTab() throws EmbJoprTestException, IOException, Exception {
+ final String DEPLOYABLE_NAME = BASIC_EAR;
+
final int DEPLOY_TIMEOUT_SEC = 20;
// Deploy the EAR
- String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
- deployEar( earFilePath );
+ String earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+ //deployEar( earFilePath );
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, earFilePath);
try {
+ /*
// Wait until the EAR appears...
new ActiveConditionChecker(new DescribedCondition("EAR appears in Summary tab list") {
public boolean isTrue() throws Exception {
@@ -373,7 +430,7 @@
ContentTableRow earRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(BASIC_EAR);
return null != earRow;
}
- }).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
+ }).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 10);
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
@@ -396,9 +453,12 @@
throw new EmbJoprTestException("EAR "+BASIC_EAR+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
}
} while( true );
+ /**/
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 2000, 10);
// FAILS because of EMBJOPR-80.
- earRow.getLinkByLabel(BASIC_EAR).click();
+ ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ earRow.getLinkByLabel(DEPLOYABLE_NAME).click();
// Check the values in info table(s)
@@ -408,7 +468,7 @@
ContentInfoTable infoTable = ejtt.getContentInfoTable( genpropTable );
Properties props = infoTable.getProperties();
- assertEquals(BASIC_EAR, props.getProperty("Name").trim());
+ assertEquals(DEPLOYABLE_NAME, props.getProperty("Name").trim());
//assertEquals("?", props.getProperty("Version")); // TODO: Where does RHQ get the version from?
// TODO: Fill JIRA? Description of EAR should be taken from application.xml <display-name>
//assertEquals("JBossTest Ear Deployment Testsuite", props.getProperty("Description"));
@@ -420,7 +480,7 @@
props = infoTable.getProperties();
- String path = ejtt.getDeployDir()+"/"+BASIC_EAR;
+ String path = ejtt.getDeployDir()+"/"+DEPLOYABLE_NAME;
assertEquals(path, props.getProperty("Path").trim());
assertEquals("no", props.getProperty("Exploded?").trim());
@@ -434,7 +494,7 @@
}
finally {
try {
- undeployEar(BASIC_EAR);
+ undeployEar(DEPLOYABLE_NAME);
}catch( Exception ex ){
log.error("Caught exception when undeploying: "+ex, ex);
}