use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testUpdateProcessorWithFilter.
@ParameterizedTest
@MethodSource("updateProcessorParams")
void testUpdateProcessorWithFilter(ProcessorRequest request) {
Processor existingProcessor = createReadyProcessorFromRequest(request);
when(processorDAO.findByIdBridgeIdAndCustomerId(DEFAULT_BRIDGE_ID, DEFAULT_PROCESSOR_ID, DEFAULT_CUSTOMER_ID)).thenReturn(existingProcessor);
Set<BaseFilter> updatedFilters = Collections.singleton(new StringEquals("key", "value"));
request.setFilters(updatedFilters);
Processor updatedProcessor = processorService.updateProcessor(DEFAULT_BRIDGE_ID, DEFAULT_PROCESSOR_ID, DEFAULT_CUSTOMER_ID, request);
ProcessorResponse updatedResponse = processorService.toResponse(updatedProcessor);
assertThat(updatedResponse.getStatus()).isEqualTo(ACCEPTED);
assertThat(updatedResponse.getFilters()).hasSize(1);
BaseFilter updatedFilter = updatedResponse.getFilters().iterator().next();
assertThat(updatedFilter.getKey()).isEqualTo("key");
assertThat(updatedFilter.getValue()).isEqualTo("value");
assertThat(updatedResponse.getTransformationTemplate()).isNull();
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method createErrorHandlerProcessor.
private static Processor createErrorHandlerProcessor() {
Processor processor = createReadyProcessorFromRequest(new ProcessorRequest(ERROR_HANDLER_PROCESSOR_NAME, TestUtils.createWebhookAction()));
processor.setId(ERROR_HANDLER_PROCESSOR_ID);
processor.setType(ERROR_HANDLER);
return processor;
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testUpdateProcessorWithGatewayWithOppositeType.
@ParameterizedTest
@MethodSource("updateProcessorParams")
void testUpdateProcessorWithGatewayWithOppositeType(ProcessorRequest request) {
Processor existingProcessor = createReadyProcessorFromRequest(request);
when(processorDAO.findByIdBridgeIdAndCustomerId(DEFAULT_BRIDGE_ID, DEFAULT_PROCESSOR_ID, DEFAULT_CUSTOMER_ID)).thenReturn(existingProcessor);
if (request.getType() == ProcessorType.SOURCE) {
Action dummyNewAction = new Action();
dummyNewAction.setType("DummyAction");
request.setAction(dummyNewAction);
request.setSource(null);
} else if (request.getType() == SINK) {
Source dummyNewSource = new Source();
dummyNewSource.setType("DummySource");
request.setSource(dummyNewSource);
request.setAction(null);
}
assertThatExceptionOfType(BadRequestException.class).isThrownBy(() -> processorService.updateProcessor(DEFAULT_BRIDGE_ID, DEFAULT_PROCESSOR_ID, DEFAULT_CUSTOMER_ID, request));
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testUpdateProcessorStatus.
@Test
void testUpdateProcessorStatus() {
ProcessorDTO updateDto = new ProcessorDTO();
updateDto.setType(DEFAULT_PROCESSOR_TYPE);
updateDto.setId(DEFAULT_PROCESSOR_ID);
updateDto.setBridgeId(DEFAULT_BRIDGE_ID);
updateDto.setCustomerId(DEFAULT_CUSTOMER_ID);
updateDto.setStatus(FAILED);
Processor updated = processorService.updateProcessorStatus(updateDto);
assertThat(updated.getStatus()).isEqualTo(FAILED);
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method doTestCreateProcessor.
private void doTestCreateProcessor(ProcessorRequest request, ProcessorType type) {
Processor processor = processorService.createProcessor(DEFAULT_BRIDGE_ID, DEFAULT_CUSTOMER_ID, DEFAULT_USER_NAME, request);
doAssertProcessorCreation(processor, request, type);
}
Aggregations