Author: mvitenkov
Date: 2009-06-09 12:31:39 -0400 (Tue, 09 Jun 2009)
New Revision: 14573
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/Dir.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/Package.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/TTreeRNA.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf7323/
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf7323/Test.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf7323.xhtml
Log:
+RF-7323 selenium test
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/Dir.java
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/Dir.java
(rev 0)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/Dir.java 2009-06-09
16:31:39 UTC (rev 14573)
@@ -0,0 +1,68 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.regressionarea.issues.rf7323;
+
+import java.util.ArrayList;
+
+/**
+ * @author Mikhail Vitenkov
+ * @since 3.3.2
+ */
+public class Dir {
+ private String name;
+ private ArrayList<Package> packages;
+ private ArrayList<Dir> dirs;
+
+ public Dir(String name, ArrayList<Package> packages) {
+ this.name = name;
+ this.packages = packages;
+ }
+
+ public Dir(String name, ArrayList<Package> packages, ArrayList<Dir> dirs) {
+ this.name = name;
+ this.packages = packages;
+ this.dirs = dirs;
+ }
+
+ public ArrayList<Dir> getDirs() {
+ return dirs;
+ }
+
+ public void setDirs(ArrayList<Dir> dirs) {
+ this.dirs = dirs;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ArrayList<Package> getPackages() {
+ return packages;
+ }
+
+ public void setPackages(ArrayList<Package> packages) {
+ this.packages = packages;
+ }
+}
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/Package.java
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/Package.java
(rev 0)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/Package.java 2009-06-09
16:31:39 UTC (rev 14573)
@@ -0,0 +1,41 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.regressionarea.issues.rf7323;
+
+/**
+ * @author Mikhail Vitenkov
+ * @since 3.3.2
+ */
+public class Package {
+ private String name;
+
+ public Package(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/TTreeRNA.java
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/TTreeRNA.java
(rev 0)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf7323/TTreeRNA.java 2009-06-09
16:31:39 UTC (rev 14573)
@@ -0,0 +1,102 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.regressionarea.issues.rf7323;
+
+import java.util.ArrayList;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.richfaces.event.NodeSelectedEvent;
+
+/**
+ * @author Mikhail Vitenkov
+ * @since 3.3.2
+ */
+@Name("rf7323")
+(a)Scope(ScopeType.SESSION)
+public class TTreeRNA {
+ private ArrayList<Dir> treeRNAroots;
+ private String recursionOrder;
+ private String selectedNode;
+
+ public String getSelectedNode() {
+ return selectedNode;
+ }
+
+ public void setSelectedNode(String selectedNode) {
+ this.selectedNode = selectedNode;
+ }
+
+ public TTreeRNA() {
+ recursionOrder = "first";
+ selectedNode = "";
+
+ treeRNAroots = new ArrayList<Dir>();
+ ArrayList<Dir> dirsArr = new ArrayList<Dir>();
+ ArrayList<Dir> subDirsArr = new ArrayList<Dir>();
+ ArrayList<Package> packArr = new ArrayList<Package>();
+ ArrayList<Package> subPackArr = new ArrayList<Package>();
+
+ treeRNAroots.clear();
+ dirsArr.clear();
+ for (int j = 0; j < 2; j++) {
+ packArr.clear();
+ subDirsArr.clear();
+ for (int k = 0; k < 3; k++) {
+ packArr.add(new Package("package #" + j + " " + k));
+ }
+ for (int f = 0; f < 2; f++) {
+ subPackArr.clear();
+ for (int l = 0; l < 3; l++) {
+ subPackArr.add(new Package("subPackage #" + j + " " + f
+ + " " + l));
+ }
+ subDirsArr.add(new Dir("subDir #" + j + " " + f,
+ new ArrayList<Package>(subPackArr)));
+ }
+ dirsArr.add(new Dir("dir #" + j, new ArrayList<Package>(packArr),
+ new ArrayList<Dir>(subDirsArr)));
+ }
+ treeRNAroots.add(new Dir("*** root ***", null, dirsArr));
+ }
+
+ public void nodeSelectListener(NodeSelectedEvent e) {
+
+ selectedNode = e.getSource().toString();
+ }
+
+ public String getRecursionOrder() {
+ return recursionOrder;
+ }
+
+ public void setRecursionOrder(String recursionOrder) {
+ this.recursionOrder = recursionOrder;
+ }
+
+ public ArrayList<Dir> getTreeRNAroots() {
+ return treeRNAroots;
+ }
+
+ public void setTreeRNAroots(ArrayList<Dir> treeRNAroots) {
+ this.treeRNAroots = treeRNAroots;
+ }
+}
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf7323/Test.java
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf7323/Test.java
(rev 0)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf7323/Test.java 2009-06-09
16:31:39 UTC (rev 14573)
@@ -0,0 +1,63 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.rf7323;
+
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+
+/**
+ * @author Mikhail Vitenkov
+ * @since 3.3.2
+ */
+public class Test extends SeleniumTestBase {
+ private static final String FORM = "form";
+ private static final String TREE_NODES = FORM +
":policyComponentsTreeBase:childs";
+ private static final String PANEL = FORM + ":policyComponentsSelectionPanel";
+
+ @org.testng.annotations.Test
+ public void testExecute() throws Exception {
+ renderPage();
+
+ selenium.click("//div[@id='"+TREE_NODES+"']/table/tbody/tr/td[1]/div/a");
+
+ //avoid mouse down node, before it became expanded(for switchType="client")
+ pause(1500,null);
+
+ selenium.mouseDown("//div[@id='"+TREE_NODES+"']/div/table[1]/tbody/tr/td[2]");
+ waitForAjaxCompletion();
+ String dir1 =
selenium.getText("//table[@id='"+PANEL+"']/tbody/tr/td");
+
+ Assert.assertEquals(dir1.contains("org.richfaces.component.html.HtmlTree"),
true);
+
+ selenium.mouseDown("//div[@id='"+TREE_NODES+"']/div/table[2]/tbody/tr/td[2]");
+ waitForAjaxCompletion();
+ String dir2 =
selenium.getText("//table[@id='"+PANEL+"']/tbody/tr/td");
+
+ Assert.assertEquals(dir2.contains("org.richfaces.component.html.HtmlTree"),
true);
+
+ Assert.assertEquals(dir1.equals(dir2), false);
+ }
+
+ public String getTestUrl() {
+ return "pages/rf7323.xhtml";
+ }
+
+}
\ No newline at end of file
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf7323.xhtml
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf7323.xhtml
(rev 0)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf7323.xhtml 2009-06-09
16:31:39 UTC (rev 14573)
@@ -0,0 +1,33 @@
+<!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:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+<ui:composition template="/layout/layout.xhtml">
+ <ui:define name="template">
+ <h:form id="form">
+ <rich:tree id="policyComponentsTreeBase" switchType="client"
+ ajaxSingle="true" ajaxSubmitSelection="true"
+ showConnectingLines="true"
+ nodeSelectListener="#{rf7323.nodeSelectListener}"
+ reRender="policyComponentsSelectionPanel"
+ process="policyComponentsSelectionPanel">
+ <a4j:actionparam name="sortField" value="" />
+ <rich:recursiveTreeNodesAdaptor id="productGroups"
+ roots="#{rf7323.treeRNAroots}" var="node"
nodes="#{node.dirs}">
+ <rich:treeNode>
+ <h:outputText value="#{node.name}" />
+ </rich:treeNode>
+ </rich:recursiveTreeNodesAdaptor>
+ </rich:tree>
+ <br />
+ <h:panelGrid columns="1" id="policyComponentsSelectionPanel"
border="1">
+ <h:outputText value="#{rf7323.selectedNode}" />
+ </h:panelGrid>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file