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));
}
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;
}
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));
}
}
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;
}
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;
}
Aggregations