- 浏览: 5068 次
- 性别:
- 来自: 大连
最新评论
-
chimpp55:
这个怎么解决
struts test -
chimpp55:
能做成一个工程,然后我导进去就可以跑,TRA 2017/1 ...
struts test
public class LoginAction extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
String username = ((LoginForm) form).getUsername();
String password = ((LoginForm) form).getPassword();
ActionErrors errors = new ActionErrors();
if ((!username.equals("deryl")) || (!password.equals("radar")))
errors.add("password",new ActionError("error.password.mismatch"));
if (!errors.empty()) {
saveErrors(request,errors);
return mapping.findForward("login");
}
// store authentication info on the session
HttpSession session = request.getSession();
session.setAttribute("authentication", username);
// Forward control to the specified success URI
return mapping.findForward("success");
}
public class TestLoginAction extends MockStrutsTestCase {
public void setUp() { super.setUp(); }
public void tearDown() { super.tearDown(); }
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
actionPerform();
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
actionPerform();
verifyForward("success");
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
actionPerform();
verifyForward("success");
assertEquals("deryl",(String) getSession().getAttribute("authentication"));
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
actionPerform();
verifyForward("success");
assertEquals("deryl",(String) getSession().getAttribute("authentication"));
verifyNoActionErrors();
}
}
public void testFailedLogin() {
addRequestParameter("username","deryl");
addRequestParameter("password","express");
setRequestPathInfo("/login");
actionPerform();
verifyForward("login");
verifyActionErrors(new String[] {"error.password.mismatch"});
assertNull((String) getSession().getAttribute("authentication"));
}
URL:http://homepage2.nifty.com/ymagic/struts/OtherTranslate/StrutsTestCase/index.html
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
String username = ((LoginForm) form).getUsername();
String password = ((LoginForm) form).getPassword();
ActionErrors errors = new ActionErrors();
if ((!username.equals("deryl")) || (!password.equals("radar")))
errors.add("password",new ActionError("error.password.mismatch"));
if (!errors.empty()) {
saveErrors(request,errors);
return mapping.findForward("login");
}
// store authentication info on the session
HttpSession session = request.getSession();
session.setAttribute("authentication", username);
// Forward control to the specified success URI
return mapping.findForward("success");
}
public class TestLoginAction extends MockStrutsTestCase {
public void setUp() { super.setUp(); }
public void tearDown() { super.tearDown(); }
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
actionPerform();
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
actionPerform();
verifyForward("success");
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
actionPerform();
verifyForward("success");
assertEquals("deryl",(String) getSession().getAttribute("authentication"));
}
}
public class TestLoginAction extends MockStrutsTestCase {
public TestLoginAction(String testName) { super(testName); }
public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","deryl");
addRequestParameter("password","radar");
actionPerform();
verifyForward("success");
assertEquals("deryl",(String) getSession().getAttribute("authentication"));
verifyNoActionErrors();
}
}
public void testFailedLogin() {
addRequestParameter("username","deryl");
addRequestParameter("password","express");
setRequestPathInfo("/login");
actionPerform();
verifyForward("login");
verifyActionErrors(new String[] {"error.password.mismatch"});
assertNull((String) getSession().getAttribute("authentication"));
}
URL:http://homepage2.nifty.com/ymagic/struts/OtherTranslate/StrutsTestCase/index.html
- strutstest214-1.2_2.4.zip (2.6 MB)
- 下载次数: 2
评论
2 楼
chimpp55
2017-01-23
这个怎么解决
1 楼
chimpp55
2017-01-23
能做成一个工程,然后我导进去就可以跑,
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Entering - actionPath = /login, forwardName = success, actualForwardPath = null (Common.java#verifyForwardPath:242)
DEB 2017/1/23 09:44:47.707 [main] - - HotelId:- - - processing normal forward (Common.java#verifyForwardPath:271)
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Entering - mappingName = /login, forwardName = success, request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d (Common.java#findForward:421)
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Entering - mappingName = /login, request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d (Common.java#getActionConfig:448)
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Entering - request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d (Common.java#getModuleConfig:464)
DEB 2017/1/23 09:44:47.707 [main] - - HotelId:- - - looking for config in request context (Common.java#getModuleConfig:466)
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Exiting - returning org.apache.struts.config.impl.ModuleConfigImpl@52dd99 (Common.java#getModuleConfig:476)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - retrieved mapping = ActionConfig[path=/login,input=/login.jsp,name=loginForm,scope=request,type=jp.co.seanuts.rspl.msc.mscfc40.mscsc4000.LoginAction (Common.java#getActionConfig:452)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Exiting (Common.java#getActionConfig:455)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - looking for forward globally (Common.java#findForward:431)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Entering - request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d (Common.java#getModuleConfig:464)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - looking for config in request context (Common.java#getModuleConfig:466)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Exiting - returning org.apache.struts.config.impl.ModuleConfigImpl@52dd99 (Common.java#getModuleConfig:476)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - retrieved forward = ForwardConfig[name=success,path=/success.jsp,redirect=false,contextRelative=false] (Common.java#findForward:436)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Exiting (Common.java#findForward:439)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - retrieved forward name = /success.jsp (Common.java#verifyForwardPath:287)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Entering - forwardPath = /success.jsp, request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d, config = servletunit.ServletConfigSimulator@9a1621 (Common.java#getTilesForward:136)
TRA 2017/1/23 09:44:47.727 [main] - - HotelId:- - - Exiting - caught DefinitionsFactoryException (Common.java#getTilesForward:173)
DEB 2017/1/23 09:44:47.727 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#getActionServlet:319)
DEB 2017/1/23 09:44:47.727 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#getActionServlet:348)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - servlet = org.apache.struts.action.ActionServlet@37668f (MockStrutsTestCase.java#setActionServlet:359)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setActionServlet:365)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#setUp:115)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setUp:126)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - contextDirectory = C:\rspl\workspace\rspl_web\WebContent (MockStrutsTestCase.java#setContextDirectory:527)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setContextDirectory:532)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - pathName = C:\rspl\workspace\rspl_web\src\msc\jp\co\seanuts\rspl\msc\mscfc40\mscsc4000\struts-config.xml (MockStrutsTestCase.java#setConfigFile:543)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - moduleName = null, pathname =C:\rspl\workspace\rspl_web\src\msc\jp\co\seanuts\rspl\msc\mscfc40\mscsc4000\struts-config.xml (MockStrutsTestCase.java#setConfigFile:561)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setConfigFile:569)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setConfigFile:547)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - key = validating, value = false (MockStrutsTestCase.java#setInitParameter:511)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setInitParameter:516)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - parameterName = username, parameterValue = deryl (MockStrutsTestCase.java#addRequestParameter:424)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#addRequestParameter:428)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - parameterName = password, parameterValue = express (MockStrutsTestCase.java#addRequestParameter:424)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#addRequestParameter:428)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - pathInfo = /login (MockStrutsTestCase.java#setRequestPathInfo:457)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - moduleName = , pathInfo = /login (MockStrutsTestCase.java#setRequestPathInfo:480)
TRA 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Entering - path = /login (Common.java#stripActionPath:349)
TRA 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Exiting - returning path = /login (Common.java#stripActionPath:358)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - setting request attribute - name = javax.servlet.include.servlet_path, value = (MockStrutsTestCase.java#setRequestPathInfo:491)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setRequestPathInfo:498)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setRequestPathInfo:461)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#actionPerform:382)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#getActionServlet:319)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - intializing actionServlet (MockStrutsTestCase.java#getActionServlet:324)
INF 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Initializing, config='org.apache.struts.action.ActionResources', returnNull=true (PropertyMessageResources.java#<init>:127)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#getActionServlet:348)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#actionPerform:412)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Entering - forwardName = login (MockStrutsTestCase.java#verifyForward:673)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#getActualForward:640)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - caught NullPointerException - returning null (MockStrutsTestCase.java#getActualForward:654)
java.lang.NullPointerException
at servletunit.struts.MockStrutsTestCase.getActualForward(MockStrutsTestCase.java:645)
at servletunit.struts.MockStrutsTestCase.verifyForward(MockStrutsTestCase.java:675)
at jp.co.seanuts.rspl.msc.mscfc40.mscsc4000.TestLoginAction.testFailedLogin(TestLoginAction.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
TRA 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Entering - actionPath = /login, forwardName = login, actualForwardPath = null (Common.java#verifyForwardPath:242)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - processing normal forward (Common.java#verifyForwardPath:271)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - mappingName = /login, forwardName = login, request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0 (Common.java#findForward:421)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - mappingName = /login, request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0 (Common.java#getActionConfig:448)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0 (Common.java#getModuleConfig:464)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - looking for config in request context (Common.java#getModuleConfig:466)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting - returning org.apache.struts.config.impl.ModuleConfigImpl@1588de9 (Common.java#getModuleConfig:476)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - retrieved mapping = ActionConfig[path=/login,input=/login.jsp,name=loginForm,scope=request,type=jp.co.seanuts.rspl.msc.mscfc40.mscsc4000.LoginAction (Common.java#getActionConfig:452)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting (Common.java#getActionConfig:455)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - looking for forward globally (Common.java#findForward:431)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0 (Common.java#getModuleConfig:464)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - looking for config in request context (Common.java#getModuleConfig:466)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting - returning org.apache.struts.config.impl.ModuleConfigImpl@1588de9 (Common.java#getModuleConfig:476)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - retrieved forward = ForwardConfig[name=login,path=/login.jsp,redirect=false,contextRelative=false] (Common.java#findForward:436)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting (Common.java#findForward:439)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - retrieved forward name = /login.jsp (Common.java#verifyForwardPath:287)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - forwardPath = /login.jsp, request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0, config = servletunit.ServletConfigSimulator@a663a4 (Common.java#getTilesForward:136)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting - caught DefinitionsFactoryException (Common.java#getTilesForward:173)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#getActionServlet:319)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#getActionServlet:348)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - servlet = org.apache.struts.action.ActionServlet@4b3b20 (MockStrutsTestCase.java#setActionServlet:359)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setActionServlet:365)
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Entering - actionPath = /login, forwardName = success, actualForwardPath = null (Common.java#verifyForwardPath:242)
DEB 2017/1/23 09:44:47.707 [main] - - HotelId:- - - processing normal forward (Common.java#verifyForwardPath:271)
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Entering - mappingName = /login, forwardName = success, request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d (Common.java#findForward:421)
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Entering - mappingName = /login, request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d (Common.java#getActionConfig:448)
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Entering - request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d (Common.java#getModuleConfig:464)
DEB 2017/1/23 09:44:47.707 [main] - - HotelId:- - - looking for config in request context (Common.java#getModuleConfig:466)
TRA 2017/1/23 09:44:47.707 [main] - - HotelId:- - - Exiting - returning org.apache.struts.config.impl.ModuleConfigImpl@52dd99 (Common.java#getModuleConfig:476)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - retrieved mapping = ActionConfig[path=/login,input=/login.jsp,name=loginForm,scope=request,type=jp.co.seanuts.rspl.msc.mscfc40.mscsc4000.LoginAction (Common.java#getActionConfig:452)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Exiting (Common.java#getActionConfig:455)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - looking for forward globally (Common.java#findForward:431)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Entering - request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d (Common.java#getModuleConfig:464)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - looking for config in request context (Common.java#getModuleConfig:466)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Exiting - returning org.apache.struts.config.impl.ModuleConfigImpl@52dd99 (Common.java#getModuleConfig:476)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - retrieved forward = ForwardConfig[name=success,path=/success.jsp,redirect=false,contextRelative=false] (Common.java#findForward:436)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Exiting (Common.java#findForward:439)
DEB 2017/1/23 09:44:47.717 [main] - - HotelId:- - - retrieved forward name = /success.jsp (Common.java#verifyForwardPath:287)
TRA 2017/1/23 09:44:47.717 [main] - - HotelId:- - - Entering - forwardPath = /success.jsp, request = servletunit.HttpServletRequestSimulator@dbd887, context = servletunit.ServletContextSimulator@164b39d, config = servletunit.ServletConfigSimulator@9a1621 (Common.java#getTilesForward:136)
TRA 2017/1/23 09:44:47.727 [main] - - HotelId:- - - Exiting - caught DefinitionsFactoryException (Common.java#getTilesForward:173)
DEB 2017/1/23 09:44:47.727 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#getActionServlet:319)
DEB 2017/1/23 09:44:47.727 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#getActionServlet:348)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - servlet = org.apache.struts.action.ActionServlet@37668f (MockStrutsTestCase.java#setActionServlet:359)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setActionServlet:365)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#setUp:115)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setUp:126)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - contextDirectory = C:\rspl\workspace\rspl_web\WebContent (MockStrutsTestCase.java#setContextDirectory:527)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setContextDirectory:532)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - pathName = C:\rspl\workspace\rspl_web\src\msc\jp\co\seanuts\rspl\msc\mscfc40\mscsc4000\struts-config.xml (MockStrutsTestCase.java#setConfigFile:543)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - moduleName = null, pathname =C:\rspl\workspace\rspl_web\src\msc\jp\co\seanuts\rspl\msc\mscfc40\mscsc4000\struts-config.xml (MockStrutsTestCase.java#setConfigFile:561)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setConfigFile:569)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setConfigFile:547)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - key = validating, value = false (MockStrutsTestCase.java#setInitParameter:511)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setInitParameter:516)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - parameterName = username, parameterValue = deryl (MockStrutsTestCase.java#addRequestParameter:424)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#addRequestParameter:428)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - parameterName = password, parameterValue = express (MockStrutsTestCase.java#addRequestParameter:424)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#addRequestParameter:428)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - pathInfo = /login (MockStrutsTestCase.java#setRequestPathInfo:457)
DEB 2017/1/23 09:44:47.737 [main] - - HotelId:- - - Entering - moduleName = , pathInfo = /login (MockStrutsTestCase.java#setRequestPathInfo:480)
TRA 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Entering - path = /login (Common.java#stripActionPath:349)
TRA 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Exiting - returning path = /login (Common.java#stripActionPath:358)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - setting request attribute - name = javax.servlet.include.servlet_path, value = (MockStrutsTestCase.java#setRequestPathInfo:491)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setRequestPathInfo:498)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setRequestPathInfo:461)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#actionPerform:382)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#getActionServlet:319)
DEB 2017/1/23 09:44:47.747 [main] - - HotelId:- - - intializing actionServlet (MockStrutsTestCase.java#getActionServlet:324)
INF 2017/1/23 09:44:47.747 [main] - - HotelId:- - - Initializing, config='org.apache.struts.action.ActionResources', returnNull=true (PropertyMessageResources.java#<init>:127)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#getActionServlet:348)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#actionPerform:412)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Entering - forwardName = login (MockStrutsTestCase.java#verifyForward:673)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#getActualForward:640)
DEB 2017/1/23 09:44:47.777 [main] - - HotelId:- - - caught NullPointerException - returning null (MockStrutsTestCase.java#getActualForward:654)
java.lang.NullPointerException
at servletunit.struts.MockStrutsTestCase.getActualForward(MockStrutsTestCase.java:645)
at servletunit.struts.MockStrutsTestCase.verifyForward(MockStrutsTestCase.java:675)
at jp.co.seanuts.rspl.msc.mscfc40.mscsc4000.TestLoginAction.testFailedLogin(TestLoginAction.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
TRA 2017/1/23 09:44:47.777 [main] - - HotelId:- - - Entering - actionPath = /login, forwardName = login, actualForwardPath = null (Common.java#verifyForwardPath:242)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - processing normal forward (Common.java#verifyForwardPath:271)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - mappingName = /login, forwardName = login, request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0 (Common.java#findForward:421)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - mappingName = /login, request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0 (Common.java#getActionConfig:448)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0 (Common.java#getModuleConfig:464)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - looking for config in request context (Common.java#getModuleConfig:466)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting - returning org.apache.struts.config.impl.ModuleConfigImpl@1588de9 (Common.java#getModuleConfig:476)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - retrieved mapping = ActionConfig[path=/login,input=/login.jsp,name=loginForm,scope=request,type=jp.co.seanuts.rspl.msc.mscfc40.mscsc4000.LoginAction (Common.java#getActionConfig:452)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting (Common.java#getActionConfig:455)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - looking for forward globally (Common.java#findForward:431)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0 (Common.java#getModuleConfig:464)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - looking for config in request context (Common.java#getModuleConfig:466)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting - returning org.apache.struts.config.impl.ModuleConfigImpl@1588de9 (Common.java#getModuleConfig:476)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - retrieved forward = ForwardConfig[name=login,path=/login.jsp,redirect=false,contextRelative=false] (Common.java#findForward:436)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting (Common.java#findForward:439)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - retrieved forward name = /login.jsp (Common.java#verifyForwardPath:287)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - forwardPath = /login.jsp, request = servletunit.HttpServletRequestSimulator@143b5da, context = servletunit.ServletContextSimulator@5821d0, config = servletunit.ServletConfigSimulator@a663a4 (Common.java#getTilesForward:136)
TRA 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting - caught DefinitionsFactoryException (Common.java#getTilesForward:173)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering (MockStrutsTestCase.java#getActionServlet:319)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#getActionServlet:348)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Entering - servlet = org.apache.struts.action.ActionServlet@4b3b20 (MockStrutsTestCase.java#setActionServlet:359)
DEB 2017/1/23 09:44:47.787 [main] - - HotelId:- - - Exiting (MockStrutsTestCase.java#setActionServlet:365)
相关推荐
Struts Test Plugin for Eclipse 是一个开源的开发工具,专为Eclipse IDE设计,旨在帮助Java开发者更高效地进行Struts框架应用的测试工作。这款插件的核心功能是自动生成和重用测试类以及测试数据,这极大地提高了...
"Struts2_Test"这个项目可能是一个用于演示或测试Struts2框架特性的实例,特别是侧重于“拦截器”的使用。 拦截器在Struts2框架中扮演着至关重要的角色。它们是AOP(面向切面编程)的一个实现,允许开发者在动作...
- **Struts1**:由于execute方法直接与Servlet API交互,测试较为复杂,通常需要第三方工具如Struts Test Case。 - **Struts2**:Struts2的Action可以独立实例化进行测试,属性设置和方法调用更加直接,依赖注入的...
使用JUnit进行单元测试,Struts Test或者MockMVC进行模拟请求测试,确保系统功能的正确性。同时,使用Eclipse或IntelliJ IDEA等IDE的调试工具可以方便地定位和修复问题。 通过以上步骤,我们可以构建一个完整的...
9. **测试**:Struts应用通常使用JUnit进行单元测试,Struts Test和WebUnit用于集成测试,确保系统的正确性。 了解了Struts框架的基础知识后,我们可以看到这个图书馆管理系统利用Struts提供的组件和服务,实现了...
对于测试,书中也提供了关于JUnit和Struts Test的实践指导,强调了单元测试和集成测试在保证代码质量中的重要性。最后,作者还分享了一些最佳实践和项目管理经验,帮助读者在实际工作中避免常见问题,提升开发效率。...
- **Struts1**:由于`execute`方法直接暴露Servlet API,测试较为困难,需要第三方工具如Struts Test Case。 - **Struts2**:Action可以通过实例化测试,支持依赖注入,使得测试更简单。 5. **输入数据处理** - ...
Struts支持JUnit进行单元测试,Struts Test或StrutsTestCase则可以帮助进行集成测试,确保Action和ActionMapping的正确性。 通过以上介绍,我们可以看到Struts图书馆管理系统是如何利用MVC架构来构建一个功能完善的...
而Struts Test或MockMVC可以用来模拟HTTP请求,对Action进行集成测试。 总的来说,这个毕业设计项目涵盖了Java Web开发的多个重要方面,对于学习和理解Struts框架及其在实际项目中的应用具有很高的价值。通过实践...
Struts Test Harness库可以帮助进行Struts特定的测试。 学习"Struts中文手册",开发者不仅能掌握Struts框架的基本概念和用法,还能了解到如何在实际项目中有效地应用Struts,提升Web应用的开发效率和质量。这个手册...
9. **测试支持(Testing Support)**:Struts2为单元测试和集成测试提供了支持,可以通过Mock对象和Struts Test插件进行测试。 10. **配置管理(Configuration Management)**:Struts2的配置可以通过XML、注解或者...
10. **测试**:为了保证系统的稳定性和可靠性,开发过程中可能使用JUnit进行单元测试,而Struts Test或者Selenium可能用于集成测试和功能测试。 综上所述,Struts文章系统是一个集成了Struts框架、MVC模式、数据库...
可以使用JUnit、Mockito等工具对Spring Bean进行单元测试,而Struts的Action可以通过Struts Test或者Mock Struts进行模拟测试。 9. **最佳实践**:在实际开发中,应遵循良好的设计原则,如单一职责原则、开闭原则等...
9. **测试与调试**:在实际开发中,可能会有JUnit单元测试和Struts Test套件来确保代码的正确性。同时,利用IDE(如Eclipse或IntelliJ IDEA)的调试工具可以帮助开发者定位和修复问题。 10. **数据库交互**:此项目...
10. **单元测试与集成测试**:为了保证项目的稳定性和质量,开发者通常会编写JUnit测试用例,对Action、Service、DAO等进行单元测试,以及使用像Struts Test这样的工具进行集成测试。 通过这个小项目,初学者可以...
9. **测试框架(Integration Testing)**:如Struts Test或JUnit,用于对Struts 2应用进行单元测试和集成测试,确保代码质量。 10. **安全(Security)**:Struts 2的安全方面可能包括防止XSS(跨站脚本攻击)、CSRF...
10. **测试与调试**:在开发过程中,单元测试(JUnit)和集成测试(如Struts Test)是必不可少的,它们帮助开发者确保代码的质量和功能的正确性。 11. **部署与运行**:最后,将所有文件打包成WAR文件,部署到...