use of com.redhat.service.smartevents.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);
processorRequestJson = ContextResolver.resolveWithScenarioContext(context, processorRequestJson);
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.smartevents.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, UUID.randomUUID().toString());
processorContext.setDeleted(true);
}
use of com.redhat.service.smartevents.integration.tests.context.BridgeContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorSteps method deleteProcessorOfBridgeIsFailingWithHTTPResponseCode.
@When("^delete the Processor \"([^\"]*)\" of the Bridge \"([^\"]*)\" is failing with HTTP response code (\\d+)$")
public void deleteProcessorOfBridgeIsFailingWithHTTPResponseCode(String processorName, String testBridgeName, int responseCode) {
BridgeContext bridgeContext = context.getBridge(testBridgeName);
String processorId = bridgeContext.getProcessor(processorName).getId();
ProcessorResource.deleteProcessorResponse(context.getManagerToken(), bridgeContext.getId(), processorId).then().statusCode(responseCode);
}
use of com.redhat.service.smartevents.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().conditionEvaluationListener(new AwaitilityOnTimeOutHandler(() -> BridgeResource.getBridgeDetailsResponse(context.getManagerToken(), bridgeContext.getId()).then().log().all())).atMost(Duration.ofMinutes(timeoutMinutes)).pollInterval(Duration.ofSeconds(5)).untilAsserted(() -> BridgeResource.getBridgeDetailsResponse(context.getManagerToken(), bridgeContext.getId()).then().statusCode(404));
}
use of com.redhat.service.smartevents.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());
}
Aggregations