use of com.redhat.service.smartevents.integration.tests.context.ProcessorContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorSteps method listOfProcessorInstancesOfBridgeIsContainingProcessor.
@And("^the list of Processor instances of the Bridge \"([^\"]*)\" is containing the Processor \"([^\"]*)\"$")
public void listOfProcessorInstancesOfBridgeIsContainingProcessor(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.smartevents.integration.tests.context.ProcessorContext in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorSteps method updateProcessorOfTheBridgeWithBody.
@When("^update the Processor \"([^\"]*)\" of the Bridge \"([^\"]*)\" with body:$")
public void updateProcessorOfTheBridgeWithBody(String processorName, String testBridgeName, String processorRequestJson) {
BridgeContext bridgeContext = context.getBridge(testBridgeName);
processorRequestJson = ContextResolver.resolveWithScenarioContext(context, processorRequestJson);
ProcessorContext processorContext = bridgeContext.getProcessor(processorName);
JsonObject json = new JsonObject(processorRequestJson);
String newProcessorName = json.getString("name");
ProcessorResponse response;
try (InputStream resourceStream = new ByteArrayInputStream(processorRequestJson.getBytes(StandardCharsets.UTF_8))) {
response = ProcessorResource.updateProcessor(context.getManagerToken(), bridgeContext.getId(), processorContext.getId(), resourceStream);
} catch (IOException e) {
throw new RuntimeException("Error opening inputstream", e);
}
bridgeContext.removeProcessor(processorName);
bridgeContext.newProcessor(newProcessorName, 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.ProcessorContext 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);
}
Aggregations