use of com.jayway.restassured.response.ValidatableResponse in project ddf by codice.
the class TestCatalogValidation method testFilterPluginNoFiltering.
@Test
public void testFilterPluginNoFiltering() throws Exception {
//Configure not enforcing validators so invalid metacards can ingest
configureEnforcedMetacardValidators(Collections.singletonList(""), getAdminConfig());
ingestXmlFromResourceAndWait(XML_RECORD_RESOURCE_PATH + "/sampleErrorMetacard.xml");
ingestXmlFromResourceAndWait(XML_RECORD_RESOURCE_PATH + "/sampleCleanMetacard.xml");
ingestXmlFromResourceAndWait(XML_RECORD_RESOURCE_PATH + "/sampleWarningMetacard.xml");
// Configure invalid filtering
configureMetacardValidityFilterPlugin(Arrays.asList("invalid-state=system-admin"), 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 one
response.body(containsString("error metacard"));
response.body(containsString("warning metacard"));
response.body(containsString("clean metacard"));
});
}
use of com.jayway.restassured.response.ValidatableResponse in project ddf by codice.
the class TestEmbeddedSolr method testCswIngest.
@Test
public void testCswIngest() {
Response response = ingestCswRecord();
ValidatableResponse validatableResponse = response.then();
validatableResponse.body(hasXPath("//TransactionResponse/TransactionSummary/totalInserted", is("1")), hasXPath("//TransactionResponse/TransactionSummary/totalUpdated", is("0")), hasXPath("//TransactionResponse/TransactionSummary/totalDeleted", is("0")), hasXPath("//TransactionResponse/InsertResult/BriefRecord/title", is("Aliquam fermentum purus quis arcu")), hasXPath("//TransactionResponse/InsertResult/BriefRecord/BoundingBox"));
try {
CatalogTestCommons.deleteMetacardUsingCswResponseId(response);
} catch (IOException | XPathExpressionException e) {
fail("Could not retrieve the ingested record's ID from the response.");
}
}
use of com.jayway.restassured.response.ValidatableResponse in project ddf by codice.
the class TestCatalog method testCswUpdateByFilterConstraintNoExistingMetacards.
@Test
public void testCswUpdateByFilterConstraintNoExistingMetacards() {
ValidatableResponse response = given().header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML).body(getFileContent(CSW_REQUEST_RESOURCE_PATH + "/CswUpdateByFilterConstraintRequest")).post(CSW_PATH.getUrl()).then();
response.body(hasXPath("//TransactionResponse/TransactionSummary/totalDeleted", is("0")), hasXPath("//TransactionResponse/TransactionSummary/totalInserted", is("0")), hasXPath("//TransactionResponse/TransactionSummary/totalUpdated", is("0")));
}
use of com.jayway.restassured.response.ValidatableResponse in project ddf by codice.
the class TestCatalog method assertIngestedDirectoryMonitor.
private ValidatableResponse assertIngestedDirectoryMonitor(String query, int numResults) {
long startTime = System.nanoTime();
ValidatableResponse response;
do {
response = executeOpenSearch("xml", "q=*" + query + "*");
if (response.extract().xmlPath().getList("metacards.metacard").size() == numResults) {
break;
}
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
}
} while (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime) < TimeUnit.MINUTES.toMillis(3));
response.body("metacards.metacard.size()", equalTo(numResults));
return response;
}
use of com.jayway.restassured.response.ValidatableResponse in project ddf by codice.
the class TestCatalogValidation method testQueryByWarningFailedValidators.
@Test
public void testQueryByWarningFailedValidators() throws Exception {
//Don't enforce the validator, so that it will be marked but ingested
configureEnforcedMetacardValidators(Collections.singletonList(""), getAdminConfig());
ingestXmlFromResourceAndWait(XML_RECORD_RESOURCE_PATH + "/sampleWarningMetacard.xml");
ingestXmlFromResourceAndWait(XML_RECORD_RESOURCE_PATH + "/sampleCleanMetacard.xml");
ingestXmlFromResourceAndWait(XML_RECORD_RESOURCE_PATH + "/sampleErrorMetacard.xml");
String query = new CswQueryBuilder().addAttributeFilter(PROPERTY_IS_LIKE, Validation.FAILED_VALIDATORS_WARNINGS, "sample-validator").getQuery();
ValidatableResponse response = given().header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML).body(query).post(CSW_PATH.getUrl()).then();
//clean metacard and warning metacard should be in results but not error one
response.body(not(containsString("error metacard")));
response.body(not(containsString("clean metacard")));
response.body(containsString("warning metacard"));
}
Aggregations