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

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Thu Apr 16 13:45:34 EDT 2009


Author: ozizka at redhat.com
Date: 2009-04-16 13:45:33 -0400 (Thu, 16 Apr 2009)
New Revision: 297

Modified:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
WAR tests adjusted to recent changes in web UI.

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java	2009-04-16 01:30:46 UTC (rev 296)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java	2009-04-16 17:45:33 UTC (rev 297)
@@ -126,6 +126,7 @@
 		public static final String EAR_UNPACKED_ZIP = "unpacked-ear1.ear.zip";
 		public static final String EAR_WITH_WAR = "EarWithWarNB.ear";
 		public static final String EAR_WITH_WAR_COUNTER = "EarWithWar-Counter.ear";
+		public static final String EAR_WITH_WAR_COUNTER_20 = "EarWithWar-Counter-20.ear";
 		public static final String EAR_EXT_DEPENDENCIES = "EarExtDependencies.ear";
 
 		// WAR

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java	2009-04-16 01:30:46 UTC (rev 296)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java	2009-04-16 17:45:33 UTC (rev 297)
@@ -172,6 +172,7 @@
         {
             HtmlAnchor link = (HtmlAnchor)i.next();
             String linkText = link.getTextContent();
+						log.debug(" * Link text: "+linkText);
             if (linkText.contains(linkLabel)) return link;
         }
 

Modified: 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-04-16 01:30:46 UTC (rev 296)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java	2009-04-16 17:45:33 UTC (rev 297)
@@ -94,7 +94,7 @@
 	 *
 	 * FAILED: JMX doesn't report EAR as deployed: eardeployment.ear
 	 */ 
-	public void XtestBasicEarDeployment() throws IOException, EmbJoprTestException
+	public void testBasicEarDeployment() throws IOException, EmbJoprTestException
 	{
 
 		final String DEPLOYABLE_NAME = BASIC_EAR;
@@ -175,7 +175,7 @@
 
 	 *  PASSED.
 	 */
-	public void XtestNavigationToEar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException
+	public void testNavigationToEar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException
 	{
 
 		// JBossAS Servers node 
@@ -301,7 +301,7 @@
 	 * junit.framework.ComparisonFailure: expected:<eardeployment.ear> but was:<ondra-redhat>
      at org.jboss.jopr.jsfunit.as5.EarTest.testEarSummaryTab(EarTest.java:323)
 	 */
-	public void XtestEarSummaryTab() throws EmbJoprTestException, IOException, Exception {
+	public void testEarSummaryTab() throws EmbJoprTestException, IOException, Exception {
 
 		final int DEPLOY_TIMEOUT_SEC = 20;
 
@@ -379,8 +379,11 @@
 
 		}
 		finally {
-			// Undeploy the EAR
-			undeployEar( BASIC_EAR );
+			try {
+				undeployEar(BASIC_EAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
 		}
 
 	}// testEarSummary()
@@ -392,7 +395,7 @@
 	 *
 	 * FAILS because some of the values are read-only.  EMBJOPR-96
 	 */
-	public void XtestEarConfigurationTab() throws IOException, EmbJoprTestException {
+	public void testEarConfigurationTab() throws IOException, EmbJoprTestException {
 
 		// Deploy the EAR.
 		String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
@@ -433,7 +436,11 @@
 
 		}
 		finally {
-			undeployEar(BASIC_EAR);
+			try {
+				undeployEar(BASIC_EAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
 		}
 
 	}
@@ -445,7 +452,7 @@
 	 *
 	 * FAILS because some of the values are read-only.  EMBJOPR-96
 	 */
-	public void XtestEarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+	public void testEarConfigurationTabCancel() throws IOException, EmbJoprTestException {
 
 		// Deploy the EAR.
 		String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
@@ -484,7 +491,11 @@
 
 		}
 		finally {
-			undeployEar(BASIC_EAR);
+			try {
+				undeployEar(BASIC_EAR);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
 		}
 
 	}
@@ -498,25 +509,27 @@
 	 * Fails because of EMBJOPR-42 - javax.el.ELException: org.jboss.seam.RequiredException:
 	 *     @Out attribute requires non-null value: updateBackingContentAction.packageDetails
 	 */
-	public void XtestEarRedeployment() throws IOException, EmbJoprTestException {
+	public void testEarRedeployment() throws IOException, EmbJoprTestException {
 
+		final String DEPLOYABLE_NAME  = BASIC_EAR;
+
 		// Deploy the EAR.
-		String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
-		deployEar( earFilePath );
+		String appFilePath = ejtt.getTestDataDir() + "/"+DeployableTypes.EAR.getDataDir()+"/"+DEPLOYABLE_NAME;
+		deployEar( appFilePath );
 
 		try {
 
 			ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
-			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME, 3000, 15);
 
 			// Navigate to the Configuration tab
-			ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-			earRow.getLinkByLabel(BASIC_EAR).click();
+			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(earFilePath);
+			fileInput.setValueAttribute(appFilePath);
 			xPath = ".//table//input[@type='submit']";
 			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
 			submit.click();
@@ -526,7 +539,7 @@
 		}
 		finally {
 			try {
-				undeployEar(BASIC_EAR); // EMBJOPR-109 here.
+				undeployEar(DEPLOYABLE_NAME); // EMBJOPR-109 here.
 			}catch( Exception ex ){
 				log.error("Caught exception when undeploying: "+ex, ex);
 			}
@@ -574,7 +587,7 @@
 	/**
 	 * Checks EAR metrics tab.
 	 */
-	public void XtestEarMetricsTab() throws IOException, EmbJoprTestException {
+	public void testEarMetricsTab() throws IOException, EmbJoprTestException {
 
 		// Deploy the EAR.
 		String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
@@ -736,8 +749,11 @@
 
 		}
 		finally {
-			//DebugUtils.writeFile("target/testEarWithWar-beforeUndeployment.html", client.getPageAsText() );///
-			undeployEar(DEPLOYABLE_NAME);
+			try {
+				undeployEar(DEPLOYABLE_NAME);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
 		}
 
 	}
@@ -850,7 +866,11 @@
 
 		}
 		finally {
-			undeployEar(DEPLOYABLE_NAME);
+			try {
+				undeployEar(DEPLOYABLE_NAME);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
 		}
 	}
 
@@ -933,7 +953,11 @@
 
 		}
 		finally {
-			undeployEar(DEPLOYABLE_NAME);
+			try {
+				undeployEar(DEPLOYABLE_NAME);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
 		}
 	}
 
@@ -968,11 +992,11 @@
 
 		}
 		finally {
-			// Undeploy the EAR.
-			undeployEar( DEPLOYABLE_NAME );
-
-			String expectedMessage = "Successfully deleted Enterprise Application (EAR) '"+DEPLOYABLE_NAME+"'.";
-			assertTrue(client.getPageAsText().contains( expectedMessage ));
+			try {
+				undeployEar(DEPLOYABLE_NAME);
+			}catch( Exception ex ){
+				log.error("Caught exception when undeploying: "+ex, ex);
+			}
 		}
 
 	}
@@ -982,17 +1006,71 @@
 
 
 
+	public void testEarRedeployDifferentVersion() 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() + "/"+DeployableTypes.EAR.getDataDir()+"/"+DEPLOYABLE_NAME;
+		ejtt.deployment.deployViaEmbJopr( DeployableTypes.EAR, appFilePath );
 
+		String appFilePath2 = ejtt.getTestDataDir() + "/"+DeployableTypes.EAR.getDataDir()+"/"+DEPLOYABLE_NAME2;
 
+		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(appFilePath2);
+			xPath = ".//table//input[@type='submit']";
+			HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+			submit.click();
 
+			// Check that the new app is deployed.
+			ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME2, 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.
 	 *
@@ -1248,7 +1326,7 @@
 		ejtt.getTabMenu().clickSummaryTab();
 
 		/// Debug log - we're getting HTTP 500 here :/
-		String dumpFile = "target/undeployEar-"+(1000+RandomUtils.nextInt(1000))+".html";
+		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();

Modified: 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-04-16 01:30:46 UTC (rev 296)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java	2009-04-16 17:45:33 UTC (rev 297)
@@ -37,6 +37,7 @@
 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.exceptions.*;
 import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
 import org.jboss.jopr.jsfunit.util.DescribedCondition;
@@ -103,17 +104,13 @@
 
 		}
 		finally {
-			//undeployWAR(DEPLOYABLE_NAME);
-
 			// Undeploy the WAR
-			HtmlButtonInput deleteButton = getAppDeleteButton(DEPLOYABLE_NAME);
+			/*HtmlButtonInput deleteButton = getAppDeleteButton(DEPLOYABLE_NAME);
 			deleteButton.click();
+			/*/
+			undeployWAR(DEPLOYABLE_NAME);
+			/**/
 
-			// This assert doesn't work.  jopr does remove the WAR, but for some
-			// reason, JBoss doesn't undeploy the MBeans
-			// JBAS-XXXX
-			//assertFalse(isWarDeployed(DEPLOYABLE_NAME));
-
 		}
 	}
 
@@ -1166,10 +1163,13 @@
 
 		ejtt.getTabMenu().clickSummaryTab();
 
-		/// DEBUG dump
-		//String dumpFile = "undeploy"+RandomUtils.nextInt()+".html";
-		//log.debug("Dumping page to: "+dumpFile);
-		//DebugUtils.writeFile(dumpFile, client.getPageAsText());
+		/// 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();
 

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-04-16 01:30:46 UTC (rev 296)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java	2009-04-16 17:45:33 UTC (rev 297)
@@ -246,7 +246,7 @@
 			DomElement navTreeForm = (DomElement)client.getElement(ID_NAV_TREE_FORM);
 			if( null == navTreeForm ){
 				try {
-					DebugUtils.writeFile("target/getNodeByLabel-IDnotFound.html", client.getPageAsText());
+					DebugUtils.writeFile("target/getNodeByLabel-navTreeIDnotFound.html", client.getPageAsText());
 				}catch(Exception ex){
 					log.error("Caught when writing file: "+ex);
 				}
@@ -264,7 +264,8 @@
 
 			if( null == nodeTable ){
 				if( throwIfNotFound )
-					throw new HtmlElementNotFoundException("Node '"+label+"' not found using XPath: "+xPath);
+					throw new HtmlElementNotFoundException(
+									"Node '"+label+"' not found using XPath: "+xPath, currentTest);
 				else
 					return null;
 			}				
@@ -280,7 +281,13 @@
      */
     public HtmlAnchor getNodeLink(String linkLabel) throws HtmlElementNotFoundException
     {
-				return getLinkInsideForm(ID_NAV_TREE_FORM, linkLabel);
+			//return getLinkInsideForm(ID_NAV_TREE_FORM, linkLabel);
+			/*HtmlElement navTreeForm = (HtmlElement) client.getElement(ID_NAV_TREE_FORM);
+			HtmlAnchor link = navTreeForm.getFirstByXPath(".//a[normalize-space() = '" + linkLabel + "']");
+			if( null == link ){
+				throw new HtmlElementNotFoundException(linkLabel)
+			}*/
+			return getNodeByLabel(linkLabel).getLabelLink();
     }
 
 




More information about the embjopr-commits mailing list