[embjopr-commits] EMBJOPR SVN: r267 - 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
Wed Apr 1 10:51:03 EDT 2009


Author: ozizka at redhat.com
Date: 2009-04-01 10:51:03 -0400 (Wed, 01 Apr 2009)
New Revision: 267

Modified:
   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 updated

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-03-31 18:34:17 UTC (rev 266)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java	2009-04-01 14:51:03 UTC (rev 267)
@@ -347,7 +347,7 @@
 
 
 			String path = ejtt.getDeployDir()+"/"+BASIC_WAR;
-			assertEquals(path, props.getProperty("Path").trim());
+			assertEquals(path, props.getProperty("Path").trim()); // EMBJOPR-110 here
 			assertEquals("no", props.getProperty("Exploded?").trim());
 
 			// Metrics Summary
@@ -508,8 +508,12 @@
 
 		}
 		finally {
-			DebugUtils.writeFile("target/redeployment.html", client.getPageAsText());///
-			undeployWAR(BASIC_WAR);
+			try {
+				DebugUtils.writeFile("target/redeployment.html", client.getPageAsText());///
+				undeployWAR(BASIC_WAR); // EMBJOPR-109 here
+			}catch( Exception ex ){
+				log.error("Exception caught in finally: "+ex.getMessage(), ex);
+			}
 		}
 
 	}
@@ -583,6 +587,8 @@
 			ContentInfoTable infoTable = ejtt.getContentInfoTable( tbl );
 			Properties props = infoTable.getProperties();
 
+			log.debug("Trait Values: "+ props.toString());
+
 			String path = ejtt.getDeployDir()+"/"+BASIC_WAR;
 			assertEquals(path, props.getProperty("Path").trim());
 
@@ -743,10 +749,19 @@
 
 		try {
 
-			// Try it 3x in 5 second interval.
+			// Try it 5x in 5 second interval.
 			new ActiveConditionChecker( new DescribedCondition("WAR '"+warFilePath+"' 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 )
@@ -754,13 +769,22 @@
 						else
 							ejtt.logServerMessage("Deployment error: ");
 					}
-					return false;
+					*/
+
+					// Check whether the WAR is listed in EmbJopr.
+					File file = new File(warFilePath);
+					log.debug("Looking for listed WAR: "+file.getName());
+					boolean listed = ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, file.getName(), isJBoss4);
+					if( listed )
+						return true;
+					else
+						return false;
 				}
-			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(5000, 3);
+			}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(5000, 8);
 
 		}
 		catch( Exception ex ){
-			throw new EmbJoprTestException(ex.getMessage());
+			throw new EmbJoprTestException(ex.getMessage(), ex);
 		}
 
 

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-03-31 18:34:17 UTC (rev 266)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java	2009-04-01 14:51:03 UTC (rev 267)
@@ -1089,7 +1089,8 @@
 
 	/**
 	 *  Pagination control
-	 *  Not much tested yet.
+	 * @returns the pagination DIV, or null if the pagination is not displayed
+	 *    (DIV can exist, but contains no First, Prev, Next, Last etc.
 	 */
 	public class ContentBoxPagination {
 
@@ -1103,8 +1104,20 @@
 		/** Returns the HTML element of the bar with "First | Prev | 1 2 | Next Last" controls. */
 		public HtmlDivision getPageContols() throws HtmlElementNotFoundException {
 			//return (HtmlDivision) client.getElement(ID_PAGE_CONTROLS);
-			return (HtmlDivision) getTabMenu().getTabContentBox().getElement()
+			HtmlDivision div = (HtmlDivision) getTabMenu().getTabContentBox().getElement()
 							.getFirstByXPath(".//*[contains(@id, 'SummaryForm:dataTableScroller')]");
+			if( null == div )
+				return null;
+
+			// When no pagination is needed, #dataTableScroller div contains only a script element.
+			// So if their number is the same, return null, which means
+			List allElems    = div.getByXPath("*");
+			List scriptElems = div.getByXPath("script");
+			if( allElems.size() == scriptElems.size() )
+				return null;
+
+			// Else if it contains something besides script, return.
+			return div;
 		}
 
 		/** Returns the HTML Select element of page size selection. */




More information about the embjopr-commits mailing list