Examples of PageRequest


Examples of org.springframework.data.domain.PageRequest

      Method annotatedMethod = parameter.getMethod();
      throw new IllegalStateException(String.format(INVALID_DEFAULT_PAGE_SIZE, annotatedMethod));
    }

    if (defaults.sort().length == 0) {
      return new PageRequest(defaultPageNumber, defaultPageSize);
    }

    return new PageRequest(defaultPageNumber, defaultPageSize, defaults.direction(), defaults.sort());
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

   */
  @Override
  public Pageable unmarshal(PageRequestDto v) {

    if (v.orders.isEmpty()) {
      return new PageRequest(v.page, v.size);
    }

    SortDto sortDto = new SortDto();
    sortDto.orders = v.orders;
    Sort sort = SortAdapter.INSTANCE.unmarshal(sortDto);

    return new PageRequest(v.page, v.size, sort);
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

    // Read side
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter("page", "0");
    request.addParameter("size", "200");

    assertSupportedAndResult(supportedMethodParameter, new PageRequest(0, 100), request);
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter("foo_page", "2");
    request.addParameter("foo_size", "10");

    assertSupportedAndResult(parameter, new PageRequest(2, 10), request);
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

  }

  @Test
  public void returnsPageableIfAvailable() {

    Pageable pageable = new PageRequest(0, 10);
    ParameterAccessor accessor = new ParametersParameterAccessor(pageableParameters, new Object[] { "test", pageable });
    assertThat(accessor.getPageable(), is(pageable));
    assertThat(accessor.getSort(), is(nullValue()));
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

  @Test
  public void returnsSortFromPageableIfAvailable() throws Exception {

    Sort sort = new Sort("foo");
    Pageable pageable = new PageRequest(0, 10, sort);
    ParameterAccessor accessor = new ParametersParameterAccessor(pageableParameters, new Object[] { "test", pageable });
    assertThat(accessor.getPageable(), is(pageable));
    assertThat(accessor.getSort(), is(sort));
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

  public void invokesFindAllWithPageableByDefault() throws Exception {

    Repository repository = mock(Repository.class);
    Method method = PagingAndSortingRepository.class.getMethod("findAll", Pageable.class);

    getInvokerFor(repository, expectInvocationOf(method)).invokeFindAll(new PageRequest(0, 10));
    getInvokerFor(repository, expectInvocationOf(method)).invokeFindAll((Pageable) null);
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

  public void invokesRedeclaredFindAllWithPageable() throws Exception {

    RepositoryWithRedeclaredFindAllWithPageable repository = mock(RepositoryWithRedeclaredFindAllWithPageable.class);
    Method method = RepositoryWithRedeclaredFindAllWithPageable.class.getMethod("findAll", Pageable.class);

    getInvokerFor(repository, expectInvocationOf(method)).invokeFindAll(new PageRequest(0, 10));
    getInvokerFor(repository, expectInvocationOf(method)).invokeFindAll((Pageable) null);
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

  public void replacesExistingPaginationInformation() throws Exception {

    MethodParameter parameter = new MethodParameter(Sample.class.getMethod("supportedMethod", Pageable.class), 0);
    UriComponentsContributor resolver = new HateoasPageableHandlerMethodArgumentResolver();
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl("http://localhost:8080?page=0&size=10");
    resolver.enhance(builder, parameter, new PageRequest(1, 20));

    MultiValueMap<String, String> params = builder.build().getQueryParams();

    List<String> page = params.get("page");
    assertThat(page.size(), is(1));
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

  /**
   * @see DATACMNS-335
   */
  @Test
  public void preventsPageSizeFromExceedingMayValueIfConfiguredOnWrite() throws Exception {
    assertUriStringFor(new PageRequest(0, 200), "page=0&size=100");
  }
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.