Search in sources :

Example 1 with BridgeContext

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

the class ProcessorSteps method listOfProcessorInstancesOfBridgeIsFailingWithHTTPResponseCode.

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

Example 2 with BridgeContext

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

the class ProcessorSteps method deleteProcessorOfBridge.

@When("^delete the Processor \"([^\"]*)\" of the Bridge \"([^\"]*)\"$")
public void deleteProcessorOfBridge(String processorName, String testBridgeName) {
    BridgeContext bridgeContext = context.getBridge(testBridgeName);
    String processorId = bridgeContext.getProcessor(processorName).getId();
    ProcessorResource.deleteProcessor(context.getManagerToken(), bridgeContext.getId(), processorId);
    bridgeContext.removeProcessor(processorName);
}
Also used : BridgeContext(com.redhat.service.smartevents.integration.tests.context.BridgeContext) When(io.cucumber.java.en.When)

Example 3 with BridgeContext

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

the class ProcessorSteps method getProcessorAction.

public Action getProcessorAction(String processorName, String testBridgeName) {
    BridgeContext bridgeContext = context.getBridge(testBridgeName);
    String processorId = bridgeContext.getProcessor(processorName).getId();
    return ProcessorResource.getProcessor(context.getManagerToken(), bridgeContext.getId(), processorId).getAction();
}
Also used : BridgeContext(com.redhat.service.smartevents.integration.tests.context.BridgeContext)

Example 4 with BridgeContext

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

the class ProcessorSteps method processorOfBridgeIsExistingWithStatusWithinMinutes.

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

Example 5 with BridgeContext

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

the class ProcessorSteps method processorOfBridgeIsNotExistingWithinMinutes.

@Then("^the Processor \"([^\"]*)\" of the Bridge \"([^\"]*)\" is not existing within (\\d+) (?:minute|minutes)$")
public void processorOfBridgeIsNotExistingWithinMinutes(String processorName, String testBridgeName, int timeoutMinutes) {
    BridgeContext bridgeContext = context.getBridge(testBridgeName);
    String processorId = bridgeContext.getProcessor(processorName).getId();
    Awaitility.await().conditionEvaluationListener(new AwaitilityOnTimeOutHandler(() -> ProcessorResource.getProcessorResponse(context.getManagerToken(), bridgeContext.getId(), processorId).then().log().all())).atMost(Duration.ofMinutes(timeoutMinutes)).pollInterval(Duration.ofSeconds(5)).untilAsserted(() -> ProcessorResource.getProcessorResponse(context.getManagerToken(), bridgeContext.getId(), processorId).then().statusCode(404));
}
Also used : AwaitilityOnTimeOutHandler(com.redhat.service.smartevents.integration.tests.common.AwaitilityOnTimeOutHandler) BridgeContext(com.redhat.service.smartevents.integration.tests.context.BridgeContext) Then(io.cucumber.java.en.Then)

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