use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method createConnectorFailureOnExternalConnectorCreation.
@Test
public void createConnectorFailureOnExternalConnectorCreation() {
Bridge b = createPersistBridge(ManagedResourceStatus.READY);
BaseAction slackAction = createSlackAction();
ProcessorRequest processorRequest = new ProcessorRequest("ManagedConnectorProcessor", slackAction);
doThrow(new InternalPlatformException(createFailureErrorMessageFor("errorDeletingConnector"), new RuntimeException("error"))).when(connectorsApiClient).deleteConnector(anyString());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), processorRequest);
waitForProcessorAndConnectorToFail(processor);
}
use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testDeleteConnectorFailureOnExternalConnectorDestruction.
@Test
public void testDeleteConnectorFailureOnExternalConnectorDestruction() {
Bridge bridge = createPersistBridge(ManagedResourceStatus.READY);
Processor processor = Fixtures.createProcessor(bridge, "bridgeTestDelete", ManagedResourceStatus.READY);
ConnectorEntity connector = Fixtures.createConnector(processor, "connectorToBeDeleted", ManagedResourceStatus.READY, "topicName");
processorDAO.persist(processor);
connectorsDAO.persist(connector);
// Emulate successful External Connector creation
Connector externalConnector = new Connector();
final ConnectorStatusStatus externalConnectorStatus = new ConnectorStatusStatus();
externalConnectorStatus.setState(ConnectorState.READY);
externalConnector.setStatus(externalConnectorStatus);
when(connectorsApiClient.getConnector(any())).thenReturn(externalConnector);
doThrow(new InternalPlatformException(createFailureErrorMessageFor("errorDeletingConnector"), new RuntimeException("error"))).when(connectorsApiClient).deleteConnector(anyString());
processorService.deleteProcessor(bridge.getId(), processor.getId(), TestConstants.DEFAULT_CUSTOMER_ID);
reloadAssertProcessorIsInStatus(processor, DEPROVISION);
waitForProcessorAndConnectorToFail(processor);
verify(rhoasService, never()).deleteTopicAndRevokeAccessFor(any(), any());
verify(connectorsApiClient, atLeast(1)).deleteConnector(anyString());
assertShardAsksForProcessorToBeDeletedDoesNotInclude(processor);
}
use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method getProcessor_processorDoesNotExist.
@Test
public void getProcessor_processorDoesNotExist() {
Bridge b = createPersistBridge(ManagedResourceStatus.READY);
ProcessorRequest r = new ProcessorRequest("My Processor", createKafkaAction());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), r);
await().atMost(5, SECONDS).untilAsserted(() -> {
Processor p = processorDAO.findById(processor.getId());
assertThat(p).isNotNull();
assertThat(p.getDependencyStatus()).isEqualTo(ManagedResourceStatus.READY);
});
assertThatExceptionOfType(ItemNotFoundException.class).isThrownBy(() -> processorService.getProcessor("doesNotExist", b.getId(), b.getCustomerId()));
}
use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testMGDOBR_80.
@Test
public void testMGDOBR_80() {
Bridge b = createPersistBridge(ManagedResourceStatus.READY);
Set<BaseFilter> filters = new HashSet<>();
filters.add(new StringEquals("name", "myName"));
filters.add(new StringEquals("surename", "mySurename"));
ProcessorRequest r = new ProcessorRequest("My Processor", filters, null, createKafkaAction());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), r);
await().atMost(5, SECONDS).untilAsserted(() -> {
Processor p = processorDAO.findById(processor.getId());
assertThat(p).isNotNull();
assertThat(p.getDependencyStatus()).isEqualTo(ManagedResourceStatus.READY);
});
assertThat(processorService.getProcessors(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID, new QueryInfo(0, 100)).getSize()).isEqualTo(1);
}
use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method createProcessor_processorWithSameNameAlreadyExists.
@Test
public void createProcessor_processorWithSameNameAlreadyExists() {
Bridge b = createPersistBridge(ManagedResourceStatus.READY);
ProcessorRequest r = new ProcessorRequest("My Processor", createKafkaAction());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), r);
await().atMost(5, SECONDS).untilAsserted(() -> {
Processor p = processorDAO.findById(processor.getId());
assertThat(p).isNotNull();
assertThat(p.getDependencyStatus()).isEqualTo(ManagedResourceStatus.READY);
});
assertThatExceptionOfType(AlreadyExistingItemException.class).isThrownBy(() -> processorService.createProcessor(b.getId(), b.getCustomerId(), r));
}
Aggregations