Author: lfryc(a)redhat.com
Date: 2010-12-06 12:57:57 -0500 (Mon, 06 Dec 2010)
New Revision: 20416
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataTable.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableFacets.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableFiltering.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableScroller.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSortingUsingColumn.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSortingUsingComponentControl.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/facets.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-column.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-component-control.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/AbstractDataTableTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTable.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacets.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacetsTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFilteringTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableScrollerTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSimpleTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSortingTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java
Log:
rich:dataTable - 74 tests for simple, facets, filtering and sorting (RFPL-912)
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/facets.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/facets.xhtml 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/facets.xhtml 2010-12-06
17:57:57 UTC (rev 20416)
@@ -118,16 +118,16 @@
<h:inputText id="headerInput"
value="#{richDataTableBean.facets['header']}" />
<h:outputLabel value="State Column Header:" />
- <h:inputText id="columnStateHeaderInput"
value="#{richDataTableBean.facets['columnStateHeader']}" />
+ <h:inputText id="stateHeaderInput"
value="#{richDataTableBean.facets['columnStateHeader']}" />
<h:outputLabel value="State Column Footer:" />
- <h:inputText id="columnStateFooterInput"
value="#{richDataTableBean.facets['columnStateFooter']}" />
+ <h:inputText id="stateFooterInput"
value="#{richDataTableBean.facets['columnStateFooter']}" />
<h:outputLabel value="Capital Column Header:" />
- <h:inputText id="columnCapitalHeaderInput"
value="#{richDataTableBean.facets['columnCapitalHeader']}" />
+ <h:inputText id="capitalHeaderInput"
value="#{richDataTableBean.facets['columnCapitalHeader']}" />
<h:outputLabel value="Capital Column Footer:" />
- <h:inputText id="columnCapitalFooterInput"
value="#{richDataTableBean.facets['columnCapitalFooter']}" />
+ <h:inputText id="capitalFooterInput"
value="#{richDataTableBean.facets['columnCapitalFooter']}" />
</h:panelGrid>
</a4j:ajax>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/filtering.xhtml 2010-12-06
17:57:57 UTC (rev 20416)
@@ -81,7 +81,7 @@
</h:panelGroup>
</f:facet>
- <h:graphicImage library="images" name="#{record.sex
== 'MALE' ? 'male.png' : 'female.png'}"
alt="record.sex" />
+ <h:graphicImage library="images" name="#{record.sex
== 'MALE' ? 'male.png' : 'female.png'}"
alt="#{record.sex}" />
<f:facet name="footer">
<h:outputText id="columnFooterSex"
value="Sex" />
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-column.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-column.xhtml 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-column.xhtml 2010-12-06
17:57:57 UTC (rev 20416)
@@ -70,7 +70,7 @@
<f:facet name="header">
<a4j:commandLink id="sortBySex"
value="Sex" render="richDataTable"
action="#{richDataTableBean.sorting['columnSex'].reverseOrder}" />
</f:facet>
- <h:graphicImage library="images" name="#{record.sex
== 'MALE' ? 'male.png' : 'female.png'}" />
+ <h:graphicImage library="images" name="#{record.sex
== 'MALE' ? 'male.png' : 'female.png'}"
alt="#{record.sex}" />
</rich:column>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-component-control.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-component-control.xhtml 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDataTable/sorting-using-component-control.xhtml 2010-12-06
17:57:57 UTC (rev 20416)
@@ -73,7 +73,7 @@
</rich:componentControl>
</h:commandLink>
</f:facet>
- <h:graphicImage library="images" name="#{record.sex
== 'MALE' ? 'male.png' : 'female.png'}" />
+ <h:graphicImage library="images" name="#{record.sex
== 'MALE' ? 'male.png' : 'female.png'}"
alt="#{record.sex}" />
</rich:column>
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/AbstractDataTableTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/AbstractDataTableTest.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/AbstractDataTableTest.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -57,9 +57,9 @@
ELEMENTS_TOTAL, ELEMENTS_TOTAL + 1 };
protected DataTable model;
- protected EmployeeTableModel employees;
- protected DataTableAttributes attributes;
- protected DataTableFacets facets;
+ protected EmployeeTableModel employees = new EmployeeTableModel();
+ protected DataTableAttributes attributes = new DataTableAttributes();
+ protected DataTableFacets facets = new DataTableFacets();
protected DataScroller dataScroller1 = new
AssertingDataScroller("outside-table",
pjq("span.rf-ds[id$=scroller1]"));
protected DataScroller dataScroller2 = new
AssertingDataScroller("inside-table-footer",
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTable.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTable.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTable.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -28,10 +28,6 @@
* @version $Revision$
*/
public interface DataTable {
- int getPages();
-
- int getCurrentPage();
-
int getRows();
int getColumns();
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableAttributes.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableAttributes.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -21,11 +21,16 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.abstractions;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import org.apache.commons.lang.StringUtils;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.model.SortMode;
import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
@@ -34,8 +39,12 @@
* @version $Revision$
*/
public class DataTableAttributes extends AbstractComponentAttributes {
+
+ JQueryLocator showDataLocator = pjq("input[id$=noDataCheckbox]");
+
public void setShowData(boolean showData) {
- setProperty("showData", showData);
+ selenium.check(showDataLocator, showData);
+ guardXhr(selenium).fireEvent(showDataLocator, Event.CLICK);
}
public void setFirst(Integer first) {
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacets.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacets.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacets.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -21,6 +21,9 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.abstractions;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+
+import org.jboss.test.selenium.locator.ElementLocator;
import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
/**
@@ -30,7 +33,7 @@
public class DataTableFacets extends AbstractComponentAttributes {
public void setNoData(String noData) {
- throw new UnsupportedOperationException("not implemeneted yet");
+ setProperty("noData", noData);
}
public void setHeader(String header) {
@@ -52,4 +55,9 @@
public void setCapitalFooter(String capitalFooter) {
setProperty("capitalFooter", capitalFooter);
}
+
+ @Override
+ protected void applyText(ElementLocator<?> locator, String value) {
+ guardXhr(selenium).type(locator, value);
+ }
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacetsTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacetsTest.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacetsTest.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -35,21 +35,18 @@
private static final String SAMPLE_STRING = "Abc123!@#ĚščСам";
private static final String EMPTY_STRING = "";
- @Test
public void testNoDataInstantChange() {
attributes.setShowData(false);
facets.setNoData(SAMPLE_STRING);
assertEquals(selenium.getText(model.getNoData()), SAMPLE_STRING);
}
- @Test
public void testNoDataEmpty() {
attributes.setShowData(false);
facets.setNoData(EMPTY_STRING);
assertEquals(selenium.getText(model.getNoData()), EMPTY_STRING);
}
- @Test
public void testNoDataLabelWithEmptyNoDataFacet() {
attributes.setShowData(false);
facets.setNoData(EMPTY_STRING);
@@ -57,61 +54,51 @@
assertEquals(selenium.getText(model.getNoData()), SAMPLE_STRING);
}
- @Test
public void testHeaderInstantChange() {
facets.setHeader(SAMPLE_STRING);
assertEquals(selenium.getText(model.getHeader()), SAMPLE_STRING);
}
- @Test
public void testHeaderEmpty() {
facets.setHeader(EMPTY_STRING);
assertFalse(selenium.isElementPresent(model.getHeader()));
}
- @Test
public void testStateHeaderInstantChange() {
facets.setStateHeader(SAMPLE_STRING);
assertEquals(selenium.getText(model.getColumnHeader(COLUMN_STATE)),
SAMPLE_STRING);
}
- @Test
public void testStateHeaderEmpty() {
- facets.setStateHeader(EMPTY_STRING);
+ facets.setStateFooter(EMPTY_STRING);
assertFalse(selenium.isElementPresent(model.getColumnHeader(COLUMN_STATE)));
}
- @Test
public void testStateFooterInstantChange() {
- facets.setStateHeader(SAMPLE_STRING);
+ facets.setStateFooter(SAMPLE_STRING);
assertEquals(selenium.getText(model.getColumnFooter(COLUMN_STATE)),
SAMPLE_STRING);
}
- @Test
public void testStateFooterEmpty() {
facets.setStateFooter(EMPTY_STRING);
assertFalse(selenium.isElementPresent(model.getColumnFooter(COLUMN_STATE)));
}
- @Test
public void testCapitalHeaderInstantChange() {
facets.setCapitalHeader(SAMPLE_STRING);
assertEquals(selenium.getText(model.getColumnHeader(COLUMN_CAPITAL)),
SAMPLE_STRING);
}
- @Test
public void testCapitalHeaderEmpty() {
facets.setCapitalHeader(EMPTY_STRING);
assertFalse(selenium.isElementPresent(model.getColumnHeader(COLUMN_CAPITAL)));
}
- @Test
public void testCapitalFooterInstantChange() {
- facets.setCapitalHeader(SAMPLE_STRING);
+ facets.setCapitalFooter(SAMPLE_STRING);
assertEquals(selenium.getText(model.getColumnFooter(COLUMN_CAPITAL)),
SAMPLE_STRING);
}
- @Test
public void testCapitalFooterEmpty() {
facets.setCapitalFooter(EMPTY_STRING);
assertFalse(selenium.isElementPresent(model.getColumnFooter(COLUMN_CAPITAL)));
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFilteringTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFilteringTest.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFilteringTest.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -30,7 +30,6 @@
import java.util.Collection;
import java.util.List;
-import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
@@ -39,7 +38,6 @@
import org.richfaces.tests.metamer.model.Employee;
import org.richfaces.tests.metamer.model.Employee.Sex;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -49,7 +47,7 @@
private static final String[] FILTER_NAMES = new String[] { "ivan",
"Гог", null, "Š" };
private static final String[] FILTER_TITLES = new String[] { "Director",
null, "CEO" };
- private static final Integer[] FILTER_NUMBER_OF_KIDS = new Integer[] { 2, 100, null,
5 };
+ private static final Integer[] FILTER_NUMBER_OF_KIDS = new Integer[] { 2, 100, 0, 5
};
JQueryLocator selectSex = jq("select");
JQueryLocator inputName = jq("input");
@@ -68,7 +66,6 @@
filterEmployee = new ExpectedEmployee();
}
- @Test
public void testFilterSex() {
filtering.selectSex(Sex.MALE);
filterEmployee.sex = Sex.MALE;
@@ -83,7 +80,6 @@
verifyFiltering();
}
- @Test
public void testFilterName() {
for (String filterName : FILTER_NAMES) {
filtering.selectName(filterName);
@@ -92,7 +88,6 @@
}
}
- @Test
public void testFilterTitle() {
for (String filterTitle : FILTER_TITLES) {
filtering.selectTitle(filterTitle);
@@ -101,7 +96,6 @@
}
}
- @Test
public void testFilterNumberOfKids1() {
for (Integer filterNumberOfKids : FILTER_NUMBER_OF_KIDS) {
filtering.selectNumberOfKids1(filterNumberOfKids);
@@ -110,7 +104,6 @@
}
}
- @Test
public void testFilterCombinations() {
filtering.selectTitle("Technology");
filterEmployee.title = "Technology";
@@ -128,8 +121,8 @@
filterEmployee.name = "9";
verifyFiltering();
- filtering.selectNumberOfKids1(1);
- filterEmployee.numberOfKids1 = 1;
+ filtering.selectNumberOfKids1(0);
+ filterEmployee.numberOfKids1 = 0;
verifyFiltering();
filtering.selectSex(Sex.FEMALE);
@@ -137,50 +130,89 @@
verifyFiltering();
}
- @Test
- public void testRefresh() {
- dataScroller1.gotoFirstPage();
+ public void testRerenderAll() {
+ dataScroller2.setLastPage(dataScroller2.obtainLastPage());
+ dataScroller2.gotoFirstPage();
rows = model.getRows();
filtering.selectName("an");
filterEmployee.name = "an";
+
+ expectedEmployees = filter(EMPLOYEES, getFilter());
- dataScroller1.gotoLastPage();
- int lastPage = dataScroller1.getCurrentPage();
+ dataScroller2.gotoLastPage();
+ int lastPage = dataScroller2.getCurrentPage();
assertTrue(lastPage > 1);
rerenderAll();
- assertEquals(dataScroller1.getCurrentPage(), lastPage);
+ assertEquals(dataScroller2.getCurrentPage(), lastPage);
+ assertTrue(dataScroller2.isLastPage());
verifyPageContent(lastPage);
+
+ dataScroller2.gotoFirstPage();
+ verifyPageContent(1);
+ }
+
+ public void testFullPageRefresh() {
+ dataScroller2.setLastPage(dataScroller2.obtainLastPage());
+ dataScroller2.gotoFirstPage();
+ rows = model.getRows();
+ filtering.selectName("an");
+ filterEmployee.name = "an";
+
+ expectedEmployees = filter(EMPLOYEES, getFilter());
+
+ dataScroller2.gotoLastPage();
+ int lastPage = dataScroller2.getCurrentPage();
+ assertTrue(lastPage > 1);
+
fullPageRefresh();
- assertEquals(dataScroller1.getCurrentPage(), lastPage);
+ assertEquals(dataScroller2.getCurrentPage(), lastPage);
+ assertTrue(dataScroller2.isLastPage());
verifyPageContent(lastPage);
+
+ dataScroller2.gotoFirstPage();
+ verifyPageContent(1);
}
public void verifyFiltering() {
expectedEmployees = filter(EMPLOYEES, getFilter());
- dataScroller1.gotoFirstPage();
+ dataScroller2.setLastPage(dataScroller2.obtainLastPage());
+
+ dataScroller2.gotoFirstPage();
rows = model.getRows();
verifyPageContent(1);
- dataScroller1.gotoPage(2);
- verifyPageContent(2);
+ if (dataScroller2.getLastPage() > 1) {
+ dataScroller2.gotoLastPage();
+ int lastPage = dataScroller2.getCurrentPage();
+ verifyPageContent(lastPage);
- dataScroller1.gotoLastPage();
- int lastPage = dataScroller1.getCurrentPage();
- verifyPageContent(lastPage);
+ if (dataScroller2.getLastPage() > 2) {
+ dataScroller2.gotoPage(2);
+ verifyPageContent(2);
+ }
- dataScroller1.gotoPage(lastPage - 1);
- verifyPageContent(lastPage - 1);
+ if (dataScroller2.getLastPage() > 3) {
+ dataScroller2.gotoPage(lastPage - 1);
+ verifyPageContent(lastPage - 1);
+ }
+ }
+
}
public void verifyPageContent(int page) {
- for (int row = 0; row < model.getRows(); row++) {
- int index = (page - 1) * rows + row;
- Employee expectedEmployee = expectedEmployees.get(index);
- filtering.verifyRow(expectedEmployee, row);
+ if (expectedEmployees.size() == 0) {
+ assertEquals(model.getRows(), 0);
+ assertTrue(model.isNoData());
+ } else {
+ for (int row = 0; row < model.getRows(); row++) {
+ int index = (page - 1) * rows + row;
+ Employee expectedEmployee = expectedEmployees.get(index);
+ filtering.verifyRow(expectedEmployee, row + 1);
+ }
}
}
@@ -256,24 +288,21 @@
public void selectName(String name) {
JQueryLocator input =
model.getColumnHeader(COLUMN_NAME).getDescendant(inputName);
- selenium.type(inputName, name);
- guardXhr(selenium).fireEvent(input, Event.BLUR);
+ guardXhr(selenium).type(input, name == null ? "" : name);
}
public void selectTitle(String title) {
JQueryLocator input =
model.getColumnHeader(COLUMN_TITLE).getDescendant(inputTitle);
- selenium.type(inputName, title);
- guardXhr(selenium).fireEvent(input, Event.BLUR);
+ guardXhr(selenium).type(input, title == null ? "" : title);
}
public void selectNumberOfKids1(int numberOfKids) {
JQueryLocator input =
model.getColumnHeader(COLUMN_NUMBER_OF_KIDS1).getDescendant(inputNumberOfKids1);
- selenium.type(inputName, Integer.toString(numberOfKids));
- guardXhr(selenium).fireEvent(input, Event.BLUR);
+ guardXhr(selenium).type(input, Integer.toString(numberOfKids));
}
public void verifyElement(int column, int row, Object expectedValue) {
- JQueryLocator locator = model.getColumnHeader(COLUMN_NAME);
+ JQueryLocator locator = model.getElement(column, row);
String text = selenium.getText(locator);
assertEquals(text, expectedValue.toString());
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableScrollerTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableScrollerTest.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableScrollerTest.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -23,9 +23,10 @@
import static org.testng.Assert.assertEquals;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Templates;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.richfaces.tests.metamer.ftest.model.DataScroller;
-import org.testng.annotations.Test;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -33,12 +34,14 @@
*/
public abstract class DataTableScrollerTest extends AbstractDataTableTest {
- @Test
+ @Inject
+ @Use("COUNTS")
+ Integer rows;
+
public void testRowCountFooterScroller() {
testRowCount(dataScroller2);
}
- @Test
@Templates(exclude = { "a4jRepeat1", "a4jRepeat2",
"hDataTable1", "hDataTable2", "richDataTable1,redDiv",
"richDataTable2,redDiv", "uiRepeat1", "uiRepeat2"
})
public void testRowCountOutsideTable() {
@@ -46,35 +49,32 @@
}
private void testRowCount(DataScroller dataScroller) {
- for (Integer rowsPerPage : COUNTS) {
- if (rowsPerPage != null) {
- attributes.setRows(rowsPerPage);
- selenium.waitForPageToLoad();
- }
+ if (rows != null) {
+ attributes.setRows(rows);
+ }
- dataScroller.gotoFirstPage();
- int rowCountPreset = attributes.getRows();
- int rowCountActual = model.getRows();
- assertEquals(rowCountActual, Math.min(ELEMENTS_TOTAL, rowCountPreset));
+ dataScroller.gotoFirstPage();
+ int rowCountPreset = attributes.getRows();
+ int rowCountActual = model.getRows();
+ assertEquals(rowCountActual, Math.min(ELEMENTS_TOTAL, rowCountPreset));
- assertEquals(dataScroller.hasPages(), rowCountActual < ELEMENTS_TOTAL);
- if (dataScroller.hasPages()) {
- dataScroller.gotoLastPage();
+ assertEquals(dataScroller.hasPages(), rowCountActual < ELEMENTS_TOTAL);
+ if (dataScroller.hasPages()) {
+ dataScroller.gotoLastPage();
- int pagesExpected = pageCountActualExpected(rowCountActual);
- int countOfVisiblePages = dataScroller.getCountOfVisiblePages();
+ int pagesExpected = pageCountActualExpected(rowCountActual);
+ int countOfVisiblePages = dataScroller.getCountOfVisiblePages();
- if (countOfVisiblePages < pagesExpected) {
- int lastVisiblePage = dataScroller.getLastVisiblePage();
- assertEquals(lastVisiblePage,
pageCountActualExpected(rowCountActual));
- } else {
- assertEquals(countOfVisiblePages, pagesExpected);
- }
+ if (countOfVisiblePages < pagesExpected) {
+ int lastVisiblePage = dataScroller.getLastVisiblePage();
+ assertEquals(lastVisiblePage, pageCountActualExpected(rowCountActual));
+ } else {
+ assertEquals(countOfVisiblePages, pagesExpected);
+ }
- int rowCountExpected = rowCountLastPageExpected(rowCountPreset);
- rowCountActual = model.getRows();
- assertEquals(rowCountActual, rowCountExpected);
- }
+ int rowCountExpected = rowCountLastPageExpected(rowCountPreset);
+ rowCountActual = model.getRows();
+ assertEquals(rowCountActual, rowCountExpected);
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSimpleTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSimpleTest.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSimpleTest.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -41,15 +41,19 @@
public abstract class DataTableSimpleTest extends AbstractDataTableTest {
protected static final int COLUMNS_TOTAL = 2;
+ private static final String NO_DATA = "There is no data.";
@Inject
+ @Use(empty = true)
protected Integer first = null;
@Inject
+ @Use(empty = true)
protected Integer rows = 30;
private int expectedFirst;
private int expectedRows;
+ private int expectedColumns;
private List<Capital> expectedElements;
@BeforeMethod
@@ -64,39 +68,44 @@
}
if (rows == null) {
- expectedRows = ELEMENTS_TOTAL - first;
+ expectedRows = ELEMENTS_TOTAL - expectedFirst;
} else {
- expectedRows = rows - first;
+ expectedRows = Math.min(rows, ELEMENTS_TOTAL) - expectedFirst;
}
+
+ if (expectedRows > 0) {
+ expectedColumns = COLUMNS_TOTAL;
+ } else {
+ expectedColumns = 0;
+ }
expectedElements = getExpectedElements();
}
- @Test
public void testRendered() {
+ attributes.setRendered(false);
+
assertFalse(model.isVisible());
assertFalse(model.isNoData());
assertEquals(model.getColumns(), 0);
assertEquals(model.getRows(), 0);
}
- @Test
public void testNoDataLabel() {
+ attributes.setNoDataLabel(NO_DATA);
+ attributes.setShowData(false);
+
assertTrue(model.isVisible());
assertTrue(model.isNoData());
assertEquals(model.getColumns(), 0);
assertEquals(model.getRows(), 0);
- assertEquals(selenium.getText(model.getNoData()), "There is no
data.");
+ assertEquals(selenium.getText(model.getNoData()), NO_DATA);
}
- @Test
- @Use(field = "first", value = "COUNTS")
public void testFirst() {
verifyTable();
}
- @Test
- @Use(field = "rows", value = "COUNTS")
public void testRows() {
verifyTable();
}
@@ -104,7 +113,7 @@
public void verifyTable() {
assertTrue(model.isVisible());
assertFalse(model.isNoData());
- assertEquals(model.getColumns(), COLUMNS_TOTAL);
+ assertEquals(model.getColumns(), expectedColumns);
assertEquals(model.getRows(), expectedRows);
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSortingTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSortingTest.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSortingTest.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -21,7 +21,9 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.abstractions;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
import static org.testng.Assert.assertEquals;
import java.lang.reflect.Method;
@@ -33,7 +35,7 @@
import org.apache.commons.lang.StringUtils;
import org.richfaces.model.SortMode;
import org.richfaces.tests.metamer.model.Employee;
-import org.testng.annotations.Test;
+import org.richfaces.tests.metamer.model.Employee.Sex;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
@@ -41,7 +43,10 @@
*/
public abstract class DataTableSortingTest extends AbstractDataTableTest {
- @Test
+ int rowIndex;
+ int modelIndex;
+ List<Employee> sortedEmployees;
+
public void testSortModeSingle() {
attributes.setSortMode(SortMode.single);
@@ -56,17 +61,65 @@
sortByColumn(COLUMN_NUMBER_OF_KIDS1);
verifySortingByColumns("numberOfKids");
+ }
+ public void testSortModeSingleReverse() {
+ attributes.setSortMode(SortMode.single);
+
+ sortByColumn(COLUMN_SEX);
+ sortByColumn(COLUMN_SEX);
+ verifySortingByColumns("sex-");
+
+ sortByColumn(COLUMN_TITLE);
+ sortByColumn(COLUMN_TITLE);
+ verifySortingByColumns("title-");
+
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ verifySortingByColumns("numberOfKids-");
+
+ sortByColumn(COLUMN_NAME);
+ sortByColumn(COLUMN_NAME);
+ verifySortingByColumns("name-");
+ }
+
+ public void testSortModeSingleDoesntRememberOrder() {
+ attributes.setSortMode(SortMode.single);
+
+ sortByColumn(COLUMN_NAME);
+ sortByColumn(COLUMN_TITLE);
+ sortByColumn(COLUMN_NAME);
+ verifySortingByColumns("name");
+ }
+
+ public void testSortModeSingleRerenderAll() {
+ attributes.setSortMode(SortMode.single);
+
+ sortByColumn(COLUMN_NAME);
+ verifySortingByColumns("name");
+
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ verifySortingByColumns("numberOfKids");
+
rerenderAll();
verifySortingByColumns("numberOfKids");
+ }
+ public void testSortModeSingleFullPageRefresh() {
+ attributes.setSortMode(SortMode.single);
+
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ verifySortingByColumns("numberOfKids");
+
+ sortByColumn(COLUMN_TITLE);
+ verifySortingByColumns("title");
+
fullPageRefresh();
- verifySortingByColumns("numberOfKids");
+ verifySortingByColumns("title");
}
- @Test
public void testSortModeMulti() {
- attributes.setSortMode(SortMode.single);
+ attributes.setSortMode(SortMode.multi);
sortByColumn(COLUMN_TITLE);
verifySortingByColumns("title");
@@ -79,50 +132,102 @@
sortByColumn(COLUMN_NAME);
verifySortingByColumns("title", "sex",
"numberOfKids", "name");
+ }
+ public void testSortModeMultiReverse() {
+ attributes.setSortMode(SortMode.multi);
+
+ sortByColumn(COLUMN_TITLE);
+ sortByColumn(COLUMN_TITLE);
+ verifySortingByColumns("title-");
+
+ sortByColumn(COLUMN_SEX);
+ sortByColumn(COLUMN_SEX);
+ verifySortingByColumns("title-", "sex-");
+
sortByColumn(COLUMN_NUMBER_OF_KIDS1);
- verifySortingByColumns("title", "sex", "name",
"numberOfKids");
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ verifySortingByColumns("title-", "sex-",
"numberOfKids-");
+ sortByColumn(COLUMN_NAME);
+ sortByColumn(COLUMN_NAME);
+ verifySortingByColumns("title-", "sex-",
"numberOfKids-", "name-");
+ }
+
+ public void testSortModeMultiReplacingOldOccurences() {
+ attributes.setSortMode(SortMode.multi);
+
sortByColumn(COLUMN_TITLE);
- verifySortingByColumns("sex", "name",
"numberOfKids", "title");
+ verifySortingByColumns("title");
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ verifySortingByColumns("title", "numberOfKids-");
+
+ sortByColumn(COLUMN_TITLE);
+ verifySortingByColumns("numberOfKids-", "title-");
+ }
+
+ public void testSortModeMultiRerenderAll() {
+ attributes.setSortMode(SortMode.multi);
+
+ sortByColumn(COLUMN_TITLE);
+ verifySortingByColumns("title");
+
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ verifySortingByColumns("title", "numberOfKids-");
+
+ sortByColumn(COLUMN_TITLE);
+ verifySortingByColumns("numberOfKids-", "title-");
+
rerenderAll();
- verifySortingByColumns("sex", "name",
"numberOfKids", "title");
+ verifySortingByColumns("numberOfKids-", "title-");
+ }
+ public void testSortModeMultiFullPageRefresh() {
+ attributes.setSortMode(SortMode.multi);
+
+ sortByColumn(COLUMN_TITLE);
+ verifySortingByColumns("title");
+
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ sortByColumn(COLUMN_NUMBER_OF_KIDS1);
+ verifySortingByColumns("title", "numberOfKids-");
+
+ sortByColumn(COLUMN_TITLE);
+ verifySortingByColumns("numberOfKids-", "title-");
+
fullPageRefresh();
- verifySortingByColumns("sex", "name",
"numberOfKids", "title");
+ verifySortingByColumns("numberOfKids-", "title-");
}
- int rowIndex;
- int modelIndex;
- List<Employee> sortedEmployees;
-
public void sortByColumn(int column) {
- selenium.click(model.getColumnHeader(column).getDescendant(jq("a")));
+
guardXhr(selenium).click(model.getColumnHeader(column).getDescendant(jq("a")));
}
public void verifySortingByColumns(String... columns) {
Comparator<Employee> employeeComparator =
getPropertyComparator(Employee.class, columns);
sortedEmployees = new ArrayList<Employee>(EMPLOYEES);
Collections.sort(sortedEmployees, employeeComparator);
-
+
+ dataScroller2.gotoFirstPage();
+
int firstPageRows = model.getRows();
- dataScroller1.gotoFirstPage();
-
for (rowIndex = 0; rowIndex < model.getRows(); rowIndex++) {
modelIndex = rowIndex;
verifyRow(rowIndex, modelIndex);
}
- dataScroller1.gotoPage(2);
+ dataScroller2.gotoPage(2);
for (rowIndex = 0; rowIndex < model.getRows(); rowIndex++) {
modelIndex = firstPageRows + rowIndex;
verifyRow(rowIndex, modelIndex);
}
- dataScroller1.gotoLastPage();
+ dataScroller2.gotoLastPage();
for (rowIndex = 0; rowIndex < model.getRows(); rowIndex++) {
modelIndex = EMPLOYEES.size() - model.getRows() + rowIndex;
@@ -131,10 +236,21 @@
}
public void verifyRow(int rowIndex, int modelIndex) {
- assertEquals(employees.getSex(rowIndex),
sortedEmployees.get(modelIndex).getSex());
- assertEquals(employees.getName(rowIndex), sortedEmployees.get(modelIndex));
- assertEquals(employees.getTitle(rowIndex),
sortedEmployees.get(modelIndex).getTitle());
- assertEquals(employees.getNumberOfKids(rowIndex),
sortedEmployees.get(modelIndex).getNumberOfKids());
+ Employee employee = sortedEmployees.get(modelIndex);
+
+ Sex sex = employees.getSex(rowIndex + 1);
+ String name = employees.getName(rowIndex + 1);
+ String title = employees.getTitle(rowIndex + 1);
+ int numberOfKids = employees.getNumberOfKids(rowIndex + 1);
+
+ String message = format(
+ "model: {0}; row: {1}; employee: {2}; found: sex '{3}', name
'{4}', title '{5}', numberOfKids '{6}'",
+ modelIndex, rowIndex, employee, sex, name, title, numberOfKids);
+
+ assertEquals(sex, employee.getSex(), message);
+ assertEquals(name, employee.getName(), message);
+ assertEquals(title, employee.getTitle(), message);
+ assertEquals(numberOfKids, employee.getNumberOfKids(), message);
}
public <T> Comparator<T> getPropertyComparator(final Class<T>
classT, final String... properties) {
@@ -143,16 +259,33 @@
@Override
public int compare(T o1, T o2) {
for (String property : properties) {
- String getterName = "get" +
StringUtils.capitalize(property);
+ boolean reverse = property.endsWith("-");
+ String getterName = "get" +
StringUtils.capitalize(property.replace("-", ""));
try {
+ Method getter = classT.getMethod(getterName);
- Method getter = classT.getClass().getMethod(getterName);
Object got1 = getter.invoke(o1);
Object got2 = getter.invoke(o2);
- Method compareTo =
got1.getClass().getMethod("compareTo", got2.getClass());
- int result = (Integer) compareTo.invoke(got1, got2);
+ int result;
+
+ if (String.class.equals(getter.getReturnType())) {
+ Method comparecompareToIgnoreCase =
got1.getClass().getMethod("compareToIgnoreCase",
+ got2.getClass());
+ result = (Integer) comparecompareToIgnoreCase.invoke(got1,
got2);
+ } else if (got1 instanceof Comparable<?> && got1
instanceof Comparable<?>) {
+ result = ((Comparable) got1).compareTo(got2);
+ // Method compareTo =
got1.getClass().getMethod("compareTo", got2.getClass());
+ // result = (Integer) compareTo.invoke(got1, got2);
+ } else {
+ throw new IllegalStateException("Cannot compare
values");
+ }
+
if (result != 0) {
- return result;
+ if (reverse) {
+ return -result;
+ } else {
+ return result;
+ }
}
} catch (Exception e) {
throw new IllegalArgumentException("Cannot obtain property
'" + property + "'", e);
@@ -160,7 +293,6 @@
}
return 0;
}
-
};
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java 2010-12-06
17:55:58 UTC (rev 20415)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -192,6 +192,9 @@
if (!hasPages()) {
return 1;
}
+ if (isLastPage()) {
+ return getCurrentPage();
+ }
int startPage = getCurrentPage();
clickLastPageButton();
int lastPage = getCurrentPage();
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataTable.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataTable.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataTable.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.model;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
+
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.reference.ReferencedLocator;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class DataTable extends AbstractModel<JQueryLocator> implements
+ org.richfaces.tests.metamer.ftest.abstractions.DataTable {
+
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ ReferencedLocator<JQueryLocator> tbody = ref(root, ">
tbody.rf-dt");
+ ReferencedLocator<JQueryLocator> firstColumnRows = ref(tbody, "> tr
> td.rf-dt-c:nth-child(1)");
+ ReferencedLocator<JQueryLocator> firstRowColumns = ref(tbody, ">
tr:eq(0) > td.rf-dt-c");
+ ReferencedLocator<JQueryLocator> noData = ref(tbody, "> tr >
td.rf-dt-ndt");
+ ReferencedLocator<JQueryLocator> columns = ref(tbody, "> tr");
+ JQueryLocator columnToElement = jq("td.rf-dt-c");
+
+ ReferencedLocator<JQueryLocator> thead = ref(root, ">
thead.rf-dt-thead");
+ ReferencedLocator<JQueryLocator> tableHeader = ref(thead, ">
tr.rf-dt-hdr > th.rf-dt-hdr-c");
+ ReferencedLocator<JQueryLocator> columnHeader = ref(thead, ">
tr.rf-dt-shdr > th.rf-dt-shdr-c");
+
+ ReferencedLocator<JQueryLocator> columnFooter = ref(root, ">
tfoot.rd-dt-tfoot > tr.rf-dt-sftr > td.rf-dt-sftr-c");
+
+ public DataTable(JQueryLocator root) {
+ super(root);
+ }
+
+ public DataTable(String name, JQueryLocator root) {
+ super(name, root);
+ }
+
+ @Override
+ public int getRows() {
+ return selenium.getCount(firstColumnRows);
+ }
+
+ @Override
+ public int getColumns() {
+ return selenium.getCount(firstRowColumns);
+ }
+
+ @Override
+ public boolean isVisible() {
+ return selenium.isElementPresent(root.getLocator()) &&
selenium.isVisible(root.getLocator());
+ }
+
+ @Override
+ public boolean isNoData() {
+ return selenium.isElementPresent(noData) && selenium.isVisible(noData);
+ }
+
+ @Override
+ public JQueryLocator getNoData() {
+ return noData.getReferenced();
+ }
+
+ @Override
+ public JQueryLocator getElement(int column, int row) {
+ return
columns.getNthOccurence(row).getChild(columnToElement).getNthChildElement(column);
+ }
+
+ @Override
+ public JQueryLocator getColumnHeader(int column) {
+ return columnHeader.getNthOccurence(column);
+ }
+
+ @Override
+ public JQueryLocator getColumnFooter(int column) {
+ return columnFooter.getNthOccurence(column);
+ }
+
+ @Override
+ public JQueryLocator getHeader() {
+ return tableHeader.getReferenced();
+ }
+
+}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableFacets.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableFacets.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableFacets.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richDataTable;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.richfaces.tests.metamer.ftest.abstractions.DataTableFacetsTest;
+import org.richfaces.tests.metamer.ftest.model.DataTable;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestDataTableFacets extends DataTableFacetsTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richDataTable/facets.xhtml");
+ }
+
+ @BeforeClass
+ public void setupModel() {
+ model = new DataTable(pjq("table.rf-dt[id$=richDataTable]"));
+ }
+
+ @Test
+ public void testNoDataInstantChange() {
+ super.testNoDataInstantChange();
+ }
+
+ @Test
+ public void testNoDataEmpty() {
+ super.testNoDataEmpty();
+ }
+
+ @Test
+ public void testNoDataLabelWithEmptyNoDataFacet() {
+ super.testNoDataLabelWithEmptyNoDataFacet();
+ }
+
+ @Test
+ public void testHeaderInstantChange() {
+ super.testHeaderInstantChange();
+ }
+
+ @Test
+ public void testHeaderEmpty() {
+ super.testHeaderEmpty();
+ }
+
+ @Test
+ public void testStateHeaderInstantChange() {
+ super.testStateHeaderInstantChange();
+ }
+
+ @Test
+ public void testStateHeaderEmpty() {
+ super.testStateHeaderEmpty();
+ }
+
+ @Test
+ public void testStateFooterInstantChange() {
+ super.testStateFooterInstantChange();
+ }
+
+ @Test
+ public void testStateFooterEmpty() {
+ super.testStateFooterEmpty();
+ }
+
+ @Test
+ public void testCapitalHeaderInstantChange() {
+ super.testCapitalHeaderInstantChange();
+ }
+
+ @Test
+ public void testCapitalHeaderEmpty() {
+ super.testCapitalHeaderEmpty();
+ }
+
+ @Test
+ public void testCapitalFooterInstantChange() {
+ super.testCapitalFooterInstantChange();
+ }
+
+ @Test
+ public void testCapitalFooterEmpty() {
+ super.testCapitalFooterEmpty();
+ }
+}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableFiltering.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableFiltering.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableFiltering.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richDataTable;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.richfaces.tests.metamer.ftest.abstractions.DataTableFilteringTest;
+import org.richfaces.tests.metamer.ftest.model.DataTable;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestDataTableFiltering extends DataTableFilteringTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richDataTable/filtering.xhtml");
+ }
+
+ @BeforeClass
+ public void setupModel() {
+ model = new DataTable(pjq("table.rf-dt[id$=richDataTable]"));
+ }
+
+ @Test
+ @Override
+ public void testFilterSex() {
+ super.testFilterSex();
+ }
+
+ @Test
+ @Override
+ public void testFilterName() {
+ super.testFilterName();
+ }
+
+ @Test
+ @Override
+ public void testFilterTitle() {
+ super.testFilterTitle();
+ }
+
+ @Test
+ @Override
+ public void testFilterNumberOfKids1() {
+ super.testFilterNumberOfKids1();
+ }
+
+ @Test
+ @Override
+ public void testFilterCombinations() {
+ super.testFilterCombinations();
+ }
+
+ @Test
+ @Override
+ public void testRerenderAll() {
+ super.testRerenderAll();
+ }
+
+ @Test
+ @Override
+ public void testFullPageRefresh() {
+ super.testFullPageRefresh();
+ }
+}
Copied:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableScroller.java
(from rev 20415,
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacets.java)
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableScroller.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableScroller.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richDataTable;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.richfaces.tests.metamer.ftest.abstractions.DataTableScrollerTest;
+import org.richfaces.tests.metamer.ftest.model.DataTable;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestDataTableScroller extends DataTableScrollerTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richDataTable/scroller.xhtml");
+ }
+
+ @BeforeClass
+ public void setupModel() {
+ model = new DataTable(pjq("table.rf-dt[id$=richDataTable]"));
+ }
+
+ @Test
+ @Override
+ public void testRowCountFooterScroller() {
+ super.testRowCountFooterScroller();
+ }
+
+ @Test
+ @Override
+ public void testRowCountOutsideTable() {
+ super.testRowCountOutsideTable();
+ }
+}
Copied:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSimple.java
(from rev 20415,
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacets.java)
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSimple.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSimple.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richDataTable;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.richfaces.tests.metamer.ftest.abstractions.DataTableSimpleTest;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.model.DataTable;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestDataTableSimple extends DataTableSimpleTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richDataTable/simple.xhtml");
+ }
+
+ @BeforeClass
+ public void setupModel() {
+ model = new DataTable(pjq("table.rf-dt[id$=richDataTable]"));
+ }
+
+ @Test
+ public void testRendered() {
+ super.testRendered();
+ }
+
+ @Test
+ public void testNoDataLabel() {
+ super.testNoDataLabel();
+ }
+
+ @Test
+ @Use(field = "first", value = "COUNTS")
+ public void testFirst() {
+ super.testFirst();
+ }
+
+ @Test
+ @Use(field = "rows", value = "COUNTS")
+ public void testRows() {
+ super.testRows();
+ }
+}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSortingUsingColumn.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSortingUsingColumn.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSortingUsingColumn.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richDataTable;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.richfaces.tests.metamer.ftest.abstractions.DataTableSortingTest;
+import org.richfaces.tests.metamer.ftest.model.DataTable;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestDataTableSortingUsingColumn extends DataTableSortingTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richDataTable/sorting-using-column.xhtml");
+ }
+
+ @BeforeClass
+ public void setupModel() {
+ model = new DataTable(pjq("table.rf-dt[id$=richDataTable]"));
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingle() {
+ super.testSortModeSingle();
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingleReverse() {
+ super.testSortModeSingleReverse();
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingleDoesntRememberOrder() {
+ super.testSortModeSingleDoesntRememberOrder();
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingleRerenderAll() {
+ super.testSortModeSingleRerenderAll();
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingleFullPageRefresh() {
+ super.testSortModeSingleFullPageRefresh();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMulti() {
+ super.testSortModeMulti();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMultiReverse() {
+ super.testSortModeMultiReverse();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMultiReplacingOldOccurences() {
+ super.testSortModeMultiReplacingOldOccurences();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMultiRerenderAll() {
+ super.testSortModeMultiRerenderAll();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMultiFullPageRefresh() {
+ super.testSortModeMultiFullPageRefresh();
+ }
+}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSortingUsingComponentControl.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSortingUsingComponentControl.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataTable/TestDataTableSortingUsingComponentControl.java 2010-12-06
17:57:57 UTC (rev 20416)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richDataTable;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.richfaces.tests.metamer.ftest.abstractions.DataTableSortingTest;
+import org.richfaces.tests.metamer.ftest.model.DataTable;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestDataTableSortingUsingComponentControl extends DataTableSortingTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richDataTable/sorting-using-component-control.xhtml");
+ }
+
+ @BeforeClass
+ public void setupModel() {
+ model = new DataTable(pjq("table.rf-dt[id$=richDataTable]"));
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingle() {
+ super.testSortModeSingle();
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingleReverse() {
+ super.testSortModeSingleReverse();
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingleDoesntRememberOrder() {
+ super.testSortModeSingleDoesntRememberOrder();
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingleRerenderAll() {
+ super.testSortModeSingleRerenderAll();
+ }
+
+ @Test
+ @Override
+ public void testSortModeSingleFullPageRefresh() {
+ super.testSortModeSingleFullPageRefresh();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMulti() {
+ super.testSortModeMulti();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMultiReverse() {
+ super.testSortModeMultiReverse();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMultiReplacingOldOccurences() {
+ super.testSortModeMultiReplacingOldOccurences();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMultiRerenderAll() {
+ super.testSortModeMultiRerenderAll();
+ }
+
+ @Test
+ @Override
+ public void testSortModeMultiFullPageRefresh() {
+ super.testSortModeMultiFullPageRefresh();
+ }
+}