use of org.opengis.filter.temporal.BinaryTemporalOperator in project ddf by codice.
the class CswQueryFactoryTest method ogcOrdTemporalQuery.
/**
* Runs an Or'd query of multiple binary Temporal OGC Query, verifying that the right filter
* class is generated based on OGC Filter
*
* @param temporalOps The Temporal query, in terms of a binary comparison
* @throws UnsupportedQueryException
* @throws SourceUnavailableException
* @throws FederationException
* @throws CswException
*/
@SuppressWarnings("unchecked")
private void ogcOrdTemporalQuery(JAXBElement<BinaryComparisonOpType> temporalOps) throws UnsupportedQueryException, SourceUnavailableException, FederationException, CswException {
Filter filter = generateTemporalFilter(temporalOps);
assertThat(filter, instanceOf(Or.class));
Or ordTemporal = (Or) filter;
List<Filter> temporalFilters = ordTemporal.getChildren();
List<Class<? extends BinaryTemporalOperator>> classes = new ArrayList<>();
for (Filter temporal : temporalFilters) {
assertThat(temporal, instanceOf(BinaryTemporalOperator.class));
classes.add((Class<? extends BinaryTemporalOperator>) temporal.getClass());
}
}
use of org.opengis.filter.temporal.BinaryTemporalOperator 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.temporal.BinaryTemporalOperator in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsGreaterThanOrEqualToTemporal.
@Ignore("not supported by solr provider")
@Test
public void testVisitPropertyIsGreaterThanOrEqualToTemporal() {
Expression val = factory.literal(new Date());
PropertyIsGreaterThanOrEqualTo filter = factory.greaterOrEqual(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(After.class)));
assertThat(binary.getExpression1(), is(created));
assertThat(binary.getExpression2(), is(val));
}
}
Aggregations