use of org.opengis.filter.temporal.During in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsGreaterThanTemporal.
@Test
public void testVisitPropertyIsGreaterThanTemporal() {
Expression val = factory.literal(new Date(System.currentTimeMillis() - 1000));
Expression test = new AttributeExpressionImpl(new NameImpl(new QName(CswConstants.DUBLIN_CORE_SCHEMA, "TestDate", CswConstants.DUBLIN_CORE_NAMESPACE_PREFIX)));
PropertyIsGreaterThan filter = factory.greater(test, val);
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(During.class));
During duplicate = (During) obj;
assertThat(duplicate.getExpression1(), is(test));
assertThat(duplicate.getExpression2(), is(val));
}
use of org.opengis.filter.temporal.During in project ddf by codice.
the class OpenSearchFilterVisitorTest method testOverlaps.
@Test
public void testOverlaps() {
During duringFilter = (During) geotoolsFilterBuilder.attribute(TEMPORAL_ATTRIBUTE_NAME).during().dates(START_DATE, END_DATE);
TOverlaps overlapsFilter = new TOverlapsImpl(duringFilter.getExpression1(), duringFilter.getExpression2());
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.AND);
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(overlapsFilter, openSearchFilterVisitorObject);
assertThat(result.getTemporalSearch(), allOf(is(notNullValue()), hasProperty("startDate", is(START_DATE)), hasProperty("endDate", is(END_DATE))));
}
use of org.opengis.filter.temporal.During in project ddf by codice.
the class OpenSearchFilterVisitorTest method testMultipleFiltersWhereOneFilterIsIgnored.
/**
* Test that other {@link Filter}s are still visited when a {@link Filter} is ignored. The {@link
* Filter}s in this test are the same as {@link #testMultipleFilters} except that the temporal
* criteria is from {@link #testNotModifiedTemporalFilter()}.
*/
@Test
public void testMultipleFiltersWhereOneFilterIsIgnored() {
During duringFilter = (During) geotoolsFilterBuilder.attribute(SOME_ATTRIBUTE_NAME).during().dates(START_DATE, END_DATE);
Contains containsFilter = (Contains) geotoolsFilterBuilder.attribute(SPATIAL_ATTRIBUTE_NAME).containing().wkt(WKT_POLYGON);
And andFilter = geotoolsFilterBuilder.allOf(duringFilter, containsFilter);
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.AND);
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(andFilter, openSearchFilterVisitorObject);
assertThat(result.getTemporalSearch(), is(nullValue()));
assertThat(result.getGeometrySearches(), contains(hasToString(is(WKT_POLYGON))));
}
use of org.opengis.filter.temporal.During in project ddf by codice.
the class OpenSearchFilterVisitorTest method testOverlapsOrNest.
@Test
public void testOverlapsOrNest() {
During duringFilter = (During) geotoolsFilterBuilder.attribute(TEMPORAL_ATTRIBUTE_NAME).during().dates(START_DATE, END_DATE);
TOverlaps overlapsFilter = new TOverlapsImpl(duringFilter.getExpression1(), duringFilter.getExpression2());
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.OR);
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(overlapsFilter, openSearchFilterVisitorObject);
assertThat(result.getTemporalSearch(), is(nullValue()));
}
use of org.opengis.filter.temporal.During in project ddf by codice.
the class OpenSearchFilterVisitorTest method testNotModifiedTemporalFilter.
/**
* Temporal {@link Filter}s for attributes other than {@value TEMPORAL_ATTRIBUTE_NAME} should be
* ignored.
*/
@Test
public void testNotModifiedTemporalFilter() {
During duringFilter = (During) geotoolsFilterBuilder.attribute(SOME_ATTRIBUTE_NAME).during().dates(START_DATE, END_DATE);
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.AND);
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(duringFilter, openSearchFilterVisitorObject);
assertThat(result.getTemporalSearch(), is(nullValue()));
}
Aggregations