Examples of MockHttpServletRequest


Examples of org.springframework.mock.web.MockHttpServletRequest

  public void testNoScopeGetScopedData() {
    assertEquals(0,input.getScopedData().size());
  }
 
  public void testWrongPathGetScopedData() {
    request = new MockHttpServletRequest();
    request.setAttribute("a","b");
    request.setAttribute("a.b","b");
    request.setAttribute("a.b.c","b");
   
    input = new StandardServletInputData(request);
View Full Code Here

Examples of org.springframework.mock.web.MockHttpServletRequest

    input.pushScope("a");input.pushScope("b");input.pushScope("c");input.pushScope("d");
    assertEquals(null ,input.getScopedData().get("c"));
  }
 
  public void testNonValidPath() {
    request = new MockHttpServletRequest();
    request.addParameter("a...foo","b");
    request.addParameter(".","c");
    request.addParameter(".","c");
    input = new StandardServletInputData(request);
    assertEquals(null, input.getScopedData().get("."));
View Full Code Here

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

Examples of org.springframework.mock.web.MockHttpServletRequest

    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

Examples of org.springframework.mock.web.MockHttpServletRequest

   * 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

Examples of org.springframework.mock.web.MockHttpServletRequest

  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

Examples of org.springframework.mock.web.MockHttpServletRequest

 
  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

Examples of org.springframework.mock.web.MockHttpServletRequest

    };
   
    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

Examples of org.springframework.mock.web.test.MockHttpServletRequest

    resetResponse();
    this.asyncControl = this.request.getAsyncRequestControl(this.response);
  }

  protected void resetRequest() {
    this.servletRequest = new MockHttpServletRequest();
    this.servletRequest.setAsyncSupported(true);
    this.request = new ServletServerHttpRequest(this.servletRequest);
  }
View Full Code Here

Examples of test.mock.servlet.MockHttpServletRequest

  private static DispatcherController dispatcherController = HttpServletDispatcherController
      .getInstance().init("firefly-mvc.xml");

  @Test
  public void testControllerHello() {
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setRequestURI("/firefly/app/hello");
    request.setServletPath("/app");
    request.setContextPath("/firefly");
    request.setMethod("GET");
    MockHttpServletResponse response = new MockHttpServletResponse();
    dispatcherController.dispatcher(request, response);
    Assert.assertThat(request.getAttribute("hello").toString(),
        is("你好 firefly!"));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.