Return-Path: list-help: list-unsubscribe: List-Post: List-Id: Mailing-List: contact cactus-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list cactus-user@jakarta.apache.org Received: (qmail 17753 invoked by uid 99); 17 Mar 2005 10:13:07 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from llsa735-a01.servidoresdns.net (HELO smtp-01.servidoresdns.net) (82.223.190.26) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 17 Mar 2005 02:13:05 -0800 Received: from pedro1 (unknown [80.28.74.39]) by smtp-01.servidoresdns.net (Postfix) with ESMTP id 838843D7FEF for ; Thu, 17 Mar 2005 11:12:59 +0100 (CET) From: "Pedro Nevado" To: "Cactus Users List" Subject: RE: Cactus test and Struts Date: Thu, 17 Mar 2005 11:13:17 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <20050316202916.77139.qmail@web30204.mail.mud.yahoo.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Checked: Checked Bryan, How do you run your tests? Ant, with your IDE, ..? I run my tests with an Ant task and most of the times with the utility in IntelliJ. I suggest you try a simple test with a simple action like: and a simple test just checking in the endXXX() that you have got the hello.jsp. Check your web.xml. You must have entries like: FilterRedirector org.apache.cactus.server.FilterTestRedirector FilterRedirector /FilterRedirector ServletTestRunner org.apache.cactus.server.runner.ServletTestRunner 3 ServletRedirector org.apache.cactus.server.ServletTestRedirector 2 JspRedirector /jspRedirector.jsp ServletTestRunner /ServletTestRunner ServletRedirector /ServletRedirector JspRedirector /JspRedirector MyServlet *.do I hope this helps. Regards, Pedro -----Mensaje original----- De: bryan hansen [mailto:bh5k@yahoo.com] Enviado el: miercoles, 16 de marzo de 2005 21:29 Para: Cactus Users List Asunto: RE: Cactus test and Struts Sorry Pedro, I looked a little closer and noticed that you had it setup that way. I have modified my test case to match yours and I still get a 404 error?!? protected void setUp() throws Exception { dispatcher = request.getRequestDispatcher("/lease/leaseSummary.do"); } public void testAction() throws Exception { dispatcher.forward(request, response); System.out.println("\n\n\n\n\n\n WE HAVE FINISHED THE TEST \n\n\n\n\n\n"); assertTrue(true); } [cactus] 12:18:45,165 DEBUG HttpClientConnectionHelper: >connect = [org.apache.commons.httpclient.util.HttpURLConnection:http://localhost:8080/ gpm-cactus/ServletRedirector?Cactus_TestMethod=testAction&Cactus_TestClass=o rg.lds.ics.pfd.fmat.lease.action.TestLeaseSummaryAction&Cactus_AutomaticSess ion=true&Cactus_Service=CALL_TEST] [cactus] 12:18:45,185 DEBUG AutoReadHttpURLConnection: Original connection = org.apache.commons.httpclient.util.HttpURLConnection:http://localhost:8080/g pm-cactus/ServletRedirector?Cactus_TestMethod=testAction&Cactus_TestClass=or g.lds.ics.pfd.fmat.lease.action.TestLeaseSummaryAction&Cactus_AutomaticSessi on=true&Cactus_Service=CALL_TEST [cactus] 12:18:45,185 DEBUG HttpURLConnection: enter HttpURLConnection.getInputStream() [cactus] 12:18:45,185 DEBUG HttpURLConnection: enter HttpURLConnection.getHeaderField(String) [cactus] 12:18:45,185 DEBUG AutoReadHttpURLConnection: Content-Length : [-1] [cactus] 12:18:45,235 DEBUG HttpURLConnection: enter HttpURLConnection.getHeaderField(String) [cactus] 12:18:45,235 DEBUG wire: << "[\r][\n]" [cactus] 12:18:45,235 DEBUG wire: << "[\r][\n]" [cactus] 12:18:45,235 DEBUG wire: << "[\r][\n]" [cactus] 12:18:45,235 DEBUG wire: << "[\r][\n]" [cactus] 12:18:45,235 DEBUG wire: << "[\r][\n]" [cactus] 12:18:45,235 DEBUG wire: << "[\r][\n]" [cactus] 12:18:45,235 DEBUG wire: << " [\r][\n]" [cactus] 12:18:45,235 DEBUG wire: << " [\r][\n]" [cactus] 12:18:45,235 DEBUG wire: << " [\r][\n]" [cactus] 12:18:45,235 DEBUG wire: << " [\r][\n]" [cactus] 12:18:45,255 DEBUG wire: << " FMAT - 404 Error[\r][\n]" [cactus] 12:18:45,255 DEBUG wire: << " [\r][\n]" [cactus] 12:18:45,255 DEBUG wire: << " [\r][\n]" [cactus] 12:18:45,255 DEBUG wire: << " [\r][\n]" [cactus] 12:18:45,255 DEBUG wire: << " [\r][\n]" [cactus] 12:18:45,255 DEBUG wire: << "
[\r][\n]" --- Pedro Nevado wrote: > Bryan, > > I get the reference in the setUp() method, not in > the begin() or beginXXX(), > so you can use the request object. It is in my code. > Regards, > Pedro > > -----Mensaje original----- > De: bryan hansen [mailto:bh5k@yahoo.com] > Enviado el: miercoles, 16 de marzo de 2005 19:00 > Para: Cactus Users List > Asunto: RE: Cactus test and Struts > > > Pedro how are you getting a reference to the > RequestDispatcher? The WebRequest from Cactus > doesn't > make it available? > > Bryan > > --- Pedro Nevado wrote: > > I use Cactus without StrutsTestCase to test my > > servlet 2.4 applications. > > > > Here it is some code: > > > > public class EmailEnvioActionTest extends > > ServletTestCase { > > > > private static RequestDispatcher dispatcher; > > > > protected void setUp() throws DaoException { > > dispatcher = > > > request.getRequestDispatcher("/email_VistaPrevia_Submit.do"); > > assert dispatcher != null : "dispatcher not > > null"; > > } > > > > public void testCaso_1() throws IOException, > > ServletException { > > dispatcher.forward(request, response); > > } > > > > I do not instantiate in my test an ActionServlet > if > > I want to test an > > Action. I use a dispatcher to put in place all the > > Struts machinery, and I > > focus the test on the request parameters and > > attributes, and the session > > attributes, that I send and what to do with them. > > > > I hope this helps. > > Regards. > > Pedro > > > > -----Mensaje original----- > > De: Nicolas Chalumeau > > [mailto:nicolas.chalumeau@gmail.com] > > Enviado el: miircoles, 16 de marzo de 2005 10:19 > > Para: Cactus Users List > > Asunto: Re: Cactus test and Struts > > > > > > Hi bryan > > > > I will not answer your question as I don't know (I > > didn't search ;) so ...) > > > > I personnally use CactusStrutsTestCase to test my > > Action > > (http://strutstestcase.sourceforge.net/). It > include > > all the > > mechanisme to load the struts-config, execute > plugin > > ... Maybe it > > could solve some of your problems. > > > > If you choose this solution the StrutsTestCase > > mailling should be the > > best place to ask in that case. > > > > Nicolas, > > > > On Tue, 15 Mar 2005 13:41:20 -0800 (PST), bryan > > hansen > > wrote: > > > We are using cactus to test some struts actions. > I > > am > > > getting an error and not sure what the cause is. > > BTW > > > if somebody has found a better way to do this, I > > am > > > open for suggestions. > > > > > > We simply add the URI that we want to request > and > > the > > > appropriate paramaters in the begin method: > > > > > > private void beginAction(WebRequest request) { > > > request.addHeader("URI", > > "/lease/leaseSummary.do"); > > > request.addParameter("command", "viewLease"); > > > request.addParameter("itemId","1301"); > > > request.addParameter("structureId", "1111"); > > > } > > > > > > We then access the action servlet: > > > > > > public void testAction() throws Exception { > > > ActionServlet servlet = new ActionServlet(); > > > servlet.init(config); > > > UserSessionValues usv = new > UserSessionValues(); > > > session.setAttribute("userInfo", usv); > > > > > > servlet.doPost(request, response); > > > > > > UserSessionValues usvSession = > > (UserSessionValues) > > > request.getSession().getAttribute("userInfo"); > > > > > > assertNotNull(usvSession); > > > > > > } > > > > > > The output from this test results in a bunch of > > debug > > > code, but ultimately this: > > > > > > [cactus] 14:09:54,114 DEBUG wire: << > "HTTP/1.1 > > 404 > > > Invalid path /ServletRedirector was > > requested[\r][\n]" > > > > > > I get the same error message on Tomcat and > JBoss. > > > > > > Any ideas? > > > > > > Thanks, > > > > > > Bryan > > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > Tired of spam? Yahoo! Mail has the best spam > > protection around > > > http://mail.yahoo.com > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > > cactus-user-unsubscribe@jakarta.apache.org > > > For additional commands, e-mail: > > cactus-user-help@jakarta.apache.org > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > cactus-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: > > cactus-user-help@jakarta.apache.org > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > cactus-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: > > cactus-user-help@jakarta.apache.org > > > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Sports - Sign up for Fantasy Baseball. > http://baseball.fantasysports.yahoo.com/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > cactus-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: > cactus-user-help@jakarta.apache.org > > > === message truncated === __________________________________ Do you Yahoo!? Make Yahoo! your home page http://www.yahoo.com/r/hs --------------------------------------------------------------------- To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: cactus-user-help@jakarta.apache.org