Search in sources :

Example 1 with TOverlapsImpl

use of org.geotools.filter.temporal.TOverlapsImpl 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))));
}
Also used : TOverlaps(org.opengis.filter.temporal.TOverlaps) During(org.opengis.filter.temporal.During) TOverlapsImpl(org.geotools.filter.temporal.TOverlapsImpl) Test(org.junit.Test)

Example 2 with TOverlapsImpl

use of org.geotools.filter.temporal.TOverlapsImpl 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()));
}
Also used : TOverlaps(org.opengis.filter.temporal.TOverlaps) During(org.opengis.filter.temporal.During) TOverlapsImpl(org.geotools.filter.temporal.TOverlapsImpl) Test(org.junit.Test)

Example 3 with TOverlapsImpl

use of org.geotools.filter.temporal.TOverlapsImpl 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))));
}
Also used : TOverlaps(org.opengis.filter.temporal.TOverlaps) During(org.opengis.filter.temporal.During) TOverlapsImpl(org.geotools.filter.temporal.TOverlapsImpl) Test(org.junit.Test)

Example 4 with TOverlapsImpl

use of org.geotools.filter.temporal.TOverlapsImpl in project ddf by codice.

the class OpenSearchFilterVisitorTest method testOverlapsInstant.

@Test
public void testOverlapsInstant() {
    After afterFilter = (After) geotoolsFilterBuilder.attribute(TEMPORAL_ATTRIBUTE_NAME).after().date(START_DATE);
    TOverlaps overlapsFilter = new TOverlapsImpl(afterFilter.getExpression1(), afterFilter.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(START_DATE))));
}
Also used : TOverlaps(org.opengis.filter.temporal.TOverlaps) After(org.opengis.filter.temporal.After) TOverlapsImpl(org.geotools.filter.temporal.TOverlapsImpl) Test(org.junit.Test)

Aggregations

TOverlapsImpl (org.geotools.filter.temporal.TOverlapsImpl)4 Test (org.junit.Test)4 TOverlaps (org.opengis.filter.temporal.TOverlaps)4 During (org.opengis.filter.temporal.During)3 After (org.opengis.filter.temporal.After)1