Search in sources :

Example 56 with Action

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;
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action)

Example 57 with 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;
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action)

Example 58 with 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;
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action)

Example 59 with 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");
}
Also used : Action(com.redhat.service.smartevents.infra.models.gateways.Action) WebhookAction(com.redhat.service.smartevents.processor.actions.webhook.WebhookAction) SlackSource(com.redhat.service.smartevents.processor.sources.slack.SlackSource) Source(com.redhat.service.smartevents.infra.models.gateways.Source) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 60 with Action

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;
}
Also used : MalformedURLException(java.net.MalformedURLException) Action(com.redhat.service.smartevents.infra.models.gateways.Action) WebhookAction(com.redhat.service.smartevents.processor.actions.webhook.WebhookAction) HashMap(java.util.HashMap) GatewayProviderException(com.redhat.service.smartevents.infra.exceptions.definitions.user.GatewayProviderException)

Aggregations

Action (com.redhat.service.smartevents.infra.models.gateways.Action)62 KafkaTopicAction (com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction)23 QuarkusTest (io.quarkus.test.junit.QuarkusTest)23 Test (org.junit.jupiter.api.Test)23 WebhookAction (com.redhat.service.smartevents.processor.actions.webhook.WebhookAction)21 SlackAction (com.redhat.service.smartevents.processor.actions.slack.SlackAction)13 HashMap (java.util.HashMap)13 ProcessorDefinition (com.redhat.service.smartevents.infra.models.processors.ProcessorDefinition)12 Processor (com.redhat.service.smartevents.manager.models.Processor)12 SendToBridgeAction (com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction)12 ProcessorRequest (com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest)9 Source (com.redhat.service.smartevents.infra.models.gateways.Source)7 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)6 BridgeResponse (com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse)6 Bridge (com.redhat.service.smartevents.manager.models.Bridge)6 TestSecurity (io.quarkus.test.security.TestSecurity)6 ProcessorResponse (com.redhat.service.smartevents.manager.api.models.responses.ProcessorResponse)5 Response (io.restassured.response.Response)5 ProcessorDTO (com.redhat.service.smartevents.infra.models.dto.ProcessorDTO)4 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)4