JBoss Rich Faces SVN: r22680 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: a4jQueue and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-05 04:50:31 -0400 (Mon, 05 Sep 2011)
New Revision: 22680
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestAttachQueueNamed.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
Log:
RFPL-1439: update tests for a4j:queue to use unified way to setting attributes
This change affects attachQueue as well since in this example is another queue (with 2 attached queues). Created one static instance in AttributesList with constructor, in case when need instance without contructor (with default locator) is instance created within class which needs it.
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestAttachQueueNamed.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestAttachQueueNamed.java 2011-09-05 08:49:53 UTC (rev 22679)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestAttachQueueNamed.java 2011-09-05 08:50:31 UTC (rev 22680)
@@ -22,11 +22,12 @@
package org.richfaces.tests.metamer.ftest.a4jAttachQueue;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes.requestDelay;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.queueAttributes;
import java.net.URL;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes;
import org.richfaces.tests.metamer.ftest.a4jQueue.QueueModel;
import org.richfaces.tests.metamer.ftest.a4jQueue.QueueModel.Input;
import org.testng.annotations.Test;
@@ -40,7 +41,6 @@
private static final Long DELAY = 5000L;
QueueModel queue = new QueueModel();
- QueueAttributes queueAttributes = new QueueAttributes(pjq("table.attributes[id$=queueAttributes]"));
@Override
public URL getTestUrl() {
@@ -52,7 +52,7 @@
*/
@Test
public void testNameReferencing() {
- queueAttributes.setRequestDelay(DELAY);
+ queueAttributes.set(requestDelay, DELAY);
queue.initializeTimes();
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-05 08:49:53 UTC (rev 22679)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-05 08:50:31 UTC (rev 22680)
@@ -25,9 +25,9 @@
import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.onrequestdequeue;
import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.onrequestqueue;
import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.rendered;
-import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.requestDelay;
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs1;
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs2;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.queueAttributes;
import static org.testng.Assert.assertFalse;
import java.net.URL;
@@ -53,8 +53,6 @@
QueueModel queue = new QueueModel();
- QueueAttributes attributesQueue1 = new QueueAttributes(pjq("table.attributes[id$=queueAttributes]"));
-
@Override
public URL getTestUrl() {
return buildUrl(contextPath, "faces/components/a4jAttachQueue/nested.xhtml");
@@ -62,9 +60,9 @@
@BeforeMethod
public void setupDelays() {
- attachQueueAttrs1.set(requestDelay, DELAY_A);
- attachQueueAttrs2.set(requestDelay, DELAY_B);
- attributesQueue1.setRequestDelay(GLOBAL_DELAY);
+ attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, DELAY_A);
+ attachQueueAttrs2.set(AttachQueueAttributes.requestDelay, DELAY_B);
+ queueAttributes.set(QueueAttributes.requestDelay, GLOBAL_DELAY);
}
@Test
@@ -78,7 +76,7 @@
@Test
public void testNoDelay() {
- attachQueueAttrs1.set(requestDelay, 0);
+ attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 0);
queue.initializeCounts();
@@ -120,7 +118,7 @@
@Test
public void testRendered() {
- attachQueueAttrs1.set(requestDelay, 1500);
+ attachQueueAttrs1.set(AttachQueueAttributes.requestDelay, 1500);
attachQueueAttrs1.set(onrequestqueue, JavaScript.js("alert('requestQueued')"));
attachQueueAttrs1.set(onrequestdequeue, JavaScript.js("alert('requestDequeued')"));
attachQueueAttrs1.set(rendered, false);
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueAttributes.java 2011-09-05 08:49:53 UTC (rev 22679)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/QueueAttributes.java 2011-09-05 08:50:31 UTC (rev 22680)
@@ -21,70 +21,25 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jQueue;
-import org.jboss.test.selenium.encapsulated.JavaScript;
-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 QueueAttributes extends AbstractComponentAttributes {
+public enum QueueAttributes implements AttributeEnum {
+
+ ignoreDupResponses,
+ name,
+ onbeforedomupdate,
+ oncomplete,
+ onerror,
+ onevent,
+ onrequestdequeue,
+ onrequestqueue,
+ onsubmit,
+ rendered,
+ requestDelay,
+ timeout
- public QueueAttributes() {
- }
-
- public QueueAttributes(ExtendedLocator<JQueryLocator> root) {
- super(root);
- }
-
- public void setIgnoreDupResponses(boolean ignoreDupResponses) {
- setProperty("ignoreDupResponses", ignoreDupResponses);
- }
-
- public void setName(String name) {
- setProperty("name", name);
- }
-
- public void setOnBeforeDomUpdate(JavaScript onBeforeDomUpdate) {
- setProperty("onbeforedomupdate", onBeforeDomUpdate);
- }
-
- public void setOnComplete(JavaScript onComplete) {
- setProperty("oncomplete", onComplete);
- }
-
- public void setOnEvent(JavaScript onEvent) {
- setProperty("onevent", onEvent);
- }
-
- public void setOnError(JavaScript onError) {
- setProperty("onerror", onError);
- }
-
- public void setOnRequestDequeue(JavaScript onRequestDequeue) {
- setProperty("onrequestdequeue", onRequestDequeue);
- }
-
- public void setOnRequestQueue(JavaScript onRequestQueue) {
- setProperty("onrequestqueue", onRequestQueue);
- }
-
- public void setOnSubmit(JavaScript onSubmit) {
- setProperty("onsubmit", onSubmit);
- }
-
- public void setRendered(boolean rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setRequestDelay(long requestDelay) {
- setProperty("requestDelay", requestDelay);
- }
-
- public void setTimeout(long timeout) {
- setProperty("timeout", timeout);
- }
-
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java 2011-09-05 08:49:53 UTC (rev 22679)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestFormQueue.java 2011-09-05 08:50:31 UTC (rev 22680)
@@ -30,6 +30,7 @@
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.a4jQueue.QueueModel.Input;
import org.richfaces.tests.metamer.ftest.annotations.Templates;
+import org.richfaces.tests.metamer.ftest.attributes.Attributes;
import org.testng.annotations.Test;
/**
@@ -48,16 +49,16 @@
QueueModel queueB = prepareLocators("formQueue2");
QueueModel globalQueue = prepareLocators("globalQueue");
- QueueAttributes attributesQueueA = prepareAttributes("formQueue1");
- QueueAttributes attributesQueueB = prepareAttributes("formQueue2");
- QueueAttributes attributesGlobalQueue = prepareAttributes("globalQueue");
+ Attributes<QueueAttributes> attributesQueueA = prepareAttributes("formQueue1");
+ Attributes<QueueAttributes> attributesQueueB = prepareAttributes("formQueue2");
+ Attributes<QueueAttributes> attributesGlobalQueue = prepareAttributes("globalQueue");
private static QueueModel prepareLocators(String identifier) {
return new QueueModel(pjq("div.rf-p[id$={0}Panel]").format(identifier));
}
- private static QueueAttributes prepareAttributes(String identifier) {
- return new QueueAttributes(pjq("div.rf-p[id$={0}AttributesPanel]").format(identifier));
+ private static Attributes<QueueAttributes> prepareAttributes(String identifier) {
+ return new Attributes<QueueAttributes>(pjq("div.rf-p[id$={0}AttributesPanel]").format(identifier));
}
@Override
@@ -80,8 +81,8 @@
*/
@Test
public void testTimingOneQueueTwoEvents() {
- attributesQueueA.setRequestDelay(DELAY_A);
- attributesGlobalQueue.setRequestDelay(GLOBAL_DELAY);
+ attributesQueueA.set(QueueAttributes.requestDelay, DELAY_A);
+ attributesGlobalQueue.set(QueueAttributes.requestDelay, GLOBAL_DELAY);
queueA.initializeTimes();
@@ -113,8 +114,8 @@
*/
@Test
public void testCountsOneQueueTwoEvents() {
- attributesQueueA.setRequestDelay(DELAY_A);
- attributesGlobalQueue.setRequestDelay(GLOBAL_DELAY);
+ attributesQueueA.set(QueueAttributes.requestDelay, DELAY_A);
+ attributesGlobalQueue.set(QueueAttributes.requestDelay, GLOBAL_DELAY);
queueA.initializeCounts();
@@ -151,9 +152,9 @@
*/
@Test
public void testTimingTwoQueuesFourEvents() {
- attributesQueueA.setRequestDelay(DELAY_A);
- attributesQueueB.setRequestDelay(DELAY_B);
- attributesGlobalQueue.setRequestDelay(GLOBAL_DELAY);
+ attributesQueueA.set(QueueAttributes.requestDelay, DELAY_A);
+ attributesQueueB.set(QueueAttributes.requestDelay, DELAY_B);
+ attributesGlobalQueue.set(QueueAttributes.requestDelay, GLOBAL_DELAY);
queueA.initializeTimes();
queueB.initializeTimes();
@@ -196,9 +197,9 @@
*/
@Test
public void testCountsTwoQueuesThreeEvents() {
- attributesQueueA.setRequestDelay(DELAY_A);
- attributesQueueB.setRequestDelay(DELAY_B);
- attributesGlobalQueue.setRequestDelay(GLOBAL_DELAY);
+ attributesQueueA.set(QueueAttributes.requestDelay, DELAY_A);
+ attributesQueueB.set(QueueAttributes.requestDelay, DELAY_B);
+ attributesGlobalQueue.set(QueueAttributes.requestDelay, GLOBAL_DELAY);
queueA.initializeCounts();
queueB.initializeCounts();
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java 2011-09-05 08:49:53 UTC (rev 22679)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jQueue/TestGlobalQueue.java 2011-09-05 08:50:31 UTC (rev 22680)
@@ -23,6 +23,7 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
+import static org.richfaces.tests.metamer.ftest.a4jQueue.QueueAttributes.*;
import com.thoughtworks.selenium.SeleniumException;
@@ -35,6 +36,7 @@
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.RegressionTest;
import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.attributes.Attributes;
import org.testng.annotations.Test;
/**
@@ -44,7 +46,7 @@
public class TestGlobalQueue extends AbstractMetamerTest {
QueueModel queue = new QueueModel();
- QueueAttributes attributes = new QueueAttributes();
+ Attributes<QueueAttributes> attributes = new Attributes<QueueAttributes>();
@Inject
@Use(empty = false)
@@ -61,7 +63,7 @@
@Test
@Use(field = "requestDelay", ints = { 0, 500, 1500, 5000 })
public void testRequestDelay() {
- attributes.setRequestDelay(requestDelay);
+ attributes.set(QueueAttributes.requestDelay, requestDelay);
queue.initializeTimes();
@@ -78,7 +80,7 @@
*/
@Test
public void testMultipleRequestsWithDelay() {
- attributes.setRequestDelay(3000);
+ attributes.set(QueueAttributes.requestDelay, 3000);
queue.initializeCounts();
@@ -113,7 +115,7 @@
@Test
@RegressionTest("https://issues.jboss.org/browse/RFPL-1194")
public void testMultipleRequestsWithNoDelay() {
- attributes.setRequestDelay(0);
+ attributes.set(QueueAttributes.requestDelay, 0);
queue.initializeCounts();
@@ -160,8 +162,8 @@
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-9328")
public void testRendered() {
- attributes.setRequestDelay(1500);
- attributes.setRendered(false);
+ attributes.set(QueueAttributes.requestDelay, 1500);
+ attributes.set(rendered, false);
queue.initializeTimes();
queue.fireEvent(1);
@@ -173,8 +175,8 @@
// TODO not implemented yet
public void testTimeout() {
- attributes.setRequestDelay(0);
- attributes.setTimeout(1000);
+ attributes.set(QueueAttributes.requestDelay, 0);
+ attributes.set(timeout, 1000);
XHRHalter.enable();
@@ -191,7 +193,7 @@
@Test
public void testIgnoreDuplicatedResponsesFalse() {
- attributes.setIgnoreDupResponses(false);
+ attributes.set(ignoreDupResponses, false);
XHRHalter.enable();
queue.type("a");
@@ -211,7 +213,7 @@
@Test
public void testIgnoreDuplicatedResponsesTrue() {
- attributes.setIgnoreDupResponses(true);
+ attributes.set(ignoreDupResponses, true);
XHRHalter.enable();
queue.type("c");
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:49:53 UTC (rev 22679)
+++ 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)
@@ -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.a4jQueue.QueueAttributes;
import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
@@ -9,4 +10,6 @@
public static Attributes<TooltipAttributes> tooltipAttributes = new Attributes<TooltipAttributes>();
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]"));
+
}
13 years, 3 months
JBoss Rich Faces SVN: r22679 - 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:49:53 -0400 (Mon, 05 Sep 2011)
New Revision: 22679
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/AttachQueueAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.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 AttachedQueue to use unified way to setting attributes
Tests for AttachedQueue don't completelly use new - unified way to setting attributes, because there is third queue used, which is not changed yet. This changes are related only to class managing access to atttributes in AttachedQueue example in Metamer (mean AttachedQueue tests package)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/AttachQueueAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/AttachQueueAttributes.java 2011-09-05 08:49:19 UTC (rev 22678)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/AttachQueueAttributes.java 2011-09-05 08:49:53 UTC (rev 22679)
@@ -21,57 +21,19 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jAttachQueue;
-import org.jboss.test.selenium.encapsulated.JavaScript;
-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 AttachQueueAttributes extends AbstractComponentAttributes {
-
- public AttachQueueAttributes() {
- }
-
- public AttachQueueAttributes(ExtendedLocator<JQueryLocator> root) {
- super(root);
- }
-
- public void setIgnoreDupResponses(boolean ignoreDupResponses) {
- setProperty("ignoreDupResponses", ignoreDupResponses);
- }
-
- public void setName(String name) {
- setProperty("name", name);
- }
-
- public void setOnRequestDequeue(JavaScript onRequestDequeue) {
- setProperty("onrequestdequeue", onRequestDequeue);
- }
-
- public void setOnRequestQueue(JavaScript onRequestQueue) {
- setProperty("onrequestqueue", onRequestQueue);
- }
-
- public void setQueueId(String queueId) {
- setProperty("queueId", queueId);
- }
-
- public void setRendered(boolean rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setRequestDelay(long requestDelay) {
- setProperty("requestDelay", requestDelay);
- }
-
- public void setRequestGroupingId(String requestGroupingId) {
- setProperty("rquestGroupingId", requestGroupingId);
- }
-
- public void setTimeout(long timeout) {
- setProperty("timeout", timeout);
- }
+public enum AttachQueueAttributes implements AttributeEnum {
+
+ ignoreDupResponses,
+ name,
+ onrequestdequeue,
+ onrequestqueue,
+ rendered,
+ requestDelay,
+ requestGroupingId
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-05 08:49:19 UTC (rev 22678)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAttachQueue/TestNestedAttachQueue.java 2011-09-05 08:49:53 UTC (rev 22679)
@@ -22,6 +22,12 @@
package org.richfaces.tests.metamer.ftest.a4jAttachQueue;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.onrequestdequeue;
+import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.onrequestqueue;
+import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.rendered;
+import static org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes.requestDelay;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs1;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.attachQueueAttrs2;
import static org.testng.Assert.assertFalse;
import java.net.URL;
@@ -46,9 +52,7 @@
static final Long DELAY_B = 5000L;
QueueModel queue = new QueueModel();
-
- AttachQueueAttributes attributesAttachQueue1 = new AttachQueueAttributes(pjq("table.attributes[id$=attributes1]"));
- AttachQueueAttributes attributesAttachQueue2 = new AttachQueueAttributes(pjq("table.attributes[id$=attributes2]"));
+
QueueAttributes attributesQueue1 = new QueueAttributes(pjq("table.attributes[id$=queueAttributes]"));
@Override
@@ -58,8 +62,8 @@
@BeforeMethod
public void setupDelays() {
- attributesAttachQueue1.setRequestDelay(DELAY_A);
- attributesAttachQueue2.setRequestDelay(DELAY_B);
+ attachQueueAttrs1.set(requestDelay, DELAY_A);
+ attachQueueAttrs2.set(requestDelay, DELAY_B);
attributesQueue1.setRequestDelay(GLOBAL_DELAY);
}
@@ -74,7 +78,7 @@
@Test
public void testNoDelay() {
- attributesAttachQueue1.setRequestDelay(0);
+ attachQueueAttrs1.set(requestDelay, 0);
queue.initializeCounts();
@@ -116,10 +120,10 @@
@Test
public void testRendered() {
- attributesAttachQueue1.setRequestDelay(1500);
- attributesAttachQueue1.setOnRequestQueue(JavaScript.js("alert('requestQueued')"));
- attributesAttachQueue1.setOnRequestDequeue(JavaScript.js("alert('requestDequeued')"));
- attributesAttachQueue1.setRendered(false);
+ attachQueueAttrs1.set(requestDelay, 1500);
+ attachQueueAttrs1.set(onrequestqueue, JavaScript.js("alert('requestQueued')"));
+ attachQueueAttrs1.set(onrequestdequeue, JavaScript.js("alert('requestDequeued')"));
+ attachQueueAttrs1.set(rendered, false);
queue.initializeTimes();
queue.fireEvent(1);
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:49:19 UTC (rev 22678)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:49:53 UTC (rev 22679)
@@ -1,7 +1,12 @@
package org.richfaces.tests.metamer.ftest.attributes;
+import org.richfaces.tests.metamer.ftest.a4jAttachQueue.AttachQueueAttributes;
import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
+import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
+
public class AttributeList {
public static Attributes<TooltipAttributes> tooltipAttributes = new Attributes<TooltipAttributes>();
+ 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]"));
}
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:49:19 UTC (rev 22678)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java 2011-09-05 08:49:53 UTC (rev 22679)
@@ -6,6 +6,7 @@
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.framework.AjaxSelenium;
import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
import org.jboss.test.selenium.interception.CommandContext;
@@ -34,19 +35,34 @@
RequestType requestType = RequestType.HTTP;
+ /**
+ * Ctor for create Attributes instance with different root locator
+ * @param <LT> - ExtentedLocator type definition
+ * @param root - ExtendedLocator
+ */
+ public <LT extends ExtendedLocator<JQueryLocator>> Attributes(LT root) {
+ this.root.setLocator(root);
+ }
+
+ public Attributes() { }
+
public void set(T attribute, String string) {
setProperty(attribute.toString(), string);
}
// TODO jjamrich 2011-09-02: make sure that this resolve to correct string representation of number given as attr
- public void set(T attribute, Integer integer) {
- setProperty(attribute.toString(), integer);
+ public void set(T attribute, Number no) {
+ setProperty(attribute.toString(), no);
}
public void set(T attribute, Boolean bool) {
setProperty(attribute.toString(), bool);
}
+ public void set(T attribute, JavaScript js) {
+ setProperty(attribute.toString(), js);
+ }
+
public void set(T attribute, Enum<?> item) {
setProperty(attribute.toString(), item.toString());
}
@@ -147,5 +163,14 @@
public void setRequestType(RequestType requestType) {
this.requestType = requestType;
}
+
+ public ExtendedLocator<JQueryLocator> getRoot() {
+ return root.getLocator();
+ }
+ public void setRoot(ExtendedLocator<JQueryLocator> root) {
+ this.root.setLocator(root);
+ }
+
+
}
13 years, 3 months
JBoss Rich Faces SVN: r22678 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richTooltip and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-05 04:49:19 -0400 (Mon, 05 Sep 2011)
New Revision: 22678
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/TooltipAttributes.java
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/UsageTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TooltipAttributes.java
Log:
RFPL-1439: updated rich:tooltip tests to use unified way to setting attributes
Moved TooltipAttributes class into tooltip's tests package and updated tests for tooltip to fit new way to setting attributes
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:48:31 UTC (rev 22677)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:49:19 UTC (rev 22678)
@@ -1,5 +1,7 @@
package org.richfaces.tests.metamer.ftest.attributes;
+import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
+
public class AttributeList {
public static Attributes<TooltipAttributes> tooltipAttributes = new Attributes<TooltipAttributes>();
}
Deleted: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/TooltipAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/TooltipAttributes.java 2011-09-05 08:48:31 UTC (rev 22677)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/TooltipAttributes.java 2011-09-05 08:49:19 UTC (rev 22678)
@@ -1,42 +0,0 @@
-package org.richfaces.tests.metamer.ftest.attributes;
-
-public enum TooltipAttributes implements AttributeEnum {
- attached,
- data,
- dir,
- direction,
- execute,
- followMouse,
- hideDelay,
- hideEvent,
- horizontalOffset,
- jointPoint,
- lang,
- layout,
- limitRender,
- mode,
- onbeforedomupdate,
- onbeforehide,
- onbeforeshow,
- onbegin,
- onclick,
- oncomplete,
- ondblclick,
- onhide,
- onmousedown,
- onmousemove,
- onmouseout,
- onmouseover,
- onmouseup,
- onshow,
- render,
- showDelay,
- showEvent,
- status,
- style,
- styleClass,
- title,
- verticalOffset,
- zindex,
-
-}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/UsageTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/UsageTest.java 2011-09-05 08:48:31 UTC (rev 22677)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/UsageTest.java 2011-09-05 08:49:19 UTC (rev 22678)
@@ -2,8 +2,8 @@
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.tooltipAttributes;
-import static org.richfaces.tests.metamer.ftest.attributes.TooltipAttributes.direction;
-import static org.richfaces.tests.metamer.ftest.attributes.TooltipAttributes.hideEvent;
+import static org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes.direction;
+import static org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes.hideEvent;
import java.net.URL;
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipSimple.java 2011-09-05 08:48:31 UTC (rev 22677)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipSimple.java 2011-09-05 08:49:19 UTC (rev 22678)
@@ -36,6 +36,8 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.tooltipAttributes;
+import static org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes.*;
import java.net.URL;
import org.jboss.test.selenium.css.CssProperty;
@@ -64,7 +66,7 @@
private static final int EVENT_OFFSET = 10;
private static final int PRESET_OFFSET = 5;
- TooltipAttributes attributes = new TooltipAttributes();
+ // TooltipAttributes attributes = new TooltipAttributes();
JQueryLocator panel = pjq("div[id$=panel]");
TooltipModel tooltip = new TooltipModel(jq(".rf-tt"), panel);
Point eventPosition;
@@ -102,13 +104,13 @@
@BeforeMethod
public void setupAttributes() {
- attributes.setShowEvent("mouseover");
- attributes.setHideEvent("mouseout");
+ tooltipAttributes.set(showEvent, "mouseover");
+ tooltipAttributes.set(hideEvent, "mouseout");
}
@Test
public void testLifecycle() {
- attributes.setMode(TooltipMode.ajax);
+ tooltipAttributes.set(TooltipAttributes.mode, TooltipMode.ajax);
retrieveRequestTime.initializeValue();
tooltip.recall();
waitGui.waitForChange(retrieveRequestTime);
@@ -117,9 +119,9 @@
@Test
public void testData() {
- attributes.setData("RichFaces 4");
- attributes.setOncomplete("data = event.data");
- attributes.setMode(TooltipMode.ajax);
+ tooltipAttributes.set(data, "RichFaces 4");
+ tooltipAttributes.set(oncomplete, "data = event.data");
+ tooltipAttributes.set(TooltipAttributes.mode, TooltipMode.ajax);
retrieveRequestTime.initializeValue();
tooltip.recall();
@@ -130,7 +132,7 @@
@Test
public void testRequestEventHandlers() {
- attributes.setMode(TooltipMode.ajax);
+ tooltipAttributes.set(TooltipAttributes.mode, TooltipMode.ajax);
super.testRequestEventsBefore("begin", "beforedomupdate", "complete");
retrieveRequestTime.initializeValue();
@@ -150,9 +152,9 @@
@Use(field = "verticalOffset", value = "offsets"),
@Use(field = "horizontalOffset", value = "offsets")})
public void testPositioning() {
- attributes.setDirection(direction);
- attributes.setHorizontalOffset(horizontalOffset);
- attributes.setVerticalOffset(verticalOffset);
+ tooltipAttributes.set(TooltipAttributes.direction, direction);
+ tooltipAttributes.set(TooltipAttributes.horizontalOffset, horizontalOffset);
+ tooltipAttributes.set(TooltipAttributes.verticalOffset, verticalOffset);
if (direction == Positioning.auto) {
direction = Positioning.topRight;
@@ -195,7 +197,7 @@
@Test
@Use(field = "followMouse", booleans = {true, false})
public void testFollowMouse() {
- attributes.setFollowMouse(followMouse);
+ tooltipAttributes.set(TooltipAttributes.followMouse, followMouse);
recallTooltipInRightBottomCornerOfPanel(0, 0);
@@ -215,8 +217,8 @@
@Use(field = "presetDelay", ints = {0, 1000, 5000})
public void testHideDelay() {
- attributes.setMode(TooltipMode.ajax);
- attributes.setHideDelay(presetDelay);
+ tooltipAttributes.set(TooltipAttributes.mode, TooltipMode.ajax);
+ tooltipAttributes.set(hideDelay, presetDelay);
new DelayTester(presetDelay) {
@@ -233,7 +235,7 @@
@Test
public void testHideEvent() {
- attributes.setHideEvent("mouseup");
+ tooltipAttributes.set(hideEvent, "mouseup");
tooltip.recall();
@@ -249,7 +251,7 @@
@Test
@Use(field = "layout", enumeration = true)
public void testLayout() {
- attributes.setLayout(layout);
+ tooltipAttributes.set(TooltipAttributes.layout, layout);
String expectedTagName = (layout == TooltipLayout.block) ? "div" : "span";
@@ -261,9 +263,9 @@
@Test
public void testLimitRender() {
- attributes.setLimitRender(true);
- attributes.setRender("@this renderChecker");
- attributes.setMode(TooltipMode.ajax);
+ tooltipAttributes.set(limitRender, true);
+ tooltipAttributes.set(render, "@this renderChecker");
+ tooltipAttributes.set(TooltipAttributes.mode, TooltipMode.ajax);
retrieveRenderChecker.initializeValue();
retrieveRequestTime.initializeValue();
@@ -276,7 +278,7 @@
@Test
@Use(field = "mode", enumeration = true)
public void testMode() {
- attributes.setMode(mode);
+ tooltipAttributes.set(TooltipAttributes.mode, mode);
retrieveRequestTime.initializeValue();
@@ -301,7 +303,7 @@
@Test
public void testRendered() {
- attributes.setRendered(false);
+ tooltipAttributes.set(TooltipAttributes.rendered, false);
assertFalse(selenium.isElementPresent(tooltip));
}
@@ -311,8 +313,8 @@
@RegressionTest("https://issues.jboss.org/browse/RF-10522")
public void testShowDelay() {
- attributes.setMode(TooltipMode.client);
- attributes.setShowDelay(presetDelay);
+ tooltipAttributes.set(TooltipAttributes.mode, TooltipMode.client);
+ tooltipAttributes.set(showDelay, presetDelay);
new DelayTester(presetDelay) {
@@ -329,7 +331,7 @@
@Test
public void testShowEvent() {
- attributes.setShowEvent("mouseup");
+ tooltipAttributes.set(TooltipAttributes.showEvent, "mouseup");
selenium.mouseUpAt(panel, new Point(5, 5));
waitGui.until(isDisplayed.locator(tooltip));
@@ -337,8 +339,8 @@
@Test
public void testStatus() {
- attributes.setStatus("statusChecker");
- attributes.setMode(TooltipMode.ajax);
+ tooltipAttributes.set(status, "statusChecker");
+ tooltipAttributes.set(TooltipAttributes.mode, TooltipMode.ajax);
retrieveStatusChecker.initializeValue();
tooltip.recall();
@@ -362,7 +364,7 @@
@Test
public void testZindex() {
- attributes.setZindex(10);
+ tooltipAttributes.set(zindex, 10);
String zindex = selenium.getStyle(tooltip, CssProperty.Z_INDEX);
assertEquals(zindex, "10");
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java 2011-09-05 08:48:31 UTC (rev 22677)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java 2011-09-05 08:49:19 UTC (rev 22678)
@@ -21,10 +21,9 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richTooltip;
-import static javax.faces.event.PhaseId.APPLY_REQUEST_VALUES;
-import static javax.faces.event.PhaseId.RENDER_RESPONSE;
-import static javax.faces.event.PhaseId.RESTORE_VIEW;
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.tooltipAttributes;
+import static org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes.*;
import java.net.URL;
@@ -44,7 +43,7 @@
*/
public class TestTooltipTarget extends AbstractMetamerTest {
- private TooltipAttributes attributes = new TooltipAttributes();
+ // private TooltipAttributes attributes = new TooltipAttributes();
private JQueryLocator panel1 = pjq("div[id$=regular-div]");
private JQueryLocator panel2 = pjq("div[id$=jsf-div]");
private JQueryLocator panel3 = pjq("div[id$=panel_body]");
@@ -60,25 +59,25 @@
@BeforeMethod
public void setupAttributes() {
- attributes.setShowEvent("mouseover");
- attributes.setHideEvent("mouseout");
+ tooltipAttributes.set(showEvent, "mouseover");
+ tooltipAttributes.set(hideEvent, "mouseout");
}
@Test
@IssueTracking("https://issues.jboss.org/browse/RF-11370")
public void testTarget() {
// 1. first target
- attributes.setTarget("regular-div");
+ tooltipAttributes.set(target, "regular-div");
tooltip1.recall();
waitGui.until(isDisplayed.locator(tooltip1));
// 2. target
- attributes.setTarget("form:jsf-div");
+ tooltipAttributes.set(target, "form:jsf-div");
tooltip2.recall();
waitGui.until(isDisplayed.locator(tooltip2));
// 3. default target
- attributes.setTarget("form:panel");
+ tooltipAttributes.set(target, "form:panel");
tooltip3.recall();
waitGui.until(isDisplayed.locator(tooltip3));
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TooltipAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TooltipAttributes.java 2011-09-05 08:48:31 UTC (rev 22677)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TooltipAttributes.java 2011-09-05 08:49:19 UTC (rev 22678)
@@ -1,150 +1,46 @@
-/*******************************************************************************
- * 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.richTooltip;
-import org.richfaces.TooltipLayout;
-import org.richfaces.TooltipMode;
-import org.richfaces.component.Positioning;
-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 TooltipAttributes extends AbstractComponentAttributes {
-
- public void setData(String data) {
- setProperty("data", data);
- }
-
- public void setDir(String dir) {
- setProperty("dir", dir);
- }
-
- public void setDirection(Positioning direction) {
- setProperty("direction", direction);
- }
-
- public void setDisabled(Boolean disabled) {
- setProperty("disabled", disabled);
- }
-
- public void setExecute(String execute) {
- setProperty("execute", execute);
- }
-
- public void setFollowMouse(Boolean followMouse) {
- setProperty("followMouse", followMouse);
- }
-
- public void setHideDelay(Integer hideDelay) {
- setProperty("hideDelay", hideDelay);
- }
-
- public void setHideEvent(String hideEvent) {
- setProperty("hideEvent", hideEvent);
- }
-
- public void setHorizontalOffset(Integer horizontalOffset) {
- setProperty("horizontalOffset", horizontalOffset);
- }
-
- public void setJointPoint(Positioning positioning) {
- setProperty("positioning", positioning);
- }
-
- public void setLang(String lang) {
- setProperty("lang", lang);
- }
-
- public void setLayout(TooltipLayout layout) {
- setProperty("layout", layout);
- }
-
- public void setLimitRender(Boolean limitRender) {
- setProperty("limitRender", limitRender);
- }
-
- public void setMode(TooltipMode mode) {
- setProperty("mode", mode);
- }
-
- public void setOnbeforehide(String onbeforehide) {
- setProperty("onbeforehide", onbeforehide);
- }
-
- public void setOnbeforeshow(String onbeforeshow) {
- setProperty("onbeforeshow", onbeforeshow);
- }
-
- public void setOnhide(String onhide) {
- setProperty("onhide", onhide);
- }
-
- public void setOnshow(String onshow) {
- setProperty("onshow", onshow);
- }
-
- public void setRender(String render) {
- setProperty("render", render);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setShowDelay(Integer showDelay) {
- setProperty("showDelay", showDelay);
- }
-
- public void setShowEvent(String showEvent) {
- setProperty("showEvent", showEvent);
- }
-
- public void setStatus(String status) {
- setProperty("status", status);
- }
-
- public void setStyle(String style) {
- setProperty("style", style);
- }
-
- public void setStyleClass(String styleClass) {
- setProperty("styleClass", styleClass);
- }
-
- public void setTarget(String target) {
- setProperty("target", target);
- }
-
- public void setTitle(String title) {
- setProperty("title", title);
- }
-
- public void setVerticalOffset(Integer verticalOffset) {
- setProperty("verticalOffset", verticalOffset);
- }
-
- public void setZindex(Integer zindex) {
- setProperty("zindex", zindex);
- }
+public enum TooltipAttributes implements AttributeEnum {
+ attached,
+ data,
+ dir,
+ direction,
+ execute,
+ followMouse,
+ hideDelay,
+ hideEvent,
+ horizontalOffset,
+ jointPoint,
+ lang,
+ layout,
+ limitRender,
+ mode,
+ onbeforedomupdate,
+ onbeforehide,
+ onbeforeshow,
+ onbegin,
+ onclick,
+ oncomplete,
+ ondblclick,
+ onhide,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup,
+ onshow,
+ render,
+ rendered,
+ showDelay,
+ showEvent,
+ status,
+ style,
+ styleClass,
+ title,
+ target,
+ verticalOffset,
+ zindex,
+
}
13 years, 3 months
JBoss Rich Faces SVN: r22677 - 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:48:31 -0400 (Mon, 05 Sep 2011)
New Revision: 22677
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeEnum.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/attributes/TooltipAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/UsageTest.java
Log:
RFPL-1439: PoC for unified way to setting attributes in Metamer tests
There is PoC with core classes and one usage test with example.
The main difference between current solution and this is that there is no need to write setter methods for all component attributes, but only simply copy all properties into enum (which should be simply copy&paste from component UIClass), and add type safety on component properties tests (usable for refactoring, when some attributes renamed or removed)
In next step is neccessary to change all classes using AbstractComponentAttributes class, and change routines in AbstractMetamerTest class as well since there are some routines to test style, styleClass or title attributes.
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeEnum.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeEnum.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeEnum.java 2011-09-05 08:48:31 UTC (rev 22677)
@@ -0,0 +1,5 @@
+package org.richfaces.tests.metamer.ftest.attributes;
+
+public interface AttributeEnum {
+
+}
Added: 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 (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-05 08:48:31 UTC (rev 22677)
@@ -0,0 +1,5 @@
+package org.richfaces.tests.metamer.ftest.attributes;
+
+public class AttributeList {
+ public static Attributes<TooltipAttributes> tooltipAttributes = new Attributes<TooltipAttributes>();
+}
Added: 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 (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/Attributes.java 2011-09-05 08:48:31 UTC (rev 22677)
@@ -0,0 +1,151 @@
+package org.richfaces.tests.metamer.ftest.attributes;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guard;
+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;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.interception.CommandContext;
+import org.jboss.test.selenium.interception.CommandInterceptionException;
+import org.jboss.test.selenium.interception.CommandInterceptor;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.ExtendedLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.option.OptionValueLocator;
+import org.jboss.test.selenium.locator.reference.LocatorReference;
+import org.jboss.test.selenium.locator.reference.ReferencedLocator;
+import org.jboss.test.selenium.request.RequestType;
+import org.jboss.test.selenium.waiting.Wait;
+
+import com.thoughtworks.selenium.SeleniumException;
+
+
+public class Attributes<T extends AttributeEnum> {
+
+ protected AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+ LocatorReference<ExtendedLocator<JQueryLocator>> root =
+ new LocatorReference<ExtendedLocator<JQueryLocator>>(pjq(""));
+ ReferencedLocator<JQueryLocator> propertyLocator = referenceInferred(root, ":input[id*=:{0}Input]{1}");
+
+ RequestType requestType = RequestType.HTTP;
+
+ public void set(T attribute, String string) {
+ setProperty(attribute.toString(), string);
+ }
+
+ // TODO jjamrich 2011-09-02: make sure that this resolve to correct string representation of number given as attr
+ public void set(T attribute, Integer integer) {
+ setProperty(attribute.toString(), integer);
+ }
+
+ public void set(T attribute, Boolean bool) {
+ setProperty(attribute.toString(), bool);
+ }
+
+ public void set(T attribute, Enum<?> item) {
+ setProperty(attribute.toString(), item.toString());
+ }
+
+ /*protected void set(String propertyName, Object value) {
+
+ }*/
+
+ protected void setProperty(String propertyName, Object value) {
+ selenium.getInterceptionProxy().registerInterceptor(new RepeatForElementNotFound());
+
+ ExtendedLocator<JQueryLocator> locator = propertyLocator.format(propertyName, "");
+ final AttributeLocator<?> typeLocator = locator.getAttribute(Attribute.TYPE);
+ final ExtendedLocator<JQueryLocator> optionLocator = locator.getChild(jq("option"));
+
+ String inputType = null;
+ if (selenium.getCount(propertyLocator.format(propertyName)) > 1) {
+ inputType = "radio";
+ } else if (selenium.getCount(optionLocator) > 1) {
+ inputType = "select";
+ } else {
+ inputType = selenium.getAttribute(typeLocator);
+ }
+
+ if (value == null) {
+ value = "";
+ }
+
+ String valueAsString = value.toString();
+ System.out.println("\n ###setting following value as string: '" + valueAsString + "'");
+
+ if ("text".equals(inputType)) {
+ applyText(locator, valueAsString);
+ } else if ("checkbox".equals(inputType)) {
+ boolean checked = Boolean.valueOf(valueAsString);
+ applyCheckbox(locator, checked);
+ } else if ("radio".equals(inputType)) {
+ locator = propertyLocator.format(propertyName, "[value="
+ + ("".equals(valueAsString) ? "null" : valueAsString) + "]");
+
+ if (!selenium.isChecked(locator)) {
+ applyRadio(locator);
+ }
+ } else if ("select".equals(inputType)) {
+ String curValue = selenium.getValue(locator);
+ if (valueAsString.equals(curValue)) {
+ return;
+ }
+ applySelect(locator, valueAsString);
+ }
+
+ selenium.getInterceptionProxy().unregisterInterceptorType(RepeatForElementNotFound.class);
+ }
+
+ protected void applyText(ElementLocator<?> locator, String value) {
+ guard(selenium, requestType).type(locator, value);
+ }
+
+ protected void applyCheckbox(ElementLocator<?> locator, boolean checked) {
+ selenium.check(locator, checked);
+ guard(selenium, requestType).fireEvent(locator, Event.CHANGE);
+ }
+
+ protected void applyRadio(ElementLocator<?> locator) {
+ guard(selenium, requestType).click(locator);
+ }
+
+ protected void applySelect(ElementLocator<?> locator, String value) {
+ OptionValueLocator optionLocator = new OptionValueLocator(value);
+ guard(selenium, requestType).select(locator, optionLocator);
+ }
+
+ private class RepeatForElementNotFound implements CommandInterceptor {
+ @Override
+ public void intercept(CommandContext ctx) throws CommandInterceptionException {
+ for (int i = 1; i <= 3; i++) {
+ try {
+ ctx.invoke();
+ break;
+ } catch (SeleniumException e) {
+ if (i == 3) {
+ throw e;
+ }
+ if (e.getMessage().matches("ERROR: Element .* not found")) {
+ Wait.waitAjax().timeout(500).interval(100).waitForTimeout();
+ continue;
+ }
+ throw e;
+ }
+ }
+ }
+ }
+
+ public RequestType getRequestType() {
+ return requestType;
+ }
+
+ public void setRequestType(RequestType requestType) {
+ this.requestType = requestType;
+ }
+
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/TooltipAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/TooltipAttributes.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/TooltipAttributes.java 2011-09-05 08:48:31 UTC (rev 22677)
@@ -0,0 +1,42 @@
+package org.richfaces.tests.metamer.ftest.attributes;
+
+public enum TooltipAttributes implements AttributeEnum {
+ attached,
+ data,
+ dir,
+ direction,
+ execute,
+ followMouse,
+ hideDelay,
+ hideEvent,
+ horizontalOffset,
+ jointPoint,
+ lang,
+ layout,
+ limitRender,
+ mode,
+ onbeforedomupdate,
+ onbeforehide,
+ onbeforeshow,
+ onbegin,
+ onclick,
+ oncomplete,
+ ondblclick,
+ onhide,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup,
+ onshow,
+ render,
+ showDelay,
+ showEvent,
+ status,
+ style,
+ styleClass,
+ title,
+ verticalOffset,
+ zindex,
+
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/UsageTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/UsageTest.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/UsageTest.java 2011-09-05 08:48:31 UTC (rev 22677)
@@ -0,0 +1,42 @@
+package org.richfaces.tests.metamer.ftest.attributes;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.tooltipAttributes;
+import static org.richfaces.tests.metamer.ftest.attributes.TooltipAttributes.direction;
+import static org.richfaces.tests.metamer.ftest.attributes.TooltipAttributes.hideEvent;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.geometry.Point;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.utils.URLUtils;
+import org.richfaces.component.Positioning;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.richTooltip.TooltipModel;
+import org.testng.annotations.Test;
+
+public class UsageTest extends AbstractMetamerTest {
+
+ JQueryLocator panel = pjq("div[id$=panel]");
+ TooltipModel tooltip = new TooltipModel(jq(".rf-tt"), panel);
+
+ @Test
+ public void test1() {
+ tooltipAttributes.set(direction, Positioning.auto);
+ }
+
+ @Test
+ public void testHideEvent() {
+ tooltipAttributes.set(hideEvent, "mouseup");
+
+ tooltip.recall();
+
+ selenium.mouseUpAt(panel, new Point(5, 5));
+ waitGui.until(isNotDisplayed.locator(tooltip));
+ }
+
+ @Override
+ public URL getTestUrl() {
+ return URLUtils.buildUrl(contextPath, "faces/components/richTooltip/simple.xhtml");
+ }
+}
13 years, 3 months
JBoss Rich Faces SVN: r22676 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-01 10:27:07 -0400 (Thu, 01 Sep 2011)
New Revision: 22676
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java
Log:
RFPL-1054: add IssueTracking for rich:tooltip targetted test
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java 2011-09-01 14:26:46 UTC (rev 22675)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java 2011-09-01 14:27:07 UTC (rev 22676)
@@ -31,6 +31,7 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.utils.URLUtils;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -64,6 +65,7 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-11370")
public void testTarget() {
// 1. first target
attributes.setTarget("regular-div");
13 years, 4 months
JBoss Rich Faces SVN: r22675 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-09-01 10:26:46 -0400 (Thu, 01 Sep 2011)
New Revision: 22675
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java
Log:
RFPL-1054: add test for rich:tooltip by @target
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTooltip/TestTooltipTarget.java 2011-09-01 14:26:46 UTC (rev 22675)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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.richTooltip;
+
+import static javax.faces.event.PhaseId.APPLY_REQUEST_VALUES;
+import static javax.faces.event.PhaseId.RENDER_RESPONSE;
+import static javax.faces.event.PhaseId.RESTORE_VIEW;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.utils.URLUtils;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test for @target attribute on page faces/components/richTooltip/targetting.xhtml
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ *
+ * @version $Revision$
+ */
+public class TestTooltipTarget extends AbstractMetamerTest {
+
+ private TooltipAttributes attributes = new TooltipAttributes();
+ private JQueryLocator panel1 = pjq("div[id$=regular-div]");
+ private JQueryLocator panel2 = pjq("div[id$=jsf-div]");
+ private JQueryLocator panel3 = pjq("div[id$=panel_body]");
+
+ TooltipModel tooltip1 = new TooltipModel(jq(".rf-tt"), panel1);
+ TooltipModel tooltip2 = new TooltipModel(jq(".rf-tt"), panel2);
+ TooltipModel tooltip3 = new TooltipModel(jq(".rf-tt"), panel3);
+
+ @Override
+ public URL getTestUrl() {
+ return URLUtils.buildUrl(contextPath, "faces/components/richTooltip/targetting.xhtml");
+ }
+
+ @BeforeMethod
+ public void setupAttributes() {
+ attributes.setShowEvent("mouseover");
+ attributes.setHideEvent("mouseout");
+ }
+
+ @Test
+ public void testTarget() {
+ // 1. first target
+ attributes.setTarget("regular-div");
+ tooltip1.recall();
+ waitGui.until(isDisplayed.locator(tooltip1));
+
+ // 2. target
+ attributes.setTarget("form:jsf-div");
+ tooltip2.recall();
+ waitGui.until(isDisplayed.locator(tooltip2));
+
+ // 3. default target
+ attributes.setTarget("form:panel");
+ tooltip3.recall();
+ waitGui.until(isDisplayed.locator(tooltip3));
+ }
+}
13 years, 4 months
JBoss Rich Faces SVN: r22674 - branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-09-01 04:19:48 -0400 (Thu, 01 Sep 2011)
New Revision: 22674
Modified:
branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
RF-11368: DropDownMenu - broken positioning in scrolled containers
Modified: branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2011-09-01 08:09:34 UTC (rev 22673)
+++ branches/community/3.3.X/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2011-09-01 08:19:48 UTC (rev 22674)
@@ -544,6 +544,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];
@@ -594,8 +595,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: r22673 - branches/enterprise.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2011-09-01 04:09:34 -0400 (Thu, 01 Sep 2011)
New Revision: 22673
Added:
branches/enterprise/3.3.1.SP3_RFPL-1631/
Log:
created branch for the RFPL-1631 patch
13 years, 4 months