use of com.jayway.restassured.path.json.JsonPath in project graylog2-server by Graylog2.
the class AlarmCallbackHistoryResourceTest method listHistoriesWhenNoHistoriesArePresent.
@Test
public void listHistoriesWhenNoHistoriesArePresent() throws Exception {
final JsonPath response = given().when().get(url).then().statusCode(200).assertThat().body(".", containsAllKeys("total", "histories")).extract().jsonPath();
assertThat(response.getInt("total")).isEqualTo(0);
assertThat(response.getList("histories")).isEmpty();
}
use of com.jayway.restassured.path.json.JsonPath in project graylog2-server by Graylog2.
the class AlarmCallbackHistoryResourceTest method getHistoryForAlert.
@Test
public void getHistoryForAlert() throws Exception {
final JsonPath response = given().when().get(url).then().statusCode(200).assertThat().body(".", containsAllKeys("total", "histories")).extract().jsonPath();
assertThat(response.getInt("total")).isEqualTo(2);
assertThat(response.getList("histories")).isNotEmpty();
}
use of com.jayway.restassured.path.json.JsonPath in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method searchForAllMessages.
@Test
@UsingDataSet(locations = "searchForExistingKeyword.json")
public void searchForAllMessages() {
final ValidatableResponse result = doSearchFor("*");
final JsonPath response = result.statusCode(200).extract().jsonPath();
assertThat(response.getInt("total_results")).isEqualTo(2);
assertThat(response.getList("messages")).hasSize(2);
assertThat(response.getList("used_indices")).hasSize(1);
}
use of com.jayway.restassured.path.json.JsonPath in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method searchForExistingKeywordOutsideOfTimeRange.
@Test
@UsingDataSet(locations = "searchForExistingKeyword.json")
public void searchForExistingKeywordOutsideOfTimeRange() {
final ValidatableResponse result = doSearchFor("Testmessage", "2015-06-14T11:32:16.827Z", "2015-06-15T11:32:16.827Z");
final JsonPath response = result.statusCode(200).extract().jsonPath();
assertThat(response.getInt("total_results")).isEqualTo(0);
assertThat(response.getList("messages")).isEmpty();
assertThat(response.getList("used_indices")).hasSize(1);
}
use of com.jayway.restassured.path.json.JsonPath in project graylog2-server by Graylog2.
the class AbsoluteSearchResourceTest method doSearchFor.
protected ValidatableResponse doSearchFor(String query, String from, String to) {
final ValidatableResponse result = given().when().param("query", query).param("from", from).param("to", to).get("/search/universal/absolute").then().body(".", containsAllKeys("query", "built_query", "used_indices", "messages", "fields", "time", "total_results", "from", "to"));
final JsonPath resultBody = result.extract().jsonPath();
assertThat(resultBody.getString("query")).isEqualTo(query);
return result;
}
Aggregations