Author: jjamrich
Date: 2011-09-23 09:31:18 -0400 (Fri, 23 Sep 2011)
New Revision: 22753
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeModelRecursiveAdaptorAttributes.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/richTree/TestTreePhases.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeToggling.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorLazyLoading.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSelection.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSimple.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorToggling.java
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/TreeNodeAttributes.java
Log:
RFPL-1439: Update tests for tree to use unified 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-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -1,7 +1,7 @@
package org.richfaces.tests.metamer.ftest.attributes;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
-import javassist.expr.NewArray;
import org.jboss.test.selenium.request.RequestType;
import org.richfaces.tests.metamer.ftest.BasicAttributes;
@@ -30,6 +30,7 @@
import org.richfaces.tests.metamer.ftest.richPanelMenuItem.PanelMenuItemAttributes;
import org.richfaces.tests.metamer.ftest.richPickList.PickListAttributes;
import org.richfaces.tests.metamer.ftest.richTooltip.TooltipAttributes;
+import org.richfaces.tests.metamer.ftest.richTree.TreeAttributes;
public class AttributeList {
public static Attributes<BasicAttributes> basicAttributes = new
Attributes<BasicAttributes>();
@@ -61,5 +62,6 @@
public static Attributes<PanelMenuGroupAttributes> panelMenuGroupAttributes =
new Attributes<PanelMenuGroupAttributes>();
public static Attributes<PanelMenuItemAttributes> panelMenuItemAttributes = new
Attributes<PanelMenuItemAttributes>();
public static Attributes<PickListAttributes> pickListAttributes = new
Attributes<PickListAttributes>();
+ public static Attributes<TreeAttributes> treeAttributes = new
Attributes<TreeAttributes>(jq("span[id*=attributes]"));
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreePhases.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreePhases.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreePhases.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -21,8 +21,8 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richTree;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.treeAttributes;
import java.net.URL;
@@ -43,7 +43,6 @@
@Use(booleans = { true, false })
Boolean immediate;
- private TreeAttributes treeAttributes = new
TreeAttributes(jq("span[id*=attributes]"));
private TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
@Override
@@ -53,7 +52,7 @@
@BeforeMethod
public void initialize() {
- treeAttributes.setImmediate(immediate);
+ treeAttributes.set(TreeAttributes.immediate, immediate);
}
@Test
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -27,6 +27,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.treeAttributes;
import java.net.URL;
import java.util.Arrays;
@@ -53,7 +54,6 @@
protected Integer[][] selectionPaths = new Integer[][] {{2, 3}, {3, 4}, {4, 1, 1},
{4}, {4, 1},
{1, 5 }, {2, 3, 3 } };
- protected TreeAttributes treeAttributes = new
TreeAttributes(jq("span[id*=attributes]"));
protected TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
protected TreeNodeModel treeNode;
@@ -77,7 +77,7 @@
@BeforeMethod
public void testInitialize() {
- treeAttributes.setSelectionType(selectionType);
+ treeAttributes.set(TreeAttributes.selectionType, selectionType);
tree.setSelectionType(selectionType);
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -38,10 +38,26 @@
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
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.BasicAttributes.handleClass;
+import static org.richfaces.tests.metamer.ftest.BasicAttributes.iconClass;
+import static org.richfaces.tests.metamer.ftest.BasicAttributes.labelClass;
+import static org.richfaces.tests.metamer.ftest.BasicAttributes.nodeClass;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.treeAttributes;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.data;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.execute;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.iconCollapsed;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.iconExpanded;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.iconLeaf;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.limitRender;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.oncomplete;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.render;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.rendered;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.selectionType;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.status;
+import static org.richfaces.tests.metamer.ftest.richTree.TreeAttributes.toggleNodeEvent;
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.BasicAttributes.*;
import java.net.URL;
@@ -57,7 +73,6 @@
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.Use;
-import org.richfaces.tests.metamer.ftest.richTreeNode.TreeNodeAttributes;
import org.testng.annotations.Test;
/**
@@ -89,12 +104,6 @@
TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
TreeNodeModel treeNode;
- TreeAttributes attributes = new
TreeAttributes(pjq("span[id*=attributes]"));
- TreeNodeAttributes[] nodeAttributes = new TreeNodeAttributes[] {
- new TreeNodeAttributes(pjq("span[id*=treeNode1Attributes]")),
- new TreeNodeAttributes(pjq("span[id*=treeNode2Attributes]")),
- new TreeNodeAttributes(pjq("span[id*=treeNode3Attributes]")) };
-
JQueryLocator expandAll = jq("input:submit[id$=expandAll]");
JQueryLocator loadingFacet = jq("input:checkbox[id$=loadingFacet]");
@@ -105,8 +114,8 @@
@Test
public void testData() {
- attributes.setData("RichFaces 4");
- attributes.setOncomplete("data = event.data");
+ treeAttributes.set(data, "RichFaces 4");
+ treeAttributes.set(oncomplete, "data = event.data");
retrieveRequestTime.initializeValue();
tree.getNode(1).select();
@@ -122,7 +131,7 @@
@Test
public void testExecute() {
- attributes.setExecute("executeChecker @this");
+ treeAttributes.set(execute, "executeChecker @this");
tree.getNode(1).select();
assertTrue(selenium.isTextPresent("* executeChecker"));
}
@@ -153,7 +162,7 @@
@Test
public void testIconCollapsed() {
- attributes.setIconCollapsed(IMAGE_URL);
+ treeAttributes.set(iconCollapsed, IMAGE_URL);
for (int i = 0; i < 3; i++) {
ExtendedLocator<JQueryLocator> icons = tree.getAnyNode().getIcon();
@@ -172,7 +181,7 @@
@Test
public void testIconExpanded() {
- attributes.setIconExpanded(IMAGE_URL);
+ treeAttributes.set(iconExpanded, IMAGE_URL);
for (int i = 0; i < 3; i++) {
ExtendedLocator<JQueryLocator> icons = tree.getAnyNode().getIcon();
@@ -191,7 +200,7 @@
@Test
public void testIconLeaf() {
- attributes.setIconLeaf(IMAGE_URL);
+ treeAttributes.set(iconLeaf, IMAGE_URL);
for (int i = 0; i < 3; i++) {
ExtendedLocator<JQueryLocator> icons = tree.getAnyNode().getIcon();
@@ -215,8 +224,8 @@
@Test
public void testLimitRender() {
- attributes.setRender("@this renderChecker");
- attributes.setLimitRender(true);
+ treeAttributes.set(render, "@this renderChecker");
+ treeAttributes.set(limitRender, true);
retrieveRenderChecker.initializeValue();
String requestTime = retrieveRequestTime.retrieve();
tree.getNode(1).select();
@@ -251,7 +260,7 @@
@Test
public void testRender() {
- attributes.setRender("@this renderChecker");
+ treeAttributes.set(render, "@this renderChecker");
retrieveRenderChecker.initializeValue();
tree.getNode(1).select();
waitGui.waitForChange(retrieveRenderChecker);
@@ -260,7 +269,7 @@
@Test
public void testRendered() {
assertTrue(selenium.isElementPresent(tree) && selenium.isVisible(tree));
- attributes.setRendered(false);
+ treeAttributes.set(rendered, false);
assertFalse(selenium.isElementPresent(tree));
}
@@ -270,7 +279,7 @@
tree.getNode(1).select();
assertFalse(retrieveStatusChecker.isValueChanged());
- attributes.setStatus("statusChecker");
+ treeAttributes.set(status, "statusChecker");
retrieveStatusChecker.initializeValue();
tree.getNode(1).select();
assertTrue(retrieveStatusChecker.isValueChanged());
@@ -295,12 +304,12 @@
@Use(field = "eventToFire", value = "eventsToFire")
public void testToggleNodeEvent() {
treeNode = tree.getNode(2);
- attributes.setSelectionType(SwitchType.client);
+ treeAttributes.set(selectionType, SwitchType.client);
ExtendedLocator<JQueryLocator> target = treeNode.getLabel();
for (Event eventToSetup : eventsToFire) {
assertTrue(treeNode.isCollapsed());
- attributes.setToggleNodeEvent(eventToSetup.getEventName());
+ treeAttributes.set(toggleNodeEvent, eventToSetup.getEventName());
fireEvent(target, eventToFire, eventToSetup);
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeToggling.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeToggling.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeToggling.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -25,6 +25,7 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.treeAttributes;
import java.net.URL;
import java.util.Deque;
@@ -46,7 +47,6 @@
private static final int TOP_LEVEL_NODES = 4;
protected int[][] paths = new int[][] {{3, 2, 1 }, {2, 4, 1 }};
- protected TreeAttributes treeAttributes = new
TreeAttributes(jq("span[id*=attributes]"));
@Inject
@Use(enumeration = true)
@@ -62,7 +62,7 @@
@BeforeMethod
public void verifyInitialState() {
- treeAttributes.setToggleType(toggleType);
+ treeAttributes.set(TreeAttributes.toggleType, toggleType);
tree.setToggleType(toggleType);
assertEquals(tree.getCollapsedNodesCount(), TOP_LEVEL_NODES);
assertEquals(tree.getExpandedNodesCount(), 0);
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeAttributes.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeAttributes.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -21,86 +21,30 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richTree;
-import org.jboss.test.selenium.locator.ExtendedLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.component.SwitchType;
-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 TreeAttributes extends AbstractComponentAttributes {
-
- public TreeAttributes() {
- super();
- }
-
- public <T extends ExtendedLocator<JQueryLocator>> TreeAttributes(T root)
{
- super(root);
- }
-
- public void setData(String data) {
- setProperty("data", data);
- }
-
- public void setExecute(String execute) {
- setProperty("execute", execute);
- }
-
- public void setIconCollapsed(String iconCollapsed) {
- setProperty("iconCollapsed", iconCollapsed);
- }
-
- public void setIconExpanded(String iconExpanded) {
- setProperty("iconExpanded", iconExpanded);
- }
-
- public void setIconLeaf(String iconLeaf) {
- setProperty("iconLeaf", iconLeaf);
- }
-
- public void setImmediate(Boolean immediate) {
- setProperty("immediate", immediate);
- }
-
- public void setKeepSaved(Boolean keepSaved) {
- setProperty("keepSaved", keepSaved);
- }
-
- public void setLang(String lang) {
- setProperty("lang", lang);
- }
-
- 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 setSelectionType(SwitchType selectionType) {
- setProperty("selectionType", selectionType);
- }
-
- public void setStatus(String status) {
- setProperty("status", status);
- }
-
- public void setTitle(String title) {
- setProperty("title", title);
- }
-
- public void setToggleNodeEvent(String toggleNodeEvent) {
- setProperty("toggleNodeEvent", toggleNodeEvent);
- }
-
- public void setToggleType(SwitchType toggleType) {
- setProperty("toggleType", toggleType);
- }
+public enum TreeAttributes implements AttributeEnum {
+
+ data,
+ execute,
+ iconCollapsed,
+ iconExpanded,
+ iconLeaf,
+ immediate,
+ keepSaved,
+ lang,
+ limitRender,
+ oncomplete,
+ render,
+ rendered,
+ selectionType,
+ status,
+ title,
+ toggleNodeEvent,
+ toggleType,
+
}
Deleted:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeModelRecursiveAdaptorAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeModelRecursiveAdaptorAttributes.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TreeModelRecursiveAdaptorAttributes.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -1,34 +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.richTree;
-
-import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
-
-/**
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class TreeModelRecursiveAdaptorAttributes extends AbstractComponentAttributes {
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorLazyLoading.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorLazyLoading.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorLazyLoading.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -21,7 +21,6 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richTreeModelAdaptor;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
@@ -38,7 +37,6 @@
import org.apache.commons.lang.StringUtils;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.richfaces.tests.metamer.ftest.richTree.TreeAttributes;
import org.richfaces.tests.metamer.ftest.richTree.TreeModel;
import org.richfaces.tests.metamer.ftest.richTree.TreeNodeModel;
import org.testng.annotations.Test;
@@ -49,7 +47,6 @@
*/
public class TestTreeModelAdaptorLazyLoading extends AbstractMetamerTest {
- protected TreeAttributes treeAttributes = new
TreeAttributes(jq("span[id*=treeAttributes]"));
protected TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
protected TreeNodeModel treeNode;
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSelection.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSelection.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSelection.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -22,7 +22,6 @@
package org.richfaces.tests.metamer.ftest.richTreeModelAdaptor;
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.URLUtils.buildUrl;
import java.net.URL;
@@ -35,8 +34,6 @@
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.richfaces.tests.metamer.ftest.annotations.Uses;
import org.richfaces.tests.metamer.ftest.richTree.TestTreeSelection;
-import org.richfaces.tests.metamer.ftest.richTree.TreeAttributes;
-import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -65,11 +62,6 @@
return buildUrl(contextPath,
"http://localhost:8080/metamer/faces/components/richTree/treeAdaptors.xhtml");
}
- @BeforeClass
- public void initTreeAttributes() {
- treeAttributes = new TreeAttributes(jq("span[id*=treeAttributes]"));
- }
-
@BeforeMethod
public void initPathsAndModelRepresentation() {
if (paths != null) {
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSimple.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSimple.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSimple.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -21,7 +21,6 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richTreeModelAdaptor;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
@@ -33,7 +32,8 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractComponentAttributes;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.richfaces.tests.metamer.ftest.richTree.TreeAttributes;
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
+import org.richfaces.tests.metamer.ftest.attributes.Attributes;
import org.richfaces.tests.metamer.ftest.richTree.TreeModel;
import org.richfaces.tests.metamer.ftest.richTree.TreeNodeModel;
import org.testng.annotations.Test;
@@ -44,14 +44,13 @@
*/
public class TestTreeModelAdaptorSimple extends AbstractMetamerTest {
- protected TreeAttributes treeAttributes = new
TreeAttributes(jq("span[id*=treeAttributes]"));
protected TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
protected TreeNodeModel treeNode;
- private ModelAdaptorAttributes modelAdaptorAttributes = new ModelAdaptorAttributes(
+ private Attributes<ModelAdaptorAttributes> modelAdaptorAttributes = new
Attributes<ModelAdaptorAttributes>(
pjq("span[id$=:listAttributes:panel]"));
- private RecursiveModelAdaptorAttributes recursiveModelAdaptorAttributes = new
RecursiveModelAdaptorAttributes(
- pjq("span[id$=:recursiveAttributes:panel]"));
+ private Attributes<RecursiveModelAdaptorAttributes>
recursiveModelAdaptorAttributes =
+ new
Attributes<RecursiveModelAdaptorAttributes>(pjq("span[id$=:recursiveAttributes:panel]"));
@Override
@@ -67,7 +66,7 @@
assertTrue(treeNode.isLeaf());
- modelAdaptorAttributes.setRendered(false);
+ modelAdaptorAttributes.set(ModelAdaptorAttributes.rendered, false);
assertFalse(treeNode.isLeaf());
}
@@ -85,7 +84,7 @@
}
assertTrue(subnodePresent, "there should be at least one subnode (not leaf)
in expanded branch");
- recursiveModelAdaptorAttributes.setRendered(false);
+ recursiveModelAdaptorAttributes.set(RecursiveModelAdaptorAttributes.rendered,
false);
for (TreeNodeModel treeNode : tree.getNode(2).getNode(2).getNodes()) {
if (!treeNode.isLeaf()) {
@@ -94,25 +93,12 @@
}
}
- private class ModelAdaptorAttributes extends AbstractComponentAttributes {
-
- public <T extends ExtendedLocator<JQueryLocator>>
ModelAdaptorAttributes(T root) {
- super(root);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
+ private enum ModelAdaptorAttributes implements AttributeEnum {
+ rendered,
}
- private class RecursiveModelAdaptorAttributes extends AbstractComponentAttributes {
-
- public <T extends ExtendedLocator<JQueryLocator>>
RecursiveModelAdaptorAttributes(T root) {
- super(root);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
+ private enum RecursiveModelAdaptorAttributes implements AttributeEnum {
+ rendered,
}
+
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorToggling.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorToggling.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorToggling.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -22,7 +22,6 @@
package org.richfaces.tests.metamer.ftest.richTreeModelAdaptor;
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.URLUtils.buildUrl;
import java.net.URL;
@@ -30,7 +29,6 @@
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.richfaces.tests.metamer.ftest.richTree.TestTreeToggling;
-import org.richfaces.tests.metamer.ftest.richTree.TreeAttributes;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -51,7 +49,6 @@
@BeforeClass
public void setupTreeModelTesting() {
- treeAttributes = new TreeAttributes(jq("span[id*=treeAttributes]"));
paths = new int[][] { { 3, 2, 1, 2 }, { 2, 4, 6 } };
}
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-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TestTreeNodeSimple.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -36,6 +36,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.richTreeNode.TreeNodeAttributes.*;
import java.net.URL;
@@ -51,6 +52,7 @@
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
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.richTree.TreeAttributes;
import org.richfaces.tests.metamer.ftest.richTree.TreeModel;
import org.richfaces.tests.metamer.ftest.richTree.TreeNodeModel;
@@ -67,9 +69,9 @@
private static final String JQ_SAMPLE_CLASS = "[sample-class]";
private static final String IMAGE_URL = "/resources/images/loading.gif";
- TreeAttributes attributesTree = new
TreeAttributes(jq("span[id$=attributes:panel]"));
- TreeNodeAttributes attributes = new
TreeNodeAttributes(jq("span[id$=treeNode1Attributes:panel]"));
- TreeNodeAttributes attributesLeaf = new
TreeNodeAttributes(jq("span[id$=treeNode3Attributes:panel]"));
+ Attributes<TreeAttributes> attributesTree = new
Attributes<TreeAttributes>(jq("span[id$=attributes:panel]"));
+ Attributes<TreeNodeAttributes> attributes = new
Attributes<TreeNodeAttributes>(jq("span[id$=treeNode1Attributes:panel]"));
+ Attributes<TreeNodeAttributes> attributesLeaf = new
Attributes<TreeNodeAttributes>(jq("span[id$=treeNode3Attributes:panel]"));
TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
TreeNodeModel treeNode = tree.getNode(1);
@@ -112,7 +114,7 @@
public void testHandleClass() {
assertEquals(selenium.getCount(not(tree.getAnyNode().getHandle(),
JQ_SAMPLE_CLASS)), 4);
- attributes.setHandleClass(SAMPLE_CLASS);
+ attributes.set(handleClass, SAMPLE_CLASS);
assertEquals(selenium.getCount(append(tree.getAnyNode().getHandle(),
JQ_SAMPLE_CLASS)), 0);
assertEquals(selenium.getCount(not(tree.getAnyNode().getHandle(),
JQ_SAMPLE_CLASS)), 4);
@@ -122,7 +124,7 @@
public void testIconClass() {
assertEquals(selenium.getCount(not(tree.getAnyNode().getIcon(),
JQ_SAMPLE_CLASS)), 4);
- attributes.setIconClass(SAMPLE_CLASS);
+ attributes.set(iconClass, SAMPLE_CLASS);
assertEquals(selenium.getCount(append(tree.getAnyNode().getIcon(),
JQ_SAMPLE_CLASS)), 0);
assertEquals(selenium.getCount(not(tree.getAnyNode().getIcon(),
JQ_SAMPLE_CLASS)), 4);
@@ -133,7 +135,7 @@
assertTrue(selenium.isElementPresent(iconImage));
assertFalse(selenium.isAttributePresent(imageSrc));
- attributes.setIconCollapsed(IMAGE_URL);
+ attributes.set(iconCollapsed, IMAGE_URL);
assertTrue(selenium.isElementPresent(iconImage));
assertTrue(selenium.isAttributePresent(imageSrc));
@@ -147,7 +149,7 @@
assertTrue(selenium.isElementPresent(iconImage));
assertFalse(selenium.isAttributePresent(imageSrc));
- attributes.setIconExpanded(IMAGE_URL);
+ attributes.set(iconExpanded, IMAGE_URL);
assertTrue(selenium.isElementPresent(iconImage));
assertFalse(selenium.isAttributePresent(imageSrc));
@@ -172,7 +174,7 @@
assertTrue(selenium.isElementPresent(leafIcon));
assertFalse(selenium.isAttributePresent(leafIconImageSrc));
- attributesLeaf.setIconLeaf(IMAGE_URL);
+ attributesLeaf.set(iconLeaf, IMAGE_URL);
assertTrue(selenium.isElementPresent(leafIcon));
assertTrue(selenium.isAttributePresent(leafIconImageSrc));
@@ -185,14 +187,14 @@
@Use(field = "toggleType", value = "toggleTypes")
public void testImmediate() {
tree.setToggleType(toggleType);
- attributesTree.setToggleType(toggleType);
+ attributesTree.set(TreeAttributes.toggleType, toggleType);
treeNode.expand();
phaseInfo.assertPhases(PhaseId.ANY_PHASE);
phaseInfo.assertListener(PhaseId.PROCESS_VALIDATIONS, "tree toggle listener
invoked");
- attributes.setImmediate(true);
+ attributes.set(immediate, true);
treeNode.expand();
@@ -204,7 +206,7 @@
public void testLabelClass() {
assertEquals(selenium.getCount(not(tree.getAnyNode().getLabel(),
JQ_SAMPLE_CLASS)), 4);
- attributes.setLabelClass(SAMPLE_CLASS);
+ attributes.set(labelClass, SAMPLE_CLASS);
assertEquals(selenium.getCount(append(tree.getAnyNode().getLabel(),
JQ_SAMPLE_CLASS)), 0);
assertEquals(selenium.getCount(not(tree.getAnyNode().getLabel(),
JQ_SAMPLE_CLASS)), 4);
@@ -214,7 +216,7 @@
public void testLang() {
assertEquals(selenium.getCount(not(tree.getAnyNode(), "[lang=cs]")),
4);
- attributes.setLang("cs");
+ attributes.set(lang, "cs");
assertEquals(selenium.getCount(append(tree.getAnyNode(), "[lang=cs]")),
0);
assertEquals(selenium.getCount(not(tree.getAnyNode(), "[lang=cs]")),
4);
@@ -251,7 +253,7 @@
assertTrue(selenium.isElementPresent(leaf));
- attributesLeaf.setRendered(false);
+ attributesLeaf.set(rendered, false);
assertFalse(selenium.isElementPresent(leaf));
assertTrue(selenium.isElementPresent(subTreeNode));
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TreeNodeAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TreeNodeAttributes.java 2011-09-23
13:30:37 UTC (rev 22752)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeNode/TreeNodeAttributes.java 2011-09-23
13:31:18 UTC (rev 22753)
@@ -21,80 +21,28 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richTreeNode;
-import org.jboss.test.selenium.locator.ExtendedLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-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 TreeNodeAttributes extends AbstractComponentAttributes {
+public enum TreeNodeAttributes implements AttributeEnum {
- public TreeNodeAttributes() {
- }
-
- public <T extends ExtendedLocator<JQueryLocator>> TreeNodeAttributes(T
root) {
- super(root);
- }
-
- public void setDir(String dir) {
- setProperty("dir", dir);
- }
-
- public void setHandleClass(String handleClass) {
- setProperty("handleClass", handleClass);
- }
-
- public void setIconClass(String iconClass) {
- setProperty("iconClass", iconClass);
- }
-
- public void setIconCollapsed(String iconCollapsed) {
- setProperty("iconCollapsed", iconCollapsed);
- }
-
- public void setIconExpanded(String iconExpanded) {
- setProperty("iconExpanded", iconExpanded);
- }
-
- public void setIconLeaf(String iconLeaf) {
- setProperty("iconLeaf", iconLeaf);
- }
-
- public void setImmediate(Boolean immediate) {
- setProperty("immediate", immediate);
- }
-
- public void setLabelClass(String labelClass) {
- setProperty("labelClass", labelClass);
- }
-
- public void setLang(String lang) {
- setProperty("lang", lang);
- }
-
- public void setOnbeforetoggle(String onbeforetoggle) {
- setProperty("onbeforetoggle", onbeforetoggle);
- }
-
- public void setOntoggle(String ontoggle) {
- setProperty("ontoggle", ontoggle);
- }
-
- public void setRendered(Boolean rendered) {
- setProperty("rendered", rendered);
- }
-
- public void setStyle(String style) {
- setProperty("style", style);
- }
-
- public void setStyleClass(String styleClass) {
- setProperty("styleClass", styleClass);
- }
-
- public void setTitle(String title) {
- setProperty("title", title);
- }
+ dir,
+ handleClass,
+ iconClass,
+ iconCollapsed,
+ iconExpanded,
+ iconLeaf,
+ immediate,
+ labelClass,
+ lang,
+ onbeforetoggle,
+ ontoggle,
+ rendered,
+ style,
+ styleClass,
+ title,
+
}