11 Replies Latest reply on Dec 9, 2008 5:04 PM by henry katz

    Testing rich:fileUpload with HtmlUnit

    henry katz Newbie

      I have the following test:

      /*
       * based on jboss tests
       */
      package org.jboss.jsfunit.test.richfaces;
      import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
      import com.gargoylesoftware.htmlunit.html.HtmlForm;
      import com.gargoylesoftware.htmlunit.javascript.host.Element;
      import java.io.File;
      import java.io.IOException;
      import java.util.ArrayList;
      import junit.framework.Test;
      import junit.framework.TestSuite;
      import org.apache.cactus.ServletTestCase;
      import org.jboss.jsfunit.jsfsession.ComponentIDNotFoundException;
      import org.jboss.jsfunit.jsfsession.JSFClientSession;
      import org.jboss.jsfunit.jsfsession.JSFServerSession;
      import org.jboss.jsfunit.jsfsession.JSFSession;
      import org.jboss.jsfunit.richclient.RichFacesClient;
      
      /**
       * Peform JSFUnit tests on RichFaces demo application.
       *
       * @author Stan Silvert
       */
      public class RichFileUploadTest extends ServletTestCase
      {
       private JSFSession jsfSession;
       private JSFClientSession client;
       private RichFacesClient ajaxClient;
       private JSFServerSession server;
      
       public void setUp() throws IOException
       {
       this.jsfSession = new JSFSession("/richfaces/fileUpload.jsf");
       this.client = jsfSession.getJSFClientSession();
       this.ajaxClient = new RichFacesClient(this.client);
       this.server = jsfSession.getJSFServerSession();
       }
      
       public void tearDown() throws Exception
       {
       this.jsfSession = null;
       this.client = null;
       this.ajaxClient = null;
       this.server = null;
       }
      
       public void testFilePresent() throws IOException
       {
       final String filename = "D:\\Notes-hkatz\\images\\support_desk.png";
       ArrayList<File> uploadedFiles = setFileParameter(filename);
       assertEquals(1, uploadedFiles.size());
       for (File upf : uploadedFiles) {
       System.out.println("file: " + upf.getAbsolutePath() + ", size: " + upf.length());
       }
       }
      
       public static Test suite()
       {
       return new TestSuite( RichFileUploadTest.class );
       }
      
       private ArrayList<File> setFileParameter(String filename)
       {
       final String uploadForm = "uploadform";
       final String uploadBtn = "uploadform:upload:upload1";
       final String uploadTextInput = "uploadform:upload:file";
      
       File f = new File(filename);
       if (!f.exists()) {
       System.out.println("Page.setFileParameter: file does not exist: " + f.toString());
       return null;
       }
      
       assertNotNull(client.getElement(uploadForm));
       // assertNull(client.getElement(uploadBtn)); // false assumption that upload button not rendered
      
       // stuff filename into widget
       HtmlFileInput inputWidget = (HtmlFileInput)client.getElement(uploadTextInput);
       try {
       inputWidget.type(filename);
       } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }
      
       assertNotNull(client.getElement(uploadBtn));
       try {
       client.click(uploadBtn);
       } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }
       return (ArrayList<File>)server.getManagedBeanValue("#{fileUploadBean.files}");
       }
      
      }
      


      which runs against the following facelet (straight from the Richfaces demo for 3.2.2):

      <ui:composition 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">
      
       <style>
      .top {
       vertical-align: top;
      
      }
      .info {
       height: 202px;
       overflow: auto;
      }
      </style>
      
       <h:form id="uploadform">
       <h:panelGrid columns="2" columnClasses="top,top">
       <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
       maxFilesQuantity="#{fileUploadBean.uploadsAvailable}"
       reRender="table" id="upload"
       immediateUpload="#{fileUploadBean.autoUpload}"
       acceptedTypes="jpg, gif, png, bmp" allowFlash="#{fileUploadBean.useFlash}">
       <a4j:support event="onuploadcomplete" reRender="info" />
       </rich:fileUpload>
       <h:panelGroup id="info">
       <rich:panel bodyClass="info">
       <f:facet name="header">
       <h:outputText value="Uploaded Files Info" />
       </f:facet>
       <h:outputText value="No files currently uploaded"
       rendered="#{fileUploadBean.size==0}" />
       <rich:dataGrid columns="1" value="#{fileUploadBean.files}"
       var="file" rowKeyVar="row">
       <rich:panel bodyClass="rich-laguna-panel-no-header">
       <h:panelGrid columns="2">
       <a4j:mediaOutput element="img" mimeType="#{file.mime}"
       createContent="#{fileUploadBean.paint}" value="#{row}"
       style="width:100px; height:100px;" cacheable="false">
       <f:param value="#{fileUploadBean.timeStamp}" name="time"/>
       </a4j:mediaOutput>
       <h:panelGrid columns="2">
       <h:outputText value="File Name:" />
       <h:outputText value="#{file.name}" />
       <h:outputText value="File Length(bytes):" />
       <h:outputText value="#{file.length}" />
       </h:panelGrid>
       </h:panelGrid>
       </rich:panel>
       </rich:dataGrid>
       </rich:panel>
       <rich:spacer height="3"/>
       <br />
       <a4j:commandButton id="uploadBtn" action="#{fileUploadBean.clearUploadData}"
       reRender="info, upload" value="Clear Uploaded Data"
       rendered="#{fileUploadBean.size>0}" />
       </h:panelGroup>
       </h:panelGrid>
       </h:form>
      </ui:composition>
      


      The apparent attempts to stuff a filename into the HtmlInput widget (type=file) which is a HtmlFileInput object under HtmlUnit is unsuccessful as determined during a debug session in the JBDS 1.1.0 GA ide as the managed bean has not detected anything. Nor is clicking on the apparent DIV html structure which has the proper JS callbacks (according to firebug) invoking the loading of the image file.

      The prior poster has a HttpUnit variant which I chose not to repeat as this is deprecated. Is my inspection of the generated HTML/javascript incorrect and if so how do I simulate the selection of a file from the file browser and subsequent clicking of the "ADD" button to upload this file via this rich:fileUpload widget?

      Thanks,
      Henry

        • 1. Re: Testing rich:fileUpload with HtmlUnit
          Stan Silvert Master

          It just so happens that I wrote a file upload test a couple of weeks ago. We are using JSFUnit to test the new JBoss Admin Console. This uses the Seam upload tag instead of the RichFaces one, but once you have a handle to the HtmlFileInput it shouldn't matter.

          // upload hellothere.war
           HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
           fileInput.setContentType("application/war");
           fileInput.setValueAttribute(System.getProperty("jsfunit.testdata") + "/war/hellothere.war");
           client.click("createContentForm:addButton");


          I'm not sure if you require this, but I also had to use an HtmlUnit ConfirmHandler to automatically respond to the window.confirm() dialog box. Here is how you set the confirm handler:
          // Initial JSF request
           WebClientSpec wcSpec = new WebClientSpec("/");
          
           // Always press OK for confirm dialogs
           wcSpec.getWebClient().setConfirmHandler(new SimpleConfirmHandler(true));
          
           JSFSession jsfSession = new JSFSession(wcSpec);


          You can see all the code, including the code for SimpleConfirmHandler here: http://fisheye.jboss.org/browse/EMBJOPR/trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit

          Hope that helps. If not, let me know and we'll take a closer look at your code.

          Stan

          • 2. Re: Testing rich:fileUpload with HtmlUnit
            henry katz Newbie

            Stan,

            Thanks for the tips. I'll take a look at the repository as well for the full details.

            Regards,
            Henry

            • 3. Re: Testing rich:fileUpload with HtmlUnit
              henry katz Newbie

              I'm getting closer. I've modified the setUp() method to include the confirm handler:

               public void setUp() throws IOException
               {
               WebClientSpec wcSpec = new WebClientSpec("/richfaces/fileUpload.jsf");
               wcSpec.getWebClient().setConfirmHandler(new SimpleConfirmHandler(true));
               this.jsfSession = new JSFSession(wcSpec);
               this.client = jsfSession.getJSFClientSession();
               this.ajaxClient = new RichFacesClient(this.client);
               this.server = jsfSession.getJSFServerSession();
               }
              


              and modified the main method to use the methods you did for HtmlFileInput:

               private ArrayList<File> setFileParameter(String filename)
               {
               final String uploadForm = "uploadform";
               final String uploadBtn = "uploadform:upload:upload1";
               final String uploadTextInput = "uploadform:upload:file";
              
               File f = new File(filename);
               if (!f.exists()) {
               System.out.println("Page.setFileParameter: file does not exist: " + f.toString());
               return null;
               }
              
               assertNotNull(client.getElement(uploadForm));
               // assertNull(client.getElement(uploadBtn)); // false assumption that upload button not rendered
              
               // stuff filename into widget
               HtmlFileInput inputWidget = (HtmlFileInput)client.getElement(uploadTextInput);
               inputWidget.setContentType("image/png");
               inputWidget.setValueAttribute(filename);
              
               assertNotNull(client.getElement(uploadBtn));
               try {
               client.click(uploadBtn);
               } catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
               }
               return (ArrayList<File>)server.getManagedBeanValue("#{fileUploadBean.files}");
               }
              


              but am still not seeing that the file actually got uploaded as the bean always returns no File's in the list.

              Where is the facelet that contains your createContentForm?
              Is it in this directory:

              http://fisheye.jboss.org/browse/EMBJOPR/trunk/core/src/main/webapp


              I'm not using seam so the client id for the add button in my case is the
              upload1 DIV in the uploadform so the client id I see is uploadform:upload:upload1. A getElement() on this client ID is non-NULL
              so I suspect I'm trying to click on the correct "button" (really a DIV).
              Is this where my error lies?

              Thanks,
              Henry

              • 4. Re: Testing rich:fileUpload with HtmlUnit
                Stan Silvert Master

                It's here:http://fisheye.jboss.org/browse/EMBJOPR/trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml

                The markup looks like this:

                <h:form id="createContentForm" enctype="multipart/form-data">
                 <h:panelGrid styleClass="formstyle">
                 <s:fileUpload id="file"
                 data="#{createContentBackedResourceAction.file}"
                 fileName="#{createContentBackedResourceAction.fileName}"
                 accept="application/zip,application/war,application/ear,application/jar"
                 contentType="#{createContentBackedResourceAction.fileContentType}"
                 required="true"/>


                Yes, you might be getting the wrong component to click. When I have a problem like that I take a look at the app using Firebug.

                Also, you can turn on the JSFUnit snooper to see all the requests/responses from the server:
                http://www.jboss.org/community/docs/DOC-12845

                Beta 3 doesn't contain the snooper, but you can get a snapshot here: http://snapshots.jboss.org/maven2/org/jboss/jsfunit/jboss-jsfunit-core/1.0.0.GA-SNAPSHOT/

                Stan

                • 5. Re: Testing rich:fileUpload with HtmlUnit
                  henry katz Newbie

                  Thanks for the facelet.

                  You're doing it slightly differently by creating your own button and not using the one implicit within the fileupload widget. I'll take a look at your button's
                  backing bean as well.

                  Thanks,
                  Henry

                  • 6. Re: Testing rich:fileUpload with HtmlUnit
                    henry katz Newbie

                    Stan,

                    I've kicked this around a bit more and still am unable to get the intrinsic "upload" button to fire. I've examined your bean and facelet

                    (http://fisheye.jboss.org/browse/EMBJOPR/trunk/core/src/main/java/org/jboss/on/embedded/ui/content/CreateContentBackedResourceAction.java?r=41)


                    http://fisheye.jboss.org/browse/EMBJOPR/trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml?r=58


                    and have already noted that you construct an explicit button with its own action method which is similar but differs from the listener the typical fileload hooks into.

                    I've traced through the button click (actually an onclick handler for a DIV) through the htmlunit code to see whether it is hitting the regular listener
                    and it was not.

                    Is there any where I might be able to send this war for you to take a quick look at?

                    Thanks,
                    Henry

                    • 7. Re: Testing rich:fileUpload with HtmlUnit
                      Stan Silvert Master

                       

                      "freemarket" wrote:


                      Is there any where I might be able to send this war for you to take a quick look at?

                      Thanks,
                      Henry


                      If it's small enough to send as an attachment you can send it to me. Or send me an FTP address and I'll get it from there.

                      Stan

                      • 8. Re: Testing rich:fileUpload with HtmlUnit
                        henry katz Newbie

                        Stan,

                        I've uploaded it to:

                        http://www.iscs-i.com/client/jsfunit/richfaces-demo-3.2.2.GA-jee5-jsfunit.war


                        This is essentially the jboss richfaces demo jar (jee5 variant) with the jsfunit tests added to it and the WEB-INF/lib built manually per the getting started instructions. The test that I've been discussing with you had been the
                        org.jboss.jsfunit.test.richfaces.RichFileUploadTest.java.

                        Today, I decided to focus and trace through the corresponding source jars so I built the 1.0.0.GA JSFunit jars which appeared to invoke an exception from the htmlunit side. Here's the relevant stack trace:



                        unable to create HTML parser

                        com.gargoylesoftware.htmlunit.ObjectInstantiationException: unable to create HTML parser
                        at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.<init>(HTMLParser.java:397)
                        at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.<init>(HTMLParser.java:332)
                        at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:232)
                        at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:127)
                        at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101)
                        at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:443)
                        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:331)
                        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:388)
                        at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:373)
                        at org.jboss.jsfunit.framework.SimpleInitialRequestStrategy.doInitialRequest(SimpleInitialRequestStrategy.java:47)
                        at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:243)
                        at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:78)
                        at org.jboss.jsfunit.test.richfaces.RichFileUploadTest.setUp(RichFileUploadTest.java:58)


                        The current jars are as follows:

                         1 736810 ant-1.5.4.jar
                         2 443432 antlr-2.7.6.jar
                         3 114926 aspectjrt-1.6.1.jar
                         4 259182 cactus-13-1.7.1.jar
                         5 180327 cactus-ant-13-1.7.1.jar
                         6 359270 cargo-0.5.jar
                         7 188671 commons-beanutils-1.7.0.jar
                         8 46725 commons-codec-1.3.jar
                         9 571259 commons-collections-3.2.jar
                         10 143602 commons-digester-1.8.jar
                         11 73721 commons-fileupload-1.2.1-sources.jar
                         12 57779 commons-fileupload-1.2.1.jar
                         13 305001 commons-httpclient-3.1.jar
                         14 109043 commons-io-1.4.jar
                         15 261809 commons-lang-2.4.jar
                         16 38015 commons-logging-1.0.4.jar
                         17 253950 cssparser-0.9.5.jar
                         18 28157 darkX-3.2.2.GA.jar
                         19 313898 dom4j-1.6.1.jar
                         20 31527 glassX-3.2.2.GA.jar
                         21 142743 gsbase-2.0.1.jar
                         22 66943 hibernate-commons-annotations-3.1.0.CR1.jar
                         23 2258840 hibernate-core-3.3.0.CR1.jar
                         24 62775 hibernate-validator-3.1.0.CR1.jar
                         25 668489 htmlunit-2.3.jar
                         26 558115 htmlunit-core-js-2.2.jar
                         27 406424 httpunit-1.6.2.jar
                         28 65671 jboss-jsfunit-analysis-1.0.0.GA-SNAPSHOT-sources.jar
                         29 88576 jboss-jsfunit-analysis-1.0.0.GA-SNAPSHOT.jar
                         30 8394 jboss-jsfunit-ant-1.0.0.GA-SNAPSHOT-sources.jar
                         31 12951 jboss-jsfunit-ant-1.0.0.GA-SNAPSHOT.jar
                         32 59000 jboss-jsfunit-core-1.0.0.GA-SNAPSHOT-sources.jar
                         33 56404 jboss-jsfunit-core-1.0.0.GA-SNAPSHOT.jar
                         34 4430 jboss-jsfunit-richfaces-1.0.0.GA-SNAPSHOT-sources.jar
                         35 5538 jboss-jsfunit-richfaces-1.0.0.GA-SNAPSHOT.jar
                         36 93310 jhighlight-1.0.jar
                         37 756883 js-1.7R1.jar
                         38 300771 jsf-facelets-1.1.14.jar
                         39 20801 jstl-1.0.jar
                         40 13236 jta-1.1.jar
                         41 137835 jtidy-4aug2000r7-dev.jar
                         42 121070 junit-3.8.1.jar
                         43 25863 laguna-3.2.2.GA.jar
                         44 115784 nekohtml-1.9.8.jar
                         45 168454 richfaces-api-3.2.2.GA.jar
                         46 1494439 richfaces-impl-3.2.2.GA.jar
                         47 2525798 richfaces-ui-3.2.2.GA.jar
                         48 15808 sac-1.3.jar
                         49 15279 slf4j-api-1.4.2.jar
                         50 7470 slf4j-simple-1.4.2.jar
                         51 2730442 xalan-2.7.0.jar
                         52 1212965 xercesImpl-2.8.1.jar
                         53 195119 xml-apis-1.3.03.jar
                        


                        Have I combined the correct libraries together above? Yesterday, the main issue was not having the corresponding source jars to walk through correctly to determine why clicking on the fileupload button (actually a DIV) was not triggering the action and hitting the bpt on the listener. I've also compared these libraries to those in the
                        jboss-jsfunit-examples/jboss-jsfunit-examples-richfaces directory and they seemed to match.

                        Thanks,
                        Henry

                        • 9. Re: Testing rich:fileUpload with HtmlUnit
                          Stan Silvert Master

                          Since you have built JSFUnit from trunk, you will see that the RichFaces demo is one of the examples that gets built. Look at jsfunit/jboss-jsfunit-examples/jboss-jsfunit-examples-richfaces/target/jboss-jsfunit-examples-richfaces-1.0.0.GA-SNAPSHOT/WEB-INF/lib

                          That will show you the jars that should be in your WAR. Offhand, I see that you need to upgrade Neko to 1.9.9. Also, you don't need HttpUnit or JTidy. There may be other differences as well.

                          If you still have trouble you can upload your latest to the FTP site and I'll take a look.

                          Stan

                          • 10. Re: Testing rich:fileUpload with HtmlUnit
                            henry katz Newbie

                            I'll make the jars identical to your jsfunit lib directory. Neko didn't seem to have anything to do with the exception but will switch them.

                            Thanks,
                            Henry

                            • 11. Re: Testing rich:fileUpload with HtmlUnit
                              henry katz Newbie

                              I've tweaked the jars to thwart the previous exception and get back to my prior status with the jsfunit 1.0.0.GA jars. Current jars:

                               1 736810 ant-1.5.4.jar
                               2 114926 aspectjrt-1.6.1.jar
                               3 259182 cactus-13-1.7.1.jar
                               4 180327 cactus-ant-13-1.7.1.jar
                               5 359270 cargo-0.5.jar
                               6 188671 commons-beanutils-1.7.0.jar
                               7 46725 commons-codec-1.3.jar
                               8 571259 commons-collections-3.2.jar
                               9 143602 commons-digester-1.8.jar
                               10 73721 commons-fileupload-1.2.1-sources.jar
                               11 57779 commons-fileupload-1.2.1.jar
                               12 305001 commons-httpclient-3.1.jar
                               13 109043 commons-io-1.4.jar
                               14 261809 commons-lang-2.4.jar
                               15 38015 commons-logging-1.0.4.jar
                               16 253950 cssparser-0.9.5.jar
                               17 28157 darkX-3.2.2.GA.jar
                               18 313898 dom4j-1.6.1.jar
                               19 31527 glassX-3.2.2.GA.jar
                               20 668489 htmlunit-2.3.jar
                               21 558115 htmlunit-core-js-2.2.jar
                               22 406424 httpunit-1.6.2.jar
                               23 56404 jboss-jsfunit-core-1.0.0.GA-SNAPSHOT.jar
                               24 5537 jboss-jsfunit-richfaces-1.0.0.GA-SNAPSHOT.jar
                               25 93310 jhighlight-1.0.jar
                               26 756883 js-1.7R1.jar
                               27 300771 jsf-facelets-1.1.14.jar
                               28 20801 jstl-1.0.jar
                               29 13236 jta-1.1.jar
                               30 137835 jtidy-4aug2000r7-dev.jar
                               31 121070 junit-3.8.1.jar
                               32 25863 laguna-3.2.2.GA.jar
                               33 116162 nekohtml-1.9.9.jar
                               34 168454 richfaces-api-3.2.2.GA.jar
                               35 1494439 richfaces-impl-3.2.2.GA.jar
                               36 2525798 richfaces-ui-3.2.2.GA.jar
                               37 15808 sac-1.3.jar
                               38 15279 slf4j-api-1.4.2.jar
                               39 7470 slf4j-simple-1.4.2.jar
                               40 2730442 xalan-2.7.0.jar
                               41 1212965 xercesImpl-2.8.1.jar
                               42 195119 xml-apis-1.3.03.jar
                              


                              So my question comes down to fundamental understanding of the effects of setting the HtmlFileInput widget and clicking on the HtmlDivision "button" in the file:upload widget as I do here:

                               private ArrayList<File> setFileParameter(String filename)
                               {
                               final String uploadForm = "uploadform";
                               final String uploadBtn = "uploadform:upload:upload1";
                               final String uploadTextInput = "uploadform:upload:file";
                               Page retPage = null;
                              
                               File f = new File(filename);
                               if (!f.exists()) {
                               System.out.println("Page.setFileParameter: file does not exist: " + f.toString());
                               return null;
                               }
                              
                               assertNotNull(client.getElement(uploadForm));
                               // assertNull(client.getElement(uploadBtn)); // false assumption that upload button not rendered
                              
                               // stuff filename into widget
                               HtmlFileInput inputWidget = (HtmlFileInput)client.getElement(uploadTextInput);
                               inputWidget.setContentType("image/png");
                               retPage = inputWidget.setValueAttribute(filename);
                              
                               HtmlDivision uploadFile = (HtmlDivision)client.getElement(uploadBtn);
                               assertNotNull(uploadFile);
                               try {
                               retPage = uploadFile.click();
                               } catch (IOException e) {
                               // TODO Auto-generated catch block
                               e.printStackTrace();
                               }
                              
                               retPage.toString();
                               return (ArrayList<File>)server.getManagedBeanValue("#{fileUploadBean.files}");
                               }
                              


                              If I hit my breakpoints on the facelet when doing a file:upload through the normal richfaces URL:


                              http://localhost:8080/richfaces-demo-3.2.2.GA-jee5/richfaces/fileUpload.jsf?c=fileUpload&tab=usage


                              how is the same action from the test (above) not hitting the breakpt?
                              The fileUploadBean does not show the file set in the HtmlFileInput widget.

                              The facelet is still the same:

                               <h:form id="uploadform">
                               <h:panelGrid columns="2" columnClasses="top,top">
                               <rich:fileUpload fileUploadListener="#{fileUploadBean.listener}"
                               maxFilesQuantity="#{fileUploadBean.uploadsAvailable}"
                               reRender="table" id="upload"
                               immediateUpload="#{fileUploadBean.autoUpload}"
                               acceptedTypes="jpg, gif, png, bmp" allowFlash="#{fileUploadBean.useFlash}">
                               <a4j:support event="onuploadcomplete" reRender="info" />
                               </rich:fileUpload>
                               <h:panelGroup id="info">
                               <rich:panel bodyClass="info">
                               <f:facet name="header">
                               <h:outputText value="Uploaded Files Info" />
                               </f:facet>
                               <h:outputText value="No files currently uploaded"
                               rendered="#{fileUploadBean.size==0}" />
                               <rich:dataGrid columns="1" value="#{fileUploadBean.files}"
                               var="file" rowKeyVar="row">
                               <rich:panel bodyClass="rich-laguna-panel-no-header">
                               <h:panelGrid columns="2">
                               <a4j:mediaOutput element="img" mimeType="#{file.mime}"
                               createContent="#{fileUploadBean.paint}" value="#{row}"
                               style="width:100px; height:100px;" cacheable="false">
                               <f:param value="#{fileUploadBean.timeStamp}" name="time"/>
                               </a4j:mediaOutput>
                               <h:panelGrid columns="2">
                               <h:outputText value="File Name:" />
                               <h:outputText value="#{file.name}" />
                               <h:outputText value="File Length(bytes):" />
                               <h:outputText value="#{file.length}" />
                               </h:panelGrid>
                               </h:panelGrid>
                               </rich:panel>
                               </rich:dataGrid>
                               </rich:panel>
                               <rich:spacer height="3"/>
                               <br />
                               <a4j:commandButton id="uploadBtn" action="#{fileUploadBean.clearUploadData}"
                               reRender="info, upload" value="Clear Uploaded Data"
                               rendered="#{fileUploadBean.size>0}" />
                               </h:panelGroup>
                               </h:panelGrid>
                               </h:form>
                              


                              I've been tracing it through the jsfunit and htmlunit code and it appears that the upload button javascript is returning false suggesting that perhaps the stuffed filename is not working. The SimpleConfirmHandler() has a brkpt that gets hit only from the richfaces normal URL and not from the jsfunit test.

                              Thanks,
                              Henry