use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class TestCswCqlFilter method initCswSourceConfiguration.
private CswSourceConfiguration initCswSourceConfiguration(CswAxisOrder cswAxisOrder, String contentType) {
CswSourceConfiguration cswSourceConfiguration = new CswSourceConfiguration();
cswSourceConfiguration.putMetacardCswMapping(Core.ID, CswConstants.CSW_IDENTIFIER);
cswSourceConfiguration.setCswAxisOrder(cswAxisOrder);
cswSourceConfiguration.putMetacardCswMapping(Metacard.CONTENT_TYPE, contentType);
return cswSourceConfiguration;
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration 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));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration 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));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class TestCswFilterDelegate method testConfigurableMetacardMapping.
@Test
public void testConfigurableMetacardMapping() throws JAXBException, SAXException, IOException {
// Setup
CswSourceConfiguration cswSourceConfiguration = new CswSourceConfiguration();
cswSourceConfiguration.putMetacardCswMapping(Core.ID, CswConstants.CSW_IDENTIFIER);
cswSourceConfiguration.putMetacardCswMapping(Core.MODIFIED, CswConstants.CSW_MODIFIED);
cswSourceConfiguration.putMetacardCswMapping(Core.CREATED, CswConstants.CSW_CREATED);
cswSourceConfiguration.putMetacardCswMapping(Metacard.EFFECTIVE, CswConstants.CSW_DATE_SUBMITTED);
cswSourceConfiguration.putMetacardCswMapping(Metacard.CONTENT_TYPE, CswConstants.CSW_FORMAT);
cswSourceConfiguration.setCswAxisOrder(CswAxisOrder.LAT_LON);
cswSourceConfiguration.setUsePosList(false);
String contentType = "myContentType";
CswFilterDelegate localCswFilterDelegate = createCswFilterDelegate(cswSourceConfiguration);
// Perform Test
/**
* Incoming query with Metacard.CONTENT_TYPE equal to myContentType. Metacard.CONTENT_TYPE
* will be mapped to format in the CswFilterDelegate.
*/
FilterType filterType = localCswFilterDelegate.propertyIsEqualTo(Metacard.CONTENT_TYPE, contentType, isCaseSensitive);
// Verify
/**
* Verify that a PropertyIsEqualTo filter is created with PropertyName of format and Literal
* equal to myContentType
*/
assertXMLEqual(configurableContentTypeMappingXml, getXmlFromMarshaller(filterType));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class TestCswFilterDelegate method testDuringAlteredCreatedDateMapping.
@Test
public void testDuringAlteredCreatedDateMapping() throws JAXBException, SAXException, IOException {
String replacedTemporalProperty = "myCreatedDate";
CswSourceConfiguration cswSourceConfiguration = initCswSourceConfiguration(CswAxisOrder.LAT_LON, false, CswConstants.CSW_TYPE, effectiveDateMapping, replacedTemporalProperty, modifiedDateMapping, CswConstants.CSW_IDENTIFIER);
CswFilterDelegate localCswFilterDelegate = createCswFilterDelegate(cswSourceConfiguration);
String xml = getXmlProperty(localCswFilterDelegate, propertyNameCreated, BETWEEN, testStartDate.toCalendar(null).getTime(), testEndDate.toCalendar(null).getTime());
DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
String startDateStr = fmt.print(testStartDate);
String endDateStr = fmt.print(testEndDate);
String testResponse = duringXml.replace(REPLACE_START_DATE, startDateStr).replace(REPLACE_END_DATE, endDateStr).replace(REPLACE_TEMPORAL_PROPERTY, replacedTemporalProperty);
assertXMLEqual(testResponse, xml);
}
Aggregations