Search in sources :

Example 36 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class WfsFilterDelegateTest method testNoComparisonOps.

@Test
public void testNoComparisonOps() {
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.setScalarCapabilities(null);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, mockMapper, 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 37 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class WfsFilterDelegateTest method setupFilterCapabilities.

private FilterCapabilities setupFilterCapabilities() {
    FilterCapabilities filterCapabilities = new FilterCapabilities();
    TemporalCapabilitiesType temporal = new TemporalCapabilitiesType();
    temporal.setTemporalOperators(new TemporalOperatorsType());
    TemporalOperatorType duringOperator = new TemporalOperatorType();
    duringOperator.setName(TEMPORAL_OPERATORS.DURING.getValue());
    temporal.getTemporalOperators().getTemporalOperator().add(duringOperator);
    TemporalOperandsType temporalOperands = new TemporalOperandsType();
    List<QName> timeQNames = Arrays.asList(new QName(Wfs20Constants.GML_3_2_NAMESPACE, "TimePeriod"), new QName(Wfs20Constants.GML_3_2_NAMESPACE, "TimeInstant"));
    for (QName qName : timeQNames) {
        TemporalOperandsType.TemporalOperand operand = new TemporalOperandsType.TemporalOperand();
        operand.setName(qName);
        temporalOperands.getTemporalOperand().add(operand);
    }
    temporal.setTemporalOperands(temporalOperands);
    filterCapabilities.setTemporalCapabilities(temporal);
    return filterCapabilities;
}
Also used : TemporalCapabilitiesType(net.opengis.filter.v_2_0_0.TemporalCapabilitiesType) FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) TemporalOperatorType(net.opengis.filter.v_2_0_0.TemporalOperatorType) QName(javax.xml.namespace.QName) TemporalOperatorsType(net.opengis.filter.v_2_0_0.TemporalOperatorsType) TemporalOperandsType(net.opengis.filter.v_2_0_0.TemporalOperandsType)

Example 38 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class WfsFilterDelegateTest method testDuringTemporalFallback.

@Test
public void testDuringTemporalFallback() {
    setupMockMetacardType();
    FilterType afterFilter = setupAfterFilterType();
    FilterType beforeFilter = setupBeforeFilterType();
    FilterCapabilities duringFilterCapabilities = setupFilterCapabilities();
    WfsFilterDelegate duringDelegate = new WfsFilterDelegate(mockFeatureMetacardType, duringFilterCapabilities, GeospatialUtil.EPSG_4326_URN, mockMapper, GeospatialUtil.LAT_LON_ORDER);
    WfsFilterDelegate spatialDelegate = mockFeatureMetacardCreateDelegate(mockFeatureProperty, mockFeatureType);
    FilterType spatialFilter = spatialDelegate.dwithin(Metacard.ANY_GEO, "POINT (30 10)", 1000);
    List<List<FilterType>> testFilters = new ArrayList<>();
    testFilters.add(Arrays.asList(afterFilter, beforeFilter));
    testFilters.add(Arrays.asList(afterFilter, beforeFilter, spatialFilter));
    for (List<FilterType> filtersToBeConverted : testFilters) {
        List<FilterType> convertedFilters = duringDelegate.applyTemporalFallbacks(filtersToBeConverted);
        FilterType duringFilter = convertedFilters.get(0);
        if (filtersToBeConverted.contains(spatialFilter)) {
            // verify that results contains the spatial filter type
            assertThat(convertedFilters.contains(spatialFilter), is(true));
            assertThat(convertedFilters.size(), is(2));
            if (duringFilter.isSetSpatialOps()) {
                duringFilter = convertedFilters.get(1);
            }
            // Verify during Filter is correct
            assertThat(duringFilter.isSetTemporalOps(), is(true));
        }
        assertThat(duringFilter.getTemporalOps().getName().toString(), is("{http://www.opengis.net/fes/2.0}During"));
        BinaryTemporalOpType binaryTemporalOpType = (BinaryTemporalOpType) duringFilter.getTemporalOps().getValue();
        assertThat(binaryTemporalOpType.isSetValueReference(), is(true));
        assertThat(binaryTemporalOpType.isSetExpression(), is(true));
        TimePeriodType timePeriod = (TimePeriodType) binaryTemporalOpType.getExpression().getValue();
        TimePositionType beginPositionType = timePeriod.getBeginPosition();
        Date beginDate = timePositionTypeToDate(beginPositionType);
        TimePositionType endPositionType = timePeriod.getEndPosition();
        Date endDate = timePositionTypeToDate(endPositionType);
        // Verify Date range is created correctly
        assertThat(endDate.after(beginDate), is(true));
    }
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) FilterType(net.opengis.filter.v_2_0_0.FilterType) TimePeriodType(net.opengis.gml.v_3_2_1.TimePeriodType) ArrayList(java.util.ArrayList) Collections.singletonList(java.util.Collections.singletonList) Collections.emptyList(java.util.Collections.emptyList) List(java.util.List) ArrayList(java.util.ArrayList) BinaryTemporalOpType(net.opengis.filter.v_2_0_0.BinaryTemporalOpType) TimePositionType(net.opengis.gml.v_3_2_1.TimePositionType) Date(java.util.Date) Test(org.junit.Test)

Example 39 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class CswFilterDelegateTest 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 40 with FilterCapabilities

use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.

the class CswFilterDelegateTest 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)33 ArrayList (java.util.ArrayList)28 Test (org.junit.Test)24 FilterType (net.opengis.filter.v_2_0_0.FilterType)14 FilterCapabilities (net.opengis.filter.v_1_1_0.FilterCapabilities)11 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)11 ComparisonOperatorsType (net.opengis.filter.v_1_1_0.ComparisonOperatorsType)8 LogicalOperators (net.opengis.filter.v_1_1_0.LogicalOperators)8 ScalarCapabilitiesType (net.opengis.filter.v_1_1_0.ScalarCapabilitiesType)8 SpatialCapabilitiesType (net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)8 SpatialOperatorsType (net.opengis.filter.v_1_1_0.SpatialOperatorsType)8 Date (java.util.Date)6 QName (javax.xml.namespace.QName)6 SpatialOperatorType (net.opengis.filter.v_1_1_0.SpatialOperatorType)6 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)6 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)6 TimePeriodType (net.opengis.gml.v_3_2_1.TimePeriodType)6 TimePositionType (net.opengis.gml.v_3_2_1.TimePositionType)6 ConformanceType (net.opengis.filter.v_2_0_0.ConformanceType)5 GeometryOperand (net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand)5