use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class TestCswSource method testRefreshWithEmptyConfiguration.
@Test
public void testRefreshWithEmptyConfiguration() throws SecurityServiceException {
AbstractCswSource cswSource = getCswSource(null, null, "type", null, null, encryptionService);
CswSourceConfiguration defaultCswSourceConfiguration = getStandardCswSourceConfiguration(null, null, null, encryptionService);
Map<String, Object> configuration = new HashMap<>();
// Assert that the default configuration is set
assertDefaultCswSourceConfiguration(cswSource.cswSourceConfiguration, defaultCswSourceConfiguration);
cswSource.refresh(configuration);
// Assert that the configuration does not change with an empty map
assertDefaultCswSourceConfiguration(cswSource.cswSourceConfiguration, defaultCswSourceConfiguration);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class TestCswSource method testRefreshWithNullConfiguration.
@Test
public void testRefreshWithNullConfiguration() throws SecurityServiceException {
AbstractCswSource cswSource = getCswSource(null, null, "type", null, null, encryptionService);
CswSourceConfiguration defaultCswSourceConfiguration = getStandardCswSourceConfiguration(null, null, null, encryptionService);
// Assert that the default configuration is set
assertDefaultCswSourceConfiguration(cswSource.cswSourceConfiguration, defaultCswSourceConfiguration);
cswSource.refresh(null);
// Assert that the configuration does not change with a null map
assertDefaultCswSourceConfiguration(cswSource.cswSourceConfiguration, defaultCswSourceConfiguration);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswFilterDelegateTest method testAfter.
@Test
public void testAfter() throws Exception {
// Setup
CswSourceConfiguration cswSourceConfiguration = initCswSourceConfiguration(CswAxisOrder.LAT_LON, false, CswConstants.CSW_TYPE, effectiveDateMapping, createdDateMapping, modifiedDateMapping, CswConstants.CSW_IDENTIFIER);
DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
String dateStr = fmt.print(testStartDate);
String controlFilterAsXml = afterXml.replace(REPLACE_TEMPORAL_PROPERTY, createdDateMapping).replace(REPLACE_DATE, dateStr);
CswFilterDelegate localCswFilterDelegate = createCswFilterDelegate(cswSourceConfiguration);
// Perform Test
FilterType filterType = localCswFilterDelegate.after(propertyNameCreated, testStartDate.toDate());
// Verify
assertXMLEqual(controlFilterAsXml, getXmlFromMarshaller(filterType));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswFilterDelegateTest method testDuringAlteredModifiedDateMapping.
@Test
public void testDuringAlteredModifiedDateMapping() throws JAXBException, SAXException, IOException {
String replacedTemporalProperty = "myModifiedDate";
CswSourceConfiguration cswSourceConfiguration = initCswSourceConfiguration(CswAxisOrder.LAT_LON, false, CswConstants.CSW_TYPE, effectiveDateMapping, createdDateMapping, replacedTemporalProperty, 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, replacedTemporalProperty);
assertXMLEqual(testResponse, xml);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration in project ddf by codice.
the class CswSourceTest method testRefresh.
@Test
public void testRefresh() throws SecurityServiceException {
AbstractCswSource cswSource = getCswSource(mockCsw, mockContext, "contentType");
CswSourceConfiguration defaultCswSourceConfiguration = getStandardCswSourceConfiguration("contentType", "qname", "queryprefix", encryptionService, permissions);
// Assert Defaults
assertDefaultCswSourceConfiguration(cswSource.cswSourceConfiguration, defaultCswSourceConfiguration);
// Set Configuration Map
Map<String, Object> configuration = getConfigurationMap(cswSource);
when(encryptionService.decryptValue(PASSWORD)).thenReturn(PASSWORD);
// Call Refresh
cswSource.refresh(configuration);
// Get Configuration
CswSourceConfiguration cswSourceConfiguration = cswSource.cswSourceConfiguration;
// Assert Refresh Changes
assertConfigurationAfterRefresh(cswSourceConfiguration);
}
Aggregations