Examples of PagedDataRows


Examples of org.springframework.springfaces.page.model.PagedDataRows

  @Test
  @SuppressWarnings("rawtypes")
  public void shouldPassPageSizeToRows() throws Exception {
    this.uiPagedData.setPageSize(12);
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    assertThat(rows.getPageSize(), is(equalTo(12)));
  }
View Full Code Here

Examples of org.springframework.springfaces.page.model.PagedDataRows

  @SuppressWarnings("rawtypes")
  public void shouldUseValueExpressionToGetData() throws Exception {
    List<String> valueResult = Collections.singletonList("a");
    this.uiPagedData.setValueExpression("value", mockExpression(valueResult));
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    rows.setRowIndex(0);
    assertThat(rows.getRowData(), is(equalTo((Object) "a")));
    assertThat(rows.getRowCount(), is(equalTo(-1)));
  }
View Full Code Here

Examples of org.springframework.springfaces.page.model.PagedDataRows

  @SuppressWarnings("rawtypes")
  public void shouldUseRowExpressionToGetRowCount() throws Exception {
    this.uiPagedData.setValueExpression("value", mockExpression(Collections.singletonList("a")));
    this.uiPagedData.setValueExpression("rowCount", mockExpression(100));
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    assertThat(rows.getRowCount(), is(equalTo(100)));
  }
View Full Code Here

Examples of org.springframework.springfaces.page.model.PagedDataRows

  public void shouldHavePageRequest() throws Exception {
    List<String> valueResult = Arrays.asList("a", "b", "c");
    this.uiPagedData.setPageSize(2);
    this.uiPagedData.setValueExpression("value", mockExpression(valueResult));
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    rows.setRowIndex(2);
    rows.isRowAvailable();
    assertThat(this.pageRequest.getOffset(), is(equalTo(2)));
    assertThat(this.pageRequest.getPageNumber(), is(equalTo(1)));
    assertThat(this.pageRequest.getPageSize(), is(equalTo(2)));
  }
View Full Code Here

Examples of org.springframework.springfaces.page.model.PagedDataRows

  @SuppressWarnings("rawtypes")
  public void shouldResorePreviouslySetPageRequest() throws Exception {
    this.requestMap.put("pageRequest", "custom");
    this.uiPagedData.setValueExpression("value", mockExpression(Collections.singletonList("a")));
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    rows.setRowIndex(0);
    rows.getRowData();
    assertThat(this.requestMap.get("pageRequest"), is(equalTo((Object) "custom")));
    assertThat(this.pageRequest, is(not(nullValue())));
  }
View Full Code Here

Examples of org.springframework.springfaces.page.model.PagedDataRows

  public void shouldCleanupPageRequestOnException() throws Exception {
    ValueExpression expression = mock(ValueExpression.class);
    given(expression.getValue(any(ELContext.class))).willThrow(new RuntimeException());
    this.uiPagedData.setValueExpression("value", expression);
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    rows.setRowIndex(0);
    try {
      this.thrown.expect(RuntimeException.class);
      rows.getRowData();
    } finally {
      assertThat(this.requestMap, not(hasKey("pageRequest")));
    }
  }
View Full Code Here

Examples of org.springframework.springfaces.page.model.PagedDataRows

    Page page = mock(Page.class);
    given(page.getContent()).willReturn(Collections.singletonList("a"));
    given(page.getTotalElements()).willReturn(100L);
    this.uiPagedData.setValueExpression("value", mockExpression(page));
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    rows.setRowIndex(0);
    assertThat(rows.getRowData(), is(equalTo((Object) "a")));
    assertThat(rows.getRowCount(), is(equalTo(100)));
    assertThat(this.pageRequest, is(notNullValue()));
    assertThat(this.pageRequest, is(Pageable.class));
  }
View Full Code Here

Examples of org.springframework.springfaces.page.model.PagedDataRows

  @SuppressWarnings("rawtypes")
  public void shouldSupportPrimeFaces() throws Exception {
    this.uiPagedData.setValueExpression("value", mockExpression(Collections.singletonList("a")));
    this.uiPagedData.setValueExpression("rowCount", mockExpression(100));
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    assertThat(rows, is(PrimeFacesPagedDataModel.class));
  }
View Full Code Here

Examples of org.springframework.springfaces.page.model.PagedDataRows

  @Test
  @SuppressWarnings("rawtypes")
  public void shouldDefaultToNullSortColumn() throws Exception {
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    assertThat(rows.getSortColumn(), is(nullValue()));
  }
View Full Code Here

Examples of org.springframework.springfaces.page.model.PagedDataRows

  @Test
  @SuppressWarnings("rawtypes")
  public void shouldPassSortColumnToDataRows() throws Exception {
    this.uiPagedData.setSortColumn("sort");
    this.uiPagedData.encodeEnd(this.context);
    PagedDataRows rows = (PagedDataRows) this.requestMap.get("pagedData");
    assertThat(rows.getSortColumn(), is(equalTo("sort")));
  }
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.