use of com.jayway.restassured.response.ValidatableResponse in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method searchForExistingKeyword.
@Test
@UsingDataSet(locations = "searchForExistingKeyword.json")
public void searchForExistingKeyword() {
final ValidatableResponse result = doSearchFor("Testmessage");
final JsonPath response = result.statusCode(200).extract().jsonPath();
assertThat(response.getInt("total_results")).isEqualTo(1);
assertThat(response.getList("messages")).hasSize(1);
assertThat(response.getList("used_indices")).hasSize(1);
}
use of com.jayway.restassured.response.ValidatableResponse in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method searchForExistingKeywordInsideOfVeryNarrowTimeRange.
@Test
@UsingDataSet(locations = "searchForExistingKeyword.json")
public void searchForExistingKeywordInsideOfVeryNarrowTimeRange() {
final ValidatableResponse result = doSearchFor("Testmessage", "2015-06-16T11:32:16.827Z", "2015-06-16T11:32:16.827Z");
final JsonPath response = result.statusCode(200).extract().jsonPath();
assertThat(response.getInt("total_results")).isEqualTo(1);
assertThat(response.getList("messages")).isNotEmpty();
assertThat(response.getList("used_indices")).hasSize(1);
}
use of com.jayway.restassured.response.ValidatableResponse in project graylog2-server by Graylog2.
the class ContentPackStreamsTest method createContentPackWithStreams.
private URI createContentPackWithStreams() {
final ValidatableResponse validatableResponse = given().when().body(jsonResourceForMethod()).post("/system/bundles").then().statusCode(201).statusLine(notNullValue());
final String locationHeader = validatableResponse.extract().header(HttpHeaders.LOCATION);
final URI uri = URI.create(locationHeader);
assertThat(uri.getPath()).startsWith("/system/bundles");
return uri;
}
use of com.jayway.restassured.response.ValidatableResponse in project graylog2-server by Graylog2.
the class GrokTests method createGrokPattern.
@Test
public void createGrokPattern() {
final ValidatableResponse validatableResponse = given().when().body(jsonResourceForMethod()).post("/system/grok").then().statusCode(201).statusLine(notNullValue());
id = validatableResponse.extract().body().jsonPath().get("id").toString();
validatableResponse.body(".", containsAllKeys("id", "name", "pattern", "content_pack"));
}
use of com.jayway.restassured.response.ValidatableResponse in project ddf by codice.
the class TestCatalogValidation method testFilterPluginErrorsOnly.
@Test
public void testFilterPluginErrorsOnly() 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());
//Configure to filter metacards with validation errors but not validation warnings
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 one
response.body(not(containsString("error metacard")));
response.body(containsString("clean metacard"));
response.body(containsString("warning metacard"));
});
}
Aggregations