Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockHttpServletRequest


  /**
   * Tests that {@link TextControl} return <code>null</code> on empty request.
   * @throws Exception
   */
  public void testDataCycling() throws Exception {
    MockHttpServletRequest emptyRequest = new MockHttpServletRequest();
    emptyRequest.addParameter("myTextBox", "");

    FormElement sfe = new FormElement();
   
    sfe._getComponent().init(new MockEnviroment());
   
View Full Code Here


    map = new HashMap();
   
    child1 = new MockEventfulStandardService();
    child2 = new MockEventfulStandardService();
   
    req = new MockHttpServletRequest();
    res = new MockHttpServletResponse();
   
    input = new StandardServletInputData(req);
    output = new StandardServletOutputData(req, res);
   
View Full Code Here

   * Test reading from request with a grouped constraint set, date is invalid.
   */
  public void anotherTestFormInactiveGroupedConstraintInValidates() throws Exception {
    FormWidget testForm = makeUsualForm();

    MockHttpServletRequest request = new MockHttpServletRequest();

    request.addParameter("testForm.__present", "true");
    request.addParameter("testForm.myCheckBox", "true");
    request.addParameter("testForm.myLongText", "108");
    request.addParameter("testForm.myDateTime.date", "11.10.20151278901");
    request.addParameter("testForm.myDateTime.time", "01:01");

    // create helper
    ConstraintGroupHelper groupHelper = new ConstraintGroupHelper();   
    testForm.getElement("myDateTime").setConstraint(groupHelper.createGroupedConstraint(new NotEmptyConstraint(), "active"));
   
View Full Code Here

  private StandardServletOutputData out;
  private MockHttpServletRequest req;
  private MockHttpServletResponse resp;
 
  public void setUp() {
    req = new MockHttpServletRequest();
    resp = new MockHttpServletResponse();
   
    out = new StandardServletOutputData(req, resp);
  }
View Full Code Here

 
  public void setUp() throws Exception {
    res = new MockHttpServletResponse();
    res.setContentType("text/html; charset=UTF-8");
   
    output = new StandardServletOutputData(new MockHttpServletRequest(), res);
   
    atomic = new AtomicResponseHelper();
    atomic.wrapOutput(output);
  }
View Full Code Here

    };
   
    service.setSessionServiceFactory(factory);
    MockLifeCycle.begin(service);
   
    req = new MockHttpServletRequest();
    res = new MockHttpServletResponse();
   
    input = new StandardServletInputData(req);
    output = new StandardServletOutputData(req, res);
  }
View Full Code Here

  public void testGetOutputStream() throws Exception {
    assertEquals(resp.getOutputStream(), out.getOutputStream());
  }
 
  public void testSetRequest() {
    req = new MockHttpServletRequest();
    out.setRequest(req);
    assertEquals(req, out.getRequest());
  }
View Full Code Here

    FormWidget testForm = makeUsualForm();
   
    Widget currentWidget = testForm;
   
    MockHttpServletRequest validRequest = new MockHttpServletRequest();

    validRequest.addParameter("testForm.__present", "true");
    validRequest.addParameter("testForm.myCheckBox", "true");
    validRequest.addParameter("testForm.myLongText", "108");
    validRequest.addParameter("testForm.myDateTime.date", "11.10.2015");
    validRequest.addParameter("testForm.myDateTime.time", "01:01");
    validRequest.addParameter("testForm.hierarchyTest.myTextarea", "blah");
    validRequest.addParameter("testForm.hierarchyTest.mySelect", "2");   
   
   
    MockUiLibUtil.emulateHandleRequest(currentWidget, "testForm", validRequest);
    currentWidget._getWidget().process();             
View Full Code Here

import org.araneaframework.servlet.core.StandardServletInputData;
import org.springframework.mock.web.MockHttpServletRequest;

public class MockUiLibUtil {
  public static void emulateHandleEvent(Widget widget, String eventId, String eventParameter) throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest();
   
    String eventPath = "";
    String eventListenerId = eventId;
   
    int lastDot = eventId.lastIndexOf(".");
   
    if (lastDot != -1) {
      eventPath = eventId.substring(0, lastDot);
      eventListenerId = eventId.substring(lastDot + 1);
    }
   
    request.addParameter(StandardWidget.EVENT_PARAMETER_KEY, eventParameter);
    request.addParameter(StandardWidget.EVENT_HANDLER_ID_KEY, eventListenerId);
    StandardServletInputData input = new StandardServletInputData(request);
   
    widget._getWidget().event(new StandardPath(eventPath), input);
  }
View Full Code Here

   
    widget._getWidget().event(new StandardPath(eventPath), input);
  }
 
  public static void emulateHandleEventForControl(Widget widget, String eventId, String eventParameter) throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest();
   
    request.addParameter(StandardWidget.EVENT_PARAMETER_KEY, eventParameter);
   StandardServletInputData input = new StandardServletInputData(request);
   
    widget._getWidget().event(new StandardPath(eventId), input);
  }
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.MockHttpServletRequest

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.