[embjopr-commits] EMBJOPR SVN: r210 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Wed Mar 11 12:43:42 EDT 2009


Author: ozizka at redhat.com
Date: 2009-03-11 12:43:42 -0400 (Wed, 11 Mar 2009)
New Revision: 210

Modified:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
Added NavTreeNode.findNodeByLabel()

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-11 14:43:29 UTC (rev 209)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java	2009-03-11 16:43:42 UTC (rev 210)
@@ -12,6 +12,7 @@
 import java.net.URL;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.math.NumberUtils;
+import org.jboss.jopr.jsfunit.AppConstants;
 import org.jboss.jsfunit.jsfsession.*;
 import org.w3c.dom.Element;
 
@@ -113,6 +114,10 @@
 		}
 
 
+
+
+
+
 		/**
 		 * Finds the nav tree node by it's link label.
 		 *
@@ -122,6 +127,12 @@
 		 *         when there's no node with given label.
 		 */
 		public NavTreeNode getNodeByLabel( String label ) throws HtmlElementNotFoundException{
+			return getNodeByLabel(label, true);
+		}
+		public NavTreeNode findNodeByLabel( String label ) throws HtmlElementNotFoundException{
+			return getNodeByLabel(label, false);
+		}
+		public NavTreeNode getNodeByLabel( String label, boolean throwIfNotFound ) throws HtmlElementNotFoundException{
 
 			DomElement navTreeForm = (DomElement)client.getElement(ID_NAV_TREE_FORM);
 
@@ -134,8 +145,12 @@
 
 			HtmlTable nodeTable = navTreeForm.getFirstByXPath( xPath );
 
-			if( null == nodeTable )
-				throw new HtmlElementNotFoundException("Node '"+label+"' not found using XPath: "+xPath);
+			if( null == nodeTable ){
+				if( throwIfNotFound )
+					throw new HtmlElementNotFoundException("Node '"+label+"' not found using XPath: "+xPath);
+				else
+					return null;
+			}				
 
 			return new NavTreeNode(nodeTable);
 
@@ -971,7 +986,6 @@
 	}
 
 
-
 	// TODO
 	protected class JMXDeploymentInfo {
 




More information about the embjopr-commits mailing list