Search in sources :

Example 11 with HTTPResponse

use of io.syndesis.qe.utils.http.HTTPResponse in project syndesis-qe by syndesisio.

the class ODataSteps method resetODataV4Service.

@Then("^.*reset OData v4 service$")
public void resetODataV4Service() {
    log.info("Reseting data on sample OData service");
    HTTPResponse response = HTTPUtils.doPostRequest(ODataUtils.getV4OpenshiftRoute() + "Reset", "{}");
    assertThat(response.getCode()).isEqualTo(204);
}
Also used : HTTPResponse(io.syndesis.qe.utils.http.HTTPResponse) Then(io.cucumber.java.en.Then)

Example 12 with HTTPResponse

use of io.syndesis.qe.utils.http.HTTPResponse in project syndesis-qe by syndesisio.

the class TelegramSteps method checkLastMessageContains.

@Then("^check that telegram last message contains string \"([^\"]*)\"$")
public void checkLastMessageContains(String expectedText) {
    HTTPResponse res = TelegramUtils.getUpdates();
    Assertions.assertThat(res.getCode()).isEqualTo(200);
    Assertions.assertThat(res.getBody()).containsIgnoringCase(expectedText);
}
Also used : HTTPResponse(io.syndesis.qe.utils.http.HTTPResponse) Then(io.cucumber.java.en.Then)

Example 13 with HTTPResponse

use of io.syndesis.qe.utils.http.HTTPResponse in project syndesis-qe by syndesisio.

the class HTTPValidationSteps method verify.

private void verify(String method, boolean once) {
    // Let the integration running
    TestUtils.sleepIgnoreInterrupt(30000L);
    // Get new events
    HTTPResponse r = HTTPUtils.doGetRequest("http://localhost:28080/events");
    Map<Long, String> events = new Gson().fromJson(r.getBody(), Map.class);
    if (once) {
        assertThat(events).size().isEqualTo(1);
    } else {
        assertThat(events).size().isGreaterThanOrEqualTo(5);
    }
    for (String event : events.values()) {
        assertThat(method.equals(event));
    }
}
Also used : HTTPResponse(io.syndesis.qe.utils.http.HTTPResponse) Gson(com.google.gson.Gson)

Example 14 with HTTPResponse

use of io.syndesis.qe.utils.http.HTTPResponse in project syndesis-qe by syndesisio.

the class ServiceNow method updateIncident.

public static Incident updateIncident(String sysId, Incident incident) {
    String json = getIncidentJson(incident);
    log.debug(String.format("Sending incident Json: %s", json));
    HTTPResponse r = HTTPUtils.doPutRequest(String.format("%s/%s", url, sysId), json, "application/json", Headers.of("Authorization", "Basic " + Base64.getEncoder().encodeToString((userName + ":" + password).getBytes())));
    assertThat(r.getCode()).isEqualTo(200);
    return getIncidentFromResponse(r);
}
Also used : HTTPResponse(io.syndesis.qe.utils.http.HTTPResponse)

Aggregations

HTTPResponse (io.syndesis.qe.utils.http.HTTPResponse)14 Then (io.cucumber.java.en.Then)6 Gson (com.google.gson.Gson)2 When (io.cucumber.java.en.When)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Headers (okhttp3.Headers)1