First let me say I am really enjoying JUnit in Action. It's been a great help to me in learning about JUnit and Cactus. I bought JUnit in Action mainly to learn about Cactus, and I've currently read the book, downloaded the source and done all the examples up to Chapter 9. So far so good.
Since I do most of my development and unit testing in Eclipse, I wanted to try running the examples from Chapter 9, using the Eclipse plugin, instead of Maven. Here are the steps I did:
1) From a clean workspace, imported the junitbook-servlets, junitbook-container (as a reference) and junitbook-repository projects from the JUnit in Action source into Eclipse.
2) Downloaded and installed the last nightly builds for the two Eclipse plug-ins, jakarta-cactus-eclipse-webapp-20030909.zip and jakarta-cactus-eclipse-runner-13-1.6dev-20030907.zip. These were the latest builds I could find.
Now for my question. What is the next step to run the Cactus Unit tests in Eclipse with Jetty?
I tried running the TestAdminServlet.java unit test by selecting it and selecting Run ->Run As ->Cactus Test from the menu, I get the following error: java.net.ConnectException: Connection refused: connect.
My guess is that this is because Jetty did not start before the Cactus unit test ran.
Do I need to configure the Cactus plugin somehow to tell it to automatically start Jetty for me before running the Cactus tests? Do I need to set up something in Cactus Preferences or in a cactus properties file? I went to the Prefences for Cactus and the checkbox for Jetty is checked.
(I was able to create a TestAllWithJetty.java class and run the Cactus tests for Chapter 9 that way, but I'd like to learn how to use the Eclipse plugin. I've also searched through the book and the index, and although the plugin is mentioned several places, I haven't found a example on how to use it.)
I think I'm overlooking something simple, and I hope all I need is a push in the right direction.
WRT the Eclipse plugin for Cactus, you have to know that it is very experimental (it's one of the reason I didn't expand on it in the book). However I do believe it's working at least with Jetty. Let me try it and come back to you (i'll need a few days - say 3-4 days).
I'd also suggest we continue this discussion on the Cactus mailing list as it may be useful to others and they may also provide feedback about their own experience about using the Eclipse plugin.
You appear to be doing everything right except one little item.
I believe the reason for the "java.net.ConnectException: Connection refused: connect" error is because you haven't provided a web.xml containing the Cactus redirectors. You need to right click on your project and then select "properties". Then go to the "Web applications" entry and set the path to your web.xml file (see http://jakarta.apache.org/cactus/integration/eclipse/webapp_plugin.html).