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>();
}