use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method intersects.
@Test
public void intersects() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(Metacard.GEOGRAPHY).intersecting().wkt(POINT_WKT);
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(1)).visit(isA(Intersects.class), anyObject());
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class CopyFilterDelegateTest method testExcludeFilter.
@Test
public void testExcludeFilter() {
Filter filterIn = Filter.EXCLUDE;
FilterBuilder filterBuilder = new GeotoolsFilterBuilder();
FilterDelegate<Filter> delegate = new CopyFilterDelegate(filterBuilder);
FilterAdapter fa = new GeotoolsFilterAdapterImpl();
Filter filterCopy = null;
try {
filterCopy = fa.adapt(filterIn, delegate);
} catch (UnsupportedQueryException e) {
fail(e.getMessage());
}
assertNotNull(filterCopy);
assertSame(filterIn, filterCopy);
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method isDate.
@Test
public void isDate() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).is().date(new Date());
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(1)).visit(isA(PropertyIsEqualTo.class), anyObject());
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method withinBuffer.
@Test
public void withinBuffer() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(Metacard.GEOGRAPHY).withinBuffer().wkt(POINT_WKT);
filter.accept(visitor, null);
filter = builder.attribute(Metacard.GEOGRAPHY).withinBuffer().wkt(POINT_WKT, 123.45d);
filter.accept(visitor, null);
filter = builder.attribute(Metacard.GEOGRAPHY).is().withinBuffer().wkt(POINT_WKT);
filter.accept(visitor, null);
filter = builder.attribute(Metacard.GEOGRAPHY).is().withinBuffer().wkt(POINT_WKT, 123.45d);
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(4)).visit(isA(DWithin.class), anyObject());
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method operatorBeforeNull.
@Test(expected = IllegalArgumentException.class)
public void operatorBeforeNull() {
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute("something").before().date(null);
}
Aggregations