DISQUS

Community Page on DISQUS

what is this?

Jump to original thread »
Author

Superceeded Article: Embedded Web Integration Testing with Jetty

Started by jhannes · 3 months ago

Do you speak test? In that case: Hello web application:

public class WebIntegrationTest extends net.sourceforge.jwebunit.WebTestCase {

public void testIndex() {
beginAt("/index.html");
assertTextPresent("Hello world");
}%0 ... Continue reading »

5 comments

  • Thank you Mr. Johannes for this article
  • Thanks for the article, been very useful in setting up our end to end tests.
    I am however having problems with getting JNID working within Jetty. Can you confirm the quoted code is correct?
  • Hi, Martin

    I am pretty sure it is correct. But make sure that you use the latest version of this article: http://www.brodwall.com/johannes/blog/2007/02/0...

    The code for this particular bit is here: http://svn.brodwall.com/demo/insanejava/trunk/w...

    If you still don't have any success, feel free to post the problem here, or send me an email.
  • Thanks for the article. I ran into an issue with Jetty classloading when running on a linux platform.

    The code which retrieves Springs WebApplicatonContext using the jetty server's servlet context was failing. Specifically, the following code was throwing a ClassCastException:

    ApplicationContext appctx = WebApplicationContextUtils
    .getRequiredWebApplicationContext(servletContext);

    The reason being that the Spring's application context was loaded by Jetty's own classloader, hence cannot be used here.

    The work around was to set the parentLoaderPriority to true while creating the Jetty server as described here: http://docs.codehaus.org/display/JETTY/Classloa...

    eg:
    WebAppContext context = new WebAppContext();
    context.setParentLoaderPriority(true);
    context.setContextPath("/");
    context.setWar("path/to/war/or/exploded/war");
    jettyServer.setHandler(context);

    The errors happens didnt happen on a Windows XP box. But while running our CI builds on a Redhat EL4 box, the classcast exception was thrown.

    Redhat EL4
    JDK 1.5_07-b3
    Jetty-6.1.1
    Spring-Framework-2.0.2

    Hope this might help someone who runs into the same problem.


    -- suresh --
  • Hi, Suresh.

    I was not aware of this issue. Thanks for the heads-up and the good feedback. I will have to work on how to integrate it into the text, but I have updated the source code in SVN.


    ~Johannes

Add New Comment

Returning? Login