use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SendToBridgeActionValidatorTest method actionWith.
private Action actionWith(Map<String, String> params) {
Action action = actionWithNullParams();
action.setMapParameters(params);
return action;
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SlackActionValidatorTest method actionWith.
private Action actionWith(Map<String, String> params) {
Action action = new Action();
action.setType(SlackAction.TYPE);
action.setMapParameters(params);
return action;
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class WebhookActionValidatorTest method actionWith.
private static Action actionWith(Map<String, String> params) {
Action action = new Action();
action.setType(WebhookAction.TYPE);
action.setMapParameters(params);
return action;
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SourceResolverTest method testActionWithoutBridgeId.
@Test
void testActionWithoutBridgeId() {
Source inputSource = createSlackSource();
Action resolvedAction = resolver.resolve(inputSource, CUSTOMER_ID, BRIDGE_ID, PROCESSOR_ID);
assertThat(resolvedAction).isNotNull();
assertThat(resolvedAction.getType()).isEqualTo(WebhookAction.TYPE);
assertThat(resolvedAction.getParameter(WebhookAction.ENDPOINT_PARAM)).isEqualTo(BRIDGE_ENDPOINT);
assertThat(resolvedAction.getParameter(WebhookAction.USE_TECHNICAL_BEARER_TOKEN_PARAM)).isEqualTo("true");
}
use of com.redhat.service.smartevents.infra.models.gateways.Action in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class SendToBridgeActionResolver method resolve.
@Override
public Action resolve(Action action, String customerId, String bridgeId, String processorId) {
String destinationBridgeId = action.getParameterOrDefault(SendToBridgeAction.BRIDGE_ID_PARAM, bridgeId);
Map<String, String> parameters = new HashMap<>();
try {
String bridgeEndpoint = gatewayConfiguratorService.getBridgeEndpoint(destinationBridgeId, customerId);
String bridgeWebhookUrl = getBridgeWebhookUrl(bridgeEndpoint);
parameters.put(WebhookAction.ENDPOINT_PARAM, bridgeWebhookUrl);
parameters.put(WebhookAction.USE_TECHNICAL_BEARER_TOKEN_PARAM, "true");
} catch (MalformedURLException e) {
throw new GatewayProviderException("Can't find events webhook for bridge " + destinationBridgeId);
}
Action transformedAction = new Action();
transformedAction.setType(WebhookAction.TYPE);
transformedAction.setMapParameters(parameters);
return transformedAction;
}
Aggregations