Search in sources :

Example 11 with FilterCapabilities

use of net.opengis.filter.v_1_1_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method testNoComparisonOps.

@Test
public void testNoComparisonOps() {
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.setScalarCapabilities(null);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    assertThat(delegate.isLogicalOps(), is(false));
    assertThat(delegate.isEpsg4326(), is(true));
    assertThat(delegate.isSortingSupported(), is(true));
    assertThat(delegate.getSrsName(), is(GeospatialUtil.EPSG_4326_URN));
    assertThat(delegate.getComparisonOps().size(), is(0));
    assertThat(delegate.getGeometryOperands().size(), greaterThan(0));
    assertThat(delegate.getSpatialOps().size(), is(SPATIAL_OPERATORS.values().length));
    assertThat(delegate.getTemporalOps().size(), is(TEMPORAL_OPERATORS.values().length));
    assertThat(delegate.getTemporalOperands().size(), greaterThan(0));
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) Test(org.junit.Test)

Example 12 with FilterCapabilities

use of net.opengis.filter.v_1_1_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method makeDelegateForLogicalSupportTests.

private WfsFilterDelegate makeDelegateForLogicalSupportTests() {
    String mockProperty = "myPropertyName";
    String mockType = "myType";
    List<String> mockProperties = new ArrayList<>(1);
    mockProperties.add(mockProperty);
    when(mockFeatureMetacardType.getProperties()).thenReturn(mockProperties);
    when(mockFeatureMetacardType.getGmlProperties()).thenReturn(mockProperties);
    when(mockFeatureMetacardType.getTextualProperties()).thenReturn(mockProperties);
    when(mockFeatureMetacardType.getTemporalProperties()).thenReturn(mockProperties);
    when(mockFeatureMetacardType.getName()).thenReturn(mockType);
    FeatureAttributeDescriptor mockFeatureAttributeDescriptor = mock(FeatureAttributeDescriptor.class);
    when(mockFeatureAttributeDescriptor.isIndexed()).thenReturn(true);
    when(mockFeatureAttributeDescriptor.getPropertyName()).thenReturn(mockProperty);
    when(mockFeatureMetacardType.getAttributeDescriptor(mockProperty)).thenReturn(mockFeatureAttributeDescriptor);
    FilterCapabilities filterCap = MockWfsServer.getFilterCapabilities();
    //Create new ScalarCapabiltiesType without Logical Operator support
    ScalarCapabilitiesType scalar = new ScalarCapabilitiesType();
    scalar.setComparisonOperators(new ComparisonOperatorsType());
    for (COMPARISON_OPERATORS compOp : COMPARISON_OPERATORS.values()) {
        ComparisonOperatorType operator = new ComparisonOperatorType();
        operator.setName(compOp.toString());
        scalar.getComparisonOperators().getComparisonOperator().add(operator);
    }
    filterCap.setScalarCapabilities(scalar);
    return new WfsFilterDelegate(mockFeatureMetacardType, filterCap, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) ComparisonOperatorsType(net.opengis.filter.v_2_0_0.ComparisonOperatorsType) ScalarCapabilitiesType(net.opengis.filter.v_2_0_0.ScalarCapabilitiesType) FeatureAttributeDescriptor(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor) ArrayList(java.util.ArrayList) ComparisonOperatorType(net.opengis.filter.v_2_0_0.ComparisonOperatorType) COMPARISON_OPERATORS(org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.COMPARISON_OPERATORS)

Example 13 with FilterCapabilities

use of net.opengis.filter.v_1_1_0.FilterCapabilities in project ddf by codice.

the class TestCswEndpoint method verifyFilterCapabilities.

/**
     * Helper method to verify the FilterCapabilities section matches the endpoint's definition
     *
     * @param ct The CapabilitiesType to verify
     */
private void verifyFilterCapabilities(CapabilitiesType ct) {
    FilterCapabilities fc = ct.getFilterCapabilities();
    assertThat(fc.getIdCapabilities(), notNullValue());
    assertThat(fc.getIdCapabilities().getEIDOrFID(), hasSize(1));
    assertThat(fc.getScalarCapabilities(), notNullValue());
    assertThat(CswEndpoint.COMPARISON_OPERATORS, hasSize(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator().size()));
    for (ComparisonOperatorType cot : CswEndpoint.COMPARISON_OPERATORS) {
        assertThat(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator(), hasItem(cot));
    }
    assertThat(fc.getSpatialCapabilities(), notNullValue());
    assertThat(CswEndpoint.SPATIAL_OPERATORS, hasSize(fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().size()));
    for (SpatialOperatorType sot : fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator()) {
        assertThat(CswEndpoint.SPATIAL_OPERATORS, hasItem(sot.getName()));
    }
}
Also used : FilterCapabilities(net.opengis.filter.v_1_1_0.FilterCapabilities) SpatialOperatorType(net.opengis.filter.v_1_1_0.SpatialOperatorType) ComparisonOperatorType(net.opengis.filter.v_1_1_0.ComparisonOperatorType)

Example 14 with FilterCapabilities

use of net.opengis.filter.v_1_1_0.FilterCapabilities in project ddf by codice.

the class TestCswFilterDelegate method getMockFilterCapabilitiesForSpatialFallback.

private FilterCapabilities getMockFilterCapabilitiesForSpatialFallback(List<SpatialOperatorNameType> spatialOperatorNameTypes, List<String> geometries) {
    FilterCapabilities mockFilterCapabilities = mock(FilterCapabilities.class);
    ComparisonOperatorsType mockComparisonOps = mock(ComparisonOperatorsType.class);
    when(mockComparisonOps.getComparisonOperator()).thenReturn(getFullComparisonOpsList());
    List<SpatialOperatorType> spatialOperatorList = new ArrayList<>();
    for (SpatialOperatorNameType spatialOperatorNameType : spatialOperatorNameTypes) {
        SpatialOperatorType spatialOperatorType = new SpatialOperatorType();
        spatialOperatorType.setName(spatialOperatorNameType);
        spatialOperatorList.add(spatialOperatorType);
    }
    SpatialOperatorsType mockSpatialOperatorsType = mock(SpatialOperatorsType.class);
    when(mockSpatialOperatorsType.getSpatialOperator()).thenReturn(spatialOperatorList);
    SpatialCapabilitiesType mockSpatialCapabilities = getSpatialCapabilities(geometries);
    when(mockSpatialCapabilities.getSpatialOperators()).thenReturn(mockSpatialOperatorsType);
    ScalarCapabilitiesType mockScalarCapabilities = mock(ScalarCapabilitiesType.class);
    when(mockScalarCapabilities.getComparisonOperators()).thenReturn(mockComparisonOps);
    when(mockFilterCapabilities.getScalarCapabilities()).thenReturn(mockScalarCapabilities);
    when(mockFilterCapabilities.getSpatialCapabilities()).thenReturn(mockSpatialCapabilities);
    when(mockScalarCapabilities.getLogicalOperators()).thenReturn(mock(LogicalOperators.class));
    return mockFilterCapabilities;
}
Also used : FilterCapabilities(net.opengis.filter.v_1_1_0.FilterCapabilities) ComparisonOperatorsType(net.opengis.filter.v_1_1_0.ComparisonOperatorsType) ScalarCapabilitiesType(net.opengis.filter.v_1_1_0.ScalarCapabilitiesType) SpatialOperatorsType(net.opengis.filter.v_1_1_0.SpatialOperatorsType) SpatialOperatorType(net.opengis.filter.v_1_1_0.SpatialOperatorType) ArrayList(java.util.ArrayList) LogicalOperators(net.opengis.filter.v_1_1_0.LogicalOperators) SpatialOperatorNameType(net.opengis.filter.v_1_1_0.SpatialOperatorNameType) SpatialCapabilitiesType(net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)

Example 15 with FilterCapabilities

use of net.opengis.filter.v_1_1_0.FilterCapabilities in project ddf by codice.

the class TestCswFilterDelegate method getMockFilterCapabilities.

private static FilterCapabilities getMockFilterCapabilities() {
    FilterCapabilities mockFilterCapabilities = mock(FilterCapabilities.class);
    ComparisonOperatorsType mockComparisonOps = mock(ComparisonOperatorsType.class);
    when(mockComparisonOps.getComparisonOperator()).thenReturn(getFullComparisonOpsList());
    SpatialOperatorsType mockSpatialOperatorsType = mock(SpatialOperatorsType.class);
    when(mockSpatialOperatorsType.getSpatialOperator()).thenReturn(getSpatialOperatorsList());
    SpatialCapabilitiesType mockSpatialCapabilities = getAllSpatialCapabilities();
    when(mockSpatialCapabilities.getSpatialOperators()).thenReturn(mockSpatialOperatorsType);
    ScalarCapabilitiesType mockScalarCapabilities = mock(ScalarCapabilitiesType.class);
    when(mockScalarCapabilities.getComparisonOperators()).thenReturn(mockComparisonOps);
    when(mockFilterCapabilities.getScalarCapabilities()).thenReturn(mockScalarCapabilities);
    when(mockFilterCapabilities.getSpatialCapabilities()).thenReturn(mockSpatialCapabilities);
    when(mockScalarCapabilities.getLogicalOperators()).thenReturn(mock(LogicalOperators.class));
    return mockFilterCapabilities;
}
Also used : FilterCapabilities(net.opengis.filter.v_1_1_0.FilterCapabilities) ComparisonOperatorsType(net.opengis.filter.v_1_1_0.ComparisonOperatorsType) ScalarCapabilitiesType(net.opengis.filter.v_1_1_0.ScalarCapabilitiesType) SpatialOperatorsType(net.opengis.filter.v_1_1_0.SpatialOperatorsType) LogicalOperators(net.opengis.filter.v_1_1_0.LogicalOperators) SpatialCapabilitiesType(net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)

Aggregations

FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)17 ArrayList (java.util.ArrayList)15 Test (org.junit.Test)12 ScalarCapabilitiesType (net.opengis.filter.v_1_1_0.ScalarCapabilitiesType)7 FilterType (net.opengis.filter.v_2_0_0.FilterType)7 ComparisonOperatorsType (net.opengis.filter.v_1_1_0.ComparisonOperatorsType)6 FilterCapabilities (net.opengis.filter.v_1_1_0.FilterCapabilities)6 SpatialCapabilitiesType (net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)6 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)6 LogicalOperators (net.opengis.filter.v_1_1_0.LogicalOperators)5 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)5 QName (javax.xml.namespace.QName)4 SpatialOperatorsType (net.opengis.filter.v_1_1_0.SpatialOperatorsType)4 Date (java.util.Date)3 ComparisonOperatorType (net.opengis.filter.v_1_1_0.ComparisonOperatorType)3 SpatialOperatorType (net.opengis.filter.v_1_1_0.SpatialOperatorType)3 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)3 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)3 ConformanceType (net.opengis.filter.v_2_0_0.ConformanceType)3 GeometryOperand (net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand)3