use of com.redhat.service.smartevents.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class TestSupport method newRequestedProcessorDTO.
public static ProcessorDTO newRequestedProcessorDTO() {
Set<BaseFilter> filters = new HashSet<>();
filters.add(new StringEquals("key", "value"));
String transformationTemplate = "{\"test\": {key}}";
Action a = new Action();
a.setType(KafkaTopicAction.TYPE);
Map<String, String> params = new HashMap<>();
params.put(KafkaTopicAction.TOPIC_PARAM, "myTopic");
a.setMapParameters(params);
ProcessorDefinition definition = new ProcessorDefinition(filters, transformationTemplate, a);
ProcessorDTO dto = new ProcessorDTO();
dto.setType(PROCESSOR_TYPE);
dto.setId(PROCESSOR_ID);
dto.setName(PROCESSOR_NAME);
dto.setDefinition(definition);
dto.setBridgeId(BRIDGE_ID);
dto.setCustomerId(CUSTOMER_ID);
dto.setOwner(USER_NAME);
dto.setStatus(PREPARING);
dto.setKafkaConnection(KAFKA_CONNECTION_DTO);
return dto;
}
use of com.redhat.service.smartevents.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorServiceTest method testBridgeIngressDeletion.
@Test
public void testBridgeIngressDeletion() {
// Given
ProcessorDTO dto = TestSupport.newRequestedProcessorDTO();
// When
bridgeExecutorService.createBridgeExecutor(dto);
bridgeExecutorService.deleteBridgeExecutor(dto);
// Then
BridgeExecutor bridgeExecutor = kubernetesClient.resources(BridgeExecutor.class).inNamespace(customerNamespaceProvider.resolveName(dto.getCustomerId())).withName(BridgeExecutor.resolveResourceName(dto.getId())).get();
assertThat(bridgeExecutor).isNull();
}
use of com.redhat.service.smartevents.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ManagerClientTest method fetchProcessorsToDeployOrDelete.
@Test
public void fetchProcessorsToDeployOrDelete() throws JsonProcessingException {
ProcessorDTO processor = TestSupport.newRequestedProcessorDTO();
stubProcessorsToDeployOrDelete(List.of(processor));
assertThat(managerClient.fetchProcessorsToDeployOrDelete().await().atMost(Duration.ofSeconds(10)).size()).isEqualTo(1);
}
use of com.redhat.service.smartevents.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutorController method notifyManager.
private void notifyManager(BridgeExecutor bridgeExecutor, ManagedResourceStatus status) {
ProcessorDTO dto = bridgeExecutor.toDTO();
dto.setStatus(status);
managerClient.notifyProcessorStatusChange(dto).subscribe().with(success -> LOGGER.info("Updating Processor with id '{}' done", dto.getId()), failure -> LOGGER.error("Updating Processor with id '{}' FAILED", dto.getId()));
}
use of com.redhat.service.smartevents.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeExecutor method toDTO.
public ProcessorDTO toDTO() {
ProcessorDTO processorDTO = new ProcessorDTO();
processorDTO.setType(ProcessorType.fromString(this.getSpec().getProcessorType()));
processorDTO.setId(this.getSpec().getId());
// TODO: think about removing bridgeDTO from the processorDTO and keep only bridgeId and customerId!
processorDTO.setBridgeId(this.getSpec().getBridgeId());
processorDTO.setCustomerId(this.getSpec().getCustomerId());
processorDTO.setOwner(this.getSpec().getOwner());
processorDTO.setName(this.getSpec().getProcessorName());
if (this.getSpec().getProcessorDefinition() != null) {
try {
processorDTO.setDefinition(MAPPER.readValue(this.getSpec().getProcessorDefinition(), ProcessorDefinition.class));
} catch (JsonProcessingException e) {
LOGGER.error("Could not deserialize Processor Definition while converting BridgeExecutor to ProcessorDTO", e);
}
}
return processorDTO;
}
Aggregations