jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "White, Melissa" <mwh...@triactive.com>
Subject RE: Simple test for my login JSP
Date Mon, 17 Mar 2003 17:27:42 GMT
It's not configured for anything as far as I know.

-----Original Message-----
From: Martin [mailto:mgainty@hotmail.com]
Sent: Friday, March 14, 2003 7:00 PM
To: Cactus Users List
Subject: Re: Simple test for my login JSP


Lets start with the simple stuff what is Port 8081configured for?
-M
----- Original Message -----
From: "White, Melissa" <mwhite@triactive.com>
To: "'Cactus Users List'" <cactus-user@jakarta.apache.org>
Sent: Friday, March 14, 2003 4:23 PM
Subject: RE: Simple test for my login JSP


> Trying that attachment again ...
>
>
>
> -----Original Message-----
> From: White, Melissa [mailto:mwhite@triactive.com]
> Sent: Friday, March 14, 2003 5:17 PM
> To: 'Cactus Users List'
> Subject: RE: Simple test for my login JSP
>
>
> Hmmm... that results in even more problems. Here is the XML output from
> ServletTestRunner. I've also attached my cactus.log file.
>
> <?xml version="1.0" encoding="UTF-8" ?><testsuites><testsuite
> name="com.triactive.webapps.mgr.LoginWebTest" tests="2" failures="0"
> errors="2" time="1.063"><testcase name="testGetJsessionid"
> time="0.875"><error message="String index out of range: 100"
>
type="java.lang.StringIndexOutOfBoundsException">java.lang.StringIndexOutOfB
> oundsException: String index out of range: 100
> at java.lang.String.substring(String.java:1517)
> at
>
org.apache.cactus.client.WebTestResultParser.readRootElement(WebTestResultPa
> rser.java;org/apache/cactus/util/log/LogAspect.aj(1k):149)
> at
>
org.apache.cactus.client.WebTestResultParser.dispatch56_parse(WebTestResultP
> arser.java;org/apache/cactus/util/log/LogAspect.aj(1k):101)
> at
>
org.apache.cactus.client.WebTestResultParser.around56_parse(WebTestResultPar
> ser.java;org/apache/cactus/util/log/LogAspect.aj(1k):1222)
> at
>
org.apache.cactus.client.WebTestResultParser.parse(WebTestResultParser.java;
> org/apache/cactus/util/log/LogAspect.aj(1k):96)
> at
>
org.apache.cactus.client.connector.http.DefaultHttpClient.callGetResult(Defa
> ultHttpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):247)
> at
>
org.apache.cactus.client.connector.http.DefaultHttpClient.dispatch48_doTest(
> DefaultHttpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):126)
> at
>
org.apache.cactus.client.connector.http.DefaultHttpClient.around48_doTest(De
> faultHttpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):1222)
> at
>
org.apache.cactus.client.connector.http.DefaultHttpClient.doTest(DefaultHttp
> Client.java;org/apache/cactus/util/log/LogAspect.aj(1k):115)
> at
>
org.apache.cactus.AbstractWebServerTestCase.runWebTest(AbstractWebServerTest
> Case.java:261)
> at
>
org.apache.cactus.AbstractWebServerTestCase.runGenericTest(AbstractWebServer
> TestCase.java:203)
> at
>
org.apache.cactus.AbstractWebServerTestCase.runTest(AbstractWebServerTestCas
> e.java:277)
> at
>
org.apache.cactus.AbstractClientTestCase.runBare(AbstractClientTestCase.java
> :286)
> at
>
org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner.java
> ;org/apache/cactus/util/log/LogAspect.aj(1k):313)
> at
>
org.apache.cactus.server.runner.ServletTestRunner.dispatch75_doGet(ServletTe
> stRunner.java;org/apache/cactus/util/log/LogAspect.aj(1k):209)
> at
>
org.apache.cactus.server.runner.ServletTestRunner.around75_doGet(ServletTest
> Runner.java;org/apache/cactus/util/log/LogAspect.aj(1k):1151)
> at
>
org.apache.cactus.server.runner.ServletTestRunner.doGet(ServletTestRunner.ja
> va;org/apache/cactus/util/log/LogAspect.aj(1k):185)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1416)
> at
>
allaire.jrun.session.JRunSessionService.service(../session/JRunSessionServic
> e.java:1082)
> at
> allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1270)
> at
>
allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDis
> patcher.java:89)
> at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1552)
> at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1542)
> at
> allaire.jrun.servlet.JvmContext.dispatch(../servlet/JvmContext.java:364)
> at allaire.jrun.http.WebEndpoint.run(../http/WebEndpoint.java:115)
> at allaire.jrun.ThreadPool.run(../ThreadPool.java:272)
> at allaire.jrun.WorkerThread.run(../WorkerThread.java:75)
> </error></testcase><testcase name="testLogin" time="0.032"><error
> message="null"
> type="java.lang.NullPointerException">java.lang.NullPointerException
> at
>
org.apache.cactus.client.connector.http.AbstractConnectionHelper.dispatch32_
>
getCookieString(AbstractConnectionHelper.java;org/apache/cactus/util/log/Log
> Aspect.aj(1k):186)
> at
>
org.apache.cactus.client.connector.http.AbstractConnectionHelper.around32_ge
>
tCookieString(AbstractConnectionHelper.java;org/apache/cactus/util/log/LogAs
> pect.aj(1k):1222)
> at
>
org.apache.cactus.client.connector.http.AbstractConnectionHelper.getCookieSt
>
ring(AbstractConnectionHelper.java;org/apache/cactus/util/log/LogAspect.aj(1
> k):167)
> at
>
org.apache.cactus.client.connector.http.HttpClientConnectionHelper.dispatch4
>
9_connect(HttpClientConnectionHelper.java;org/apache/cactus/util/log/LogAspe
> ct.aj(1k):151)
> at
>
org.apache.cactus.client.connector.http.HttpClientConnectionHelper.around49_
>
connect(HttpClientConnectionHelper.java;org/apache/cactus/util/log/LogAspect
> .aj(1k):1222)
> at
>
org.apache.cactus.client.connector.http.HttpClientConnectionHelper.connect(H
>
ttpClientConnectionHelper.java;org/apache/cactus/util/log/LogAspect.aj(1k):1
> 07)
> at
>
org.apache.cactus.client.connector.http.DefaultHttpClient.callRunTest(Defaul
> tHttpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):196)
> at
>
org.apache.cactus.client.connector.http.DefaultHttpClient.dispatch48_doTest(
> DefaultHttpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):119)
> at
>
org.apache.cactus.client.connector.http.DefaultHttpClient.around48_doTest(De
> faultHttpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):1222)
> at
>
org.apache.cactus.client.connector.http.DefaultHttpClient.doTest(DefaultHttp
> Client.java;org/apache/cactus/util/log/LogAspect.aj(1k):115)
> at
>
org.apache.cactus.AbstractWebServerTestCase.runWebTest(AbstractWebServerTest
> Case.java:261)
> at
>
org.apache.cactus.AbstractWebServerTestCase.runGenericTest(AbstractWebServer
> TestCase.java:203)
> at
>
org.apache.cactus.AbstractWebServerTestCase.runTest(AbstractWebServerTestCas
> e.java:277)
> at
>
org.apache.cactus.AbstractClientTestCase.runBare(AbstractClientTestCase.java
> :286)
> at
>
org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner.java
> ;org/apache/cactus/util/log/LogAspect.aj(1k):313)
> at
>
org.apache.cactus.server.runner.ServletTestRunner.dispatch75_doGet(ServletTe
> stRunner.java;org/apache/cactus/util/log/LogAspect.aj(1k):209)
> at
>
org.apache.cactus.server.runner.ServletTestRunner.around75_doGet(ServletTest
> Runner.java;org/apache/cactus/util/log/LogAspect.aj(1k):1151)
> at
>
org.apache.cactus.server.runner.ServletTestRunner.doGet(ServletTestRunner.ja
> va;org/apache/cactus/util/log/LogAspect.aj(1k):185)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1416)
> at
>
allaire.jrun.session.JRunSessionService.service(../session/JRunSessionServic
> e.java:1082)
> at
> allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1270)
> at
>
allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDis
> patcher.java:89)
> at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1552)
> at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1542)
> at
> allaire.jrun.servlet.JvmContext.dispatch(../servlet/JvmContext.java:364)
> at allaire.jrun.http.WebEndpoint.run(../http/WebEndpoint.java:115)
> at allaire.jrun.ThreadPool.run(../ThreadPool.java:272)
> at allaire.jrun.WorkerThread.run(../WorkerThread.java:75)
> </error></testcase></testsuite></testsuites>
>
>
>
> -----Original Message-----
> From: Jason Arndt [mailto:jarndt196@yahoo.com]
> Sent: Friday, March 14, 2003 4:55 PM
> To: Cactus Users List
> Subject: Re: Simple test for my login JSP
>
>
> Have you LoginWebTest extend JspTestCase instead of
> ServletTestCase.
>
> --- "White, Melissa" <mwhite@triactive.com> wrote:
> > I am trying to use Cactus to unit test our JSPs, but
> > am having difficulty
> > getting a simple test to work. I have a test case
> > defined as follows:
> >
> > public class LoginWebTest extends ServletTestCase
> > {
> >   private static Cookie jsessionid = null;
> >
> >   public LoginWebTest(String name)
> >   {
> >     super(name);
> >   }
> >
> >   public static void main(String[] args)
> >   {
> >     junit.textui.TestRunner.run(suite());
> >   }
> >
> >   public static Test suite()
> >   {
> >     final TestSuite suite = new TestSuite();
> >     suite.addTest(new
> > LoginWebTest("testGetJsessionid"));
> >     suite.addTest(new LoginWebTest("testLogin"));
> >     return suite;
> >   }
> >   public void beginGetJsessionid(WebRequest
> > webRequest)
> >   {
> >     webRequest.setURL("localhost:8101", "",
> > "/portal/login.jsp", null,
> > null);
> >   }
> >
> >   public void testGetJsessionid() {}
> >
> >   public void endGetJsessionid(WebResponse
> > webResponse)
> >   {
> >     Cookie c =
> > webResponse.getCookieIgnoreCase("jsessionid");
> >     assertNotNull(c);
> >     this.jsessionid = c;
> >   }
> >
> >   public void beginLogin(WebRequest webRequest)
> >   {
> >     webRequest.setURL("localhost:8101", "",
> > "/portal/doLogin.jsp", null,
> > null);
> >     webRequest.addParameter("company", "mwhite");
> >     webRequest.addParameter("username", "admin");
> >     webRequest.addParameter("password", "adminpwd");
> >   }
> >
> >   public void testLogin()
> >   {
> >     assertEquals("mwhite",
> > request.getParameter("company"));
> >     SpecialistValue sv =
> >
> (SpecialistValue)session.getAttribute(SpecialistKeys.CURRENT);
> >     assertNotNull("SpecialistValue not found in
> > session", sv);
> >   }
> > }
> >
> > The assertNotNull in testLogin fails, but it is not
> > clear to me that
> > doLogin.jsp is ever being reached. If it is, there
> > should be some output in
> > my JRun log, but there is none. After doLogin.jsp is
> > executed, I should be
> > able to retrieve the SpecialistValue object from the
> > session. Am I missing
> > something?
> >
> > I'm using JRun 3.1.  Any help would be greatly
> > appreciated.
> >
> > -- Melissa
> >
> >
> ---------------------------------------------------------------------
> > 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! Web Hosting - establish your business online
> http://webhosting.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

Mime
View raw message