use of io.restassured.response.Response in project graylog2-server by Graylog2.
the class MessagesResourceIT method testInvalidQueryResponse.
@ContainerMatrixTest
void testInvalidQueryResponse() {
sut.importElasticsearchFixture("messages-for-export.json", MessagesResourceIT.class);
String allMessagesTimeRange = "{\"timerange\": {\"type\": \"absolute\", \"from\": \"2015-01-01T00:00:00\", \"to\": \"2015-01-01T23:59:59\"}}";
Response r = given().spec(requestSpec).accept("text/csv").body(allMessagesTimeRange).expect().response().statusCode(200).contentType("text/csv").when().post("/views/search/messages");
String[] resultLines = r.asString().split("\n");
assertThat(resultLines).startsWith("\"timestamp\",\"source\",\"message\"").as("should contain header");
assertThat(Arrays.copyOfRange(resultLines, 1, 5)).containsExactlyInAnyOrder("\"2015-01-01T04:00:00.000Z\",\"source-2\",\"Ho\"", "\"2015-01-01T03:00:00.000Z\",\"source-1\",\"Hi\"", "\"2015-01-01T02:00:00.000Z\",\"source-2\",\"He\"", "\"2015-01-01T01:00:00.000Z\",\"source-1\",\"Ha\"");
}
use of io.restassured.response.Response in project SSM by Intel-bigdata.
the class ActionRestApi method getActionsSupported.
/**
* Get list of action names supported in SmartServer.
* @return
*/
public static List<String> getActionsSupported() {
Response response = RestAssured.get(ACTIONROOT + "/registry/list");
response.then().body("status", Matchers.equalTo("OK"));
return response.jsonPath().getList("body");
}
use of io.restassured.response.Response in project SSM by Intel-bigdata.
the class ActionRestApi method getActionInfoMap.
public static Map getActionInfoMap(long aid) {
Response actionInfo = RestAssured.get(ACTIONROOT + "/" + aid + "/info");
actionInfo.then().body("status", Matchers.equalTo("OK"));
JsonPath actionInfoPath = new JsonPath(actionInfo.asString());
Map actionInfoMap = actionInfoPath.getMap("body");
return actionInfoMap;
}
use of io.restassured.response.Response in project SSM by Intel-bigdata.
the class ActionRestApi method getActionIds.
/**
* Get aids of a cmdlet.
* @param cid
* @return
*/
public static List<Long> getActionIds(long cid) {
Response cmdletInfo = RestAssured.get(CMDLETROOT + "/" + cid + "/info");
cmdletInfo.then().body("status", Matchers.equalTo("OK"));
JsonPath cmdletInfoPath = new JsonPath(cmdletInfo.asString());
List<Long> ret = new ArrayList<>();
for (Object obj : (List) cmdletInfoPath.getMap("body").get("aids")) {
ret.add(CovUtil.getLong(obj));
}
return ret;
}
use of io.restassured.response.Response in project SSM by Intel-bigdata.
the class TestConfRestApi method testConf.
@Test
public void testConf() {
Response response = RestAssured.get(RestApiBase.CONFROOT);
response.then().body("status", Matchers.equalTo("OK"));
Map confMap = response.jsonPath().getMap("body");
Assert.assertEquals("true", confMap.get(SmartConfKeys.SMART_DFS_ENABLED));
Assert.assertTrue(((String) confMap.get(SmartConfKeys.SMART_DFS_NAMENODE_RPCSERVER_KEY)).contains("localhost"));
}
Aggregations