Search in sources :

Example 71 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswCqlFilter method testPropertyIsLessThanOrEqualToFloatLiteral.

@Test
public void testPropertyIsLessThanOrEqualToFloatLiteral() throws UnsupportedQueryException {
    FilterType filterType = cswFilterDelegate.propertyIsLessThanOrEqualTo(propertyName, floatLiteral);
    String cqlText = CswCqlTextFilter.getInstance().getCqlText(filterType);
    assertThat(propertyIsLessThanOrEqualToWithDecimal, is(cqlText));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) Test(org.junit.Test)

Example 72 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswCqlFilter method testDuring.

@Test
public void testDuring() throws UnsupportedQueryException {
    DateTime startDate = new DateTime(2013, 5, 1, 0, 0, 0, 0);
    DateTime endDate = new DateTime(2013, 12, 31, 0, 0, 0, 0);
    CswSourceConfiguration cswSourceConfiguration = initCswSourceConfiguration(CswAxisOrder.LAT_LON, CswConstants.CSW_TYPE, effectiveDateMapping, createdDateMapping, modifiedDateMapping, CswConstants.CSW_IDENTIFIER);
    CswFilterDelegate cswFilterDelegate = initDefaultCswFilterDelegate(cswSourceConfiguration);
    FilterType filterType = cswFilterDelegate.during(propertyNameModified, startDate.toCalendar(null).getTime(), endDate.toCalendar(null).getTime());
    String cqlText = CswCqlTextFilter.getInstance().getCqlText(filterType);
    DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
    String startDateStr = fmt.print(startDate);
    String endDateStr = fmt.print(endDate);
    String testResponse = during.replace(REPLACE_START_DATE, startDateStr).replace(REPLACE_END_DATE, endDateStr).replace(REPLACE_TEMPORAL_PROPERTY, modifiedDateMapping);
    assertThat(testResponse, is(cqlText));
}
Also used : CswSourceConfiguration(org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration) FilterType(net.opengis.filter.v_1_1_0.FilterType) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 73 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswCqlFilter method testPropertyIsEqualToStringLiteralType.

@Test
public void testPropertyIsEqualToStringLiteralType() throws UnsupportedQueryException {
    FilterType filterType = cswFilterDelegate.propertyIsEqualTo(Metacard.CONTENT_TYPE, contentTypeLiteral, isCaseSensitive);
    String cqlText = CswCqlTextFilter.getInstance().getCqlText(filterType);
    assertThat(propertyIsEqualToContentType, is(cqlText));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) Test(org.junit.Test)

Example 74 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswCqlFilter method testDuringAlteredEffectiveDateMapping.

@Test
public void testDuringAlteredEffectiveDateMapping() throws UnsupportedQueryException {
    DateTime startDate = new DateTime(2013, 5, 1, 0, 0, 0, 0);
    DateTime endDate = new DateTime(2013, 12, 31, 0, 0, 0, 0);
    String replacedTemporalProperty = "myEffectiveDate";
    CswSourceConfiguration cswSourceConfiguration = initCswSourceConfiguration(CswAxisOrder.LAT_LON, CswConstants.CSW_TYPE, replacedTemporalProperty, createdDateMapping, modifiedDateMapping, CswConstants.CSW_IDENTIFIER);
    CswFilterDelegate cswFilterDelegate = initDefaultCswFilterDelegate(cswSourceConfiguration);
    FilterType filterType = cswFilterDelegate.during(propertyNameEffective, startDate.toCalendar(null).getTime(), endDate.toCalendar(null).getTime());
    String cqlText = CswCqlTextFilter.getInstance().getCqlText(filterType);
    DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
    String startDateStr = fmt.print(startDate);
    String endDateStr = fmt.print(endDate);
    String testResponse = during.replace(REPLACE_START_DATE, startDateStr).replace(REPLACE_END_DATE, endDateStr).replace(REPLACE_TEMPORAL_PROPERTY, replacedTemporalProperty);
    assertThat(testResponse, is(cqlText));
}
Also used : CswSourceConfiguration(org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration) FilterType(net.opengis.filter.v_1_1_0.FilterType) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 75 with FilterType

use of net.opengis.filter.v_2_0_0.FilterType in project ddf by codice.

the class TestCswCqlFilter method testPropertyIsEqualToDateLiteral.

/**
     * Verify that when given a non ISO 8601 formatted date, the CswFilterDelegate converts the date
     * to ISO 8601 format (ie. the xml generated off of the filterType should have an ISO 8601
     * formatted date in it).
     */
@Test
public void testPropertyIsEqualToDateLiteral() throws UnsupportedQueryException {
    LOGGER.debug("Input date: {}", date);
    LOGGER.debug("ISO 8601 formatted date: {}", convertDateToIso8601Format(getDate()));
    FilterType filterType = cswFilterDelegate.propertyIsEqualTo(propertyName, date);
    String cqlText = CswCqlTextFilter.getInstance().getCqlText(filterType);
    assertThat(propertyIsEqualToWithDate, is(cqlText));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)212 FilterType (net.opengis.filter.v_1_1_0.FilterType)209 FilterType (net.opengis.filter.v_2_0_0.FilterType)58 ArrayList (java.util.ArrayList)50 JAXBElement (javax.xml.bind.JAXBElement)12 CswSourceConfiguration (org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration)12 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)11 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)11 QName (javax.xml.namespace.QName)10 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)10 LineString (com.vividsolutions.jts.geom.LineString)9 Date (java.util.Date)9 DistanceBufferType (net.opengis.filter.v_2_0_0.DistanceBufferType)9 UnaryLogicOpType (net.opengis.filter.v_2_0_0.UnaryLogicOpType)9 DateTime (org.joda.time.DateTime)8 Method (java.lang.reflect.Method)7 QueryConstraintType (net.opengis.cat.csw.v_2_0_2.QueryConstraintType)7 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)7 TimePeriodType (net.opengis.gml.v_3_2_1.TimePeriodType)7 TimePositionType (net.opengis.gml.v_3_2_1.TimePositionType)7