JBoss Rich Faces SVN: r22690 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-07 17:25:37 -0400 (Wed, 07 Sep 2011)
New Revision: 22690
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java
Log:
RFPL-1439: Fix input format locator in a4jStatus.TestFacets (syntax error)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java 2011-09-07 14:27:22 UTC (rev 22689)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java 2011-09-07 21:25:37 UTC (rev 22690)
@@ -36,7 +36,7 @@
*/
public class TestFacets extends AbstracStatusTest {
JQueryLocator applyFacetsButton = pjq("input[id$=applyFacets]");
- JQueryLocator inputFormat = pjq("input{id$={0}Input]");
+ JQueryLocator inputFormat = pjq("input[id$={0}Input]");
@Override
public URL getTestUrl() {
13 years, 4 months
JBoss Rich Faces SVN: r22689 - branches/enterprise/3.3.1.SP3_RFPL-1631/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: ghjboss
Date: 2011-09-07 10:27:22 -0400 (Wed, 07 Sep 2011)
New Revision: 22689
Modified:
branches/enterprise/3.3.1.SP3_RFPL-1631/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
fix for RFPL-1631
Modified: branches/enterprise/3.3.1.SP3_RFPL-1631/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- branches/enterprise/3.3.1.SP3_RFPL-1631/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2011-09-06 21:01:19 UTC (rev 22688)
+++ branches/enterprise/3.3.1.SP3_RFPL-1631/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2011-09-07 14:27:22 UTC (rev 22689)
@@ -521,6 +521,7 @@
var parOffset = Position.cumulativeOffset(this.element);
var divOffset = Position.cumulativeOffset(innerDiv);
+ var scrollOffset = Position.realOffset(this.element);
var deltaX = divOffset[0] - parOffset[0];
var deltaY = divOffset[1] - parOffset[1];
@@ -571,8 +572,8 @@
if (!foundPos) {
layerPos = this.calcPosition(listPos[0].jointPoint, listPos[0].direction)
}
- this.layer.style.left = layerPos.left + hOffset - deltaX - this.left + "px";
- this.layer.style.top = layerPos.top + vOffset - deltaY - this.top + "px";
+ this.layer.style.left = layerPos.left + hOffset - deltaX - this.left - scrollOffset[0] + "px";
+ this.layer.style.top = layerPos.top + vOffset - deltaY - this.top - scrollOffset[1] + "px";
this.layer.style.width = this.layer.clientWidth + "px";
13 years, 4 months
JBoss Rich Faces SVN: r22688 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: attributes and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-06 17:01:19 -0400 (Tue, 06 Sep 2011)
New Revision: 22688
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/attributes/AttributeList.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFacets.java
Log:
RFPL-1439: Fix request typy for setting facet attributes (HTTP/XHR)
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 2011-09-06 21:00:55 UTC (rev 22687)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/AbstractDataTableTest.java 2011-09-06 21:01:19 UTC (rev 22688)
@@ -61,7 +61,6 @@
protected DataTable model;
protected EmployeeTableModel employees = new EmployeeTableModel();
- // 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/attributes/AttributeList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-06 21:00:55 UTC (rev 22687)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-06 21:01:19 UTC (rev 22688)
@@ -1,5 +1,6 @@
package org.richfaces.tests.metamer.ftest.attributes;
+import org.jboss.test.selenium.request.RequestType;
import org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes;
import org.richfaces.tests.metamer.ftest.a4jPoll.PollAttributes;
import org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes;
@@ -20,6 +21,6 @@
public static Attributes<RepeatAttributes> repeatAttributes = new Attributes<RepeatAttributes>();
public static Attributes<StatusAttributes> statusAttributes = new Attributes<StatusAttributes>();
public static Attributes<DataTableAttributes> dataTableAttributes = new Attributes<DataTableAttributes>();
- public static Attributes<DataTableFacets> dataTableFacets = new Attributes<DataTableFacets>();
+ public static Attributes<DataTableFacets> dataTableFacets = new Attributes<DataTableFacets>(RequestType.XHR); // for facets use XHR by default
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java 2011-09-06 21:00:55 UTC (rev 22687)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java 2011-09-06 21:01:19 UTC (rev 22688)
@@ -31,7 +31,6 @@
import org.richfaces.ExpandMode;
import org.richfaces.tests.metamer.bean.Model;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.richfaces.tests.metamer.ftest.abstractions.DataTableFacets;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.richfaces.tests.metamer.ftest.attributes.Attributes;
@@ -54,7 +53,6 @@
Attributes<CollapsibleSubTableAttributes> collapsibleSubTabAttributes = new Attributes<CollapsibleSubTableAttributes>();
DataTable dataTable = new DataTable(pjq("table[id$=richDataTable]"));;
- Attributes<DataTableFacets> dataTableFacets = new Attributes<DataTableFacets>(RequestType.XHR);
JQueryLocator showDataLocator = pjq("input[id$=noDataCheckbox]");
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFacets.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFacets.java 2011-09-06 21:00:55 UTC (rev 22687)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFacets.java 2011-09-06 21:01:19 UTC (rev 22688)
@@ -26,6 +26,7 @@
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import static org.richfaces.tests.metamer.ftest.abstractions.DataTableFacets.*;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.dataTableFacets;
import java.net.URL;
13 years, 4 months
JBoss Rich Faces SVN: r22687 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-06 17:00:55 -0400 (Tue, 06 Sep 2011)
New Revision: 22687
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacetsTest.java
Log:
RFPL-1439: Fix wrong attribute locator for Capital Footer instant change
This was mistake while refactoring to use unified way to setting attributes
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 2011-09-06 21:00:36 UTC (rev 22686)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacetsTest.java 2011-09-06 21:00:55 UTC (rev 22687)
@@ -94,7 +94,7 @@
}
public void testCapitalFooterInstantChange() {
- dataTableFacets.set(capitalHeader, SAMPLE_STRING);
+ dataTableFacets.set(capitalFooter, SAMPLE_STRING);
assertEquals(selenium.getText(model.getColumnFooter(COLUMN_CAPITAL)), SAMPLE_STRING);
}
13 years, 4 months
JBoss Rich Faces SVN: r22686 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-06 17:00:36 -0400 (Tue, 06 Sep 2011)
New Revision: 22686
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TestTreeNodeSimple.java
Log:
Fix wrong testURL
There were included full http address including localhost as host and application name in buildURL method param which should be only test related part of URL, shich causes open invalid address for testing.
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TestTreeNodeSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TestTreeNodeSimple.java 2011-09-05 21:07:07 UTC (rev 22685)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TestTreeNodeSimple.java 2011-09-06 21:00:36 UTC (rev 22686)
@@ -100,7 +100,7 @@
@Override
public URL getTestUrl() {
- return buildUrl(contextPath, "http://localhost:8080/metamer/faces/components/richTree/simple.xhtml");
+ return buildUrl(contextPath, "faces/components/richTree/simple.xhtml");
}
@Test
13 years, 4 months
JBoss Rich Faces SVN: r22685 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: attributes and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-05 17:07:07 -0400 (Mon, 05 Sep 2011)
New Revision: 22685
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/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/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/attributes/AttributeList.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/CollapsibleSubTableAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFacets.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFiltering.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableScroller.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSorting.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestExtendedDataTableSelection.java
Log:
RFPL-1439: change dataTable to use unified way to setting attributes
There are some abstrations classes used in more tests and classes for setting facests (not directly component attributes) - which was updated as well.
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 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/AbstractDataTableTest.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -26,7 +26,10 @@
import java.util.List;
+import org.jboss.test.selenium.GuardRequest;
+import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.request.RequestType;
import org.richfaces.tests.metamer.bean.Model;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.model.AssertingDataScroller;
@@ -58,12 +61,13 @@
protected DataTable model;
protected EmployeeTableModel employees = new EmployeeTableModel();
- protected DataTableAttributes attributes = new DataTableAttributes();
- protected DataTableFacets facets = new DataTableFacets();
+ // 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",
pjq("span.rf-ds[id$=scroller2]"));
+
+ JQueryLocator showDataLocator = pjq("input[id$=noDataCheckbox]");
public class EmployeeTableModel {
public Sex getSex(int row) {
@@ -84,4 +88,14 @@
return Integer.valueOf(selenium.getText(model.getElement(COLUMN_NUMBER_OF_KIDS1, row)));
}
}
+
+ protected void enableShowData(final boolean showData) {
+ new GuardRequest(RequestType.XHR) {
+ public void command() {
+ selenium.check(showDataLocator, showData);
+ selenium.fireEvent(showDataLocator, Event.CLICK);
+ selenium.fireEvent(showDataLocator, Event.CHANGE);
+ }
+ }.waitRequest();
+ }
}
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 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableAttributes.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -21,69 +21,19 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.abstractions;
-import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedList;
-
-import org.apache.commons.lang.StringUtils;
-import org.jboss.test.selenium.GuardRequest;
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.jboss.test.selenium.request.RequestType;
-import org.richfaces.model.SortMode;
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
-
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class DataTableAttributes extends AbstractComponentAttributes {
+public enum DataTableAttributes implements AttributeEnum {
- JQueryLocator showDataLocator = pjq("input[id$=noDataCheckbox]");
-
- public void setShowData(final boolean showData) {
- new GuardRequest(RequestType.XHR) {
- public void command() {
- selenium.check(showDataLocator, showData);
- selenium.fireEvent(showDataLocator, Event.CLICK);
- selenium.fireEvent(showDataLocator, Event.CHANGE);
- }
- }.waitRequest();
- }
-
- public void setFirst(Integer first) {
- setProperty("first", first);
- }
-
- public void setNoDataLabel(String noDataLabel) {
- setProperty("noDataLabel", noDataLabel);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setRows(Integer rows) {
- setProperty("rows", rows);
- }
-
- public int getRows() {
- return Integer.valueOf(getProperty("rows"));
- }
-
- public void setSortMode(SortMode sortMode) {
- setProperty("sortMode", sortMode);
- }
-
- public void setSortPriority(Collection<String> sortPriority) {
- setProperty("sortPriority", sortPriority);
- }
-
- public Collection<String> getSortPriority() {
- String string = getProperty("sortPriority");
- return new LinkedList<String>(Arrays.asList(StringUtils.split(string, "[], ")));
-
- }
+ first,
+ noDataLabel,
+ rendered,
+ rows,
+ sortMode,
+ sortPriority,
+
}
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 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacets.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -21,47 +21,20 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.abstractions;
-import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
-
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class DataTableFacets extends AbstractComponentAttributes {
-
- public void setNoData(String noData) {
- setProperty("noData", noData);
- }
-
- public void setHeader(String header) {
- setProperty("header", header);
- }
+public enum DataTableFacets implements AttributeEnum {
- public void setFooter(String footer) {
- setProperty("footer", footer);
- }
+ noData,
+ header,
+ footer,
+ stateHeader,
+ stateFooter,
+ capitalHeader,
+ capitalFooter
- public void setStateHeader(String stateHeader) {
- setProperty("stateHeader", stateHeader);
- }
-
- public void setStateFooter(String stateFooter) {
- setProperty("stateFooter", stateFooter);
- }
-
- public void setCapitalHeader(String capitalHeader) {
- setProperty("capitalHeader", capitalHeader);
- }
-
- 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 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableFacetsTest.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -21,8 +21,11 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.abstractions;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.dataTableFacets;
import static org.testng.Assert.assertEquals;
+import static org.richfaces.tests.metamer.ftest.abstractions.DataTableFacets.*;
+
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
@@ -33,70 +36,70 @@
private static final String EMPTY_STRING = "";
public void testNoDataInstantChange() {
- attributes.setShowData(false);
- facets.setNoData(SAMPLE_STRING);
+ enableShowData(false);
+ dataTableFacets.set(noData, SAMPLE_STRING);
assertEquals(selenium.getText(model.getNoData()), SAMPLE_STRING);
}
public void testNoDataEmpty() {
- attributes.setShowData(false);
- facets.setNoData(EMPTY_STRING);
+ enableShowData(false);
+ dataTableFacets.set(noData, EMPTY_STRING);
assertEquals(selenium.getText(model.getNoData()), EMPTY_STRING);
}
public void testHeaderInstantChange() {
- facets.setHeader(SAMPLE_STRING);
+ dataTableFacets.set(header, SAMPLE_STRING);
assertEquals(selenium.getText(model.getHeader()), SAMPLE_STRING);
}
public void testHeaderEmpty() {
- facets.setHeader(EMPTY_STRING);
+ dataTableFacets.set(header, EMPTY_STRING);
if (selenium.isElementPresent(model.getHeader())) {
assertEquals(selenium.getText(model.getHeader()), EMPTY_STRING);
} else {
- facets.setHeader(SAMPLE_STRING);
+ dataTableFacets.set(header, SAMPLE_STRING);
assertEquals(selenium.getText(model.getHeader()), SAMPLE_STRING);
}
}
public void testStateHeaderInstantChange() {
- facets.setStateHeader(SAMPLE_STRING);
+ dataTableFacets.set(stateHeader, SAMPLE_STRING);
assertEquals(selenium.getText(model.getColumnHeader(COLUMN_STATE)), SAMPLE_STRING);
}
public void testStateHeaderEmpty() {
- facets.setStateHeader(EMPTY_STRING);
+ dataTableFacets.set(stateHeader, EMPTY_STRING);
assertEquals(selenium.getText(model.getColumnHeader(COLUMN_STATE)), EMPTY_STRING);
}
public void testStateFooterInstantChange() {
- facets.setStateFooter(SAMPLE_STRING);
+ dataTableFacets.set(stateFooter, SAMPLE_STRING);
assertEquals(selenium.getText(model.getColumnFooter(COLUMN_STATE)), SAMPLE_STRING);
}
public void testStateFooterEmpty() {
- facets.setStateFooter(EMPTY_STRING);
+ dataTableFacets.set(stateFooter, EMPTY_STRING);
assertEquals(selenium.getText(model.getColumnFooter(COLUMN_STATE)), EMPTY_STRING);
}
public void testCapitalHeaderInstantChange() {
- facets.setCapitalHeader(SAMPLE_STRING);
+ dataTableFacets.set(capitalHeader, SAMPLE_STRING);
assertEquals(selenium.getText(model.getColumnHeader(COLUMN_CAPITAL)), SAMPLE_STRING);
}
public void testCapitalHeaderEmpty() {
- facets.setCapitalHeader(EMPTY_STRING);
+ dataTableFacets.set(capitalHeader, EMPTY_STRING);
assertEquals(selenium.getText(model.getColumnHeader(COLUMN_CAPITAL)), EMPTY_STRING);
}
public void testCapitalFooterInstantChange() {
- facets.setCapitalFooter(SAMPLE_STRING);
+ dataTableFacets.set(capitalHeader, SAMPLE_STRING);
assertEquals(selenium.getText(model.getColumnFooter(COLUMN_CAPITAL)), SAMPLE_STRING);
}
public void testCapitalFooterEmpty() {
- facets.setCapitalFooter(EMPTY_STRING);
+ dataTableFacets.set(capitalFooter, EMPTY_STRING);
assertEquals(selenium.getText(model.getColumnFooter(COLUMN_CAPITAL)), EMPTY_STRING);
}
}
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 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableScrollerTest.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -22,6 +22,7 @@
package org.richfaces.tests.metamer.ftest.abstractions;
import static org.testng.Assert.assertEquals;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.dataTableAttributes;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Templates;
@@ -49,11 +50,11 @@
private void testRowCount(DataScroller dataScroller) {
if (rows != null) {
- attributes.setRows(rows);
+ dataTableAttributes.set(DataTableAttributes.rows, rows);
}
dataScroller.gotoFirstPage();
- int rowCountPreset = attributes.getRows();
+ int rowCountPreset = Integer.parseInt(dataTableAttributes.get(DataTableAttributes.rows));
int rowCountActual = model.getRows();
assertEquals(rowCountActual, Math.min(ELEMENTS_TOTAL, rowCountPreset));
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 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSimpleTest.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -24,6 +24,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.dataTableAttributes;
import java.util.List;
@@ -57,8 +58,8 @@
@BeforeMethod
public void setup() {
- attributes.setFirst(first);
- attributes.setRows(rows);
+ dataTableAttributes.set(DataTableAttributes.first, first);
+ dataTableAttributes.set(DataTableAttributes.rows, rows);
if (first == null) {
expectedFirst = 0;
@@ -84,7 +85,7 @@
public void testRendered() {
assertTrue(model.isVisible());
- attributes.setRendered(false);
+ dataTableAttributes.set(DataTableAttributes.rendered, false);
assertFalse(model.isVisible());
assertFalse(model.isNoData());
@@ -96,8 +97,8 @@
assertTrue(model.isVisible());
assertFalse(model.isNoData());
- attributes.setNoDataLabel(NO_DATA);
- attributes.setShowData(false);
+ dataTableAttributes.set(DataTableAttributes.noDataLabel, NO_DATA);
+ enableShowData(false);
assertTrue(model.isVisible());
assertTrue(model.isNoData());
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 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/abstractions/DataTableSortingTest.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -24,6 +24,8 @@
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.richfaces.tests.metamer.ftest.abstractions.DataTableAttributes.sortMode;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.dataTableAttributes;
import static org.testng.Assert.assertEquals;
import java.lang.reflect.Method;
@@ -48,7 +50,7 @@
List<Employee> sortedEmployees;
public void testSortModeSingle() {
- attributes.setSortMode(SortMode.single);
+ dataTableAttributes.set(sortMode, SortMode.single);
sortByColumn(COLUMN_TITLE);
verifySortingByColumns("title");
@@ -64,7 +66,7 @@
}
public void testSortModeSingleReverse() {
- attributes.setSortMode(SortMode.single);
+ dataTableAttributes.set(sortMode, SortMode.single);
sortByColumn(COLUMN_SEX);
sortByColumn(COLUMN_SEX);
@@ -84,7 +86,7 @@
}
public void testSortModeSingleDoesntRememberOrder() {
- attributes.setSortMode(SortMode.single);
+ dataTableAttributes.set(sortMode, SortMode.single);
sortByColumn(COLUMN_NAME);
sortByColumn(COLUMN_TITLE);
@@ -93,7 +95,7 @@
}
public void testSortModeSingleRerenderAll() {
- attributes.setSortMode(SortMode.single);
+ dataTableAttributes.set(sortMode, SortMode.single);
sortByColumn(COLUMN_NAME);
verifySortingByColumns("name");
@@ -106,7 +108,7 @@
}
public void testSortModeSingleFullPageRefresh() {
- attributes.setSortMode(SortMode.single);
+ dataTableAttributes.set(sortMode, SortMode.single);
sortByColumn(COLUMN_NUMBER_OF_KIDS1);
verifySortingByColumns("numberOfKids");
@@ -119,7 +121,7 @@
}
public void testSortModeMulti() {
- attributes.setSortMode(SortMode.multi);
+ dataTableAttributes.set(sortMode, SortMode.multi);
sortByColumn(COLUMN_TITLE);
verifySortingByColumns("title");
@@ -135,7 +137,7 @@
}
public void testSortModeMultiReverse() {
- attributes.setSortMode(SortMode.multi);
+ dataTableAttributes.set(sortMode, SortMode.multi);
sortByColumn(COLUMN_TITLE);
sortByColumn(COLUMN_TITLE);
@@ -155,7 +157,7 @@
}
public void testSortModeMultiReplacingOldOccurences() {
- attributes.setSortMode(SortMode.multi);
+ dataTableAttributes.set(sortMode, SortMode.multi);
sortByColumn(COLUMN_TITLE);
verifySortingByColumns("title");
@@ -169,7 +171,7 @@
}
public void testSortModeMultiRerenderAll() {
- attributes.setSortMode(SortMode.multi);
+ dataTableAttributes.set(sortMode, SortMode.multi);
sortByColumn(COLUMN_TITLE);
verifySortingByColumns("title");
@@ -186,7 +188,7 @@
}
public void testSortModeMultiFullPageRefresh() {
- attributes.setSortMode(SortMode.multi);
+ dataTableAttributes.set(sortMode, SortMode.multi);
sortByColumn(COLUMN_TITLE);
verifySortingByColumns("title");
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -5,6 +5,8 @@
import org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes;
import org.richfaces.tests.metamer.ftest.a4jRepeat.RepeatAttributes;
import org.richfaces.tests.metamer.ftest.a4jStatus.StatusAttributes;
+import org.richfaces.tests.metamer.ftest.abstractions.DataTableAttributes;
+import org.richfaces.tests.metamer.ftest.abstractions.DataTableFacets;
import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
@@ -17,5 +19,7 @@
public static Attributes<PollAttributes> pollAttributes = new Attributes<PollAttributes>();
public static Attributes<RepeatAttributes> repeatAttributes = new Attributes<RepeatAttributes>();
public static Attributes<StatusAttributes> statusAttributes = new Attributes<StatusAttributes>();
+ public static Attributes<DataTableAttributes> dataTableAttributes = new Attributes<DataTableAttributes>();
+ public static Attributes<DataTableFacets> dataTableFacets = new Attributes<DataTableFacets>();
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -47,6 +47,10 @@
public Attributes() { }
+ public Attributes(RequestType reqType) {
+ this.requestType = reqType;
+ }
+
public void set(T attribute, String string) {
setProperty(attribute.toString(), string);
}
@@ -68,6 +72,15 @@
setProperty(attribute.toString(), item.toString());
}
+ /**
+ * Retrieve current attribute value
+ * @param attribute
+ * @return
+ */
+ public String get(T attribute) {
+ return getProperty(attribute.toString());
+ }
+
/*protected void set(String propertyName, Object value) {
}*/
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/AbstractCollapsibleSubTableTest.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -24,6 +24,9 @@
import java.util.LinkedList;
import java.util.List;
+import org.jboss.test.selenium.GuardRequest;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.request.RequestType;
import org.richfaces.ExpandMode;
import org.richfaces.tests.metamer.bean.Model;
@@ -31,6 +34,7 @@
import org.richfaces.tests.metamer.ftest.abstractions.DataTableFacets;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.attributes.Attributes;
import org.richfaces.tests.metamer.ftest.model.CollapsibleSubTable;
import org.richfaces.tests.metamer.ftest.model.CollapsibleSubTableToggler;
import org.richfaces.tests.metamer.ftest.model.DataTable;
@@ -48,9 +52,11 @@
private static final List<Employee> EMPLOYEES = Model.unmarshallEmployees();
- CollapsibleSubTableAttributes attributes = new CollapsibleSubTableAttributes();
+ Attributes<CollapsibleSubTableAttributes> collapsibleSubTabAttributes = new Attributes<CollapsibleSubTableAttributes>();
DataTable dataTable = new DataTable(pjq("table[id$=richDataTable]"));;
- DataTableFacets facets = new DataTableFacets();
+ Attributes<DataTableFacets> dataTableFacets = new Attributes<DataTableFacets>(RequestType.XHR);
+
+ JQueryLocator showDataLocator = pjq("input[id$=noDataCheckbox]");
@Inject
@Use(value = "configuration*")
@@ -123,4 +129,15 @@
return RequestType.NONE;
}
}
+
+ public void enableShowData(final boolean showData) {
+ new GuardRequest(RequestType.XHR) {
+ public void command() {
+ selenium.check(showDataLocator, showData);
+ selenium.fireEvent(showDataLocator, Event.CLICK);
+ selenium.fireEvent(showDataLocator, Event.CHANGE);
+ }
+ }.waitRequest();
+ }
+
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/CollapsibleSubTableAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/CollapsibleSubTableAttributes.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/CollapsibleSubTableAttributes.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -21,89 +21,26 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richCollapsibleSubTable;
-import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
-import java.util.Collection;
-
-import org.jboss.test.selenium.GuardRequest;
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.jboss.test.selenium.request.RequestType;
-import org.richfaces.ExpandMode;
-import org.richfaces.model.SortMode;
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
-
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class CollapsibleSubTableAttributes extends AbstractComponentAttributes {
+public enum CollapsibleSubTableAttributes implements AttributeEnum {
+
+ columnClasses,
+ expandMode,
+ expanded,
+ first,
+ footerClass,
+ headerClass,
+ noDataLabel,
+ rendered,
+ rowClasses,
+ rowClass,
+ rows,
+ sortMode,
+ sortPriority,
- JQueryLocator showDataLocator = pjq("input[id$=noDataCheckbox]");
-
- public void setShowData(final boolean showData) {
- new GuardRequest(RequestType.XHR) {
- public void command() {
- selenium.check(showDataLocator, showData);
- selenium.fireEvent(showDataLocator, Event.CLICK);
- selenium.fireEvent(showDataLocator, Event.CHANGE);
- }
- }.waitRequest();
- }
-
- public void setExpandMode(ExpandMode expandMode) {
- setProperty("expandMode", expandMode);
- }
-
- public void setExpanded(Boolean expanded) {
- setProperty("expanded", expanded);
- }
-
- public void setFirst(Integer first) {
- setProperty("first", first);
- }
-
- public void setNoDataLabel(String noDataLabel) {
- setProperty("noDataLabel", noDataLabel);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setRows(Integer rows) {
- setProperty("rows", rows);
- }
-
- public Integer getRows() {
- return Integer.valueOf(getProperty("rows"));
- }
-
- public void setSortMode(SortMode sortMode) {
- setProperty("sortMode", sortMode);
- }
-
- public void setSortPriority(Collection<String> sortPriority) {
- setProperty("sortPriority", sortPriority);
- }
-
- public void setColumnClasses(String columnClasses) {
- setProperty("columnClasses", columnClasses);
- }
-
- public void setRowClasses(String rowClasses) {
- setProperty("rowClasses", rowClasses);
- }
-
- public void setRowClass(String rowClass) {
- setProperty("rowClass", rowClass);
- }
-
- public void setHeaderClass(String headerClass) {
- setProperty("headerClass", headerClass);
- }
-
- public void setFooterClass(String footerClass) {
- setProperty("footerClass", footerClass);
- }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFacets.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFacets.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFacets.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -25,6 +25,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static org.richfaces.tests.metamer.ftest.abstractions.DataTableFacets.*;
import java.net.URL;
@@ -56,7 +57,7 @@
return subtable.hasVisibleRows();
}
});
- attributes.setShowData(false);
+ enableShowData(false);
assertFalse(subtable.hasVisibleRows());
JQueryLocator noDataFacet = pjq("table[id$=richDataTable] > tbody.rf-cst:eq(0) > tr.rf-cst-nd > td.rf-cst-nd-c");
@@ -64,12 +65,12 @@
assertFalse(selenium.isVisible(noDataFacet));
assertTrue(selenium.getText(noDataFacet).isEmpty());
- facets.setNoData(SAMPLE_STRING);
+ dataTableFacets.set(noData, SAMPLE_STRING);
- attributes.setShowData(true);
+ enableShowData(true);
assertTrue(subtable.hasVisibleRows());
- attributes.setShowData(false);
+ enableShowData(false);
assertFalse(subtable.hasVisibleRows());
assertTrue(subtable.isNoData());
@@ -78,29 +79,29 @@
@Test
public void testHeaderInstantChange() {
- facets.setHeader(SAMPLE_STRING);
+ dataTableFacets.set(header, SAMPLE_STRING);
assertEquals(selenium.getText(subtable.getHeader()), SAMPLE_STRING);
- facets.setHeader(EMPTY_STRING);
+ dataTableFacets.set(header, EMPTY_STRING);
if (selenium.isElementPresent(subtable.getHeader())) {
assertEquals(selenium.getText(subtable.getHeader()), EMPTY_STRING);
}
- facets.setHeader(SAMPLE_STRING);
+ dataTableFacets.set(header, SAMPLE_STRING);
assertEquals(selenium.getText(subtable.getHeader()), SAMPLE_STRING);
}
@Test
public void testFooterInstantChange() {
- facets.setFooter(SAMPLE_STRING);
+ dataTableFacets.set(footer, SAMPLE_STRING);
assertEquals(selenium.getText(subtable.getFooter()), SAMPLE_STRING);
- facets.setFooter(EMPTY_STRING);
+ dataTableFacets.set(footer, EMPTY_STRING);
if (selenium.isElementPresent(subtable.getFooter())) {
assertEquals(selenium.getText(subtable.getFooter()), EMPTY_STRING);
}
- facets.setFooter(SAMPLE_STRING);
+ dataTableFacets.set(footer, SAMPLE_STRING);
assertEquals(selenium.getText(subtable.getFooter()), SAMPLE_STRING);
}
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFiltering.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFiltering.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableFiltering.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -57,7 +57,7 @@
@BeforeMethod
public void prepare() {
- attributes.setRows(rows);
+ collapsibleSubTabAttributes.set(CollapsibleSubTableAttributes.rows, rows);
Column.resetAll();
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableScroller.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableScroller.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableScroller.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -71,14 +71,14 @@
paginationTester = new BasicPaginationTester();
}
- attributes.setExpandMode(expandMode);
+ collapsibleSubTabAttributes.set(CollapsibleSubTableAttributes.expandMode, expandMode);
dataScroller = new DataScroller(subtable.getFooter().getChild(jq("span.rf-ds")));
secondDataScroller = new DataScroller(secondSubtable.getFooter().getChild(jq("span.rf-ds")));
paginationTester.setDataScroller(dataScroller);
- attributes.setRows(rows);
+ collapsibleSubTabAttributes.set(CollapsibleSubTableAttributes.rows, rows);
int lastPage = dataScroller.obtainLastPage();
dataScroller.setLastPage(lastPage);
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSimple.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -28,6 +28,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static org.richfaces.tests.metamer.ftest.richCollapsibleSubTable.CollapsibleSubTableAttributes.*;
import java.net.URL;
import java.util.List;
@@ -56,7 +57,7 @@
public void testExpandMode() {
final RequestType requestType = getRequestTypeForExpandMode();
- attributes.setExpandMode(expandMode);
+ collapsibleSubTabAttributes.set(CollapsibleSubTableAttributes.expandMode, expandMode);
assertTrue(subtable.hasVisibleRows());
assertTrue(secondSubtable.hasVisibleRows());
@@ -80,7 +81,7 @@
@Test
public void testFirst() {
- attributes.setFirst(2);
+ collapsibleSubTabAttributes.set(first, 2);
List<Employee> visibleEmployees = employees.subList(2, subtable.getRowCount());
@@ -96,7 +97,7 @@
@Test
@Use(field = "configuration", empty = true)
public void testRendered() {
- attributes.setRendered(false);
+ collapsibleSubTabAttributes.set(rendered, false);
assertFalse(configurationMen.subtable.hasVisibleRows());
assertFalse(configurationWomen.subtable.hasVisibleRows());
@@ -104,7 +105,7 @@
selenium.click(configurationMen.toggler);
assertFalse(configurationMen.subtable.hasVisibleRows());
- attributes.setRendered(true);
+ collapsibleSubTabAttributes.set(rendered, true);
assertTrue(configurationMen.subtable.hasVisibleRows());
assertTrue(configurationWomen.subtable.hasVisibleRows());
@@ -112,7 +113,7 @@
@Test
public void testRows() {
- attributes.setRows(11);
+ collapsibleSubTabAttributes.set(rows, 11);
List<Employee> visibleEmployees = employees.subList(0, 11);
@@ -129,7 +130,7 @@
@Test
public void testColumnClasses() {
- attributes.setColumnClasses("col1,col2,col3");
+ collapsibleSubTabAttributes.set(columnClasses, "col1,col2,col3");
for (int i = 1; i <= 3; i++) {
JQueryLocator anyCellInColumn = subtable.getAnyCellInColumn(i);
JQueryLocator haveClassSet = append(anyCellInColumn, ".col" + i);
@@ -141,8 +142,8 @@
@Test
public void testRowClasses() {
- attributes.setRows(13);
- attributes.setRowClasses("row1,row2,row3");
+ collapsibleSubTabAttributes.set(rows, 13);
+ collapsibleSubTabAttributes.set(rowClasses, "row1,row2,row3");
int rowCount = subtable.getRowCount();
assertEquals(rowCount, 13);
@@ -156,8 +157,8 @@
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-10212")
public void testRowClass() {
- attributes.setRows(13);
- attributes.setRowClass("rowClass");
+ collapsibleSubTabAttributes.set(rows, 13);
+ collapsibleSubTabAttributes.set(rowClass, "rowClass");
JQueryLocator anyRow = subtable.getAnyRow();
JQueryLocator haveClassSet = append(anyRow, ".rowClass");
JQueryLocator haveNotClassSet = not(append(anyRow, ":visible"), ".rowClass");
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSorting.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSorting.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsibleSubTable/TestCollapsibleSubTableSorting.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -71,8 +71,8 @@
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-11302")
public void testSorting() {
- attributes.setRows(rows);
- attributes.setSortMode(sortMode);
+ collapsibleSubTabAttributes.set(CollapsibleSubTableAttributes.rows, rows);
+ collapsibleSubTabAttributes.set(CollapsibleSubTableAttributes.sortMode, sortMode);
sortBy(Column.NAME);
verifySorting();
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestExtendedDataTableSelection.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestExtendedDataTableSelection.java 2011-09-05 08:52:27 UTC (rev 22684)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestExtendedDataTableSelection.java 2011-09-05 21:07:07 UTC (rev 22685)
@@ -25,6 +25,8 @@
import static org.richfaces.tests.metamer.ftest.richExtendedDataTable.TestExtendedDataTableSelection.Modifier.CTRL;
import static org.richfaces.tests.metamer.ftest.richExtendedDataTable.TestExtendedDataTableSelection.Modifier.SHIFT;
import static org.testng.Assert.assertEquals;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.dataTableAttributes;
+import static org.richfaces.tests.metamer.ftest.abstractions.DataTableAttributes.*;
import java.net.URL;
import java.util.Arrays;
@@ -40,6 +42,7 @@
import org.jboss.test.selenium.utils.array.ArrayTransform;
import org.jboss.test.selenium.waiting.retrievers.Retriever;
import org.richfaces.tests.metamer.ftest.abstractions.AbstractDataTableTest;
+import org.richfaces.tests.metamer.ftest.abstractions.DataTableAttributes;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.model.ExtendedDataTable;
import org.testng.annotations.BeforeClass;
@@ -67,7 +70,7 @@
@BeforeMethod
public void setupAttributes() {
- attributes.setRows(10);
+ dataTableAttributes.set(rows, 10);
selected = new TreeSet<Integer>();
}
@@ -213,12 +216,13 @@
}
private int getPageForIndex(int index) {
- int rows = attributes.getRows();
+ int rows = Integer.parseInt(dataTableAttributes.get(DataTableAttributes.rows));
return (index / rows) + 1;
}
private int getRowForIndex(int index) {
- return 1 + index - ((dataScroller2.getCurrentPage() - 1) * attributes.getRows());
+ int rows = Integer.parseInt(dataTableAttributes.get(DataTableAttributes.rows));
+ return 1 + index - ((dataScroller2.getCurrentPage() - 1) * rows);
}
}
13 years, 4 months
JBoss Rich Faces SVN: r22684 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: attributes and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-05 04:52:27 -0400 (Mon, 05 Sep 2011)
New Revision: 22684
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/StatusFacets.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/StatusAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java
Log:
RFPL-1439: update tests for a4j:status to use unified way to setting attributes
One small change in TestSimple. Removed dependency on AbstractComponentAttributes class since this was IMHO quite missused. Now is used private method to set facets managing status behavior
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java 2011-09-05 08:51:54 UTC (rev 22683)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/AbstracStatusTest.java 2011-09-05 08:52:27 UTC (rev 22684)
@@ -40,8 +40,6 @@
JQueryLocator buttonError = pjq("input[id$=button3]");
JQueryLocator status = pjq("span[id$=status]");
- StatusAttributes attributes = new StatusAttributes();
-
TextRetriever retrieveStatus = retrieveText.locator(status);
XHRHalter haltHandler;
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/StatusAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/StatusAttributes.java 2011-09-05 08:51:54 UTC (rev 22683)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/StatusAttributes.java 2011-09-05 08:52:27 UTC (rev 22684)
@@ -21,31 +21,18 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jStatus;
-import org.jboss.test.selenium.encapsulated.JavaScript;
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class StatusAttributes extends AbstractComponentAttributes {
- public void setOnError(JavaScript javaScript) {
- setProperty("onerror", javaScript.toString());
- }
+public enum StatusAttributes implements AttributeEnum {
- public void setOnStart(JavaScript javaScript) {
- setProperty("onstart", javaScript.toString());
- }
+ onerror,
+ onstart,
+ onstop,
+ onsuccess,
+ rendered
- public void setOnStop(JavaScript javaScript) {
- setProperty("onstop", javaScript.toString());
- }
-
- public void setOnSuccess(JavaScript javaScript) {
- setProperty("onsuccess", javaScript.toString());
- }
-
- public void setRendered(boolean rendered) {
- setProperty("rendered", Boolean.toString(rendered));
- }
}
Deleted: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/StatusFacets.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/StatusFacets.java 2011-09-05 08:51:54 UTC (rev 22683)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/StatusFacets.java 2011-09-05 08:52:27 UTC (rev 22684)
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010-2011, 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.a4jStatus;
-
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
-
-import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
-import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
-
-/**
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class StatusFacets extends AbstractComponentAttributes {
-
- JQueryLocator applyFacetsButton = pjq("input[id$=applyFacets]");
-
- @Override
- protected void applyText(ElementLocator<?> locator, String value) {
- selenium.type(locator, value);
- guardXhr(selenium).click(applyFacetsButton);
- }
-
- public void setStartText(String startText) {
- setProperty("facetStartText", startText);
- }
-
- public String getStartText() {
- return getProperty("facetStartText");
- }
-
- public void setStopText(String stopText) {
- setProperty("facetStopText", stopText);
- }
-
- public String getStopText() {
- return getProperty("facetStopText");
- }
-
- public void setErrorText(String errorText) {
- setProperty("facetErrorText", errorText);
- }
-
- public String getErrorText() {
- return getProperty("facetErrorText");
- }
-}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java 2011-09-05 08:51:54 UTC (rev 22683)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestFacets.java 2011-09-05 08:52:27 UTC (rev 22684)
@@ -21,11 +21,13 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jStatus;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.testng.annotations.Test;
/**
@@ -33,7 +35,8 @@
* @version $Revision$
*/
public class TestFacets extends AbstracStatusTest {
- StatusFacets facets = new StatusFacets();
+ JQueryLocator applyFacetsButton = pjq("input[id$=applyFacets]");
+ JQueryLocator inputFormat = pjq("input{id$={0}Input]");
@Override
public URL getTestUrl() {
@@ -52,20 +55,20 @@
void testChangingFacet(ElementLocator<?> button, IterateStatus iterateStatus) {
switch (iterateStatus) {
case START:
- facets.setStartText(facets.getStartText() + "*");
+ setStartText(getStartText() + "*");
break;
case STOP:
- facets.setStopText(facets.getStopText() + "*");
+ setStopText(getStopText() + "*");
break;
case ERROR:
- facets.setErrorText(facets.getErrorText() + "*");
+ setErrorText(getErrorText() + "*");
break;
default:
throw new IllegalStateException();
}
- final String startText = facets.getStartText();
- final String stopText = (button.getAsString().equals(buttonError.getAsString())) ? facets.getErrorText() : facets.getStopText();
+ final String startText = getStartText();
+ final String stopText = (button.getAsString().equals(buttonError.getAsString())) ? getErrorText() : getStopText();
testRequestButton(button, startText, stopText);
}
@@ -73,4 +76,42 @@
private static enum IterateStatus {
START, STOP, ERROR
}
+
+ /**
+ * Routine to set value into input with specified locator
+ * @param locator
+ * @param value
+ */
+ private void setValueTo(ElementLocator<?> locator, String value) {
+ selenium.type(locator, value);
+ guardXhr(selenium).click(applyFacetsButton);
+ }
+
+ private String getValueFrom(ElementLocator<?> locator) {
+ return selenium.getValue(locator);
+ }
+
+ public void setStartText(String startText) {
+ setValueTo(inputFormat.format("facetStartText"), startText);
+ }
+
+ public String getStartText() {
+ return getValueFrom(inputFormat.format("facetStartText"));
+ }
+
+ public void setStopText(String stopText) {
+ setValueTo(inputFormat.format("facetStopText"), stopText);
+ }
+
+ public String getStopText() {
+ return getValueFrom(inputFormat.format("facetStopText"));
+ }
+
+ public void setErrorText(String errorText) {
+ setValueTo(inputFormat.format("facetErrorText"), errorText);
+ }
+
+ public String getErrorText() {
+ return getValueFrom(inputFormat.format("facetErrorText"));
+ }
}
\ No newline at end of file
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2011-09-05 08:51:54 UTC (rev 22683)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestInstantAttributes.java 2011-09-05 08:52:27 UTC (rev 22684)
@@ -24,6 +24,8 @@
import static org.jboss.test.selenium.encapsulated.JavaScript.js;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.statusAttributes;
+import static org.richfaces.tests.metamer.ftest.a4jStatus.StatusAttributes.*;
import java.net.URL;
@@ -40,8 +42,6 @@
*/
public class TestInstantAttributes extends AbstracStatusTest {
- StatusAttributes attributes = new StatusAttributes();
-
JavaScript alert = js("alert('{0}')");
@Override
@@ -51,19 +51,19 @@
@BeforeMethod
public void setupAttributes() {
- attributes.setRequestType(RequestType.XHR);
+ statusAttributes.setRequestType(RequestType.XHR);
}
@Test
@IssueTracking("https://issues.jboss.org/browse/RFPL-1516")
public void testOnStart() {
- attributes.setRequestType(null);
+ statusAttributes.setRequestType(null);
XHRHalter.enable();
for (int i = 0; i < 2; i++) {
final int ii = i;
retrieveRequestTime.initializeValue();
- attributes.setOnStart(js("window.metamer = " + ii));
+ statusAttributes.set(onstart, js("window.metamer = " + ii));
getCurrentXHRHalter().complete();
waitGui.waitForChange(retrieveRequestTime);
@@ -81,7 +81,7 @@
@IssueTracking({ "https://issues.jboss.org/browse/RF-9118", "http://java.net/jira/browse/JAVASERVERFACES-1788" })
public void testOnError() {
for (int i = 0; i < 2; i++) {
- attributes.setOnError(alert.parametrize("error" + i));
+ statusAttributes.set(onerror, alert.parametrize("error" + i));
selenium.click(buttonError);
waitAjax.until(alertPresent);
@@ -92,7 +92,7 @@
@Test
public void testOnSuccess() {
for (int i = 0; i < 2; i++) {
- attributes.setOnSuccess(alert.parametrize("success" + 1));
+ statusAttributes.set(onsuccess, alert.parametrize("success" + 1));
selenium.click(button1);
waitAjax.until(alertPresent);
@@ -103,7 +103,7 @@
@Test
public void testOnStop() {
for (int i = 0; i < 2; i++) {
- attributes.setOnStop(alert.parametrize("stop" + i));
+ statusAttributes.set(onstop, alert.parametrize("stop" + i));
selenium.click(button1);
waitAjax.until(alertPresent);
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java 2011-09-05 08:51:54 UTC (rev 22683)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jStatus/TestSimple.java 2011-09-05 08:52:27 UTC (rev 22684)
@@ -26,6 +26,8 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.statusAttributes;
+import static org.richfaces.tests.metamer.ftest.a4jStatus.StatusAttributes.rendered;
import java.net.URL;
@@ -40,8 +42,6 @@
*/
public class TestSimple extends AbstracStatusTest {
- StatusAttributes attributes = new StatusAttributes();
-
JQueryLocator defaultStatus = jq("span[id$=a4jStatusPanel]");
TextRetriever retrieveDefaultStatus = retrieveText.locator(defaultStatus);
@@ -78,7 +78,7 @@
public void testRendered() {
assertTrue(selenium.isElementPresent(status));
- attributes.setRendered(false);
+ statusAttributes.set(rendered, false);
assertFalse(selenium.isElementPresent(status));
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:51:54 UTC (rev 22683)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:52:27 UTC (rev 22684)
@@ -4,6 +4,7 @@
import org.richfaces.tests.metamer.ftest.a4jPoll.PollAttributes;
import org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes;
import org.richfaces.tests.metamer.ftest.a4jRepeat.RepeatAttributes;
+import org.richfaces.tests.metamer.ftest.a4jStatus.StatusAttributes;
import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
@@ -15,5 +16,6 @@
public static Attributes<QueueAttributes> queueAttributes = new Attributes<QueueAttributes>(pjq("table.attributes[id$=queueAttributes]"));
public static Attributes<PollAttributes> pollAttributes = new Attributes<PollAttributes>();
public static Attributes<RepeatAttributes> repeatAttributes = new Attributes<RepeatAttributes>();
+ public static Attributes<StatusAttributes> statusAttributes = new Attributes<StatusAttributes>();
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java 2011-09-05 08:51:54 UTC (rev 22683)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java 2011-09-05 08:52:27 UTC (rev 22684)
@@ -1,6 +1,7 @@
package org.richfaces.tests.metamer.ftest.attributes;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guard;
+import static org.jboss.test.selenium.locator.Attribute.VALUE;
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.locator.reference.ReferencedLocator.referenceInferred;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
@@ -117,6 +118,14 @@
selenium.getInterceptionProxy().unregisterInterceptorType(RepeatForElementNotFound.class);
}
+ protected String getProperty(String propertyName) {
+ final ReferencedLocator<JQueryLocator> locator = propertyLocator.format(propertyName, "");
+ if (selenium.getCount(locator) > 1) {
+ return selenium.getAttribute(propertyLocator.format(propertyName, "[checked]").getAttribute(VALUE));
+ }
+ return selenium.getValue(locator);
+ }
+
protected void applyText(ElementLocator<?> locator, String value) {
guard(selenium, requestType).type(locator, value);
}
13 years, 4 months
JBoss Rich Faces SVN: r22683 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: attributes and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-05 04:51:54 -0400 (Mon, 05 Sep 2011)
New Revision: 22683
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/RepeatAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
Log:
RFPL-1439: update a4j:repeat tests to use unified way to setting attributes
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/RepeatAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/RepeatAttributes.java 2011-09-05 08:51:24 UTC (rev 22682)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/RepeatAttributes.java 2011-09-05 08:51:54 UTC (rev 22683)
@@ -21,32 +21,16 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jRepeat;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.jboss.test.selenium.locator.ExtendedLocator;
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class RepeatAttributes extends AbstractComponentAttributes {
+public enum RepeatAttributes implements AttributeEnum {
- public RepeatAttributes() {
- }
+ first,
+ rendered,
+ rows
- public RepeatAttributes(ExtendedLocator<JQueryLocator> root) {
- super(root);
- }
-
- public void setFirst(int first) {
- setProperty("first", first);
- }
-
- public void setRendered(String rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setRows(int rows) {
- setProperty("rows", rows);
- }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestSimple.java 2011-09-05 08:51:24 UTC (rev 22682)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRepeat/TestSimple.java 2011-09-05 08:51:54 UTC (rev 22683)
@@ -25,6 +25,7 @@
import static java.lang.Math.min;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.repeatAttributes;
import java.net.URL;
@@ -44,7 +45,6 @@
protected static final int ELEMENTS_TOTAL = 20;
SimpleModel model;
- RepeatAttributes attributes = new RepeatAttributes();
@Inject
@Use(empty = false)
@@ -68,16 +68,16 @@
model = new SimpleModel();
if (first != null) {
- attributes.setFirst(first);
+ repeatAttributes.set(RepeatAttributes.first, first);
}
if (rows != null) {
- attributes.setRows(rows);
+ repeatAttributes.set(RepeatAttributes.rows, rows);
}
}
@Test
public void testRenderedAttribute() {
- attributes.setRendered("false");
+ repeatAttributes.set(RepeatAttributes.rendered, "false");
assertEquals(model.isRendered(), false);
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:51:24 UTC (rev 22682)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:51:54 UTC (rev 22683)
@@ -3,6 +3,7 @@
import org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes;
import org.richfaces.tests.metamer.ftest.a4jPoll.PollAttributes;
import org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes;
+import org.richfaces.tests.metamer.ftest.a4jRepeat.RepeatAttributes;
import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
@@ -13,5 +14,6 @@
public static Attributes<AttachQueueAttributes> attachQueueAttrs2 = new Attributes<AttachQueueAttributes>(pjq("table.attributes[id$=attributes2]"));
public static Attributes<QueueAttributes> queueAttributes = new Attributes<QueueAttributes>(pjq("table.attributes[id$=queueAttributes]"));
public static Attributes<PollAttributes> pollAttributes = new Attributes<PollAttributes>();
+ public static Attributes<RepeatAttributes> repeatAttributes = new Attributes<RepeatAttributes>();
}
13 years, 4 months
JBoss Rich Faces SVN: r22682 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-05 04:51:24 -0400 (Mon, 05 Sep 2011)
New Revision: 22682
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/TestRegionSimple.java
Log:
RFPL-1439: update a4j:region tests to use unified way to setting attributes
Since there is only one attribute set, and legacy solution was inner class with AbstractComponentAttributes implemetation, only switch to enum was done.
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/TestRegionSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/TestRegionSimple.java 2011-09-05 08:51:01 UTC (rev 22681)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/TestRegionSimple.java 2011-09-05 08:51:24 UTC (rev 22682)
@@ -32,6 +32,8 @@
import org.jboss.test.selenium.waiting.retrievers.TextRetriever;
import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
+import org.richfaces.tests.metamer.ftest.attributes.Attributes;
import org.testng.annotations.Test;
/**
@@ -40,7 +42,7 @@
*/
public class TestRegionSimple extends AbstractMetamerTest {
- RegionAttributes attributes = new RegionAttributes();
+ Attributes<RegionAttributes> attributes = new Attributes<RegionAttributes>();
JQueryLocator nameInput = pjq("input:text[id$=user2NameInput]");
JQueryLocator emailInput = pjq("input:text[id$=user2EmailInput]");
@@ -80,7 +82,7 @@
assertTrue(selenium.isElementPresent(nameOutput));
assertTrue(selenium.isElementPresent(emailOutput));
- attributes.setRendered(false);
+ attributes.set(RegionAttributes.rendered, false);
assertFalse(selenium.isElementPresent(nameInput));
assertFalse(selenium.isElementPresent(emailInput));
@@ -88,9 +90,7 @@
assertTrue(selenium.isElementPresent(emailOutput));
}
- private class RegionAttributes extends AbstractComponentAttributes {
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
+ private enum RegionAttributes implements AttributeEnum {
+ rendered
}
}
13 years, 4 months
JBoss Rich Faces SVN: r22681 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: attributes and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-05 04:51:01 -0400 (Mon, 05 Sep 2011)
New Revision: 22681
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPollInterval.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPollSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
Log:
RFPL-1439: update a4j:poll tests to use unified way to setting attributess
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollAttributes.java 2011-09-05 08:50:31 UTC (rev 22680)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollAttributes.java 2011-09-05 08:51:01 UTC (rev 22681)
@@ -21,7 +21,7 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jPoll;
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
/**
* Tests the a4j:poll component.
@@ -29,56 +29,20 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class PollAttributes extends AbstractComponentAttributes {
- public void setEnabled(boolean enabled) {
- setProperty("enabled", enabled);
- }
+public enum PollAttributes implements AttributeEnum {
- public void setInterval(long interval) {
- setProperty("interval", interval);
- }
+ action,
+ actionListener,
+ bypassUpdates,
+ data,
+ enabled,
+ execute,
+ immediate,
+ interval,
+ limitRender,
+ oncomplete,
+ render,
+ rendered,
+ status
- public void setAction(String action) {
- setProperty("action", action);
- }
-
- public void setActionListener(String actionListener) {
- setProperty("actionListener", actionListener);
- }
-
- public void setBypassUpdates(Boolean bypassUpdates) {
- setProperty("bypassUpdates", bypassUpdates);
- }
-
- public void setData(String data) {
- setProperty("data", data);
- }
-
- public void setExecute(String execute) {
- setProperty("execute", execute);
- }
-
- public void setImmediate(Boolean immediate) {
- setProperty("immediate", immediate);
- }
-
- public void setInterval(Integer interval) {
- setProperty("interval", interval);
- }
-
- public void setLimitRender(Boolean limitRender) {
- setProperty("limitRender", limitRender);
- }
-
- public void setRender(String render) {
- setProperty("render", render);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setStatus(String status) {
- setProperty("status", status);
- }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPollInterval.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPollInterval.java 2011-09-05 08:50:31 UTC (rev 22680)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPollInterval.java 2011-09-05 08:51:01 UTC (rev 22681)
@@ -21,6 +21,12 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jPoll;
+import static org.jboss.test.selenium.utils.PrimitiveUtils.asLong;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.pollAttributes;
+import static org.testng.Assert.assertTrue;
+
import java.io.IOException;
import java.net.URL;
@@ -35,11 +41,6 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.*;
-import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
-import static org.jboss.test.selenium.utils.PrimitiveUtils.*;
-
/**
* Tests the a4j:poll component.
*
@@ -53,8 +54,6 @@
@Inject
int interval;
- PollAttributes attributes = new PollAttributes();
-
JQueryLocator time = pjq("span[id$=time]");
AttributeLocator<?> clientTime = pjq("span[id$=event1:outputTime]").getAttribute(Attribute.TITLE);
@@ -112,8 +111,8 @@
* </p>
*/
public void testClient() {
- attributes.setEnabled(true);
- attributes.setInterval(interval);
+ pollAttributes.set(PollAttributes.enabled, true);
+ pollAttributes.set(PollAttributes.interval, interval);
waitForPoll();
for (int i = 0; i < ITERATION_COUNT; i++) {
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPollSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPollSimple.java 2011-09-05 08:50:31 UTC (rev 22680)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPollSimple.java 2011-09-05 08:51:01 UTC (rev 22681)
@@ -32,6 +32,8 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.pollAttributes;
+import static org.richfaces.tests.metamer.ftest.a4jPoll.PollAttributes.*;
import java.net.URL;
@@ -48,8 +50,6 @@
*/
public class TestPollSimple extends AbstractMetamerTest {
- PollAttributes attributes = new PollAttributes();
-
JQueryLocator outputCounter = pjq("span[id$=outputCounter]");
@Inject
@@ -64,8 +64,8 @@
@BeforeMethod
public void enablePoll() {
- attributes.setInterval(2500);
- attributes.setEnabled(true);
+ pollAttributes.set(interval, 2500);
+ pollAttributes.set(enabled, true);
}
@@ -85,7 +85,7 @@
@Test
public void testBypassUpdates() {
- attributes.setBypassUpdates(true);
+ pollAttributes.set(bypassUpdates, true);
waitForTwoSubsequentRequests();
phaseInfo.assertListener(PROCESS_VALIDATIONS, "action invoked");
phaseInfo.assertPhases(RESTORE_VIEW, APPLY_REQUEST_VALUES, PROCESS_VALIDATIONS, RENDER_RESPONSE);
@@ -93,8 +93,8 @@
@Test
public void testData() {
- attributes.setData("RichFaces 4");
- attributes.setOncomplete("data = event.data");
+ pollAttributes.set(data, "RichFaces 4");
+ pollAttributes.set(oncomplete, "data = event.data");
retrieveRequestTime.initializeValue();
waitGui.waitForChange(retrieveRequestTime);
@@ -104,7 +104,7 @@
@Test
public void testImmediate() {
- attributes.setImmediate(true);
+ pollAttributes.set(immediate, true);
waitForTwoSubsequentRequests();
phaseInfo.assertListener(APPLY_REQUEST_VALUES, "action invoked");
phaseInfo.assertPhases(RESTORE_VIEW, APPLY_REQUEST_VALUES, RENDER_RESPONSE);
@@ -123,20 +123,20 @@
@Test
public void testRendered() {
- attributes.setEnabled(true);
- attributes.setRendered(false);
+ pollAttributes.set(enabled, true);
+ pollAttributes.set(rendered, false);
retrieveRequestTime.initializeValue();
waitModel.timeout(5000).interval(1000).waitForTimeout();
assertFalse(retrieveRequestTime.isValueChanged());
- attributes.setRendered(true);
+ pollAttributes.set(rendered, true);
waitForTwoSubsequentRequests();
}
@Test
public void testExecute() {
- attributes.setExecute("executeChecker");
+ pollAttributes.set(execute, "executeChecker");
waitForTwoSubsequentRequests();
@@ -145,19 +145,19 @@
@Test
public void testEnabled() {
- attributes.setEnabled(false);
+ pollAttributes.set(enabled, false);
retrieveRequestTime.initializeValue();
waitModel.timeout(5000).interval(1000).waitForTimeout();
assertFalse(retrieveRequestTime.isValueChanged());
- attributes.setEnabled(true);
+ pollAttributes.set(enabled, true);
waitForTwoSubsequentRequests();
}
@Test
public void testRender() {
- attributes.setRender("renderChecker");
+ pollAttributes.set(render, "renderChecker");
retrieveRenderChecker.initializeValue();
retrieveRequestTime.initializeValue();
waitAjax.waitForChange(retrieveRenderChecker);
@@ -166,8 +166,8 @@
@Test
public void testLimitRender() {
- attributes.setLimitRender(true);
- attributes.setRender("renderChecker");
+ pollAttributes.set(limitRender, true);
+ pollAttributes.set(render, "renderChecker");
retrieveRenderChecker.initializeValue();
retrieveRequestTime.initializeValue();
waitGui.waitForChange(retrieveRenderChecker);
@@ -175,9 +175,9 @@
}
private void testClientSideEventHandlers(String... events) {
- attributes.setEnabled(false);
+ pollAttributes.set(enabled, false);
super.testRequestEventsBefore(events);
- attributes.setEnabled(true);
+ pollAttributes.set(enabled, true);
retrieveRequestTime.initializeValue();
waitAjax.waitForChange(retrieveRequestTime);
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:50:31 UTC (rev 22680)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:51:01 UTC (rev 22681)
@@ -1,6 +1,7 @@
package org.richfaces.tests.metamer.ftest.attributes;
import org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes;
+import org.richfaces.tests.metamer.ftest.a4jPoll.PollAttributes;
import org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes;
import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
@@ -11,5 +12,6 @@
public static Attributes<AttachQueueAttributes> attachQueueAttrs1 = new Attributes<AttachQueueAttributes>(pjq("table.attributes[id$=attributes1]"));
public static Attributes<AttachQueueAttributes> attachQueueAttrs2 = new Attributes<AttachQueueAttributes>(pjq("table.attributes[id$=attributes2]"));
public static Attributes<QueueAttributes> queueAttributes = new Attributes<QueueAttributes>(pjq("table.attributes[id$=queueAttributes]"));
+ public static Attributes<PollAttributes> pollAttributes = new Attributes<PollAttributes>();
}
13 years, 4 months