Author: dsvyatobatsko
Date: 2008-11-05 13:04:06 -0500 (Wed, 05 Nov 2008)
New Revision: 11034
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/resources/simple-tree-data.properties
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
Log:
tree tests
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2008-11-05
18:04:06 UTC (rev 11034)
@@ -0,0 +1,106 @@
+/**
+ * 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.ajax4jsf.bean.tree;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import javax.faces.FacesException;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.model.TreeNode;
+import org.richfaces.model.TreeNodeImpl;
+
+/**
+ * Copied from demo
+ */
+public class TreeTestBean {
+
+ private TreeNode<String> rootNode = null;
+
+ private String nodeTitle;
+
+ private static final String DATA_PATH = "/simple-tree-data.properties";
+
+ private void addNodes(String path, TreeNode<String> node, Properties
properties) {
+ boolean end = false;
+ int counter = 1;
+
+ while (!end) {
+ String key = path != null ? path + '.' + counter :
String.valueOf(counter);
+
+ String value = properties.getProperty(key);
+ if (value != null) {
+ TreeNode<String> nodeImpl = new TreeNodeImpl<String>();
+ nodeImpl.setData(value);
+ node.addChild(new Integer(counter), nodeImpl);
+ addNodes(key, nodeImpl, properties);
+ counter++;
+ } else {
+ end = true;
+ }
+ }
+ }
+
+ private void loadTree() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ InputStream dataStream =
this.getClass().getClassLoader().getResourceAsStream(DATA_PATH);
+ try {
+ Properties properties = new Properties();
+ properties.load(dataStream);
+
+ rootNode = new TreeNodeImpl<String>();
+ addNodes(null, rootNode, properties);
+
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ if (dataStream != null) {
+ try {
+ dataStream.close();
+ } catch (IOException e) {
+ externalContext.log(e.getMessage(), e);
+ }
+ }
+ }
+ }
+
+ public TreeNode<String> getTreeNode() {
+ if (rootNode == null) {
+ loadTree();
+ }
+
+ return rootNode;
+ }
+
+ public String getNodeTitle() {
+ return nodeTitle;
+ }
+
+ public void setNodeTitle(String nodeTitle) {
+ this.nodeTitle = nodeTitle;
+ }
+
+}
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/resources/simple-tree-data.properties
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/resources/simple-tree-data.properties
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/resources/simple-tree-data.properties 2008-11-05
18:04:06 UTC (rev 11034)
@@ -0,0 +1,66 @@
+1=Daniel Defo
+1.1=Robinson Crusoe
+1.1.1=Start In Life
+1.1.2=Slavery And Escape
+1.1.3=Wrecked On A Desert Island
+1.1.4=First Weeks On The Island
+1.1.5=Builds A House - The Journal
+1.1.6=Ill And Conscience-Stricken
+1.1.7=Agricultural Experience
+1.1.8=Surveys His Position
+1.1.9=A Boat
+1.1.10=Tames Goats
+1.1.11=Finds Print Of Man's Foot On The Sand
+1.1.12=A Cave Retreat
+1.1.13=Wreck Of A Spanish Ship
+1.1.14=A Dream Realised
+1.1.15=Friday's Education
+1.1.16=Rescue Of Prisoners From Cannibals
+1.1.17=Visit Of Mutineers
+1.1.18=The Ship Recovered
+1.1.19=Return To England
+1.1.20=Fight Between Friday And A Bear
+2=Edgar Allan Poe
+2.1=Plays
+2.1.1=Politian
+2.2=Short stories
+2.2.1=The Assignation
+2.2.2=Berenice
+2.2.3=The Black Cat
+2.2.4=The Cask of Amontillado
+2.2.5=A Descent into the Maelstrom
+2.3=Poetry
+2.3.1=Alone
+2.3.2=An Enigma
+2.3.3=Annabel Lee
+2.3.4=Bridal Ballad
+3=Henry Wadsworth Longfellow
+3.1=The Song of Hiawatha
+3.1.1=Introduction
+3.1.2=I. The Peace-Pipe
+3.1.3=II. The Four Winds
+3.1.4=III. Hiawatha's Childhood
+3.1.5=IV. Hiawatha and Mudjekeewis
+3.1.6=V. Hiawatha's Fasting
+3.1.7=VI. Hiawatha's Friends
+3.1.8=VII. Hiawatha's Sailing
+3.1.9=VIII. Hiawatha's Fishing
+3.1.10=IX. Hiawatha and the Pearl-Feather
+3.1.11=X. Hiawatha's Wooing
+3.1.12=XI. Hiawatha's Wedding-Feast
+3.1.13=XII. The Son of the Evening Star
+3.1.14=XIII. Blessing the Cornfields
+3.1.15=XIV. Picture-Writing
+3.1.16=XV. Hiawatha's Lamentation
+3.1.17=XVI. Pau-Puk-Keewis
+3.1.18=XVII. The Hunting of Pau-Puk-Keewis
+3.1.19=XVIII. The Death of Kwasind
+3.1.20=XIX. The Ghosts
+3.1.21=XX. The Famine
+3.1.22=XXI. The White Man's Foot
+3.1.23=XXII. Hiawatha's Departure
+3.2=Poetry
+3.2.1=A Psalm Of Life
+3.2.2=Birds Of Passage
+3.2.3=Hiawatha's Childhood
+3.2.4=Hymn To The Night
\ No newline at end of file
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/resources/simple-tree-data.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
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 2008-11-05
16:26:42 UTC (rev 11033)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2008-11-05
18:04:06 UTC (rev 11034)
@@ -260,6 +260,11 @@
<managed-bean-name>autoTestBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.autotest.bean.AutoTestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>treeBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.tree.TreeTestBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/ajaxInclude/step1.xhtml</from-view-id>
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Added:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-05
18:04:06 UTC (rev 11034)
@@ -0,0 +1,27 @@
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
+import org.richfaces.SeleniumTestBase;
+import org.testng.annotations.Test;
+
+public class TreeTest extends SeleniumTestBase {
+
+ @Test
+ public void testRenderedAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test component with rendered = false is not present on the
page");
+ tester.testRendered();
+ }
+
+ @Override
+ public String getTestUrl() {
+ return "pages/tree/treeTest.xhtml";
+ }
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/tree/treeAutoTest.xhtml";
+ }
+}
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Show replies by date