use of io.syndesis.qe.utils.http.HTTPResponse in project syndesis-qe by syndesisio.
the class HTTPValidationSteps method verifyThatAfterSecondsWasCalls.
@Then("^verify that after (\\d+) seconds there (?:were|was) (\\d+) calls?$")
public void verifyThatAfterSecondsWasCalls(int seconds, int calls) {
clear();
TestUtils.sleepIgnoreInterrupt((long) seconds * 1000);
HTTPResponse r = HTTPUtils.doGetRequest("http://localhost:28080/events");
Map<Long, String> events = new Gson().fromJson(r.getBody(), Map.class);
assertThat(events).size().isEqualTo(calls);
}
use of io.syndesis.qe.utils.http.HTTPResponse in project syndesis-qe by syndesisio.
the class ServiceNow method deleteIncident.
public static void deleteIncident(String sysId) {
HTTPResponse r = HTTPUtils.doDeleteRequest(String.format("%s/%s", url, sysId), Headers.of("Authorization", "Basic " + Base64.getEncoder().encodeToString((userName + ":" + password).getBytes())));
assertThat(r.getCode()).isEqualTo(204);
}
use of io.syndesis.qe.utils.http.HTTPResponse in project syndesis-qe by syndesisio.
the class ServiceNow method getFilteredIncidents.
public static List<Incident> getFilteredIncidents(String filter, int limit) {
String getUrl = url + "?sysparm_limit=" + limit;
if (filter != null) {
try {
getUrl += "&sysparm_query=" + URLEncoder.encode(filter, "UTF-8");
} catch (UnsupportedEncodingException e) {
// this won't happen
}
}
HTTPResponse r = HTTPUtils.doGetRequest(getUrl, Headers.of("Authorization", "Basic " + Base64.getEncoder().encodeToString((userName + ":" + password).getBytes())));
assertThat(r.getCode()).isEqualTo(200);
String responseBody = r.getBody();
return parseResponse(responseBody);
}
use of io.syndesis.qe.utils.http.HTTPResponse in project syndesis-qe by syndesisio.
the class ServiceNow method createIncident.
public static Incident createIncident(Incident i) {
String json = getIncidentJson(i);
log.debug(String.format("Sending incident Json: %s", json));
HTTPResponse r = HTTPUtils.doPostRequest(url, json, "application/json", Headers.of("Authorization", "Basic " + Base64.getEncoder().encodeToString((userName + ":" + password).getBytes())));
assertThat(r.getCode()).isEqualTo(201);
return getIncidentFromResponse(r);
}
use of io.syndesis.qe.utils.http.HTTPResponse in project syndesis-qe by syndesisio.
the class ODataSteps method oDataServiceDoesntContain.
@Then("^.*check that entity \"([^\"]*)\" is not present in \"([^\"]*)\" collection on OData( V2)? service$")
public void oDataServiceDoesntContain(final String entityKey, final String collection, String v2) {
HTTPResponse response = HTTPUtils.doGetRequest((v2 != null && !v2.isEmpty() ? ODataUtils.getCurrentV2Url() : ODataUtils.getV4OpenshiftRoute()) + collection + "(" + entityKey + ")");
assertThat(response.getCode()).isEqualTo(404);
}
Aggregations