Search in sources :

Example 16 with BridgeContext

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

the class BridgeSteps method bridgeIsExistingWithStatusWithinMinutes.

@And("^the Bridge \"([^\"]*)\" is existing with status \"([^\"]*)\" within (\\d+) (?:minute|minutes)$")
public void bridgeIsExistingWithStatusWithinMinutes(String testBridgeName, String status, int timeoutMinutes) {
    BridgeContext bridgeContext = context.getBridge(testBridgeName);
    Awaitility.await().conditionEvaluationListener(new AwaitilityOnTimeOutHandler(() -> BridgeResource.getBridgeDetailsResponse(context.getManagerToken(), bridgeContext.getId()).then().log().all())).atMost(Duration.ofMinutes(timeoutMinutes)).pollInterval(Duration.ofSeconds(5)).failFast(() -> BridgeResource.getBridgeDetailsResponse(context.getManagerToken(), bridgeContext.getId()).then().body("status", Matchers.not("failed"))).untilAsserted(() -> BridgeResource.getBridgeDetailsResponse(context.getManagerToken(), bridgeContext.getId()).then().body("status", Matchers.equalTo(status)).body("endpoint", Matchers.containsString(bridgeContext.getId())));
    BridgeUtils.getOrRetrieveBridgeEventsEndpoint(context, testBridgeName);
}
Also used : AwaitilityOnTimeOutHandler(com.redhat.service.smartevents.integration.tests.common.AwaitilityOnTimeOutHandler) BridgeContext(com.redhat.service.smartevents.integration.tests.context.BridgeContext) And(io.cucumber.java.en.And)

Example 17 with BridgeContext

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

the class BridgeSteps method createFakeBridge.

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

Example 18 with BridgeContext

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

the class BridgeUtils method getOrRetrieveBridgeEventsEndpoint.

public static String getOrRetrieveBridgeEventsEndpoint(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.smartevents.integration.tests.context.BridgeContext)

Aggregations

BridgeContext (com.redhat.service.smartevents.integration.tests.context.BridgeContext)18 And (io.cucumber.java.en.And)6 When (io.cucumber.java.en.When)6 AwaitilityOnTimeOutHandler (com.redhat.service.smartevents.integration.tests.common.AwaitilityOnTimeOutHandler)4 ProcessorContext (com.redhat.service.smartevents.integration.tests.context.ProcessorContext)3 Then (io.cucumber.java.en.Then)3 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)2 JsonObject (io.vertx.core.json.JsonObject)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 BridgeListResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeListResponse)1 BridgeResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse)1 ProcessorListResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorListResponse)1