Search in sources :

Example 1 with Before

use of org.opengis.filter.temporal.Before in project ddf by codice.

the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsLessThanTemporal.

@Test
public void testVisitPropertyIsLessThanTemporal() {
    Expression val = factory.literal(new Date());
    PropertyIsLessThan filter = factory.less(created, val);
    Object obj = visitor.visit(filter, null);
    assertThat(obj, instanceOf(Before.class));
    Before duplicate = (Before) obj;
    assertThat(duplicate.getExpression1(), is(created));
    assertThat(duplicate.getExpression2(), is(val));
}
Also used : Before(org.opengis.filter.temporal.Before) Expression(org.opengis.filter.expression.Expression) PropertyIsLessThan(org.opengis.filter.PropertyIsLessThan) Date(java.util.Date) CswQueryFactoryTest(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest) Test(org.junit.Test)

Example 2 with Before

use of org.opengis.filter.temporal.Before in project ddf by codice.

the class FilterBuilderTest method before.

@Test
public void before() {
    FilterVisitor visitor = spy(new DefaultFilterVisitor() {
    });
    FilterBuilder builder = new GeotoolsFilterBuilder();
    Filter filter = builder.attribute(FOO_ATTRIBUTE).before().date(new Date());
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).is().before().date(new Date());
    filter.accept(visitor, null);
    InOrder inOrder = inOrder(visitor);
    inOrder.verify(visitor, times(2)).visit(isA(Before.class), anyObject());
}
Also used : Before(org.opengis.filter.temporal.Before) InOrder(org.mockito.InOrder) DefaultFilterVisitor(org.geotools.filter.visitor.DefaultFilterVisitor) DefaultFilterVisitor(org.geotools.filter.visitor.DefaultFilterVisitor) FilterVisitor(org.opengis.filter.FilterVisitor) Filter(org.opengis.filter.Filter) FilterBuilder(ddf.catalog.filter.FilterBuilder) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) Date(java.util.Date) Test(org.junit.Test)

Aggregations

Date (java.util.Date)2 Test (org.junit.Test)2 Before (org.opengis.filter.temporal.Before)2 FilterBuilder (ddf.catalog.filter.FilterBuilder)1 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)1 CswQueryFactoryTest (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest)1 DefaultFilterVisitor (org.geotools.filter.visitor.DefaultFilterVisitor)1 InOrder (org.mockito.InOrder)1 Filter (org.opengis.filter.Filter)1 FilterVisitor (org.opengis.filter.FilterVisitor)1 PropertyIsLessThan (org.opengis.filter.PropertyIsLessThan)1 Expression (org.opengis.filter.expression.Expression)1