[embjopr-commits] EMBJOPR SVN: r390 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5: app and 4 other directories.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Wed May 6 17:15:46 EDT 2009


Author: ozizka at redhat.com
Date: 2009-05-06 17:15:45 -0400 (Wed, 06 May 2009)
New Revision: 390

Added:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/
   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/ejb/
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/rar/
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/rar/RarTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java
Removed:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EjbTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/RarTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
Log:
App tests separated to different java packages.

Deleted: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java	2009-05-06 19:17:03 UTC (rev 389)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java	2009-05-06 21:15:45 UTC (rev 390)
@@ -1,1436 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.jopr.jsfunit.as5;
-
-import com.gargoylesoftware.htmlunit.Page;
-import com.gargoylesoftware.htmlunit.WebClient;
-import org.jboss.jopr.jsfunit.util.DescribedCondition;
-import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
-import org.jboss.jopr.jsfunit.*;
-import com.gargoylesoftware.htmlunit.html.*;
-import java.io.*;
-import java.util.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import javax.faces.application.FacesMessage;
-import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletRequest;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
-import org.apache.commons.lang.math.RandomUtils;
-import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
-import org.jboss.jopr.jsfunit.exceptions.*;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
-import org.w3c.dom.Node;
-
-
-
-/**
- * This class contains tests for testing the EmbJopr Application
- * Management Functions for Enterprise Application archives with JBoss AS 5.
- * 
- * @author Shelly McGowan
- *
- */
-public class EarTest extends ApplicationTestBaseAS5 {
-
-	public static final DeployableTypes APP_TYPE = DeployableTypes.EAR;
-
-
-	
-	/**
-	  * @return the suite of tests being tested
-	*/
-	public static Test suite()
-	{
-		String testToRun = System.getProperty("jsfunit.test.single");
-		if( null == testToRun ){
-			return new TestSuite(EarTest.class);
-		}
-		else{
-			// TODO: Try running single test set in system property.
-			// http://members.pingnet.ch/gamma/junit.htm
-			TestSuite suite = new TestSuite();
-			//suite.addTest(this.getClass().getConstructor(String.class).newInstance(testToRun));
-			suite.addTest( new EarTest(testToRun) );
-			return suite;
-		}
-	}
-
-	public EarTest() {
-	}
-	private EarTest(String testToRun) {
-		super(testToRun);
-	}
-
-
-
-
-	/*
-	 * testName: testBasicEarDeployment
-   * assertion:  verify basic deployment of Enterprise Archive
-	 * test Strategy:  Navigate to Enterprise Applications.
-	 *	Add a new resource.  Verify the resource was successfully
-	 *	deployed.  Undeploy the archive for test clean up purposes.
-	 *
-	 * FAILED: JMX doesn't report EAR as deployed: eardeployment.ear
-	 */ 
-	public void testBasicEarDeployment() throws IOException, EmbJoprTestException
-	{
-
-		final String DEPLOYABLE_NAME = BASIC_EAR;
-
-		try {
-			// Deploy the EAR.
-			String earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
-			deployEar( earFilePath );
-
-			String expectedMessage = DEPLOYABLE_NAME + " created successfully";
-
-			checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
-			// Use JMX to assert that the EAR components really did deploy successfully.
-			//id="vfszip:/home/brq/ozizka/JoprEmbedded/jboss-as-5.x/build/output/jboss-5.1.0.Beta1/server/default/deploy/eardeployment.ear/",type=Deployment
-			//id="vfszip:/home/ondra/work/JOPRembedded/embjopr-svn-trunk/jsfunit/target/jboss5x/deploy/eardeployment.ear",* not found.
-			assertTrue("JMX doesn't report EAR as deployed: eardeployment.ear", isEarDeployed(DEPLOYABLE_NAME));
-			assertTrue("JMX doesn't report EJB sessiona.jar as deployed.", isEJBDeployed("sessiona.jar"));
-			assertTrue("JMX doesn't report EJB sessionb.jar as deployed.", isEJBDeployed("sessionb.jar"));
-		}
-		finally {
-			// Undeploy the EAR.
-
-			/*undeployEar( DEPLOYABLE_NAME );
-			String expectedMessage = "Successfully deleted Enterprise Application (EAR) '"+DEPLOYABLE_NAME+"'.";
-			assertTrue(client.getPageAsText().contains( expectedMessage ));
-			/**/
-			ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
-		}
-
-		// This assert doesn't work. The JXM view is not consistent with the mananaged view. 
-		// JBAS-XXXX
-		//assertFalse(isEarDeployed("eardeployment.ear"));
-		//assertFalse(isEJBDeployed("sessiona.jar"));
-		//assertFalse(isEJBDeployed("sessionb.jar"));
-
-	}
-
-	/**
-	 *	assertion:
-	   
-	      Verify an .ear that contained a bad deployment descriptor
-				fails deployment, fixed using console, and can then be
-				successfully deployed.
-
-	  	test Strategy:
-	   
-	      Deploy an .ear that is known to have a bad deployment
-				descriptor.  Verify the console shows deployment failed.
-				Edit the .ear resource to fix the achive.  Redeploy and
-				verify the archive has been deployed successfully.
-	 
-	 */
-	public void DISABLEDtestBadEarRedeploy() throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
-
-		try {
-			String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+EAR_MALFORMED_APP_FILENAME;
-			deployEar(earFilePath);
-
-			checkClientAndServerMessages("Failed to create Resource", "Failed to create Resource", true);
-		}
-		finally {
-			undeployEar(BASIC_EAR);
-		}
-	}
-
-
-
-
-	/**
-	 * assertion:
-	  
-			Verify the navigation sequence to Enterprise Applications.
-
-		 test Strategy:
-	 
-	    From the root of the navigation tree:
-			Click JBossAS Servers ==> JBoss App Server:${config}
-	          ==> Applications ==> Enterprise Application
-
-	 *  PASSED.
-	 */
-	public void testNavigationToEar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException
-	{
-
-		// JBossAS Servers node 
-		NavTreeNode nodeServers = ejtt.getNavTree().getNodeByLabel("JBossAS Servers");
-		nodeServers.click();
-
-		{
-			String headerText = "JBossAS Server";
-			String jbossConfig = ejtt.getJBossConfig();
-
-			assertTrue("Page doesn't contain the header: "+headerText,
-							client.getPageAsText().contains(headerText));
-
-			assertTrue("EmbJopr should list at least one server (the one it is running on)" +
-							" and that should be in the UP sate.",
-							client.getPageAsText().contains("UP"));
-			// Check whether the server is listed. If not, Exception is thrown.
-			ContentTableRow row =
-							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("JBoss Application Server")
-							.getFirstRowContainingLink("JBoss AS 5 ("+jbossConfig+")");
-			// Click the server link
-			//HtmlAnchor link row.getLinkByLabel("JBAS (default)");
-			Node firstLink = row.getCellByColumnName("Name").getElementsByTagName("a").item(0);
-			if( null == firstLink || !(firstLink instanceof HtmlAnchor) )
-				throw new HtmlElementNotFoundException("Can't find the server link.");
-
-			((HtmlAnchor)firstLink).click();
-		}
-
-		// JBoss App Server:${config} node
-		{
-			String pageText = client.getPageAsText();
-
-			String jbossConfig = ejtt.getJBossConfig();
-			String headerText = "JBoss AS 5 ("+jbossConfig+")";
-			assertTrue("Page doesn't contain the header: "+headerText,
-							pageText.contains(headerText));
-
-			headerText = "General Properties";
-			assertTrue("Page doesn't contain the header: "+headerText,
-							pageText.contains(headerText));
-
-			// TODO: This page reports "Version:5.0 CR1" - EMBJOPR-77
-
-			ejtt.getNavTree().getNodeByLabel("Applications").click();
-
-		}
-
-
-		// Applications node 
-		{
-			// Whooo-hooo! So much to click through!
-
-			ejtt.getTabMenu().clickTab("Summary");
-
-			// TODO: Pagination options: EMBJOPR-78
-			// resourceDataScroller.xhtml, TableManager.java, "pageSizes".
-
-
-			// There's at least one Application with State == UP.
-			//ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Different types of Applications");
-			HtmlTable tableElement = (HtmlTable)client.getElement("categorySummaryForm:dataTable");
-			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTable(tableElement);
-			ContentTableRow row = table.getFirstRowContainingText("UP");
-
-			// Go further - try to click on any Application that is up.
-			HtmlAnchor link = row.getFirstLinkFromColumn("Name");
-			link.click();
-		}
-
-
-		{
-			// Go back to applications Sumary screen.
-			ejtt.getNavTree().getNodeByLabel("Applications").click();
-		}
-
-
-		// Concrete appliction node.
-		{
-			// Deploy the EAR.
-			String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
-			deployEar( earFilePath );
-
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-			assertTrue("Page doesn't list "+BASIC_EAR+" in Summary tab.", earRow != null );
-
-			// Go to the summary through listed item.
-			earRow.getLinkByLabel(BASIC_EAR).click();
-			// Check that we have the summary tab for the selected EAR.
-			assertTrue( "EAR name ("+BASIC_EAR+" not found in the content box.",
-				ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_EAR) );
-
-			// Go to the summary through nav tree node.
-			NavTreeNode earNode = ejtt.getNavTree().getNodeByLabel(NAV_EAR);
-			if( !earNode.isExpanded() ){
-				log.info("Expanding.");
-				earNode.getArrowLink().click();
-				Thread.sleep(2000);
-			}
-			ejtt.getNavTree().getNodeByLabel(BASIC_EAR).click();
-			// Check that we have the summary tab for the selected EAR.
-			ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_EAR);
-
-			undeployEar(BASIC_EAR);
-
-		}
-
-	
-	}// testNavigationToEar()
-
-
-
-
-
-
-	/**
-	 *  Assertion:  Verify the content of the Enterprise Application Summary tab
-	 *
-	 *
-	 * FAILS because clicking on the EAR name in list brings us to the root node Summary.
-	 * https://jira.jboss.org/jira/browse/EMBJOPR-80
-	 *
-	 * junit.framework.ComparisonFailure: expected:<eardeployment.ear> but was:<ondra-redhat>
-     at org.jboss.jopr.jsfunit.as5.EarTest.testEarSummaryTab(EarTest.java:323)
-	 */
-	public void testEarSummaryTab() throws EmbJoprTestException, IOException, Exception {
-
-		final int DEPLOY_TIMEOUT_SEC = 20;
-
-		// Deploy the EAR
-		String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
-		deployEar( earFilePath );
-
-		try {
-
-			// Wait until the EAR appears...
-			new ActiveConditionChecker(new DescribedCondition("EAR appears in Summary tab list") {
-				public boolean isTrue() throws Exception {
-					// Refresh, then check.
-					ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-					ContentTableRow earRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(BASIC_EAR);
-					return null != earRow;
-				}
-			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
-
-
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-
-			// Wait until the Status is "UP".
-			// TODO: Replace with ActiveConditionChecker.
-			int maxLoops = DEPLOY_TIMEOUT_SEC;
-			do {
-				String statusText = earRow.getCellTextByColumnName("Status");
-				log.debug("EAR Status: "+statusText);
-				if( "UP".equals(statusText) )
-					break;
-
-				// Refresh page after 1 second.
-				ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-				earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-
-				// We don't want an infinite loop by mistake.
-				if( maxLoops-- <= 0 ){
-					throw new EmbJoprTestException("EAR "+BASIC_EAR+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
-				}
-			} while( true );
-
-			// FAILS because of EMBJOPR-80.
-			earRow.getLinkByLabel(BASIC_EAR).click();
-
-
-			// Check the values in info table(s)
-
-			// General Properties
-			HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
-			ContentInfoTable infoTable = ejtt.getContentInfoTable( genpropTable );
-			Properties props = infoTable.getProperties();
-
-			assertEquals(BASIC_EAR, 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"));
-
-
-			// Resource Traits
-			infoTable = ejtt.getContentInfoTable(
-							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
-			props = infoTable.getProperties();
-
-
-			String path = ejtt.getDeployDir()+"/"+BASIC_EAR;
-			assertEquals(path, props.getProperty("Path").trim());
-
-			assertEquals("no", props.getProperty("Exploded?").trim());
-
-			// Metrics Summary
-			HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Metrics Summary").getElement();
-			infoTable = ejtt.getContentInfoTable(summaryTable);
-			// (nothing here yet)
-
-
-		}
-		finally {
-			try {
-				undeployEar(BASIC_EAR);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}// testEarSummary()
-
-
-
-	/**
-	 * Changes EAR configuration, and checks whether the changes were saved.
-	 *
-	 */
-	public void testEarConfigurationTab() throws IOException, EmbJoprTestException {
-
-		// Deploy the EAR.
-		String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
-		deployEar( earFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
-
-			// Navigate to the Configuration tab
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-			earRow.getLinkByLabel(BASIC_EAR).click();
-
-			Page prevPage = client.getContentPage();
-			ejtt.tabMenu.clickConfigurationTab();
-			assertNotSame("We should move to other page after clicking the Config tab.",
-							prevPage, client.getContentPage());
-
-			// Read properties.
-			Properties props = new Properties();
-			String filePath = ejtt.getTestDataDir()+"/ear/"+"ear-conf-basic.properties";
-			props.load(new FileInputStream( filePath ));
-
-
-			// Set the configuration options and Save
-			fillOutForm(props);
-			//ejtt.getTabMenu().getTabContentBox().getButtonByLabel("Save");
-			ejtt.getClickableByID("resourceConfigurationForm:saveButton").click();
-
-
-			// Check whether the properties were saved.
-			ejtt.tabMenu.clickConfigurationTab();
-
-			// TODO: We don't see the success message! EMBJOPR-89
-			//checkClientAndServerMessages("successfully", "successfully", false);
-
-			// FAILS because some of the values are read-only.  EMBJOPR-96
-			checkForm(props);
-
-			// TODO: Finish when the properties are marked read-only.
-
-		}
-		finally {
-			try {
-				undeployEar(BASIC_EAR);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-
-	/**
-	 * Changes EAR configuration, and verifies that the changes were NOT saved.
-	 *
-	 */
-	public void testEarConfigurationTabCancel() throws IOException, EmbJoprTestException {
-
-		// Deploy the EAR.
-		String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
-		deployEar( earFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
-
-			// Navigate to the Configuration tab
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-			earRow.getLinkByLabel(BASIC_EAR).click();
-
-			Page prevPage = client.getContentPage();
-			ejtt.tabMenu.clickConfigurationTab();
-			assertNotSame("We should move to other page after clicking the Config tab.",
-							prevPage, client.getContentPage());
-
-
-			// Load properties (we will use their names).
-			Properties propsToSet = new Properties();
-			String propsFilePath = ejtt.getTestDataDir()+"/ear/"+"ear-conf-basic.properties";
-			propsToSet.load(new FileInputStream( propsFilePath ));
-
-			// Get the current properties.
-			Properties propsOriginal = getFormPropertiesValues( propsToSet );
-
-
-			// Set the configuration options and CANCEL
-			fillOutForm( propsToSet );
-			ejtt.getClickableByID("resourceConfigurationForm:cancelButton").click();
-
-
-			// TODO: We should get back to Conf tab automatically: EMBJOPR-100
-			ejtt.tabMenu.clickConfigurationTab();
-
-			// Now check whether the values are the same as before editing.
-			checkForm( propsOriginal );
-
-		}
-		finally {
-			try {
-				undeployEar(BASIC_EAR);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-
-	/**
-	 * Redeploys EAR.
-	 *
-	 * Fails because of EMBJOPR-109 - HTTP Status 500 - Error in Seam/JSF
-	 * Fails because of EMBJOPR-42 - javax.el.ELException: org.jboss.seam.RequiredException:
-	 *     @Out attribute requires non-null value: updateBackingContentAction.packageDetails
-	 */
-	public void testEarRedeployment() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME  = BASIC_EAR;
-
-		// Deploy the EAR.
-		String appFilePath = ejtt.getTestDataDir() + "/"+DeployableTypes.EAR.getDataDir()+"/"+DEPLOYABLE_NAME;
-		deployEar( appFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME, 3000, 15);
-
-			// Navigate to the Configuration tab
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			earRow.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.tabMenu.clickContentTab();
-
-			String xPath = ".//table//input[@type='file']";
-			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			fileInput.setValueAttribute(appFilePath);
-			xPath = ".//table//input[@type='submit']";
-			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			submit.click();
-
-
-
-		}
-		finally {
-			try {
-				undeployEar(DEPLOYABLE_NAME); // EMBJOPR-109 here.
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-
-	/**
-	 * Deploys exploded EAR and checks whether it is reported as exploded.
-	 *
-	 * DISABLED - Badly written test, to be fixed. TODO: Hot-deploy
-	 */
-	public void DISABLEDtestUnzippedEarReportedAsExploded() throws IOException, EmbJoprTestException {
-
-		// Deploy the EAR.
-		String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
-		deployEar( earFilePath );
-
-		try {
-			// Wait for EAR to be deployed and UP
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
-
-			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits");
-			ContentInfoTable infoTable = ejtt.getTabMenu().getTabContentBox().getContentInfoTable(table.getElement());
-			Properties properties = infoTable.getProperties();
-			assertEquals("'Exploded?' should be 'yes'", "yes", properties.getProperty("Exploded?").toLowerCase() );
-
-		}
-		finally {
-			try {
-				undeployEar(BASIC_EAR);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-
-
-	/**
-	 * Checks EAR metrics tab.
-	 */
-	public void testEarMetricsTab() throws IOException, EmbJoprTestException {
-
-		// Deploy the EAR.
-		String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
-		deployEar( earFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
-
-			// Navigate to the Metrics tab
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-			earRow.getLinkByLabel(BASIC_EAR).click();
-			ejtt.tabMenu.clickMetricsTab();
-
-			// Resource Traits
-
-			// Check the Path.
-			HtmlTable tbl = ejtt.getTabMenu().getTabContentBox().
-							getTableUnderHeader("Trait Values").getElement();
-			ContentInfoTable infoTable = ejtt.getContentInfoTable( tbl );
-			Properties props = infoTable.getProperties();
-			log.debug("EAR Metrics tab - Trait Values: "+ props.toString());
-
-			String path = ejtt.getDeployDir()+"/"+BASIC_EAR;
-			assertEquals(path, props.getProperty("Path"));
-
-		}
-		finally {
-			try {
-				undeployEar(BASIC_EAR);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-	/**
-	 * Changes EAR configuration, and checks whether the changes were saved.
-	 *
-	 * FAILS because some of the values are read-only.  EMBJOPR-96
-	 */
-	public void testEarMetricsTabRefreshButton() throws IOException, EmbJoprTestException {
-
-		// Deploy the EAR.
-		String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
-		deployEar( earFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
-
-			// Navigate to the Metrics tab
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-			earRow.getLinkByLabel(BASIC_EAR).click();
-			ejtt.tabMenu.clickMetricsTab();
-
-			// Click the Refresh button.
-			// Can this change to submit? Perhaps set an ID and use ejtt.getClickableById().
-			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Refresh").click();
-
-			// Check that we are still on the right tab.
-			assertTrue("Metrics tab is active", ejtt.tabMenu.isTabActive("Metrics") );
-			assertTrue("Page contains EAR name", client.getPageAsText().contains(BASIC_EAR) );
-			assertTrue("Page contains 'Refresh'", client.getPageAsText().contains("Refresh") );
-
-		}
-		finally {
-			try {
-				undeployEar(BASIC_EAR);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-	/**
-	 * Deploys an exploded EAR application.
-	 *
-	 * PASSED.
-	 * Now fails, because EAR does not appear.
-	 */
-	public void testDeployUnpackedEar() throws IOException, EmbJoprTestException {
-
-
-		// Deploy the unpacked EAR.
-		// We have to use hotdeploy - can't upload a directory.
-		log.info("Unzipping ear/"+EAR_UNPACKED_ZIP);
-		unzipToDeployDir("ear/"+EAR_UNPACKED_ZIP, "");
-		ejtt.sleep(5000); // 5 sec is default deployment scanner interval.
-
-		try {
-				// Loop, wait for the app to appear.
-				log.info("Waiting for EAR to appear.");
-				ejtt.deployment.waitActivelyForDeployment( DeployableTypes.EAR, EAR_UNPACKED, 5000, 12, this);
-
-
-				ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-
-				ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(EAR_UNPACKED);
-
-				// TODO: Finish
-
-				// TODO: Check whether Exploded?:  yes.  EMBJOPR-95
-
-				// TODO: DeploymentUtils, DeployableTypes, isAvailable enum inner classes
-
-				// TODO: Preliminary test - check system properties, their validity, java version, etc.
-		}
-		finally {
-			// Delete the EAR dir.
-			deleteFromDeployDir(EAR_UNPACKED);
-		}
-	}
-
-
-
-
-
-
-	/**
-	 * Deploys an EAR with WAR as a module, and checks whether the web app runs.
-	 */
-	public void testEarWithWar() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME = EAR_WITH_WAR;
-
-		// Deploy the EAR.
-		String earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
-		deployEar( earFilePath );
-
-		// Get the HTTP port and the URL of the test page.
-		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
-		int port = tmpRequest.getLocalPort();
-		// Eventually remove ".war" suffix and add "-war" (convention)
-		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".ear" ) +"-war";
-		String testPageUrl = "http://localhost:"+port+"/"+context+"/index.jsp";
-
-		// Create web client we will use to check the web app.
-		WebClient webClient = new WebClient();
-		webClient.setThrowExceptionOnFailingStatusCode(false);
-		HtmlPage page;
-
-		try {
-
-			// Wait until the EAR is UP.
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME, 3000, 15, this);
-			
-			// Assert that the app is running.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
-      assertTrue("Page should contain 'Hello World'", page.asText().contains("Hello World"));
-
-		}
-		finally {
-			try {
-				undeployEar(DEPLOYABLE_NAME);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-
-
-
-
-
-
-
-	/**
-	 * Stops and Starts an EAR with WAR in the Control tab.
-	 *
-	 * FAILS because of EMBJOPR-133.
-	 */
-	public void testStopAndStartEar() throws IOException, EmbJoprTestException
-	{
-		final String DEPLOYABLE_NAME = EAR_WITH_WAR_COUNTER;
-
-		// Get the HTTP port and the URL of the test page.
-		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
-		int port = tmpRequest.getLocalPort();
-		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".ear" )+"-war"; // Eventually remove ".ear" suffix.
-		String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
-
-		// Create web client we will use to check the web app.
-		WebClient webClient = new WebClient();
-		// We'll get 404 after stopping the app.
-		webClient.setThrowExceptionOnFailingStatusCode(false);
-		HtmlPage page;
-
-
-		// Deploy the EAR.
-		String appfilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
-		deployEar( appfilePath );
-
-		try {
-
-			// Wait until app is UP
-			ejtt.getNavTree().getNodeByLabel(DeployableTypes.EAR.getNavTreeLabel()).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME,
-							3000, 15, this);
-
-			// Assert that the app is running.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
-      assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
-
-			// Refresh the page several times to increase the counter.
-			page = (HtmlPage) page.refresh();
-			page = (HtmlPage) page.refresh();
-
-			// Get the counter number.
-			Integer count1 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
-
-
-
-			// Navigate to the web app, then to it's Control tab.
-			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			row.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.getTabMenu().clickControlTab();
-
-			// Click the Stop button.
-			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Stop").click();
-
-			// Check the latest message.
-			/*
-			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
-			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
-			assertTrue( tr.getTextContent().contains("Success") );
-			/**/
-			DebugUtils.writeFile("target/testStopAndStartEar-opsTable.html", client.getPageAsText() );///
-			OperationStatusType status = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getLastOperationStatus();
-			assertEquals("Stop operation did not succeed, the status is: "+status, OperationStatusType.SUCCESS, status);
-			//assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
-
-
-			// Assert that the app is stopped.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertTrue( 200 != page.getWebResponse().getStatusCode() );
-
-
-			// Click the Start button.
-			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start").click();
-
-			// Check the latest message. TODO: EJTT class for ops history table?
-			/*
-			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getElement();
-			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
-			assertTrue( tr.getTextContent().contains("Success") );
-			*/
-			DebugUtils.writeFile("target/testStopAndStartEar-opsTable2.html", client.getPageAsText() );///
-			status = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getLastOperationStatus();
-			assertEquals("Start operation did not succeed, the status is: "+status, OperationStatusType.SUCCESS, status);
-			//assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
-
-
-			// Assert that the app is running.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertTrue( 200 == page.getWebResponse().getStatusCode() );
-      assertTrue(page.asText().contains("HELLO WORLD"));
-
-			// Get the counter number.
-			Integer count2 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
-
-			assertTrue( "Counter is reset upon app restart, thus should be lower after.", count1 > count2 );
-
-
-		}
-		finally {
-			try {
-				undeployEar(DEPLOYABLE_NAME);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-	}
-
-
-	/**
-	 * Restarts the EAR in Control tab and checks whether it was really restarted.
-	 *
-	 * FAILS because of EMBJOPR-133.
-	 */
-	public void testRestartEar() throws IOException, EmbJoprTestException
-	{
-		final String DEPLOYABLE_NAME = EAR_WITH_WAR_COUNTER;
-
-		// Get the HTTP port and the URL of the test page.
-		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
-		int port = tmpRequest.getLocalPort();
-		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".ear" )+"-war";
-		String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
-
-		// Create web client we will use to check the web app.
-		WebClient webClient = new WebClient();
-		webClient.setThrowExceptionOnFailingStatusCode(false);
-		HtmlPage page;
-
-
-		// Deploy the app.
-		String appFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
-		deployEar( appFilePath );
-
-		try {
-
-			// Wait until app is UP
-			ejtt.getNavTree().getNodeByLabel(DeployableTypes.EAR.getNavTreeLabel()).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME,
-							3000, 15, this);
-
-			// Assert that the app is running.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
-      assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
-
-			// Refresh the page several times to increase the counter.
-			page = (HtmlPage) page.refresh();
-			page = (HtmlPage) page.refresh();
-
-			// Get the counter number.
-			Integer count1 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
-
-
-
-			// Navigate to the web app, then to it's Control tab.
-			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			row.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.getTabMenu().clickControlTab();
-
-			// Click the Restart button.
-			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Restart").click();
-
-			// Check the latest message. TODO: EJTT class for ops history table?
-			/*
-			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getElement();
-			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
-			assertTrue( tr.getTextContent().contains("Success") );
-			*/
-			//assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
-			OperationStatusType status = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getLastOperationStatus();
-			assertEquals("Stop operation did not succeed, the status is: "+status, OperationStatusType.SUCCESS, status);
-
-
-
-			// Assert that the app is running.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertTrue( 200 == page.getWebResponse().getStatusCode() );
-      assertTrue(page.asText().contains("HELLO WORLD"));
-
-			// Get the counter number.
-			Integer count2 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
-
-			assertTrue( "Counter is reset upon app restart, thus should be lower after.", count1 > count2 );
-
-		}
-		finally {
-			try {
-				undeployEar(DEPLOYABLE_NAME);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-	}
-
-
-
-	/**
-	 * Deploys an EAR with dependencies which are not in default config,
-	 * checks for the deployment error message,
-	 * and checks that the EAR is not listed.
-	 *
-	 * FAILS because of EMBJOPR-137 - EAR with unsatisfied dependencies
-	 * show error upon deploy, but then shows as UP.
-	 */
-	public void testEarWithUnsatisfiedDeps() throws IOException, EmbJoprTestException
-	{
-
-		final String DEPLOYABLE_NAME = EAR_EXT_DEPENDENCIES;
-
-		try {
-			// Deploy the EAR.
-			String appFilePath = ejtt.getTestDataDir() + "/"+DeployableTypes.EAR.getDataDir()+"/"+DEPLOYABLE_NAME;
-			ejtt.deployment.deployViaEmbJopr( DeployableTypes.EAR, appFilePath );
-
-			// Check that we get an error message.
-			assertTrue( "We should get an error message.", server.getFacesMessages().hasNext() );
-			assertTrue( "We should get an error message.",
-							server.getFacesMessages().next().getSeverity() != FacesMessage.SEVERITY_INFO );
-
-			// Check that the EAR is not listed as deployed.
-			assertFalse( "The EAR should not be listed as deployed.",
-		    ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.EAR, DEPLOYABLE_NAME, false) );
-
-		}
-		finally {
-			try {
-				undeployEar(DEPLOYABLE_NAME);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-
-
-
-
-	public void testEarRedeployDifferentName() throws IOException, EmbJoprTestException
-	{
-
-		final String DEPLOYABLE_NAME  = EAR_WITH_WAR_COUNTER;
-		final String DEPLOYABLE_NAME2 = EAR_WITH_WAR_COUNTER_20;
-
-		// Deploy the EAR.
-		String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME;
-		ejtt.deployment.deployViaEmbJopr( APP_TYPE, appFilePath );
-
-		String appFilePath2 = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME2;
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 15);
-
-			// Navigate to the Configuration tab
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			earRow.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.tabMenu.clickContentTab();
-
-			String xPath = ".//table//input[@type='file']";
-			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			fileInput.setValueAttribute(appFilePath2);
-			xPath = ".//table//input[@type='submit']";
-			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			submit.click();
-
-			// We should get:
-			// The specified file must have the same name as the existing
-			// deployed EAR File (EarWithWar-Counter.ear).
-			String msg = "The specified file must have the same name " +
-				"as the existing deployed EAR File";
-			checkClientAndServerMessages( msg, msg, FacesMessage.SEVERITY_WARN );
-
-			// Check that the old app is deployed.
-			ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 15);
-
-		}
-		finally {
-			try {
-				undeployEar( DEPLOYABLE_NAME );
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-			try {
-				undeployEar( DEPLOYABLE_NAME2 );
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-	
-	}
-
-
-
-
-	public void testEarRedeployDifferentVersion() throws IOException, EmbJoprTestException
-	{
-
-		final String DEPLOYABLE_NAME  = EAR_WITH_WAR_COUNTER;
-		final String DEPLOYABLE_NAME2 = EAR_WITH_WAR_COUNTER_20;
-
-		// Copy new version to tmp dir under old ver's filename.
-		String srcFilePath =  ejtt.getTestDataDir() +"/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME2;
-		String destFilePath = ejtt.getTempDir() +"/"+DEPLOYABLE_NAME;
-		FileUtils.copyFile(new File(srcFilePath), new File(destFilePath));
-
-
-		// Deploy the EAR.
-		String appFilePath = destFilePath;
-		ejtt.deployment.deployViaEmbJopr( APP_TYPE, appFilePath );
-
-		String appFilePath2 = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME2;
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 15);
-
-			// Navigate to the Configuration tab
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			earRow.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.tabMenu.clickContentTab();
-
-			String xPath = ".//table//input[@type='file']";
-			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			fileInput.setValueAttribute(appFilePath2);
-			xPath = ".//table//input[@type='submit']";
-			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			submit.click();
-
-			// We should get:
-			// The specified file must have the same name as the existing
-			// deployed EAR File (EarWithWar-Counter.ear).
-			String msg = "The specified file must have the same name " +
-				"as the existing deployed EAR File";
-			checkClientAndServerMessages( msg, msg, FacesMessage.SEVERITY_WARN );
-
-			// Check that the old app is deployed.
-			ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 15);
-
-		}
-		finally {
-			try {
-				undeployEar( DEPLOYABLE_NAME );
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-			try {
-				undeployEar( DEPLOYABLE_NAME2 );
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-	/**
-	 * Waits for the deployable to be in the UP State.
-	 *
-	 * @param type  Type of deployable - EAR, WAR, SAR, ...
-	 * @param name  Name of the deployable, like 'hello.war'.
-		 @deprecated  Moved to EJTT.Deployment.
-	 */
-	private void XwaitActivelyForDeployment(
-						final DeployableTypes type, final String name,
-						int intervalMS, int retries
-					)
-					throws EmbJoprTestException, IOException
-	{
-		try {
-			String conditionDesc = type.name()+" "+name+" appears in embjopr as deployed";
-			final EmbJoprTestToolkit selfEjtt = ejtt;
-			boolean deployedSuccessfuly =
-			new ActiveConditionChecker( new DescribedCondition(conditionDesc) {
-				int callsMade = 0;
-				public boolean isTrue() throws HtmlElementNotFoundException, IOException {
-					// Refresh the page if this is not the first call.
-					if( callsMade++ > 0 )
-						selfEjtt.refreshPage();
-					// If found, return true.
-					return new DeploymentUtils().isDeployedAccordingToEmbJopr( type, name );
-				}
-			} ).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout( intervalMS, retries );
-		}
-		catch( EmbJoprTestException ex ){ throw ex; }
-		catch( IOException ex ){ throw ex; }
-		// Wrap all exceptions to EmbJoprTestException.
-		catch( Exception ex ){
-			throw new EmbJoprTestException("Exception thrown while actively waiting for condition.", ex);
-		}
-	}
-
-
-
-
-	/**
-	 * Utilities for performing and checking deployment.
-	 * In the future, it should be general interface like
-	 *   boolean isDeployed( DeployableType type, String name ).
-	 */
-	protected class DeploymentUtils {
-
-		/**
-		 * Returns true if EmbJopr lists a deployable of given type and name,
-		 * and it's State is UP; false otherwise.
-		 */
-		private boolean isDeployedAccordingToEmbJopr( DeployableTypes type, String deployableName )
-						throws HtmlElementNotFoundException, IOException
-		{
-			// Refresh / go to the appropriate page.
-			ejtt.getNavTree().getNodeByLabel( type.getNavTreeLabel() ).click();
-			ContentTableRow earRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(deployableName);
-			if( null == earRow ){
-				log.debug("Row with "+deployableName+" not present.");
-				return false;
-			}
-
-			String statusText = earRow.getCellTextByColumnName("Status");
-			if( "UP".equals(statusText) ){
-				return true;
-			}else{
-				log.debug("Row with "+deployableName+" has Status == '"+statusText+"' != UP.");
-				return false;
-			}
-		}
-		
-		
-		/**
-		 * Returns true if there's a file of the given name in server's deploy dir;
-		 * false otherwise.
-		 */
-		private boolean isDeployedAccordingToFileSystem( DeployableTypes type, String name )
-		{
-			String deployPath = System.getProperty(SYSPROP_DEPLOY_DIR);
-			String fileName = deployPath+"/"+name;
-			return (new File(fileName)).exists();
-		}
-
-		private void undeployViaFileSystem( String name ) throws EmbJoprTestException{
-			String deployPath = System.getProperty(SYSPROP_DEPLOY_DIR);
-			String fileName = deployPath+"/"+name;
-			File fileToDelete = new File(fileName);
-
-			if( !fileToDelete.exists() )
-				throw new EmbJoprTestException("Deployable doesn't exist: "+fileName);
-
-			if(fileToDelete.isFile()){
-				if( !fileToDelete.delete() ){
-					throw new EmbJoprTestException("Unable to delete: "+fileName);
-				}
-			}else if(fileToDelete.isDirectory()){
-				deleteDirectory(fileToDelete);
-			}
-
-		}// isDeployedAccordingToFileSystem()
-		
-
-	}// class DeploymentUtils
-
-
-	
-	
-
-	// TODO: Move to utils
-	/**
-	 * Unzips given archive from testdata dir to server's deploy/ dir.
-	 * @param relativeArchivePath  Path of the archive relative to testdata dir.
-	 * @param relativeDestDir      Path of the destination dir relative to deploy dir.
-	 */
-	private void unzipToDeployDir( String relativeArchivePath, String relativeDestDir )
-					throws FileNotFoundException, IOException
-	{
-
-		String destDir = System.getProperty(SYSPROP_DEPLOY_DIR)+"/"+relativeDestDir;
-		String archivePath = System.getProperty(SYSPROP_TESTDATA_DIR)+"/"+relativeArchivePath;
-
-		log.info("Unzipping '"+archivePath+"' to '"+destDir+"'.");
-
-		unzipArchive( archivePath, destDir );
-	}
-
-
-	
-	/**
-	 * Unzips archive from the given path to the given destination dir.
-	 */
-	private void unzipArchive(String archivePath, String destDir)
-					throws FileNotFoundException, IOException
-	{
-
-		FileInputStream fis = new FileInputStream( archivePath );
-		ZipInputStream zin = new ZipInputStream(new BufferedInputStream(fis));
-
-		ZipEntry entry;
-		while( null != (entry = zin.getNextEntry()) ){
-
-			if(entry.isDirectory()) {
-				// Assume directories are stored parents first then children.
-				log.info("Extracting directory: " + entry.getName());
-				// This is not robust, just for demonstration purposes.
-				(new File(destDir +"/"+ entry.getName())).mkdir();
-				continue;
-			}
-
-			log.info("Extracting file: " + entry.getName());
-
-			final int BUFFER = 2048;
-			FileOutputStream fos = new FileOutputStream( destDir +"/"+ entry.getName());
-			BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER);
-
-			int count;
-			byte[] data = new byte[BUFFER];
-			while ((count = zin.read(data, 0, BUFFER)) != -1) {
-				 dest.write(data, 0, count);
-			}
-			dest.flush();
-			dest.close();
-			zin.closeEntry();
-
-		}
-
-		zin.close();
-
-	}
-
-
-
-
-	// TODO: Moved to EJTT, remove from here.
-	private void deleteFromDeployDir( String deployableName ) throws IOException{
-
-		String deployDir = ejtt.getDeployDir();
-
-		File dirToDelete = new File( deployDir, deployableName);
-		// Just not to delete something accidentally...
-		// Not true for Cargo maven plugin.
-		//assertTrue( deployDir+" contains '/server/'", deployDir.contains("/server/"));
-
-		// Check if not outside deploy dir.
-		if( !dirToDelete.getCanonicalPath().startsWith( deployDir ) )
-			throw new IllegalArgumentException(
-							" The resulting path is outside deploy dir: "+dirToDelete.getCanonicalPath());
-
-		log.info("Deleting '"+dirToDelete.getPath()+"'...");
-		//deleteDirectory( dirToDelete );
-	}
-
-
-
-  public static void deleteDirectory(File path) throws EmbJoprTestException
-	{
-		List<String> undeletableFiles = new ArrayList();
-		deleteDirectory(path, undeletableFiles);
-		if( !undeletableFiles.isEmpty() ){
-			throw new EmbJoprTestException("Couldn't delete following files: \n  "+
-							StringUtils.join(undeletableFiles, "\n  ") + "\n");
-		}
-	}
-
-  public static void deleteDirectory(File path, List<String> undeletableFiles)
-	{
-    if( path.exists() ) {
-      File[] files = path.listFiles();
-      for(int i=0; i<files.length; i++) {
-         if(files[i].isDirectory()) {
-           deleteDirectory(files[i], undeletableFiles );
-         }
-         else {
-           if( !files[i].delete() ){
-						 undeletableFiles.add(files[i].getAbsolutePath());
-					 }
-         }
-      }
-    }
-    if( ! path.delete() )
-			undeletableFiles.add( path.getAbsolutePath() );
-  }
-
-	private void deployEar( String earFilePath ) throws IOException, HtmlElementNotFoundException
-	{
-		if( !(new File(earFilePath)).exists())
-			throw new FileNotFoundException(earFilePath);
-
-		log.info("Deploying: "+earFilePath);
-
-		// Navigate to Enterprise Archives
-		ejtt.getNavTree().getNodeLink(NAV_EAR).click();
-
-		// click on the "Add new resource" button
-		client.click("actionHeaderForm:addNewContent");  // 404 if setThrowExceptionOnFailingStatusCode(true) above
-
-		// Upload the file
-		HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
-		fileInput.setContentType("application/ear");
-		fileInput.setValueAttribute(earFilePath);
-		client.click("createContentForm:addButton");
-		ejtt.sleep( 2000 );
-
-		// Log the message
-		ejtt.logServerMessage("Something went wrong with deploy: ");
-	}
-
-	private void undeployEar( String earFileName ) throws IOException, HtmlElementNotFoundException, ActionNotAvailableException
-	{
-
-		// Navigate to Enterprise Archives
-		ejtt.getNavTree().getNodeLink(NAV_EAR).click();
-
-		ejtt.getTabMenu().clickSummaryTab();
-
-		/// Debug log - we're getting HTTP 500 here :/
-		String dumpFile = "target/"+this.getName()+"-undeployEar-"+(1000+RandomUtils.nextInt(1000))+".html";
-		log.debug("Dumping page to "+dumpFile);
-		DebugUtils.writeFile( dumpFile, client.getPageAsText());
-		int httpStatusCode = client.getContentPage().getWebResponse().getStatusCode();
-		if( 200 != httpStatusCode )
-			log.warn("Status code before undeployment is: "+httpStatusCode);
-
-		HtmlButtonInput deleteButton = getAppDeleteButton( earFileName );
-		deleteButton.click();
-
-		// Log the message (with prefix of potential warning)
-		ejtt.logServerMessage("Something went wrong with undeploy: ");
-
-		// Sleep for 3 sec.  TODO: write some waitForUndeployed()
-		ejtt.sleep( 3000 );
-
-	}
-
-
-
-}// class EarTest

Deleted: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EjbTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EjbTest.java	2009-05-06 19:17:03 UTC (rev 389)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EjbTest.java	2009-05-06 21:15:45 UTC (rev 390)
@@ -1,127 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.jopr.jsfunit.as5;
-
-import org.jboss.jopr.jsfunit.*;
-import com.gargoylesoftware.htmlunit.html.*;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import javax.faces.application.FacesMessage;
-import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
-
-
-
-/**
- * This class contains tests for testing the EmbJopr Application
- * Management Functions for Enterprise JavaBean archives with JBoss AS 5.
- * 
- * @author Shelly McGowan
- *
- */
-public class EjbTest extends ApplicationTestBaseAS5 {
-
-	/**
-	  * @return the suite of tests being tested
-	*/
-
-	public static Test suite()
-	{
-		return new TestSuite(EjbTest.class);
-	}
-
-
-        /*
-         * testName: testBasicEjbDeployment
-         * assertion:  verify basic deployment of an EJB JAR.
-         * test Strategy:  Navigate to EJB Applications.
-         *      Add a new resource.  Verify the resource was successfully
-         *      deployed.  Undeploy the archive.
-         *
-         */
-
-	public void testBasicEjbDeployment() throws IOException, EmbJoprTestException
-	{
-		log.info(DebugUtils.getCurrentMethodFullName());
-
-		// Navigate to EJB Applications
-		HtmlAnchor ejbLink = getNavTreeLink(NAV_EJB2);
-		ejbLink.click();
-
-		// click on the "Add new resource" button
-		client.click("actionHeaderForm:addNewContent");  // 404 if setThrowExceptionOnFailingStatusCode(true) above
-
-		// TODO: "/ejb/BASIC_JAR" causes exceptions in seam:
-		// http://wwwapps.rdu.redhat.com/w3xpastebin/pastebin.php?show=9842
-
-		String filePath = System.getProperty("jsfunit.testdata") + "/ejb/"+BASIC_JAR;
-		log.info("Uploading EJB archive: "+filePath);
-		File uploadFile = new File(filePath);
-		if( !uploadFile.exists() )
-			throw new EmbJoprTestException("Can't find EJB file to upload: '"+filePath+"'");
-
-		// upload ejb
-		HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
-		fileInput.setContentType("application/ejb");
-		fileInput.setValueAttribute(filePath);
-		client.click("createContentForm:addButton");
-
-		log.info("HTTP status after EJB upload: "+client.getContentPage().getWebResponse().getStatusCode());
-		log.info("renderResponse() called: " + server.getFacesContext().getRenderResponse() );
-		log.info("responseComplete() called: " + server.getFacesContext().getResponseComplete() );
-
-		String errorMessage = 
-						( server.getFacesMessages().hasNext()
-						&& server.getFacesMessages().next().getSeverity() != FacesMessage.SEVERITY_INFO ) ?
-							" Faces message: "+server.getFacesMessages().next()
-							: ""; // Awful code
-
-		// FAILS because of NPE and HTTP 500.
-		// assert that the success message appeared on the client side
-		assertTrue("Success message not found."+errorMessage, client.getPageAsText().contains("Resource " + BASIC_JAR + " created successfully!"));
-
-		// assert text and severity level for FacesMessage on server side
-		assertTrue(server.getFacesMessages().hasNext());
-		FacesMessage successMessage = server.getFacesMessages().next();
-		assertTrue(FacesMessage.SEVERITY_INFO.equals(successMessage.getSeverity()));
-		assertTrue(successMessage.getDetail().contains("Resource " + BASIC_JAR + " created successfully!"));
-
-
-		assertFalse("Page contains 'Total: 0', EJBs probably not listed.",  client.getPageAsText().contains("Total: 0"));
-
-
-		// Use JMX to assert that the EJB components really did deploy successfully
-		assertTrue(isEJBDeployed(BASIC_JAR));
-
-		// Undeploy the EJB JAR 
-		HtmlButtonInput deleteButton = getAppDeleteButton(BASIC_JAR);
-		deleteButton.click();
-
-		assertTrue(client.getPageAsText().contains(EJB2_DEL_MSG + " '" + BASIC_JAR +"'."));
-
-		assertFalse(isEJBDeployed(BASIC_JAR));
-	}
-
-}

Deleted: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/RarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/RarTest.java	2009-05-06 19:17:03 UTC (rev 389)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/RarTest.java	2009-05-06 21:15:45 UTC (rev 390)
@@ -1,583 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.jopr.jsfunit.as5;
-
-import com.gargoylesoftware.htmlunit.Page;
-import com.gargoylesoftware.htmlunit.WebClient;
-import org.jboss.jopr.jsfunit.util.DescribedCondition;
-import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
-import org.jboss.jopr.jsfunit.*;
-import com.gargoylesoftware.htmlunit.html.*;
-import java.io.*;
-import java.util.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import javax.faces.application.FacesMessage;
-import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletRequest;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
-import org.apache.commons.lang.math.RandomUtils;
-import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
-import org.jboss.jopr.jsfunit.exceptions.*;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
-import org.w3c.dom.Node;
-
-
-
-/**
- * This class contains tests for testing the EmbJopr Application
- * Management Functions for Resource Adapters with JBoss AS 5.
- * 
- * @author Shelly McGowan
- *
- */
-public class RarTest extends ApplicationTestBaseAS5 {
-
-	public static final DeployableTypes APP_TYPE = DeployableTypes.RAR;
-
-
-	
-	/**
-	  * @return the suite of tests being tested
-	*/
-	public static Test suite()
-	{
-		String testToRun = System.getProperty("jsfunit.test.single");
-		if( null == testToRun ){
-			return new TestSuite(RarTest.class);
-		}
-		else{
-			// TODO: Try running single test set in system property.
-			// http://members.pingnet.ch/gamma/junit.htm
-			TestSuite suite = new TestSuite();
-			//suite.addTest(this.getClass().getConstructor(String.class).newInstance(testToRun));
-			suite.addTest( new RarTest(testToRun) );
-			return suite;
-		}
-	}
-
-	public RarTest() {
-	}
-	private RarTest(String testToRun) {
-		super(testToRun);
-	}
-
-
-	/*
-	 * testName: testBasicRarDeployment
-         * assertion:  verify basic deployment of a standalone resource adapter
-	 * test Strategy:  Navigate to Resource Adapter.
-	 *	Add a new resource.  Verify the resource was successfully
-	 *	deployed.  Undeploy the archive for test clean up purposes.
-	 *
-	 */ 
-	public void testBasicRarDeployment() throws IOException, EmbJoprTestException
-	{
-
-		final String DEPLOYABLE_NAME = BASIC_RAR;
-
-		try {
-			// Deploy the RAR.
-			String rarFilePath = ejtt.getTestDataDir() + "/rar/"+DEPLOYABLE_NAME;
-			deployRar( rarFilePath );
-
-			String expectedMessage = DEPLOYABLE_NAME + " created successfully";
-
-			checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
-			assertTrue("JMX doesn't report RAR, jbosstestadapter.rar as deployed.", isRarDeployed(BASIC_RAR));
-		}
-		finally {
-			ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
-		}
-
-		assertFalse(isRarDeployed(BASIC_RAR));
-
-	}
-
-
-	/**
-	 * assertion: Verify the navigation sequence to Resource Adapters.
-         *
-         * test Strategy:
-	 * 
-	 *   From the root of the navigation tree:i
-         *	Click JBossAS Servers ==> JBoss App Server:${config}
-	 *         ==> Applications ==> Resource Adapters
-         *
-	 */
-	public void testNavigationToRar() throws IOException, HtmlElementNotFoundException,
-		 ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException
-	{
-
-		// JBossAS Servers node 
-		NavTreeNode nodeServers = ejtt.getNavTree().getNodeByLabel("JBossAS Servers");
-		nodeServers.click();
-
-		{
-			String headerText = "JBossAS Server";
-			String jbossConfig = ejtt.getJBossConfig();
-
-			assertTrue("Page doesn't contain the header: "+headerText,
-							client.getPageAsText().contains(headerText));
-
-			assertTrue("EmbJopr should list at least one server (the one it is running on)" +
-							" and that should be in the UP sate.",
-							client.getPageAsText().contains("UP"));
-			// Check whether the server is listed. If not, Exception is thrown.
-			ContentTableRow row =
-							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("JBoss Application Server")
-							.getFirstRowContainingLink("JBoss AS 5 ("+jbossConfig+")");
-			// Click the server link
-			//HtmlAnchor link row.getLinkByLabel("JBAS (default)");
-			Node firstLink = row.getCellByColumnName("Name").getElementsByTagName("a").item(0);
-			if( null == firstLink || !(firstLink instanceof HtmlAnchor) )
-				throw new HtmlElementNotFoundException("Can't find the server link.");
-
-			((HtmlAnchor)firstLink).click();
-		}
-
-		// JBoss App Server:${config} node
-		{
-			String pageText = client.getPageAsText();
-
-			String jbossConfig = ejtt.getJBossConfig();
-			String headerText = "JBoss AS 5 ("+jbossConfig+")";
-			assertTrue("Page doesn't contain the header: "+headerText,
-							pageText.contains(headerText));
-
-			headerText = "General Properties";
-			assertTrue("Page doesn't contain the header: "+headerText,
-							pageText.contains(headerText));
-
-			ejtt.getNavTree().getNodeByLabel("Applications").click();
-
-		}
-
-		// Applications node 
-		{
-
-			ejtt.getTabMenu().clickTab("Summary");
-
-			HtmlTable tableElement = (HtmlTable)client.getElement("categorySummaryForm:dataTable");
-			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTable(tableElement);
-			ContentTableRow row = table.getFirstRowContainingText("UP");
-
-			// Go further - try to click on any Application that is up.
-			HtmlAnchor link = row.getFirstLinkFromColumn("Name");
-			link.click();
-		}
-
-
-		{
-			// Go back to applications Sumary screen.
-			ejtt.getNavTree().getNodeByLabel("Applications").click();
-		}
-
-
-		// Concrete appliction node.
-		{
-			// Deploy the RAR.
-			String rarFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/rar/"+BASIC_RAR;
-			deployRar( rarFilePath );
-
-			ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
-
-			ContentTableRow rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_RAR);
-			assertTrue("Page doesn't list "+BASIC_RAR+" in Summary tab.", rarRow != null );
-
-			// Go to the summary through listed item.
-			rarRow.getLinkByLabel(BASIC_RAR).click();
-			// Check that we have the summary tab for the selected RAR.
-			assertTrue( "RAR name ("+BASIC_RAR+" not found in the content box.",
-				ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_RAR) );
-
-			// Go to the summary through nav tree node.
-			NavTreeNode rarNode = ejtt.getNavTree().getNodeByLabel(NAV_RAR);
-			if( !rarNode.isExpanded() ){
-				log.info("Expanding.");
-				rarNode.getArrowLink().click();
-				Thread.sleep(2000);
-			}
-			ejtt.getNavTree().getNodeByLabel(BASIC_RAR).click();
-			// Check that we have the summary tab for the selected RAR.
-			ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_RAR);
-
-			undeployRar(BASIC_RAR);
-
-		}
-
-	
-	}// testNavigationToRar()
-
-
-
-
-
-
-	/**
-	 *  Assertion:  Verify the content of the Resource Adapter Summary tab
-	 *
-	 *
-	 */
-	public void testRarSummaryTab() throws EmbJoprTestException, IOException, Exception {
-
-		final int DEPLOY_TIMEOUT_SEC = 20;
-
-		// Deploy the RAR
-		String rarFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/rar/"+BASIC_RAR;
-		deployRar( rarFilePath );
-
-		try {
-
-			// Wait until the RAR appears...
-			new ActiveConditionChecker(new DescribedCondition("RAR appears in Summary tab list") {
-				public boolean isTrue() throws Exception {
-					// Refresh, then check.
-					ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
-					ContentTableRow rarRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(BASIC_RAR);
-					return null != rarRow;
-				}
-			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
-
-
-			ContentTableRow rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_RAR);
-
-			// Wait until the Status is "UP".
-			// TODO: Replace with ActiveConditionChecker.
-			int maxLoops = DEPLOY_TIMEOUT_SEC;
-			do {
-				String statusText = rarRow.getCellTextByColumnName("Status");
-				log.debug("RAR Status: "+statusText);
-				if( "UP".equals(statusText) )
-					break;
-
-				// Refresh page after 1 second.
-				ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
-				rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_RAR);
-
-				// We don't want an infinite loop by mistake.
-				if( maxLoops-- <= 0 ){
-					throw new EmbJoprTestException("RAR "+BASIC_RAR+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
-				}
-			} while( true );
-
-			// FAILS because of EMBJOPR-80.
-			rarRow.getLinkByLabel(BASIC_RAR).click();
-
-
-			// Check the values in info table(s)
-
-			// General Properties
-			HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
-			ContentInfoTable infoTable = ejtt.getContentInfoTable( genpropTable );
-			Properties props = infoTable.getProperties();
-
-			assertEquals(BASIC_RAR, props.getProperty("Name").trim());
-
-			// Resource Traits
-			infoTable = ejtt.getContentInfoTable(
-			ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
-			props = infoTable.getProperties();
-
-
-			String path = ejtt.getDeployDir()+"/"+BASIC_RAR;
-			assertEquals(path, props.getProperty("Path").trim());
-
-			assertEquals("no", props.getProperty("Exploded?").trim());
-
-			// Metrics Summary
-			HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Metrics Summary").getElement();
-			infoTable = ejtt.getContentInfoTable(summaryTable);
-			// (nothing here yet)
-
-
-		}
-		finally {
-			try {
-				undeployRar(BASIC_RAR);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}// testRarSummary()
-
-
-
-	/**
-	 * Changes RAR configuration, and checks whether the changes were saved.
-	 *
-	 */
-	public void testRarConfigurationTab() throws IOException, EmbJoprTestException {
-
-		// Deploy the RAR.
-		String rarFilePath = ejtt.getTestDataDir() +"/rar/"+ BASIC_RAR;
-		deployRar( rarFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.RAR, BASIC_RAR, 3000, 15);
-
-			// Navigate to the Configuration tab
-			ContentTableRow rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_RAR);
-			rarRow.getLinkByLabel(BASIC_RAR).click();
-
-			Page prevPage = client.getContentPage();
-			ejtt.tabMenu.clickConfigurationTab();
-			assertNotSame("We should move to other page after clicking the Config tab.",
-							prevPage, client.getContentPage());
-
-			// Read properties.
-			Properties props = new Properties();
-			String filePath = ejtt.getTestDataDir()+"/rar/"+"rar-conf-basic.properties";
-			props.load(new FileInputStream( filePath ));
-
-
-			// Set the configuration options and Save
-			fillOutForm(props);
-			//ejtt.getTabMenu().getTabContentBox().getButtonByLabel("Save");
-			ejtt.getClickableByID("resourceConfigurationForm:saveButton").click();
-
-
-			// Check whether the properties were saved.
-			ejtt.tabMenu.clickConfigurationTab();
-
-			// TODO: We don't see the success message! EMBJOPR-89
-			checkClientAndServerMessages("successfully", "successfully", false);
-
-			// FAILS because some of the values are read-only.  EMBJOPR-96
-			checkForm(props);
-
-			// TODO: Finish when the properties are marked read-only.
-
-		}
-		finally {
-			try {
-				undeployRar(BASIC_RAR);
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-
-
-	/**
-	 * Redeploys RAR.
-	 *
-	 */
-
-	public void testRarRedeployment() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME  = BASIC_RAR;
-
-		// Deploy the RAR.
-		String appFilePath = ejtt.getTestDataDir() + "/"+DeployableTypes.RAR.getDataDir()+"/"+DEPLOYABLE_NAME;
-		deployRar( appFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.RAR, DEPLOYABLE_NAME, 3000, 15);
-
-			// Navigate to the Configuration tab
-			ContentTableRow rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			rarRow.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.tabMenu.clickContentTab();
-
-			String xPath = ".//table//input[@type='file']";
-			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			fileInput.setValueAttribute(appFilePath);
-			xPath = ".//table//input[@type='submit']";
-			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			submit.click();
-
-
-
-		}
-		finally {
-			try {
-				undeployRar(DEPLOYABLE_NAME); 
-			}catch( Exception ex ){
-				log.error("Caught exception when undeploying: "+ex, ex);
-			}
-		}
-
-	}
-
-	/**
-	 * Utilities for performing and checking deployment.
-	 * In the future, it should be general interface like
-	 *   boolean isDeployed( DeployableType type, String name ).
-	 */
-	protected class DeploymentUtils {
-
-		/**
-		 * Returns true if EmbJopr lists a deployable of given type and name,
-		 * and it's State is UP; false otherwise.
-		 */
-		private boolean isDeployedAccordingToEmbJopr( DeployableTypes type, String deployableName )
-						throws HtmlElementNotFoundException, IOException
-		{
-			// Refresh / go to the appropriate page.
-			ejtt.getNavTree().getNodeByLabel( type.getNavTreeLabel() ).click();
-			ContentTableRow rarRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(deployableName);
-			if( null == rarRow ){
-				log.debug("Row with "+deployableName+" not present.");
-				return false;
-			}
-
-			String statusText = rarRow.getCellTextByColumnName("Status");
-			if( "UP".equals(statusText) ){
-				return true;
-			}else{
-				log.debug("Row with "+deployableName+" has Status == '"+statusText+"' != UP.");
-				return false;
-			}
-		}
-		
-		
-		/**
-		 * Returns true if there's a file of the given name in server's deploy dir;
-		 * false otherwise.
-		 */
-		private boolean isDeployedAccordingToFileSystem( DeployableTypes type, String name )
-		{
-			String deployPath = System.getProperty(SYSPROP_DEPLOY_DIR);
-			String fileName = deployPath+"/"+name;
-			return (new File(fileName)).exists();
-		}
-
-		private void undeployViaFileSystem( String name ) throws EmbJoprTestException{
-			String deployPath = System.getProperty(SYSPROP_DEPLOY_DIR);
-			String fileName = deployPath+"/"+name;
-			File fileToDelete = new File(fileName);
-
-			if( !fileToDelete.exists() )
-				throw new EmbJoprTestException("Deployable doesn't exist: "+fileName);
-
-			if(fileToDelete.isFile()){
-				if( !fileToDelete.delete() ){
-					throw new EmbJoprTestException("Unable to delete: "+fileName);
-				}
-			}else if(fileToDelete.isDirectory()){
-				deleteDirectory(fileToDelete);
-			}
-
-		}// isDeployedAccordingToFileSystem()
-		
-
-	}// class DeploymentUtils
-
-
-
-	private void deployRar( String rarFilePath ) throws IOException, HtmlElementNotFoundException
-	{
-		if( !(new File(rarFilePath)).exists())
-			throw new FileNotFoundException(rarFilePath);
-
-		log.info("Deploying: "+rarFilePath);
-
-		// Navigate to Enterprise Archives
-		ejtt.getNavTree().getNodeLink(NAV_RAR).click();
-
-		// click on the "Add new resource" button
-		client.click("actionHeaderForm:addNewContent");  // 404 if setThrowExceptionOnFailingStatusCode(true) above
-
-		// Upload the file
-		HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
-		fileInput.setContentType("application/rar");
-		fileInput.setValueAttribute(rarFilePath);
-		client.click("createContentForm:addButton");
-		ejtt.sleep( 2000 );
-
-		// Log the message
-		ejtt.logServerMessage("Something went wrong with deploy: ");
-	}
-
-	private void undeployRar( String rarFileName ) throws IOException,
-			 HtmlElementNotFoundException, ActionNotAvailableException
-	{
-
-		// Navigate to Enterprise Archives
-		ejtt.getNavTree().getNodeLink(NAV_RAR).click();
-
-		ejtt.getTabMenu().clickSummaryTab();
-
-		/// Debug log - we're getting HTTP 500 here :/
-		String dumpFile = "target/"+this.getName()+"-undeployRar-"+(1000+RandomUtils.nextInt(1000))+".html";
-		log.debug("Dumping page to "+dumpFile);
-		DebugUtils.writeFile( dumpFile, client.getPageAsText());
-		int httpStatusCode = client.getContentPage().getWebResponse().getStatusCode();
-		if( 200 != httpStatusCode )
-			log.warn("Status code before undeployment is: "+httpStatusCode);
-
-		HtmlButtonInput deleteButton = getAppDeleteButton( rarFileName );
-		deleteButton.click();
-
-		// Log the message (with prefix of potential warning)
-		ejtt.logServerMessage("Something went wrong with undeploy: ");
-
-		// Sleep for 3 sec.  TODO: write some waitForUndeployed()
-		ejtt.sleep( 3000 );
-
-	}
-
-	public static void deleteDirectory(File path) throws EmbJoprTestException
-        {
-                List<String> undeletableFiles = new ArrayList();
-                deleteDirectory(path, undeletableFiles);
-                if( !undeletableFiles.isEmpty() ){
-                        throw new EmbJoprTestException("Couldn't delete following files: \n  "+
-                                                        StringUtils.join(undeletableFiles, "\n  ") + "\n");
-                }
-        }
-
-	public static void deleteDirectory(File path, List<String> undeletableFiles)
-        {
-	  if( path.exists() ) {
-		File[] files = path.listFiles();
-      	 	for(int i=0; i<files.length; i++) {
-            if(files[i].isDirectory()) {
-           	deleteDirectory(files[i], undeletableFiles );
-        	} else {
-           	if( !files[i].delete() ){
-           	undeletableFiles.add(files[i].getAbsolutePath());
-                }
-            }
-         }
-      }
-
-    	if( ! path.delete() )
-              undeletableFiles.add( path.getAbsolutePath() );
-      }
-
-
-}// class RarTest

Deleted: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java	2009-05-06 19:17:03 UTC (rev 389)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java	2009-05-06 21:15:45 UTC (rev 390)
@@ -1,1283 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.jopr.jsfunit.as5;
-
-import com.gargoylesoftware.htmlunit.Page;
-import javax.faces.application.FacesMessage.Severity;
-import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletRequest;
-import com.gargoylesoftware.htmlunit.WebClient;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
-
-import org.jboss.jopr.jsfunit.*;
-import com.gargoylesoftware.htmlunit.html.*;
-import java.io.*;
-import java.util.Properties;
-import javax.faces.application.FacesMessage;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
-import org.apache.commons.lang.math.RandomUtils;
-import org.jboss.jopr.jsfunit.exceptions.*;
-import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
-import org.jboss.jopr.jsfunit.util.DescribedCondition;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
-import org.w3c.dom.Node;
-
-/**
- * This class contains tests for testing the EmbJopr Application
- * Management Functions for Web Components with JBoss AS 5.
- *
- * Most tests currently fail because of 
- * JBAS-6640: Undeploying and deploying the same WAR in short time fails.
- */
-public class WarTest extends ApplicationTestBaseAS5 {
-
-	public static final int DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL = 6000;
-	public static final int DEPLOY_UP_STATE_WAIT_CHECK_RETRIES = 50;
-
-	public static final DeployableTypes APP_TYPE = DeployableTypes.WAR;
-
-	
-
-	/**
-	 * @return the suite of tests being tested
-	 */
-	public static Test suite() {
-		return new TestSuite(WarTest.class);
-	}
-
-
-	/*
-	 * testName: testBasicWarDeployment
-	 * assertion:  verify basic deployment of an EJB JAR.
-	 * test Strategy:  Navigate to WAR Applications.
-	 *      Add a new resource.  Verify the resource was successfully
-	 *      deployed.  Undeploy the archive.
-	 *
-	 */
-	public void testBasicWarDeployment()
-					throws IOException, HtmlElementNotFoundException, ActionNotAvailableException
-	{
-
-		final String DEPLOYABLE_NAME = BASIC_WAR;
-
-		String filePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-
-		try {
-			deployWAR( filePath );
-
-			// Check the success message.
-			String expectedMessage = "Resource hellothere.war created successfully!";
-			checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
-			// Use JMX to assert that the WAR really did deploy successfully
-			assertTrue("WAR was not deployed according to JMX", isWarDeployed(DEPLOYABLE_NAME));
-
-			// use HtmlUnit to test the newly deployed war in a new WebClient session
-			// note that I have full access to the FacesContext and the previous request
-			//Thread.sleep(3000); // Give JBoss some time to launch the webapp.
-			HttpServletRequest request =
-				 (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
-			int port = request.getLocalPort();
-			WebClient webClient = new WebClient();
-			HtmlPage page = (HtmlPage)webClient.getPage("http://localhost:" + port + "/hellothere/hello.jsp");
-			assertTrue(page.asText().contains("HELLO WORLD"));
-
-		}
-		finally {
-			// Undeploy the WAR
-			/*HtmlButtonInput deleteButton = getAppDeleteButton(DEPLOYABLE_NAME);
-			deleteButton.click();
-			/*/
-			undeployWAR(DEPLOYABLE_NAME);
-			/**/
-
-		}
-	}
-
-
-
-
-
-	/**
-	 * Tries to deploy a invalid WAR (with invalid descriptor)
-	 * and checks that EmbJopr rejects this deployment.
-	 */
-	public void testBadWarRedeploy() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME = AppConstants.WAR_FILENAME_MALFORMED_APP;
-
-		try {
-
-			String filePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-			deployWAR(filePath);
-
-			checkClientAndServerMessages("Failed to create Resource", "Failed to create Resource", true);
-		}
-		finally {
-			undeployWAR(DEPLOYABLE_NAME);
-		}
-	}
-
-
-
-
-
-
-	/**
-	 * Various ways to navigate to a WAR application:
-	 * Nav tree, apps listing, WARs listing.
-	 */
-	public void testNavigationToWar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException, ActionOutOfSyncException
-	{
-
-		// JBossAS Servers node
-		NavTreeNode nodeServers = ejtt.getNavTree().getNodeByLabel("JBossAS Servers");
-		nodeServers.click();
-
-		{
-			String headerText = "JBossAS Server";
-			String jbossConfig = ejtt.getJBossConfig();
-
-			assertTrue("Page doesn't contain the header: "+headerText,
-							client.getPageAsText().contains(headerText));
-
-			assertTrue("EmbJopr should list at least one server (the one it is running on)" +
-							" and that should be in the UP sate.",
-							client.getPageAsText().contains("UP"));
-			// Check whether the server is listed. If not, Exception is thrown.
-			ContentTableRow row =
-							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("JBoss Application Server")
-							.getFirstRowContainingLink("JBoss AS 5 ("+jbossConfig+")");
-			// Click the server link
-			//HtmlAnchor link row.getLinkByLabel("JBoss App Server:default");
-			Node firstLink = row.getCellByColumnName("Name").getElementsByTagName("a").item(0);
-			if( null == firstLink || !(firstLink instanceof HtmlAnchor) )
-				throw new HtmlElementNotFoundException("Can't find the server link.");
-
-			((HtmlAnchor)firstLink).click();
-		}
-
-		// JBoss App Server:${config} node
-		{
-			String pageText = client.getPageAsText();
-
-			String jbossConfig = ejtt.getJBossConfig();
-			String headerText = "JBoss AS 5 ("+jbossConfig+")";
-			assertTrue("Page doesn't contain the header: "+headerText,
-							pageText.contains(headerText));
-
-			headerText = "General Properties";
-			assertTrue("Page doesn't contain the header: "+headerText,
-							pageText.contains(headerText));
-
-			// TODO: This page reports "Version:5.0 CR1" - EMBJOPR-77
-
-			ejtt.getNavTree().getNodeByLabel("Applications").click();
-
-		}
-
-
-		// Applications node
-		{
-
-			ejtt.getTabMenu().clickTab("Summary");
-
-			// TODO: Pagination options: EMBJOPR-78
-			// resourceDataScroller.xhtml, TableManager.java, "pageSizes".
-
-
-			// There's at least one Application with State == UP.
-			//ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Different types of Applications");
-			HtmlTable tableElement = (HtmlTable)client.getElement("categorySummaryForm:dataTable");
-			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTable(tableElement);
-			ContentTableRow row = table.getFirstRowContainingText("UP");
-
-			// Go further - try to click on any Application that is up.
-			HtmlAnchor link = row.getFirstLinkFromColumn("Name");
-			link.click();
-		}
-
-
-		{
-			// Go back to applications Sumary screen.
-			ejtt.getNavTree().getNodeByLabel("Applications").click();
-		}
-
-
-		// Concrete appliction node.
-		{
-
-			final String DEPLOYABLE_NAME = BASIC_WAR_02;
-
-			// Deploy the WAR.
-			String filePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-			deployWarRepeatedly( filePath );
-
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-
-			// Get to the app through listing.
-			log.debug("Looking for row with: "+DEPLOYABLE_NAME);
-
-			// Commented out: we would have to click trough pages.
-			//ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			ContentTableRow row = ejtt.getTabMenu().getTabContentBox()
-							.findLinkRowInDataTableUsingPagination(DEPLOYABLE_NAME);
-
-			assertTrue("Page doesn't list "+DEPLOYABLE_NAME+" in Summary tab.", row != null );
-
-			 // Go to the summary through listed item.
-			row.getLinkByLabel(DEPLOYABLE_NAME).click();
-			/**/
-
-			
-			// Other way to get to app: through nav tree.
-			ejtt.getNavTree().getNodeArrow(NAV_WAR).click();
-			ejtt.navTree.waitUntilNodeLoadedByAjax(DEPLOYABLE_NAME, 500, 15);
-			ejtt.navTree.getNodeByLabel(DEPLOYABLE_NAME).click();
-			/**/
-
-
-			// Check that we have the summary tab for the selected WAR.
-			assertTrue( "WAR name "+DEPLOYABLE_NAME+" not found in the content box.",
-				ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(DEPLOYABLE_NAME) );
-
-			// Go to the summary through nav tree node.
-			NavTreeNode appNode = ejtt.getNavTree().getNodeByLabel(NAV_WAR);
-			if( !appNode.isExpanded() ){
-				log.info("Expanding.");
-				appNode.getArrowLink().click();
-				Thread.sleep(2000);
-			}
-			ejtt.getNavTree().getNodeByLabel(DEPLOYABLE_NAME).click();
-			// Check that we have the summary tab for the selected WAR.
-			ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(DEPLOYABLE_NAME);
-
-			undeployWAR(DEPLOYABLE_NAME);
-
-		}
-
-
-	}// testNavigationToWar()
-
-
-
-
-
-
-
-	/**
-	 * Tests the values shown in the Summary tab of WAR.
-	 *
-	 *  FAILS because of:  EMBJOPR-110 (missing / at the beginning of the path)
-	 */
-	public void testWarSummaryTab() throws EmbJoprTestException, IOException, Exception {
-
-		final int DEPLOY_TIMEOUT_SEC = 120;
-
-		final String DEPLOYABLE_NAME = BASIC_WAR_03;
-
-		// Deploy the WAR
-		String appFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/war/"+DEPLOYABLE_NAME;
-		deployWarRepeatedly( appFilePath );
-
-		try {
-
-			// Wait until the WAR appears...
-			// Should be present when the page is reloaded.
-			// TODO: Replace with waitUntil~()
-			new ActiveConditionChecker(new DescribedCondition("WAR appears in Summary tab list") {
-				public boolean isTrue() throws Exception {
-					// Refresh, then check.
-					ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-					ContentTableRow appRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(DEPLOYABLE_NAME);
-					return null != appRow;
-				}
-			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
-			/**/
-
-
-			ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-
-			// Wait until the Status is "UP".
-			// TODO: Replace with ActiveConditionChecker.
-			int maxLoops = DEPLOY_TIMEOUT_SEC;
-			do {
-				String statusText = appRow.getCellTextByColumnName("Status");
-				log.debug("WAR Status: "+statusText);
-				if( "UP".equals(statusText) )
-					break;
-
-				// Refresh page after 1 second.
-				ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-				appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-
-				// We don't want an infinite loop by mistake.
-				if( maxLoops-- <= 0 ){
-					throw new EmbJoprTestException("WAR "+DEPLOYABLE_NAME+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
-				}
-			} while( true );
-
-			// FAILS because of EMBJOPR-80.
-			appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
-
-
-			// Check the values in info table(s)
-
-			// General Properties
-			HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
-			ContentInfoTable infoTable = ejtt.getContentInfoTable( genpropTable );
-			Properties props = infoTable.getProperties();
-			log.info("General Properties: "+props.toString());
-
-			assertEquals(DEPLOYABLE_NAME, props.getProperty("Name").trim());
-			//assertEquals("?", props.getProperty("Version")); // TODO: Where does RHQ get the version from?
-
-
-			// Resource Traits
-			infoTable = ejtt.getContentInfoTable(
-							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
-			props = infoTable.getProperties();
-			log.info("Resource Traits: "+props.toString());
-			log.debug("Path: "+props.getProperty("Path"));///
-
-
-			String path = ejtt.getDeployDir()+"/"+DEPLOYABLE_NAME;
-			assertEquals(path, props.getProperty("Path").trim()); // EMBJOPR-110 here
-			assertEquals("no", props.getProperty("Exploded?").trim());
-
-			// Metrics Summary
-			HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Metrics Summary").getElement();
-			infoTable = ejtt.getContentInfoTable(summaryTable);
-			// (nothing here yet)
-
-
-		}
-		finally {
-			// Undeploy the WAR
-			undeployWAR( DEPLOYABLE_NAME );
-		}
-
-	}// testWarSummary()
-
-
-
-
-
-
-
-	/**
-	 * Changes WAR configuration, and checks whether the changes were saved.
-	 *
-	 */
-	public void testWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
-
-		final String DEPLOYABLE_NAME = BASIC_WAR_04;
-
-		// Deploy the WAR.
-		String filePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
-		deployWarRepeatedly( filePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
-
-			// Navigate to the Configuration tab
-			ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
-
-			Page prevPage = client.getContentPage();
-			ejtt.tabMenu.clickConfigurationTab();
-			assertNotSame("We should move to other page after clicking the Config tab.",
-							prevPage, client.getContentPage());
-
-			// Read properties.
-			Properties props = new Properties();
-			String propsFilePath = ejtt.getTestDataDir()+"/war/"+"war-conf-basic.properties";
-			props.load(new FileInputStream( propsFilePath ));
-
-
-			// Set the configuration options and Save
-			fillOutForm(props);
-			//ejtt.getTabMenu().getTabContentBox().getButtonByLabel("Save");
-			ejtt.getClickableByID("resourceConfigurationForm:saveButton").click();
-
-
-			// Check whether the properties were saved.
-			ejtt.tabMenu.clickConfigurationTab();
-
-			// TODO: We don't see the success message! EMBJOPR-89
-			//checkClientAndServerMessages("successfully", "successfully", false);
-
-			// FAILS because some of the values are read-only.  EMBJOPR-96
-			checkForm(props);
-
-			// TODO: Finish when the properties are marked read-only.
-
-		}
-		finally {
-			undeployWAR(DEPLOYABLE_NAME);
-		}
-
-	}
-
-
-
-
-
-	/**
-	 * Changes WAR configuration, and verifies that the changes were NOT saved.
-	 *
-	 * FAILS because some of the values are read-only.  EMBJOPR-96
-	 */
-	public void testWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME = BASIC_WAR_05;
-
-		// Deploy the WAR.
-		String filePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
-		deployWarRepeatedly( filePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
-							DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
-
-			// Navigate to the Configuration tab
-			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			row.getLinkByLabel(DEPLOYABLE_NAME).click();
-
-			Page prevPage = client.getContentPage();
-			ejtt.tabMenu.clickConfigurationTab();
-			assertNotSame("We should move to other page after clicking the Config tab.",
-							prevPage, client.getContentPage());
-
-
-			// Load properties (we will use their names).
-			Properties propsToSet = new Properties();
-			String propsFilePath = ejtt.getTestDataDir()+"/war/"+"war-conf-basic.properties";
-			propsToSet.load(new FileInputStream( propsFilePath ));
-
-			// Get the current properties.
-			Properties propsOriginal = getFormPropertiesValues( propsToSet );
-
-
-			// Set the configuration options and CANCEL
-			fillOutForm( propsToSet );
-			ejtt.getClickableByID("resourceConfigurationForm:cancelButton").click();
-
-
-			// TODO: We should get back to Conf tab automatically: EMBJOPR-100
-			ejtt.tabMenu.clickConfigurationTab();
-
-			// Now check whether the values are the same as before editing.
-			checkForm( propsOriginal );
-
-		}
-		finally {
-			undeployWAR(DEPLOYABLE_NAME);
-		}
-
-	}
-
-
-
-
-	/**
-	 * Redeploys WAR, using WAR's Content tab upload form.
-	 *
-	 * Fails because of:  EMBJOPR-109
-	 */
-	public void testWarRedeployment() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME = BASIC_WAR_06;
-
-		// Deploy the WAR.
-		String appFilePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
-		deployWarRepeatedly( appFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
-
-			// Navigate to the Configuration tab
-			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			row.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.tabMenu.clickContentTab();
-
-			String xPath = ".//table//input[@type='file']";
-			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			fileInput.setValueAttribute(appFilePath);
-			xPath = ".//table//input[@type='submit']";
-			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
-			submit.click();
-
-		}
-		finally {
-			try {
-				DebugUtils.writeFile("target/redeployment.html", client.getPageAsText());///
-				undeployWAR(DEPLOYABLE_NAME); // EMBJOPR-109 here
-			}catch( Exception ex ){
-				log.error("Exception caught in finally: "+ex.getMessage(), ex);
-			}
-		}
-
-	}
-
-
-	/**
-	 * Deploys the WAR, undeploys it and deploys again.
-	 * All these actions are done using EmbJopr.
-	 *
-	 * Fails because of EMBJOPR-125
-	 */
-	public void testWarDeployUndeployDeploy() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME = BASIC_WAR_DUD;
-
-
-		// Deploy the WAR.
-		String appFilePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
-		deployWarRepeatedly( appFilePath );
-
-		try {
-
-			// Undeploy.
-			log.info("Undeploying "+DEPLOYABLE_NAME);
-			undeployWAR(DEPLOYABLE_NAME);
-			//DebugUtils.writeFile("target/DUD-undeploy.html", client.getPageAsText());///
-			assertFalse( "Deployable "+DEPLOYABLE_NAME+" shouldn't be listed as deployed after undeployment.",
-							ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
-
-			// Deploy the same war again.
-			log.info("Deploying "+DEPLOYABLE_NAME+" again.");
-			deployWAR( appFilePath );
-			//DebugUtils.writeFile("target/DUD-deploy.html", client.getPageAsText());///
-			// EMBJOPR-125 here.
-			assertTrue( "Deployable "+DEPLOYABLE_NAME+" should be listed as deployed after deployment.",
-							ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
-
-		}
-		finally {
-			try {
-				DebugUtils.writeFile("target/testDeployUndeployDeploy-finally.html", client.getPageAsText());///
-				undeployWAR(DEPLOYABLE_NAME);
-			}catch( Exception ex ){
-				log.error("Exception caught in finally: "+ex.getMessage(), ex);
-			}
-		}
-
-	}
-
-
-
-	/**
-	 * Deploys the WAR, undeploys it and deploys again.
-	 * All these actions are done using EmbJopr.
-	 */
-	public void testWarDeployUndeployDeployRetryOnErrors() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME = BASIC_WAR_DUD_RETRY;
-
-
-		// Deploy the WAR.
-		String appFilePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
-		deployWarRepeatedly( appFilePath );
-
-		try {
-
-			// Undeploy.
-			log.info("Undeploying "+DEPLOYABLE_NAME);
-			undeployWAR(DEPLOYABLE_NAME); // EMBJOPR-109 here
-			DebugUtils.writeFile("target/DUD_RETRY-undeploy.html", client.getPageAsText());///
-			assertFalse( "Deployable "+DEPLOYABLE_NAME+" shouldn't be listed as deployed after undeployment.",
-							ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
-
-			// Deploy the same war again.
-			log.info("Deploying "+DEPLOYABLE_NAME+" again.");
-			deployWarRepeatedly( appFilePath );
-			DebugUtils.writeFile("target/DUD_RETRY-deploy.html", client.getPageAsText());///
-			assertTrue( "Deployable "+DEPLOYABLE_NAME+" should be listed as deployed after deployment.",
-							ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
-
-		}
-		finally {
-			try {
-				DebugUtils.writeFile("target/testDeployUndeployDeployRetryOnErrors-finally.html", client.getPageAsText());///
-				undeployWAR(DEPLOYABLE_NAME); // EMBJOPR-109 here
-			}catch( Exception ex ){
-				log.error("Exception caught in finally: "+ex.getMessage(), ex);
-			}
-		}
-
-	}
-
-
-
-	/**
-	 * Deploys exploded WAR and checks whether it is reported as exploded.
-	 *
-	 * DISABLED - Badly written test, to be fixed. TODO: Hot-deploy
-	 */
-	public void DISABLEDtestUnzippedWarReportedAsExploded() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME = BASIC_WAR_07;
-
-		// Deploy the WAR.
-		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-		deployWarRepeatedly( WARFilePath );
-
-		try {
-			// Wait for WAR to be deployed and UP
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
-
-			// Click the WAR link 
-			ejtt.getTabMenu().getTabContentBox().getFirstTable()
-							.getFirstRowContainingText(DEPLOYABLE_NAME).getFirstLinkFromColumn("Name").click();
-
-			DebugUtils.writeFile("target/res_traits.html", client.getPageAsText());///
-
-			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits");
-			ContentInfoTable infoTable = ejtt.getTabMenu().getTabContentBox().getContentInfoTable(table.getElement());
-			Properties props = infoTable.getProperties();
-			log.info("Resource Traits: "+props.toString());
-			log.debug("Exploded?: "+props.getProperty("Exploded?"));
-
-			assertEquals("'Exploded?' should be 'yes'", "yes", props.getProperty("Exploded?")/*.toLowerCase()*/ );
-
-		}
-		finally {
-			undeployWAR(DEPLOYABLE_NAME);
-		}
-
-	}
-
-
-
-
-	/**
-	 * Checks WAR metrics tab.
-	 * 
-	 * FAILS because of:  EMBJOPR-110 (missing / at the beginning of the path)
-	 */
-	public void testWarMetricsTab() throws IOException, EmbJoprTestException {
-
-		final String DEPLOYABLE_NAME = BASIC_WAR_08;
-
-		// Deploy the WAR.
-		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-		deployWarRepeatedly( WARFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
-
-			// Navigate to the Metrics tab
-			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			row.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.tabMenu.clickMetricsTab();
-
-			// Resource Traits
-
-			// Check the Path.
-			HtmlTable tbl = ejtt.getTabMenu().getTabContentBox().
-							getTableUnderHeader("Trait Values").getElement();
-			ContentInfoTable infoTable = ejtt.getContentInfoTable( tbl );
-			Properties props = infoTable.getProperties();
-
-			log.debug("Trait Values: "+ props.toString());
-
-			String path = ejtt.getDeployDir()+"/"+DEPLOYABLE_NAME;
-			assertEquals(path, props.getProperty("Path").trim());
-
-
-		}
-		finally {
-			undeployWAR(DEPLOYABLE_NAME);
-		}
-
-	}
-
-
-	/**
-	 * Changes WAR configuration, and checks whether the changes were saved.
-	 *
-	 * FAILS because some of the values are read-only.  EMBJOPR-96
-	 */
-	public void testWarMetricsTabRefreshButton() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
-
-		final String DEPLOYABLE_NAME = BASIC_WAR_09;
-
-		// Deploy the WAR.
-		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-		deployWarRepeatedly( WARFilePath );
-
-		try {
-
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
-							DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
-
-			// Navigate to the Metrics tab
-			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			row.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.tabMenu.clickMetricsTab();
-
-			// Click the Refresh button.
-			// Can this change to submit? Perhaps set an ID and use ejtt.getClickableById().
-			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Refresh").click();
-
-			// Check that we are still on the right tab.
-			assertTrue("Metrics tab is active", ejtt.tabMenu.isTabActive("Metrics") );
-			assertTrue("Page contains WAR name", client.getPageAsText().contains(DEPLOYABLE_NAME) );
-			assertTrue("Page contains 'Refresh'", client.getPageAsText().contains("Refresh") );
-
-		}
-		finally {
-			undeployWAR(DEPLOYABLE_NAME);
-		}
-
-	}
-
-
-	/**
-	 * Deploys an exploded WAR application.
-	 *
-	 * FAILS when undeploying, because:
-	 *
-org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException: Couldn't delete following files:
-  /home/ondra/work/JOPRembedded/embjopr-svn-trunk/jsfunit/target/jboss5x/deploy/unpacked-web1.war
-
-	at org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit$Deployment.deleteDirectory(EmbJoprTestToolkit.java:1662)
-	at org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit$Deployment.deleteFromDeployDir(EmbJoprTestToolkit.java:1652)
-	at org.jboss.jopr.jsfunit.as5.WarTest.testDeployUnpackedWar(WarTest.java:663)
-	 *
-	 * TODO:  Catch exceptions in finally and log them only (in all tests),
-	 *        to get the eventual real exception from the try block.
-	 *
-	 * TODO:  Think up how to simulate hot-undeploy.
-	 *				Should we rename it to other dir and then delete?
-	 *
-	 *        Perhaps it just still didn't process the deployed war when trying to undeploy?
-	 *				  "Condition 'WAR unpacked-web1.war appears in embjopr as deployed' not satisfied,
-	 *           0 retries left. Leaving the wait loop."
-	 *        Should we wait more? Or is it caused by failures of some previous tests?
-	 *
-	 */
-	public void testDeployUnpackedWar() throws IOException, EmbJoprTestException {
-
-
-		// Deploy the unpacked WAR.
-		// We have to use hotdeploy - can't upload a directory.
-		//ejtt.deployment.unzipToDeployDir("war/"+WAR_UNPACKED_ZIP, "");
-		String archivePath = ejtt.getTestDataDir()+"/war/"+WAR_UNPACKED_ZIP;
-		String tempDir = ejtt.getTempDir();
-		String destDir = ejtt.getDeployDir();
-
-		log.info("Unzipping "+archivePath+" to "+tempDir);
-		ejtt.deployment.unzipArchive( archivePath, tempDir );
-
-		log.info("Moving "+tempDir+"/"+WAR_UNPACKED+" to "+destDir+"/"+WAR_UNPACKED);
-		ejtt.deployment.moveDir(tempDir+"/"+WAR_UNPACKED, destDir+"/"+WAR_UNPACKED);
-		
-
-
-		try {
-			// Loop, wait for the app to appear.
-			log.info("Waiting for WAR to appear.");
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, WAR_UNPACKED,
-						DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
-
-
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-
-			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(WAR_UNPACKED);
-
-			// TODO: Finish
-
-			// TODO: Check whether Exploded?:  yes.  EMBJOPR-95
-
-			// TODO: DeploymentUtils, DeployableTypes, isAvailable enum inner classes
-
-			// TODO: Preliminary test - check system properties, their validity, java version, etc.
-		}
-		finally {
-			// Delete the WAR dir.
-			ejtt.deployment.deleteFromDeployDir(WAR_UNPACKED);
-		}
-	}
-
-
-
-
-	/**
-	 * Stops and starts the WAR using buttons in the Control tab, and checks
-	 * whether it's really stopped and started by sending HTTP requests.
-	 */
-	public void testStopAndStartWar() throws IOException, EmbJoprTestException
-	{
-		final String DEPLOYABLE_NAME = BASIC_WAR_STOPSTART;
-
-		// Get the HTTP port and the URL of the test page.
-		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
-		int port = tmpRequest.getLocalPort();
-		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".war" ); // Eventually remove ".war" suffix.
-		String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
-
-		// Create web client we will use to check the web app.
-		WebClient webClient = new WebClient();
-		// We'll get 404 after stopping the app.
-		webClient.setThrowExceptionOnFailingStatusCode(false);
-		HtmlPage page;
-
-
-		// Deploy the WAR.
-		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-		deployWarRepeatedly( WARFilePath );
-
-		try {
-
-			// Wait until app is UP
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
-							DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
-
-			// Assert that the app is running.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
-      assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
-
-			// Refresh the page several times to increase the counter.
-			page = (HtmlPage) page.refresh();
-			page = (HtmlPage) page.refresh();
-
-			// Get the counter number.
-			String count1text = page.getBody().getHtmlElementById("count").getTextContent();
-			Integer count1 = NumberUtils.createInteger( count1text );
-
-
-
-			// Navigate to the web app, then to it's Control tab.
-			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			row.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.getTabMenu().clickControlTab();
-
-			// Click the Stop button.
-			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Stop").click();
-
-			// Check the latest message.
-			/*
-			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
-			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tr[contains(@class, 'rich-table-firstrow')]");
-			assertTrue( tr.getTextContent().contains("Success") );
-			/**/
-			assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
-
-
-			// Assert that the app is stopped.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertTrue( 200 != page.getWebResponse().getStatusCode() );
-
-
-			// Click the Start button.
-			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start").click();
-
-			// Check the latest message. TODO: EJTT class for ops history table?
-			/*
-			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getElement();
-			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
-			assertTrue( tr.getTextContent().contains("Success") );
-			*/
-			assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
-
-
-			// Assert that the app is running.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertTrue( 200 == page.getWebResponse().getStatusCode() );
-      assertTrue(page.asText().contains("HELLO WORLD"));
-
-			// Get the counter number.
-			String count2text = page.getBody().getHtmlElementById("count").getTextContent();
-			Integer count2 = NumberUtils.createInteger( count2text );
-
-			assertTrue( "Counter is reset upon app restart, thus should be lower after. " +
-							"Old: "+count1text+" New: "+count2text, count1 > count2 );
-
-
-		}
-		finally {
-			undeployWAR(DEPLOYABLE_NAME);
-		}
-	}
-
-
-	/**
-	 * Restarts the WAR using button in the Control tab,
-	 * and checks whether it's really restarted by checking whether JSP variable was reset.
-	 */
-	public void testRestartWar() throws IOException, EmbJoprTestException
-	{
-		final String DEPLOYABLE_NAME = BASIC_WAR_RESTART;
-
-		// Get the HTTP port and the URL of the test page.
-		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
-		int port = tmpRequest.getLocalPort();
-		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".war" ); // Eventually remove ".war" suffix.
-		String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
-
-		// Create web client we will use to check the web app.
-		WebClient webClient = new WebClient();
-		webClient.setThrowExceptionOnFailingStatusCode(false);
-		HtmlPage page;
-
-
-		// Deploy the WAR.
-		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-		deployWarRepeatedly( WARFilePath );
-
-		try {
-
-			// Wait until app is UP
-			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
-							DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
-
-			// Assert that the app is running.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
-      assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
-
-			// Refresh the page several times to increase the counter.
-			page = (HtmlPage) page.refresh();
-			page = (HtmlPage) page.refresh();
-
-			// Get the counter number.
-			String count1text = page.getBody().getHtmlElementById("count").getTextContent();
-			Integer count1 = NumberUtils.createInteger( count1text );
-
-
-
-			// Navigate to the web app, then to it's Control tab.
-			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
-			row.getLinkByLabel(DEPLOYABLE_NAME).click();
-			ejtt.getTabMenu().clickControlTab();
-
-			// Click the Restart button.
-			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Restart").click();
-
-			// Check the latest message. TODO: EJTT class for ops history table?
-			/*
-			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getElement();
-			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
-			assertTrue( tr.getTextContent().contains("Success") );
-			*/
-			assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
-			
-
-			// Assert that the app is running.
-      page = (HtmlPage)webClient.getPage(testPageUrl);
-			assert( 200 == page.getWebResponse().getStatusCode() );
-      assertTrue(page.asText().contains("HELLO WORLD"));
-
-			// Get the counter number.
-			String count2text = page.getBody().getHtmlElementById("count").getTextContent();
-			Integer count2 = NumberUtils.createInteger( count2text );
-
-			assertTrue( "Counter is reset upon app restart, thus should be lower after. " +
-							"Old: "+count1text+" New: "+count2text, count1 > count2 );
-
-		}
-		finally {
-			try {
-				undeployWAR(DEPLOYABLE_NAME);
-			} catch( Exception ex ){
-				DebugUtils.writeFile("target/testRestartWar-undeploy.html", client.getPageAsText());///
-				log.debug("Cathed an expected exception when trying to undeploy "+DEPLOYABLE_NAME+": "+ex );
-			}
-		}
-	}
-
-
-
-
-	/**
-	 * Deploys a WAR with bad farchive extension (.zip)
-	 * and checks whether EmbJopr reports deployment failure.
-	 */
-	public void testDeployWarWithIncorrectExtension() throws IOException, EmbJoprTestException
-	{
-		final String DEPLOYABLE_NAME = WAR_UNPACKED_ZIP;
-
-
-		// Deploy the WAR.
-		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-		deployWAR( WARFilePath );
-
-		try {
-
-			assertTrue( "There should be a faces message informing about failure.",
-							server.getFacesMessages().hasNext() );
-
-			assertTrue( "The failure message should have ERROR severity.",
-							FacesMessage.SEVERITY_ERROR == server.getFacesMessages().next().getSeverity() );
-
-			assertTrue( "Page should contain 'Incorrect extension' string (deployer message).",
-				client.getPageAsText().contains("Incorrect extension") );
-
-		}
-		finally {
-			// Undeploy for the case it was (errorneously) deployed.
-			try {
-				undeployWAR(DEPLOYABLE_NAME);
-			} catch( Exception ex ){
-				log.debug("Cathed an expected exception when trying to undeploy "+DEPLOYABLE_NAME+": "+ex );
-			}
-		}
-	}
-
-
-	/**
-	 * Deploys a WAR and checks that it doesn't appear under the Embedded Web App's node.
-	 */
-	public void testStandaloneWarDoesntAppearInEmbeddedWars() throws IOException, EmbJoprTestException
-	{
-		final String DEPLOYABLE_NAME = BASIC_WAR_10;
-
-
-		// Deploy the WAR.
-		String appFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
-
-		try {
-			
-			deployWAR( appFilePath );
-
-			ejtt.navTree.getNodeByLabel(DeployableTypes.EMB_WAR.getNavTreeLabel()).getLabelLink().click();
-
-			assertFalse( ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.EMB_WAR, DEPLOYABLE_NAME, false) );
-
-		}
-		finally {
-			// Undeploy for the case it was (errorneously) deployed.
-			try {
-				undeployWAR(DEPLOYABLE_NAME);
-			} catch( Exception ex ){
-				log.debug("Cathed an expected exception when trying to undeploy "+DEPLOYABLE_NAME+": "+ex );
-			}
-		}
-	}
-
-
-	/**
-	 * Hot-deploy several WARs and check that after some time, all of them are deployed and UP.
-	 */
-	public void testWarHotDeployManyWarsAtOnce() throws IOException, EmbJoprTestException
-	{
-		final String TEMP_DEPLOYABLE_NAME = BASIC_WAR_MULTI_HOTDEPLOY;
-		final int APP_COPIES = 25;
-
-		final String fileNamePattern = "multiHotdeploy%d"+APP_TYPE.getExtension();
-
-		try {
-
-			// Hot-deploy several WARs.
-			String fileSrcPath = ejtt.getTestDataDir() +"/"+APP_TYPE.getDataDir()+"/"+ TEMP_DEPLOYABLE_NAME;
-			for (int i = 0; i < APP_COPIES; i++) {
-				String fileDestPath = ejtt.getDeployDir() +"/"+ String.format(fileNamePattern, i);
-				FileUtils.copyFile( new File(fileSrcPath), new File(fileDestPath) );
-			}
-
-			// Wait for them to get displayed and UP.
-			for (int i = 0; i < APP_COPIES; i++) {
-				String deployableName = String.format(fileNamePattern, i);
-				ejtt.deployment.waitActivelyForDeployment(APP_TYPE, deployableName, 5000, 10);
-			}
-
-		}
-		finally {
-			// Undeploy all of them.
-			for (int i = 0; i < APP_COPIES; i++) {
-				String deployableName = String.format(fileNamePattern, i);
-				try {
-					//undeployWAR( deployableName ); // TODO: Generalize
-					ejtt.deployment.undeployViaEmbJopr(APP_TYPE, deployableName);
-				} catch( Exception ex ){
-					log.warn("Cathed an expected exception when trying to undeploy "+deployableName+": "+ex );
-				}
-			}
-		}
-		
-	}// testWarHotDeployManyWarsAtOnce()
-
-
-
-
-
-
-
-
-
-
-	/**
-	 * Deploys WAR.
-	 */
-	private void deployWAR( String warFilePath )
-					throws IOException, HtmlElementNotFoundException
-	{
-		if( !(new File(warFilePath)).exists())
-			throw new FileNotFoundException(warFilePath);
-		
-		log.info("Deploying: "+warFilePath);
-
-		// Navigate to Enterprise Archives
-		//ejtt.getNavTree().getNodeLink(NAV_WAR).click();
-		ejtt.getNavTree().getNodeLink(AppConstants.DeployableTypes.WAR.getNavTreeLabel()).click();
-
-		// click on the "Add new resource" button
-		client.click("actionHeaderForm:addNewContent");  // 404 if setThrowExceptionOnFailingStatusCode(true) above
-
-		// Upload the file
-		HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
-		fileInput.setContentType("application/war");
-		fileInput.setValueAttribute(warFilePath);
-		client.click("createContentForm:addButton");
-
-		// Log server message.
-		ejtt.logServerMessage();
-
-		// Todo: Write some waitUntilDeployed().
-		ejtt.sleep( 2000 );
-
-	}
-
-
-
-	/**
-	 * Deploys WAR; if fails, waits 5 seconds and re-tries; this is repeated 3 times.
-	 */
-	private void deployWarRepeatedly( final String warFilePath )
-					throws IOException, HtmlElementNotFoundException, EmbJoprTestException
-	{
-
-		File warFile = new File(warFilePath);
-		final String warFileName = warFile.getName();
-
-		try {
-
-			// Try it 5x in 5 second interval.
-			new ActiveConditionChecker( new DescribedCondition("WAR '"+warFileName+"' succesfuly deployed") {
-				public boolean isTrue() throws Exception {
-					deployWAR(warFilePath);
-
-					// Check whether deployment ended with success message.
-					/* Now broken, EmbJopr reports an error even when deployed successfully:
-					 * Failed to create Resource hellothere.war - cause:
-							java.lang.RuntimeException:java.lang.NullPointerException
-					 -> java.lang.NullPointerException:null
-					 * See EMBJOPR-116
-					 */
-					/*
-					if( server.getFacesMessages().hasNext() ){
-						FacesMessage msg = server.getFacesMessages().next();
-						if( msg.getSeverity() == FacesMessage.SEVERITY_INFO )
-							return true;
-						else
-							ejtt.logServerMessage("Deployment error: ");
-					}
-					*/
-
-					// Check whether the WAR is listed in EmbJopr.
-					log.debug("Looking for listed WAR: "+warFileName);
-					boolean listed = ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, warFileName, true);
-					if( listed )
-						return true;
-					else
-						return false;
-				}
-			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(5000, 8);
-
-		}
-		catch( Exception ex ){
-			throw new EmbJoprTestException(ex.getClass().getName()+": "+ex.getMessage(), ex);
-		}
-
-
-	}// deployWarRepeatedly()
-
-
-	/**
-	 * Undeploys war.
-	 *
-	 * TODO: When tested, merge to EJTT.Deployment.
-	 */
-	private void undeployWAR( String warFileName )
-					throws IOException, HtmlElementNotFoundException, ActionNotAvailableException
-	{
-
-		// Navigate to Enterprise Archives
-		ejtt.getNavTree().getNodeLink(NAV_WAR).click();
-
-		ejtt.getTabMenu().clickSummaryTab();
-
-		/// Debug log - we're getting HTTP 500 here :/
-		String dumpFile = "target/"+this.getName()+"-undeployWar-"+(1000+RandomUtils.nextInt(1000))+".html";
-		log.debug("Dumping page to "+dumpFile);
-		DebugUtils.writeFile( dumpFile, client.getPageAsText());
-		int httpStatusCode = client.getContentPage().getWebResponse().getStatusCode();
-		if( 200 != httpStatusCode )
-			log.warn("Status code before undeployment is: "+httpStatusCode);
-
-		//HtmlButtonInput deleteButton = getAppDeleteButton( warFileName ).click();
-
-		// Find the row containing the deployable. Use the pagination if needed.
-		ContentTableRow appRow = ejtt.getTabMenu().getTabContentBox().
-						findLinkRowInDataTableUsingPagination(warFileName);
-
-		/// DEBUG dump
-		//log.debug("Dumping page to: "+dumpFile+"2");
-		//DebugUtils.writeFile(dumpFile+"2", client.getPageAsText());
-
-		if( null == appRow ){
-			log.warn("Can't find row with WAR to undeploy: "+warFileName);
-			return;
-		}
-
-		appRow.getButtonByLabel("Delete").click();
-
-		// Log the message (with prefix of potential warning)
-		ejtt.logServerMessage("Something went wrong with undeploy: ");
-
-		// Sleep for 3 sec. TODO: write some waitForUndeployed(), as negation of opposite.
-		ejtt.sleep( 2000 );
-
-	}
-
-}
-

Added: 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	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java	2009-05-06 21:15:45 UTC (rev 390)
@@ -0,0 +1,1436 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.app.ear;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+import org.jboss.jopr.jsfunit.util.DescribedCondition;
+import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.*;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.commons.lang.math.RandomUtils;
+import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
+import org.jboss.jopr.jsfunit.exceptions.*;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
+import org.w3c.dom.Node;
+
+
+
+/**
+ * This class contains tests for testing the EmbJopr Application
+ * Management Functions for Enterprise Application archives with JBoss AS 5.
+ * 
+ * @author Shelly McGowan
+ *
+ */
+public class EarTest extends ApplicationTestBaseAS5 {
+
+	public static final DeployableTypes APP_TYPE = DeployableTypes.EAR;
+
+
+	
+	/**
+	  * @return the suite of tests being tested
+	*/
+	public static Test suite()
+	{
+		String testToRun = System.getProperty("jsfunit.test.single");
+		if( null == testToRun ){
+			return new TestSuite(EarTest.class);
+		}
+		else{
+			// TODO: Try running single test set in system property.
+			// http://members.pingnet.ch/gamma/junit.htm
+			TestSuite suite = new TestSuite();
+			//suite.addTest(this.getClass().getConstructor(String.class).newInstance(testToRun));
+			suite.addTest( new EarTest(testToRun) );
+			return suite;
+		}
+	}
+
+	public EarTest() {
+	}
+	private EarTest(String testToRun) {
+		super(testToRun);
+	}
+
+
+
+
+	/*
+	 * testName: testBasicEarDeployment
+   * assertion:  verify basic deployment of Enterprise Archive
+	 * test Strategy:  Navigate to Enterprise Applications.
+	 *	Add a new resource.  Verify the resource was successfully
+	 *	deployed.  Undeploy the archive for test clean up purposes.
+	 *
+	 * FAILED: JMX doesn't report EAR as deployed: eardeployment.ear
+	 */ 
+	public void testBasicEarDeployment() throws IOException, EmbJoprTestException
+	{
+
+		final String DEPLOYABLE_NAME = BASIC_EAR;
+
+		try {
+			// Deploy the EAR.
+			String earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+			deployEar( earFilePath );
+
+			String expectedMessage = DEPLOYABLE_NAME + " created successfully";
+
+			checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+			// Use JMX to assert that the EAR components really did deploy successfully.
+			//id="vfszip:/home/brq/ozizka/JoprEmbedded/jboss-as-5.x/build/output/jboss-5.1.0.Beta1/server/default/deploy/eardeployment.ear/",type=Deployment
+			//id="vfszip:/home/ondra/work/JOPRembedded/embjopr-svn-trunk/jsfunit/target/jboss5x/deploy/eardeployment.ear",* not found.
+			assertTrue("JMX doesn't report EAR as deployed: eardeployment.ear", isEarDeployed(DEPLOYABLE_NAME));
+			assertTrue("JMX doesn't report EJB sessiona.jar as deployed.", isEJBDeployed("sessiona.jar"));
+			assertTrue("JMX doesn't report EJB sessionb.jar as deployed.", isEJBDeployed("sessionb.jar"));
+		}
+		finally {
+			// Undeploy the EAR.
+
+			/*undeployEar( DEPLOYABLE_NAME );
+			String expectedMessage = "Successfully deleted Enterprise Application (EAR) '"+DEPLOYABLE_NAME+"'.";
+			assertTrue(client.getPageAsText().contains( expectedMessage ));
+			/**/
+			ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+		}
+
+		// This assert doesn't work. The JXM view is not consistent with the mananaged view. 
+		// JBAS-XXXX
+		//assertFalse(isEarDeployed("eardeployment.ear"));
+		//assertFalse(isEJBDeployed("sessiona.jar"));
+		//assertFalse(isEJBDeployed("sessionb.jar"));
+
+	}
+
+	/**
+	 *	assertion:
+	   
+	      Verify an .ear that contained a bad deployment descriptor
+				fails deployment, fixed using console, and can then be
+				successfully deployed.
+
+	  	test Strategy:
+	   
+	      Deploy an .ear that is known to have a bad deployment
+				descriptor.  Verify the console shows deployment failed.
+				Edit the .ear resource to fix the achive.  Redeploy and
+				verify the archive has been deployed successfully.
+	 
+	 */
+	public void DISABLEDtestBadEarRedeploy() throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
+
+		try {
+			String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+EAR_MALFORMED_APP_FILENAME;
+			deployEar(earFilePath);
+
+			checkClientAndServerMessages("Failed to create Resource", "Failed to create Resource", true);
+		}
+		finally {
+			undeployEar(BASIC_EAR);
+		}
+	}
+
+
+
+
+	/**
+	 * assertion:
+	  
+			Verify the navigation sequence to Enterprise Applications.
+
+		 test Strategy:
+	 
+	    From the root of the navigation tree:
+			Click JBossAS Servers ==> JBoss App Server:${config}
+	          ==> Applications ==> Enterprise Application
+
+	 *  PASSED.
+	 */
+	public void testNavigationToEar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException
+	{
+
+		// JBossAS Servers node 
+		NavTreeNode nodeServers = ejtt.getNavTree().getNodeByLabel("JBossAS Servers");
+		nodeServers.click();
+
+		{
+			String headerText = "JBossAS Server";
+			String jbossConfig = ejtt.getJBossConfig();
+
+			assertTrue("Page doesn't contain the header: "+headerText,
+							client.getPageAsText().contains(headerText));
+
+			assertTrue("EmbJopr should list at least one server (the one it is running on)" +
+							" and that should be in the UP sate.",
+							client.getPageAsText().contains("UP"));
+			// Check whether the server is listed. If not, Exception is thrown.
+			ContentTableRow row =
+							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("JBoss Application Server")
+							.getFirstRowContainingLink("JBoss AS 5 ("+jbossConfig+")");
+			// Click the server link
+			//HtmlAnchor link row.getLinkByLabel("JBAS (default)");
+			Node firstLink = row.getCellByColumnName("Name").getElementsByTagName("a").item(0);
+			if( null == firstLink || !(firstLink instanceof HtmlAnchor) )
+				throw new HtmlElementNotFoundException("Can't find the server link.");
+
+			((HtmlAnchor)firstLink).click();
+		}
+
+		// JBoss App Server:${config} node
+		{
+			String pageText = client.getPageAsText();
+
+			String jbossConfig = ejtt.getJBossConfig();
+			String headerText = "JBoss AS 5 ("+jbossConfig+")";
+			assertTrue("Page doesn't contain the header: "+headerText,
+							pageText.contains(headerText));
+
+			headerText = "General Properties";
+			assertTrue("Page doesn't contain the header: "+headerText,
+							pageText.contains(headerText));
+
+			// TODO: This page reports "Version:5.0 CR1" - EMBJOPR-77
+
+			ejtt.getNavTree().getNodeByLabel("Applications").click();
+
+		}
+
+
+		// Applications node 
+		{
+			// Whooo-hooo! So much to click through!
+
+			ejtt.getTabMenu().clickTab("Summary");
+
+			// TODO: Pagination options: EMBJOPR-78
+			// resourceDataScroller.xhtml, TableManager.java, "pageSizes".
+
+
+			// There's at least one Application with State == UP.
+			//ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Different types of Applications");
+			HtmlTable tableElement = (HtmlTable)client.getElement("categorySummaryForm:dataTable");
+			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTable(tableElement);
+			ContentTableRow row = table.getFirstRowContainingText("UP");
+
+			// Go further - try to click on any Application that is up.
+			HtmlAnchor link = row.getFirstLinkFromColumn("Name");
+			link.click();
+		}
+
+
+		{
+			// Go back to applications Sumary screen.
+			ejtt.getNavTree().getNodeByLabel("Applications").click();
+		}
+
+
+		// Concrete appliction node.
+		{
+			// Deploy the EAR.
+			String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
+			deployEar( earFilePath );
+
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+
+			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+			assertTrue("Page doesn't list "+BASIC_EAR+" in Summary tab.", earRow != null );
+
+			// Go to the summary through listed item.
+			earRow.getLinkByLabel(BASIC_EAR).click();
+			// Check that we have the summary tab for the selected EAR.
+			assertTrue( "EAR name ("+BASIC_EAR+" not found in the content box.",
+				ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_EAR) );
+
+			// Go to the summary through nav tree node.
+			NavTreeNode earNode = ejtt.getNavTree().getNodeByLabel(NAV_EAR);
+			if( !earNode.isExpanded() ){
+				log.info("Expanding.");
+				earNode.getArrowLink().click();
+				Thread.sleep(2000);
+			}
+			ejtt.getNavTree().getNodeByLabel(BASIC_EAR).click();
+			// Check that we have the summary tab for the selected EAR.
+			ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_EAR);
+
+			undeployEar(BASIC_EAR);
+
+		}
+
+	
+	}// testNavigationToEar()
+
+
+
+
+
+
+	/**
+	 *  Assertion:  Verify the content of the Enterprise Application Summary tab
+	 *
+	 *
+	 * FAILS because clicking on the EAR name in list brings us to the root node Summary.
+	 * https://jira.jboss.org/jira/browse/EMBJOPR-80
+	 *
+	 * junit.framework.ComparisonFailure: expected:<eardeployment.ear> but was:<ondra-redhat>
+     at org.jboss.jopr.jsfunit.as5.EarTest.testEarSummaryTab(EarTest.java:323)
+	 */
+	public void testEarSummaryTab() throws EmbJoprTestException, IOException, Exception {
+
+		final int DEPLOY_TIMEOUT_SEC = 20;
+
+		// Deploy the EAR
+		String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
+		deployEar( earFilePath );
+
+		try {
+
+			// Wait until the EAR appears...
+			new ActiveConditionChecker(new DescribedCondition("EAR appears in Summary tab list") {
+				public boolean isTrue() throws Exception {
+					// Refresh, then check.
+					ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+					ContentTableRow earRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(BASIC_EAR);
+					return null != earRow;
+				}
+			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
+
+
+			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+
+			// Wait until the Status is "UP".
+			// TODO: Replace with ActiveConditionChecker.
+			int maxLoops = DEPLOY_TIMEOUT_SEC;
+			do {
+				String statusText = earRow.getCellTextByColumnName("Status");
+				log.debug("EAR Status: "+statusText);
+				if( "UP".equals(statusText) )
+					break;
+
+				// Refresh page after 1 second.
+				ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+				earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+
+				// We don't want an infinite loop by mistake.
+				if( maxLoops-- <= 0 ){
+					throw new EmbJoprTestException("EAR "+BASIC_EAR+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
+				}
+			} while( true );
+
+			// FAILS because of EMBJOPR-80.
+			earRow.getLinkByLabel(BASIC_EAR).click();
+
+
+			// Check the values in info table(s)
+
+			// General Properties
+			HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
+			ContentInfoTable infoTable = ejtt.getContentInfoTable( genpropTable );
+			Properties props = infoTable.getProperties();
+
+			assertEquals(BASIC_EAR, 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"));
+
+
+			// Resource Traits
+			infoTable = ejtt.getContentInfoTable(
+							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
+			props = infoTable.getProperties();
+
+
+			String path = ejtt.getDeployDir()+"/"+BASIC_EAR;
+			assertEquals(path, props.getProperty("Path").trim());
+
+			assertEquals("no", props.getProperty("Exploded?").trim());
+
+			// Metrics Summary
+			HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Metrics Summary").getElement();
+			infoTable = ejtt.getContentInfoTable(summaryTable);
+			// (nothing here yet)
+
+
+		}
+		finally {
+			try {
+				undeployEar(BASIC_EAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}// testEarSummary()
+
+
+
+	/**
+	 * Changes EAR configuration, and checks whether the changes were saved.
+	 *
+	 */
+	public void testEarConfigurationTab() throws IOException, EmbJoprTestException {
+
+		// Deploy the EAR.
+		String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
+		deployEar( earFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+
+			// Navigate to the Configuration tab
+			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+			earRow.getLinkByLabel(BASIC_EAR).click();
+
+			Page prevPage = client.getContentPage();
+			ejtt.tabMenu.clickConfigurationTab();
+			assertNotSame("We should move to other page after clicking the Config tab.",
+							prevPage, client.getContentPage());
+
+			// Read properties.
+			Properties props = new Properties();
+			String filePath = ejtt.getTestDataDir()+"/ear/"+"ear-conf-basic.properties";
+			props.load(new FileInputStream( filePath ));
+
+
+			// Set the configuration options and Save
+			fillOutForm(props);
+			//ejtt.getTabMenu().getTabContentBox().getButtonByLabel("Save");
+			ejtt.getClickableByID("resourceConfigurationForm:saveButton").click();
+
+
+			// Check whether the properties were saved.
+			ejtt.tabMenu.clickConfigurationTab();
+
+			// TODO: We don't see the success message! EMBJOPR-89
+			//checkClientAndServerMessages("successfully", "successfully", false);
+
+			// FAILS because some of the values are read-only.  EMBJOPR-96
+			checkForm(props);
+
+			// TODO: Finish when the properties are marked read-only.
+
+		}
+		finally {
+			try {
+				undeployEar(BASIC_EAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+
+	/**
+	 * Changes EAR configuration, and verifies that the changes were NOT saved.
+	 *
+	 */
+	public void testEarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+
+		// Deploy the EAR.
+		String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
+		deployEar( earFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+
+			// Navigate to the Configuration tab
+			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+			earRow.getLinkByLabel(BASIC_EAR).click();
+
+			Page prevPage = client.getContentPage();
+			ejtt.tabMenu.clickConfigurationTab();
+			assertNotSame("We should move to other page after clicking the Config tab.",
+							prevPage, client.getContentPage());
+
+
+			// Load properties (we will use their names).
+			Properties propsToSet = new Properties();
+			String propsFilePath = ejtt.getTestDataDir()+"/ear/"+"ear-conf-basic.properties";
+			propsToSet.load(new FileInputStream( propsFilePath ));
+
+			// Get the current properties.
+			Properties propsOriginal = getFormPropertiesValues( propsToSet );
+
+
+			// Set the configuration options and CANCEL
+			fillOutForm( propsToSet );
+			ejtt.getClickableByID("resourceConfigurationForm:cancelButton").click();
+
+
+			// TODO: We should get back to Conf tab automatically: EMBJOPR-100
+			ejtt.tabMenu.clickConfigurationTab();
+
+			// Now check whether the values are the same as before editing.
+			checkForm( propsOriginal );
+
+		}
+		finally {
+			try {
+				undeployEar(BASIC_EAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+
+	/**
+	 * Redeploys EAR.
+	 *
+	 * Fails because of EMBJOPR-109 - HTTP Status 500 - Error in Seam/JSF
+	 * Fails because of EMBJOPR-42 - javax.el.ELException: org.jboss.seam.RequiredException:
+	 *     @Out attribute requires non-null value: updateBackingContentAction.packageDetails
+	 */
+	public void testEarRedeployment() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME  = BASIC_EAR;
+
+		// Deploy the EAR.
+		String appFilePath = ejtt.getTestDataDir() + "/"+DeployableTypes.EAR.getDataDir()+"/"+DEPLOYABLE_NAME;
+		deployEar( appFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME, 3000, 15);
+
+			// Navigate to the Configuration tab
+			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			earRow.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.tabMenu.clickContentTab();
+
+			String xPath = ".//table//input[@type='file']";
+			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			fileInput.setValueAttribute(appFilePath);
+			xPath = ".//table//input[@type='submit']";
+			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			submit.click();
+
+
+
+		}
+		finally {
+			try {
+				undeployEar(DEPLOYABLE_NAME); // EMBJOPR-109 here.
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+
+	/**
+	 * Deploys exploded EAR and checks whether it is reported as exploded.
+	 *
+	 * DISABLED - Badly written test, to be fixed. TODO: Hot-deploy
+	 */
+	public void DISABLEDtestUnzippedEarReportedAsExploded() throws IOException, EmbJoprTestException {
+
+		// Deploy the EAR.
+		String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
+		deployEar( earFilePath );
+
+		try {
+			// Wait for EAR to be deployed and UP
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+
+			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits");
+			ContentInfoTable infoTable = ejtt.getTabMenu().getTabContentBox().getContentInfoTable(table.getElement());
+			Properties properties = infoTable.getProperties();
+			assertEquals("'Exploded?' should be 'yes'", "yes", properties.getProperty("Exploded?").toLowerCase() );
+
+		}
+		finally {
+			try {
+				undeployEar(BASIC_EAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+
+
+	/**
+	 * Checks EAR metrics tab.
+	 */
+	public void testEarMetricsTab() throws IOException, EmbJoprTestException {
+
+		// Deploy the EAR.
+		String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
+		deployEar( earFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+
+			// Navigate to the Metrics tab
+			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+			earRow.getLinkByLabel(BASIC_EAR).click();
+			ejtt.tabMenu.clickMetricsTab();
+
+			// Resource Traits
+
+			// Check the Path.
+			HtmlTable tbl = ejtt.getTabMenu().getTabContentBox().
+							getTableUnderHeader("Trait Values").getElement();
+			ContentInfoTable infoTable = ejtt.getContentInfoTable( tbl );
+			Properties props = infoTable.getProperties();
+			log.debug("EAR Metrics tab - Trait Values: "+ props.toString());
+
+			String path = ejtt.getDeployDir()+"/"+BASIC_EAR;
+			assertEquals(path, props.getProperty("Path"));
+
+		}
+		finally {
+			try {
+				undeployEar(BASIC_EAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+	/**
+	 * Changes EAR configuration, and checks whether the changes were saved.
+	 *
+	 * FAILS because some of the values are read-only.  EMBJOPR-96
+	 */
+	public void testEarMetricsTabRefreshButton() throws IOException, EmbJoprTestException {
+
+		// Deploy the EAR.
+		String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
+		deployEar( earFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+
+			// Navigate to the Metrics tab
+			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+			earRow.getLinkByLabel(BASIC_EAR).click();
+			ejtt.tabMenu.clickMetricsTab();
+
+			// Click the Refresh button.
+			// Can this change to submit? Perhaps set an ID and use ejtt.getClickableById().
+			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Refresh").click();
+
+			// Check that we are still on the right tab.
+			assertTrue("Metrics tab is active", ejtt.tabMenu.isTabActive("Metrics") );
+			assertTrue("Page contains EAR name", client.getPageAsText().contains(BASIC_EAR) );
+			assertTrue("Page contains 'Refresh'", client.getPageAsText().contains("Refresh") );
+
+		}
+		finally {
+			try {
+				undeployEar(BASIC_EAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+	/**
+	 * Deploys an exploded EAR application.
+	 *
+	 * PASSED.
+	 * Now fails, because EAR does not appear.
+	 */
+	public void testDeployUnpackedEar() throws IOException, EmbJoprTestException {
+
+
+		// Deploy the unpacked EAR.
+		// We have to use hotdeploy - can't upload a directory.
+		log.info("Unzipping ear/"+EAR_UNPACKED_ZIP);
+		unzipToDeployDir("ear/"+EAR_UNPACKED_ZIP, "");
+		ejtt.sleep(5000); // 5 sec is default deployment scanner interval.
+
+		try {
+				// Loop, wait for the app to appear.
+				log.info("Waiting for EAR to appear.");
+				ejtt.deployment.waitActivelyForDeployment( DeployableTypes.EAR, EAR_UNPACKED, 5000, 12, this);
+
+
+				ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+
+				ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(EAR_UNPACKED);
+
+				// TODO: Finish
+
+				// TODO: Check whether Exploded?:  yes.  EMBJOPR-95
+
+				// TODO: DeploymentUtils, DeployableTypes, isAvailable enum inner classes
+
+				// TODO: Preliminary test - check system properties, their validity, java version, etc.
+		}
+		finally {
+			// Delete the EAR dir.
+			deleteFromDeployDir(EAR_UNPACKED);
+		}
+	}
+
+
+
+
+
+
+	/**
+	 * Deploys an EAR with WAR as a module, and checks whether the web app runs.
+	 */
+	public void testEarWithWar() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME = EAR_WITH_WAR;
+
+		// Deploy the EAR.
+		String earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+		deployEar( earFilePath );
+
+		// Get the HTTP port and the URL of the test page.
+		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+		int port = tmpRequest.getLocalPort();
+		// Eventually remove ".war" suffix and add "-war" (convention)
+		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".ear" ) +"-war";
+		String testPageUrl = "http://localhost:"+port+"/"+context+"/index.jsp";
+
+		// Create web client we will use to check the web app.
+		WebClient webClient = new WebClient();
+		webClient.setThrowExceptionOnFailingStatusCode(false);
+		HtmlPage page;
+
+		try {
+
+			// Wait until the EAR is UP.
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME, 3000, 15, this);
+			
+			// Assert that the app is running.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+      assertTrue("Page should contain 'Hello World'", page.asText().contains("Hello World"));
+
+		}
+		finally {
+			try {
+				undeployEar(DEPLOYABLE_NAME);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+
+
+
+
+
+
+
+	/**
+	 * Stops and Starts an EAR with WAR in the Control tab.
+	 *
+	 * FAILS because of EMBJOPR-133.
+	 */
+	public void testStopAndStartEar() throws IOException, EmbJoprTestException
+	{
+		final String DEPLOYABLE_NAME = EAR_WITH_WAR_COUNTER;
+
+		// Get the HTTP port and the URL of the test page.
+		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+		int port = tmpRequest.getLocalPort();
+		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".ear" )+"-war"; // Eventually remove ".ear" suffix.
+		String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
+
+		// Create web client we will use to check the web app.
+		WebClient webClient = new WebClient();
+		// We'll get 404 after stopping the app.
+		webClient.setThrowExceptionOnFailingStatusCode(false);
+		HtmlPage page;
+
+
+		// Deploy the EAR.
+		String appfilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+		deployEar( appfilePath );
+
+		try {
+
+			// Wait until app is UP
+			ejtt.getNavTree().getNodeByLabel(DeployableTypes.EAR.getNavTreeLabel()).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME,
+							3000, 15, this);
+
+			// Assert that the app is running.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+      assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
+
+			// Refresh the page several times to increase the counter.
+			page = (HtmlPage) page.refresh();
+			page = (HtmlPage) page.refresh();
+
+			// Get the counter number.
+			Integer count1 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+
+
+			// Navigate to the web app, then to it's Control tab.
+			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			row.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.getTabMenu().clickControlTab();
+
+			// Click the Stop button.
+			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Stop").click();
+
+			// Check the latest message.
+			/*
+			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
+			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
+			assertTrue( tr.getTextContent().contains("Success") );
+			/**/
+			DebugUtils.writeFile("target/testStopAndStartEar-opsTable.html", client.getPageAsText() );///
+			OperationStatusType status = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getLastOperationStatus();
+			assertEquals("Stop operation did not succeed, the status is: "+status, OperationStatusType.SUCCESS, status);
+			//assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
+
+
+			// Assert that the app is stopped.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertTrue( 200 != page.getWebResponse().getStatusCode() );
+
+
+			// Click the Start button.
+			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start").click();
+
+			// Check the latest message. TODO: EJTT class for ops history table?
+			/*
+			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getElement();
+			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
+			assertTrue( tr.getTextContent().contains("Success") );
+			*/
+			DebugUtils.writeFile("target/testStopAndStartEar-opsTable2.html", client.getPageAsText() );///
+			status = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getLastOperationStatus();
+			assertEquals("Start operation did not succeed, the status is: "+status, OperationStatusType.SUCCESS, status);
+			//assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
+
+
+			// Assert that the app is running.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertTrue( 200 == page.getWebResponse().getStatusCode() );
+      assertTrue(page.asText().contains("HELLO WORLD"));
+
+			// Get the counter number.
+			Integer count2 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+			assertTrue( "Counter is reset upon app restart, thus should be lower after.", count1 > count2 );
+
+
+		}
+		finally {
+			try {
+				undeployEar(DEPLOYABLE_NAME);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+	}
+
+
+	/**
+	 * Restarts the EAR in Control tab and checks whether it was really restarted.
+	 *
+	 * FAILS because of EMBJOPR-133.
+	 */
+	public void testRestartEar() throws IOException, EmbJoprTestException
+	{
+		final String DEPLOYABLE_NAME = EAR_WITH_WAR_COUNTER;
+
+		// Get the HTTP port and the URL of the test page.
+		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+		int port = tmpRequest.getLocalPort();
+		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".ear" )+"-war";
+		String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
+
+		// Create web client we will use to check the web app.
+		WebClient webClient = new WebClient();
+		webClient.setThrowExceptionOnFailingStatusCode(false);
+		HtmlPage page;
+
+
+		// Deploy the app.
+		String appFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+		deployEar( appFilePath );
+
+		try {
+
+			// Wait until app is UP
+			ejtt.getNavTree().getNodeByLabel(DeployableTypes.EAR.getNavTreeLabel()).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME,
+							3000, 15, this);
+
+			// Assert that the app is running.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+      assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
+
+			// Refresh the page several times to increase the counter.
+			page = (HtmlPage) page.refresh();
+			page = (HtmlPage) page.refresh();
+
+			// Get the counter number.
+			Integer count1 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+
+
+			// Navigate to the web app, then to it's Control tab.
+			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			row.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.getTabMenu().clickControlTab();
+
+			// Click the Restart button.
+			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Restart").click();
+
+			// Check the latest message. TODO: EJTT class for ops history table?
+			/*
+			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getElement();
+			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
+			assertTrue( tr.getTextContent().contains("Success") );
+			*/
+			//assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
+			OperationStatusType status = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getLastOperationStatus();
+			assertEquals("Stop operation did not succeed, the status is: "+status, OperationStatusType.SUCCESS, status);
+
+
+
+			// Assert that the app is running.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertTrue( 200 == page.getWebResponse().getStatusCode() );
+      assertTrue(page.asText().contains("HELLO WORLD"));
+
+			// Get the counter number.
+			Integer count2 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+			assertTrue( "Counter is reset upon app restart, thus should be lower after.", count1 > count2 );
+
+		}
+		finally {
+			try {
+				undeployEar(DEPLOYABLE_NAME);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+	}
+
+
+
+	/**
+	 * Deploys an EAR with dependencies which are not in default config,
+	 * checks for the deployment error message,
+	 * and checks that the EAR is not listed.
+	 *
+	 * FAILS because of EMBJOPR-137 - EAR with unsatisfied dependencies
+	 * show error upon deploy, but then shows as UP.
+	 */
+	public void testEarWithUnsatisfiedDeps() throws IOException, EmbJoprTestException
+	{
+
+		final String DEPLOYABLE_NAME = EAR_EXT_DEPENDENCIES;
+
+		try {
+			// Deploy the EAR.
+			String appFilePath = ejtt.getTestDataDir() + "/"+DeployableTypes.EAR.getDataDir()+"/"+DEPLOYABLE_NAME;
+			ejtt.deployment.deployViaEmbJopr( DeployableTypes.EAR, appFilePath );
+
+			// Check that we get an error message.
+			assertTrue( "We should get an error message.", server.getFacesMessages().hasNext() );
+			assertTrue( "We should get an error message.",
+							server.getFacesMessages().next().getSeverity() != FacesMessage.SEVERITY_INFO );
+
+			// Check that the EAR is not listed as deployed.
+			assertFalse( "The EAR should not be listed as deployed.",
+		    ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.EAR, DEPLOYABLE_NAME, false) );
+
+		}
+		finally {
+			try {
+				undeployEar(DEPLOYABLE_NAME);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+
+
+
+
+	public void testEarRedeployDifferentName() throws IOException, EmbJoprTestException
+	{
+
+		final String DEPLOYABLE_NAME  = EAR_WITH_WAR_COUNTER;
+		final String DEPLOYABLE_NAME2 = EAR_WITH_WAR_COUNTER_20;
+
+		// Deploy the EAR.
+		String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME;
+		ejtt.deployment.deployViaEmbJopr( APP_TYPE, appFilePath );
+
+		String appFilePath2 = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME2;
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+			ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 15);
+
+			// Navigate to the Configuration tab
+			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			earRow.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.tabMenu.clickContentTab();
+
+			String xPath = ".//table//input[@type='file']";
+			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			fileInput.setValueAttribute(appFilePath2);
+			xPath = ".//table//input[@type='submit']";
+			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			submit.click();
+
+			// We should get:
+			// The specified file must have the same name as the existing
+			// deployed EAR File (EarWithWar-Counter.ear).
+			String msg = "The specified file must have the same name " +
+				"as the existing deployed EAR File";
+			checkClientAndServerMessages( msg, msg, FacesMessage.SEVERITY_WARN );
+
+			// Check that the old app is deployed.
+			ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 15);
+
+		}
+		finally {
+			try {
+				undeployEar( DEPLOYABLE_NAME );
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+			try {
+				undeployEar( DEPLOYABLE_NAME2 );
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+	
+	}
+
+
+
+
+	public void testEarRedeployDifferentVersion() throws IOException, EmbJoprTestException
+	{
+
+		final String DEPLOYABLE_NAME  = EAR_WITH_WAR_COUNTER;
+		final String DEPLOYABLE_NAME2 = EAR_WITH_WAR_COUNTER_20;
+
+		// Copy new version to tmp dir under old ver's filename.
+		String srcFilePath =  ejtt.getTestDataDir() +"/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME2;
+		String destFilePath = ejtt.getTempDir() +"/"+DEPLOYABLE_NAME;
+		FileUtils.copyFile(new File(srcFilePath), new File(destFilePath));
+
+
+		// Deploy the EAR.
+		String appFilePath = destFilePath;
+		ejtt.deployment.deployViaEmbJopr( APP_TYPE, appFilePath );
+
+		String appFilePath2 = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME2;
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+			ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 15);
+
+			// Navigate to the Configuration tab
+			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			earRow.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.tabMenu.clickContentTab();
+
+			String xPath = ".//table//input[@type='file']";
+			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			fileInput.setValueAttribute(appFilePath2);
+			xPath = ".//table//input[@type='submit']";
+			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			submit.click();
+
+			// We should get:
+			// The specified file must have the same name as the existing
+			// deployed EAR File (EarWithWar-Counter.ear).
+			String msg = "The specified file must have the same name " +
+				"as the existing deployed EAR File";
+			checkClientAndServerMessages( msg, msg, FacesMessage.SEVERITY_WARN );
+
+			// Check that the old app is deployed.
+			ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 15);
+
+		}
+		finally {
+			try {
+				undeployEar( DEPLOYABLE_NAME );
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+			try {
+				undeployEar( DEPLOYABLE_NAME2 );
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+	/**
+	 * Waits for the deployable to be in the UP State.
+	 *
+	 * @param type  Type of deployable - EAR, WAR, SAR, ...
+	 * @param name  Name of the deployable, like 'hello.war'.
+		 @deprecated  Moved to EJTT.Deployment.
+	 */
+	private void XwaitActivelyForDeployment(
+						final DeployableTypes type, final String name,
+						int intervalMS, int retries
+					)
+					throws EmbJoprTestException, IOException
+	{
+		try {
+			String conditionDesc = type.name()+" "+name+" appears in embjopr as deployed";
+			final EmbJoprTestToolkit selfEjtt = ejtt;
+			boolean deployedSuccessfuly =
+			new ActiveConditionChecker( new DescribedCondition(conditionDesc) {
+				int callsMade = 0;
+				public boolean isTrue() throws HtmlElementNotFoundException, IOException {
+					// Refresh the page if this is not the first call.
+					if( callsMade++ > 0 )
+						selfEjtt.refreshPage();
+					// If found, return true.
+					return new DeploymentUtils().isDeployedAccordingToEmbJopr( type, name );
+				}
+			} ).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout( intervalMS, retries );
+		}
+		catch( EmbJoprTestException ex ){ throw ex; }
+		catch( IOException ex ){ throw ex; }
+		// Wrap all exceptions to EmbJoprTestException.
+		catch( Exception ex ){
+			throw new EmbJoprTestException("Exception thrown while actively waiting for condition.", ex);
+		}
+	}
+
+
+
+
+	/**
+	 * Utilities for performing and checking deployment.
+	 * In the future, it should be general interface like
+	 *   boolean isDeployed( DeployableType type, String name ).
+	 */
+	protected class DeploymentUtils {
+
+		/**
+		 * Returns true if EmbJopr lists a deployable of given type and name,
+		 * and it's State is UP; false otherwise.
+		 */
+		private boolean isDeployedAccordingToEmbJopr( DeployableTypes type, String deployableName )
+						throws HtmlElementNotFoundException, IOException
+		{
+			// Refresh / go to the appropriate page.
+			ejtt.getNavTree().getNodeByLabel( type.getNavTreeLabel() ).click();
+			ContentTableRow earRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(deployableName);
+			if( null == earRow ){
+				log.debug("Row with "+deployableName+" not present.");
+				return false;
+			}
+
+			String statusText = earRow.getCellTextByColumnName("Status");
+			if( "UP".equals(statusText) ){
+				return true;
+			}else{
+				log.debug("Row with "+deployableName+" has Status == '"+statusText+"' != UP.");
+				return false;
+			}
+		}
+		
+		
+		/**
+		 * Returns true if there's a file of the given name in server's deploy dir;
+		 * false otherwise.
+		 */
+		private boolean isDeployedAccordingToFileSystem( DeployableTypes type, String name )
+		{
+			String deployPath = System.getProperty(SYSPROP_DEPLOY_DIR);
+			String fileName = deployPath+"/"+name;
+			return (new File(fileName)).exists();
+		}
+
+		private void undeployViaFileSystem( String name ) throws EmbJoprTestException{
+			String deployPath = System.getProperty(SYSPROP_DEPLOY_DIR);
+			String fileName = deployPath+"/"+name;
+			File fileToDelete = new File(fileName);
+
+			if( !fileToDelete.exists() )
+				throw new EmbJoprTestException("Deployable doesn't exist: "+fileName);
+
+			if(fileToDelete.isFile()){
+				if( !fileToDelete.delete() ){
+					throw new EmbJoprTestException("Unable to delete: "+fileName);
+				}
+			}else if(fileToDelete.isDirectory()){
+				deleteDirectory(fileToDelete);
+			}
+
+		}// isDeployedAccordingToFileSystem()
+		
+
+	}// class DeploymentUtils
+
+
+	
+	
+
+	// TODO: Move to utils
+	/**
+	 * Unzips given archive from testdata dir to server's deploy/ dir.
+	 * @param relativeArchivePath  Path of the archive relative to testdata dir.
+	 * @param relativeDestDir      Path of the destination dir relative to deploy dir.
+	 */
+	private void unzipToDeployDir( String relativeArchivePath, String relativeDestDir )
+					throws FileNotFoundException, IOException
+	{
+
+		String destDir = System.getProperty(SYSPROP_DEPLOY_DIR)+"/"+relativeDestDir;
+		String archivePath = System.getProperty(SYSPROP_TESTDATA_DIR)+"/"+relativeArchivePath;
+
+		log.info("Unzipping '"+archivePath+"' to '"+destDir+"'.");
+
+		unzipArchive( archivePath, destDir );
+	}
+
+
+	
+	/**
+	 * Unzips archive from the given path to the given destination dir.
+	 */
+	private void unzipArchive(String archivePath, String destDir)
+					throws FileNotFoundException, IOException
+	{
+
+		FileInputStream fis = new FileInputStream( archivePath );
+		ZipInputStream zin = new ZipInputStream(new BufferedInputStream(fis));
+
+		ZipEntry entry;
+		while( null != (entry = zin.getNextEntry()) ){
+
+			if(entry.isDirectory()) {
+				// Assume directories are stored parents first then children.
+				log.info("Extracting directory: " + entry.getName());
+				// This is not robust, just for demonstration purposes.
+				(new File(destDir +"/"+ entry.getName())).mkdir();
+				continue;
+			}
+
+			log.info("Extracting file: " + entry.getName());
+
+			final int BUFFER = 2048;
+			FileOutputStream fos = new FileOutputStream( destDir +"/"+ entry.getName());
+			BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER);
+
+			int count;
+			byte[] data = new byte[BUFFER];
+			while ((count = zin.read(data, 0, BUFFER)) != -1) {
+				 dest.write(data, 0, count);
+			}
+			dest.flush();
+			dest.close();
+			zin.closeEntry();
+
+		}
+
+		zin.close();
+
+	}
+
+
+
+
+	// TODO: Moved to EJTT, remove from here.
+	private void deleteFromDeployDir( String deployableName ) throws IOException{
+
+		String deployDir = ejtt.getDeployDir();
+
+		File dirToDelete = new File( deployDir, deployableName);
+		// Just not to delete something accidentally...
+		// Not true for Cargo maven plugin.
+		//assertTrue( deployDir+" contains '/server/'", deployDir.contains("/server/"));
+
+		// Check if not outside deploy dir.
+		if( !dirToDelete.getCanonicalPath().startsWith( deployDir ) )
+			throw new IllegalArgumentException(
+							" The resulting path is outside deploy dir: "+dirToDelete.getCanonicalPath());
+
+		log.info("Deleting '"+dirToDelete.getPath()+"'...");
+		//deleteDirectory( dirToDelete );
+	}
+
+
+
+  public static void deleteDirectory(File path) throws EmbJoprTestException
+	{
+		List<String> undeletableFiles = new ArrayList();
+		deleteDirectory(path, undeletableFiles);
+		if( !undeletableFiles.isEmpty() ){
+			throw new EmbJoprTestException("Couldn't delete following files: \n  "+
+							StringUtils.join(undeletableFiles, "\n  ") + "\n");
+		}
+	}
+
+  public static void deleteDirectory(File path, List<String> undeletableFiles)
+	{
+    if( path.exists() ) {
+      File[] files = path.listFiles();
+      for(int i=0; i<files.length; i++) {
+         if(files[i].isDirectory()) {
+           deleteDirectory(files[i], undeletableFiles );
+         }
+         else {
+           if( !files[i].delete() ){
+						 undeletableFiles.add(files[i].getAbsolutePath());
+					 }
+         }
+      }
+    }
+    if( ! path.delete() )
+			undeletableFiles.add( path.getAbsolutePath() );
+  }
+
+	private void deployEar( String earFilePath ) throws IOException, HtmlElementNotFoundException
+	{
+		if( !(new File(earFilePath)).exists())
+			throw new FileNotFoundException(earFilePath);
+
+		log.info("Deploying: "+earFilePath);
+
+		// Navigate to Enterprise Archives
+		ejtt.getNavTree().getNodeLink(NAV_EAR).click();
+
+		// click on the "Add new resource" button
+		client.click("actionHeaderForm:addNewContent");  // 404 if setThrowExceptionOnFailingStatusCode(true) above
+
+		// Upload the file
+		HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
+		fileInput.setContentType("application/ear");
+		fileInput.setValueAttribute(earFilePath);
+		client.click("createContentForm:addButton");
+		ejtt.sleep( 2000 );
+
+		// Log the message
+		ejtt.logServerMessage("Something went wrong with deploy: ");
+	}
+
+	private void undeployEar( String earFileName ) throws IOException, HtmlElementNotFoundException, ActionNotAvailableException
+	{
+
+		// Navigate to Enterprise Archives
+		ejtt.getNavTree().getNodeLink(NAV_EAR).click();
+
+		ejtt.getTabMenu().clickSummaryTab();
+
+		/// Debug log - we're getting HTTP 500 here :/
+		String dumpFile = "target/"+this.getName()+"-undeployEar-"+(1000+RandomUtils.nextInt(1000))+".html";
+		log.debug("Dumping page to "+dumpFile);
+		DebugUtils.writeFile( dumpFile, client.getPageAsText());
+		int httpStatusCode = client.getContentPage().getWebResponse().getStatusCode();
+		if( 200 != httpStatusCode )
+			log.warn("Status code before undeployment is: "+httpStatusCode);
+
+		HtmlButtonInput deleteButton = getAppDeleteButton( earFileName );
+		deleteButton.click();
+
+		// Log the message (with prefix of potential warning)
+		ejtt.logServerMessage("Something went wrong with undeploy: ");
+
+		// Sleep for 3 sec.  TODO: write some waitForUndeployed()
+		ejtt.sleep( 3000 );
+
+	}
+
+
+
+}// class EarTest

Copied: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTest.java (from rev 389, trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EjbTest.java)
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTest.java	2009-05-06 21:15:45 UTC (rev 390)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.app.ejb;
+
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import javax.faces.application.FacesMessage;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+
+
+
+/**
+ * This class contains tests for testing the EmbJopr Application
+ * Management Functions for Enterprise JavaBean archives with JBoss AS 5.
+ * 
+ * @author Shelly McGowan
+ *
+ */
+public class EjbTest extends ApplicationTestBaseAS5 {
+
+	/**
+	  * @return the suite of tests being tested
+	*/
+
+	public static Test suite()
+	{
+		return new TestSuite(EjbTest.class);
+	}
+
+
+        /*
+         * testName: testBasicEjbDeployment
+         * assertion:  verify basic deployment of an EJB JAR.
+         * test Strategy:  Navigate to EJB Applications.
+         *      Add a new resource.  Verify the resource was successfully
+         *      deployed.  Undeploy the archive.
+         *
+         */
+
+	public void testBasicEjbDeployment() throws IOException, EmbJoprTestException
+	{
+		log.info(DebugUtils.getCurrentMethodFullName());
+
+		// Navigate to EJB Applications
+		HtmlAnchor ejbLink = getNavTreeLink(NAV_EJB2);
+		ejbLink.click();
+
+		// click on the "Add new resource" button
+		client.click("actionHeaderForm:addNewContent");  // 404 if setThrowExceptionOnFailingStatusCode(true) above
+
+		// TODO: "/ejb/BASIC_JAR" causes exceptions in seam:
+		// http://wwwapps.rdu.redhat.com/w3xpastebin/pastebin.php?show=9842
+
+		String filePath = System.getProperty("jsfunit.testdata") + "/ejb/"+BASIC_JAR;
+		log.info("Uploading EJB archive: "+filePath);
+		File uploadFile = new File(filePath);
+		if( !uploadFile.exists() )
+			throw new EmbJoprTestException("Can't find EJB file to upload: '"+filePath+"'");
+
+		// upload ejb
+		HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
+		fileInput.setContentType("application/ejb");
+		fileInput.setValueAttribute(filePath);
+		client.click("createContentForm:addButton");
+
+		log.info("HTTP status after EJB upload: "+client.getContentPage().getWebResponse().getStatusCode());
+		log.info("renderResponse() called: " + server.getFacesContext().getRenderResponse() );
+		log.info("responseComplete() called: " + server.getFacesContext().getResponseComplete() );
+
+		String errorMessage = 
+						( server.getFacesMessages().hasNext()
+						&& server.getFacesMessages().next().getSeverity() != FacesMessage.SEVERITY_INFO ) ?
+							" Faces message: "+server.getFacesMessages().next()
+							: ""; // Awful code
+
+		// FAILS because of NPE and HTTP 500.
+		// assert that the success message appeared on the client side
+		assertTrue("Success message not found."+errorMessage, client.getPageAsText().contains("Resource " + BASIC_JAR + " created successfully!"));
+
+		// assert text and severity level for FacesMessage on server side
+		assertTrue(server.getFacesMessages().hasNext());
+		FacesMessage successMessage = server.getFacesMessages().next();
+		assertTrue(FacesMessage.SEVERITY_INFO.equals(successMessage.getSeverity()));
+		assertTrue(successMessage.getDetail().contains("Resource " + BASIC_JAR + " created successfully!"));
+
+
+		assertFalse("Page contains 'Total: 0', EJBs probably not listed.",  client.getPageAsText().contains("Total: 0"));
+
+
+		// Use JMX to assert that the EJB components really did deploy successfully
+		assertTrue(isEJBDeployed(BASIC_JAR));
+
+		// Undeploy the EJB JAR 
+		HtmlButtonInput deleteButton = getAppDeleteButton(BASIC_JAR);
+		deleteButton.click();
+
+		assertTrue(client.getPageAsText().contains(EJB2_DEL_MSG + " '" + BASIC_JAR +"'."));
+
+		assertFalse(isEJBDeployed(BASIC_JAR));
+	}
+
+}

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/rar/RarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/rar/RarTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/rar/RarTest.java	2009-05-06 21:15:45 UTC (rev 390)
@@ -0,0 +1,583 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.app.rar;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+import org.jboss.jopr.jsfunit.util.DescribedCondition;
+import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.*;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.commons.lang.math.RandomUtils;
+import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
+import org.jboss.jopr.jsfunit.exceptions.*;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
+import org.w3c.dom.Node;
+
+
+
+/**
+ * This class contains tests for testing the EmbJopr Application
+ * Management Functions for Resource Adapters with JBoss AS 5.
+ * 
+ * @author Shelly McGowan
+ *
+ */
+public class RarTest extends ApplicationTestBaseAS5 {
+
+	public static final DeployableTypes APP_TYPE = DeployableTypes.RAR;
+
+
+	
+	/**
+	  * @return the suite of tests being tested
+	*/
+	public static Test suite()
+	{
+		String testToRun = System.getProperty("jsfunit.test.single");
+		if( null == testToRun ){
+			return new TestSuite(RarTest.class);
+		}
+		else{
+			// TODO: Try running single test set in system property.
+			// http://members.pingnet.ch/gamma/junit.htm
+			TestSuite suite = new TestSuite();
+			//suite.addTest(this.getClass().getConstructor(String.class).newInstance(testToRun));
+			suite.addTest( new RarTest(testToRun) );
+			return suite;
+		}
+	}
+
+	public RarTest() {
+	}
+	private RarTest(String testToRun) {
+		super(testToRun);
+	}
+
+
+	/*
+	 * testName: testBasicRarDeployment
+         * assertion:  verify basic deployment of a standalone resource adapter
+	 * test Strategy:  Navigate to Resource Adapter.
+	 *	Add a new resource.  Verify the resource was successfully
+	 *	deployed.  Undeploy the archive for test clean up purposes.
+	 *
+	 */ 
+	public void testBasicRarDeployment() throws IOException, EmbJoprTestException
+	{
+
+		final String DEPLOYABLE_NAME = BASIC_RAR;
+
+		try {
+			// Deploy the RAR.
+			String rarFilePath = ejtt.getTestDataDir() + "/rar/"+DEPLOYABLE_NAME;
+			deployRar( rarFilePath );
+
+			String expectedMessage = DEPLOYABLE_NAME + " created successfully";
+
+			checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+			assertTrue("JMX doesn't report RAR, jbosstestadapter.rar as deployed.", isRarDeployed(BASIC_RAR));
+		}
+		finally {
+			ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+		}
+
+		assertFalse(isRarDeployed(BASIC_RAR));
+
+	}
+
+
+	/**
+	 * assertion: Verify the navigation sequence to Resource Adapters.
+         *
+         * test Strategy:
+	 * 
+	 *   From the root of the navigation tree:i
+         *	Click JBossAS Servers ==> JBoss App Server:${config}
+	 *         ==> Applications ==> Resource Adapters
+         *
+	 */
+	public void testNavigationToRar() throws IOException, HtmlElementNotFoundException,
+		 ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException
+	{
+
+		// JBossAS Servers node 
+		NavTreeNode nodeServers = ejtt.getNavTree().getNodeByLabel("JBossAS Servers");
+		nodeServers.click();
+
+		{
+			String headerText = "JBossAS Server";
+			String jbossConfig = ejtt.getJBossConfig();
+
+			assertTrue("Page doesn't contain the header: "+headerText,
+							client.getPageAsText().contains(headerText));
+
+			assertTrue("EmbJopr should list at least one server (the one it is running on)" +
+							" and that should be in the UP sate.",
+							client.getPageAsText().contains("UP"));
+			// Check whether the server is listed. If not, Exception is thrown.
+			ContentTableRow row =
+							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("JBoss Application Server")
+							.getFirstRowContainingLink("JBoss AS 5 ("+jbossConfig+")");
+			// Click the server link
+			//HtmlAnchor link row.getLinkByLabel("JBAS (default)");
+			Node firstLink = row.getCellByColumnName("Name").getElementsByTagName("a").item(0);
+			if( null == firstLink || !(firstLink instanceof HtmlAnchor) )
+				throw new HtmlElementNotFoundException("Can't find the server link.");
+
+			((HtmlAnchor)firstLink).click();
+		}
+
+		// JBoss App Server:${config} node
+		{
+			String pageText = client.getPageAsText();
+
+			String jbossConfig = ejtt.getJBossConfig();
+			String headerText = "JBoss AS 5 ("+jbossConfig+")";
+			assertTrue("Page doesn't contain the header: "+headerText,
+							pageText.contains(headerText));
+
+			headerText = "General Properties";
+			assertTrue("Page doesn't contain the header: "+headerText,
+							pageText.contains(headerText));
+
+			ejtt.getNavTree().getNodeByLabel("Applications").click();
+
+		}
+
+		// Applications node 
+		{
+
+			ejtt.getTabMenu().clickTab("Summary");
+
+			HtmlTable tableElement = (HtmlTable)client.getElement("categorySummaryForm:dataTable");
+			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTable(tableElement);
+			ContentTableRow row = table.getFirstRowContainingText("UP");
+
+			// Go further - try to click on any Application that is up.
+			HtmlAnchor link = row.getFirstLinkFromColumn("Name");
+			link.click();
+		}
+
+
+		{
+			// Go back to applications Sumary screen.
+			ejtt.getNavTree().getNodeByLabel("Applications").click();
+		}
+
+
+		// Concrete appliction node.
+		{
+			// Deploy the RAR.
+			String rarFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/rar/"+BASIC_RAR;
+			deployRar( rarFilePath );
+
+			ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
+
+			ContentTableRow rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_RAR);
+			assertTrue("Page doesn't list "+BASIC_RAR+" in Summary tab.", rarRow != null );
+
+			// Go to the summary through listed item.
+			rarRow.getLinkByLabel(BASIC_RAR).click();
+			// Check that we have the summary tab for the selected RAR.
+			assertTrue( "RAR name ("+BASIC_RAR+" not found in the content box.",
+				ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_RAR) );
+
+			// Go to the summary through nav tree node.
+			NavTreeNode rarNode = ejtt.getNavTree().getNodeByLabel(NAV_RAR);
+			if( !rarNode.isExpanded() ){
+				log.info("Expanding.");
+				rarNode.getArrowLink().click();
+				Thread.sleep(2000);
+			}
+			ejtt.getNavTree().getNodeByLabel(BASIC_RAR).click();
+			// Check that we have the summary tab for the selected RAR.
+			ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_RAR);
+
+			undeployRar(BASIC_RAR);
+
+		}
+
+	
+	}// testNavigationToRar()
+
+
+
+
+
+
+	/**
+	 *  Assertion:  Verify the content of the Resource Adapter Summary tab
+	 *
+	 *
+	 */
+	public void testRarSummaryTab() throws EmbJoprTestException, IOException, Exception {
+
+		final int DEPLOY_TIMEOUT_SEC = 20;
+
+		// Deploy the RAR
+		String rarFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/rar/"+BASIC_RAR;
+		deployRar( rarFilePath );
+
+		try {
+
+			// Wait until the RAR appears...
+			new ActiveConditionChecker(new DescribedCondition("RAR appears in Summary tab list") {
+				public boolean isTrue() throws Exception {
+					// Refresh, then check.
+					ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
+					ContentTableRow rarRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(BASIC_RAR);
+					return null != rarRow;
+				}
+			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
+
+
+			ContentTableRow rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_RAR);
+
+			// Wait until the Status is "UP".
+			// TODO: Replace with ActiveConditionChecker.
+			int maxLoops = DEPLOY_TIMEOUT_SEC;
+			do {
+				String statusText = rarRow.getCellTextByColumnName("Status");
+				log.debug("RAR Status: "+statusText);
+				if( "UP".equals(statusText) )
+					break;
+
+				// Refresh page after 1 second.
+				ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
+				rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_RAR);
+
+				// We don't want an infinite loop by mistake.
+				if( maxLoops-- <= 0 ){
+					throw new EmbJoprTestException("RAR "+BASIC_RAR+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
+				}
+			} while( true );
+
+			// FAILS because of EMBJOPR-80.
+			rarRow.getLinkByLabel(BASIC_RAR).click();
+
+
+			// Check the values in info table(s)
+
+			// General Properties
+			HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
+			ContentInfoTable infoTable = ejtt.getContentInfoTable( genpropTable );
+			Properties props = infoTable.getProperties();
+
+			assertEquals(BASIC_RAR, props.getProperty("Name").trim());
+
+			// Resource Traits
+			infoTable = ejtt.getContentInfoTable(
+			ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
+			props = infoTable.getProperties();
+
+
+			String path = ejtt.getDeployDir()+"/"+BASIC_RAR;
+			assertEquals(path, props.getProperty("Path").trim());
+
+			assertEquals("no", props.getProperty("Exploded?").trim());
+
+			// Metrics Summary
+			HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Metrics Summary").getElement();
+			infoTable = ejtt.getContentInfoTable(summaryTable);
+			// (nothing here yet)
+
+
+		}
+		finally {
+			try {
+				undeployRar(BASIC_RAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}// testRarSummary()
+
+
+
+	/**
+	 * Changes RAR configuration, and checks whether the changes were saved.
+	 *
+	 */
+	public void testRarConfigurationTab() throws IOException, EmbJoprTestException {
+
+		// Deploy the RAR.
+		String rarFilePath = ejtt.getTestDataDir() +"/rar/"+ BASIC_RAR;
+		deployRar( rarFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.RAR, BASIC_RAR, 3000, 15);
+
+			// Navigate to the Configuration tab
+			ContentTableRow rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_RAR);
+			rarRow.getLinkByLabel(BASIC_RAR).click();
+
+			Page prevPage = client.getContentPage();
+			ejtt.tabMenu.clickConfigurationTab();
+			assertNotSame("We should move to other page after clicking the Config tab.",
+							prevPage, client.getContentPage());
+
+			// Read properties.
+			Properties props = new Properties();
+			String filePath = ejtt.getTestDataDir()+"/rar/"+"rar-conf-basic.properties";
+			props.load(new FileInputStream( filePath ));
+
+
+			// Set the configuration options and Save
+			fillOutForm(props);
+			//ejtt.getTabMenu().getTabContentBox().getButtonByLabel("Save");
+			ejtt.getClickableByID("resourceConfigurationForm:saveButton").click();
+
+
+			// Check whether the properties were saved.
+			ejtt.tabMenu.clickConfigurationTab();
+
+			// TODO: We don't see the success message! EMBJOPR-89
+			checkClientAndServerMessages("successfully", "successfully", false);
+
+			// FAILS because some of the values are read-only.  EMBJOPR-96
+			checkForm(props);
+
+			// TODO: Finish when the properties are marked read-only.
+
+		}
+		finally {
+			try {
+				undeployRar(BASIC_RAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+
+
+	/**
+	 * Redeploys RAR.
+	 *
+	 */
+
+	public void testRarRedeployment() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME  = BASIC_RAR;
+
+		// Deploy the RAR.
+		String appFilePath = ejtt.getTestDataDir() + "/"+DeployableTypes.RAR.getDataDir()+"/"+DEPLOYABLE_NAME;
+		deployRar( appFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_RAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.RAR, DEPLOYABLE_NAME, 3000, 15);
+
+			// Navigate to the Configuration tab
+			ContentTableRow rarRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			rarRow.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.tabMenu.clickContentTab();
+
+			String xPath = ".//table//input[@type='file']";
+			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			fileInput.setValueAttribute(appFilePath);
+			xPath = ".//table//input[@type='submit']";
+			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			submit.click();
+
+
+
+		}
+		finally {
+			try {
+				undeployRar(DEPLOYABLE_NAME); 
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
+		}
+
+	}
+
+	/**
+	 * Utilities for performing and checking deployment.
+	 * In the future, it should be general interface like
+	 *   boolean isDeployed( DeployableType type, String name ).
+	 */
+	protected class DeploymentUtils {
+
+		/**
+		 * Returns true if EmbJopr lists a deployable of given type and name,
+		 * and it's State is UP; false otherwise.
+		 */
+		private boolean isDeployedAccordingToEmbJopr( DeployableTypes type, String deployableName )
+						throws HtmlElementNotFoundException, IOException
+		{
+			// Refresh / go to the appropriate page.
+			ejtt.getNavTree().getNodeByLabel( type.getNavTreeLabel() ).click();
+			ContentTableRow rarRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(deployableName);
+			if( null == rarRow ){
+				log.debug("Row with "+deployableName+" not present.");
+				return false;
+			}
+
+			String statusText = rarRow.getCellTextByColumnName("Status");
+			if( "UP".equals(statusText) ){
+				return true;
+			}else{
+				log.debug("Row with "+deployableName+" has Status == '"+statusText+"' != UP.");
+				return false;
+			}
+		}
+		
+		
+		/**
+		 * Returns true if there's a file of the given name in server's deploy dir;
+		 * false otherwise.
+		 */
+		private boolean isDeployedAccordingToFileSystem( DeployableTypes type, String name )
+		{
+			String deployPath = System.getProperty(SYSPROP_DEPLOY_DIR);
+			String fileName = deployPath+"/"+name;
+			return (new File(fileName)).exists();
+		}
+
+		private void undeployViaFileSystem( String name ) throws EmbJoprTestException{
+			String deployPath = System.getProperty(SYSPROP_DEPLOY_DIR);
+			String fileName = deployPath+"/"+name;
+			File fileToDelete = new File(fileName);
+
+			if( !fileToDelete.exists() )
+				throw new EmbJoprTestException("Deployable doesn't exist: "+fileName);
+
+			if(fileToDelete.isFile()){
+				if( !fileToDelete.delete() ){
+					throw new EmbJoprTestException("Unable to delete: "+fileName);
+				}
+			}else if(fileToDelete.isDirectory()){
+				deleteDirectory(fileToDelete);
+			}
+
+		}// isDeployedAccordingToFileSystem()
+		
+
+	}// class DeploymentUtils
+
+
+
+	private void deployRar( String rarFilePath ) throws IOException, HtmlElementNotFoundException
+	{
+		if( !(new File(rarFilePath)).exists())
+			throw new FileNotFoundException(rarFilePath);
+
+		log.info("Deploying: "+rarFilePath);
+
+		// Navigate to Enterprise Archives
+		ejtt.getNavTree().getNodeLink(NAV_RAR).click();
+
+		// click on the "Add new resource" button
+		client.click("actionHeaderForm:addNewContent");  // 404 if setThrowExceptionOnFailingStatusCode(true) above
+
+		// Upload the file
+		HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
+		fileInput.setContentType("application/rar");
+		fileInput.setValueAttribute(rarFilePath);
+		client.click("createContentForm:addButton");
+		ejtt.sleep( 2000 );
+
+		// Log the message
+		ejtt.logServerMessage("Something went wrong with deploy: ");
+	}
+
+	private void undeployRar( String rarFileName ) throws IOException,
+			 HtmlElementNotFoundException, ActionNotAvailableException
+	{
+
+		// Navigate to Enterprise Archives
+		ejtt.getNavTree().getNodeLink(NAV_RAR).click();
+
+		ejtt.getTabMenu().clickSummaryTab();
+
+		/// Debug log - we're getting HTTP 500 here :/
+		String dumpFile = "target/"+this.getName()+"-undeployRar-"+(1000+RandomUtils.nextInt(1000))+".html";
+		log.debug("Dumping page to "+dumpFile);
+		DebugUtils.writeFile( dumpFile, client.getPageAsText());
+		int httpStatusCode = client.getContentPage().getWebResponse().getStatusCode();
+		if( 200 != httpStatusCode )
+			log.warn("Status code before undeployment is: "+httpStatusCode);
+
+		HtmlButtonInput deleteButton = getAppDeleteButton( rarFileName );
+		deleteButton.click();
+
+		// Log the message (with prefix of potential warning)
+		ejtt.logServerMessage("Something went wrong with undeploy: ");
+
+		// Sleep for 3 sec.  TODO: write some waitForUndeployed()
+		ejtt.sleep( 3000 );
+
+	}
+
+	public static void deleteDirectory(File path) throws EmbJoprTestException
+        {
+                List<String> undeletableFiles = new ArrayList();
+                deleteDirectory(path, undeletableFiles);
+                if( !undeletableFiles.isEmpty() ){
+                        throw new EmbJoprTestException("Couldn't delete following files: \n  "+
+                                                        StringUtils.join(undeletableFiles, "\n  ") + "\n");
+                }
+        }
+
+	public static void deleteDirectory(File path, List<String> undeletableFiles)
+        {
+	  if( path.exists() ) {
+		File[] files = path.listFiles();
+      	 	for(int i=0; i<files.length; i++) {
+            if(files[i].isDirectory()) {
+           	deleteDirectory(files[i], undeletableFiles );
+        	} else {
+           	if( !files[i].delete() ){
+           	undeletableFiles.add(files[i].getAbsolutePath());
+                }
+            }
+         }
+      }
+
+    	if( ! path.delete() )
+              undeletableFiles.add( path.getAbsolutePath() );
+      }
+
+
+}// class RarTest

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java	2009-05-06 21:15:45 UTC (rev 390)
@@ -0,0 +1,1283 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit.as5.app.war;
+
+import com.gargoylesoftware.htmlunit.Page;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+import com.gargoylesoftware.htmlunit.WebClient;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
+
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.*;
+import java.util.Properties;
+import javax.faces.application.FacesMessage;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.commons.lang.math.RandomUtils;
+import org.jboss.jopr.jsfunit.exceptions.*;
+import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
+import org.jboss.jopr.jsfunit.util.DescribedCondition;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
+import org.w3c.dom.Node;
+
+/**
+ * This class contains tests for testing the EmbJopr Application
+ * Management Functions for Web Components with JBoss AS 5.
+ *
+ * Most tests currently fail because of 
+ * JBAS-6640: Undeploying and deploying the same WAR in short time fails.
+ */
+public class WarTest extends ApplicationTestBaseAS5 {
+
+	public static final int DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL = 6000;
+	public static final int DEPLOY_UP_STATE_WAIT_CHECK_RETRIES = 50;
+
+	public static final DeployableTypes APP_TYPE = DeployableTypes.WAR;
+
+	
+
+	/**
+	 * @return the suite of tests being tested
+	 */
+	public static Test suite() {
+		return new TestSuite(WarTest.class);
+	}
+
+
+	/*
+	 * testName: testBasicWarDeployment
+	 * assertion:  verify basic deployment of an EJB JAR.
+	 * test Strategy:  Navigate to WAR Applications.
+	 *      Add a new resource.  Verify the resource was successfully
+	 *      deployed.  Undeploy the archive.
+	 *
+	 */
+	public void testBasicWarDeployment()
+					throws IOException, HtmlElementNotFoundException, ActionNotAvailableException
+	{
+
+		final String DEPLOYABLE_NAME = BASIC_WAR;
+
+		String filePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+
+		try {
+			deployWAR( filePath );
+
+			// Check the success message.
+			String expectedMessage = "Resource hellothere.war created successfully!";
+			checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+			// Use JMX to assert that the WAR really did deploy successfully
+			assertTrue("WAR was not deployed according to JMX", isWarDeployed(DEPLOYABLE_NAME));
+
+			// use HtmlUnit to test the newly deployed war in a new WebClient session
+			// note that I have full access to the FacesContext and the previous request
+			//Thread.sleep(3000); // Give JBoss some time to launch the webapp.
+			HttpServletRequest request =
+				 (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+			int port = request.getLocalPort();
+			WebClient webClient = new WebClient();
+			HtmlPage page = (HtmlPage)webClient.getPage("http://localhost:" + port + "/hellothere/hello.jsp");
+			assertTrue(page.asText().contains("HELLO WORLD"));
+
+		}
+		finally {
+			// Undeploy the WAR
+			/*HtmlButtonInput deleteButton = getAppDeleteButton(DEPLOYABLE_NAME);
+			deleteButton.click();
+			/*/
+			undeployWAR(DEPLOYABLE_NAME);
+			/**/
+
+		}
+	}
+
+
+
+
+
+	/**
+	 * Tries to deploy a invalid WAR (with invalid descriptor)
+	 * and checks that EmbJopr rejects this deployment.
+	 */
+	public void testBadWarRedeploy() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME = AppConstants.WAR_FILENAME_MALFORMED_APP;
+
+		try {
+
+			String filePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+			deployWAR(filePath);
+
+			checkClientAndServerMessages("Failed to create Resource", "Failed to create Resource", true);
+		}
+		finally {
+			undeployWAR(DEPLOYABLE_NAME);
+		}
+	}
+
+
+
+
+
+
+	/**
+	 * Various ways to navigate to a WAR application:
+	 * Nav tree, apps listing, WARs listing.
+	 */
+	public void testNavigationToWar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException, ActionOutOfSyncException
+	{
+
+		// JBossAS Servers node
+		NavTreeNode nodeServers = ejtt.getNavTree().getNodeByLabel("JBossAS Servers");
+		nodeServers.click();
+
+		{
+			String headerText = "JBossAS Server";
+			String jbossConfig = ejtt.getJBossConfig();
+
+			assertTrue("Page doesn't contain the header: "+headerText,
+							client.getPageAsText().contains(headerText));
+
+			assertTrue("EmbJopr should list at least one server (the one it is running on)" +
+							" and that should be in the UP sate.",
+							client.getPageAsText().contains("UP"));
+			// Check whether the server is listed. If not, Exception is thrown.
+			ContentTableRow row =
+							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("JBoss Application Server")
+							.getFirstRowContainingLink("JBoss AS 5 ("+jbossConfig+")");
+			// Click the server link
+			//HtmlAnchor link row.getLinkByLabel("JBoss App Server:default");
+			Node firstLink = row.getCellByColumnName("Name").getElementsByTagName("a").item(0);
+			if( null == firstLink || !(firstLink instanceof HtmlAnchor) )
+				throw new HtmlElementNotFoundException("Can't find the server link.");
+
+			((HtmlAnchor)firstLink).click();
+		}
+
+		// JBoss App Server:${config} node
+		{
+			String pageText = client.getPageAsText();
+
+			String jbossConfig = ejtt.getJBossConfig();
+			String headerText = "JBoss AS 5 ("+jbossConfig+")";
+			assertTrue("Page doesn't contain the header: "+headerText,
+							pageText.contains(headerText));
+
+			headerText = "General Properties";
+			assertTrue("Page doesn't contain the header: "+headerText,
+							pageText.contains(headerText));
+
+			// TODO: This page reports "Version:5.0 CR1" - EMBJOPR-77
+
+			ejtt.getNavTree().getNodeByLabel("Applications").click();
+
+		}
+
+
+		// Applications node
+		{
+
+			ejtt.getTabMenu().clickTab("Summary");
+
+			// TODO: Pagination options: EMBJOPR-78
+			// resourceDataScroller.xhtml, TableManager.java, "pageSizes".
+
+
+			// There's at least one Application with State == UP.
+			//ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Different types of Applications");
+			HtmlTable tableElement = (HtmlTable)client.getElement("categorySummaryForm:dataTable");
+			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTable(tableElement);
+			ContentTableRow row = table.getFirstRowContainingText("UP");
+
+			// Go further - try to click on any Application that is up.
+			HtmlAnchor link = row.getFirstLinkFromColumn("Name");
+			link.click();
+		}
+
+
+		{
+			// Go back to applications Sumary screen.
+			ejtt.getNavTree().getNodeByLabel("Applications").click();
+		}
+
+
+		// Concrete appliction node.
+		{
+
+			final String DEPLOYABLE_NAME = BASIC_WAR_02;
+
+			// Deploy the WAR.
+			String filePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+			deployWarRepeatedly( filePath );
+
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+
+			// Get to the app through listing.
+			log.debug("Looking for row with: "+DEPLOYABLE_NAME);
+
+			// Commented out: we would have to click trough pages.
+			//ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			ContentTableRow row = ejtt.getTabMenu().getTabContentBox()
+							.findLinkRowInDataTableUsingPagination(DEPLOYABLE_NAME);
+
+			assertTrue("Page doesn't list "+DEPLOYABLE_NAME+" in Summary tab.", row != null );
+
+			 // Go to the summary through listed item.
+			row.getLinkByLabel(DEPLOYABLE_NAME).click();
+			/**/
+
+			
+			// Other way to get to app: through nav tree.
+			ejtt.getNavTree().getNodeArrow(NAV_WAR).click();
+			ejtt.navTree.waitUntilNodeLoadedByAjax(DEPLOYABLE_NAME, 500, 15);
+			ejtt.navTree.getNodeByLabel(DEPLOYABLE_NAME).click();
+			/**/
+
+
+			// Check that we have the summary tab for the selected WAR.
+			assertTrue( "WAR name "+DEPLOYABLE_NAME+" not found in the content box.",
+				ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(DEPLOYABLE_NAME) );
+
+			// Go to the summary through nav tree node.
+			NavTreeNode appNode = ejtt.getNavTree().getNodeByLabel(NAV_WAR);
+			if( !appNode.isExpanded() ){
+				log.info("Expanding.");
+				appNode.getArrowLink().click();
+				Thread.sleep(2000);
+			}
+			ejtt.getNavTree().getNodeByLabel(DEPLOYABLE_NAME).click();
+			// Check that we have the summary tab for the selected WAR.
+			ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(DEPLOYABLE_NAME);
+
+			undeployWAR(DEPLOYABLE_NAME);
+
+		}
+
+
+	}// testNavigationToWar()
+
+
+
+
+
+
+
+	/**
+	 * Tests the values shown in the Summary tab of WAR.
+	 *
+	 *  FAILS because of:  EMBJOPR-110 (missing / at the beginning of the path)
+	 */
+	public void testWarSummaryTab() throws EmbJoprTestException, IOException, Exception {
+
+		final int DEPLOY_TIMEOUT_SEC = 120;
+
+		final String DEPLOYABLE_NAME = BASIC_WAR_03;
+
+		// Deploy the WAR
+		String appFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/war/"+DEPLOYABLE_NAME;
+		deployWarRepeatedly( appFilePath );
+
+		try {
+
+			// Wait until the WAR appears...
+			// Should be present when the page is reloaded.
+			// TODO: Replace with waitUntil~()
+			new ActiveConditionChecker(new DescribedCondition("WAR appears in Summary tab list") {
+				public boolean isTrue() throws Exception {
+					// Refresh, then check.
+					ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+					ContentTableRow appRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(DEPLOYABLE_NAME);
+					return null != appRow;
+				}
+			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
+			/**/
+
+
+			ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+
+			// Wait until the Status is "UP".
+			// TODO: Replace with ActiveConditionChecker.
+			int maxLoops = DEPLOY_TIMEOUT_SEC;
+			do {
+				String statusText = appRow.getCellTextByColumnName("Status");
+				log.debug("WAR Status: "+statusText);
+				if( "UP".equals(statusText) )
+					break;
+
+				// Refresh page after 1 second.
+				ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+				appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+
+				// We don't want an infinite loop by mistake.
+				if( maxLoops-- <= 0 ){
+					throw new EmbJoprTestException("WAR "+DEPLOYABLE_NAME+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
+				}
+			} while( true );
+
+			// FAILS because of EMBJOPR-80.
+			appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
+
+
+			// Check the values in info table(s)
+
+			// General Properties
+			HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
+			ContentInfoTable infoTable = ejtt.getContentInfoTable( genpropTable );
+			Properties props = infoTable.getProperties();
+			log.info("General Properties: "+props.toString());
+
+			assertEquals(DEPLOYABLE_NAME, props.getProperty("Name").trim());
+			//assertEquals("?", props.getProperty("Version")); // TODO: Where does RHQ get the version from?
+
+
+			// Resource Traits
+			infoTable = ejtt.getContentInfoTable(
+							ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
+			props = infoTable.getProperties();
+			log.info("Resource Traits: "+props.toString());
+			log.debug("Path: "+props.getProperty("Path"));///
+
+
+			String path = ejtt.getDeployDir()+"/"+DEPLOYABLE_NAME;
+			assertEquals(path, props.getProperty("Path").trim()); // EMBJOPR-110 here
+			assertEquals("no", props.getProperty("Exploded?").trim());
+
+			// Metrics Summary
+			HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Metrics Summary").getElement();
+			infoTable = ejtt.getContentInfoTable(summaryTable);
+			// (nothing here yet)
+
+
+		}
+		finally {
+			// Undeploy the WAR
+			undeployWAR( DEPLOYABLE_NAME );
+		}
+
+	}// testWarSummary()
+
+
+
+
+
+
+
+	/**
+	 * Changes WAR configuration, and checks whether the changes were saved.
+	 *
+	 */
+	public void testWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+
+		final String DEPLOYABLE_NAME = BASIC_WAR_04;
+
+		// Deploy the WAR.
+		String filePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
+		deployWarRepeatedly( filePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+			// Navigate to the Configuration tab
+			ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
+
+			Page prevPage = client.getContentPage();
+			ejtt.tabMenu.clickConfigurationTab();
+			assertNotSame("We should move to other page after clicking the Config tab.",
+							prevPage, client.getContentPage());
+
+			// Read properties.
+			Properties props = new Properties();
+			String propsFilePath = ejtt.getTestDataDir()+"/war/"+"war-conf-basic.properties";
+			props.load(new FileInputStream( propsFilePath ));
+
+
+			// Set the configuration options and Save
+			fillOutForm(props);
+			//ejtt.getTabMenu().getTabContentBox().getButtonByLabel("Save");
+			ejtt.getClickableByID("resourceConfigurationForm:saveButton").click();
+
+
+			// Check whether the properties were saved.
+			ejtt.tabMenu.clickConfigurationTab();
+
+			// TODO: We don't see the success message! EMBJOPR-89
+			//checkClientAndServerMessages("successfully", "successfully", false);
+
+			// FAILS because some of the values are read-only.  EMBJOPR-96
+			checkForm(props);
+
+			// TODO: Finish when the properties are marked read-only.
+
+		}
+		finally {
+			undeployWAR(DEPLOYABLE_NAME);
+		}
+
+	}
+
+
+
+
+
+	/**
+	 * Changes WAR configuration, and verifies that the changes were NOT saved.
+	 *
+	 * FAILS because some of the values are read-only.  EMBJOPR-96
+	 */
+	public void testWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME = BASIC_WAR_05;
+
+		// Deploy the WAR.
+		String filePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
+		deployWarRepeatedly( filePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
+							DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+			// Navigate to the Configuration tab
+			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			row.getLinkByLabel(DEPLOYABLE_NAME).click();
+
+			Page prevPage = client.getContentPage();
+			ejtt.tabMenu.clickConfigurationTab();
+			assertNotSame("We should move to other page after clicking the Config tab.",
+							prevPage, client.getContentPage());
+
+
+			// Load properties (we will use their names).
+			Properties propsToSet = new Properties();
+			String propsFilePath = ejtt.getTestDataDir()+"/war/"+"war-conf-basic.properties";
+			propsToSet.load(new FileInputStream( propsFilePath ));
+
+			// Get the current properties.
+			Properties propsOriginal = getFormPropertiesValues( propsToSet );
+
+
+			// Set the configuration options and CANCEL
+			fillOutForm( propsToSet );
+			ejtt.getClickableByID("resourceConfigurationForm:cancelButton").click();
+
+
+			// TODO: We should get back to Conf tab automatically: EMBJOPR-100
+			ejtt.tabMenu.clickConfigurationTab();
+
+			// Now check whether the values are the same as before editing.
+			checkForm( propsOriginal );
+
+		}
+		finally {
+			undeployWAR(DEPLOYABLE_NAME);
+		}
+
+	}
+
+
+
+
+	/**
+	 * Redeploys WAR, using WAR's Content tab upload form.
+	 *
+	 * Fails because of:  EMBJOPR-109
+	 */
+	public void testWarRedeployment() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME = BASIC_WAR_06;
+
+		// Deploy the WAR.
+		String appFilePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
+		deployWarRepeatedly( appFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+			// Navigate to the Configuration tab
+			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			row.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.tabMenu.clickContentTab();
+
+			String xPath = ".//table//input[@type='file']";
+			HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			fileInput.setValueAttribute(appFilePath);
+			xPath = ".//table//input[@type='submit']";
+			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			submit.click();
+
+		}
+		finally {
+			try {
+				DebugUtils.writeFile("target/redeployment.html", client.getPageAsText());///
+				undeployWAR(DEPLOYABLE_NAME); // EMBJOPR-109 here
+			}catch( Exception ex ){
+				log.error("Exception caught in finally: "+ex.getMessage(), ex);
+			}
+		}
+
+	}
+
+
+	/**
+	 * Deploys the WAR, undeploys it and deploys again.
+	 * All these actions are done using EmbJopr.
+	 *
+	 * Fails because of EMBJOPR-125
+	 */
+	public void testWarDeployUndeployDeploy() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME = BASIC_WAR_DUD;
+
+
+		// Deploy the WAR.
+		String appFilePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
+		deployWarRepeatedly( appFilePath );
+
+		try {
+
+			// Undeploy.
+			log.info("Undeploying "+DEPLOYABLE_NAME);
+			undeployWAR(DEPLOYABLE_NAME);
+			//DebugUtils.writeFile("target/DUD-undeploy.html", client.getPageAsText());///
+			assertFalse( "Deployable "+DEPLOYABLE_NAME+" shouldn't be listed as deployed after undeployment.",
+							ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
+
+			// Deploy the same war again.
+			log.info("Deploying "+DEPLOYABLE_NAME+" again.");
+			deployWAR( appFilePath );
+			//DebugUtils.writeFile("target/DUD-deploy.html", client.getPageAsText());///
+			// EMBJOPR-125 here.
+			assertTrue( "Deployable "+DEPLOYABLE_NAME+" should be listed as deployed after deployment.",
+							ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
+
+		}
+		finally {
+			try {
+				DebugUtils.writeFile("target/testDeployUndeployDeploy-finally.html", client.getPageAsText());///
+				undeployWAR(DEPLOYABLE_NAME);
+			}catch( Exception ex ){
+				log.error("Exception caught in finally: "+ex.getMessage(), ex);
+			}
+		}
+
+	}
+
+
+
+	/**
+	 * Deploys the WAR, undeploys it and deploys again.
+	 * All these actions are done using EmbJopr.
+	 */
+	public void testWarDeployUndeployDeployRetryOnErrors() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME = BASIC_WAR_DUD_RETRY;
+
+
+		// Deploy the WAR.
+		String appFilePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
+		deployWarRepeatedly( appFilePath );
+
+		try {
+
+			// Undeploy.
+			log.info("Undeploying "+DEPLOYABLE_NAME);
+			undeployWAR(DEPLOYABLE_NAME); // EMBJOPR-109 here
+			DebugUtils.writeFile("target/DUD_RETRY-undeploy.html", client.getPageAsText());///
+			assertFalse( "Deployable "+DEPLOYABLE_NAME+" shouldn't be listed as deployed after undeployment.",
+							ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
+
+			// Deploy the same war again.
+			log.info("Deploying "+DEPLOYABLE_NAME+" again.");
+			deployWarRepeatedly( appFilePath );
+			DebugUtils.writeFile("target/DUD_RETRY-deploy.html", client.getPageAsText());///
+			assertTrue( "Deployable "+DEPLOYABLE_NAME+" should be listed as deployed after deployment.",
+							ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
+
+		}
+		finally {
+			try {
+				DebugUtils.writeFile("target/testDeployUndeployDeployRetryOnErrors-finally.html", client.getPageAsText());///
+				undeployWAR(DEPLOYABLE_NAME); // EMBJOPR-109 here
+			}catch( Exception ex ){
+				log.error("Exception caught in finally: "+ex.getMessage(), ex);
+			}
+		}
+
+	}
+
+
+
+	/**
+	 * Deploys exploded WAR and checks whether it is reported as exploded.
+	 *
+	 * DISABLED - Badly written test, to be fixed. TODO: Hot-deploy
+	 */
+	public void DISABLEDtestUnzippedWarReportedAsExploded() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME = BASIC_WAR_07;
+
+		// Deploy the WAR.
+		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+		deployWarRepeatedly( WARFilePath );
+
+		try {
+			// Wait for WAR to be deployed and UP
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+			// Click the WAR link 
+			ejtt.getTabMenu().getTabContentBox().getFirstTable()
+							.getFirstRowContainingText(DEPLOYABLE_NAME).getFirstLinkFromColumn("Name").click();
+
+			DebugUtils.writeFile("target/res_traits.html", client.getPageAsText());///
+
+			ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits");
+			ContentInfoTable infoTable = ejtt.getTabMenu().getTabContentBox().getContentInfoTable(table.getElement());
+			Properties props = infoTable.getProperties();
+			log.info("Resource Traits: "+props.toString());
+			log.debug("Exploded?: "+props.getProperty("Exploded?"));
+
+			assertEquals("'Exploded?' should be 'yes'", "yes", props.getProperty("Exploded?")/*.toLowerCase()*/ );
+
+		}
+		finally {
+			undeployWAR(DEPLOYABLE_NAME);
+		}
+
+	}
+
+
+
+
+	/**
+	 * Checks WAR metrics tab.
+	 * 
+	 * FAILS because of:  EMBJOPR-110 (missing / at the beginning of the path)
+	 */
+	public void testWarMetricsTab() throws IOException, EmbJoprTestException {
+
+		final String DEPLOYABLE_NAME = BASIC_WAR_08;
+
+		// Deploy the WAR.
+		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+		deployWarRepeatedly( WARFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+			// Navigate to the Metrics tab
+			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			row.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.tabMenu.clickMetricsTab();
+
+			// Resource Traits
+
+			// Check the Path.
+			HtmlTable tbl = ejtt.getTabMenu().getTabContentBox().
+							getTableUnderHeader("Trait Values").getElement();
+			ContentInfoTable infoTable = ejtt.getContentInfoTable( tbl );
+			Properties props = infoTable.getProperties();
+
+			log.debug("Trait Values: "+ props.toString());
+
+			String path = ejtt.getDeployDir()+"/"+DEPLOYABLE_NAME;
+			assertEquals(path, props.getProperty("Path").trim());
+
+
+		}
+		finally {
+			undeployWAR(DEPLOYABLE_NAME);
+		}
+
+	}
+
+
+	/**
+	 * Changes WAR configuration, and checks whether the changes were saved.
+	 *
+	 * FAILS because some of the values are read-only.  EMBJOPR-96
+	 */
+	public void testWarMetricsTabRefreshButton() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+
+		final String DEPLOYABLE_NAME = BASIC_WAR_09;
+
+		// Deploy the WAR.
+		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+		deployWarRepeatedly( WARFilePath );
+
+		try {
+
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
+							DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+			// Navigate to the Metrics tab
+			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			row.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.tabMenu.clickMetricsTab();
+
+			// Click the Refresh button.
+			// Can this change to submit? Perhaps set an ID and use ejtt.getClickableById().
+			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Refresh").click();
+
+			// Check that we are still on the right tab.
+			assertTrue("Metrics tab is active", ejtt.tabMenu.isTabActive("Metrics") );
+			assertTrue("Page contains WAR name", client.getPageAsText().contains(DEPLOYABLE_NAME) );
+			assertTrue("Page contains 'Refresh'", client.getPageAsText().contains("Refresh") );
+
+		}
+		finally {
+			undeployWAR(DEPLOYABLE_NAME);
+		}
+
+	}
+
+
+	/**
+	 * Deploys an exploded WAR application.
+	 *
+	 * FAILS when undeploying, because:
+	 *
+org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException: Couldn't delete following files:
+  /home/ondra/work/JOPRembedded/embjopr-svn-trunk/jsfunit/target/jboss5x/deploy/unpacked-web1.war
+
+	at org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit$Deployment.deleteDirectory(EmbJoprTestToolkit.java:1662)
+	at org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit$Deployment.deleteFromDeployDir(EmbJoprTestToolkit.java:1652)
+	at org.jboss.jopr.jsfunit.as5.WarTest.testDeployUnpackedWar(WarTest.java:663)
+	 *
+	 * TODO:  Catch exceptions in finally and log them only (in all tests),
+	 *        to get the eventual real exception from the try block.
+	 *
+	 * TODO:  Think up how to simulate hot-undeploy.
+	 *				Should we rename it to other dir and then delete?
+	 *
+	 *        Perhaps it just still didn't process the deployed war when trying to undeploy?
+	 *				  "Condition 'WAR unpacked-web1.war appears in embjopr as deployed' not satisfied,
+	 *           0 retries left. Leaving the wait loop."
+	 *        Should we wait more? Or is it caused by failures of some previous tests?
+	 *
+	 */
+	public void testDeployUnpackedWar() throws IOException, EmbJoprTestException {
+
+
+		// Deploy the unpacked WAR.
+		// We have to use hotdeploy - can't upload a directory.
+		//ejtt.deployment.unzipToDeployDir("war/"+WAR_UNPACKED_ZIP, "");
+		String archivePath = ejtt.getTestDataDir()+"/war/"+WAR_UNPACKED_ZIP;
+		String tempDir = ejtt.getTempDir();
+		String destDir = ejtt.getDeployDir();
+
+		log.info("Unzipping "+archivePath+" to "+tempDir);
+		ejtt.deployment.unzipArchive( archivePath, tempDir );
+
+		log.info("Moving "+tempDir+"/"+WAR_UNPACKED+" to "+destDir+"/"+WAR_UNPACKED);
+		ejtt.deployment.moveDir(tempDir+"/"+WAR_UNPACKED, destDir+"/"+WAR_UNPACKED);
+		
+
+
+		try {
+			// Loop, wait for the app to appear.
+			log.info("Waiting for WAR to appear.");
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, WAR_UNPACKED,
+						DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+
+			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(WAR_UNPACKED);
+
+			// TODO: Finish
+
+			// TODO: Check whether Exploded?:  yes.  EMBJOPR-95
+
+			// TODO: DeploymentUtils, DeployableTypes, isAvailable enum inner classes
+
+			// TODO: Preliminary test - check system properties, their validity, java version, etc.
+		}
+		finally {
+			// Delete the WAR dir.
+			ejtt.deployment.deleteFromDeployDir(WAR_UNPACKED);
+		}
+	}
+
+
+
+
+	/**
+	 * Stops and starts the WAR using buttons in the Control tab, and checks
+	 * whether it's really stopped and started by sending HTTP requests.
+	 */
+	public void testStopAndStartWar() throws IOException, EmbJoprTestException
+	{
+		final String DEPLOYABLE_NAME = BASIC_WAR_STOPSTART;
+
+		// Get the HTTP port and the URL of the test page.
+		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+		int port = tmpRequest.getLocalPort();
+		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".war" ); // Eventually remove ".war" suffix.
+		String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
+
+		// Create web client we will use to check the web app.
+		WebClient webClient = new WebClient();
+		// We'll get 404 after stopping the app.
+		webClient.setThrowExceptionOnFailingStatusCode(false);
+		HtmlPage page;
+
+
+		// Deploy the WAR.
+		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+		deployWarRepeatedly( WARFilePath );
+
+		try {
+
+			// Wait until app is UP
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
+							DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+			// Assert that the app is running.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+      assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
+
+			// Refresh the page several times to increase the counter.
+			page = (HtmlPage) page.refresh();
+			page = (HtmlPage) page.refresh();
+
+			// Get the counter number.
+			String count1text = page.getBody().getHtmlElementById("count").getTextContent();
+			Integer count1 = NumberUtils.createInteger( count1text );
+
+
+
+			// Navigate to the web app, then to it's Control tab.
+			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			row.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.getTabMenu().clickControlTab();
+
+			// Click the Stop button.
+			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Stop").click();
+
+			// Check the latest message.
+			/*
+			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
+			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tr[contains(@class, 'rich-table-firstrow')]");
+			assertTrue( tr.getTextContent().contains("Success") );
+			/**/
+			assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
+
+
+			// Assert that the app is stopped.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertTrue( 200 != page.getWebResponse().getStatusCode() );
+
+
+			// Click the Start button.
+			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start").click();
+
+			// Check the latest message. TODO: EJTT class for ops history table?
+			/*
+			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getElement();
+			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
+			assertTrue( tr.getTextContent().contains("Success") );
+			*/
+			assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
+
+
+			// Assert that the app is running.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertTrue( 200 == page.getWebResponse().getStatusCode() );
+      assertTrue(page.asText().contains("HELLO WORLD"));
+
+			// Get the counter number.
+			String count2text = page.getBody().getHtmlElementById("count").getTextContent();
+			Integer count2 = NumberUtils.createInteger( count2text );
+
+			assertTrue( "Counter is reset upon app restart, thus should be lower after. " +
+							"Old: "+count1text+" New: "+count2text, count1 > count2 );
+
+
+		}
+		finally {
+			undeployWAR(DEPLOYABLE_NAME);
+		}
+	}
+
+
+	/**
+	 * Restarts the WAR using button in the Control tab,
+	 * and checks whether it's really restarted by checking whether JSP variable was reset.
+	 */
+	public void testRestartWar() throws IOException, EmbJoprTestException
+	{
+		final String DEPLOYABLE_NAME = BASIC_WAR_RESTART;
+
+		// Get the HTTP port and the URL of the test page.
+		HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+		int port = tmpRequest.getLocalPort();
+		String context = StringUtils.chomp( DEPLOYABLE_NAME, ".war" ); // Eventually remove ".war" suffix.
+		String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
+
+		// Create web client we will use to check the web app.
+		WebClient webClient = new WebClient();
+		webClient.setThrowExceptionOnFailingStatusCode(false);
+		HtmlPage page;
+
+
+		// Deploy the WAR.
+		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+		deployWarRepeatedly( WARFilePath );
+
+		try {
+
+			// Wait until app is UP
+			ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
+							DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+			// Assert that the app is running.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+      assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
+
+			// Refresh the page several times to increase the counter.
+			page = (HtmlPage) page.refresh();
+			page = (HtmlPage) page.refresh();
+
+			// Get the counter number.
+			String count1text = page.getBody().getHtmlElementById("count").getTextContent();
+			Integer count1 = NumberUtils.createInteger( count1text );
+
+
+
+			// Navigate to the web app, then to it's Control tab.
+			ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+			row.getLinkByLabel(DEPLOYABLE_NAME).click();
+			ejtt.getTabMenu().clickControlTab();
+
+			// Click the Restart button.
+			ejtt.tabMenu.getTabContentBox().getButtonByLabel("Restart").click();
+
+			// Check the latest message. TODO: EJTT class for ops history table?
+			/*
+			HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getElement();
+			HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tbody/tr[contains(@class, 'rich-table-firstrow')]");
+			assertTrue( tr.getTextContent().contains("Success") );
+			*/
+			assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
+			
+
+			// Assert that the app is running.
+      page = (HtmlPage)webClient.getPage(testPageUrl);
+			assert( 200 == page.getWebResponse().getStatusCode() );
+      assertTrue(page.asText().contains("HELLO WORLD"));
+
+			// Get the counter number.
+			String count2text = page.getBody().getHtmlElementById("count").getTextContent();
+			Integer count2 = NumberUtils.createInteger( count2text );
+
+			assertTrue( "Counter is reset upon app restart, thus should be lower after. " +
+							"Old: "+count1text+" New: "+count2text, count1 > count2 );
+
+		}
+		finally {
+			try {
+				undeployWAR(DEPLOYABLE_NAME);
+			} catch( Exception ex ){
+				DebugUtils.writeFile("target/testRestartWar-undeploy.html", client.getPageAsText());///
+				log.debug("Cathed an expected exception when trying to undeploy "+DEPLOYABLE_NAME+": "+ex );
+			}
+		}
+	}
+
+
+
+
+	/**
+	 * Deploys a WAR with bad farchive extension (.zip)
+	 * and checks whether EmbJopr reports deployment failure.
+	 */
+	public void testDeployWarWithIncorrectExtension() throws IOException, EmbJoprTestException
+	{
+		final String DEPLOYABLE_NAME = WAR_UNPACKED_ZIP;
+
+
+		// Deploy the WAR.
+		String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+		deployWAR( WARFilePath );
+
+		try {
+
+			assertTrue( "There should be a faces message informing about failure.",
+							server.getFacesMessages().hasNext() );
+
+			assertTrue( "The failure message should have ERROR severity.",
+							FacesMessage.SEVERITY_ERROR == server.getFacesMessages().next().getSeverity() );
+
+			assertTrue( "Page should contain 'Incorrect extension' string (deployer message).",
+				client.getPageAsText().contains("Incorrect extension") );
+
+		}
+		finally {
+			// Undeploy for the case it was (errorneously) deployed.
+			try {
+				undeployWAR(DEPLOYABLE_NAME);
+			} catch( Exception ex ){
+				log.debug("Cathed an expected exception when trying to undeploy "+DEPLOYABLE_NAME+": "+ex );
+			}
+		}
+	}
+
+
+	/**
+	 * Deploys a WAR and checks that it doesn't appear under the Embedded Web App's node.
+	 */
+	public void testStandaloneWarDoesntAppearInEmbeddedWars() throws IOException, EmbJoprTestException
+	{
+		final String DEPLOYABLE_NAME = BASIC_WAR_10;
+
+
+		// Deploy the WAR.
+		String appFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+
+		try {
+			
+			deployWAR( appFilePath );
+
+			ejtt.navTree.getNodeByLabel(DeployableTypes.EMB_WAR.getNavTreeLabel()).getLabelLink().click();
+
+			assertFalse( ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.EMB_WAR, DEPLOYABLE_NAME, false) );
+
+		}
+		finally {
+			// Undeploy for the case it was (errorneously) deployed.
+			try {
+				undeployWAR(DEPLOYABLE_NAME);
+			} catch( Exception ex ){
+				log.debug("Cathed an expected exception when trying to undeploy "+DEPLOYABLE_NAME+": "+ex );
+			}
+		}
+	}
+
+
+	/**
+	 * Hot-deploy several WARs and check that after some time, all of them are deployed and UP.
+	 */
+	public void testWarHotDeployManyWarsAtOnce() throws IOException, EmbJoprTestException
+	{
+		final String TEMP_DEPLOYABLE_NAME = BASIC_WAR_MULTI_HOTDEPLOY;
+		final int APP_COPIES = 25;
+
+		final String fileNamePattern = "multiHotdeploy%d"+APP_TYPE.getExtension();
+
+		try {
+
+			// Hot-deploy several WARs.
+			String fileSrcPath = ejtt.getTestDataDir() +"/"+APP_TYPE.getDataDir()+"/"+ TEMP_DEPLOYABLE_NAME;
+			for (int i = 0; i < APP_COPIES; i++) {
+				String fileDestPath = ejtt.getDeployDir() +"/"+ String.format(fileNamePattern, i);
+				FileUtils.copyFile( new File(fileSrcPath), new File(fileDestPath) );
+			}
+
+			// Wait for them to get displayed and UP.
+			for (int i = 0; i < APP_COPIES; i++) {
+				String deployableName = String.format(fileNamePattern, i);
+				ejtt.deployment.waitActivelyForDeployment(APP_TYPE, deployableName, 5000, 10);
+			}
+
+		}
+		finally {
+			// Undeploy all of them.
+			for (int i = 0; i < APP_COPIES; i++) {
+				String deployableName = String.format(fileNamePattern, i);
+				try {
+					//undeployWAR( deployableName ); // TODO: Generalize
+					ejtt.deployment.undeployViaEmbJopr(APP_TYPE, deployableName);
+				} catch( Exception ex ){
+					log.warn("Cathed an expected exception when trying to undeploy "+deployableName+": "+ex );
+				}
+			}
+		}
+		
+	}// testWarHotDeployManyWarsAtOnce()
+
+
+
+
+
+
+
+
+
+
+	/**
+	 * Deploys WAR.
+	 */
+	private void deployWAR( String warFilePath )
+					throws IOException, HtmlElementNotFoundException
+	{
+		if( !(new File(warFilePath)).exists())
+			throw new FileNotFoundException(warFilePath);
+		
+		log.info("Deploying: "+warFilePath);
+
+		// Navigate to Enterprise Archives
+		//ejtt.getNavTree().getNodeLink(NAV_WAR).click();
+		ejtt.getNavTree().getNodeLink(AppConstants.DeployableTypes.WAR.getNavTreeLabel()).click();
+
+		// click on the "Add new resource" button
+		client.click("actionHeaderForm:addNewContent");  // 404 if setThrowExceptionOnFailingStatusCode(true) above
+
+		// Upload the file
+		HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
+		fileInput.setContentType("application/war");
+		fileInput.setValueAttribute(warFilePath);
+		client.click("createContentForm:addButton");
+
+		// Log server message.
+		ejtt.logServerMessage();
+
+		// Todo: Write some waitUntilDeployed().
+		ejtt.sleep( 2000 );
+
+	}
+
+
+
+	/**
+	 * Deploys WAR; if fails, waits 5 seconds and re-tries; this is repeated 3 times.
+	 */
+	private void deployWarRepeatedly( final String warFilePath )
+					throws IOException, HtmlElementNotFoundException, EmbJoprTestException
+	{
+
+		File warFile = new File(warFilePath);
+		final String warFileName = warFile.getName();
+
+		try {
+
+			// Try it 5x in 5 second interval.
+			new ActiveConditionChecker( new DescribedCondition("WAR '"+warFileName+"' succesfuly deployed") {
+				public boolean isTrue() throws Exception {
+					deployWAR(warFilePath);
+
+					// Check whether deployment ended with success message.
+					/* Now broken, EmbJopr reports an error even when deployed successfully:
+					 * Failed to create Resource hellothere.war - cause:
+							java.lang.RuntimeException:java.lang.NullPointerException
+					 -> java.lang.NullPointerException:null
+					 * See EMBJOPR-116
+					 */
+					/*
+					if( server.getFacesMessages().hasNext() ){
+						FacesMessage msg = server.getFacesMessages().next();
+						if( msg.getSeverity() == FacesMessage.SEVERITY_INFO )
+							return true;
+						else
+							ejtt.logServerMessage("Deployment error: ");
+					}
+					*/
+
+					// Check whether the WAR is listed in EmbJopr.
+					log.debug("Looking for listed WAR: "+warFileName);
+					boolean listed = ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, warFileName, true);
+					if( listed )
+						return true;
+					else
+						return false;
+				}
+			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(5000, 8);
+
+		}
+		catch( Exception ex ){
+			throw new EmbJoprTestException(ex.getClass().getName()+": "+ex.getMessage(), ex);
+		}
+
+
+	}// deployWarRepeatedly()
+
+
+	/**
+	 * Undeploys war.
+	 *
+	 * TODO: When tested, merge to EJTT.Deployment.
+	 */
+	private void undeployWAR( String warFileName )
+					throws IOException, HtmlElementNotFoundException, ActionNotAvailableException
+	{
+
+		// Navigate to Enterprise Archives
+		ejtt.getNavTree().getNodeLink(NAV_WAR).click();
+
+		ejtt.getTabMenu().clickSummaryTab();
+
+		/// Debug log - we're getting HTTP 500 here :/
+		String dumpFile = "target/"+this.getName()+"-undeployWar-"+(1000+RandomUtils.nextInt(1000))+".html";
+		log.debug("Dumping page to "+dumpFile);
+		DebugUtils.writeFile( dumpFile, client.getPageAsText());
+		int httpStatusCode = client.getContentPage().getWebResponse().getStatusCode();
+		if( 200 != httpStatusCode )
+			log.warn("Status code before undeployment is: "+httpStatusCode);
+
+		//HtmlButtonInput deleteButton = getAppDeleteButton( warFileName ).click();
+
+		// Find the row containing the deployable. Use the pagination if needed.
+		ContentTableRow appRow = ejtt.getTabMenu().getTabContentBox().
+						findLinkRowInDataTableUsingPagination(warFileName);
+
+		/// DEBUG dump
+		//log.debug("Dumping page to: "+dumpFile+"2");
+		//DebugUtils.writeFile(dumpFile+"2", client.getPageAsText());
+
+		if( null == appRow ){
+			log.warn("Can't find row with WAR to undeploy: "+warFileName);
+			return;
+		}
+
+		appRow.getButtonByLabel("Delete").click();
+
+		// Log the message (with prefix of potential warning)
+		ejtt.logServerMessage("Something went wrong with undeploy: ");
+
+		// Sleep for 3 sec. TODO: write some waitForUndeployed(), as negation of opposite.
+		ejtt.sleep( 2000 );
+
+	}
+
+}
+




More information about the embjopr-commits mailing list