use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class KafkaTopicActionTest 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.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class WebhookActionTest method createProcessorWithParameterlessAction.
private ProcessorDTO createProcessorWithParameterlessAction() {
BaseAction action = new BaseAction();
action.setType(WebhookAction.TYPE);
Map<String, String> params = new HashMap<>();
action.setParameters(params);
ProcessorDTO processor = new ProcessorDTO();
processor.setId("myProcessor");
processor.setDefinition(new ProcessorDefinition(null, null, action));
processor.setBridgeId("myBridge");
return processor;
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class WebhookActionValidatorTest method assertIsValid.
private void assertIsValid(String endpoint) {
BaseAction action = createActionWithEndpoint(endpoint);
ValidationResult validationResult = validator.isValid(action);
assertThat(validationResult.isValid()).isTrue();
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class WebhookActionValidatorTest method assertIsInvalid.
private void assertIsInvalid(String endpoint, String errorMessage, Map<String, String> params) {
BaseAction action = createActionWithEndpoint(endpoint);
params.forEach((k, v) -> action.getParameters().put(k, v));
ValidationResult validationResult = validator.isValid(action);
assertThat(validationResult.isValid()).isFalse();
assertThat(validationResult.getMessage()).startsWith(errorMessage);
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ExecutorTest method testOnEventWithNoMatchingFilters.
@Test
public void testOnEventWithNoMatchingFilters() throws JsonProcessingException {
Set<BaseFilter> filters = new HashSet<>();
filters.add(new StringEquals("data.key", "notTheValue"));
BaseAction action = new BaseAction();
action.setType(KafkaTopicAction.TYPE);
ProcessorDTO processorDTO = createProcessor(new ProcessorDefinition(filters, null, action));
Executor executor = new Executor(processorDTO, filterEvaluatorFactory, transformationEvaluatorFactory, actionProviderFactoryMock, meterRegistry);
CloudEvent cloudEvent = createCloudEvent();
executor.onEvent(cloudEvent);
verify(actionInvokerMock, never()).onEvent(any());
}
Aggregations