예제 #1
0
  @Test
  public void testConfigureFeatureTypes() throws WfsException {
    ArgumentCaptor<DescribeFeatureTypeRequest> captor =
        ArgumentCaptor.forClass(DescribeFeatureTypeRequest.class);

    WfsSource source =
        getWfsSource(
            ONE_TEXT_PROPERTY_SCHEMA,
            MockWfsServer.getFilterCapabilities(),
            Wfs20Constants.EPSG_4326_URN,
            1);

    final String SAMPLE_FEATURE_NAME0 = SAMPLE_FEATURE_NAME + "0";

    verify(mockWfs).describeFeatureType(captor.capture());

    DescribeFeatureTypeRequest describeFeatureType = captor.getValue();

    // sample feature 0 does not have a prefix
    assertThat(SAMPLE_FEATURE_NAME0, equalTo(describeFeatureType.getTypeName()));

    assertTrue(source.isAvailable());
    assertThat(source.featureTypeFilters.size(), is(1));
    WfsFilterDelegate delegate = source.featureTypeFilters.get(new QName(SAMPLE_FEATURE_NAME0));
    assertThat(delegate, notNullValue());

    assertThat(source.getContentTypes().size(), is(1));

    List<ContentType> types = new ArrayList<ContentType>();
    types.addAll(source.getContentTypes());

    assertTrue(SAMPLE_FEATURE_NAME0.equals(types.get(0).getName()));
  }
예제 #2
0
  @Test
  public void testConfigureFeatureTypesDescribeFeatureException() throws WfsException {
    ArgumentCaptor<DescribeFeatureTypeRequest> captor =
        ArgumentCaptor.forClass(DescribeFeatureTypeRequest.class);

    WfsSource source =
        getWfsSource(
            ONE_TEXT_PROPERTY_SCHEMA,
            MockWfsServer.getFilterCapabilities(),
            Wfs20Constants.EPSG_4326_URN,
            1,
            true);

    final String SAMPLE_FEATURE_NAME0 = SAMPLE_FEATURE_NAME + "0";

    verify(mockWfs).describeFeatureType(captor.capture());

    DescribeFeatureTypeRequest describeFeatureType = captor.getValue();

    // sample feature 0 does not have a prefix
    assertThat(SAMPLE_FEATURE_NAME0, equalTo(describeFeatureType.getTypeName()));

    assertTrue(source.featureTypeFilters.isEmpty());

    assertTrue(source.getContentTypes().isEmpty());
  }