1 2 Previous Next 16 Replies Latest reply on Jul 5, 2007 2:57 PM by ssilvert

    JSFUnit and Ant

    mwringe

      I have been trying to use the cactus ant tasks to get jsfunit working but have run into a lot of issues with it. the task needs an old version of cargo, only works with non exploded wars and ears, and only really manages to corrupt my war.

      Is there any plan to create JSFUnit specific ant tasks?

        • 1. Re: JSFUnit and Ant
          ssilvert

          We will definitely have Ant support. It's on my TODO list for this week to try the Ant cactify tasks. If the only thing it needs is a new version of Cargo then that should be easy to patch.

          If the cactify task doesn't work out then I'll make something that does work.

          Stan
          http://labs.jboss.com/jsfunit/

          • 2. Re: JSFUnit and Ant
            mwringe

            I actually got the cactifywar stuff sortof working now, I had some issue with cactifywar not properly handling my war for some reason which I got around (the task actually was completing successfully, but the resulting war was corrupted).

            The issue with cargo was that I already have cargo 0.8 which will not work with the ant cactifywar, it needs cargo < 0.6. The svn version of cactus should work with the newest cargo.

            The only thing I have now to figure out is how to change the servlettestredirector class in the web.xml. I don't think the ant cactify tasks have this option.

            The ant cactify tasks are not that bad (once I got it working). The big issues I have with it are
            1) can't handle exploded archives
            2) can't handle sar archives
            3) doesn't have an option to change the class for the redirectors
            4) seems to pass without error while producing a corrupted war

            • 3. Re: JSFUnit and Ant
              mwringe

              For my testing, I created a very simple patch to the cactus svn source that allows setting the servletredirector class using the cactifywar tasks. [and by using the svn source I was able to use a more recent cargo].

              With my patch in place it is fairly easy to setup jsfunit using the cactus tools.

              I am basically using something like:

              <cactifywar srcfile="${war}"
               destfile="${war-jsfunitifed}">
               <servletredirector classname="org.jboss.jsfunit.framework.JSFUnitCactusRedirector"/>
              </cactifywar>
              




              • 4. Re: JSFUnit and Ant
                ssilvert

                Awesome!

                Let's talk about next steps. I think we should:
                1) Submit the patch to the Cactus team.
                2) Go ahead and offer the patched version temporarily as a download on the JSFUnit site.
                3) Write a document called something like, "Ant Integration"
                4) Write a document called "Maven Integration"

                If you look in SVN under <jsfunit root>/src/site/xdoc, you will see that I'm using the XDOC format for building documentation. It's really simple. There are only a handful of tags to learn. See doco for xdoc here: http://maven.apache.org/maven-1.x/plugins/xdoc/

                To convert the XDOC to html, just run

                mvn site


                Can you take care of #1 and #3?

                I'll do #2 and #4 and get all the stuff pushed out to the JSFUnit site. I'll also ping the Cactus team and introduce myself.

                Stan

                • 5. Re: JSFUnit and Ant
                  mwringe

                   

                  "stan.silvert@jboss.com" wrote:
                  Awesome!
                  Can you take care of #1 and #3?
                  Stan


                  I can do that.
                  I had to change a couple of other things in the cactus code to get it to build (before my patch was even added). I would like to look into that a bit and see if I can get a more cleaner build going (I had to disable things like tests and stylechecker, it might just be a dependency version issue)

                  • 6. Re: JSFUnit and Ant
                    ssilvert

                    BTW, it looks like they added support for exploded WARs too. But they haven't done a release in a long time so you will only get support for that if you build from their SVN:

                    http://issues.apache.org/jira/browse/CACTUS-238

                    http://www.mail-archive.com/cactus-dev%40jakarta.apache.org/msg08077.html

                    Stan

                    • 7. Re: JSFUnit and Ant
                      ssilvert

                       

                      "stan.silvert@jboss.com" wrote:
                      BTW, it looks like they added support for exploded WARs too. But they haven't done a release in a long time so you will only get support for that if you build from their SVN:

                      http://issues.apache.org/jira/browse/CACTUS-238

                      http://www.mail-archive.com/cactus-dev%40jakarta.apache.org/msg08077.html

                      Stan


                      Actually, I may be wrong about that. It's hard to tell if the patch was ever committed.

                      Stan

                      • 8. Re: JSFUnit and Ant
                        mwringe

                        I don't think it was ever applied and i know that the svn version does not work with exploded wars. I also came across an email in the cactus mailing list about exploded wars and somebody got it working, but they never posted the patch:
                        http://www.mail-archive.com/cactus-user%40jakarta.apache.org/msg07315.html

                        I don't think creating a patch to also handled exploded wars would be much of a problem.

                        • 9. Re: JSFUnit and Ant
                          ssilvert

                           

                          "mwringe" wrote:
                          For my testing, I created a very simple patch to the cactus svn source that allows setting the servletredirector class using the cactifywar tasks. [and by using the svn source I was able to use a more recent cargo].

                          With my patch in place it is fairly easy to setup jsfunit using the cactus tools.

                          I am basically using something like:
                          <cactifywar srcfile="${war}"
                           destfile="${war-jsfunitifed}">
                           <servletredirector classname="org.jboss.jsfunit.framework.JSFUnitCactusRedirector"/>
                          </cactifywar>
                          




                          What would you think if we reimplemented the JSFUnitCactusRedirector as a Filter? Then you would configure your application exactly as per the Cactus instructions except that you would add this to your WAR:

                          <filter>
                           <filter-name>JSFUnitFilter</filter-name>
                           <filter-class>org.jboss.jsfunit.framework.JSFUnitFilter</filter-class>
                          </filter>
                          
                          <filter-mapping>
                           <filter-name>JSFUnitFilter</filter-name>
                           <servlet-name>ServletRedirector</servlet-name>
                          </filter-mapping>
                          
                          <filter-mapping>
                           <filter-name>JSFUnitFilter</filter-name>
                           <servlet-name>ServletTestRunner</servlet-name>
                          </filter-mapping>


                          The upside of this is that we wouldn't need to change anything in cactify. Also, we could get rid of both JSFUnitServlet.java and JSFUnitCactusRedirector.java.

                          The downside is that you would need to add the above filter declaration before running cactify.

                          Stan

                          • 10. Re: JSFUnit and Ant
                            mwringe

                             

                            "stan.silvert@jboss.com" wrote:

                            The downside is that you would need to add the above filter declaration before running cactify.


                            The cacitfy ant tasks already have a option to mergexml fragments into your web.xml so this wouldn't be that big of a deal to use.

                            It might make sense later to look into creating a jsfunit ant task that is just a very light weight wrapper around the cactus tasks. This could set things like the filer/redirector up by default, as well as automatically add the proper jars into WEB-INF/lib (the cactus tasks already does this for the cactus requirements).

                            • 11. Re: JSFUnit and Ant
                              mwringe

                              Using the cactify tasks with jsfunit can be done, but its not an ideal situation. There's going to be a lot of merging of xml fragments into the web.xml, and having to add a lot of extra jars into the lib directory.

                              I don't think it really makes sense to use the cactus tools with jsfunit, it would probably make a lot more sense to create a lightweight wrapper around the cactus tasks or to create our own ant tasks for jsfunit.

                              • 12. Re: JSFUnit and Ant
                                ssilvert

                                 

                                "mwringe" wrote:

                                I don't think it really makes sense to use the cactus tools with jsfunit, it would probably make a lot more sense to create a lightweight wrapper around the cactus tasks or to create our own ant tasks for jsfunit.


                                OK. Let's do it.

                                I know we will need to do something like that for Maven 2 anyway since there is no cactify for Maven 2 - at least until Cactus does another release (if they ever get around to it).

                                Stan

                                • 13. Re: JSFUnit and Ant
                                  mwringe

                                  I looked into this some more, writing a wrapper around the cactus ant tasks isn't really an option, its not designed to be extensible.
                                  I did some work in altering the tasks themselves, but I am unsure if this is the best option. I will look and see how difficult it would be to have our own tasks since we don't need most of the cactus tasks functionality.

                                  • 14. Re: JSFUnit and Ant
                                    ssilvert

                                    Thanks for the update. Look forward to hearing more when you get further into the research.

                                    Stan

                                    1 2 Previous Next