use of net.opengis.gml.v_3_2_1.TimePositionType in project ddf by codice.
the class TestWfsFilterDelegate method testRelativeTemporalOnlyQueryAfterUnsupported.
/**
* If the WFS server does not support an 'After' temporal query and supports a
* 'During' temporal query, the query should be translated into a 'During <date> to <now>'
*/
@Test
public void testRelativeTemporalOnlyQueryAfterUnsupported() {
setupMockMetacardType();
FilterType afterFilter = setupAfterFilterType();
FilterCapabilities duringFilterCapabilities = setupFilterCapabilities();
WfsFilterDelegate duringDelegate = new WfsFilterDelegate(mockFeatureMetacardType, duringFilterCapabilities, GeospatialUtil.EPSG_4326_URN, mockMapper, GeospatialUtil.LAT_LON_ORDER);
List<FilterType> testFilters = new ArrayList<>();
testFilters.add(afterFilter);
List<FilterType> convertedFilters = duringDelegate.applyTemporalFallbacks(testFilters);
FilterType duringFilter = convertedFilters.get(0);
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 net.opengis.gml.v_3_2_1.TimePositionType in project ddf by codice.
the class TestWfsFilterDelegate method testDuringFilterTypeDates.
@Test
public void testDuringFilterTypeDates() throws Exception {
setupMockMetacardType();
FilterType duringFilter = setupDuringFilterType();
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);
assertThat(endDate.after(beginDate), is(true));
}
use of net.opengis.gml.v_3_2_1.TimePositionType in project ddf by codice.
the class TestWfsFilterDelegate method testDuringTemporalFallback.
@Test
public void testDuringTemporalFallback() throws Exception {
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)", Double.valueOf(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));
}
}
Aggregations