001 package com.mockrunner.struts; 002 003 import java.util.Locale; 004 005 import javax.sql.DataSource; 006 007 import org.apache.commons.validator.ValidatorResources; 008 import org.apache.struts.action.Action; 009 import org.apache.struts.action.ActionForm; 010 import org.apache.struts.action.ActionForward; 011 import org.apache.struts.action.ActionMapping; 012 import org.apache.struts.action.ActionMessage; 013 import org.apache.struts.action.ActionMessages; 014 import org.apache.struts.action.DynaActionForm; 015 import org.apache.struts.config.FormBeanConfig; 016 import org.apache.struts.util.MessageResources; 017 018 import com.mockrunner.base.HTMLOutputModule; 019 import com.mockrunner.base.HTMLOutputTestCase; 020 import com.mockrunner.mock.web.MockActionForward; 021 import com.mockrunner.mock.web.MockActionMapping; 022 import com.mockrunner.mock.web.MockPageContext; 023 024 /** 025 * Delegator for {@link com.mockrunner.struts.ActionTestModule}. You can 026 * subclass this adapter or use {@link com.mockrunner.struts.ActionTestModule} 027 * directly (so your test case can use another base class). 028 * This adapter extends {@link com.mockrunner.base.BaseTestCase}. 029 * It can be used if you want to use several modules in conjunction. 030 * <b>This class is generated from the {@link com.mockrunner.struts.ActionTestModule} 031 * and should not be edited directly</b>. 032 */ 033 public abstract class ActionTestCaseAdapter extends HTMLOutputTestCase 034 { 035 private ActionTestModule actionTestModule; 036 037 public ActionTestCaseAdapter() 038 { 039 040 } 041 042 public ActionTestCaseAdapter(String name) 043 { 044 super(name); 045 } 046 047 protected void tearDown() throws Exception 048 { 049 super.tearDown(); 050 actionTestModule = null; 051 } 052 053 /** 054 * Creates the {@link com.mockrunner.struts.ActionTestModule}. If you 055 * overwrite this method, you must call <code>super.setUp()</code>. 056 */ 057 protected void setUp() throws Exception 058 { 059 super.setUp(); 060 actionTestModule = createActionTestModule(getActionMockObjectFactory()); 061 } 062 063 /** 064 * Returns the {@link com.mockrunner.struts.ActionTestModule} as 065 * {@link com.mockrunner.base.HTMLOutputModule}. 066 * @return the {@link com.mockrunner.base.HTMLOutputModule} 067 */ 068 protected HTMLOutputModule getHTMLOutputModule() 069 { 070 return actionTestModule; 071 } 072 073 /** 074 * Gets the {@link com.mockrunner.struts.ActionTestModule}. 075 * @return the {@link com.mockrunner.struts.ActionTestModule} 076 */ 077 protected ActionTestModule getActionTestModule() 078 { 079 return actionTestModule; 080 } 081 082 /** 083 * Sets the {@link com.mockrunner.struts.ActionTestModule}. 084 * @param actionTestModule the {@link com.mockrunner.struts.ActionTestModule} 085 */ 086 protected void setActionTestModule(ActionTestModule actionTestModule) 087 { 088 this.actionTestModule = actionTestModule; 089 } 090 091 /** 092 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setReset(boolean)} 093 */ 094 protected void setReset(boolean reset) 095 { 096 actionTestModule.setReset(reset); 097 } 098 099 /** 100 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setDoPopulate(boolean)} 101 */ 102 protected void setDoPopulate(boolean doPopulate) 103 { 104 actionTestModule.setDoPopulate(doPopulate); 105 } 106 107 /** 108 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setRecognizeMessagesInSession(boolean)} 109 */ 110 protected void setRecognizeMessagesInSession(boolean recognizeInSession) 111 { 112 actionTestModule.setRecognizeMessagesInSession(recognizeInSession); 113 } 114 115 /** 116 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setMessageAttributeKey(String)} 117 */ 118 protected void setMessageAttributeKey(String messageAttributeKey) 119 { 120 actionTestModule.setMessageAttributeKey(messageAttributeKey); 121 } 122 123 /** 124 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setErrorAttributeKey(String)} 125 */ 126 protected void setErrorAttributeKey(String errorAttributeKey) 127 { 128 actionTestModule.setErrorAttributeKey(errorAttributeKey); 129 } 130 131 /** 132 * Delegates to {@link com.mockrunner.struts.ActionTestModule#addMappedPropertyRequestPrefix(String)} 133 */ 134 protected String addMappedPropertyRequestPrefix(String property) 135 { 136 return actionTestModule.addMappedPropertyRequestPrefix(property); 137 } 138 139 /** 140 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionMapping} 141 */ 142 protected ActionMapping getActionMapping() 143 { 144 return actionTestModule.getActionMapping(); 145 } 146 147 /** 148 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setValidate(boolean)} 149 */ 150 protected void setValidate(boolean validate) 151 { 152 actionTestModule.setValidate(validate); 153 } 154 155 /** 156 * Delegates to {@link com.mockrunner.struts.ActionTestModule#addExceptionHandler(ExceptionHandlerConfig)} 157 */ 158 protected void addExceptionHandler(ExceptionHandlerConfig handler) 159 { 160 actionTestModule.addExceptionHandler(handler); 161 } 162 163 /** 164 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setResources(MessageResources)} 165 */ 166 protected void setResources(MessageResources resources) 167 { 168 actionTestModule.setResources(resources); 169 } 170 171 /** 172 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setResources(String, MessageResources)} 173 */ 174 protected void setResources(String key, MessageResources resources) 175 { 176 actionTestModule.setResources(key, resources); 177 } 178 179 /** 180 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setDataSource(DataSource)} 181 */ 182 protected void setDataSource(DataSource dataSource) 183 { 184 actionTestModule.setDataSource(dataSource); 185 } 186 187 /** 188 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setDataSource(String, DataSource)} 189 */ 190 protected void setDataSource(String key, DataSource dataSource) 191 { 192 actionTestModule.setDataSource(key, dataSource); 193 } 194 195 /** 196 * Delegates to {@link com.mockrunner.struts.ActionTestModule#createValidatorResources(String[])} 197 */ 198 protected ValidatorResources createValidatorResources(String[] resourcesFiles) 199 { 200 return actionTestModule.createValidatorResources(resourcesFiles); 201 } 202 203 /** 204 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setValidatorResources(ValidatorResources)} 205 */ 206 protected void setValidatorResources(ValidatorResources validatorResources) 207 { 208 actionTestModule.setValidatorResources(validatorResources); 209 } 210 211 /** 212 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyForward(String)} 213 */ 214 protected void verifyForward(String path) 215 { 216 actionTestModule.verifyForward(path); 217 } 218 219 /** 220 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionForward} 221 */ 222 protected MockActionForward getActionForward() 223 { 224 return actionTestModule.getActionForward(); 225 } 226 227 /** 228 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyForwardName(String)} 229 */ 230 protected void verifyForwardName(String name) 231 { 232 actionTestModule.verifyForwardName(name); 233 } 234 235 /** 236 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyRedirect(boolean)} 237 */ 238 protected void verifyRedirect(boolean redirect) 239 { 240 actionTestModule.verifyRedirect(redirect); 241 } 242 243 /** 244 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyNoActionErrors} 245 */ 246 protected void verifyNoActionErrors() 247 { 248 actionTestModule.verifyNoActionErrors(); 249 } 250 251 /** 252 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionErrors} 253 */ 254 protected ActionMessages getActionErrors() 255 { 256 return actionTestModule.getActionErrors(); 257 } 258 259 /** 260 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyNoActionMessages} 261 */ 262 protected void verifyNoActionMessages() 263 { 264 actionTestModule.verifyNoActionMessages(); 265 } 266 267 /** 268 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionMessages} 269 */ 270 protected ActionMessages getActionMessages() 271 { 272 return actionTestModule.getActionMessages(); 273 } 274 275 /** 276 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyHasActionErrors} 277 */ 278 protected void verifyHasActionErrors() 279 { 280 actionTestModule.verifyHasActionErrors(); 281 } 282 283 /** 284 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyHasActionMessages} 285 */ 286 protected void verifyHasActionMessages() 287 { 288 actionTestModule.verifyHasActionMessages(); 289 } 290 291 /** 292 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionErrorPresent(String)} 293 */ 294 protected void verifyActionErrorPresent(String errorKey) 295 { 296 actionTestModule.verifyActionErrorPresent(errorKey); 297 } 298 299 /** 300 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionMessagePresent(String)} 301 */ 302 protected void verifyActionMessagePresent(String messageKey) 303 { 304 actionTestModule.verifyActionMessagePresent(messageKey); 305 } 306 307 /** 308 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionErrorNotPresent(String)} 309 */ 310 protected void verifyActionErrorNotPresent(String errorKey) 311 { 312 actionTestModule.verifyActionErrorNotPresent(errorKey); 313 } 314 315 /** 316 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionMessageNotPresent(String)} 317 */ 318 protected void verifyActionMessageNotPresent(String messageKey) 319 { 320 actionTestModule.verifyActionMessageNotPresent(messageKey); 321 } 322 323 /** 324 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionErrors(String[])} 325 */ 326 protected void verifyActionErrors(String[] errorKeys) 327 { 328 actionTestModule.verifyActionErrors(errorKeys); 329 } 330 331 /** 332 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionMessages(String[])} 333 */ 334 protected void verifyActionMessages(String[] messageKeys) 335 { 336 actionTestModule.verifyActionMessages(messageKeys); 337 } 338 339 /** 340 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionErrorValues(String, Object[])} 341 */ 342 protected void verifyActionErrorValues(String errorKey, Object[] values) 343 { 344 actionTestModule.verifyActionErrorValues(errorKey, values); 345 } 346 347 /** 348 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionErrorByKey(String)} 349 */ 350 protected ActionMessage getActionErrorByKey(String errorKey) 351 { 352 return actionTestModule.getActionErrorByKey(errorKey); 353 } 354 355 /** 356 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionMessageValues(String, Object[])} 357 */ 358 protected void verifyActionMessageValues(String messageKey, Object[] values) 359 { 360 actionTestModule.verifyActionMessageValues(messageKey, values); 361 } 362 363 /** 364 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionMessageByKey(String)} 365 */ 366 protected ActionMessage getActionMessageByKey(String messageKey) 367 { 368 return actionTestModule.getActionMessageByKey(messageKey); 369 } 370 371 /** 372 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionErrorValue(String, Object)} 373 */ 374 protected void verifyActionErrorValue(String errorKey, Object value) 375 { 376 actionTestModule.verifyActionErrorValue(errorKey, value); 377 } 378 379 /** 380 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionMessageValue(String, Object)} 381 */ 382 protected void verifyActionMessageValue(String messageKey, Object value) 383 { 384 actionTestModule.verifyActionMessageValue(messageKey, value); 385 } 386 387 /** 388 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionErrorProperty(String, String)} 389 */ 390 protected void verifyActionErrorProperty(String errorKey, String property) 391 { 392 actionTestModule.verifyActionErrorProperty(errorKey, property); 393 } 394 395 /** 396 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyActionMessageProperty(String, String)} 397 */ 398 protected void verifyActionMessageProperty(String messageKey, String property) 399 { 400 actionTestModule.verifyActionMessageProperty(messageKey, property); 401 } 402 403 /** 404 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyNumberActionErrors(int)} 405 */ 406 protected void verifyNumberActionErrors(int number) 407 { 408 actionTestModule.verifyNumberActionErrors(number); 409 } 410 411 /** 412 * Delegates to {@link com.mockrunner.struts.ActionTestModule#verifyNumberActionMessages(int)} 413 */ 414 protected void verifyNumberActionMessages(int number) 415 { 416 actionTestModule.verifyNumberActionMessages(number); 417 } 418 419 /** 420 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setActionMessages(ActionMessages)} 421 */ 422 protected void setActionMessages(ActionMessages messages) 423 { 424 actionTestModule.setActionMessages(messages); 425 } 426 427 /** 428 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setActionMessagesToSession(ActionMessages)} 429 */ 430 protected void setActionMessagesToSession(ActionMessages messages) 431 { 432 actionTestModule.setActionMessagesToSession(messages); 433 } 434 435 /** 436 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionMessagesFromRequest} 437 */ 438 protected ActionMessages getActionMessagesFromRequest() 439 { 440 return actionTestModule.getActionMessagesFromRequest(); 441 } 442 443 /** 444 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionMessagesFromSession} 445 */ 446 protected ActionMessages getActionMessagesFromSession() 447 { 448 return actionTestModule.getActionMessagesFromSession(); 449 } 450 451 /** 452 * Delegates to {@link com.mockrunner.struts.ActionTestModule#hasActionMessages} 453 */ 454 protected boolean hasActionMessages() 455 { 456 return actionTestModule.hasActionMessages(); 457 } 458 459 /** 460 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setActionErrors(ActionMessages)} 461 */ 462 protected void setActionErrors(ActionMessages errors) 463 { 464 actionTestModule.setActionErrors(errors); 465 } 466 467 /** 468 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setActionErrorsToSession(ActionMessages)} 469 */ 470 protected void setActionErrorsToSession(ActionMessages errors) 471 { 472 actionTestModule.setActionErrorsToSession(errors); 473 } 474 475 /** 476 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionErrorsFromRequest} 477 */ 478 protected ActionMessages getActionErrorsFromRequest() 479 { 480 return actionTestModule.getActionErrorsFromRequest(); 481 } 482 483 /** 484 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionErrorsFromSession} 485 */ 486 protected ActionMessages getActionErrorsFromSession() 487 { 488 return actionTestModule.getActionErrorsFromSession(); 489 } 490 491 /** 492 * Delegates to {@link com.mockrunner.struts.ActionTestModule#hasActionErrors} 493 */ 494 protected boolean hasActionErrors() 495 { 496 return actionTestModule.hasActionErrors(); 497 } 498 499 /** 500 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getMockActionMapping} 501 */ 502 protected MockActionMapping getMockActionMapping() 503 { 504 return actionTestModule.getMockActionMapping(); 505 } 506 507 /** 508 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getMockPageContext} 509 */ 510 protected MockPageContext getMockPageContext() 511 { 512 return actionTestModule.getMockPageContext(); 513 } 514 515 /** 516 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getLastAction} 517 */ 518 protected Action getLastAction() 519 { 520 return actionTestModule.getLastAction(); 521 } 522 523 /** 524 * Delegates to {@link com.mockrunner.struts.ActionTestModule#generateValidToken} 525 */ 526 protected void generateValidToken() 527 { 528 actionTestModule.generateValidToken(); 529 } 530 531 /** 532 * Delegates to {@link com.mockrunner.struts.ActionTestModule#getActionForm} 533 */ 534 protected ActionForm getActionForm() 535 { 536 return actionTestModule.getActionForm(); 537 } 538 539 /** 540 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setActionForm(ActionForm)} 541 */ 542 protected void setActionForm(ActionForm formObj) 543 { 544 actionTestModule.setActionForm(formObj); 545 } 546 547 /** 548 * Delegates to {@link com.mockrunner.struts.ActionTestModule#createActionForm(Class)} 549 */ 550 protected ActionForm createActionForm(Class form) 551 { 552 return actionTestModule.createActionForm(form); 553 } 554 555 /** 556 * Delegates to {@link com.mockrunner.struts.ActionTestModule#createDynaActionForm(FormBeanConfig)} 557 */ 558 protected DynaActionForm createDynaActionForm(FormBeanConfig formConfig) 559 { 560 return actionTestModule.createDynaActionForm(formConfig); 561 } 562 563 /** 564 * Delegates to {@link com.mockrunner.struts.ActionTestModule#populateRequestToForm} 565 */ 566 protected void populateRequestToForm() 567 { 568 actionTestModule.populateRequestToForm(); 569 } 570 571 /** 572 * Delegates to {@link com.mockrunner.struts.ActionTestModule#actionPerform(Class, Class)} 573 */ 574 protected ActionForward actionPerform(Class action, Class form) 575 { 576 return actionTestModule.actionPerform(action, form); 577 } 578 579 /** 580 * Delegates to {@link com.mockrunner.struts.ActionTestModule#actionPerform(Class)} 581 */ 582 protected ActionForward actionPerform(Class action) 583 { 584 return actionTestModule.actionPerform(action); 585 } 586 587 /** 588 * Delegates to {@link com.mockrunner.struts.ActionTestModule#actionPerform(Action)} 589 */ 590 protected ActionForward actionPerform(Action action) 591 { 592 return actionTestModule.actionPerform(action); 593 } 594 595 /** 596 * Delegates to {@link com.mockrunner.struts.ActionTestModule#actionPerform(Action, ActionForm)} 597 */ 598 protected ActionForward actionPerform(Action action, ActionForm form) 599 { 600 return actionTestModule.actionPerform(action, form); 601 } 602 603 /** 604 * Delegates to {@link com.mockrunner.struts.ActionTestModule#actionPerform(Action, Class)} 605 */ 606 protected ActionForward actionPerform(Action action, Class form) 607 { 608 return actionTestModule.actionPerform(action, form); 609 } 610 611 /** 612 * Delegates to {@link com.mockrunner.struts.ActionTestModule#actionPerform(Class, ActionForm)} 613 */ 614 protected ActionForward actionPerform(Class action, ActionForm form) 615 { 616 return actionTestModule.actionPerform(action, form); 617 } 618 619 /** 620 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setLocale(Locale)} 621 */ 622 protected void setLocale(Locale locale) 623 { 624 actionTestModule.setLocale(locale); 625 } 626 627 /** 628 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setInput(String)} 629 */ 630 protected void setInput(String input) 631 { 632 actionTestModule.setInput(input); 633 } 634 635 /** 636 * Delegates to {@link com.mockrunner.struts.ActionTestModule#setParameter(String)} 637 */ 638 protected void setParameter(String parameter) 639 { 640 actionTestModule.setParameter(parameter); 641 } 642 }