Hopefully there are some experts there. I've been working on this for days and am so frustrated I'm about to quit. Currently it is failing within the action class and throwing an exception. Please let me know what additional info I can give to make this more clear. Here is my
test case:
package gov.wapa.snr.pbs.actionTests;
import servletunit.struts.CactusStrutsTestCase;
import gov.wapa.snr.pbs.actionForms.TypeTablesForm;
import java.util.ArrayList;
import org.apache.cactus.client.authentication.FormAuthentication;
import org.apache.cactus.WebRequest;
/**
* User: Holmes
* Date: Aug 13, 2004
* Time: 12:26:48 PM
* All software and source code property of WAPA/DOE
*/
public class TestTypeTablesAction extends CactusStrutsTestCase {
public void beginFormAuthentication(WebRequest theRequest) throws Exception {
theRequest.setAuthentication(new FormAuthentication("weblogic", "weblogic"));
}
public void testFormAuthentication() {
assertEquals("weblogic", request.getUserPrincipal().getName());
assertEquals("weblogic", request.getRemoteUser());
assertTrue("User not in 'PBSadmin' role", request.isUserInRole("PBSadmin"));
}
public void beginNoTypeTable(WebRequest theRequest) {
theRequest.setAuthentication(new FormAuthentication("weblogic", "weblogic"));
theRequest.addParameter("Menu2Load", "TabbedHome");
theRequest.addParameter("menuSelected2", "-1");
theRequest.addParameter("menuSelected", "3");
}
public void testNoTypeTable() {
/*setRequestPathInfo("/welcome.do");
actionPerform();*/
setConfigFile("/WEB-INF/struts-config.xml");
setRequestPathInfo("/systemTables_other.do");
actionPerform();
System.out.println("Actual forward in NoTypeTable: " + getActualForward());
TypeTablesForm form = (TypeTablesForm) getActionForm();
assertNotNull("typeTablesForm is null", form);
ArrayList methodNames = form.getSystemDelegateMethodNames();
assertNotNull("Method names in Form Bean is null", methodNames);
verifyTilesForward("failure", "systemTables_other");
verifyNoActionErrors();
}
public void beginWithTypeTable(WebRequest theRequest) {
theRequest.setAuthentication(new FormAuthentication("weblogic", "weblogic"));
theRequest.addParameter("Menu2Load", "TabbedHome");
theRequest.addParameter("menuSelected2", "-1");
theRequest.addParameter("menuSelected", "3");
}
public void testWithTypeTable() {
setConfigFile("/WEB-INF/struts-config.xml");
setRequestPathInfo("/systemTables_other.do");
addRequestParameter("typeTable", "AddressTypes");
actionPerform();
System.out.println("Actual forward in WithTypeTable: " + getActualForward());
TypeTablesForm form = (TypeTablesForm) getActionForm();
;
assertNotNull("typeTablesForm is null", form);
ArrayList methodNames = form.getSystemDelegateMethodNames();
assertNotNull("Method names in Form Bean is null", methodNames);
assertNotNull("typeTable is Null", form.getTypeTable());
assertNotNull("getAlign is Null", form.getAlign());
assertNotNull("ColumnNameOne is null", form.getColumnNameOne());
assertNotNull("columnNameTwo is null", form.getColumnNameTwo());
assertNotNull("columnOne is null", form.getColumnOne());
assertNotNull("columnTwo is null", form.getColumnTwo());
assertNotNull("tableType is null", form.getTypeTable());
verifyTilesForward("success", "systemTables_other");
verifyNoActionErrors();
}
}