Source Code Cross Referenced for ExcelFindRow.java in  » Testing » webtest » com » canoo » webtest » plugins » exceltest » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » webtest » com.canoo.webtest.plugins.exceltest 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright © 2006-2007 ASERT. Released under the Canoo Webtest license.
002:        package com.canoo.webtest.plugins.exceltest;
003:
004:        import com.canoo.webtest.engine.StepFailedException;
005:        import org.apache.poi.hssf.util.CellReference;
006:        import org.apache.poi.hssf.usermodel.HSSFSheet;
007:        import org.apache.poi.hssf.usermodel.HSSFCell;
008:
009:        /**
010:         * @author Rob Nielsen
011:         * @webtest.step category="Excel"
012:         *   name="excelFindRow"
013:         *   alias="findRow"
014:         * description="This step allows you to find a specific row on a sheet.  This is useful for using with repeat when you don't know how many rows there will be on a table.  It starts from a specified cell and searches down for a row matching the given text in an Excel spreadsheet and saves the resulting row as a property."
015:         */
016:        public class ExcelFindRow extends AbstractExcelSheetStep {
017:            private String fText;
018:            private String fPropertyName;
019:            private String fPropertyType;
020:            private String fStartRow = "1";
021:            private String fCol;
022:
023:            /**
024:             * @param index The row to start from
025:             * @webtest.parameter required="no"
026:             * default="1"
027:             * description="The row to start searching from"
028:             */
029:            public void setStartRow(final String index) {
030:                fStartRow = index;
031:            }
032:
033:            public String getStartRow() {
034:                return fStartRow;
035:            }
036:
037:            /**
038:             * @param index The index of the sheet to select
039:             * @webtest.parameter required="no"
040:             * description="The column reference (eg. 'B' or '2') to search in."
041:             */
042:            public void setCol(final String index) {
043:                fCol = index;
044:            }
045:
046:            public String getCol() {
047:                return fCol;
048:            }
049:
050:            /**
051:             * @param name The Property Name
052:             * @webtest.parameter required="yes"
053:             * description="The name of the property in which to store the value."
054:             */
055:            public void setProperty(final String name) {
056:                fPropertyName = name;
057:            }
058:
059:            public String getProperty() {
060:                return fPropertyName;
061:            }
062:
063:            /**
064:             * Sets the Type of the Property.<p>
065:             *
066:             * @param type The Property type
067:             * @webtest.parameter required="no"
068:             * description="The type of the property in which to store the value. Either \"ant\" or \"dynamic\"."
069:             * default="the \"defaultPropertyType\" as specified in the \"config\" element is used."
070:             */
071:            public void setPropertyType(final String type) {
072:                fPropertyType = type;
073:            }
074:
075:            public String getPropertyType() {
076:                return fPropertyType;
077:            }
078:
079:            public String getText() {
080:                return fText;
081:            }
082:
083:            /**
084:             * @param text
085:             * @webtest.parameter
086:             * 	 required="yes"
087:             *   description="The text value to search for.  Will be treated as a regex if surrounded with '/'s (eg '/test\d+/')"
088:             */
089:            public void setText(final String text) {
090:                fText = text;
091:            }
092:
093:            protected boolean verifyText(final String actualValue) {
094:                return verifyStrings(getText(), actualValue);
095:            }
096:
097:            protected void verifyParameters() {
098:                super .verifyParameters();
099:                nullParamCheck(getText(), "text");
100:                nullParamCheck(getProperty(), "property");
101:                nullParamCheck(getCol(), "col");
102:                optionalIntegerParamCheck(getStartRow(), "startRow", true);
103:            }
104:
105:            public void doExecute() {
106:                final CellReference cellReference = ExcelCellUtils
107:                        .getCellReference(this , null, getStartRow(), getCol());
108:                final HSSFSheet excelSheet = getExcelSheet();
109:                int row = cellReference.getRow();
110:                while (row <= excelSheet.getLastRowNum()) {
111:                    final HSSFCell excelCellAt = ExcelCellUtils.getExcelCellAt(
112:                            this , row, cellReference.getCol());
113:                    if (verifyText(ExcelCellUtils.getCellValueAt(excelCellAt))) {
114:                        setWebtestProperty(getProperty(), String
115:                                .valueOf(row + 1), getPropertyType());
116:                        return;
117:                    }
118:                    row++;
119:                }
120:                throw new StepFailedException("No cells were found matching '"
121:                        + getText() + "' starting from " + cellReference, this);
122:            }
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.