use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceConnectorTest method waitForConnectorToBeDeleted.
private void waitForConnectorToBeDeleted(final Bridge bridge, final Processor processor) {
// There will be 2 re-tries at 5s each. Add 5s to be certain everything completes.
await().atMost(15, SECONDS).untilAsserted(() -> {
ConnectorEntity foundConnector = connectorsDAO.findByProcessorIdAndName(processor.getId(), TestConstants.DEFAULT_CONNECTOR_NAME);
assertThat(foundConnector).isNull();
final Processor processorDeleted = processorService.getProcessor(bridge.getId(), processor.getId(), DEFAULT_CUSTOMER_ID);
assertThat(processorDeleted.getStatus()).isEqualTo(DEPROVISION);
});
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceConnectorTest method waitForProcessorAndConnectorToFail.
private void waitForProcessorAndConnectorToFail(final Processor processor) {
// There will be 4 re-tries at 5s each. Add 5s to be certain everything completes.
await().atMost(25, SECONDS).untilAsserted(() -> {
Processor p = processorDAO.findById(processor.getId());
assertThat(p).isNotNull();
assertThat(p.getStatus()).isEqualTo(FAILED);
});
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceConnectorTest method createConnectorFailureOnExternalConnectorCreation.
@Test
void createConnectorFailureOnExternalConnectorCreation() {
Bridge b = createPersistBridge(READY);
Action slackAction = createSlackAction();
ProcessorRequest processorRequest = new ProcessorRequest("ManagedConnectorProcessor", slackAction);
doThrow(new InternalPlatformException(RhoasServiceImpl.createFailureErrorMessageFor("errorDeletingConnector"), new RuntimeException("error"))).when(connectorsApiClient).deleteConnector(anyString());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), b.getOwner(), processorRequest);
waitForProcessorAndConnectorToFail(processor);
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceConnectorTest method createConnectorFailureOnKafkaTopicCreation.
@Test
void createConnectorFailureOnKafkaTopicCreation() {
Bridge b = createPersistBridge(READY);
Action slackAction = createSlackAction();
ProcessorRequest processorRequest = new ProcessorRequest("ManagedConnectorProcessor", slackAction);
when(rhoasService.createTopicAndGrantAccessFor(anyString(), any())).thenThrow(new InternalPlatformException(RhoasServiceImpl.createFailureErrorMessageFor("errorTopic"), new RuntimeException("error")));
when(connectorsApiClient.createConnector(any(ConnectorRequest.class))).thenReturn(new Connector());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), b.getOwner(), processorRequest);
waitForProcessorAndConnectorToFail(processor);
verify(rhoasService, atLeast(1)).createTopicAndGrantAccessFor(anyString(), eq(RhoasTopicAccessType.PRODUCER));
verify(connectorsApiClient, never()).createConnector(any(ConnectorRequest.class));
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceConnectorTest method createPersistProcessor.
private Processor createPersistProcessor(Bridge bridge, ManagedResourceStatus status) {
Processor processor = Fixtures.createProcessor(bridge, status);
processorDAO.persist(processor);
return processor;
}
Aggregations