Package org.springframework.web.context.request

Examples of org.springframework.web.context.request.NativeWebRequest


  @Test(expected = IllegalStateException.class)
  public void resolveFacebookAccessTokenArgument_noFacebookCookie_required() throws Exception {
    MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    httpServletRequest.setCookies(new Cookie("not_a_facebook_cookie", "doesn't matter"));
    NativeWebRequest request = new ServletWebRequest(httpServletRequest);

    Method method = FacebookArgumentResolverTest.class.getDeclaredMethod("annotatedMethod", String.class,
        String.class, String.class);

    MethodParameter tokenParameter = new MethodParameter(method, 1);
View Full Code Here


  @Test
  public void resolveArgument_noFacebookCookie_unrequired() throws Exception {
    MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    httpServletRequest.setCookies(new Cookie("not_a_facebook_cookie", "doesn't matter"));
    NativeWebRequest request = new ServletWebRequest(httpServletRequest);

    Method method = FacebookArgumentResolverTest.class.getDeclaredMethod("unrequiredAnnotatedMethod", String.class,
        String.class, String.class);

    MethodParameter idParameter = new MethodParameter(method, 0);
View Full Code Here

 
  @Test(expected = IllegalStateException.class)
  public void resolveUserIdArgument_facebookCookieWithoutEntries_required() throws Exception {
    MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    httpServletRequest.setCookies(new Cookie("fbs_" + API_KEY, BAD_TEST_COOKIE_VALUE));
    NativeWebRequest request = new ServletWebRequest(httpServletRequest);
    Method method = FacebookArgumentResolverTest.class.getDeclaredMethod("annotatedMethod", String.class,
        String.class, String.class);

    MethodParameter idParameter = new MethodParameter(method, 0);
    assertEquals(UNRESOLVED, resolver.resolveArgument(idParameter, request));
View Full Code Here

  @Test(expected = IllegalStateException.class)
  public void resolveAccessTokenArgument_facebookCookieWithoutEntries_required() throws Exception {
    MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    httpServletRequest.setCookies(new Cookie("fbs_" + API_KEY, BAD_TEST_COOKIE_VALUE));
    NativeWebRequest request = new ServletWebRequest(httpServletRequest);
    Method method = FacebookArgumentResolverTest.class.getDeclaredMethod("annotatedMethod", String.class,
        String.class, String.class);

    MethodParameter tokenParameter = new MethodParameter(method, 1);
    assertEquals(UNRESOLVED, resolver.resolveArgument(tokenParameter, request));
View Full Code Here

  @Test
  public void resolveArgument_facebookCookieWithoutEntries_unrequired() throws Exception {
    MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    httpServletRequest.setCookies(new Cookie("fbs_" + API_KEY, BAD_TEST_COOKIE_VALUE));
    NativeWebRequest request = new ServletWebRequest(httpServletRequest);
    Method method = FacebookArgumentResolverTest.class.getDeclaredMethod("unrequiredAnnotatedMethod", String.class,
        String.class, String.class);

    MethodParameter idParameter = new MethodParameter(method, 0);
    assertEquals(null, resolver.resolveArgument(idParameter, request));
View Full Code Here

  @Test
  public void resolveArgument() throws Exception {
    MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    httpServletRequest.setCookies(new Cookie("fbs_" + API_KEY, GOOD_TEST_COOKIE_VALUE));
    NativeWebRequest request = new ServletWebRequest(httpServletRequest);
    Method method = FacebookArgumentResolverTest.class.getDeclaredMethod("annotatedMethod", String.class,
        String.class, String.class);

    MethodParameter idParameter = new MethodParameter(method, 0);
    assertEquals("24680", (String) resolver.resolveArgument(idParameter, request));
View Full Code Here

 
  @Test
  public void resolveArgument_dauthorizationRequest_object() throws Exception {
    MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    httpServletRequest.setParameter("signed_request", DEAUTH_CALLBACK);
    NativeWebRequest request = new ServletWebRequest(httpServletRequest);
    Method method = SignedRequestArgumentResolverTest.class.getDeclaredMethod("annotatedMethod", DeauthorizationRequest.class, Map.class, MultiValueMap.class, String.class);
    MethodParameter deauthParameter = new MethodParameter(method, 0);
    DeauthorizationRequest resolved = (DeauthorizationRequest) resolver.resolveArgument(deauthParameter, null, request, null);
    assertEquals("HMAC-SHA256", resolved.getAlgorithm());
    assertEquals(1335894796, resolved.getIssuedAt());
View Full Code Here

  @Test
  @SuppressWarnings({ "unused", "unchecked" })
  public void resolveArgument_dauthorizationRequest_map() throws Exception {
    MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    httpServletRequest.setParameter("signed_request", DEAUTH_CALLBACK);
    NativeWebRequest request = new ServletWebRequest(httpServletRequest);
    Method method = SignedRequestArgumentResolverTest.class.getDeclaredMethod("annotatedMethod", DeauthorizationRequest.class, Map.class, MultiValueMap.class, String.class);
    MethodParameter deauthParameter = new MethodParameter(method, 1);
    Class<?> parameterType = deauthParameter.getParameterType();
    Map<String, Object> resolved = (Map<String, Object>) resolver.resolveArgument(deauthParameter, null, request, null);
    assertEquals("HMAC-SHA256", resolved.get("algorithm"));
View Full Code Here

  @Test
  @SuppressWarnings({ "unused", "unchecked" })
  public void resolveArgument_dauthorizationRequest_multiValueMap() throws Exception {
    MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
    httpServletRequest.setParameter("signed_request", DEAUTH_CALLBACK);
    NativeWebRequest request = new ServletWebRequest(httpServletRequest);
    Method method = SignedRequestArgumentResolverTest.class.getDeclaredMethod("annotatedMethod", DeauthorizationRequest.class, Map.class, MultiValueMap.class, String.class);
    MethodParameter deauthParameter = new MethodParameter(method, 2);
    Class<?> parameterType = deauthParameter.getParameterType();
    MultiValueMap<String, Object> resolved = (MultiValueMap<String, Object>) resolver.resolveArgument(deauthParameter, null, request, null);
    assertEquals("HMAC-SHA256", resolved.getFirst("algorithm"));
View Full Code Here

TOP

Related Classes of org.springframework.web.context.request.NativeWebRequest

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.