use of org.opengis.filter.expression.Expression in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testSourceIdFilter.
@Test
public void testSourceIdFilter() {
Expression val = factory.literal("source1");
Expression val2 = factory.literal("source2");
Expression sourceExpr = factory.property(Core.SOURCE_ID);
PropertyIsEqualTo filter = factory.equal(sourceExpr, val, false);
Filter filter2 = factory.equal(sourceExpr, val2, false);
Filter likeFilter = factory.like(attrExpr, "something");
Filter sourceFilter = factory.or(filter, filter2);
Filter totalFilter = factory.and(sourceFilter, likeFilter);
Object obj = totalFilter.accept(visitor, null);
assertThat(obj, instanceOf(PropertyIsLike.class));
PropertyIsLike duplicate = (PropertyIsLike) obj;
assertThat(duplicate.getExpression(), is(attrExpr));
assertThat(duplicate.getLiteral(), is("something"));
assertThat(visitor.getSourceIds().size(), is(2));
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsLessThanOrEqualToTemporal.
@Ignore("not supported by solr provider")
@Test
public void testVisitPropertyIsLessThanOrEqualToTemporal() {
Expression val = factory.literal(new Date());
PropertyIsLessThanOrEqualTo filter = factory.lessOrEqual(created, val);
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(Or.class));
Or duplicate = (Or) obj;
for (Filter child : duplicate.getChildren()) {
BinaryTemporalOperator binary = (BinaryTemporalOperator) child;
assertThat(binary, anyOf(instanceOf(TEquals.class), instanceOf(Before.class)));
assertThat(binary.getExpression1(), is(created));
assertThat(binary.getExpression2(), is(val));
}
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsGreaterThan.
@Test
public void testVisitPropertyIsGreaterThan() {
Expression val = factory.literal(8);
PropertyIsGreaterThan filter = factory.greater(attrExpr, val);
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(PropertyIsGreaterThan.class));
PropertyIsGreaterThan duplicate = (PropertyIsGreaterThan) obj;
assertThat(duplicate.getExpression1(), is(attrExpr));
assertThat(duplicate.getExpression2(), is(val));
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsLessThanOrEqualTo.
@Test
public void testVisitPropertyIsLessThanOrEqualTo() {
Expression val = factory.literal(8);
PropertyIsLessThanOrEqualTo filter = factory.lessOrEqual(attrExpr, val);
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(PropertyIsLessThanOrEqualTo.class));
PropertyIsLessThanOrEqualTo duplicate = (PropertyIsLessThanOrEqualTo) obj;
assertThat(duplicate.getExpression1(), is(attrExpr));
assertThat(duplicate.getExpression2(), is(val));
}
use of org.opengis.filter.expression.Expression in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsBetween.
@Test
public void testVisitPropertyIsBetween() {
Expression lower = factory.literal(4);
Expression upper = factory.literal(7);
PropertyIsBetween filter = factory.between(attrExpr, lower, upper);
PropertyIsBetween duplicate = (PropertyIsBetween) visitor.visit(filter, null);
assertThat(duplicate.getExpression(), is(attrExpr));
assertThat(duplicate.getLowerBoundary(), is(lower));
assertThat(duplicate.getUpperBoundary(), is(upper));
}
Aggregations