[embjopr-commits] EMBJOPR SVN: r375 - in trunk/jsfunit: src/test/java/org/jboss/jopr/jsfunit and 3 other directories.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Mon May 4 13:43:37 EDT 2009


Author: smcgowan at redhat.com
Date: 2009-05-04 13:43:37 -0400 (Mon, 04 May 2009)
New Revision: 375

Added:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/RarTest.java
   trunk/jsfunit/testdata/rar/
   trunk/jsfunit/testdata/rar/jbosstestadapter.rar
Modified:
   trunk/jsfunit/pom.xml
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java
Log:
Basic Resource Adapter Tests, pom version updates

Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml	2009-05-04 17:12:38 UTC (rev 374)
+++ trunk/jsfunit/pom.xml	2009-05-04 17:43:37 UTC (rev 375)
@@ -110,13 +110,13 @@
       <dependency>
          <groupId>org.jboss.integration</groupId>
          <artifactId>jboss-profileservice-spi</artifactId>          
-         <version>5.1.0.CR2</version>
+         <version>5.1.0.CR3</version>
          <scope>provided</scope>
       </dependency>
       <dependency>
          <groupId>org.jboss.man</groupId>
          <artifactId>jboss-metatype</artifactId>
-         <version>2.1.0.CR4</version>
+         <version>2.1.0.CR8</version>
          <scope>provided</scope>
       </dependency>
       <dependency>

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java	2009-05-04 17:12:38 UTC (rev 374)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java	2009-05-04 17:43:37 UTC (rev 375)
@@ -153,10 +153,11 @@
 		public static final String WAR_UNPACKED_ZIP = "unpacked-web1.war.zip";
 
 
+	// RAR
+    public static final String BASIC_RAR = "jbosstestadapter.rar";
 
 
 
-
     // Defaults
     public static final String[] WAR_DEFAULTS = new String[]{
 			"ROOT.war", "invoker.war",

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java	2009-05-04 17:12:38 UTC (rev 374)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/ApplicationTestBaseAS5.java	2009-05-04 17:43:37 UTC (rev 375)
@@ -154,7 +154,23 @@
 		}
 	}
 
+	public boolean isRarDeployed(String rarName) throws RuntimeException
+        {
+                try {
+                        String query = "jboss.deployment:id=\"vfszip:" +
+                                                      System.getProperty("jsfunit.deploy.dir") + "/" + rarName + "/\",*";
+                        //String query = String.format("jboss.deployment:id=\"vfszip:%s/%s/\",*",
+                        //                               System.getProperty("jsfunit.deploy.dir"), rarName );
 
+                        return isMBeanStateDeployedByQuery(query);
+                }
+                catch (Exception e) {
+                        throw new RuntimeException(e);
+                }
+        }
+
+
+
 }// ApplicationTestBaseAS5 
 
 

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/RarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/RarTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/RarTest.java	2009-05-04 17:43:37 UTC (rev 375)
@@ -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;
+
+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/testdata/rar/jbosstestadapter.rar
===================================================================
(Binary files differ)


Property changes on: trunk/jsfunit/testdata/rar/jbosstestadapter.rar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream




More information about the embjopr-commits mailing list