use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder 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), anyObject());
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method after.
@Test
public void after() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).after().date(new Date());
filter.accept(visitor, null);
filter = builder.attribute(FOO_ATTRIBUTE).is().after().date(new Date());
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(2)).visit(isA(After.class), anyObject());
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method operatorDuringNull.
@Test(expected = IllegalArgumentException.class)
public void operatorDuringNull() {
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute("something").during().dates(null, null);
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method afterDate.
@Test
public void afterDate() {
final Date date = new Date();
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).is().after().date(date);
filter.accept(visitor, null);
ArgumentCaptor<After> expressionArgument = ArgumentCaptor.forClass(After.class);
verify(visitor).visit(expressionArgument.capture(), anyObject());
ExpressionVisitor expVisitor = spy(new DefaultExpressionVisitor() {
});
expressionArgument.getValue().getExpression1().accept(expVisitor, null);
ArgumentCaptor<PropertyName> propertyNameArgument = ArgumentCaptor.forClass(PropertyName.class);
verify(expVisitor).visit(propertyNameArgument.capture(), anyObject());
assertEquals(FOO_ATTRIBUTE, propertyNameArgument.getValue().getPropertyName());
expressionArgument.getValue().getExpression2().accept(expVisitor, null);
ArgumentCaptor<Literal> literalArgument = ArgumentCaptor.forClass(Literal.class);
verify(expVisitor).visit(literalArgument.capture(), anyObject());
assertEquals(date, ((Instant) literalArgument.getValue().getValue()).getPosition().getDate());
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method likeXPathInvalid.
@Test(expected = IllegalArgumentException.class)
public void likeXPathInvalid() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.xpath("foo").is().like().text("bar");
}
Aggregations