Search in sources :

Example 6 with BridgeContext

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

the class ProcessorSteps method processorOfBridgeHasActionOfTypeAndParameters.

@And("^the Processor \"([^\"]*)\" of the Bridge \"([^\"]*)\" has action of type \"([^\"]*)\" and parameters:$")
public void processorOfBridgeHasActionOfTypeAndParameters(String processorName, String testBridgeName, String actionType, DataTable parametersDatatable) {
    BridgeContext bridgeContext = context.getBridge(testBridgeName);
    String processorId = bridgeContext.getProcessor(processorName).getId();
    ProcessorResponse response = ProcessorResource.getProcessor(context.getManagerToken(), bridgeContext.getId(), processorId);
    BaseAction action = response.getAction();
    assertThat(action.getType()).isEqualTo(actionType);
    parametersDatatable.asMap().forEach((key, value) -> {
        assertThat(action.getParameters()).containsEntry(key, value);
    });
}
Also used : ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) BridgeContext(com.redhat.service.bridge.integration.tests.context.BridgeContext) BaseAction(com.redhat.service.bridge.infra.models.actions.BaseAction) And(io.cucumber.java.en.And)

Example 7 with BridgeContext

use of com.redhat.service.bridge.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.bridge.integration.tests.context.BridgeContext) When(io.cucumber.java.en.When)

Example 8 with BridgeContext

use of com.redhat.service.bridge.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().atMost(Duration.ofMinutes(timeoutMinutes)).pollInterval(Duration.ofSeconds(5)).untilAsserted(() -> ProcessorResource.getProcessorResponse(context.getManagerToken(), bridgeContext.getId(), processorId).then().body("status", Matchers.equalTo(status)));
}
Also used : BridgeContext(com.redhat.service.bridge.integration.tests.context.BridgeContext) Then(io.cucumber.java.en.Then)

Example 9 with BridgeContext

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

the class BridgeSteps method getBridgeIsFailingWithHTTPResponseCode.

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

Example 10 with BridgeContext

use of com.redhat.service.bridge.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().atMost(Duration.ofMinutes(timeoutMinutes)).pollInterval(Duration.ofSeconds(5)).untilAsserted(() -> BridgeResource.getBridgeDetailsResponse(context.getManagerToken(), bridgeContext.getId()).then().body("status", Matchers.equalTo(status)).body("endpoint", Matchers.containsString(bridgeContext.getId())));
    BridgeUtils.getOrRetrieveBridgeEndpoint(context, testBridgeName);
}
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