use of com.redhat.service.smartevents.manager.models.ConnectorEntity in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ConnectorsApiClientTest method testConnectorEntity.
private ConnectorEntity testConnectorEntity() {
ConnectorEntity connectorEntity = new ConnectorEntity();
connectorEntity.setType(ConnectorType.SINK);
connectorEntity.setId(TEST_CONNECTOR_ID);
connectorEntity.setName(TEST_CONNECTOR_NAME);
connectorEntity.setConnectorTypeId(TEST_CONNECTOR_TYPE_ID);
connectorEntity.setConnectorExternalId(TEST_CONNECTOR_EXTERNAL_ID);
connectorEntity.setProcessor(testProcessor());
return connectorEntity;
}
use of com.redhat.service.smartevents.manager.models.ConnectorEntity in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ConnectorsServiceTest method doCreateConnector.
@ParameterizedTest
@Transactional
@MethodSource("connectorProcessors")
void doCreateConnector(Processor processor, String expectedConnectorTypeId) {
connectorsService.createConnectorEntity(processor);
ArgumentCaptor<ConnectorEntity> captor = ArgumentCaptor.forClass(ConnectorEntity.class);
verify(connectorsDAOMock).persist(captor.capture());
ConnectorEntity entity = captor.getValue();
assertThat(entity.getConnectorTypeId()).isEqualTo(expectedConnectorTypeId);
}
use of com.redhat.service.smartevents.manager.models.ConnectorEntity in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ConnectorsDAOTest method findByProcessorIdName.
@Test
public void findByProcessorIdName() {
Bridge b = createPersistBridge();
Processor p = createPersistProcessor(b);
ConnectorEntity c = createPersistConnector(p, ManagedResourceStatus.READY);
assertThat(connectorsDAO.findByProcessorIdAndName(p.getId(), c.getName())).isEqualTo(c);
}
use of com.redhat.service.smartevents.manager.models.ConnectorEntity in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ConnectorsDAOTest method createPersistConnector.
private ConnectorEntity createPersistConnector(Processor p, ManagedResourceStatus status) {
ConnectorEntity c = Fixtures.createSinkConnector(p, status);
connectorsDAO.persist(c);
return c;
}
use of com.redhat.service.smartevents.manager.models.ConnectorEntity in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorWorker method delegate.
private Processor delegate(Work work, Processor processor) {
// Get Processor's Connector for which work needs completing
final ConnectorEntity connectorEntity = getConnectorEntity(processor);
// Delegate to the ConnectorWorker however mimic that the Work originated from the Processor.
Work connectorEntityWork = Work.forDependentResource(connectorEntity, work);
ConnectorEntity updatedConnectorEntity = connectorWorker.handleWork(connectorEntityWork);
processor.setDependencyStatus(updatedConnectorEntity.getStatus());
// If the Connector failed we should mark the Processor as failed too
if (updatedConnectorEntity.getStatus() == ManagedResourceStatus.FAILED) {
processor.setStatus(ManagedResourceStatus.FAILED);
}
return persist(processor);
}
Aggregations