Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockHttpServletRequest.addParameter()


    filter.setProxyGrantingTicketStorage(mock(ProxyGrantingTicketStorage.class));
  }

  public void testNormalOperation() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/demo/any-path");
    request.addParameter("ticket", "ST-0-ER94xMJmn6pha35CQRoZ");
    Authentication result = filter.getPreauthAuthentication(request, new MockHttpServletResponse());
    assertTrue(result != null);
  }

  @Test(expectedExceptions = AuthenticationException.class)
View Full Code Here


  }

  @Test(expectedExceptions = AuthenticationException.class)
  public void testNullServiceTicketHandledGracefully() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/demo/any-path");
    request.addParameter("ticket", "ST-0-ER94xMJmn6pha35CQRoZ");
    filter.setAuthenticationManager(new AuthenticationManager() {
      public Authentication authenticate(Authentication a) {
        throw new BadCredentialsException("Rejected");
      }
    });
View Full Code Here

  @Test
  public void testBboxFilter() throws Exception {
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setRequestURI("/rest/beans");
    request.addParameter("bbox", "4,6,0,3");
    request.setMethod("GET");

    MockHttpServletResponse response = new MockHttpServletResponse();
    ModelAndView mav = adapter.handle(request, response, restController);
    Object o = mav.getModel().get(RestController.FEATURE_COLLECTION);
View Full Code Here

   * 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

  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");
View Full Code Here

    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
View Full Code Here

    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();   
View Full Code Here

    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

    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

   
    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");
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.