use of org.codice.ddf.itests.common.csw.CswQueryBuilder in project ddf by codice.
the class TestCatalogValidation method testEnforceValidityErrorsAndWarnings.
@Test
public void testEnforceValidityErrorsAndWarnings() throws Exception {
//Configure to enforce validator
configureEnforcedMetacardValidators(Collections.singletonList("sample-validator"), getAdminConfig());
//Configure to enforce errors and warnings
configureEnforceValidityErrorsAndWarnings("true", "true", getAdminConfig());
ingestXmlFromResourceWaitForFailure(XML_RECORD_RESOURCE_PATH + "/sampleWarningMetacard.xml");
ingestXmlFromResourceAndWait(XML_RECORD_RESOURCE_PATH + "/sampleCleanMetacard.xml");
ingestXmlFromResourceWaitForFailure(XML_RECORD_RESOURCE_PATH + "/sampleErrorMetacard.xml");
configureFilterInvalidMetacards("true", "false", getAdminConfig());
testWithRetry(() -> {
String query = new CswQueryBuilder().addAttributeFilter(PROPERTY_IS_LIKE, "AnyText", "*").getQuery();
ValidatableResponse response = given().header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML).body(query).post(CSW_PATH.getUrl()).then();
//clean metacard should be in results but not invalid ones
response.body(not(containsString("warning metacard")));
response.body(containsString("clean metacard"));
response.body(not(containsString("error metacard")));
});
}
use of org.codice.ddf.itests.common.csw.CswQueryBuilder in project ddf by codice.
the class AbstractIntegrationTest method isCatalogEmpty.
protected boolean isCatalogEmpty() {
try {
String query = new CswQueryBuilder().addAttributeFilter(PROPERTY_IS_LIKE, "AnyText", "*").getQuery();
ValidatableResponse response = given().header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML).body(query).auth().basic("admin", "admin").post(CSW_PATH.getUrl()).then();
response.body(hasXPath("/GetRecordsResponse/SearchResults[@numberOfRecordsMatched=\"0\"]"));
return true;
} catch (AssertionError e) {
return false;
}
}
Aggregations