2 Replies Latest reply on Dec 6, 2010 4:51 AM by yy zhang

    jsfunit 1.3 work with jetty5

    yy zhang Newbie

      hello,

      i have a question about jsfunit 1.3 work with jetty.

      i think jsfunit is based on the Cactus and junit, and now Cactus1.8.1 support internal start Jetty5.1.9, then jsfunit support internal start Jetty?

       

      Cactus 1.8.1:

             public static Test suite() {
                    System.setProperty("cactus.contextURL",
                           "http://localhost:8083/testCactus");
                    TestSuite suite = new TestSuite();
                    suite.addTestSuite(TestSampleServlet.class);
                    return new Jetty5xTestSetup(suite);
             }

       

       

             public static Test suite() {

                    System.setProperty("cactus.contextURL",

                           "http://localhost:8083/testCactus");

                    TestSuite suite = new TestSuite();

                    suite.addTestSuite(TestSampleServlet.class);

                    return new Jetty5xTestSetup(suite);

             }

       

       

      I  use the above code on jsfunit test,exception happended

       

       

      java.lang.IllegalStateException: Can not find HttpSession.  Make sure JSFUnitFilter has run and your test extends org.apache.cactus.ServletTestCase.

      at org.jboss.jsfunit.framework.WebConversationFactory.makeWebClient(WebConversationFactory.java:136)

      at org.jboss.jsfunit.framework.WebClientSpec.<init>(WebClientSpec.java:116)

      at org.jboss.jsfunit.framework.WebClientSpec.<init>(WebClientSpec.java:94)

      at org.jboss.jsfunit.framework.WebClientSpec.<init>(WebClientSpec.java:78)

      at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:58)

      at JSFUnitJettyTest.setUp(JSFUnitJettyTest.java:24)

      at junit.framework.TestCase.runBare(TestCase.java:128)

      at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:155)

      at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:120)

      at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:94)

      at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:225)

      at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java:1)

      at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:102)

      at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:225)

      at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java:1)

      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:73)

      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:225)

      at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java:1)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)

      at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:666)

      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)

      at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)

      at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)

      at org.mortbay.http.HttpServer.service(HttpServer.java:909)

      at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)

      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)

      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)

      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)

      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)

      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)