Author: nbelaevski
Date: 2009-05-22 18:37:17 -0400 (Fri, 22 May 2009)
New Revision: 14287
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5773/
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5773/Bean.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5773/Item.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5773/
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5773/Test.java
branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5773.xhtml
Modified:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml
Log:
https://jira.jboss.org/jira/browse/RF-5773
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5773/Bean.java
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5773/Bean.java
(rev 0)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5773/Bean.java 2009-05-22
22:37:17 UTC (rev 14287)
@@ -0,0 +1,57 @@
+/**
+ * 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.rf5773;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+/**
+ * This test case for: <a
href="https://jira.jboss.org/jira/browse/RF-5773">RF-5773 -
+ * Forms not working within DataTable</a>
+ *
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+
+@Name("rf5773")
+(a)Scope(ScopeType.SESSION)
+public class Bean {
+
+ private List<Item> items;
+
+ public Bean() {
+ items = new ArrayList<Item>();
+ for (int i = 0; i < 3; i++) {
+ items.add(new Item("Item " + i));
+ }
+ }
+
+ public List<Item> getItems() {
+ return items;
+ }
+
+}
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5773/Item.java
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5773/Item.java
(rev 0)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-ejb/src/main/java/org/richfaces/regressionarea/issues/rf5773/Item.java 2009-05-22
22:37:17 UTC (rev 14287)
@@ -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.regressionarea.issues.rf5773;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+public class Item {
+
+ private String value;
+
+ private int counter = 0;
+
+ public Item(String value) {
+ super();
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void incCounter() {
+ counter++;
+ }
+
+ public void validate(FacesContext context, UIComponent component, Object value) {
+ String messageText = value.toString();
+ context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, messageText,
messageText));
+ }
+
+ public int getCounter() {
+ return counter;
+ }
+}
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5773/Test.java
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5773/Test.java
(rev 0)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5773/Test.java 2009-05-22
22:37:17 UTC (rev 14287)
@@ -0,0 +1,81 @@
+/**
+ * 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.rf5773;
+
+import junit.framework.Assert;
+
+import org.richfaces.SeleniumTestBase;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.2
+ */
+public class Test extends SeleniumTestBase {
+
+ private void checkStep(String[] text, int[] counter) {
+ for (int i = 0; i < text.length; i++) {
+ String s = getTextById("outputRepeat:" + i + ":valuePanel");
+
+ Assert.assertEquals(
+ String.format("Value check failed for step: [%d]; expected '%s' was
'%s'", i, text[i], s),
+ text[i], s);
+ }
+
+ for (int i = 0; i < counter.length; i++) {
+ String s = getTextById("outputRepeat:" + i + ":counterPanel");
+ Assert.assertEquals(
+ String.format("Counter check failed for step: [%d]; expected '%s' was
'%s'", i, counter[i], s),
+ String.valueOf(counter[i]), s);
+ }
+ }
+
+ @org.testng.annotations.Test
+ public void testExecute() throws Exception {
+ renderPage();
+
+ String[] text = {"Item 0", "Item 1", "Item 2"};
+ int[] counter = new int[text.length];
+
+ //check initial setup
+ checkStep(text, counter);
+ AssertTextEquals("messages", "");
+ //initial setup ok
+
+ for (int i = 0; i < text.length; i++) {
+ text[i] = "Val:" + String.valueOf(i) ;
+ counter[i]++;
+ type("formsRepeat:" + i + ":form:input", text[i]);
+ clickAjaxCommandAndWait("formsRepeat:" + i + ":form:link");
+
+ checkStep(text, counter);
+ AssertTextEquals("messages", text[i]);
+ }
+
+ }
+
+
+ @Override
+ public String getTestUrl() {
+ return "pages/rf5773.xhtml";
+ }
+}
Modified:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml 2009-05-22
16:36:40 UTC (rev 14286)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml 2009-05-22
22:37:17 UTC (rev 14287)
@@ -31,6 +31,7 @@
<package name="org.richfaces.testng.rf6035" />
<package name="org.richfaces.testng.rf6267" />
<package name="org.richfaces.testng.rf6547" />
+ <package name="org.richfaces.testng.rf5773" />
</packages>
</test>
</suite>
Added:
branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5773.xhtml
===================================================================
---
branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5773.xhtml
(rev 0)
+++
branches/community/3.3.X/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5773.xhtml 2009-05-22
22:37:17 UTC (rev 14287)
@@ -0,0 +1,36 @@
+<!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">
+ <a4j:repeat value="#{rf5773.items}" var="item"
id="formsRepeat">
+ <a4j:form id="form">
+ <h:inputText value="#{item.value}" id="input"
validator="#{item.validate}" />
+ <a4j:commandLink action="#{item.incCounter}" value="link"
id="link"/>
+ </a4j:form>
+ </a4j:repeat>
+
+ <rich:messages id="messages" />
+
+ <a4j:outputPanel ajaxRendered="true">
+ <a4j:repeat value="#{rf5773.items}" var="item"
id="outputRepeat">
+ <a4j:outputPanel id="valuePanel">
+ #{item.value}
+ </a4j:outputPanel>
+ <h:outputText value=" - " />
+ <a4j:outputPanel id="counterPanel">
+ #{item.counter}
+ </a4j:outputPanel>
+ <br />
+ </a4j:repeat>
+ </a4j:outputPanel>
+
+ </ui:define>
+</ui:composition>
+</html>