I have the following method that keeps failing and I don't know why. The method
should really only set a NavigationBean into session, then forward to a page
based on the action parameter.
================================================================
public void testProductSelection() throws Exception {
// JUnitDoclet begin method productSelection
NavigationBean navigationBean = null;
java.lang.String[] productSelectionRequired = {
"requiredif.productSelectionRequired" };
java.lang.String[] reqParamNames = { "action",
"businessLineSelected",
"businessCardSelected",
"businessSecuredCardSelected",
"equipmentExpressSelected"
};
java.lang.String[] reqParamValue0 = { "nextPage", "true",
"false", "false", "false", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue1 = { "nextPage", "false",
"true", "false", "false", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue2 = { "nextPage", "false",
"false", "true", "false", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue3 = { "nextPage", "false",
"false", "false", "true", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue4 = { "nextPage", "true",
"true", "false", "false", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue5 = { "nextPage", "true",
"false", "true", "false", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue6 = { "nextPage", "true",
"false", "false", "true", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue7 = { "nextPage", "false",
"true", "true", "false", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue8 = { "nextPage", "false",
"true", "false", "true", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue9 = { "nextPage", "false",
"false", "true", "true", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue10 = { "business", "true",
"true", "true", "true", Constants.BUSINESS_FWD };
java.lang.String[] reqParamValue11 = { "firstOwner",
"true", "true", "true", "true", Constants.FIRSTOWNER_FWD };
java.lang.String[] reqParamValue12 = { "secondOwner",
"true", "true", "true", "true", Constants.SECONDOWNER_FWD };
java.lang.String[] reqParamValue13 = { "businessLine",
"true", "true", "true", "true", "prepareBusinessLine" };
java.lang.String[] reqParamValue14 = { "businessCard",
"true", "true", "true", "true", "prepareBusinessCard" };
java.lang.String[] reqParamValue15 = { "securedCard",
"true", "true", "true", "true", "prepareSecuredCard" };
java.lang.String[] reqParamValue16 = { "equipmentExpress",
"true", "true", "true", "true", "prepareEquipmentExpress" };
java.lang.String[] reqParamValue17 = { "conclude", "true",
"true", "true", "true", Constants.BUSINESS_FWD };
java.lang.Object[] reqParamValues = { reqParamValue0,
reqParamValue1, reqParamValue2, reqParamValue3,
reqParamValue4,
reqParamValue5, reqParamValue6, reqParamValue7,
reqParamValue8,
reqParamValue9, reqParamValue10, reqParamValue11,
reqParamValue12,
reqParamValue13, reqParamValue14, reqParamValue15,
reqParamValue16,
reqParamValue17
};
//----- NO Products
---------------------------------------------------------//
setRequestPathInfo("/productSelection");
addRequestParameter("action", "nextPage");
addRequestParameter("businessLineSelected", "false");
addRequestParameter("businessCardSelected", "false");
addRequestParameter("businessSecuredCardSelected", "false");
addRequestParameter("equipmentExpressSelected", "false");
actionPerform();
verifyActionErrors( productSelectionRequired );
verifyForward( Constants.ERROR_FWD );
//----- Various Products
----------------------------------------------------//
setRequestPathInfo("/productSelection");
for( int i=0; i<reqParamValues.length; i++ ){
String[] reqParamValue = (String[])reqParamValues[i];
log.info(
"//------------------------------------------------------------------------//"
);
log.info( "reqParamValue " + i + " name is " +
reqParamValues[i].getClass().getName().toString() );
log.info( "setRequestPathInfo( /productSelection )" );
addRequestParameter( reqParamNames[0], reqParamValue[0] );
addRequestParameter( reqParamNames[1], reqParamValue[1] );
addRequestParameter( reqParamNames[2], reqParamValue[2] );
addRequestParameter( reqParamNames[3], reqParamValue[3] );
addRequestParameter( reqParamNames[4], reqParamValue[4] );
log.info(
"----------------------------------------------------------------------------"
);
log.info( "reqParamNames[0]: " +
reqParamNames[0].toString() );
log.info( "reqParamNames[1]: " +
reqParamNames[1].toString() );
log.info( "reqParamNames[2]: " +
reqParamNames[2].toString() );
log.info( "reqParamNames[3]: " +
reqParamNames[3].toString() );
log.info( "reqParamNames[4]: " +
reqParamNames[4].toString() );
log.info(
"----------------------------------------------------------------------------"
);
log.info( "reqParamValue[0]: " +
reqParamValue[0].toString() );
log.info( "reqParamValue[1]: " +
reqParamValue[1].toString() );
log.info( "reqParamValue[2]: " +
reqParamValue[2].toString() );
log.info( "reqParamValue[3]: " +
reqParamValue[3].toString() );
log.info( "reqParamValue[4]: " +
reqParamValue[4].toString() );
log.info(
"----------------------------------------------------------------------------"
);
try{
actionPerform();
} catch( Exception e ){
log.error(e.getMessage() );
e.printStackTrace();
}
verifyNoActionErrors();
log.info( "actionForwards: " + reqParamValue[5].toString()
);
log.info( "getActualForward: " + getActualForward() );
verifyForward( reqParamValue[5] );
navigationBean = (NavigationBean) getSession().getAttribute(
Constants.NAVIGATION_BEAN );
assertTrue( "NavigationBean is null", navigationBean !=
null );
log.info(
"//------------------------------------------------------------------------//"
);
}
//----- END...
--------------------------------------------------------------//
// JUnitDoclet end method productSelection
}
I get this error on the 14th iteration:
=============================================
java.lang.IllegalStateException: response already committed
at
weblogic.servlet.internal.ServletResponseImpl.sendRedirect(ServletResponseImpl.java:584)
at
servletunit.struts.StrutsResponseWrapper.sendRedirect(StrutsResponseWrapper.java:154)
at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:385)
at
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:316)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at
servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCase.java:537)
at
com.wf.bd.ice.creditapplication.CreditApplicationActionsTest.testProductSelection(CreditApplicationActionsTest.java:195)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
at
org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:124)
at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
at
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
at
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:124)
at
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
at
org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
at
org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:124)
at
org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
--------------------
Mick Knutson
Wells Fargo Business Direct Information Systems
(415) 222-1020
"This message may contain confidential and/or privileged information. If you
are not the addressee or authorized to receive this for the addressee, you must
not use, copy, disclose, or take any action based on this message or any
information herein. If you have received this message in error, please advise
the sender immediately by reply e-mail and delete this message. Thank you for
your cooperation."
--------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]