use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class FilterBuilderTest method notNull.
@Test
public void notNull() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.not(builder.attribute(FOO_ATTRIBUTE).is().empty());
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(1)).visit(isA(Not.class), any());
inOrder.verify(visitor).visit(isA(PropertyIsNull.class), any());
}
use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class FilterBuilderTest method propertyIsEqual.
@Test
public void propertyIsEqual() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).equalTo().text("bar");
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).is().equalTo().text("bar");
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).is().text("bar");
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().bool(true);
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().bytes(new byte[] {});
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().date(new Date());
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().number((short) 5);
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().number(new Integer(5));
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().number(new Long(5));
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().number(new Float(5));
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().number(new Double(5));
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().wkt("POINT (10, 30)");
filter.accept(visitor, null);
filter = builder.attribute(null).is().text(null);
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).equalTo().dateRange(new Date(1), new Date(2));
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(13)).visit(isA(PropertyIsEqualTo.class), any());
inOrder.verify(visitor, times(1)).visit(isA(During.class), any());
}
use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class FilterBuilderTest method operatorWithinBufferNull.
@Test(expected = IllegalArgumentException.class)
public void operatorWithinBufferNull() {
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute("something").withinBuffer().wkt(null);
}
use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class FilterBuilderTest method propertyIsBetween.
@Test
public void propertyIsBetween() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Long(5), new Long(7));
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).is().between().numbers(new Long(5), new Long(7));
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).between().numbers((short) 5, (short) 7);
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Integer(5), new Integer(7));
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Long(5), new Long(7));
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Float(5), new Float(7));
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).between().numbers(new Double(5), new Double(7));
filter.accept(visitor, null);
filter = builder.attribute(null).is().between().numbers(null, (Integer) null);
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(8)).visit(isA(PropertyIsBetween.class), any());
}
use of ddf.catalog.filter.FilterBuilder in project ddf by codice.
the class FilterBuilderTest method operatorBeyondNull.
@Test(expected = IllegalArgumentException.class)
public void operatorBeyondNull() {
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute("something").beyond().wkt(null);
}
Aggregations