use of ddf.catalog.filter.FilterBuilder 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);
}
use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class FilterBuilderTest method likeCaseSensitive.
@Test
public void likeCaseSensitive() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).is().like().caseSensitiveText("bAr");
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(1)).visit(isA(PropertyIsLike.class), any());
// TODO check case sensitivity
}
use of ddf.catalog.filter.FilterBuilder 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), any());
}
use of ddf.catalog.filter.FilterBuilder 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), any());
}
use of ddf.catalog.filter.FilterBuilder 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), any());
}
Aggregations