You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Meir Kalter <me...@openu.ac.il> on 2005/07/28 14:21:31 UTC

End handler happened before every page I am checking does not com e

I am using cactus jakarta-cactus-13-1.7


I will start with part of my code:


	public void beginMainData(WebRequest theRequest)
	{
        //		 Set up HTTP related parameters
	    theRequest.setURL("myserver", "/app", "/index2.html",
	        null, null);
	  

	}

	public void endMainData(com.meterware.httpunit.WebResponse
theResponse)
	{

		      WebTable table = null;
		      String title = null;
			try {
				assertNull(null);
				title = theResponse.getTitle();
				assertEquals("test",title);
{}
What need to be happen is that the index2.html will be received , then the
function endMainData will be happened.
The page contains just title  (and one line ): 


<HTML><TITLE>
<title>test</title>
<BODY>
<H1> test</H1>
</BODY>
</HTML>

 the results of the test is :


- <testcase name="testMainData" time="2.529"> 
<failure message="expected:<test> but was:<>"
type="junit.framework.ComparisonFailure">junit.framework.ComparisonFailure:
expected:<test> but was:<> 

I understand - that the requested page is not been called.

       If some body can help - explain to me what exectly to do - thanks.
     meir



Re: End handler happened before every page I am checking does not com e

Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi Meir,

In article <84...@arava.openu.local>,
Thu, 28 Jul 2005 14:21:31 +0200,
Meir Kalter <me...@openu.ac.il> wrote: 
meirka> I will start with part of my code:
meirka> 
meirka> 	public void beginMainData(WebRequest theRequest)
meirka> 	{
meirka>         //		 Set up HTTP related parameters
meirka> 	    theRequest.setURL("myserver", "/app", "/index2.html",
meirka> 	        null, null);
meirka> 	}
meirka> 
meirka> 	public void endMainData(com.meterware.httpunit.WebResponse
meirka> theResponse)
meirka> 	{
meirka> 		      WebTable table = null;
meirka> 		      String title = null;
meirka> 			try {
meirka> 				assertNull(null);
meirka> 				title = theResponse.getTitle();
meirka> 				assertEquals("test",title);
meirka> {}
meirka> What need to be happen is that the index2.html will be received , then the
meirka> function endMainData will be happened.

Could you show us testMainData method?
The testMainData() method should call appropriate methods
to write the page content to the output-stream of the response object.

Use of WebRequest#setURL method does not mean that
we can get the specified resource as a WebResponse instance.
The method is provided to control value returned by some methods of
javax.servlet.http.HttpServletRequest, getPathInfo() for example,
so that we can easily test behavior of server-side methods
depending on value of requested URL.

Regards,
----
Kazuhito SUGURI