use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.
the class TestWfsFilterDelegate method testUnsupportedFilterType.
private void testUnsupportedFilterType(Method spatialOpMeth, SPATIAL_OPERATORS failType) throws InvocationTargetException, IllegalAccessException {
WfsFilterDelegate delegate = setupFilterDelegate(failType.toString());
FilterType filter = (FilterType) spatialOpMeth.invoke(delegate, Metacard.ANY_GEO, POLYGON);
assertNull(filter);
}
use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.
the class TestWfsFilterDelegate method testRelativeTemporalOnlyQueryAfterSupported.
/**
* If the WFS server does support an 'After' temporal query and supports a
* 'During' temporal query, the query should remain an 'After' query
*/
@Test
public void testRelativeTemporalOnlyQueryAfterSupported() {
setupMockMetacardType();
FilterType afterFilter = setupAfterFilterType();
assertThat(afterFilter.getTemporalOps().getName().toString(), is("{http://www.opengis.net/fes/2.0}After"));
BinaryTemporalOpType binaryTemporalOpType = (BinaryTemporalOpType) afterFilter.getTemporalOps().getValue();
assertThat(binaryTemporalOpType.isSetValueReference(), is(true));
assertThat(binaryTemporalOpType.isSetExpression(), is(true));
TimeInstantType timePeriod = (TimeInstantType) binaryTemporalOpType.getExpression().getValue();
TimePositionType beginPositionType = timePeriod.getTimePosition();
Date beginDate = timePositionTypeToDate(beginPositionType);
Date endDate = new Date();
// Verify Date range is created correctly
assertThat(endDate.after(beginDate), is(true));
}
use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.
the class TestWfsFilterDelegate method testSequentialPropertyIsOfTemporalType.
private void testSequentialPropertyIsOfTemporalType(String methName, String temporalOpName) throws Exception {
SequentialTestMockHolder sequentialTestMockHolder = new SequentialTestMockHolder().invoke();
WfsFilterDelegate delegate = sequentialTestMockHolder.getDelegate();
String mockMetacardAttribute = sequentialTestMockHolder.getMockMetacardAttribute();
String mockFeatureProperty = sequentialTestMockHolder.getMockFeatureProperty();
String mockFeatureType = sequentialTestMockHolder.getMockFeatureType();
DateTime date = new DateTime().minusDays(365);
// Perform Test
Method method = WfsFilterDelegate.class.getMethod(methName, String.class, Date.class);
FilterType filter = (FilterType) method.invoke(delegate, mockMetacardAttribute, date.toDate());
//Verify
assertThat(filter.getTemporalOps().getName().toString(), is(temporalOpName));
BinaryTemporalOpType binaryTemporalOpType = (BinaryTemporalOpType) filter.getTemporalOps().getValue();
assertThat(binaryTemporalOpType.isSetValueReference(), is(true));
assertThat(binaryTemporalOpType.getValueReference(), is(mockFeatureProperty));
assertThat(binaryTemporalOpType.isSetExpression(), is(true));
TimeInstantType timeInstant = (TimeInstantType) binaryTemporalOpType.getExpression().getValue();
assertThat(timeInstant.getTimePosition().getValue().get(0), is(ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC).print(date)));
assertThat("Strings matches expected pattern", timeInstant.getId().matches(getRegEx(mockFeatureType)), equalTo(true));
}
use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.
the class TestWfsFilterDelegate method testLogicalOrNoLogicalSupport.
@Test(expected = UnsupportedOperationException.class)
public void testLogicalOrNoLogicalSupport() throws Exception {
WfsFilterDelegate delegate = makeDelegateForLogicalSupportTests();
FilterType compFilter1 = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
FilterType compFilter2 = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
List<FilterType> filtersToBeOred = new ArrayList<>();
filtersToBeOred.add(compFilter1);
filtersToBeOred.add(compFilter2);
//Perform Test
FilterType filter = delegate.or(filtersToBeOred);
}
use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.
the class TestWfsFilterDelegate method testBeyondFilter.
@Test
public void testBeyondFilter() throws JAXBException, SAXException, IOException {
WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.Beyond.toString());
FilterType filter = delegate.beyond(Metacard.ANY_GEO, POLYGON, DISTANCE);
assertTrue(filter.isSetSpatialOps());
assertTrue(filter.getSpatialOps().getValue() instanceof DistanceBufferType);
assertXMLEqual(MockWfsServer.getBeyondXmlFilter(), getXmlFromMarshaller(filter));
}
Aggregations