use of org.opengis.filter.temporal.During in project ddf by codice.
the class OpenSearchFilterVisitorTest method testOverlapsNullNest.
@Test
public void testOverlapsNullNest() {
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 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 testDuringOrNest.
@Test
public void testDuringOrNest() {
During duringFilter = (During) geotoolsFilterBuilder.attribute(TEMPORAL_ATTRIBUTE_NAME).during().dates(START_DATE, END_DATE);
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.OR);
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(duringFilter, openSearchFilterVisitorObject);
assertThat(result.getTemporalSearch(), is(nullValue()));
}
use of org.opengis.filter.temporal.During in project ddf by codice.
the class OpenSearchFilterVisitorTest method testDuringDates.
@Test
public void testDuringDates() {
During duringFilter = (During) geotoolsFilterBuilder.attribute(TEMPORAL_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(), 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 testDuringLast.
@Test
public void testDuringLast() {
long durationInMilliSeconds = TimeUnit.DAYS.toMillis(10);
During duringFilter = (During) geotoolsFilterBuilder.attribute(TEMPORAL_ATTRIBUTE_NAME).during().last(durationInMilliSeconds);
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.AND);
Date currentDate = Calendar.getInstance().getTime();
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(duringFilter, openSearchFilterVisitorObject);
TemporalFilter temporalSearch = result.getTemporalSearch();
assertThat(temporalSearch, is(notNullValue()));
Date endDate = temporalSearch.getEndDate();
assertThat("end date should be the current date", endDate, DateMatchers.within(10, ChronoUnit.SECONDS, currentDate));
assertThat("start date should be before the end date", temporalSearch.getStartDate(), DateMatchers.sameInstant(endDate.getTime() - durationInMilliSeconds));
}
use of org.opengis.filter.temporal.During in project ddf by codice.
the class OpenSearchFilterVisitorTest method testDuringNullNest.
@Test
public void testDuringNullNest() {
During duringFilter = (During) geotoolsFilterBuilder.attribute(TEMPORAL_ATTRIBUTE_NAME).during().dates(START_DATE, END_DATE);
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(duringFilter, openSearchFilterVisitorObject);
assertThat(result.getTemporalSearch(), allOf(is(notNullValue()), hasProperty("startDate", is(START_DATE)), hasProperty("endDate", is(END_DATE))));
}
Aggregations