Author: konstantin.mishin
Date: 2009-01-12 12:20:38 -0500 (Mon, 12 Jan 2009)
New Revision: 12227
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeNodesAdaptorTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/treeNodesAdaptor.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeNodesAdaptorTest.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
Log:
RF-5581
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeNodesAdaptorTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeNodesAdaptorTestBean.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeNodesAdaptorTestBean.java 2009-01-12
17:20:38 UTC (rev 12227)
@@ -0,0 +1,23 @@
+package org.ajax4jsf.bean.tree;
+
+public class TreeNodesAdaptorTestBean {
+
+ private String[] nodes = {"1", "2", "3"};
+ private String[] roots = {"A", "B", "C"};
+
+ public void setNodes(String[] nodes) {
+ this.nodes = nodes;
+ }
+
+ public String[] getNodes() {
+ return nodes;
+ }
+
+ public void setRoots(String[] roots) {
+ this.roots = roots;
+ }
+
+ public String[] getRoots() {
+ return roots;
+ }
+}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-01-12
16:37:26 UTC (rev 12226)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-01-12
17:20:38 UTC (rev 12227)
@@ -293,6 +293,11 @@
<managed-bean-class>org.ajax4jsf.bean.tree.TreeTestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>treeNodesAdaptor</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.tree.TreeNodesAdaptorTestBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
<managed-bean>
<managed-bean-name>effectBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.EffectBean</managed-bean-class>
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/treeNodesAdaptor.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/treeNodesAdaptor.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/treeNodesAdaptor/treeNodesAdaptor.xhtml 2009-01-12
17:20:38 UTC (rev 12227)
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="mainForm">
+ <rich:tree id="tree">
+ <rich:treeNodesAdaptor nodes="#{treeNodesAdaptor.roots}"
var="root">
+ <rich:treeNode>
+ <h:outputText value="#{root}"></h:outputText>
+ </rich:treeNode>
+ <rich:treeNodesAdaptor nodes="#{treeNodesAdaptor.nodes}"
var="node">
+ <rich:treeNode>
+ <h:outputText value="#{root}#{node}"></h:outputText>
+ </rich:treeNode>
+ </rich:treeNodesAdaptor>
+ </rich:treeNodesAdaptor>
+ </rich:tree>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeNodesAdaptorTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeNodesAdaptorTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeNodesAdaptorTest.java 2009-01-12
17:20:38 UTC (rev 12227)
@@ -0,0 +1,66 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+public class TreeNodesAdaptorTest extends SeleniumTestBase {
+
+ private String[] nodes = {"1", "2", "3"};
+ private String[] roots = {"A", "B", "C"};
+
+ private String tree;
+
+ private void init(Template template) {
+ renderPage(template);
+ String mainForm = getParentId() + "mainForm";
+ tree = mainForm + ":tree";
+ }
+
+ /**
+ * component builds right tree structure: data is fetched from nodes collection
+ * and assigned to var variable
+ */
+ @Test
+ public void testTreeStructure(Template template) {
+ init(template);
+ String locator = "xpath=id('"+ tree + "')/div";
+ for (int i = 0; i < roots.length; i++) {
+ String rootLocator = locator + "/table[" + (i + 1) +
"]/tbody/tr";
+ Assert.assertEquals(selenium.getText(rootLocator), roots[i]);
+ clickAjaxCommandAndWait(rootLocator + "/td[1]/div/a");
+ String nodesLocator = locator + "/div[" + (i + 1) + "]";
+ for (int j = 0; j < nodes.length; j++) {
+ Assert.assertEquals(selenium.getText(nodesLocator + "/table[" + (j + 1) +
"]/tbody/tr"), roots[i] + nodes[j]);
+ }
+ }
+ }
+
+ @Override
+ public String getTestUrl() {
+ return "pages/treeNodesAdaptor/treeNodesAdaptor.xhtml";
+ }
+
+}