JBoss Rich Faces SVN: r7800 - trunk/framework/api/src/main/java/org/richfaces/model.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-14 09:53:40 -0400 (Mon, 14 Apr 2008)
New Revision: 7800
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java
Log:
RF-3065
Modified: trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java 2008-04-14 13:52:57 UTC (rev 7799)
+++ trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java 2008-04-14 13:53:40 UTC (rev 7800)
@@ -7,6 +7,7 @@
package org.richfaces.model;
import java.io.File;
+import java.io.Serializable;
import javax.faces.FacesException;
@@ -16,9 +17,14 @@
* @author "Andrey Markavtsov"
*
*/
-public class UploadItem {
+public class UploadItem implements Serializable{
- /** Users file name */
+ /**
+ * Serial id
+ */
+ private static final long serialVersionUID = -111723029745124147L;
+
+ /** Users file name */
private String fileName;
/** Content type */
16 years, 9 months
JBoss Rich Faces SVN: r7799 - trunk/test-applications/jsp/src/main/webapp/PanelMenu.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2008-04-14 09:52:57 -0400 (Mon, 14 Apr 2008)
New Revision: 7799
Modified:
trunk/test-applications/jsp/src/main/webapp/PanelMenu/PanelMenu.jsp
Log:
Modified: trunk/test-applications/jsp/src/main/webapp/PanelMenu/PanelMenu.jsp
===================================================================
--- trunk/test-applications/jsp/src/main/webapp/PanelMenu/PanelMenu.jsp 2008-04-14 13:52:31 UTC (rev 7798)
+++ trunk/test-applications/jsp/src/main/webapp/PanelMenu/PanelMenu.jsp 2008-04-14 13:52:57 UTC (rev 7799)
@@ -4,7 +4,7 @@
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:subview id="panelMenuSubviewID">
- <rich:panelMenu id="panelMenuID" disabled="#{panelMenu.disabled}" width="#{panelMenu.width}" selectedChild="thisChild"
+ <rich:panelMenu binding="#{panelMenu.myPanelMenu}" id="panelMenuID" disabled="#{panelMenu.disabled}" width="#{panelMenu.width}" selectedChild="thisChild"
expandSingle="#{panelMenu.expandSingle}" mode="#{panelMenu.mode}" value="PanelMenu" rendered="#{panelMenu.rendered}"
iconCollapsedGroup="#{panelMenu.icon.collapsedGroup}" iconCollapsedTopGroup="#{panelMenu.icon.collapsedTopGroup}"
iconDisabledGroup="#{panelMenu.icon.disabledGroup}" iconDisabledItem="#{panelMenu.icon.disabledItem}"
@@ -184,4 +184,6 @@
</rich:panelMenuGroup>
</rich:panelMenuGroup>
</rich:panelMenu>
+ <a4j:commandButton actionListener="#{panelMenu.panelAction}" reRender="bindingOutput" value="BindingTest" />
+ <h:outputText value="#{panelMenu.bindingStatus}" id="bindingOutput"/>
</f:subview>
16 years, 9 months
JBoss Rich Faces SVN: r7798 - trunk/test-applications/jsp/src/main/java/panelMenu.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2008-04-14 09:52:31 -0400 (Mon, 14 Apr 2008)
New Revision: 7798
Modified:
trunk/test-applications/jsp/src/main/java/panelMenu/PanelMenu.java
Log:
Modified: trunk/test-applications/jsp/src/main/java/panelMenu/PanelMenu.java
===================================================================
--- trunk/test-applications/jsp/src/main/java/panelMenu/PanelMenu.java 2008-04-14 13:43:43 UTC (rev 7797)
+++ trunk/test-applications/jsp/src/main/java/panelMenu/PanelMenu.java 2008-04-14 13:52:31 UTC (rev 7798)
@@ -1,9 +1,17 @@
package panelMenu;
import util.icon.Icon;
+import org.richfaces.component.html.HtmlPanelMenu;
+import com.sun.facelets.FaceletContext;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
public class PanelMenu {
+ private HtmlPanelMenu myPanelMenu;
+ private String bindingStatus;
private Icon icon;
private String width;
private String mode;
@@ -18,8 +26,10 @@
private String inputText;
private boolean disabled;
private boolean expandSingle;
-
+
public PanelMenu() {
+ myPanelMenu = new HtmlPanelMenu();
+ bindingStatus = "Ready";
width = "500px";
mode = "none";
expandMode = "none";
@@ -39,31 +49,52 @@
icon.setCollapsedGroup(icon.iconAjaxProcess);
icon.setDisabledGroup(icon.iconAjaxStoped);
}
-
+
+ public void panelAction(ActionEvent e) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ if (context != null) {
+ System.out.println("=============");
+ System.out.println(myPanelMenu.getClientId(context));
+ System.out.println("=============");
+ bindingStatus = "Passed";
+ } else {
+ bindingStatus = "Failed";
+ }
+
+ }
+
public boolean isDisabled() {
return disabled;
}
+
public String getWidth() {
return width;
}
+
public void setWidth(String width) {
this.width = width;
}
+
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
+
public boolean isExpandSingle() {
return expandSingle;
}
+
public void setExpandSingle(boolean expandSingle) {
this.expandSingle = expandSingle;
}
+
public String getAlign() {
return align;
}
+
public void setAlign(String align) {
this.align = align;
}
+
public boolean isRendered() {
return rendered;
}
@@ -75,30 +106,39 @@
public Icon getIcon() {
return icon;
}
+
public void setIcon(Icon icon) {
this.icon = icon;
}
+
public String getIconGroupPosition() {
return iconGroupPosition;
}
+
public void setIconGroupPosition(String iconGroupPosition) {
this.iconGroupPosition = iconGroupPosition;
}
+
public String getIconGroupTopPosition() {
return iconGroupTopPosition;
}
+
public void setIconGroupTopPosition(String iconGroupTopPosition) {
this.iconGroupTopPosition = iconGroupTopPosition;
}
+
public String getIconItemPosition() {
return iconItemPosition;
}
+
public void setIconItemPosition(String iconItemPosition) {
this.iconItemPosition = iconItemPosition;
}
+
public String getIconItemTopPosition() {
return iconItemTopPosition;
}
+
public void setIconItemTopPosition(String iconItemTopPosition) {
this.iconItemTopPosition = iconItemTopPosition;
}
@@ -106,7 +146,7 @@
public String getMode() {
return mode;
}
-
+
public void setMode(String mode) {
this.mode = mode;
}
@@ -135,14 +175,14 @@
this.inputText = inputText;
}
- public void bTest1(){
+ public void bTest1() {
icon.setCollapsed(icon.iconCollapse);
icon.setExpanded(icon.iconExpand);
icon.setItem(icon.iconItem);
icon.setIcon(icon.iconFileManager);
icon.setCollapsedGroup(icon.iconAjaxProcess);
icon.setDisabledGroup(icon.iconAjaxStoped);
-
+
setWidth("400px");
setAlign("right");
setDisabled(false);
@@ -156,14 +196,14 @@
setTabIndex("3");
}
- public void bTest2(){
+ public void bTest2() {
icon.setCollapsed(icon.iconExpand);
icon.setExpanded(icon.iconCollapse);
icon.setItem(icon.iconHeader);
icon.setIcon(icon.iconFileManagerReject);
icon.setCollapsedGroup(icon.iconAjaxStoped);
icon.setDisabledGroup(icon.iconAjaxProcess);
-
+
setWidth("250px");
setAlign("bottom");
setDisabled(false);
@@ -174,17 +214,17 @@
setIconItemPosition("right");
setIconItemTopPosition("left");
setMode("server");
- setTabIndex("2");
+ setTabIndex("2");
}
- public void bTest3(){
+ public void bTest3() {
icon.setCollapsed(icon.iconCollapse);
icon.setExpanded(icon.iconExpand);
icon.setItem(icon.iconItem);
icon.setIcon(icon.iconFileManager);
icon.setCollapsedGroup(icon.iconAjaxProcess);
icon.setDisabledGroup(icon.iconAjaxStoped);
-
+
setWidth("400px");
setAlign("middle");
setDisabled(false);
@@ -195,18 +235,18 @@
setIconItemPosition("right");
setIconItemTopPosition("left");
setMode("none");
- setTabIndex("2");
-
+ setTabIndex("2");
+
}
- public void bTest4(){
+ public void bTest4() {
icon.setCollapsed(icon.iconExpand);
icon.setExpanded(icon.iconCollapse);
icon.setItem(icon.iconHeader);
icon.setIcon(icon.iconFileManagerReject);
icon.setCollapsedGroup(icon.iconAjaxStoped);
icon.setDisabledGroup(icon.iconAjaxProcess);
-
+
setWidth("250px");
setAlign("top");
setDisabled(true);
@@ -217,18 +257,18 @@
setIconItemPosition("left");
setIconItemTopPosition("left");
setMode("ajax");
- setTabIndex("2");
-
+ setTabIndex("2");
+
}
- public void bTest5(){
+ public void bTest5() {
icon.setCollapsed(icon.iconCollapse);
icon.setExpanded(icon.iconExpand);
icon.setItem(icon.iconItem);
icon.setIcon(icon.iconFileManager);
icon.setCollapsedGroup(icon.iconAjaxProcess);
icon.setDisabledGroup(icon.iconAjaxStoped);
-
+
setWidth("250px");
setAlign("right");
setDisabled(false);
@@ -239,7 +279,15 @@
setIconItemPosition("right");
setIconItemTopPosition("right");
setMode("none");
- setTabIndex("2");
+ setTabIndex("2");
}
+
+ public HtmlPanelMenu getMyPanelMenu() {
+ return myPanelMenu;
+ }
+
+ public void setMyPanelMenu(HtmlPanelMenu myPanelMenu) {
+ this.myPanelMenu = myPanelMenu;
+ }
}
\ No newline at end of file
16 years, 9 months
JBoss Rich Faces SVN: r7797 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-04-14 09:43:43 -0400 (Mon, 14 Apr 2008)
New Revision: 7797
Modified:
trunk/docs/userguide/en/src/main/docbook/included/actionparam.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml
Log:
http://jira.jboss.com/jira/browse/RF-3064 - <a4j:actionParam> name was changed to <a4j:actionparam> according to TLD
Modified: trunk/docs/userguide/en/src/main/docbook/included/actionparam.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/actionparam.desc.xml 2008-04-14 13:25:56 UTC (rev 7796)
+++ trunk/docs/userguide/en/src/main/docbook/included/actionparam.desc.xml 2008-04-14 13:43:43 UTC (rev 7797)
@@ -8,7 +8,7 @@
</sectioninfo>
<title>Description</title>
<para>The <emphasis role="bold">
- <property><a4j:actionParam></property>
+ <property><a4j:actionparam></property>
</emphasis> component combines the functionality of both JSF components: <emphasis role="bold">
<property><f:param></property>
</emphasis> and <emphasis role="bold">
Modified: trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml 2008-04-14 13:25:56 UTC (rev 7796)
+++ trunk/docs/userguide/en/src/main/docbook/included/actionparam.xml 2008-04-14 13:43:43 UTC (rev 7797)
@@ -31,7 +31,7 @@
<para>
<emphasis role="bold">Example:</emphasis>
</para>
- <programlisting role="XML"><![CDATA[<a4j:actionParam noEscape="true" name="param1" value="getMyValue()" assignTo="#{bean.prop1}" />]]></programlisting>
+ <programlisting role="XML"><![CDATA[<a4j:actionparam noEscape="true" name="param1" value="getMyValue()" assignTo="#{bean.prop1}" />]]></programlisting>
</section>
<section>
<title>Creating the Component Dynamically Using Java</title>
@@ -47,7 +47,7 @@
<section>
<title>Key attributes and ways of usage</title>
<para>The component <emphasis role="bold">
- <property><a4j:actionParam></property>
+ <property><a4j:actionparam></property>
</emphasis> is a combination of the functionality of two JSF tags: <emphasis role="bold">
<property><f:param></property>
</emphasis> and <emphasis role="bold">
@@ -60,7 +60,7 @@
attribute as its <emphasis><property>"value"</property></emphasis>. If a <emphasis><property>"converter"</property></emphasis> attribute is specified, use it to encode and
decode the <emphasis><property>"value"</property></emphasis> to a string stored in the html parameter.</para>
<para><emphasis role="bold">
- <property><a4j:actionParam></property>
+ <property><a4j:actionparam></property>
</emphasis>has a <emphasis><property>"noEscape"</property></emphasis> attribute. If it is set to
<property>"true"</property>, the <emphasis><property>"value"</property></emphasis> is evaluated as a JavaScript code. </para>
<emphasis role="bold">Example:</emphasis>
@@ -71,7 +71,7 @@
...
</script>
...
- <a4j:actionParam noEscape="true" name="param1" value="foo" assignTo="#{bean.prop1}" />
+ <a4j:actionparam noEscape="true" name="param1" value="foo" assignTo="#{bean.prop1}" />
...]]></programlisting>
<para>
The <emphasis role="bold"><property><a4j:param></property></emphasis> extends
@@ -86,7 +86,7 @@
<para>
<ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/actionparam.jsf?c=act...">Here</ulink>
you can see the example of <emphasis role="bold"
- ><property><a4j:actionParam></property></emphasis> usage and sources for the given example.
+ ><property><a4j:actionparam></property></emphasis> usage and sources for the given example.
</para>
<para>More information can be found on the <ulink url="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063764"
>Ajax4jsf Users Forum</ulink>.</para>
16 years, 9 months
JBoss Rich Faces SVN: r7796 - trunk/framework/impl/src/main/java/org/ajax4jsf/request.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-14 09:25:56 -0400 (Mon, 14 Apr 2008)
New Revision: 7796
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
Log:
RF-3063
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-04-14 13:12:22 UTC (rev 7795)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-04-14 13:25:56 UTC (rev 7796)
@@ -127,12 +127,19 @@
}
public Object getFile() {
- if (null != tempFile) {
- return tempFile;
- }else if (null != bOut) {
- return bOut.toByteArray();
- }
- return null;
+ if (null != tempFile) {
+ if (fOut != null) {
+ try {
+ fOut.close();
+ } catch (IOException ex) {
+ }
+ fOut = null;
+ }
+ return tempFile;
+ } else if (null != bOut) {
+ return bOut.toByteArray();
+ }
+ return null;
}
public String getFilename() {
@@ -160,7 +167,7 @@
tempFile = File.createTempFile(new UID().toString().replace(
":", "-"), ".upload");
- tempFile.deleteOnExit();
+ //tempFile.deleteOnExit();
fOut = new FileOutputStream(tempFile);
} catch (IOException ex) {
throw new FileUploadException("Could not create temporary file");
@@ -298,7 +305,7 @@
parameters = new HashMap<String, Param>();
File file = null;
- this.percentMap = getProgressData();
+ this.percentMap = getProgressData();
try {
byte[] buffer = new byte[BUFFER_SIZE];
@@ -429,7 +436,7 @@
return false;
}
}
-
+
return true;
} else {
if (file != null) {
@@ -579,8 +586,7 @@
return (p != null && p instanceof FileParam) ? ((FileParam) p)
.getFile() : null;
}
-
-
+
public String getFileName(String name) {
Param p = getParam(name);
return (p != null && p instanceof FileParam) ? ((FileParam) p)
16 years, 9 months
JBoss Rich Faces SVN: r7795 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-04-14 09:12:22 -0400 (Mon, 14 Apr 2008)
New Revision: 7795
Modified:
trunk/docs/userguide/en/src/main/docbook/included/pickList.desc.xml
Log:
http://jira.jboss.com/jira/browse/RF-2174 - key feature 'disablement support' was hidden
Modified: trunk/docs/userguide/en/src/main/docbook/included/pickList.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/pickList.desc.xml 2008-04-14 13:02:31 UTC (rev 7794)
+++ trunk/docs/userguide/en/src/main/docbook/included/pickList.desc.xml 2008-04-14 13:12:22 UTC (rev 7795)
@@ -38,9 +38,9 @@
<listitem>
<para>Highly customizable look and feel</para>
</listitem>
- <listitem>
+ <!--listitem>
<para>Disablement support</para>
- </listitem>
+ </listitem-->
</itemizedlist>
</section>
</section>
16 years, 9 months
JBoss Rich Faces SVN: r7794 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-04-14 09:02:31 -0400 (Mon, 14 Apr 2008)
New Revision: 7794
Modified:
trunk/docs/userguide/en/src/main/docbook/included/inplaceSelect.xml
Log:
http://jira.jboss.com/jira/browse/RF-1226 - inplaceSelect screenshots were added
Modified: trunk/docs/userguide/en/src/main/docbook/included/inplaceSelect.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/inplaceSelect.xml 2008-04-14 12:13:24 UTC (rev 7793)
+++ trunk/docs/userguide/en/src/main/docbook/included/inplaceSelect.xml 2008-04-14 13:02:31 UTC (rev 7794)
@@ -139,7 +139,7 @@
<title>Changed state</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/inplaceSelectCh1.png"/>
+ <imagedata fileref="images/inplaceSelectCh1.png"/>
</imageobject>
</mediaobject>
</figure>
@@ -224,7 +224,23 @@
The <emphasis><property>"selectOnEdit"</property></emphasis> (with possible values "true", "false") gives you an
option to make the text in the input field selected right after the change from <property>view</property> state to <property>edit</property> occurs.
</para>
+ <programlisting role="XML"><![CDATA[...
+<rich:inplaceSelect value="#{bean.inputValue}" selectOnEdit="true">
+ <f:selectItems value="#{bean.selectItems}"/>
+</rich:inplaceSelect>
+...]]></programlisting>
<para>
+ This is the result:
+ </para>
+ <figure>
+ <title>The <emphasis><property>"selectOnEdit"</property></emphasis> attribute usage</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/inplaceSelectSoE.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
Another useful attribute is <emphasis><property>"openOnEdit"</property></emphasis>.
With "true" value it defines that the drop-down list with items opens automatically after <property>edit</property> state is activated.
</para>
@@ -241,8 +257,18 @@
<f:selectItems value="#{bean.selectItems}"/>
</rich:inplaceSelect>
...]]></programlisting>
+ <para>
+ This is the result:
+ </para>
+ <figure>
+ <title>The <emphasis><property>"showControls"</property></emphasis> attribute usage</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/inplaceSelectSC.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
-
<para>
You can also position the controls relatively to the input field, by means of
</para>
@@ -264,12 +290,22 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
-<rich:inplaceSelect value="#{bean.inputValue}" controlsHorizontalPosition="left" controlsVerticalPosition="bottom" showControls="true">
+<rich:inplaceSelect value="#{bean.inputValue}" controlsHorizontalPosition="left" controlsVerticalPosition="center" showControls="true">
<f:selectItems value="#{bean.selectItems}"/>
</rich:inplaceSelect>
...]]> </programlisting>
+ <para>
+ This is the result:
+ </para>
+ <figure>
+ <title>Controls positioning</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/inplaceSelectCentLeft.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
-
<para>It is also possible to use <emphasis><property>"controls"</property></emphasis>
facet in order to replace the default controls with facets content. See the example below.
</para>
@@ -278,7 +314,7 @@
<emphasis role="bold">Example:</emphasis>
</para>
<programlisting role="XML"><![CDATA[...
-<rich:inplaceSelect value="#{bean.inputValue}" showControls="true" controlsHorizontalPosition="left" controlsVerticalPosition="bottom">
+<rich:inplaceSelect value="#{bean.inputValue}" showControls="true">
<f:facet name="controls">
<button onclick="#{rich:component('inplaceSelect')}.save();" type="button">Save</button>
<button onclick="#{rich:component('inplaceSelect')}.cancel();" type="button">Cancel</button>
@@ -286,7 +322,17 @@
<f:selectItems value="#{bean.selectItems}"/>
</rich:inplaceSelect>
...]]> </programlisting>
-
+ <para>
+ This is the result:
+ </para>
+ <figure>
+ <title><emphasis><property>"controls"</property></emphasis> facet usage</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/inplaceSelectFct.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
<note>
<title>Note:</title>
<para>
16 years, 9 months
JBoss Rich Faces SVN: r7793 - in trunk/test-applications/seleniumTest: src/main/java/org/ajax4jsf and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-14 08:13:24 -0400 (Mon, 14 Apr 2008)
New Revision: 7793
Added:
trunk/test-applications/seleniumTest/src/main/webapp/layout/
trunk/test-applications/seleniumTest/src/main/webapp/layout/template.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands/
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands/ajaxButtonDescription.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands/ajaxButtonTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java
Removed:
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
Modified:
trunk/test-applications/seleniumTest/pom.xml
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/A4JCommandTestBean.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandsTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java
Log:
test for ajax command buttons
Modified: trunk/test-applications/seleniumTest/pom.xml
===================================================================
--- trunk/test-applications/seleniumTest/pom.xml 2008-04-14 10:20:16 UTC (rev 7792)
+++ trunk/test-applications/seleniumTest/pom.xml 2008-04-14 12:13:24 UTC (rev 7793)
@@ -182,5 +182,10 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui</artifactId>
+ <version>3.2.1-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/A4JCommandTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/A4JCommandTestBean.java 2008-04-14 10:20:16 UTC (rev 7792)
+++ trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/A4JCommandTestBean.java 2008-04-14 12:13:24 UTC (rev 7793)
@@ -6,17 +6,17 @@
public class A4JCommandTestBean {
- private Integer text = 1;
+ private Integer value = 0;
private String param;
public void actionListener(ActionEvent event) {
- this.text++;
+ this.value++;
}
public String action () {
- this.text++;
+ this.value++;
return null;
}
@@ -25,18 +25,18 @@
}
/**
- * @return the text
+ * @return the value
*/
- public Integer getText() {
- return text;
+ public Integer getValue() {
+ return value;
}
/**
- * @param text the text to set
+ * @param value the value to set
*/
- public void setText(Integer text) {
- text++;
- this.text = text;
+ public void setValue(Integer value) {
+ value++;
+ this.value = value;
}
/**
Added: trunk/test-applications/seleniumTest/src/main/webapp/layout/template.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/layout/template.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/webapp/layout/template.xhtml 2008-04-14 12:13:24 UTC (rev 7793)
@@ -0,0 +1,103 @@
+<!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:a4j="http://richfaces.org/a4j"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+<head>
+ <script>
+ var errorMessage = null;
+ window.onerror = function (message, url, code) {
+ errorMessage = message;
+ };
+ function checkError () {
+ return errorMessage;
+ }
+
+ function submitForm () {
+ document.getElementById('_form').submit();
+ }
+
+ function reRenderAll () {
+ document.getElementById('_Selenium_Test_ReRender_Form:_reRender').onclick();
+ return;
+ }
+ </script>
+</head>
+<f:view>
+<body>
+<div style="padding: 10px; font-size: 24px;">Rich faces component testing by Selenium</div><br/>
+<h:form id="_Selenium_Test_ReRender_Form">
+ <table border="0" cellpadding="5" cellspacing="0">
+ <tr>
+ <td colspan="2">
+ <a4j:commandLink reRender="_Selenium_Test_Form1, _Selenium_Test_Form2" style="text-decoration: underline; color: blue" value="ReRenderAll" id="_reRender"/>
+ </td>
+ </tr>
+ <!-- tr>
+ <td>
+ <b>Ajax Status:</b>
+ </td>
+ <td>
+ <a4j:status startText="Ajax in progress...">
+ <f:facet name="stop">
+ <h:outputText value="Completed" style="color: green"></h:outputText>
+ </f:facet>
+ <f:facet name="start">
+ <h:outputText value="In progress..." style="color: red"></h:outputText>
+ </f:facet>
+ </a4j:status>
+ </td>
+ </tr-->
+ </table>
+</h:form>
+<br/>
+<div id="_Selenium_Test_ControlPoint1" style="display: none;">Control1</div>
+ <br/>
+<table border="0" cellpadding="0" cellspacing="10"><tr><td style="vertical-align: top">
+ <rich:dataTable value="1" id="_Selenium_Test_Description">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Description area"></h:outputText>
+ </f:facet>
+ <ui:insert name="description"></ui:insert>
+ </h:column>
+ </rich:dataTable>
+</td></tr></table>
+
+ <br/><br/>
+<table border="0" cellpadding="0" cellspacing="10"><tr><td style="vertical-align: top">
+<h:form id="_Selenium_Test_Form1">
+ <rich:dataTable value="1" id="_Selenium_Test_DataTable" style="width: auto">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Testing area inside Data Table"></h:outputText>
+ </f:facet>
+ <ui:insert name="component" />
+ </h:column>
+ </rich:dataTable>
+</h:form>
+</td>
+<td style="width: 20px">
+</td>
+<td style="vertical-align: top">
+<h:form id="_Selenium_Test_Form2">
+ <rich:panel id="_Selenium_Test_Panel">
+ <f:facet name="header">
+ <h:outputText value="Testing area inside Panel"></h:outputText>
+ </f:facet>
+ <ui:insert name="component" />
+ </rich:panel>
+</h:form>
+</td></tr></table>
+
+
+<script type="text/javascript">
+ window.done=false;A4J.AJAX.AddListener(new A4J.AJAX.Listener(function(){window.done=true}));
+</script>
+
+<div id="_Selenium_Test_ControlPoint2" style="display: none;">Control2</div>
+</body>
+</f:view>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands/ajaxButtonDescription.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands/ajaxButtonDescription.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands/ajaxButtonDescription.xhtml 2008-04-14 12:13:24 UTC (rev 7793)
@@ -0,0 +1,3 @@
+<html>
+askgfjas faskjfaskl klj
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands/ajaxButtonTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands/ajaxButtonTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands/ajaxButtonTest.xhtml 2008-04-14 12:13:24 UTC (rev 7793)
@@ -0,0 +1,63 @@
+<!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:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="../../layout/template.xhtml">
+ <ui:define name="component">
+ <a4j:commandButton
+ id="b1"
+ action="#{commandBean.action}"
+ actionListener="#{commandBean.actionListener}"
+ reRender="_value"
+ value="Button1">
+ </a4j:commandButton>
+
+ <a4j:commandButton
+ id="b2"
+ action="#{commandBean.action}"
+ actionListener="#{commandBean.actionListener}"
+ immediate="true"
+ reRender="_value"
+ value="Button2">
+ </a4j:commandButton>
+
+ <a4j:commandButton
+ id="b3"
+ action="#{commandBean.action}"
+ immediate="true"
+ reRender="_value"
+ value="Button3">
+ </a4j:commandButton>
+
+ <a4j:commandButton
+ id="b4"
+ action="#{commandBean.action}"
+ immediate="true"
+ ajaxSingle="true"
+ reRender="_value"
+ value="Button4">
+ </a4j:commandButton>
+
+ <a4j:commandButton
+ id="b5"
+ action="#{commandBean.action}"
+ actionListener="#{commandBean.actionListener}"
+ ajaxSingle="true"
+ reRender="_value"
+ value="Button5">
+ </a4j:commandButton>
+
+ <br/>
+ <h:inputText value="#{commandBean.value}" id="_value"></h:inputText>
+ <br/>
+ <rich:calendar></rich:calendar>
+ </ui:define>
+ <ui:define name="description">
+ <ui:include src="ajaxButtonDescription.xhtml" />
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Deleted: trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands.xhtml 2008-04-14 10:20:16 UTC (rev 7792)
+++ trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommands.xhtml 2008-04-14 12:13:24 UTC (rev 7793)
@@ -1,52 +0,0 @@
-<!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:a4j="http://richfaces.org/a4j"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core">
- <head><title>test</title></head>
- <body>
- <a4j:status startText="Ajax in progress..." stopText="Ajax completed" id="status"></a4j:status>
- <h:form id="fff">
- <a4j:commandButton
- actionListener="#{commandBean.actionListener}"
- reRender="date,text"
- value="Button1"
- id="b1" />
- <a4j:commandLink
- actionListener="#{commandBean.actionListener}"
- ajaxSingle="true"
- reRender="date,text"
- value="Link1"
- id="l1"></a4j:commandLink> <br/>
- <h:inputText value="#{commandBean.text}" id="text" style="width: 100px"/>
- <h:panelGrid id="panel">
- <a4j:commandButton
- requestDelay="1000"
- actionListener="#{commandBean.actionListener}"
- reRender="date,text,param"
- ajaxSingle="true"
- value="Button2"
- action="#{commandBean.action}"
- id="b2">
- <a4j:actionparam name="param" value="actionParameter1" assignTo="#{commandBean.param}" />
- </a4j:commandButton>
- <a4j:commandLink
- requestDelay="1000"
- actionListener="#{commandBean.actionListener}"
- action="#{commandBean.action}"
- reRender="date,text,param"
- value="Link2"
- id="l2">
- <a4j:actionparam name="param" value="actionParameter2" assignTo="#{commandBean.param}" />
- </a4j:commandLink> <br/>
- </h:panelGrid>
- <h:outputText value="#{commandBean.date}" id="date"/>
- </h:form>
- <h:form id="_form">
- <h:outputText value="#{commandBean.param}" id="param"></h:outputText>
- </h:form>
- <script type="text/javascript">
- window.done=false;A4J.AJAX.AddListener(new A4J.AJAX.Listener(function(){window.done=true}));
- </script>
- </body>
-</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java (rev 0)
+++ trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java 2008-04-14 12:13:24 UTC (rev 7793)
@@ -0,0 +1,249 @@
+package org.ajax4jsf.test.base;
+
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+
+/**
+ * The base java class for selenium tests implementation.
+ * @author Andrey Markavtsov
+ *
+ */
+public class SeleniumTestBase {
+
+ private static final String equalCh = "=";
+
+ private static final String idSearch = RendererUtils.HTML.id_ATTRIBUTE + equalCh;
+
+ /** Specifies the time to wait for page rendering */
+ private static final Integer pageRenderTime = 5000;
+
+ /** The default selenium instance */
+ protected DefaultSelenium selenium;
+
+ /** Host */
+ public String host;
+
+ /** Port */
+ public String port;
+
+ /** Protocol */
+ public String protocol;
+
+ /** Defines the name of current j2ee application name*/
+ public static final String APPLICATION_NAME = "seleniumTest";
+
+ public static final String COMPONENT_PREFIX_INSIDE_TABLE = "_Selenium_Test_Form1:_Selenium_Test_DataTable:0:";
+
+ public static final String COMPONENT_PREFIX_INSIDE_PANEL = "_Selenium_Test_Form2:";
+
+ public SeleniumTestBase() {
+ /* Default constructor */
+ }
+
+ public SeleniumTestBase(String protocol, String host, String port) {
+ this.host = host;
+ this.port = port;
+ this.protocol = protocol;
+ }
+
+ /**
+ * @param url
+ * @param browser
+ * @return
+ */
+ public DefaultSelenium createSeleniumClient(String url, String browser) {
+ return new DefaultSelenium(host, 4444, browser, url);
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ selenium = createSeleniumClient(protocol + "://" + host + ":" + port + "/", browser);
+ selenium.start();
+ }
+
+ /**
+ * Renders page
+ */
+ protected void renderPage (String homePage) {
+ selenium.open(protocol + "://" + host + ":" + port + "/" + APPLICATION_NAME + homePage);
+ selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
+
+ checkPageRendering(); // At the first we check if page has been rendered
+ checkJSError(); // At the second we check if JS errors occurred
+
+ reRenderForm(); // ReRender component
+
+ checkPageRendering(); // Check all again
+ checkJSError();
+
+ }
+
+ /**
+ * Return component id inside Data table
+ * @param id
+ * @return
+ */
+ public String getComponentIdInsideTable(String id) {
+ return COMPONENT_PREFIX_INSIDE_TABLE + id;
+ }
+
+
+ /**
+ * Return component id inside Panel
+ * @param id
+ * @return
+ */
+ public String getComponentIdInsidePanel(String id) {
+ return COMPONENT_PREFIX_INSIDE_PANEL + id;
+ }
+
+
+ /**
+ * ReRenders the component
+ */
+ public void reRenderForm () {
+ selenium.getEval("selenium.browserbot.getCurrentWindow().reRenderAll();");
+ //clickById("_Selenium_Test_ReRender_Form:_reRender");
+ waitForAjaxCompletion(3000);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ selenium.stop();
+ selenium = null;
+ }
+
+ /**
+ * Checks if JS error occurred.
+ * Fails test if yes.
+ * This method should be invoked after each event or any thing which can be a cause of JS error.
+ */
+ public void checkJSError () {
+ String error = selenium.getEval("selenium.browserbot.getCurrentWindow().checkError();");
+ if (error != null && !("null".equals(error)) && !("".equals(error))) {
+ Assert.fail("Failure by the following Javascript error: " + error);
+ }
+ }
+
+ /**
+ * Checks if page containing component test has been rendered completely
+ */
+ public void checkPageRendering() {
+ String t1 = getTextById("_Selenium_Test_ControlPoint1");
+ String t2 = getTextById("_Selenium_Test_ControlPoint2");
+ if (t1 == null || t2 == null || !"Control1".equals(t1) || !"Control2".equals(t2)) {
+ Assert.fail("The page has been not rendered properlly");
+ }
+ }
+
+ /**
+ * Waits while AJAX request will be completed
+ * @param miliseconds - time to wait
+ */
+ public void waitForAjaxCompletion (int miliseconds) {
+ selenium.waitForCondition(
+ "selenium.browserbot.getCurrentWindow().done==true", String.valueOf(miliseconds));
+ }
+
+
+ /**
+ * Asserts DOM node value equals to value defined
+ * @param id - DOM element id
+ * @param value - value defined
+ */
+ public void AssertValueEquals(String id, String value) {
+ String _v = getValueById(id);
+ Assert.assertEquals(_v, value);
+ }
+
+ /**
+ * Asserts DOM node value does not equal to value defined
+ * @param id - DOM element id
+ * @param value - value defined
+ */
+ public void AssertValueNotEquals(String id, String value) {
+ String _v = getValueById(id);
+ Assert.assertNotSame(_v, value);
+ }
+
+
+ /**
+ * Asserts DOM node text equals to text defined
+ * @param id - DOM element id
+ * @param value - text defined
+ */
+ public void AssertTextEquals(String id, String value) {
+ String _v = getTextById(id);
+ Assert.assertEquals(_v, value);
+ }
+
+ /**
+ * Asserts DOM node text does not equal to text defined
+ * @param id - DOM element id
+ * @param value - text defined
+ */
+ public void AssertTextNotEquals(String id, String value) {
+ String _v = getTextById(id);
+ Assert.assertNotSame(_v, value);
+ }
+
+ /**
+ * Returns element's text
+ * @param id - DOM element id
+ * @return
+ */
+ public String getTextById(String id) {
+ return selenium.getText(idSearch + id);
+ }
+
+ /**
+ * Returns element's value
+ * @param id - DOM element id
+ * @return
+ */
+ public String getValueById(String id) {
+ return selenium.getValue(idSearch + id);
+ }
+
+ /**
+ * Clicks on element
+ * @param id - DOM element id
+ * @return
+ */
+ public void clickById(String id) {
+ selenium.click(idSearch + id);
+ checkJSError();
+ }
+
+
+ /**
+ * Return true if element is visible
+ * @param id - DOM element id
+ * @return
+ */
+ public boolean isVisibleById(String id) {
+ return selenium.isVisible(idSearch + id);
+ }
+
+ /**
+ * Creates delay
+ * @param miliSeconds
+ * @throws InterruptedException
+ */
+ public void delay (int miliSeconds) throws InterruptedException {
+ Thread.sleep(miliSeconds);
+ }
+
+}
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandsTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandsTest.java 2008-04-14 10:20:16 UTC (rev 7792)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandsTest.java 2008-04-14 12:13:24 UTC (rev 7793)
@@ -1,11 +1,9 @@
package org.richfaces;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
+import org.ajax4jsf.test.base.SeleniumTestBase;
import org.testng.annotations.Test;
+
public class AjaxCommandsTest extends SeleniumTestBase {
public AjaxCommandsTest() {
@@ -14,76 +12,60 @@
@Test
public void testAjaxCommandsComponents() throws Exception {
- selenium.open("http://localhost:8080/seleniumTest/faces/pages/ajaxCommands.xhtml");
- selenium.waitForPageToLoad("5000");
-
- assertEquals("1", getValueById("fff:text"));
- assertTrue(isVisibleById("_viewRoot:status.stop"));
-
- String date = getTextById("fff:date");
-
- // the click on command button [ ajaxSingle = false ]
- clickById("fff:b1");
- selenium.waitForCondition(
- "selenium.browserbot.getCurrentWindow().done==true", "1000");
- assertEquals("3", getValueById("fff:text"));
- assertFalse(getTextById("fff:date").equals(date));
-
- // the click on command button [ ajaxSingle = false ]
- clickById("fff:b1");
- selenium.waitForCondition(
- "selenium.browserbot.getCurrentWindow().done==true", "1000");
- assertEquals("5", getValueById("fff:text"));
- assertFalse(getTextById("fff:date").equals(date));
-
- // the click on command link [ ajaxSingle = true ]
- clickById("fff:l1");
- selenium.waitForCondition(
- "selenium.browserbot.getCurrentWindow().done==true", "1000");
- assertEquals("2", getValueById("fff:text"));
- assertFalse(getTextById("fff:date").equals(date));
-
- // the click on command link [ ajaxSingle = true ]
- clickById("fff:l1");
- selenium.waitForCondition(
- "selenium.browserbot.getCurrentWindow().done==true", "1000");
- assertEquals("2", getValueById("fff:text"));
- assertFalse(getTextById("fff:date").equals(date));
-
- // the click on command button [ ajaxSingle = true ]
- clickById("fff:b2");
- assertTrue("".equals(getTextById("_form:param")));
- assertEquals("2", getValueById("fff:text"));
- delay(2000);
- assertEquals("3", getValueById("fff:text"));
- assertFalse(getTextById("fff:date").equals(date));
-
- // the click on command button [ ajaxSingle = true ]
- clickById("fff:b2");
- assertEquals("3", getValueById("fff:text"));
- delay(2000);
- assertEquals("3", getValueById("fff:text"));
- assertFalse(getTextById("fff:date").equals(date));
-
- // the click on command link [ ajaxSingle = false ]
- clickById("fff:l2");
- assertTrue("actionParameter1"
- .equals(getTextById("_form:param")));
- assertEquals("3", getValueById("fff:text"));
- delay(2000);
- assertEquals("6", getValueById("fff:text"));
- assertFalse(getTextById("fff:date").equals(date));
- assertTrue("actionParameter2"
- .equals(getTextById("_form:param")));
-
- // the click on command link [ ajaxSingle = false ]
- clickById("fff:l2");
- assertEquals("6", getValueById("fff:text"));
- delay(2000);
- assertEquals("9", getValueById("fff:text"));
- assertFalse(getTextById("fff:date").equals(date));
- assertTrue("actionParameter2"
- .equals(getTextById("_form:param")));
+ renderPage("/faces/pages/ajaxCommands/ajaxButtonTest.xhtml");
+
+ _testAjaxCommandsComponents(COMPONENT_PREFIX_INSIDE_TABLE);
+ _testAjaxCommandsComponents(COMPONENT_PREFIX_INSIDE_PANEL);
}
+
+ private void _testAjaxCommandsComponents (String parentId) {
+ // test inside DataTable
+ String buttonId = parentId + "b1";
+ String inputId = parentId + "_value";
+
+ clickById(buttonId);
+ waitForAjaxCompletion(3000);
+ AssertValueEquals(inputId, "3");
+
+ clickById(buttonId);
+ waitForAjaxCompletion(1000);
+ AssertValueEquals(inputId, "6");
+
+ buttonId = parentId + "b2";
+
+ clickById(buttonId);
+ waitForAjaxCompletion(1000);
+ AssertValueEquals(inputId, "6");
+
+ buttonId = parentId + "b3";
+
+ clickById(buttonId);
+ waitForAjaxCompletion(1000);
+ AssertValueEquals(inputId, "6");
+
+ buttonId = parentId + "b4";
+
+ clickById(buttonId);
+ waitForAjaxCompletion(1000);
+ AssertValueEquals(inputId, "1");
+
+ buttonId = parentId + "b5";
+
+ clickById(buttonId);
+ waitForAjaxCompletion(1000);
+ AssertValueEquals(inputId, "2");
+
+ buttonId = parentId + "b1";
+
+ clickById(buttonId);
+ waitForAjaxCompletion(1000);
+ AssertValueEquals(inputId, "5");
+
+ buttonId = parentId + "b3";
+
+ clickById(buttonId);
+ waitForAjaxCompletion(1000);
+ AssertValueEquals(inputId, "5");
+ }
}
Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java 2008-04-14 10:20:16 UTC (rev 7792)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java 2008-04-14 12:13:24 UTC (rev 7793)
@@ -7,9 +7,8 @@
* @author asmirnov
*
*/
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
-import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
@@ -33,7 +32,7 @@
selenium.start();
}
- @Test(enabled=false)
+ @Test(enabled=true)
public void testSomethingSimple() throws Exception {
selenium.open("http://localhost:8080/seleniumTest/faces/test.xhtml");
selenium.waitForPageToLoad("5000");
Deleted: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-04-14 10:20:16 UTC (rev 7792)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumTestBase.java 2008-04-14 12:13:24 UTC (rev 7793)
@@ -1,110 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-
-import com.thoughtworks.selenium.DefaultSelenium;
-
-public class SeleniumTestBase {
-
- private static final String equalCh = "=";
-
- private static final String idSearch = RendererUtils.HTML.id_ATTRIBUTE + equalCh;
-
- protected DefaultSelenium selenium;
-
- private String host;
-
- private String port;
-
- private String protocol;
-
- public SeleniumTestBase() {
- // Default constructor
- }
-
- public SeleniumTestBase(String protocol, String host, String port) {
- this.host = host;
- this.port = port;
- this.protocol = protocol;
- }
-
- /**
- * @param url
- * @param browser
- * @return
- */
- public DefaultSelenium createSeleniumClient(String url, String browser) {
- return new DefaultSelenium(host, 4444, browser, url);
- }
-
- /**
- * This method are invoking before selenium tests started
- */
- @BeforeTest
- @Parameters( { "browser" })
- public void startSelenium(String browser) {
- System.out.println("___________>>>>>>>>>>>>." + protocol + "://" + host + ":" + port);
- selenium = createSeleniumClient(protocol + "://" + host + ":" + port, browser);
- selenium.start();
- }
-
- /**
- * This method are invoking after selenium tests completed
- */
- @AfterTest
- public void stopSelenium() {
- selenium.stop();
- selenium = null;
- }
-
-
- /**
- * Returns element's text
- * @param id - DOM element id
- * @return
- */
- public String getTextById(String id) {
- return selenium.getText(idSearch + id);
- }
-
- /**
- * Returns element's value
- * @param id - DOM element id
- * @return
- */
- public String getValueById(String id) {
- return selenium.getValue(idSearch + id);
- }
-
- /**
- * Clicks on element
- * @param id - DOM element id
- * @return
- */
- public void clickById(String id) {
- selenium.click(idSearch + id);
- }
-
-
- /**
- * Return true if element is visible
- * @param id - DOM element id
- * @return
- */
- public boolean isVisibleById(String id) {
- return selenium.isVisible(idSearch + id);
- }
-
- /**
- * Creates delay
- * @param miliSeconds
- * @throws InterruptedException
- */
- public void delay (int miliSeconds) throws InterruptedException {
- Thread.sleep(miliSeconds);
- }
-
-}
16 years, 9 months
JBoss Rich Faces SVN: r7792 - trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-14 06:20:16 -0400 (Mon, 14 Apr 2008)
New Revision: 7792
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
Log:
RF-3041
Modified: trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
--- trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-04-14 10:20:12 UTC (rev 7791)
+++ trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2008-04-14 10:20:16 UTC (rev 7792)
@@ -111,6 +111,7 @@
String fileName = multipartRequest.getFileName(clientId);
Object file = multipartRequest.getFile(clientId);
fileUpload.setLocalFileName(fileName);
+ fileUpload.setLocalContentType(multipartRequest.getFileContentType(clientId));
onUploadComplete(context, file, fileUpload);
}
@@ -338,7 +339,7 @@
Object file) {
ValueExpression data = fileUpload
.getValueExpression(_FILES_UPLOADED_ATTRIBUTE_NAME);
- UploadItem item = new UploadItem(fileUpload.getLocalFileName(),file);
+ UploadItem item = new UploadItem(fileUpload.getLocalFileName(), fileUpload.getLocalContentType(), file);
if (data != null) {
if (data.getValue(context.getELContext()) instanceof Collection) {
Collection collection = (Collection) data.getValue(context
16 years, 9 months
JBoss Rich Faces SVN: r7791 - trunk/framework/api/src/main/java/org/richfaces/model.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-04-14 06:20:12 -0400 (Mon, 14 Apr 2008)
New Revision: 7791
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java
Log:
RF-3041
Modified: trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java 2008-04-14 09:35:17 UTC (rev 7790)
+++ trunk/framework/api/src/main/java/org/richfaces/model/UploadItem.java 2008-04-14 10:20:12 UTC (rev 7791)
@@ -21,6 +21,9 @@
/** Users file name */
private String fileName;
+ /** Content type */
+ private String contentType;
+
/** java.io.File instance */
private File file;
@@ -30,8 +33,9 @@
/**
* Constructor for the UploadItem
*/
- public UploadItem(String fileName, Object file) {
+ public UploadItem(String fileName, String contentType, Object file) {
this.fileName = fileName;
+ this.contentType = contentType;
if (null != file) {
if (file.getClass().isAssignableFrom(File.class)) {
this.file = (File) file;
@@ -78,4 +82,13 @@
public String getFileName() {
return fileName;
}
+
+ /**
+ * @return the contentType
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+
}
16 years, 9 months