use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswCqlFilterTest method initCswSourceConfiguration.
private CswSourceConfiguration initCswSourceConfiguration(CswAxisOrder cswAxisOrder, String contentType, String effectiveDateMapping, String createdDateMapping, String modifiedDateMapping, String identifierMapping) {
CswSourceConfiguration cswSourceConfiguration = new CswSourceConfiguration();
cswSourceConfiguration.putMetacardCswMapping(Core.ID, identifierMapping);
cswSourceConfiguration.setCswAxisOrder(cswAxisOrder);
cswSourceConfiguration.putMetacardCswMapping(Metacard.CONTENT_TYPE, contentType);
cswSourceConfiguration.putMetacardCswMapping(Metacard.EFFECTIVE, effectiveDateMapping);
cswSourceConfiguration.putMetacardCswMapping(Core.CREATED, createdDateMapping);
cswSourceConfiguration.putMetacardCswMapping(Core.MODIFIED, modifiedDateMapping);
return cswSourceConfiguration;
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswFilterDelegateTest method initCswSourceConfiguration.
private CswSourceConfiguration initCswSourceConfiguration(CswAxisOrder cswAxisOrder, boolean usePosList, String contentType) {
CswSourceConfiguration cswSourceConfiguration = new CswSourceConfiguration();
cswSourceConfiguration.putMetacardCswMapping(Core.ID, CswConstants.CSW_IDENTIFIER);
cswSourceConfiguration.setCswAxisOrder(cswAxisOrder);
cswSourceConfiguration.setUsePosList(usePosList);
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 CswFilterDelegateTest 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);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswFilterDelegateTest method testIntersectsFallbackToNotDisjointPropertyOwsBoundingBox.
@Test
public void testIntersectsFallbackToNotDisjointPropertyOwsBoundingBox() throws JAXBException, SAXException, IOException {
String propName = CswConstants.BBOX_PROP;
CswSourceConfiguration cswSourceConfiguration = new CswSourceConfiguration();
cswSourceConfiguration.putMetacardCswMapping(Metacard.CONTENT_TYPE, CswConstants.CSW_TYPE);
CswFilterDelegate localCswFilterDelegate = initCswFilterDelegate(getMockFilterCapabilitiesForSpatialFallback(Arrays.asList(DISJOINT), Arrays.asList("Polygon")), initCswSourceConfiguration(CswAxisOrder.LAT_LON, false, CswConstants.CSW_TYPE));
FilterType filterType = localCswFilterDelegate.intersects(propName, polygonWkt);
assertXMLEqual(notDisjointPolygonXmlPropertyOwsBoundingBox, getXmlFromMarshaller(filterType));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswFilterDelegateTest method testRelative.
@Test
public void testRelative() throws JAXBException, SAXException, IOException {
long duration = 92000000000L;
CswSourceConfiguration cswSourceConfiguration = initCswSourceConfiguration(CswAxisOrder.LAT_LON, false, CswConstants.CSW_TYPE, effectiveDateMapping, createdDateMapping, modifiedDateMapping, CswConstants.CSW_IDENTIFIER);
CswFilterDelegate localCswFilterDelegate = createCswFilterDelegate(cswSourceConfiguration);
Map<String, Object> propMap = new HashMap<>();
propMap.put("extendedComparisonOp", "relative");
propMap.put("duration", new Long(duration));
String xml = getXmlProperty(localCswFilterDelegate, propertyNameModified, BETWEEN, testStartDate.toCalendar(null).getTime(), testEndDate.toCalendar(null).getTime(), propMap);
String durationCompare = duringXml.replace(REPLACE_START_DATE, "").replace(REPLACE_END_DATE, "").replace(REPLACE_TEMPORAL_PROPERTY, modifiedDateMapping);
String pattern = "(?i)(<ns.:Literal>)(.+?)(</ns.:Literal>)";
String compareXml = xml.replaceAll(pattern, "<ogc:Literal xmlns:ogc=\"http://www.opengis.net/ogc\"></ogc:Literal>");
Diff xmlDiff = new Diff(durationCompare, compareXml);
xmlDiff.overrideElementQualifier(new ElementNameQualifier() {
@Override
protected boolean equalsNamespace(Node control, Node test) {
return true;
}
});
xmlDiff.overrideDifferenceListener(new DifferenceListener() {
@Override
public int differenceFound(Difference diff) {
if (diff.getId() == DifferenceConstants.NAMESPACE_PREFIX_ID) {
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
return RETURN_ACCEPT_DIFFERENCE;
}
@Override
public void skippedComparison(Node arg0, Node arg1) {
}
});
assertXMLIdentical(xmlDiff, true);
}
Aggregations