[embjopr-commits] EMBJOPR SVN: r635 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: util and 1 other directory.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Thu Jul 30 14:46:53 EDT 2009


Author: ozizka at redhat.com
Date: 2009-07-30 14:46:53 -0400 (Thu, 30 Jul 2009)
New Revision: 635

Modified:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
 * EarTest#testEarDeployFineThenRedeployMalformedDescriptor() updated.

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java	2009-07-30 16:43:44 UTC (rev 634)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java	2009-07-30 18:46:53 UTC (rev 635)
@@ -185,10 +185,11 @@
 	/**
 	 * TODO:
 	 * 1) Deploy a valid EAR with a war in it (to check it's functionality).
-	 * 2) In the Control tab, update it with an EAR with malformed descriptor.
+	 * 2) In the Content tab, update it with an EAR with malformed descriptor.
 	 * 3) Check that the error message contains "***** ROLLED BACK TO ORIGINAL APPLICATION FILE. *****"
 	 * 4) Check that the embedded WAR works to verify the rollback.
 	 *
+	 * FAILS:  EMBJOPR-226;  Should be fixed in trunk.
 	 */
 	public void testEarDeployFineThenRedeployMalformedDescriptor() throws IOException, EmbJoprTestException {
 
@@ -207,11 +208,17 @@
 
 			// Redeploy new version with malformed application.xml in the Content tab.
 
+			// Has to have the same name -> copy to a tmp dir.
 			earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_2_NAME;
 			String tmpFilePath = ejtt.getTempDir()+'/'+DEPLOYABLE_NAME;
 			FileUtils.copyFile( new File(earFilePath), new File(tmpFilePath) );
-			ejtt.deployment.deployViaEmbJopr(APP_TYPE, tmpFilePath);
 
+			// Fill the upload input and click the update button.
+			ejtt.getTabMenu().getTabContentBox().getFirstTable().getFirstLinkContaining( DEPLOYABLE_NAME ).click();
+			ejtt.getTabMenu().clickContentTab();
+			ejtt.getTabMenu().getTabContentBox().getFirstFileInput().setValueAttribute( earFilePath );
+			ejtt.getTabMenu().getTabContentBox().getButtonByLabel("Update").click();
+
 			// We should get an error message.
 			checkClientAndServerMessages("Failed to update", "Failed to update", true);
 

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java	2009-07-30 16:43:44 UTC (rev 634)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java	2009-07-30 18:46:53 UTC (rev 635)
@@ -744,15 +744,20 @@
 	}
 
 
+	/**
+	 *
+	 */
+	 public interface HtmlElementBacked {
+		 public HtmlElement getElement();
+		 public HtmlAnchor getFirstLinkContaining();
+	 }
 
 
 
-
-
 	/**
 	 * Inner class for manipulation with tab content box.
 	 */
-	public class TabContentBox extends PageAware {
+	public class TabContentBox extends PageAware /*implements HtmlElementBacked*/ {
 
 		private HtmlElement element;
 		public HtmlElement getElement() {			return element;		}
@@ -996,6 +1001,14 @@
 		}
 
 
+
+		/** Returns first file upload input. */
+		public HtmlFileInput getFirstFileInput(){
+			String xPath = ".//input[ contains( @type, 'file') and position() = 1 ]";
+			return (HtmlFileInput) this.getElement().getFirstByXPath(xPath);
+		}
+
+
 	}// inner class TabContentBox
 
 
@@ -1073,6 +1086,8 @@
 		private Map<String, Integer> colIndexes = null;
 		//private boolean analyzedButNotFound = false;
 
+
+		
 		/**
 		 * Return the table cell given by the row and column.
 		 */
@@ -1085,6 +1100,16 @@
 		    return tableCell.asText();
 		}
 
+
+
+		/** Returns first link containing given text. */
+		public HtmlAnchor getFirstLinkContaining( String label ){
+			String xPath = ".//a[ contains( normalize-space(), '"+label+"') and position() = 1 ]";
+			return (HtmlAnchor) this.getElement().getFirstByXPath(xPath);
+		}
+
+
+
 		/**
 		 * Returns the first row that contains given text, or throws HtmlElementNotFoundException.
 		 * @param text



More information about the embjopr-commits mailing list