use of com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class Hooks method cleanUp.
@After
public void cleanUp() {
String token = Optional.ofNullable(context.getManagerToken()).orElse(BridgeUtils.retrieveBridgeToken());
// Remove all bridges/processors created
context.getAllBridges().values().stream().filter(bridgeContext -> !bridgeContext.isDeleted()).forEach(bridgeContext -> {
final String bridgeId = bridgeContext.getId();
BridgeResponse bridge = BridgeResource.getBridgeDetails(token, bridgeId);
if (bridge.getStatus() == ManagedResourceStatus.READY) {
ProcessorListResponse processorList = ProcessorResource.getProcessorList(token, bridgeId);
if (processorList.getSize() > 0) {
processorList.getItems().stream().forEach(p -> ProcessorResource.deleteProcessor(token, bridgeId, p.getId()));
Awaitility.await().atMost(Duration.ofMinutes(2)).pollInterval(Duration.ofSeconds(5)).until(() -> ProcessorResource.getProcessorList(token, bridgeId).getSize() == 0);
}
}
switch(bridge.getStatus()) {
case ACCEPTED:
case PROVISIONING:
case READY:
case FAILED:
try {
BridgeResource.deleteBridge(token, bridgeId);
} catch (Exception e) {
LOGGER.warn(e, () -> "Unable to delete bridge with id " + bridgeId);
}
default:
break;
}
});
}
use of com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method listProcessors.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void listProcessors() {
BridgeResponse bridgeResponse = createAndDeployBridge();
ProcessorResponse p = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction())).as(ProcessorResponse.class);
ProcessorResponse p2 = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor2", createKafkaAction())).as(ProcessorResponse.class);
ProcessorListResponse listResponse = TestUtils.listProcessors(bridgeResponse.getId(), 0, 100).as(ProcessorListResponse.class);
assertThat(listResponse.getPage()).isZero();
assertThat(listResponse.getSize()).isEqualTo(2L);
assertThat(listResponse.getTotal()).isEqualTo(2L);
listResponse.getItems().forEach((i) -> assertThat(i.getId()).isIn(p.getId(), p2.getId()));
}
use of com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method listProcessors_pageOffset.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void listProcessors_pageOffset() {
BridgeResponse bridgeResponse = createAndDeployBridge();
TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction())).as(ProcessorResponse.class);
ProcessorResponse p2 = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor2", createKafkaAction())).as(ProcessorResponse.class);
ProcessorListResponse listResponse = TestUtils.listProcessors(bridgeResponse.getId(), 1, 1).as(ProcessorListResponse.class);
assertThat(listResponse.getPage()).isEqualTo(1L);
assertThat(listResponse.getSize()).isEqualTo(1L);
assertThat(listResponse.getTotal()).isEqualTo(2L);
assertThat(listResponse.getItems().get(0).getId()).isEqualTo(p2.getId());
assertRequestedAction(listResponse.getItems().get(0));
}
use of com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse 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()));
}
Aggregations