use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ConnectorsApiClientTest method testProcessor.
private Processor testProcessor() {
Processor processor = new Processor();
processor.setType(ProcessorType.SINK);
processor.setId(TEST_PROCESSOR_ID);
processor.setName(TEST_PROCESSOR_NAME);
return processor;
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ConnectorsServiceTest method processorWith.
private static Processor processorWith(Gateway gateway) {
Processor processor = new Processor();
processor.setBridge(new Bridge());
ProcessorDefinition processorDefinition = new ProcessorDefinition();
if (gateway instanceof Action) {
processorDefinition.setRequestedAction((Action) gateway);
processor.setType(ProcessorType.SINK);
} else {
processorDefinition.setRequestedSource((Source) gateway);
processor.setType(ProcessorType.SOURCE);
}
processor.setId(TEST_PROCESSOR_ID);
processor.setName(TEST_PROCESSOR_NAME);
processor.setDefinition(processorDefinition);
return processor;
}
use of com.redhat.service.smartevents.manager.models.Processor 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.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ConnectorsDAOTest method createPersistProcessor.
private Processor createPersistProcessor(Bridge bridge) {
Processor p = Fixtures.createProcessor(bridge, ManagedResourceStatus.ACCEPTED);
Action a = new Action();
a.setType(KafkaTopicAction.TYPE);
Map<String, String> params = new HashMap<>();
params.put(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
a.setMapParameters(params);
ProcessorDefinition definition = new ProcessorDefinition(Collections.emptySet(), null, a);
p.setDefinition(definition);
processorDAO.persist(p);
return p;
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeWorker method createErrorHandlerProcessor.
/**
* Creates error handler processor if required
*
* @param bridge input bridge
* @return true if the work can proceed (either the error handler processor
* is not required or it's created and ready), false otherwise.
*/
private void createErrorHandlerProcessor(Bridge bridge) {
// If an ErrorHandler is not needed, consider it ready
Action errorHandlerAction = bridge.getDefinition().getErrorHandler();
boolean errorHandlerProcessorIsNotRequired = Objects.isNull(errorHandlerAction);
if (errorHandlerProcessorIsNotRequired) {
return;
}
String bridgeId = bridge.getId();
String customerId = bridge.getCustomerId();
ListResult<Processor> processors = processorService.getHiddenProcessors(bridgeId, customerId);
// This assumes we can only have one ErrorHandler Processor per Bridge
if (processors.getTotal() > 0) {
return;
}
// create error handler processor if not present
String errorHandlerName = String.format("Back-channel for Bridge '%s'", bridge.getId());
ProcessorRequest errorHandlerProcessor = new ProcessorRequest(errorHandlerName, errorHandlerAction);
processorService.createErrorHandlerProcessor(bridge.getId(), bridge.getCustomerId(), bridge.getOwner(), errorHandlerProcessor);
}
Aggregations