Search in sources :

Example 46 with GeotoolsFilterBuilder

use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.

the class FilterBuilderTest method operatorAfterNull.

@Test(expected = IllegalArgumentException.class)
public void operatorAfterNull() {
    FilterBuilder builder = new GeotoolsFilterBuilder();
    Filter filter = builder.attribute("something").after().date(null);
}
Also used : Filter(org.opengis.filter.Filter) FilterBuilder(ddf.catalog.filter.FilterBuilder) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) Test(org.junit.Test)

Example 47 with GeotoolsFilterBuilder

use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.

the class FilterBuilderTest method xpathExists.

@Test
public void xpathExists() {
    FilterVisitor visitor = spy(new DefaultFilterVisitor() {
    });
    FilterBuilder builder = new GeotoolsFilterBuilder();
    Filter filter = builder.xpath("//foo").exists();
    filter.accept(visitor, null);
    InOrder inOrder = inOrder(visitor);
    inOrder.verify(visitor, times(1)).visit(isA(PropertyIsLike.class), anyObject());
}
Also used : PropertyIsLike(org.opengis.filter.PropertyIsLike) 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) Test(org.junit.Test)

Example 48 with GeotoolsFilterBuilder

use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder 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)

Example 49 with GeotoolsFilterBuilder

use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.

the class FilterBuilderTest method within.

@Test
public void within() {
    FilterVisitor visitor = spy(new DefaultFilterVisitor() {
    });
    FilterBuilder builder = new GeotoolsFilterBuilder();
    Filter filter = builder.attribute(Metacard.GEOGRAPHY).within().wkt(POINT_WKT);
    filter.accept(visitor, null);
    filter = builder.attribute(Metacard.GEOGRAPHY).is().within().wkt(MULTIPOLYGON_WKT);
    filter.accept(visitor, null);
    InOrder inOrder = inOrder(visitor);
    inOrder.verify(visitor, times(2)).visit(isA(Within.class), anyObject());
}
Also used : 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) DWithin(org.opengis.filter.spatial.DWithin) Within(org.opengis.filter.spatial.Within) Test(org.junit.Test)

Example 50 with GeotoolsFilterBuilder

use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.

the class FilterBuilderTest method during.

@Test
public void during() {
    FilterVisitor visitor = spy(new DefaultFilterVisitor() {
    });
    FilterBuilder builder = new GeotoolsFilterBuilder();
    Filter filter = builder.attribute(FOO_ATTRIBUTE).during().dates(new Date(), new Date(System.currentTimeMillis() + 10000000));
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).during().next(1000);
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).during().last(1000);
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).is().during().dates(new Date(), new Date(System.currentTimeMillis() + 10000000));
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).is().during().next(1000);
    filter.accept(visitor, null);
    filter = builder.attribute(FOO_ATTRIBUTE).is().during().last(1000);
    filter.accept(visitor, null);
    InOrder inOrder = inOrder(visitor);
    inOrder.verify(visitor, times(6)).visit(isA(During.class), anyObject());
}
Also used : 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) During(org.opengis.filter.temporal.During) Test(org.junit.Test)

Aggregations

GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)67 Test (org.junit.Test)50 FilterBuilder (ddf.catalog.filter.FilterBuilder)44 Filter (org.opengis.filter.Filter)38 DefaultFilterVisitor (org.geotools.filter.visitor.DefaultFilterVisitor)24 FilterVisitor (org.opengis.filter.FilterVisitor)23 InOrder (org.mockito.InOrder)21 ArrayList (java.util.ArrayList)14 Date (java.util.Date)13 GeotoolsFilterAdapterImpl (ddf.catalog.filter.proxy.adapter.GeotoolsFilterAdapterImpl)12 QueryRequest (ddf.catalog.operation.QueryRequest)10 QueryResponse (ddf.catalog.operation.QueryResponse)9 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)9 CatalogFramework (ddf.catalog.CatalogFramework)8 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)8 Metacard (ddf.catalog.data.Metacard)7 FilterAdapter (ddf.catalog.filter.FilterAdapter)7 Source (ddf.catalog.source.Source)7 UnsupportedQueryException (ddf.catalog.source.UnsupportedQueryException)7 Before (org.junit.Before)7