use of com.redhat.service.bridge.manager.models.ConnectorEntity in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest 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(), "connectorToBeDeleted");
assertThat(foundConnector).isNull();
final Processor processorDeleted = processorService.getProcessor(processor.getId(), bridge.getId(), TestConstants.DEFAULT_CUSTOMER_ID);
assertThat(processorDeleted.getStatus()).isEqualTo(DEPROVISION);
});
}
use of com.redhat.service.bridge.manager.models.ConnectorEntity in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ConnectorsServiceImpl method createConnectorEntity.
@Override
@Transactional(Transactional.TxType.MANDATORY)
public // Connector should always be marked for creation in the same transaction as a Processor
void createConnectorEntity(BaseAction resolvedAction, Processor processor, ActionProvider actionProvider) {
if (!actionProvider.isConnectorAction()) {
return;
}
ConnectorAction connectorAction = (ConnectorAction) actionProvider;
JsonNode connectorPayload = connectorAction.connectorPayload(resolvedAction);
String connectorType = connectorAction.getConnectorType();
String newConnectorName = connectorName(connectorType, processor);
String topicName = connectorAction.topicName(resolvedAction);
ConnectorEntity newConnectorEntity = new ConnectorEntity();
newConnectorEntity.setName(newConnectorName);
newConnectorEntity.setStatus(ManagedResourceStatus.ACCEPTED);
newConnectorEntity.setSubmittedAt(ZonedDateTime.now());
newConnectorEntity.setProcessor(processor);
newConnectorEntity.setDefinition(connectorPayload);
newConnectorEntity.setConnectorType(connectorType);
newConnectorEntity.setTopicName(topicName);
connectorsDAO.persist(newConnectorEntity);
}
Aggregations