1 2 Previous Next 24 Replies Latest reply on Mar 13, 2008 7:44 AM by stiley Go to original post
      • 15. Re: Won't run tests
        juanignaciosl

        Well, I "translated" the URL at my explanation to make it clearer. Where can I set that property, anyway, and what should it contain?

        • 16. Re: Won't run tests
          ssilvert

          Generally, you should not set that property. I was just making sure.

          Stan

          • 17. Re: Won't run tests
            ssilvert

            I don't think the "follow redirects disabled" message is a problem. That's coming from HttpClient, which is at a lower level than Cactus. I'm pretty sure Cactus should be handling the redirect for you.

            Have you tried issuing this URL directly from your browser?
            http://jagita46w256.itacyl.red:7575/gnomos/ServletRedirector?Cactus_Service=GET_RESULTS

            You should get an error but I wouldn't expect it to be a 302 error.

            Stan

            • 18. Re: Won't run tests
              ssilvert

              Also, if you are running through a load balancer, Cactus/JSFUnit won't work. See the Cactus FAQ: http://jakarta.apache.org/cactus/faq.html#faq_load_balancing

              Stan

              • 19. Re: Won't run tests
                juanignaciosl

                I had already seen the load balancer issue, but I'm not using it.

                There's another difference between the application and the test war: application urls must not be "localhost" but my network name, due to an authentication scheme. Should it force me to use cactus.contextURL?

                • 20. Re: Won't run tests
                  ssilvert

                  I'm not sure I understand your last post, but here is the info concerning the cactus.contextURL property.
                  http://jakarta.apache.org/cactus/integration/manual/howto_config.html

                  cactus.contextURL is what Cactus will use for the redirect when it needs to get test results. In JSFUnit, the only time you need to set this is when you are running your tests from ant or maven. If you are running from a browser using ServletTestRunner then your are typing the required URL in your browser.

                  In the JSFUnitFilter, I set the cactus.contextURL for you using this code:

                  System.setProperty("cactus.contextURL", makeWARURL());
                  .
                  .
                  .
                  public static String makeWARURL(HttpServletRequest req)
                   {
                   return req.getScheme() + "://" + req.getServerName() + ":" +
                   req.getServerPort() + req.getContextPath();
                   }


                  Perhaps in your system the makeWARURL() method will return an improper result?

                  Stan

                  • 21. Re: Won't run tests
                    juanignaciosl

                    What I meant is I can't enter my app through http://localhost:7575/... but http://mydnsname... .

                    But it's not the problem, since I've just tried the Tomcat test at that name instead at localhost and it also works.

                    So I have no idea of what's the problem...

                    • 22. Re: Won't run tests
                      stiley

                      Hello, I am trying to get the JSFUnit working locally against an application but am having a hard time.

                      I decided to try the ready-made war from this wiki page
                      http://wiki.jboss.org/wiki/GettingStartedGuide

                      And am getting the exact same error running the tests as described on that URL as I am runnin my test against my application.

                      The error from the ready-made war (copied from my browser window)

                      java.lang.OutOfMemoryError: Java heap space at org.w3c.tidy.Node.clone(Node.java:331) at org.w3c.tidy.Node.cloneNode(Node.java:1489) at org.w3c.tidy.Node.cloneNode(Node.java:1496) at org.w3c.tidy.Node.cloneNode(Node.java:1496) at org.w3c.tidy.Node.cloneNode(Node.java:1496) at org.w3c.tidy.DOMNodeImpl.cloneNode(DOMNodeImpl.java:507) at com.meterware.httpunit.ParsedHTML.getDOM(ParsedHTML.java:975) at com.meterware.httpunit.WebResponse.getDOM(WebResponse.java:538) at org.jboss.jsfunit.facade.JSFClientSession.doWebRequest(JSFClientSession.java:189) at org.jboss.jsfunit.facade.JSFClientSession.doInitialRequest(JSFClientSession.java:122) at org.jboss.jsfunit.facade.JSFClientSession.(JSFClientSession.java:75) at org.jboss.foo.JSFUnitTest.testInitialPage(JSFUnitTest.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153) at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119) at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93) at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224) at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java) at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101) at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224) at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224) at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

                      • 23. Re: Won't run tests

                        Hi there stiley,

                        this has nothing to do with the JSF Unit framework itself - this is more likeley related to the java heap space running out of memory.

                        Please increase the memory for the application server that you use - for instance you can set java_opt to -Xmx=512M to set the space for tomcat servers to a max of 512M. By default I guess this is 128M or even less.

                        • 24. Re: Won't run tests
                          stiley

                          Hi and thanks for your response.

                          I currently have a JAVA_OPTS environment variable set to
                          -Xmx512m -Xms128m

                          The test case I am trying to execute is trivial

                           public void testInitialPage() throws IOException, SAXException
                           {
                           // Send an HTTP request for the initial page
                           JSFClientSession client = null;
                           client = new JSFClientSession("/login.seam");
                          
                           // A JSFServerSession gives you access to JSF state
                           JSFServerSession server = new JSFServerSession(client);
                          
                           }


                          Should I really need more memory for that test case?

                          I am using JDK 1.6, Tomcat 6.0.14 On WinXP 64 bit with 8 GB Ram



                          1 2 Previous Next