use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswFilterDelegateTest method testPropertyIsEqualToAlternateIdMapping.
@Test
public void testPropertyIsEqualToAlternateIdMapping() throws JAXBException, SAXException, IOException {
String replacedIdentifierProperty = propertyName;
CswSourceConfiguration cswSourceConfiguration = initCswSourceConfiguration(CswAxisOrder.LAT_LON, false, CswConstants.CSW_TYPE, effectiveDateMapping, createdDateMapping, modifiedDateMapping, replacedIdentifierProperty);
CswFilterDelegate localCswFilterDelegate = createCswFilterDelegate(cswSourceConfiguration);
FilterType filterType = localCswFilterDelegate.propertyIsEqualTo(Core.ID, stringLiteral, isCaseSensitive);
assertXMLEqual(propertyIsEqualToXml, getXmlFromMarshaller(filterType));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswFilterDelegateTest method testDuring.
@Test
public void testDuring() throws JAXBException, SAXException, IOException {
CswSourceConfiguration cswSourceConfiguration = initCswSourceConfiguration(CswAxisOrder.LAT_LON, false, CswConstants.CSW_TYPE, effectiveDateMapping, createdDateMapping, modifiedDateMapping, CswConstants.CSW_IDENTIFIER);
CswFilterDelegate localCswFilterDelegate = createCswFilterDelegate(cswSourceConfiguration);
String xml = getXmlProperty(localCswFilterDelegate, propertyNameModified, 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, modifiedDateMapping);
assertXMLEqual(testResponse, xml);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswFilterDelegateTest method testConfigurableMetacardMappingApiso.
@Test
public void testConfigurableMetacardMappingApiso() throws JAXBException, SAXException, IOException {
// Setup
CswSourceConfiguration cswSourceConfiguration = new CswSourceConfiguration();
cswSourceConfiguration.putMetacardCswMapping(Core.ID, APISO_IDENTIFIER);
cswSourceConfiguration.putMetacardCswMapping(Core.MODIFIED, APISO_MODIFIED);
cswSourceConfiguration.putMetacardCswMapping(Metacard.CONTENT_TYPE, APISO_TYPE);
cswSourceConfiguration.putMetacardCswMapping(Core.TITLE, APISO_TITLE);
cswSourceConfiguration.putMetacardCswMapping(CswConstants.ANY_TEXT, APISO_ANYTEXT);
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(configurableApisoTypeMappingXml, getXmlFromMarshaller(filterType));
/**
* Incoming query with Metacard.ANY_TEXT equal to myContentType. Metacard.ANY_TEXT will be
* mapped to format in the CswFilterDelegate.
*/
FilterType anyTextfilterType = localCswFilterDelegate.propertyIsLike(Metacard.ANY_TEXT, contentType, isCaseSensitive);
String xml = getXmlFromMarshaller(anyTextfilterType);
assertXMLEqual(configurableApisoAnyTextMappingXml, xml);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswCqlFilterTest method testRelative.
@Test
public void testRelative() throws UnsupportedQueryException {
long duration = 92000000000L;
CswSourceConfiguration cswSourceConfiguration = initCswSourceConfiguration(CswAxisOrder.LAT_LON, CswConstants.CSW_TYPE, effectiveDateMapping, createdDateMapping, modifiedDateMapping, CswConstants.CSW_IDENTIFIER);
CswFilterDelegate localCswFilterDelegate = initDefaultCswFilterDelegate(cswSourceConfiguration);
FilterType filterType = localCswFilterDelegate.relative(propertyNameModified, duration);
String cqlText = CswCqlTextFilter.getInstance().getCqlText(filterType);
String durationCompare = during.replace(REPLACE_START_DATE, "").replace(REPLACE_END_DATE, "").replace(REPLACE_TEMPORAL_PROPERTY, modifiedDateMapping);
String pattern = "(?i)(')(.+?)(')";
String compareXml = cqlText.replaceAll(pattern, "''");
assertThat(durationCompare, is(compareXml));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswCqlFilterTest 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(cqlText, is(testResponse));
}
Aggregations