9 Replies Latest reply on Dec 1, 2010 12:21 PM by Stan Silvert

    JSFunit 1.3 FileNotFoundException: MANIFEST.MF

    Dave Chen Master

      I tried to use jsfunit 1.3.  I created my.war with Ant task. When I run the jsfunitwar task, i got FileNotFoundException

       

      [jsfunitwar] java.io.FileNotFoundException: C:\DOCUME~1\administrator\LOCALS~1\Temp\jsfunitwartask1857162980433275464\my.war\META-INF\MANIFEST.MF

       

      I checked the directory: C:\DOCUME~1\John\LOCALS~1\Temp\jsfunitwartask1857162980433275464\my.war  was created, but i did not see the META-INF\MANIFEST.MF.

       

      The my.war contains a MANIFEST.MF.

       

      Could someone help me?  Thanks,

      Dave

        • 1. Re: JSFunit 1.3 FileNotFoundException: MANIFEST.MF
          Dave Chen Master

          exception stack:

           

          at java.io.FileOutputStream.open(Native Method)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
            at org.jboss.jsfunit.ant.Utils.unzip(Utils.java:114)
            at org.jboss.jsfunit.ant.Utils.explodeArchive(Utils.java:262)
            at org.jboss.jsfunit.ant.JSFUnitWarTask.JSFUnitWar(JSFUnitWarTask.java:383)
            at org.jboss.jsfunit.ant.JSFUnitWarTask.execute(JSFUnitWarTask.java:274)
            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            at org.apache.tools.ant.Task.perform(Task.java:348)
            at org.apache.tools.ant.Target.execute(Target.java:390)
            at org.apache.tools.ant.Target.performTasks(Target.java:411)
            at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360)
            at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
            at org.apache.tools.ant.Project.executeTargets(Project.java:1212)
            at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
            at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
            at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
            at org.apache.tools.ant.Task.perform(Task.java:348)
            at org.apache.tools.ant.Target.execute(Target.java:390)
            at org.apache.tools.ant.Target.performTasks(Target.java:411)
            at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360)
            at org.apache.tools.ant.Project.executeTarget(Project.java:1329)
            at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
            at org.apache.tools.ant.Project.executeTargets(Project.java:1212)
            at org.apache.tools.ant.Main.runBuild(Main.java:801)
            at org.apache.tools.ant.Main.startAnt(Main.java:218)
            at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
            at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

          • 2. Re: JSFunit 1.3 FileNotFoundException: MANIFEST.MF
            Dave Chen Master

            the my.war is created by ant war task, then proguard it. as a result , the war contains:

             

            META-INF/MANIFEST.MF

            WEB-INF/foo.jsp

             

            The war does not contains empty entries such as META-INF/  and WEB-INF/ entries.

            So the jsfunitwar task unzip: did not create directory META-INF first, but create META-INF/MANIFEST.MF.

            should the uznip create directory first if it does not exist?

             

            Thanks,

            Dave

            • 3. Re: JSFunit 1.3 FileNotFoundException: MANIFEST.MF
              Stan Silvert Master

              Hi Dave,

               

              Are you still having a problem?  From your next post it looks like you at least got the JSFUnit ant task to work?

               

              Stan

              • 4. Re: JSFunit 1.3 FileNotFoundException: MANIFEST.MF
                Dave Chen Master

                Hi Stan, yes it is working if the war is not obfuscated. But  JSF testing (simulating user input and clicks) takes much more time than clicking in browser.  I do not know why.  Normally one request/response from web browser such IE or Firefox takes one or two seconds to finish,  but JSF testing takes minutes.

                 

                Dave

                • 5. Re: JSFunit 1.3 FileNotFoundException: MANIFEST.MF
                  Stan Silvert Master

                  The actual test exectuion shouldn't take that long.  Most of the time of a JSFUnit test is spent creating and deploying your WAR.  That's something that takes a bit of time whether you are testing by hand or using JSFUnit.  It's just that with JSFUnit it is all done together so it might look like something that takes longer than it really does (by comparison).

                   

                  Try putting a timer at the beginning and end of an individual test.  You should see that the JSFUnit API calls are similar (but not quite as fast) as browser performance.  However, in your case a lot of time is spent logging all those extra CSS error messages.  Once you get that cleaned up it will help your test execution performance quite a bit.

                   

                  That being said, I have been looking closely at overall performance when using Arquillian.  One of the goals for JSFUnit 2.0 is to reduce that overall time to create, deploy, and test the war.

                   

                  Stan

                  • 6. Re: JSFunit 1.3 FileNotFoundException: MANIFEST.MF
                    Dave Chen Master

                    I am wondering if the web caching is enabled. For browser, web caching reduces CSS/javascript fetching from server. Richfaces has very large number of css and jascripts to load. Does JSFSession enable web caching automatically?  For multiple tests, I use WebClientSpec singleton to enable caching between tests.

                     

                    static WebClientSpec webClientSpec =  new WebClientSpec("/")  //singleton

                     

                    JSFSession jsfSession = new JSFSession(webClientSpec);

                     

                    When I try to run the same test again, get the following error:

                     

                    Initial request was already made.

                     

                    java.lang.IllegalStateException: Initial request was already made.
                    at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:255)
                    at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:81)

                    Thanks for help.

                    Dave

                    • 7. Re: JSFunit 1.3 FileNotFoundException: MANIFEST.MF
                      Stan Silvert Master

                      JSFSession uses HtmlUnit, which in turn uses a forked version of Rhino for javascript processing.  Yes, it does cache this stuff.  I'm sure it's not as well optimized as FireFox or IE, but they are always working to improve it.  Here is where someone asked the same question about HtmlUnit:

                      http://old.nabble.com/Compile-JS-on-page-load-td26075438.html

                       

                      You shouldn't use WebClientSpec in a static.  Its purpose is to configure and execute the initial request for a single JSFSession.  So for each new JSFSession, you need a new WebClientSpec.

                       

                      If you are sure that the bottleneck in JSFUnit performance with RichFaces is CSS/javascript fetching then we need to take a look at HtmlUnit to see if there is some way to cache CSS and javascript between instantiations of the HtmlUnit WebClient.  If there is already a way to do it then we should put something in JSFUnit that makes it easy to configure.  If not, then we need to submit a feature request to HtmlUnit.

                       

                      Stan

                      • 8. Re: JSFunit 1.3 FileNotFoundException: MANIFEST.MF
                        Dave Chen Master

                        Can all JSFUnit tests share one JSF session?  like one session for web browser to do all testing.  If yes, subsequent tests can use previous test's page to avoid initial page request.

                         

                        Thanks, Dave

                        • 9. Re: JSFunit 1.3 FileNotFoundException: MANIFEST.MF
                          Stan Silvert Master

                          Dave Chen wrote:

                           

                          Can all JSFUnit tests share one JSF session?  like one session for web browser to do all testing.  If yes, subsequent tests can use previous test's page to avoid initial page request.

                           

                          Thanks, Dave

                          I know it won't work with Arquillian.  I don't remember off hand exactly what will happen with Cactus.  It's a bad idea in any case.  The point of a test case is to isolate a use case as your most course-grained integration test.  If you keep the session alive between tests then you run the risk of corrupting one test based on the outcome of another.

                           

                          I understand that you are going for performance.  If you want to do something like that then I would suggest that you do one long user session and just do lots of assertions in a single test.  It's not ideal, but at least it's safe.  You can still break things up into many methods where you pass around the JSFSession, but JUnit would see it as one test.

                           

                          Stan