maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r480978 - /maven/shared/trunk/maven-web-ui-tests/src/main/java/org/apache/maven/shared/web/test/XPathExpressionUtil.java
Date Thu, 30 Nov 2006 15:53:12 GMT
Author: evenisse
Date: Thu Nov 30 07:53:11 2006
New Revision: 480978

URL: http://svn.apache.org/viewvc?view=rev&rev=480978
Log: (empty)

Modified:
    maven/shared/trunk/maven-web-ui-tests/src/main/java/org/apache/maven/shared/web/test/XPathExpressionUtil.java

Modified: maven/shared/trunk/maven-web-ui-tests/src/main/java/org/apache/maven/shared/web/test/XPathExpressionUtil.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-web-ui-tests/src/main/java/org/apache/maven/shared/web/test/XPathExpressionUtil.java?view=diff&rev=480978&r1=480977&r2=480978
==============================================================================
--- maven/shared/trunk/maven-web-ui-tests/src/main/java/org/apache/maven/shared/web/test/XPathExpressionUtil.java
(original)
+++ maven/shared/trunk/maven-web-ui-tests/src/main/java/org/apache/maven/shared/web/test/XPathExpressionUtil.java
Thu Nov 30 07:53:11 2006
@@ -42,7 +42,33 @@
     public static final String END_NODE_TEST = "]";
 
     public static final String ANCHOR = "a";
+    
+    public static final String LIST = "ul";
+    
+    public static final String LINE = "li";
 
+    public static String getList( String[] values )
+    {
+        String xpathExpression = "";
+        
+        if ( values.length > 0 )
+        {        
+            xpathExpression += ELEMENT_ANY_LEVEL; 
+            xpathExpression += LIST;
+            xpathExpression += START_NODE_TEST;
+            
+            for (int nIndex = 0; nIndex < values.length; nIndex++ )
+            {
+                xpathExpression += ( ( nIndex > 0 ) ? AND : "" );                
+                xpathExpression += contains( LINE + position( nIndex + 1 ), values[nIndex]
);
+            }
+            
+            xpathExpression += END_NODE_TEST;
+        }    
+        
+        return xpathExpression;
+    }
+    
     /**
      * expression for acquiring an element in one of the table columns
      *
@@ -131,16 +157,16 @@
             {
                 // prepend "and" if index > 0
                 xpathExpression += ( ( nIndex > 0 ) ? AND : "" );
-                xpathExpression += contains( parent, columnPosition( nIndex + 1 ), columnValues[nIndex]
);
+                xpathExpression += contains( parent, TABLE_COLUMN + position( nIndex + 1
), columnValues[nIndex] );
             }
         }
 
         return xpathExpression;
     }
 
-    private static String columnPosition( int nIndex )
+    private static String position( int nIndex )
     {
-        return new String( TABLE_COLUMN + "[" + nIndex + "]" );
+        return new String( "[" + nIndex + "]" );
     }
 
     private static String contains( String parent, String element, String matchedString )



Mime
View raw message