use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ExecutorTest method testOnEventWithFiltersTransformationAndDifferentRequestedResolvedActions.
@Test
public void testOnEventWithFiltersTransformationAndDifferentRequestedResolvedActions() throws JsonProcessingException {
Set<BaseFilter> filters = new HashSet<>();
filters.add(new StringEquals("data.key", "value"));
String transformationTemplate = "{\"test\": \"{data.key}\"}";
BaseAction requestedAction = new BaseAction();
requestedAction.setType("SendToBridge");
BaseAction resolvedAction = new BaseAction();
resolvedAction.setType(WebhookAction.TYPE);
ProcessorDTO processorDTO = createProcessor(new ProcessorDefinition(filters, transformationTemplate, requestedAction, resolvedAction));
Executor executor = new Executor(processorDTO, filterEvaluatorFactory, transformationEvaluatorFactory, actionProviderFactoryMock, meterRegistry);
CloudEvent cloudEvent = createCloudEvent();
executor.onEvent(cloudEvent);
verify(actionProviderFactoryMock).getInvokableActionProvider(WebhookAction.TYPE);
verify(actionInvokerMock, times(1)).onEvent(any());
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ExecutorTest method testOnEventWithFiltersTransformationAndSameRequestedResolvedActions.
@Test
public void testOnEventWithFiltersTransformationAndSameRequestedResolvedActions() throws JsonProcessingException {
Set<BaseFilter> filters = new HashSet<>();
filters.add(new StringEquals("data.key", "value"));
String transformationTemplate = "{\"test\": \"{data.key}\"}";
BaseAction action = new BaseAction();
action.setType(KafkaTopicAction.TYPE);
ProcessorDTO processorDTO = createProcessor(new ProcessorDefinition(filters, transformationTemplate, action));
Executor executor = new Executor(processorDTO, filterEvaluatorFactory, transformationEvaluatorFactory, actionProviderFactoryMock, meterRegistry);
CloudEvent cloudEvent = createCloudEvent();
executor.onEvent(cloudEvent);
verify(actionProviderFactoryMock).getInvokableActionProvider(KafkaTopicAction.TYPE);
verify(actionInvokerMock).onEvent(any());
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ExecutorTest method testOnEventWithNullTemplate.
@Test
public void testOnEventWithNullTemplate() throws JsonProcessingException {
Set<BaseFilter> filters = new HashSet<>();
filters.add(new StringEquals("data.key", "value"));
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(actionProviderFactoryMock).getInvokableActionProvider(KafkaTopicAction.TYPE);
verify(actionInvokerMock).onEvent(any());
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method createConnectorFailureOnExternalConnectorCreation.
@Test
public void createConnectorFailureOnExternalConnectorCreation() {
Bridge b = createPersistBridge(ManagedResourceStatus.READY);
BaseAction slackAction = createSlackAction();
ProcessorRequest processorRequest = new ProcessorRequest("ManagedConnectorProcessor", slackAction);
doThrow(new InternalPlatformException(createFailureErrorMessageFor("errorDeletingConnector"), new RuntimeException("error"))).when(connectorsApiClient).deleteConnector(anyString());
Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), processorRequest);
waitForProcessorAndConnectorToFail(processor);
}
use of com.redhat.service.bridge.infra.models.actions.BaseAction in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorServiceTest method createSlackAction.
private BaseAction createSlackAction() {
BaseAction mcAction = new BaseAction();
mcAction.setType(SlackAction.TYPE);
Map<String, String> parameters = mcAction.getParameters();
parameters.put("channel", "channel");
parameters.put("webhookUrl", "webhook_url");
return mcAction;
}
Aggregations