use of com.redhat.service.bridge.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KafkaTopicActionValidatorTest method isValid_emptyTopicStringIsNotValid.
@Test
public void isValid_emptyTopicStringIsNotValid() {
ProcessorDTO processor = createProcessorWithActionForTopic("myTopic");
processor.getDefinition().getResolvedAction().getParameters().put(KafkaTopicAction.TOPIC_PARAM, "");
ValidationResult validationResult = validator.isValid(processor.getDefinition().getResolvedAction());
assertThat(validationResult.isValid()).isFalse();
assertThat(validationResult.getMessage()).isEqualTo(KafkaTopicActionValidator.INVALID_TOPIC_PARAM_MESSAGE);
}
use of com.redhat.service.bridge.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KafkaTopicActionValidatorTest method createProcessorWithActionForTopic.
private ProcessorDTO createProcessorWithActionForTopic(String topicName) {
BaseAction b = new BaseAction();
b.setType(KafkaTopicAction.TYPE);
Map<String, String> params = new HashMap<>();
params.put(KafkaTopicAction.TOPIC_PARAM, topicName);
b.setParameters(params);
ProcessorDTO p = new ProcessorDTO();
p.setId("myProcessor");
p.setDefinition(new ProcessorDefinition(null, null, b));
p.setBridgeId("myBridge");
return p;
}
use of com.redhat.service.bridge.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KafkaTopicInvokerTest method createProcessor.
private ProcessorDTO createProcessor() {
ProcessorDTO p = new ProcessorDTO();
p.setId("myProcessor");
p.setBridgeId("myBridge");
return p;
}
use of com.redhat.service.bridge.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class WebhookActionTest method createProcessorWithActionForEndpoint.
private ProcessorDTO createProcessorWithActionForEndpoint(String endpoint) {
ProcessorDTO processor = createProcessorWithParameterlessAction();
processor.getDefinition().getResolvedAction().getParameters().put(WebhookAction.ENDPOINT_PARAM, endpoint);
return processor;
}
use of com.redhat.service.bridge.infra.models.dto.ProcessorDTO in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ExecutorTest method testMetricsAreProduced.
@Test
public void testMetricsAreProduced() throws JsonProcessingException {
Set<BaseFilter> filters = new HashSet<>();
filters.add(new StringEquals("data.key", "value"));
BaseAction action = new BaseAction();
action.setType(KafkaTopicAction.TYPE);
String transformationTemplate = "{\"test\": \"{data.key}\"}";
ProcessorDTO processorDTO = createProcessor(new ProcessorDefinition(filters, transformationTemplate, action));
Executor executor = new Executor(processorDTO, filterEvaluatorFactory, transformationEvaluatorFactory, actionProviderFactoryMock, meterRegistry);
CloudEvent cloudEvent = createCloudEvent();
executor.onEvent(cloudEvent);
assertThat(meterRegistry.getMeters().stream().anyMatch(x -> x.getId().getName().equals(MetricsConstants.PROCESSOR_PROCESSING_TIME_METRIC_NAME))).isTrue();
assertThat(meterRegistry.getMeters().stream().anyMatch(x -> x.getId().getName().equals(MetricsConstants.FILTER_PROCESSING_TIME_METRIC_NAME))).isTrue();
assertThat(meterRegistry.getMeters().stream().anyMatch(x -> x.getId().getName().equals(MetricsConstants.TRANSFORMATION_PROCESSING_TIME_METRIC_NAME))).isTrue();
assertThat(meterRegistry.getMeters().stream().anyMatch(x -> x.getId().getName().equals(MetricsConstants.ACTION_PROCESSING_TIME_METRIC_NAME))).isTrue();
}
Aggregations