use of com.redhat.service.bridge.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorSteps method addProcessorToBridgeWithBody.
@When("^add a Processor to the Bridge \"([^\"]*)\" with body:$")
public void addProcessorToBridgeWithBody(String testBridgeName, String processorRequestJson) {
BridgeContext bridgeContext = context.getBridge(testBridgeName);
JsonObject json = new JsonObject(processorRequestJson);
String processorName = json.getString("name");
ProcessorResponse response;
try (InputStream resourceStream = new ByteArrayInputStream(processorRequestJson.getBytes(StandardCharsets.UTF_8))) {
response = ProcessorResource.createProcessor(context.getManagerToken(), bridgeContext.getId(), resourceStream);
} catch (IOException e) {
throw new RuntimeException("Error with inputstream", e);
}
bridgeContext.newProcessor(processorName, response.getId());
assertThat(response.getName()).isEqualTo(processorName);
assertThat(response.getKind()).isEqualTo("Processor");
assertThat(response.getHref()).isNotNull();
assertThat(response.getStatus()).isEqualTo(ManagedResourceStatus.ACCEPTED);
}
use of com.redhat.service.bridge.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorSteps method addFakeProcessorToBridge.
@When("^add a fake Processor \"([^\"]*)\" to the Bridge \"([^\"]*)\"$")
public void addFakeProcessorToBridge(String processorName, String testBridgeName) {
BridgeContext bridgeContext = context.getBridge(testBridgeName);
ProcessorContext processorContext = bridgeContext.newProcessor(processorName, Utils.generateId(processorName));
processorContext.setDeleted(true);
}
use of com.redhat.service.bridge.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorSteps method getProcessorOfBridgeIsFailingWithHTTPResponseCode.
@And("^get Processor \"([^\"]*)\" of the Bridge \"([^\"]*)\" is failing with HTTP response code (\\d+)$")
public void getProcessorOfBridgeIsFailingWithHTTPResponseCode(String processorName, String testBridgeName, int responseCode) {
BridgeContext bridgeContext = context.getBridge(testBridgeName);
String processorId = bridgeContext.getProcessor(processorName).getId();
ProcessorResource.getProcessorResponse(context.getManagerToken(), bridgeContext.getId(), processorId).then().statusCode(responseCode);
}
use of com.redhat.service.bridge.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorSteps method listOfBridgeInstancesIsContainingBridge.
@And("^the list of Processor instances of the Bridge \"([^\"]*)\" is containing the Processor \"([^\"]*)\"$")
public void listOfBridgeInstancesIsContainingBridge(String testBridgeName, String processorName) {
BridgeContext bridgeContext = context.getBridge(testBridgeName);
ProcessorContext processorContext = bridgeContext.getProcessor(processorName);
ProcessorListResponse response = ProcessorResource.getProcessorList(context.getManagerToken(), bridgeContext.getId());
assertThat(response.getItems()).anyMatch(p -> p.getId().equals(processorContext.getId()));
}
use of com.redhat.service.bridge.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().atMost(Duration.ofMinutes(timeoutMinutes)).pollInterval(Duration.ofSeconds(5)).untilAsserted(() -> ProcessorResource.getProcessorResponse(context.getManagerToken(), bridgeContext.getId(), processorId).then().statusCode(404));
}
Aggregations