[richfaces-svn-commits] JBoss Rich Faces SVN: r12354 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/tree and 4 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Jan 20 13:19:06 EST 2009


Author: dsvyatobatsko
Date: 2009-01-20 13:19:06 -0500 (Tue, 20 Jan 2009)
New Revision: 12354

Added:
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/rich/
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/rich/dragAndDropTest.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/rich/treeAutoTest.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/rich/treeTest.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/dragAndDropTest.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/treeAutoTest.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/treeTest.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeRichModelTest.java
   trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeSwingModelTest.java
Removed:
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/dragAndDropTest.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml
Modified:
   trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
   trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
   trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
Log:
https://jira.jboss.org/jira/browse/RF-4826

Modified: 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	2009-01-20 18:12:56 UTC (rev 12353)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java	2009-01-20 18:19:06 UTC (rev 12354)
@@ -21,15 +21,9 @@
 package org.ajax4jsf.bean.tree;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Properties;
 
-import javax.faces.FacesException;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
 import org.ajax4jsf.bean.tree.rich.AudioLibrary;
 import org.apache.commons.digester.Digester;
 import org.apache.commons.digester.xmlrules.DigesterLoader;
@@ -37,15 +31,10 @@
 import org.richfaces.component.UITreeNode;
 import org.richfaces.component.state.TreeStateAdvisor;
 import org.richfaces.event.DropEvent;
-import org.richfaces.event.NodeSelectedEvent;
 import org.richfaces.model.TreeNode;
-import org.richfaces.model.TreeNodeImpl;
 import org.richfaces.model.TreeRowKey;
 import org.xml.sax.SAXException;
 
-/**
- * Copied from demo
- */
 public class TreeTestBean {
 
     private TreeNode<String> rootNode = null;
@@ -54,62 +43,6 @@
 
     private static final String DATA_PATH = "/simple-tree-data.properties";
 
-    public void processSelection(NodeSelectedEvent event) {
-        UITree tree = (UITree) event.getComponent();
-    }
-
-    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;
-    }
-
     private TreeNode<Object> richRootNode = null;
 
     public synchronized TreeNode<Object> getRichTreeNode() {
@@ -154,32 +87,6 @@
         return swingNodes;
     }
 
-    private boolean isRichModel = true;
-
-    /**
-     * Gets value of isRichModel field.
-     * @return value of isRichModel field
-     */
-    public boolean isRichModel() {
-        return isRichModel;
-    }
-
-    /**
-     * Set a new value for isRichModel field.
-     * @param isRichModel a new value for isRichModel field
-     */
-    public void setRichModel(boolean isRichModel) {
-        this.isRichModel = isRichModel;
-    }
-
-    public Object getRootNode() {
-        if(isRichModel) {
-            return getRichTreeNode();
-        } else {
-            return getSwingTreeNodes();
-        }
-    }
-
     public String getNodeTitle() {
         return nodeTitle;
     }
@@ -269,62 +176,48 @@
         setToggleOnClick(true);
         setSwitchType("server");
         setAjaxSubmitSelection(false);
-        setRichModel(true);
     }
 
     public void initToggleOnClickTestAjaxMode() {
         setToggleOnClick(true);
         setSwitchType("ajax");
         setAjaxSubmitSelection(false);
-        setRichModel(true);
     }
 
     public void initToggleOnClickTestClientMode() {
         setToggleOnClick(true);
         setSwitchType("client");
         setAjaxSubmitSelection(false);
-        setRichModel(true);
     }
+
     public void initAjaxSubmitSelectionTest() {
         setSwitchType("client");
         setAjaxSubmitSelection(true);
         setToggleOnClick(false);
-        setRichModel(true);
     }
 
     public void initAjaxCoreTest() {
         setSwitchType("ajax");
         setToggleOnClick(false);
         setAjaxSubmitSelection(true);
-        setRichModel(true);
     }
 
-    public void initAjaxCoreTestWithSwingModel() {
-        setSwitchType("ajax");
-        setToggleOnClick(false);
-        setAjaxSubmitSelection(true);
-        setRichModel(false);
-    }
-
     public void initServerMode() {
         setSwitchType("server");
         setToggleOnClick(false);
         setAjaxSubmitSelection(false);
-        setRichModel(true);
     }
 
     public void initAjaxMode() {
         setSwitchType("ajax");
         setToggleOnClick(false);
         setAjaxSubmitSelection(false);
-        setRichModel(true);
     }
 
     public void initClientMode() {
         setSwitchType("client");
         setToggleOnClick(false);
         setAjaxSubmitSelection(false);
-        setRichModel(true);
     }
 
     public void initDragAndDropTest() {
@@ -337,7 +230,6 @@
         setSwitchType("ajax");
         setToggleOnClick(false);
         setAjaxSubmitSelection(false);
-        setRichModel(true);
     }
 
     private TreeStateAdvisor advisor;

Deleted: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/dragAndDropTest.xhtml
===================================================================
(Binary files differ)

Copied: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/rich/dragAndDropTest.xhtml (from rev 12350, trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/dragAndDropTest.xhtml)
===================================================================
(Binary files differ)

Copied: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/rich/treeAutoTest.xhtml (from rev 12350, trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml)
===================================================================
(Binary files differ)

Copied: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/rich/treeTest.xhtml (from rev 12350, trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml)
===================================================================
(Binary files differ)

Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/dragAndDropTest.xhtml
===================================================================
(Binary files differ)


Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/dragAndDropTest.xhtml
___________________________________________________________________
Name: svn:mime-type
   + application/xhtml+xml

Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/treeAutoTest.xhtml
===================================================================
(Binary files differ)


Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/treeAutoTest.xhtml
___________________________________________________________________
Name: svn:mime-type
   + application/xhtml+xml

Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/treeTest.xhtml
===================================================================
(Binary files differ)


Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/swing/treeTest.xhtml
___________________________________________________________________
Name: svn:mime-type
   + application/xhtml+xml

Deleted: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
===================================================================
(Binary files differ)

Deleted: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeTest.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java	2009-01-20 18:12:56 UTC (rev 12353)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java	2009-01-20 18:19:06 UTC (rev 12354)
@@ -298,8 +298,8 @@
         runScript("loadTemplate('" + template + "', '" + resetMethodName + "');", false);
         waitForPageToLoad();
 
-        
-        selenium.open(protocol + "://" + host + ":" + port + "/" + APPLICATION_NAME + filterPrefix + postfix);
+        String base = getTestBase();
+        selenium.open(protocol + "://" + host + ":" + port + "/" + APPLICATION_NAME + filterPrefix + (null != base ? base : "") + postfix);
         selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
 
 //        setParentId(template.getPrefix());
@@ -325,9 +325,10 @@
     protected void renderAutoTestPage(Template template, String resetMethodName) {
        renderAutoTestPage(null, template, resetMethodName);
     }
-    
+
     protected void renderAutoTestPage(String url, Template template, String resetMethodName) {
-        selenium.open(protocol + "://" + host + ":" + port + "/" + APPLICATION_NAME + filterPrefix + (url != null ? url : getAutoTestUrl()));
+        String base = getTestBase();
+        selenium.open(protocol + "://" + host + ":" + port + "/" + APPLICATION_NAME + filterPrefix + (null != base ? base : "") + (url != null ? url : getAutoTestUrl()));
         selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
 
         setParentId(template.getPrefix());
@@ -1196,7 +1197,11 @@
     public String getAutoTestUrl() {
     	return null;
     }
-    
+
+    public String getTestBase() {
+        return null;
+    }
+
     /**
      * Control action that should force ajax request from the component.
      * This method should wait for ajax completion

Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeRichModelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeRichModelTest.java	                        (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeRichModelTest.java	2009-01-20 18:19:06 UTC (rev 12354)
@@ -0,0 +1,13 @@
+package org.richfaces.testng;
+
+/**
+ * Put richfaces model specific tests  here.
+ */
+public class TreeRichModelTest extends TreeTest {
+
+    @Override
+    public String getTestBase() {
+        return "pages/tree/rich/";
+    }
+
+}


Property changes on: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeRichModelTest.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/test/java/org/richfaces/testng/TreeSwingModelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeSwingModelTest.java	                        (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeSwingModelTest.java	2009-01-20 18:19:06 UTC (rev 12354)
@@ -0,0 +1,13 @@
+package org.richfaces.testng;
+
+/**
+ * Put swing model specific tests here.
+ */
+public class TreeSwingModelTest extends TreeTest {
+
+    @Override
+    public String getTestBase() {
+        return "pages/tree/swing/";
+    }
+
+}


Property changes on: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeSwingModelTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Author Id Revision Date
Name: svn:eol-style
   + native

Modified: 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	2009-01-20 18:12:56 UTC (rev 12353)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java	2009-01-20 18:19:06 UTC (rev 12354)
@@ -32,14 +32,13 @@
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class TreeTest extends SeleniumTestBase {
+public abstract class TreeTest extends SeleniumTestBase {
 
     private static Map<String, String> params = new HashMap<String, String>();
     private final static String INIT_TOGGLE_ON_CLICK_SERVER_MODE = "#{treeBean.initToggleOnClickTestServerMode}";
     private final static String INIT_TOGGLE_ON_CLICK_AJAX_MODE = "#{treeBean.initToggleOnClickTestAjaxMode}";
     private final static String INIT_TOGGLE_ON_CLICK_CLIENT_MODE = "#{treeBean.initToggleOnClickTestClientMode}";
     private final static String INIT_AJAX_CORE_TEST = "#{treeBean.initAjaxCoreTest}";
-    private final static String INIT_AJAX_CORE_TEST_WITH_SWING_MODEL = "#{treeBean.initAjaxCoreTestWithSwingModel}";
     private final static String INIT_AJAX_SUBMIT_SELECTION = "#{treeBean.initAjaxSubmitSelectionTest}";
     private final static String INIT_SERVER_MODE = "#{treeBean.initServerMode}";
     private final static String INIT_AJAX_MODE = "#{treeBean.initAjaxMode}";
@@ -48,7 +47,7 @@
     private final static String INIT_KEYBOARD_NAVIGATION_TEST = "#{treeBean.initKeyboardNavigationTest}";
     private final static String TEAR_DOWN_METHOD = "#{treeBean.tearDown}";
     private final static String INIT_DRAG_AND_DROP_TEST = "#{treeBean.initDragAndDropTest}";
-    private final static String DRAG_AND_DROP_TEST_URL = "pages/tree/dragAndDropTest.xhtml";
+    private final static String DRAG_AND_DROP_TEST_URL = "dragAndDropTest.xhtml";
 
     static final Map<String, String> styles = new HashMap<String, String>();
 
@@ -167,101 +166,7 @@
         tester.checkNodeSelectedListener(true);
     }
 
-//
-// Swing model
-//
-
     @Test
-    public void testAjaxSingleWithSwingModel(Template template) {
-        AutoTester tester = getAutoTester(this);
-        tester.renderPage(template, INIT_AJAX_CORE_TEST_WITH_SWING_MODEL);
-        tester.reset();
-        tester.setupControl(TestSetupEntry.ajaxSingle, Boolean.TRUE);
-        tester.clickLoad();
-        writeStatus("Navigate to the first child");
-        String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
-        clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td/div/a");
-        writeStatus("Check node expanded events are delivered");
-        tester.checkNodeExpandedListener(true);
-        clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td/div/a");
-        type("//*[@id='"+ compId + ":childs']/div/div/table[1]/tbody/tr/td[3]/input", "New");
-        tester.setExtrenalValidationFailed();
-        tester.startTracing();
-        writeStatus("Test ajaxSingle attribute");
-        clickTreeNodeAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td[3]");
-        tester.checkUpdateModel(false);
-        tester.checkNodeSelectedListener(true);
-    }
-
-    @Test
-    public void testAjaxSingleWithInternalValidationFailedWithSwingModel(Template template) {
-        AutoTester tester = getAutoTester(this);
-        tester.renderPage(template, INIT_AJAX_CORE_TEST_WITH_SWING_MODEL);
-        tester.reset();
-        tester.setupControl(TestSetupEntry.ajaxSingle, Boolean.TRUE);
-        tester.clickLoad();
-        writeStatus("Navigate to the first child");
-        String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
-        clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td/div/a");
-        writeStatus("Check node expanded events are delivered");
-        tester.checkNodeExpandedListener(true);
-        clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td/div/a");
-        writeStatus("Set a new invalid value for the child");
-        type("//*[@id='"+ compId + ":childs']/div/div/table[1]/tbody/tr/td[3]/input", "");
-        tester.startTracing();
-        writeStatus("Test ajaxSingle attribute in case of invalid component state");
-        clickTreeNodeAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td[3]");
-        tester.checkUpdateModel(false);
-        tester.checkNodeSelectedListener(false);
-    }
-
-    @Test
-    public void testImmediateWithSwingModel(Template template) {
-        AutoTester tester = getAutoTester(this);
-        tester.renderPage(template, INIT_AJAX_CORE_TEST_WITH_SWING_MODEL);
-        tester.reset();
-        tester.setupControl(TestSetupEntry.immediate, Boolean.TRUE);
-        tester.clickLoad();
-        writeStatus("Navigate to the first child");
-        String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
-        clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td/div/a");
-        writeStatus("Check node expanded events are delivered");
-        tester.checkNodeExpandedListener(true);
-        clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td/div/a");
-        writeStatus("Set a new value for the child");
-        type("//*[@id='"+ compId + ":childs']/div/div/table[1]/tbody/tr/td[3]/input", "New");
-        tester.startTracing();
-        writeStatus("Test immediate attribute");
-        clickTreeNodeAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td[3]");
-        tester.checkUpdateModel(true);
-        tester.checkNodeSelectedListener(true);
-    }
-
-    @Test
-    public void testImmediateWithExternalValidationFailedWithSwingModel(Template template) {
-        AutoTester tester = getAutoTester(this);
-        tester.renderPage(template, INIT_AJAX_CORE_TEST_WITH_SWING_MODEL);
-        tester.reset();
-        tester.setupControl(TestSetupEntry.immediate, Boolean.TRUE);
-        tester.clickLoad();
-        writeStatus("Navigate to the first child");
-        String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
-        clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td/div/a");
-        writeStatus("Check node expanded events are delivered");
-        tester.checkNodeExpandedListener(true);
-        clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td/div/a");
-        writeStatus("set a new value for the child");
-        type("//*[@id='"+ compId + ":childs']/div/div/table[1]/tbody/tr/td[3]/input", "New");
-        writeStatus("Set external validation to fail");
-        tester.setExtrenalValidationFailed();
-        tester.startTracing();
-        writeStatus("Test immediate attribute with external validation failed");
-        clickTreeNodeAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td[3]");
-        tester.checkUpdateModel(false);
-        tester.checkNodeSelectedListener(true);
-    }
-
-    @Test
     public void testToggleOnClickTrueWithServerMode(Template template) {
         AutoTester tester = getAutoTester(this);
         tester.renderPage(template, INIT_TOGGLE_ON_CLICK_SERVER_MODE);
@@ -667,12 +572,12 @@
 
     @Override
     public String getTestUrl() {
-        return "pages/tree/treeTest.xhtml";
+        return "treeTest.xhtml";
     }
 
     @Override
     public String getAutoTestUrl() {
-        return "pages/tree/treeAutoTest.xhtml";
+        return "treeAutoTest.xhtml";
     }
 
     private void clickTreeNode(String locator){




More information about the richfaces-svn-commits mailing list