JBoss Rich Faces SVN: r15418 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/actionParameter and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-01 09:23:56 -0400 (Tue, 01 Sep 2009)
New Revision: 15418
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/actionParameter/ActionParameterTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/actionParameter/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/actionParameter/messages.properties
Log:
- ActionParameterTestCase - reformatted to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/actionParameter/ActionParameterTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/actionParameter/ActionParameterTestCase.java 2009-09-01 13:19:58 UTC (rev 15417)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/actionParameter/ActionParameterTestCase.java 2009-09-01 13:23:56 UTC (rev 15418)
@@ -1,12 +1,32 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This code 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 code 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 test suite; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.jboss.richfaces.integrationTest.actionParameter;
-import java.util.HashMap;
-import java.util.Map;
-
+import org.apache.commons.lang.StringUtils;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.waiting.Condition;
import org.jboss.test.selenium.waiting.Wait;
-import org.testng.Assert;
+import static org.testng.Assert.*;
+
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -15,94 +35,107 @@
*/
public class ActionParameterTestCase extends AbstractSeleniumRichfacesTestCase {
+ private final String LOC_OUTPUT_SELECTED_NAME_PREFORMATTED = getLoc("OUTPUT_SELECTED_NAME_PREFORMATTED");
+ private final String LOC_BUTTON_SELECTED_NAME_PREFORMATTED = getLoc("BUTTON_SELECTED_NAME_PREFORMATTED");
+ private final String LOC_LABEL_CHANGE_SKIN = getLoc("LABEL_CHANGE_SKIN");
+ private final String LOC_ANCHOR_SELECT_SKIN_RELATIVE = getLoc("ANCHOR_SELECT_SKIN_RELATIVE");
+ private final String LOC_BUTTON_SCREEN_SIZE = getLoc("BUTTON_SCREEN_SIZE");
+ private final String LOC_OUTPUT_SCREEN_WIDTH = formatLoc("OUTPUT_SCREEN_WIDTH", LOC_BUTTON_SCREEN_SIZE);
+ private final String LOC_OUTPUT_SCREEN_HEIGHT = formatLoc("OUTPUT_SCREEN_HEIGHT", LOC_BUTTON_SCREEN_SIZE);
+
+ private final String MSG_LABEL_SELECTED_NAME = getMsg("LABEL_SELECTED_NAME");
+ private final String MSG_PATTERN_SELECTED_NAME = getMsg("PATTERN_SELECTED_NAME");
+ private final String[] MSG_INPUT_GUYS_LIST = StringUtils.split(getMsg("INPUT_GUYS_LIST"), ',');
+ private final String[] MSG_RELATION_SKINS_COLORS = StringUtils.split(getMsg("RELATION_SKINS_COLORS"), '#');
+
/**
- * Opens specified page
+ * Gets initial selected name (check that it is only a label) and select
+ * each guy by pressing the button and waiting for output changes
*/
- private void openPage() {
- selenium.open(contextPath
- + "/richfaces/actionparam.jsf?c=actionparam&tab=usage");
- }
-
@Test
- public void selectingNames() {
- openPage();
+ public void testSelectingNames() {
+ final String locSelectedName = format(LOC_OUTPUT_SELECTED_NAME_PREFORMATTED, MSG_LABEL_SELECTED_NAME);
- String prefix = getMess("selected-name--prefix");
- final String selectedName = formatLoc("selected-name--text", prefix);
+ scrollIntoView(locSelectedName, true);
- Assert.assertEquals(prefix, selenium.getText(selectedName));
+ // get initial selected name (should be only label)
+ String selectedName = selenium.getText(locSelectedName);
- String[] guys = new String[] { getMess("first-guy"),
- getMess("second-guy") };
+ assertEquals(selectedName, MSG_LABEL_SELECTED_NAME, format(
+ "Initial selected name '{0}' doesn't match expected '{1}'", selectedName, MSG_LABEL_SELECTED_NAME));
- for (String guy : guys) {
- String button = formatLoc("selected-name--button", guy);
- final String expect = formatMess("selected-name--pattern", prefix,
- guy);
+ // for each guy press button and wait for output changes
+ for (String msgOutputGuy : MSG_INPUT_GUYS_LIST) {
+ final String locButton = format(LOC_BUTTON_SELECTED_NAME_PREFORMATTED, msgOutputGuy);
+ final String expected = format(MSG_PATTERN_SELECTED_NAME, MSG_LABEL_SELECTED_NAME, msgOutputGuy);
- selenium.click(button);
+ scrollIntoView(locButton, true);
- Wait.until(new Condition() {
+ selenium.click(locButton);
+
+ Wait.failWith(format("Selected name never changed to '{0}'", expected)).until(new Condition() {
public boolean isTrue() {
- return expect.equals(selenium.getText(selectedName));
+ return expected.equals(selenium.getText(locSelectedName));
}
});
}
}
+ /**
+ * Switching between skins and waiting for actual skin changes (detected by
+ * label's background color changes).
+ */
@Test
- @SuppressWarnings("serial")
- public void selectingSkin() {
- openPage();
+ public void testSelectingSkin() {
+ for (String relation : MSG_RELATION_SKINS_COLORS) {
+ final String[] msgSkinColor = StringUtils.split(relation, '|');
+ final String msgInputSkin = msgSkinColor[0];
+ final String msgOutputColor = msgSkinColor[1];
+ final String locAnchorSelectSkin = format(LOC_ANCHOR_SELECT_SKIN_RELATIVE, LOC_LABEL_CHANGE_SKIN, msgInputSkin);
+
+ scrollIntoView(locAnchorSelectSkin, false);
+
+ selenium.click(locAnchorSelectSkin);
- final String changeSkinLabel = getLoc("change-skin--label");
+ Wait.failWith(format("Color never changed to '{0}'", msgOutputColor)).until(new Condition() {
+ public boolean isTrue() {
+ String actualColor = getStyle(LOC_LABEL_CHANGE_SKIN, "background-color");
- Map<String, String> skins = new HashMap<String, String>() {
- {
- put(getMess("skin-1-name"), getMess("skin-1-color"));
- put(getMess("skin-2-name"), getMess("skin-2-color"));
- }
- };
-
- for (String skin : skins.keySet()) {
- final String expected = skins.get(skin);
-
- String skinAnchor = formatLoc("change-skin--link-relative",
- changeSkinLabel, skin);
-
- selenium.click(skinAnchor);
-
- Wait.until(new Condition() {
- public boolean isTrue() {
- String actual = getStyle(changeSkinLabel,
- "background-color");
- return expected.equals(actual);
+ return msgOutputColor.equals(actualColor);
}
});
}
}
+ /**
+ * Gets a expected width and height of the screen (by javascript evaluation)
+ * and try to evaluate it by click on the button. Wait for output values
+ * matches expected.
+ */
@Test
- public void showScreenSize() {
- openPage();
-
- String screenSizeButton = getLoc("screen-size--button");
-
- final String widthText = formatLoc("screen-size--width--text-relative",
- screenSizeButton);
- final String heightText = formatLoc(
- "screen-size--height--text-relative", screenSizeButton);
-
+ public void testShowScreenSize() {
final String expectedWidth = selenium.getEval("screen.width");
final String expectedHeight = selenium.getEval("screen.height");
+
+ scrollIntoView(LOC_BUTTON_SCREEN_SIZE, true);
- selenium.click(screenSizeButton);
+ selenium.click(LOC_BUTTON_SCREEN_SIZE);
+
+ Wait.failWith(format("Screen sizes never match expected value {0}x{1}", expectedWidth, expectedHeight)).until(
+ new Condition() {
+ public boolean isTrue() {
+ return expectedWidth.equals(selenium.getText(LOC_OUTPUT_SCREEN_WIDTH))
+ && expectedHeight.equals(selenium.getText(LOC_OUTPUT_SCREEN_HEIGHT));
+ }
+ });
+ }
- Wait.until(new Condition() {
- public boolean isTrue() {
- return expectedWidth.equals(selenium.getText(widthText))
- && expectedHeight.equals(selenium.getText(heightText));
- }
- });
+ /**
+ * Loads a specific component's page
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Action Parameter");
}
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/actionParameter/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/actionParameter/locators.properties 2009-09-01 13:19:58 UTC (rev 15417)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/actionParameter/locators.properties 2009-09-01 13:23:56 UTC (rev 15418)
@@ -1,7 +1,7 @@
-selected-name--text=//text()[starts-with(.,'{0}')]/..
-selected-name--button=//input[@type\='button' and @value\='Set Name to {0}']
-change-skin--label=//div[text()\='Change Demo Appplication Skin To\: ']
-change-skin--link-relative={0}/../div[2]/a[text()\='{1}']
-screen-size--button=//input[@type\='button' and @value\='Show Screen Size']
-screen-size--width--text-relative={0}/../div[1]//tr[1]/td[2]
-screen-size--height--text-relative={0}/../div[1]//tr[2]/td[2]
+OUTPUT_SELECTED_NAME_PREFORMATTED=//text()[starts-with(.,'{0}')]/..
+BUTTON_SELECTED_NAME_PREFORMATTED=//input[@type\='button' and @value\='Set Name to {0}']
+LABEL_CHANGE_SKIN=//div[text()\='Change Demo Appplication Skin To\: ']
+ANCHOR_SELECT_SKIN_RELATIVE={0}/../div[2]/a[text()\='{1}']
+BUTTON_SCREEN_SIZE=//input[@type\='button' and @value\='Show Screen Size']
+OUTPUT_SCREEN_WIDTH={0}/../div[1]//tr[1]/td[2]
+OUTPUT_SCREEN_HEIGHT={0}/../div[1]//tr[2]/td[2]
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/actionParameter/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/actionParameter/messages.properties 2009-09-01 13:19:58 UTC (rev 15417)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/actionParameter/messages.properties 2009-09-01 13:23:56 UTC (rev 15418)
@@ -1,8 +1,4 @@
-selected-name--prefix=Selected Name\:
-selected-name--pattern={0}{1}
-first-guy=Alex
-second-guy=John
-skin-1-name=DeepMarine
-skin-1-color=rgb(0, 136, 148)
-skin-2-name=BlueSky
-skin-2-color=rgb(190, 214, 248)
\ No newline at end of file
+LABEL_SELECTED_NAME=Selected Name\:
+PATTERN_SELECTED_NAME={0}{1}
+INPUT_GUYS_LIST=Alex,John
+RELATION_SKINS_COLORS=DeepMarine|rgb(0, 136, 148)\#BlueSky|rgb(190, 214, 248)
15 years, 4 months
JBoss Rich Faces SVN: r15417 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: ochikvina
Date: 2009-09-01 09:19:58 -0400 (Tue, 01 Sep 2009)
New Revision: 15417
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_columns.xml
Log:
https://jira.jboss.org/jira/browse/RF-7678 - the component description is updated;
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_columns.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_columns.xml 2009-09-01 13:17:52 UTC (rev 15416)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_columns.xml 2009-09-01 13:19:58 UTC (rev 15417)
@@ -67,7 +67,7 @@
<para> The <emphasis role="bold">
<property><rich:columns></property>
</emphasis> component gets a list from data model and outputs
- corresponding set of columns inside <emphasis role="bold">
+ a corresponding set of columns inside <emphasis role="bold">
<property><rich:dataTable></property>
</emphasis> on a page. It is possible to use <emphasis>
<property>"header"</property>
@@ -85,22 +85,23 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML">...
-<rich:dataTable value="#{capitalsBean.capitals}" var="cap">
- <rich:columns value="#{capitalsBean.labels}" var="col" index="index">
- <f:facet name="header">
- <h:outputText value="#{col.text}" />
- </f:facet>
- <h:outputText value="#{cap[index]}" />
- <f:facet name="footer">
- <h:outputText value="#{col.text}" />
- </f:facet>
- </rich:columns>
-</rich:dataTable>
-...</programlisting>
+ <programlisting role="XML"><![CDATA[...
+<rich:dataTable value="#{dataTableScrollerBean.model}" var="model" width="750">
+ <rich:columns value="#{dataTableScrollerBean.columns}" var="columns"
+ index="ind" id="column#{ind}">
+ <f:facet name="header">
+ <h:outputText value="#{columns.header}" />
+ </f:facet>
+
+ <h:outputText value="#{model[ind].model} " />
+ <h:outputText value="#{model[ind].mileage} miles " />
+ <h:outputText value="#{model[ind].price}$" />
+ </rich:columns>
+</rich:dataTable>
+...]]></programlisting>
<para> The <emphasis>
<property>"columns"</property>
- </emphasis> attribute defines the count of columns. </para>
+ </emphasis> attribute defines the count of columns.</para>
<para> The <emphasis>
<property>"rowspan"</property>
</emphasis> attribute defines the number of rows to be displayed. If
@@ -113,69 +114,20 @@
<para> The <emphasis>
<property>"end"</property>
</emphasis> attribute contains the last iteration item. </para>
- <para> With the help of the attributes described below you can customize the
+ <para> With the help of the attributes described above you can customize the
output, i.e. define which columns and how many rows appear on a page. </para>
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
- <programlisting role="XML">...
-<rich:dataTable value="#{capitalsBean.capitals}" var="cap">
- <rich:columns value="#{capitalsBean.labels}" var="col" index="index" rowspan="0" columns="3" begin="1" end="2">
- <f:facet name="header">
- <h:outputText value="#{col.text}" />
- </f:facet>
- <h:outputText value="#{cap[index]}" />
- </rich:columns>
-</rich:dataTable>
-...</programlisting>
- <para> In the example below, columns from first to second and all rows are shown
- in the <emphasis role="bold">
- <property><rich:dataTable></property>
- </emphasis> . </para>
- <para>The result is:</para>
- <figure>
- <title> Generated <emphasis role="bold">
- <property><rich:columns></property>
- </emphasis> with columns from first to second and all rows </title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/columns2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
+
<para> The <emphasis role="bold">
<property><rich:columns></property>
</emphasis> component does not prevent to use <emphasis role="bold">
<property><rich:column></property>
- </emphasis> . In the following example one column renders in any way
- and another columns could be picked from the model. </para>
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
+ </emphasis>. In the following example one column renders in any way
+ and another columns are picked from the model.</para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
<programlisting role="XML">...
-<rich:dataTable value="#{rowBean.rows}" var="row">
- <rich:column>
- <h:outputText value ="#{row.columnValue}"/>
- </rich:column>
- <rich:columns value="#{colBean.columns}" var="col">
- <f:facet name="header">
- <h:outputText value="#{col.header}"/>
- </f:facet>
- <h:outputText value="#{row.columnValue}"/>
- <f:facet name="footer">
- <h:outputText value="#{col.footer}"/>
- </f:facet>
- </rich:columns>
-</rich:dataTable>
-...</programlisting>
- <para>
- Now, you can use a few <emphasis role="bold">
- <property><rich:columns></property>
- </emphasis> together with <emphasis role="bold">
- <property><rich:column></property>
- </emphasis> within the one table:
- </para>
- <programlisting role="XML">...
<rich:dataTable value="#{dataTableScrollerBean.model}" var="model" width="500px" rows="5">
<f:facet name="header">
<h:outputText value="Cars Available"></h:outputText>
@@ -201,79 +153,17 @@
</rich:dataTable>
...
</programlisting>
-
- <para> In order to group columns with text information into one row, use the <emphasis>
- <property>"colspan"</property>
- </emphasis> attribute, which is similar to an HTML one. In the
- following example the third column contains 3 columns. In addition,
- it's necessary to specify that the next column begins from
- the first row with the help of the <code>breakBefore =
- "true"</code> . </para>
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
- <programlisting role="XML">...
-<rich:dataTable value="#{columns.data1}" var="data">
- <rich:column>
- <h:outputText value="#{column.Item1}" />
- </rich:column>
- <rich:column>
- <h:outputText value="#{column.Item2}" />
- </rich:column>
- <rich:column>
- <h:outputText value="#{column.Item3}" />
- </rich:column>
- <rich:columns columns="3" colspan="3" breakBefore="true">
- <h:outputText value="#{data.str0}" />
- </rich:columns>
-</rich:dataTable>
-...</programlisting>
-
- <!--para>As a result the following structure is rendered:</para>
- <figure>
- <title><rich:column> modified with colspan and breakbefore attributes</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/column3.png"/>
- </imageobject>
- </mediaobject>
- </figure-->
-
- <para> The same way is used for <property>columns</property> grouping with the <emphasis>
- <property>"rowspan"</property>
- </emphasis> attribute that is similar to an HTML. The only thing to
- add in the example is an instruction to move onto the next row for
- each next after the second column. </para>
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
- <programlisting role="XML">...
-<rich:dataTable value="#{columns.data1}" var="data">
- <rich:columns columns="2" rowspan="3">
- <h:outputText value="#{data.str0}" />
- </rich:columns>
- <rich:column>
- <h:outputText value="#{column.Item1}" />
- </rich:column>
- <rich:column breakBefore="true">
- <h:outputText value="#{column.Item2}" />
- </rich:column>
- <rich:column breakBefore="true">
- <h:outputText value="#{column.Item3}" />
- </rich:column>
-</rich:dataTable>
-...
-</programlisting>
-
- <!--para>As a result:</para>
- <figure>
- <title><rich:column> generated with rowspan attribute</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/column4.png"/>
- </imageobject>
- </mediaobject>
- </figure-->
+
+ <para>The grouping some columns into one column or one row with the help of
+ the <emphasis>
+ <property>"colspan"</property>,
+ </emphasis> <emphasis>
+ <property>"rowspan"</property>
+ </emphasis> and <emphasis>
+ <property>"breakBefore"</property></emphasis> attributes can be perform for <emphasis role="bold">
+ <property><rich:columns></property></emphasis> the same way as for the
+ <link linkend="col_grouping"><emphasis role="bold">
+ <property><rich:columnt></property></emphasis> component</link>.</para>
<note>
<title>Note:</title>
<para> The <emphasis role="bold">
@@ -407,17 +297,20 @@
</row>
</tbody>
</tgroup>
- </table>
- You can find all necessary information about style classes redefinition in
+ </table>
+ <para>Custom style classes as well as skin parameters for <emphasis role="bold">
+ <property><rich:columns></property></emphasis> are the same as for the <link linkend="dataTableRefData"><emphasis role="bold">
+ <property><rich:dataTable></property></emphasis> component.</link></para>
+ <para>You can find all necessary information about style classes redefinition in
<link linkend="customstyles">Definition of Custom Style Classes</link>
- section.
+ section.</para>
</section>
<section>
<title>Relevant Resources Links</title>
- <para>
- <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?c=columns"> On the component LiveDemo page </ulink> you can found some additional information
- for <emphasis role="bold">
+ <para>On the
+ <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?c=columns">component LiveDemo page </ulink>
+ you can find an additional information on the <emphasis role="bold">
<property><rich:columns></property>
- </emphasis> component usage. </para>
+ </emphasis> component usage.</para>
</section>
</section>
\ No newline at end of file
15 years, 4 months
JBoss Rich Faces SVN: r15416 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: ochikvina
Date: 2009-09-01 09:17:52 -0400 (Tue, 01 Sep 2009)
New Revision: 15416
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_column.xml
Log:
https://jira.jboss.org/jira/browse/RF-7678 - adding the Id;
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_column.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_column.xml 2009-08-31 20:31:49 UTC (rev 15415)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_column.xml 2009-09-01 13:17:52 UTC (rev 15416)
@@ -98,7 +98,7 @@
</imageobject>
</mediaobject>
</figure>
- <para>Now, in order to group columns with text information into one row in one
+ <para id="col_grouping">Now, in order to group columns with text information into one row in one
column with a flag, use the <emphasis>
<property>"colspan"</property>
</emphasis> attribute, which is similar to an HTML one, specifying
15 years, 4 months