Search in sources :

Example 1 with BridgeContext

use of com.redhat.service.bridge.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeSteps method bridgeIsNotExistingWithinMinutes.

@Then("^the Bridge \"([^\"]*)\" is not existing within (\\d+) (?:minute|minutes)$")
public void bridgeIsNotExistingWithinMinutes(String testBridgeName, int timeoutMinutes) {
    BridgeContext bridgeContext = context.getBridge(testBridgeName);
    Awaitility.await().atMost(Duration.ofMinutes(timeoutMinutes)).pollInterval(Duration.ofSeconds(5)).untilAsserted(() -> BridgeResource.getBridgeDetailsResponse(context.getManagerToken(), bridgeContext.getId()).then().statusCode(404));
}
Also used : BridgeContext(com.redhat.service.bridge.integration.tests.context.BridgeContext) Then(io.cucumber.java.en.Then)

Example 2 with BridgeContext

use of com.redhat.service.bridge.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeSteps method listOfBridgeInstancesIsContainingBridge.

@And("^the list of Bridge instances is containing the Bridge \"([^\"]*)\"$")
public void listOfBridgeInstancesIsContainingBridge(String testBridgeName) {
    BridgeContext bridgeContext = context.getBridge(testBridgeName);
    BridgeListResponse response = BridgeResource.getBridgeList(context.getManagerToken());
    assertThat(response.getItems()).anyMatch(b -> b.getId().equals(bridgeContext.getId()));
    BridgeResponse bridge = response.getItems().stream().filter(b -> b.getId().equals(bridgeContext.getId())).findFirst().orElseThrow();
    assertThat(bridge.getName()).isEqualTo(bridgeContext.getName());
}
Also used : BridgeContext(com.redhat.service.bridge.integration.tests.context.BridgeContext) BridgeListResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeListResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) And(io.cucumber.java.en.And)

Example 3 with BridgeContext

use of com.redhat.service.bridge.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeSteps method addFakeProcessorToBridge.

@When("^create a fake Bridge \"([^\"]*)\"$")
public void addFakeProcessorToBridge(String testBridgeName) {
    BridgeContext bridgeContext = context.newBridge(testBridgeName, Utils.generateId(testBridgeName), Utils.generateId("test-" + testBridgeName));
    bridgeContext.setDeleted(true);
}
Also used : BridgeContext(com.redhat.service.bridge.integration.tests.context.BridgeContext) When(io.cucumber.java.en.When)

Example 4 with BridgeContext

use of com.redhat.service.bridge.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeUtils method getOrRetrieveBridgeEndpoint.

public static String getOrRetrieveBridgeEndpoint(TestContext context, String testBridgeName) {
    BridgeContext bridgeContext = context.getBridge(testBridgeName);
    if (bridgeContext.getEndPoint() == null) {
        // store bridge endpoint details
        String endPoint = BridgeResource.getBridgeDetails(context.getManagerToken(), bridgeContext.getId()).getEndpoint();
        // defined, otherwise rest-assured will use port 8080
        if (endPoint.matches("http://localhost/.*")) {
            endPoint = endPoint.replace("http://localhost/", "http://localhost:80/");
        }
        bridgeContext.setEndPoint(endPoint);
    }
    return bridgeContext.getEndPoint();
}
Also used : BridgeContext(com.redhat.service.bridge.integration.tests.context.BridgeContext)

Example 5 with BridgeContext

use of com.redhat.service.bridge.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorSteps method listOfBridgeInstancesIsFailingWithHTTPResponseCode.

@And("^the list of Processor instances of the Bridge \"([^\"]*)\" is failing with HTTP response code (\\d+)$")
public void listOfBridgeInstancesIsFailingWithHTTPResponseCode(String testBridgeName, int responseCode) {
    BridgeContext bridgeContext = context.getBridge(testBridgeName);
    ProcessorResource.getProcessorListResponse(context.getManagerToken(), bridgeContext.getId()).then().statusCode(responseCode);
}
Also used : BridgeContext(com.redhat.service.bridge.integration.tests.context.BridgeContext) And(io.cucumber.java.en.And)

Aggregations

BridgeContext (com.redhat.service.bridge.integration.tests.context.BridgeContext)16 And (io.cucumber.java.en.And)7 When (io.cucumber.java.en.When)5 Then (io.cucumber.java.en.Then)3 ProcessorContext (com.redhat.service.bridge.integration.tests.context.ProcessorContext)2 ProcessorResponse (com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse)2 BaseAction (com.redhat.service.bridge.infra.models.actions.BaseAction)1 BridgeListResponse (com.redhat.service.bridge.manager.api.models.responses.BridgeListResponse)1 BridgeResponse (com.redhat.service.bridge.manager.api.models.responses.BridgeResponse)1 ProcessorListResponse (com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse)1 JsonObject (io.vertx.core.json.JsonObject)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1