use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testUpdateProcessorWithGateway.
@ParameterizedTest
@MethodSource("updateProcessorParams")
void testUpdateProcessorWithGateway(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) {
Source dummyNewSource = new Source();
dummyNewSource.setType("DummySource");
request.setSource(dummyNewSource);
} else if (request.getType() == SINK) {
Action dummyNewAction = new Action();
dummyNewAction.setType("DummyAction");
request.setAction(dummyNewAction);
}
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 testGetProcessor.
@Test
void testGetProcessor() {
Processor found = processorService.getProcessor(DEFAULT_BRIDGE_ID, DEFAULT_PROCESSOR_ID, DEFAULT_CUSTOMER_ID);
assertThat(found).isNotNull();
assertThat(found.getId()).isEqualTo(DEFAULT_PROCESSOR_ID);
assertThat(found.getBridge().getId()).isEqualTo(DEFAULT_BRIDGE_ID);
assertThat(found.getBridge().getCustomerId()).isEqualTo(DEFAULT_CUSTOMER_ID);
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testUpdateProcessorStatusReadyPublishedAt.
@Test
void testUpdateProcessorStatusReadyPublishedAt() {
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(READY);
Processor publishedProcessor = processorService.updateProcessorStatus(updateDto);
assertThat(publishedProcessor.getStatus()).isEqualTo(READY);
assertThat(publishedProcessor.getPublishedAt()).isNotNull();
// Check calls to set PublishedAt at idempotent
Processor publishedProcessor2 = processorService.updateProcessorStatus(updateDto);
assertThat(publishedProcessor2.getStatus()).isEqualTo(READY);
assertThat(publishedProcessor2.getPublishedAt()).isEqualTo(publishedProcessor.getPublishedAt());
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method testToResponse.
@Test
void testToResponse() {
Bridge b = Fixtures.createBridge();
Processor p = Fixtures.createProcessor(b, READY);
Action action = Fixtures.createKafkaAction();
ProcessorDefinition definition = new ProcessorDefinition(Collections.emptySet(), "", action);
p.setDefinition(definition);
ProcessorResponse r = processorService.toResponse(p);
assertThat(r).isNotNull();
assertThat(r.getHref()).isEqualTo(APIConstants.USER_API_BASE_PATH + b.getId() + "/processors/" + p.getId());
assertThat(r.getName()).isEqualTo(p.getName());
assertThat(r.getStatus()).isEqualTo(p.getStatus());
assertThat(r.getType()).isEqualTo(p.getType());
assertThat(r.getId()).isEqualTo(p.getId());
assertThat(r.getSubmittedAt()).isEqualTo(p.getSubmittedAt());
assertThat(r.getPublishedAt()).isEqualTo(p.getPublishedAt());
assertThat(r.getKind()).isEqualTo("Processor");
assertThat(r.getTransformationTemplate()).isEmpty();
assertThat(r.getAction().getType()).isEqualTo(KafkaTopicAction.TYPE);
}
use of com.redhat.service.smartevents.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method createFailedProcessor.
private static Processor createFailedProcessor() {
Processor processor = Fixtures.createProcessor(createReadyBridge(), FAILED);
processor.setId(FAILED_PROCESSOR_ID);
processor.setName(FAILED_PROCESSOR_NAME);
return processor;
}
Aggregations