Package org.strecks.form.controller

Examples of org.strecks.form.controller.DelegatingForm


    ActionWithActionForm action = new ActionWithActionForm();

    c.readAnnotations(action.getClass());
    Map<String, InjectionWrapper> injectionHandlers = c.getInjectionMap();
    ActionForm actionForm = new SimpleForm();
    DelegatingForm delegator = new DelegatingForm(actionForm);

    InjectionWrapper inputWrapper = injectionHandlers.get("actionForm");

    ActionContext injectionContext = new TestContextImpl(delegator, null);
    inputWrapper.inject(action, injectionContext);
View Full Code Here


  @Test
  public void testValidBindingForm2() throws Exception
  {

    FormWrapper delegate = createMock(FormWrapper.class);
    DelegatingForm form = createMock(DelegatingForm.class);

    expect(delegate.wrapForm(form, null)).andReturn(form);
    delegate.handleBindingForm(form, null);
    delegate.handleValidForm(form, null);
View Full Code Here

  public void testPrePopulate2() throws Exception
  {

    FormPopulateSource delegate = new FormPopulateSourceImpl();
    ActionForm actionForm = new SimpleStrutsForm();
    DelegatingForm delegator = new DelegatingForm(actionForm);

    ControllerRequestProcessor processor = new ControllerRequestProcessor();
    processor.setFormPopulationSource(delegate);

    assert actionForm == processor.prePopulate(delegator, null);
View Full Code Here

  public void testPreValidate() throws Exception
  {

    FormValidationHandler delegate = new FormValidationHandlerImpl();
    ActionForm actionForm = new SimpleStrutsForm();
    DelegatingForm delegator = new DelegatingForm(actionForm);

    ControllerRequestProcessor processor = new ControllerRequestProcessor();
    processor.setFormValidationHandler(delegate);

    assert delegator == processor.preValidate(delegator, null);
View Full Code Here

    ServletActionContext sac = getActionContext();
    FormWrapper wrapper = newMock(FormWrapper.class);
    ProcessActionForm processActionForm = getProcessActionForm(wrapper);
    HttpServletRequest request = newMock(HttpServletRequest.class);
    ActionForm actionForm = newMock(ActionForm.class);
    DelegatingForm delegatingForm = new DelegatingForm(actionForm);

    expect(sac.getActionForm()).andReturn(actionForm);
    expect(sac.getRequest()).andReturn(request);
   
    expect(wrapper.wrapForm(actionForm, request)).andReturn(delegatingForm);
View Full Code Here

    HttpSession session = createMock(HttpSession.class);
    ModuleConfig moduleConfig = createMock(ModuleConfig.class);
    ActionServlet servlet = createMock(ActionServlet.class);
    ServletContext context = createMock(ServletContext.class);
    MessageResources messageResources = createMock(MessageResources.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);
   
    action.setServlet(servlet);

    actionBean.preBind();
    form.bindInwards(actionBean);
    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(mapping.getParameter()).andReturn("method");
    expect(request.getParameter("method")).andReturn("Insert Stuff Here");
    expect(request.getSession(false)).andReturn(session);
    expect(session.getAttribute(Globals.LOCALE_KEY)).andReturn(Locale.getDefault());
View Full Code Here

    ActionForward actionForward = new ActionForward();

    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    BasicFormAction actionBean = createStrictMock(BasicFormAction.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);

    expect(request.getAttribute(Globals.ERROR_KEY)).andReturn(null);
    actionBean.setInputError(false);
    form.setBindOutwards(true);
    expect(actionBean.execute()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);
    expect(form.getBindOutwards()).andReturn(true);
    form.bindOutwards(actionBean);

    replay(actionBean);
    replay(mapping);
    replay(form);
    replay(request);
View Full Code Here

    ActionForward actionForward = new ActionForward();

    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    BasicFormAction actionBean = createStrictMock(BasicFormAction.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);

    ActionErrors errors = new ActionErrors();
    errors.add("prop", new ActionMessage("key"));
    expect(request.getAttribute(Globals.ERROR_KEY)).andReturn(errors);
    actionBean.setInputError(true);
    expect(actionBean.execute()).andReturn("success");
    expect(form.getBindOutwards()).andReturn(false);
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(form);
View Full Code Here

    BasicSubmitController action = new BasicSubmitController();
    ActionForward actionForward = new ActionForward();

    BasicSubmitAction actionBean = createStrictMock(BasicSubmitAction.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    actionBean.preBind();
    form.bindInwards(actionBean);
    expect(actionBean.execute()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
View Full Code Here

    BasicSubmitController action = new BasicSubmitController();
    ActionForward actionForward = new ActionForward();

    BasicSubmitAction actionBean = createStrictMock(BasicSubmitAction.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(Boolean.TRUE);
    expect(actionBean.cancel()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);
View Full Code Here

TOP

Related Classes of org.strecks.form.controller.DelegatingForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.