Search in sources :

Example 1 with PropertyIsLessThanOrEqualTo

use of org.opengis.filter.PropertyIsLessThanOrEqualTo 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));
    }
}
Also used : BinaryTemporalOperator(org.opengis.filter.temporal.BinaryTemporalOperator) Or(org.opengis.filter.Or) PropertyIsLessThanOrEqualTo(org.opengis.filter.PropertyIsLessThanOrEqualTo) Expression(org.opengis.filter.expression.Expression) Filter(org.opengis.filter.Filter) Date(java.util.Date) Ignore(org.junit.Ignore) CswQueryFactoryTest(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest) Test(org.junit.Test)

Example 2 with PropertyIsLessThanOrEqualTo

use of org.opengis.filter.PropertyIsLessThanOrEqualTo 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));
}
Also used : PropertyIsLessThanOrEqualTo(org.opengis.filter.PropertyIsLessThanOrEqualTo) Expression(org.opengis.filter.expression.Expression) CswQueryFactoryTest(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest) Test(org.junit.Test)

Example 3 with PropertyIsLessThanOrEqualTo

use of org.opengis.filter.PropertyIsLessThanOrEqualTo in project ddf by codice.

the class CswRecordMapperFilterVisitorTest 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));
}
Also used : PropertyIsLessThanOrEqualTo(org.opengis.filter.PropertyIsLessThanOrEqualTo) Expression(org.opengis.filter.expression.Expression) CswQueryFactoryTest(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest) Test(org.junit.Test)

Example 4 with PropertyIsLessThanOrEqualTo

use of org.opengis.filter.PropertyIsLessThanOrEqualTo in project ddf by codice.

the class CswRecordMapperFilterVisitorTest 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));
    }
}
Also used : BinaryTemporalOperator(org.opengis.filter.temporal.BinaryTemporalOperator) Or(org.opengis.filter.Or) PropertyIsLessThanOrEqualTo(org.opengis.filter.PropertyIsLessThanOrEqualTo) Expression(org.opengis.filter.expression.Expression) Filter(org.opengis.filter.Filter) Date(java.util.Date) Ignore(org.junit.Ignore) CswQueryFactoryTest(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest) Test(org.junit.Test)

Aggregations

CswQueryFactoryTest (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest)4 Test (org.junit.Test)4 PropertyIsLessThanOrEqualTo (org.opengis.filter.PropertyIsLessThanOrEqualTo)4 Expression (org.opengis.filter.expression.Expression)4 Date (java.util.Date)2 Ignore (org.junit.Ignore)2 Filter (org.opengis.filter.Filter)2 Or (org.opengis.filter.Or)2 BinaryTemporalOperator (org.opengis.filter.temporal.BinaryTemporalOperator)2