???Cactus+Jetty????servelt????????
???????????? ???????[ 2013/9/22 10:28:06 ] ????????
??????????
package junitbook.container;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebRequest;
public class TestSampleServletIntegration extends ServletTestCase
{
private SampleServlet servlet;
public static Test suite()
{
System.setProperty("cactus.contextURL"?? "http://localhost:8080/test");// ???????????????
TestSuite suite = new TestSuite("All tests with Jetty");
suite.addTestSuite(TestSampleServletIntegration.class);
return new Jetty5XTestSetup(suite);
}
protected void setUp()
{
servlet = new SampleServlet();
}
public void testIsAuthenticatedAuthenticated()
{
session.setAttribute("authenticated"?? "true");
assertTrue(servlet.isAuthenticated(request));
}
public void testIsAuthenticatedNotAuthenticated()
{
assertFalse(servlet.isAuthenticated(request));
}
public void beginIsAuthenticatedNoSession(WebRequest request)
{
request.setAutomaticSession(false);
}
public void testIsAuthenticatedNoSession()
{
assertFalse(servlet.isAuthenticated(request));
}
}
?????м?????????
????1.??????????ServletTestCase????????session??request??response?????????
????2.jetty?????????????汾?????cactus???а涼?????????jetty????lib??????????????????д?????????????????????????????java.lang.NoSuchMethodException: org.mortbay.jetty.nio.SelectChannelConnector.setPort(java.lang.String)????????????jetty???а??У?setPort????????int????????????????cactus??????????
????3.???????commons codec???jar
????4.???jetty??5.x????Jetty5XTestSetup???????6.x????Jetty6XTestSetup????????????cactus??????jetty5.1.9??org.mortbay.jetty-5.1.9.jar??????????Jetty5XTestSetup??
??????Щ??jetty????????????仹??о?????????????struts2??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11