Search in sources :

Example 1 with PropertyIsGreaterThan

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

the class TestCswRecordMapperFilterVisitor method testVisitPropertyIsGreaterThanTemporal.

@Test
public void testVisitPropertyIsGreaterThanTemporal() {
    Expression val = factory.literal(new Date(System.currentTimeMillis() - 1000));
    Expression test = new AttributeExpressionImpl(new NameImpl(new QName(CswConstants.DUBLIN_CORE_SCHEMA, "TestDate", CswConstants.DUBLIN_CORE_NAMESPACE_PREFIX)));
    PropertyIsGreaterThan filter = factory.greater(test, val);
    Object obj = visitor.visit(filter, null);
    assertThat(obj, instanceOf(During.class));
    During duplicate = (During) obj;
    assertThat(duplicate.getExpression1(), is(test));
    assertThat(duplicate.getExpression2(), is(val));
}
Also used : NameImpl(org.geotools.feature.NameImpl) Expression(org.opengis.filter.expression.Expression) AttributeExpressionImpl(org.geotools.filter.AttributeExpressionImpl) QName(javax.xml.namespace.QName) Date(java.util.Date) During(org.opengis.filter.temporal.During) PropertyIsGreaterThan(org.opengis.filter.PropertyIsGreaterThan) CswQueryFactoryTest(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest) Test(org.junit.Test)

Example 2 with PropertyIsGreaterThan

use of org.opengis.filter.PropertyIsGreaterThan 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));
}
Also used : Expression(org.opengis.filter.expression.Expression) PropertyIsGreaterThan(org.opengis.filter.PropertyIsGreaterThan) 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)2 Test (org.junit.Test)2 PropertyIsGreaterThan (org.opengis.filter.PropertyIsGreaterThan)2 Expression (org.opengis.filter.expression.Expression)2 Date (java.util.Date)1 QName (javax.xml.namespace.QName)1 NameImpl (org.geotools.feature.NameImpl)1 AttributeExpressionImpl (org.geotools.filter.AttributeExpressionImpl)1 During (org.opengis.filter.temporal.During)1