jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 楼 14 <floor14_...@hotmail.com>
Subject HELP;Missing Cactus property [cactus.contextURL]
Date Sun, 21 Mar 2004 12:44:28 GMT
please help me!
=====error code:
testSaveToSessionOK(TestSampleServlet)org.apache.cactus.util.ChainedRuntimeException: 
Missing Cactus property [cactus.contextURL]
	at 
org.apache.cactus.configuration.BaseConfiguration.getContextURL(BaseConfiguration.java:114)

	at 
org.apache.cactus.configuration.AbstractWebConfiguration.getRedirectorURL_aroundBody0(AbstractWebConfiguration.java:85)

	at 
org.apache.cactus.configuration.AbstractWebConfiguration.getRedirectorURL_aroundBody1$advice(AbstractWebConfiguration.java:240)

	at 
org.apache.cactus.configuration.AbstractWebConfiguration.getRedirectorURL(AbstractWebConfiguration.java)

	at 
org.apache.cactus.client.connector.http.DefaultHttpClient.callRunTest(DefaultHttpClient.java:197)

	at 
org.apache.cactus.client.connector.http.DefaultHttpClient.doTest_aroundBody0(DefaultHttpClient.java:119)

	at 
org.apache.cactus.client.connector.http.DefaultHttpClient.doTest_aroundBody1$advice(DefaultHttpClient.java:240)

	at 
org.apache.cactus.client.connector.http.DefaultHttpClient.doTest(DefaultHttpClient.java)

	at 
org.apache.cactus.internal.client.WebClientTestCaseDelegate.runWebTest(WebClientTestCaseDelegate.java:333)

	at 
org.apache.cactus.internal.client.WebClientTestCaseDelegate.runGenericTest(WebClientTestCaseDelegate.java:281)

	at 
org.apache.cactus.internal.client.WebClientTestCaseDelegate.runTest(WebClientTestCaseDelegate.java:257)

	at 
org.apache.cactus.ServletTestCase.runCactusTest(ServletTestCase.java:300)
	at org.apache.cactus.ServletTestCase.runBare(ServletTestCase.java:263)
	at TestSampleServlet.main(TestSampleServlet.java:46)

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1

=======source code:
import java.io.IOException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebRequest;
import org.apache.cactus.WebResponse;

public class TestSampleServlet extends ServletTestCase
{
	public TestSampleServlet(String theName)
	{
		super(theName);
	}

	public static Test suite()
	{
		return new TestSuite(TestSampleServlet.class);
	}

public void setup(){
}

public void teardown(){
}

  
	public void beginSaveToSessionOK(WebRequest webRequest)
	{
		webRequest.addParameter("testparam", "it works!");
		webRequest.setURL("localhost:8080", "/cactus_test", "/SampleServlet" 
,null, null);
	}


	public void testSaveToSessionOK() throws IOException
	{
		SampleServlet servlet = new SampleServlet();
		servlet.saveToSession(request);
		assertEquals("it works!", session.getAttribute("testAttribute"));
	}

	public void endSaveToSessionOK(WebResponse theResponse){
		System.out.println(theResponse.getText());
	}
	public static void main(String[] args)
	{
		junit.textui.TestRunner.main(new 
String[]{TestSampleServlet.class.getName()});
	}
}

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com  


Mime
View raw message