Exemplo n.º 1
0
  /**
   * Given 10 features (and metacards) exist that match search criteria, since page size=4 and
   * startIndex=0, should get 4 results back - metacards 1 thru 4.
   *
   * @throws WfsException
   * @throws TransformerConfigurationException
   * @throws UnsupportedQueryException
   */
  @Test
  public void testPagingStartIndexZero()
      throws WfsException, TransformerConfigurationException, UnsupportedQueryException {

    // Setup
    int pageSize = 4;
    int startIndex = 0;

    WfsSource source =
        getWfsSource(
            ONE_TEXT_PROPERTY_SCHEMA,
            MockWfsServer.getFilterCapabilities(),
            Wfs20Constants.EPSG_4326_URN,
            10,
            false);
    Filter filter = builder.attribute(Metacard.ANY_TEXT).is().like().text(LITERAL);
    Query query = new QueryImpl(filter, startIndex, pageSize, null, false, 0);

    // Execute
    GetFeatureType featureType = source.buildGetFeatureRequest(query);
    BigInteger startIndexGetFeature = featureType.getStartIndex();
    BigInteger countGetFeature = featureType.getCount();

    // Verify
    assertThat(countGetFeature.intValue(), is(pageSize));
    assertThat(startIndexGetFeature.intValue(), is(startIndex));
  }